Open simoneorlando opened 1 year ago
@simoneorlando For ONNX model, the image ratio need to be kept to prevent shifting result. More details. 1024:684 is the fixed ratio in converted ONNX models.
I use truck.jpg and truck_prompt.json to run onnx demo, change input size from (684,1024) to (1024,1024) not find error.
@vietanhdev I read through the segment-anything tickets 56 and 130, and it looks like the fixed aspect ratio was a bug in the SAM package that has been fixed in SAM PR-58.
Unfortunately, that PR was merged three days after the segment-anything v1.0 package was pushed to PyPi, so by default this will keep happening.
Cloning the SAM repo and installing it with pip install -e .
instead of using the PyPi package specified in the requirements.txt
file, and then re-exporting the weights using samexporter
, seems to have fixed the scaling issue, and the 684 number may no longer be relevant.
(Check my work on this one. Python isn't my native language.)
Not an issue. The code works perfectly for me. I saw the original code expects 1024x1024 image size. So, I was just wondering where the 684 fixed size for height comes from. Thank you