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
46.95k stars 5.56k forks source link

Different scales of images have different execution effects. How to obtain more detailed results on a high-resolution image #335

Open GuaGod opened 1 year ago

GuaGod commented 1 year ago

image When I upload a high-resolution image, the segmentation result is not accurate at the contour image But when I upload a slice, the segmentation results become accurate.How can I achieve the same results?

spullara commented 1 year ago

I'd find small objects on the main image and then take a crop of that part of the image 1k x 1k (the image encoder size) to get a more refined result for those objects.

GuaGod commented 1 year ago

I'd find small objects on the main image and then take a crop of that part of the image 1k x 1k (the image encoder size) to get a more refined result for those objects.

So do I still need to manually search for small objects in the main image, and how to merge these finer contours back into the original main image

GuaGod commented 1 year ago

image You can try to tune some parameters in the SamAutomaticMaskGenerator, such as pred_iou_thresh and stalility_score_thresh.And there are some improvement when I set lower value at them.