Yolov5-deepsort-inference icon indicating copy to clipboard operation
Yolov5-deepsort-inference copied to clipboard

error

Open snaki40 opened this issue 3 years ago • 9 comments

RuntimeError: "unfolded2d_copy" not implemented for 'Half'

snaki40 avatar Feb 17 '21 19:02 snaki40

也是这个报错 E:\coding\图像识别\Yolov5-deepsort-inference-master\Yolov5-deepsort-inference-master\deep_sort\utils\parser.py:23: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. self.update(yaml.load(fo.read())) Fusing layers... fps: 25 Traceback (most recent call last): File "demo.py", line 54, in main() File "demo.py", line 28, in main result = det.feedCap(im, func_status) File "E:\coding\图像识别\Yolov5-deepsort-inference-master\Yolov5-deepsort-inference-master\utils\BaseDetector.py", line 35, in feedCap im, faces, face_bboxes = update_tracker(self, im) File "E:\coding\图像识别\Yolov5-deepsort-inference-master\Yolov5-deepsort-inference-master\tracker.py", line 42, in update_tracker _, bboxes = target_detector.detect(image) File "E:\coding\图像识别\Yolov5-deepsort-inference-master\Yolov5-deepsort-inference-master\AIDetector_pytorch.py", line 47, in detect pred = self.m(img, augment=False)[0] File "C:\Users\acer\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl result = self.forward(*input, **kwargs) File "E:\coding\图像识别\Yolov5-deepsort-inference-master\Yolov5-deepsort-inference-master\models\yolo.py", line 112, in forward return self.forward_once(x, profile) # single-scale inference, train File "E:\coding\图像识别\Yolov5-deepsort-inference-master\Yolov5-deepsort-inference-master\models\yolo.py", line 128, in forward_once x = m(x) # run File "C:\Users\acer\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl result = self.forward(*input, **kwargs) File "E:\coding\图像识别\Yolov5-deepsort-inference-master\Yolov5-deepsort-inference-master\models\common.py", line 90, in forward return self.conv(torch.cat([x[..., ::2, ::2], x[..., 1::2, ::2], x[..., ::2, 1::2], x[..., 1::2, 1::2]], 1)) File "C:\Users\acer\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl result = self.forward(*input, **kwargs) File "E:\coding\图像识别\Yolov5-deepsort-inference-master\Yolov5-deepsort-inference-master\models\common.py", line 34, in fuseforward return self.act(self.conv(x)) File "C:\Users\acer\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl result = self.forward(*input, **kwargs) File "C:\Users\acer\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\nn\modules\conv.py", line 423, in forward return self._conv_forward(input, self.weight) File "C:\Users\acer\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\nn\modules\conv.py", line 420, in _conv_forward self.padding, self.dilation, self.groups) RuntimeError: "unfolded2d_copy" not implemented for 'Half'

maxtorgithub avatar Feb 18 '21 05:02 maxtorgithub

似乎是CUDA错误?

Sharpiless avatar Feb 19 '21 04:02 Sharpiless

python3.8也出现这个问题

F:\Download\Yolov5-deepsort-inference-master\Yolov5-deepsort-inference-master\deep_sort\utils\parser.py:23: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  self.update(yaml.load(fo.read()))
Fusing layers...
fps: 16
Traceback (most recent call last):
  File "demo.py", line 54, in <module>
    main()
  File "demo.py", line 28, in main
    result = det.feedCap(im, func_status)
  File "F:\Download\Yolov5-deepsort-inference-master\Yolov5-deepsort-inference-master\utils\BaseDetector.py", line 35, in feedCap
    im, faces, face_bboxes = update_tracker(self, im)
  File "F:\Download\Yolov5-deepsort-inference-master\Yolov5-deepsort-inference-master\tracker.py", line 42, in update_tracker
    _, bboxes = target_detector.detect(image)
  File "F:\Download\Yolov5-deepsort-inference-master\Yolov5-deepsort-inference-master\AIDetector_pytorch.py", line 50, in detect
    pred = self.m(img, augment=False)[0]
  File "C:\Users\yangqike\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "F:\Download\Yolov5-deepsort-inference-master\Yolov5-deepsort-inference-master\models\yolo.py", line 112, in forward
    return self.forward_once(x, profile)  # single-scale inference, train
  File "F:\Download\Yolov5-deepsort-inference-master\Yolov5-deepsort-inference-master\models\yolo.py", line 128, in forward_once
    x = m(x)  # run
  File "C:\Users\yangqike\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "F:\Download\Yolov5-deepsort-inference-master\Yolov5-deepsort-inference-master\models\common.py", line 90, in forward
    return self.conv(torch.cat([x[..., ::2, ::2], x[..., 1::2, ::2], x[..., ::2, 1::2], x[..., 1::2, 1::2]], 1))
  File "C:\Users\yangqike\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "F:\Download\Yolov5-deepsort-inference-master\Yolov5-deepsort-inference-master\models\common.py", line 34, in fuseforward
    return self.act(self.conv(x))
  File "C:\Users\yangqike\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "C:\Users\yangqike\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\nn\modules\conv.py", line 423, in forward
    return self._conv_forward(input, self.weight)
  File "C:\Users\yangqike\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\nn\modules\conv.py", line 419, in _conv_forward
    return F.conv2d(input, weight, self.bias, self.stride,
RuntimeError: "unfolded2d_copy" not implemented for 'Half'

yang7ke avatar Feb 19 '21 11:02 yang7ke

pip3 install torch==1.7.0+cu101 torchvision==0.8.1+cu101 torchaudio===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html 参考文章中安装方法,没有这个问题了

maxtorgithub avatar Feb 20 '21 03:02 maxtorgithub

pip3 install torch==1.7.0+cu101 torchvision==0.8.1+cu101 torchaudio===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html 参考文章中安装方法,没有这个问题了

我用Python3.8成功安装了你推荐的这个,可还是出现相同的报错。

yang7ke avatar Feb 21 '21 11:02 yang7ke

我的环境为:1.7.0+cu101+python3.7.9,该环境没问题,

Sharpiless avatar Feb 24 '21 02:02 Sharpiless

项目文件夹cmd打开 在cmd中直接conda activate torch107激活环境 然后python demo.py就可以了

JingyibySUTsoftware avatar Mar 06 '21 03:03 JingyibySUTsoftware

cpu下torch不支持半精度,所以half() 出现的地方需要修改为float。

sssssshf avatar Dec 12 '22 07:12 sssssshf

@sssssshf 感谢!直接将AIDetector_pytorch.py文件里面的half()全部替换为float()就可以了

Picaun avatar May 30 '23 04:05 Picaun