facebookresearch / segment-anything

The repository provides code for running inference with the SegmentAnything Model (SAM), links for downloading the trained model checkpoints, and example notebooks that show how to use the model.
Apache License 2.0
47.8k stars 5.65k forks source link

Did the official demo use better model than vit_h model? #347

Open zxj7b80 opened 1 year ago

zxj7b80 commented 1 year ago

When I provide multiply points for the model sam_vit_h_4b8939.pth, bad result occurs. It's different from the official demo 'https://segment-anything.com/demo'. In official demo, better segment result occurs with more points prompt. So I wonder whether the official demo used better model than sam_vit_h_4b8939.pth.

githublqs commented 1 year ago

I also have this question https://github.com/facebookresearch/segment-anything/issues/346

AlexLee1235 commented 1 year ago

In my case, when I prompt it iteratively (add one point a time and use old mask as prompt), it's result is more like the web demo.

for i in range(1,len(samPoints)): masks, scores, logits = predictor.predict( point_coords = np.array(samPoints[0:i]), point_labels = np.array(pointFlag[0:i]), mask_input = prev[None, :, :] if i > 1 else None, multimask_output = False, ) prev = logits[np.argmax(scores), :, :]

sunsunnyshine commented 1 year ago

I'm confused too!! The later is the demo result. image image

sunsunnyshine commented 1 year ago

I use the iterative prompt,and got this. The result has improved slightly, but it still doesn't meet the requirements compared to the demo. image It seems like less point bright better results?? image

sunsunnyshine commented 1 year ago

In my case, when I prompt it iteratively (add one point a time and use old mask as prompt), it's result is more like the web demo.

for i in range(1,len(samPoints)): masks, scores, logits = predictor.predict( point_coords = np.array(samPoints[0:i]), point_labels = np.array(pointFlag[0:i]), mask_input = prev[None, :, :] if i > 1 else None, multimask_output = False, ) prev = logits[np.argmax(scores), :, :]

Hello, may I ask how the result looks after this processing? If you could provide a visual representation, I would greatly appreciate it!

JI4JUN commented 12 months ago

following

315386775 commented 10 months ago

following

Gi-gigi commented 1 month ago

@AlexLee1235

In my case, when I prompt it iteratively (add one point a time and use old mask as prompt), it's result is more like the web demo.

for i in range(1,len(samPoints)): masks, scores, logits = predictor.predict( point_coords = np.array(samPoints[0:i]), point_labels = np.array(pointFlag[0:i]), mask_input = prev[None, :, :] if i > 1 else None, multimask_output = False, ) prev = logits[np.argmax(scores), :, :]

Hi friend, thank you very much for your guidance and advice. However, I have a few questions I'd like to ask:

Are the samPoints something you customized? If they are customized, how should I modify the code to iteratively feed the points into the model? I'd appreciate your guidance, and I would be very grateful if you could provide it.