MobileSAM icon indicating copy to clipboard operation
MobileSAM copied to clipboard

Can the image size only be 1024X1024?

Open zhongniuniu opened this issue 11 months ago • 3 comments

Can the image size only be 1024?

zhongniuniu avatar Mar 07 '24 08:03 zhongniuniu

When I try to change the image size, it gives the following error: Traceback (most recent call last): File "model_proxy_SAM.py", line 396, in out = model(x) File "/public2/zhongyutian/zhongyutian/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl return forward_call(*input, **kwargs) File "model_proxy_SAM.py", line 322, in forward out = self.sam.image_encoder(x) File "/public2/zhongyutian/zhongyutian/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl return forward_call(*input, **kwargs) File "/public2/zhongyutian/AutoSAM-main/mobilemodels/mobile_encoder/tiny_vit_sam.py", line 617, in forward x = self.forward_features(x) File "/public2/zhongyutian/AutoSAM-main/mobilemodels/mobile_encoder/tiny_vit_sam.py", line 609, in forward_features x = layer(x) File "/public2/zhongyutian/zhongyutian/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl return forward_call(*input, **kwargs) File "/public2/zhongyutian/AutoSAM-main/mobilemodels/mobile_encoder/tiny_vit_sam.py", line 439, in forward x = blk(x) File "/public2/zhongyutian/zhongyutian/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl return forward_call(*input, **kwargs) File "/public2/zhongyutian/AutoSAM-main/mobilemodels/mobile_encoder/tiny_vit_sam.py", line 336, in forward assert L == H * W, "input feature has wrong size" AssertionError: input feature has wrong size

zhongniuniu avatar Mar 07 '24 08:03 zhongniuniu

@zhongniuniu hi, bro. Did you solve the problem? I also want to segment the different sizes of the images.

Kaiqi-Chen avatar Aug 14 '24 19:08 Kaiqi-Chen

I still can't enter an image with a size other than 1024. I had to resize my individual image to 1024 to run it successfully.

zhongniuniu avatar Aug 15 '24 07:08 zhongniuniu