ByungKwanLee / Full-Segment-Anything

This is Pytorch Implementation Code for adding new features in code of Segment-Anything. Here, the features support 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
MIT License
121 stars 9 forks source link

Improve Mask Results #1

Closed user074 closed 8 months ago

user074 commented 8 months ago

First great work to batch process images! Is there anyway to improve the generated mask results? Some of the mask I have does not look so good with my images as what I got from SAM. Maybe I am doing something wrong?

Screenshot 2023-11-20 at 1 34 41 AM Screenshot 2023-11-20 at 1 34 52 AM

And this is from SAM Automatic Mask Generator:

Screenshot 2023-11-20 at 1 35 01 AM
ByungKwanLee commented 8 months ago

I would like to ask: (1) is your original image size is 256? (2) If it is 256, original SAM input is fixed to 1024 but how to propagate 256 resolution in SAM code with automatic mask generator?

user074 commented 8 months ago

Yeah they are. I use the SamAutomaticMaskGenerator and it is able to accept different sizes and I experimented on that. It can accept many non-standard sizes.

user074 commented 8 months ago

Wait I think I find the issue. The way to normalize and preprocess the image really have a lot of affects on the outcome.

ByungKwanLee commented 8 months ago

is the problem you experienced due to my code issue?

user074 commented 8 months ago

No I think it is the SAM model part. Not sure how they normalize their images but it gives better results with their pipeline. Great work by the way! But I probably will use FastSAM since it is much faster than SAM

Ashutosh1995 commented 4 months ago

@user074 were you able to send a custom image size and train the SAM model. What changes did you do? Can you please explain in depth?