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 521 forks source link

Failed to inference with webcam streams #62

Closed siyangxie closed 3 years ago

siyangxie commented 3 years ago

Hi, I'm trying to run this project with webcam streams and got this error message:

Traceback (most recent call last):
  File "detect.py", line 186, in <module>
    detect()
  File "detect.py", line 85, in detect
    pred = model(img, augment=opt.augment)[0]
  File "/home/xiesiyang/anaconda3/envs/yolor/lib/python3.6/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/xiesiyang/workspace/yolor/models/models.py", line 543, in forward
    return self.forward_once(x)
  File "/home/xiesiyang/workspace/yolor/models/models.py", line 594, in forward_once
    x = module(x, out)  # WeightedFeatureFusion(), FeatureConcat()
  File "/home/xiesiyang/anaconda3/envs/yolor/lib/python3.6/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/xiesiyang/workspace/yolor/utils/layers.py", line 69, in forward
    return torch.cat([outputs[i] for i in self.layers], 1) if self.multiple else outputs[self.layers[0]]
RuntimeError: Sizes of tensors must match except in dimension 2. Got 24 and 23 (The offending index is 0)
terminate called without an active exception
Aborted (core dumped)
WongKinYiu commented 3 years ago

image size should be 64x.

rusvagzur commented 2 years ago

@WongKinYiu @siyangxie This exactly happened to me as well and this worked. However, how could I make a videostream work with 1280?