Open msverma101 opened 1 year ago
Encoder is pretty large and wont run on any cpu, try using gpu
yeah automatic mask generator is pretty slow, there are few things you can try 1) resize your image to a smaller image and then resize the masks that you got back to original image 2) use smaller model 3) try manually passing 32x32 = 1024 points in batches of say 128 or 256, you will get masks pretty quickly using this. After that remove duplicate / near duplicate masks, put iou thresholding, in my case all this look 6s for 3000 x 3000 images. And the results were more than satisfactory in my case. 3rd point will be particularly helpful in you are trying to segment particular object/ objects in your image
https://github.com/ByungKwanLee/Full-Segment-Anything addresses the ciritical issues of SAM, which supports batch-input on the full-grid prompt (automatic mask generation) with post-processing: removing duplicated or small regions and holes, under flexible input image size
yeah automatic mask generator is pretty slow, there are few things you can try
- resize your image to a smaller image and then resize the masks that you got back to original image
- use smaller model
- try manually passing 32x32 = 1024 points in batches of say 128 or 256, you will get masks pretty quickly using this. After that remove duplicate / near duplicate masks, put iou thresholding, in my case all this look 6s for 3000 x 3000 images. And the results were more than satisfactory in my case. 3rd point will be particularly helpful in you are trying to segment particular object/ objects in your image
@lavishchauhan321 would you mind elaborating on this a bit more? Do you use the built-in tools for thresholding or something like OpenCV? Also, do you happen to know what bottleneck you're removing in the Generator tool when switching to a Generator-like tool via the Predictor tool that allows for such an increase in speed?
i used the following setup and it is really slow to generate the mask it took almost 8 minutes
vit_b, sam_vit_b_01ec64.pth and a simple image of size 5.9mb
can you tell me what i can do to reduce this time