You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been attempting to save segments to an in-memory numpy array by leaving the 'output' variable as None in my code when running the generate function with the SamGeo object. Here is some of my code for an example:
When I do this, the variable 'segmentation' returns None. After some debugging the samgeo.py script, I found where this error is coming from. Line 225 through 229 only calls the 'save_segments' function if the argument 'output' is not None. This seemed a little silly since 'output' defaults to None.
Anyways, I found the bug and fixed it by changing the code in lines 225 through 229 from this:
if output is not None:
# Save the masks to the output path. The output is either a binary mask or a mask of objects with unique values.
self.save_masks(
output, foreground, unique, erosion_kernel, mask_multiplier, **kwargs
)
to this:
Save the masks to the output path. The output is either a binary mask or a mask of objects with unique values.
Environment Information
Description
I've been attempting to save segments to an in-memory numpy array by leaving the 'output' variable as None in my code when running the generate function with the SamGeo object. Here is some of my code for an example:
sam_kwargs = {
"points_per_side": 70,
"pred_iou_thresh": 0.9,
"stability_score_thresh": 0.92,
"crop_n_layers": 1,
"crop_n_points_downscale_factor": 2,
"min_mask_region_area": 80,
}
sam.generate(source=image[:,:,:3], foreground=False, unique=True, batch=False)
segmentation = sam.objects
When I do this, the variable 'segmentation' returns None. After some debugging the samgeo.py script, I found where this error is coming from. Line 225 through 229 only calls the 'save_segments' function if the argument 'output' is not None. This seemed a little silly since 'output' defaults to None.
Anyways, I found the bug and fixed it by changing the code in lines 225 through 229 from this:
if output is not None:
# Save the masks to the output path. The output is either a binary mask or a mask of objects with unique values.
self.save_masks(
output, foreground, unique, erosion_kernel, mask_multiplier, **kwargs
)
to this:
Save the masks to the output path. The output is either a binary mask or a mask of objects with unique values.
The text was updated successfully, but these errors were encountered: