sam-hq icon indicating copy to clipboard operation
sam-hq copied to clipboard

Input resolution - target size

Open bhack opened this issue 1 year ago • 5 comments

Is there a way to control the input size? Do we need to enforce scaling the encoder expected resolution?

bhack avatar Jun 14 '23 16:06 bhack

Hi, we follow SAM and using the input size 1024. If you want to change input size, please see the discussion here. Usually we suggest to resize your image to standard input size required by the model and then resize the predicted masks to any resolution you want.

lkeab avatar Jun 15 '23 01:06 lkeab

Resizing it is not working well with large images with small targets.

https://github.com/SysCV/sam-hq/blob/ca530af6d6c8717e33704b07f4f3c6c8e778b0ff/segment_anything/predictor.py#LL31C26-L31C43

Skipping the resizing on ResizeLongestSide it is working well instead but then the output mask is unaligned to the RGB source.

Can we make this more flexible?

bhack avatar Jun 15 '23 02:06 bhack

Were you able to solve this issue? I want to resize the output masks back to original image shape and I'm not seeing where I should put this code

nikky4D avatar Sep 05 '23 18:09 nikky4D

Not I still had that issue.

bhack avatar Sep 05 '23 18:09 bhack

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

ByungKwanLee avatar Oct 13 '23 21:10 ByungKwanLee