Closed imneonizer closed 2 months ago
Thanks for your interest! The predictor.py has just been updated, please try again. You can achieve automatic mask generation by code below:
mask_generator = SamAutomaticMaskGenerator(model)
image = cv2.imread('demo_images/blur.jpg')
masks = mask_generator.generate(image)
for i in range(len(masks)): # save the mask results
mask = ((masks[i]['segmentation'])*255).astype(np.uint8)
cv2.imwrite('mask_{}.jpg'.format(str(i).zfill(2)), mask)
Thanks the issue is resolved now, however I found out it is not very much useful for my use case i.e., Field Delineation on Sentinel-2 Images with 10m resolution, those images are too much blurry. I wonder if you would be releasing code to finetune the model for such use cases.
Here is the driver code:
Error:
On further investigation, I found this https://github.com/robustsam/RobustSAM/blob/main/robust_segment_anything/predictor.py#L230-L236 which is not passing the
encoder_features
which is a required param for mask decoder here: https://github.com/robustsam/RobustSAM/blob/main/robust_segment_anything/modeling/mask_decoder.py#L98C9-L117 Interestingly#TODO
is mentioned for that param aswell.