facebookresearch/segment-anything

https://segment-anything.com/demo is working fine. But my local scripts/amg.py is not working as well as https://segment-anything.com/demo

tugsjargal1 opened this issue · 3 comments

Dear all,

I am really happy to know this amazing library is existing and you guys created it. Much appreciate.
My case is strange. I am going to try to explain my issue on below:

  1. This is my original image that I wanted to segment:
original-image
  1. My goal is to segment polygon shape where is placed at the center. I use Macbook M1 chip. So, CUDA is not supported in my case.

python scripts/amg.py --device cpu --checkpoint ../checkpoints/sam_vit_h_4b8939.pth --model-type vit_h --output metadata --input original-image.png

Here is my metadata: [
metadata.zip
]

I got below shape at least. Because it is very differenciatable than other shapes. But this one is not what I want to get.
2

This is what I want to get from the image:
original-image-to-achieve

  1. When I upload this original-image.png to https://segment-anything.com/demo# and selected "Everything", seems that "Everything" option is working fine:
Screenshot 2024-04-05 at 17 19 30

How I can work segment-anything as https://segment-anything.com/demo# with "Everything" option on my local environment ?

Do you have any suggestions in my case ?

Thanks in advance!
Much appreciate any help.

I feel the model they have on the website is different from the model they have open sourced for the code. I am also currently in the same boat where I am unable to identically reproduce the same results as the demo

The demo also uses the same vit_h model but the parameters that they use are different and I don't think they have open-sourced it.

I would refer to the following comment , I was able to improve my segment everything results by modifying these two parameters crop_n_layers=1, and crop_n_points_downscale_factor=2,

Hi @krishnaadithya, Thanks for your suggestion. I tried by changing parameters crop_n_layers=1, and crop_n_points_downscale_factor=2. But still no luck.

Do you suggest change other parameters ?

Thanks.