ChaoningZhang / MobileSAM

This is the official code for MobileSAM project that makes SAM lightweight for mobile applications and beyond!
Apache License 2.0
4.86k stars 505 forks source link

Can the image size only be 1024X1024? #142

Open zhongniuniu opened 8 months ago

zhongniuniu commented 8 months ago

Can the image size only be 1024?

zhongniuniu commented 8 months ago

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

Kaiqi-Chen commented 3 months ago

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

zhongniuniu commented 3 months ago

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.