WongKinYiu / yolor

implementation of paper - You Only Learn One Representation: Unified Network for Multiple Tasks (https://arxiv.org/abs/2105.04206)
GNU General Public License v3.0
1.99k stars 517 forks source link

RuntimeError: Sizes of tensors must match except in dimension 2. Got 28 and 27 (The offending index is 0) #229

Open GMN23362 opened 2 years ago

GMN23362 commented 2 years ago

Any help will be so appreciated!

blitzkz23 commented 2 years ago

I seem to run into this exact same problem when trying to inference using a webcam

blitzkz23 commented 2 years ago

I got similar issue while running inference on cams. you could just try different image size(usually one of these three works:1280,640,320). I guess it must be something with tensor splitting or resizing.

Ah yes, I second this. I've figured out the reason back then but I forgot to rep back on this issue. For me, It's because my webcam resolution is 640x360 so I need to pass the --img-size 640 to the parameter in order for it to work.

yang-0201 commented 2 years ago

change datasets.py function letterbox(auto = True) into letterbox(auto = False),can inference all pictures in 1280 scale