owo12321 / Yolov5_DeepSort_Traffic-counter

基于Yolov5_DeepSort的物体计数器,可以统计车流或人流量等
190 stars 31 forks source link

请问为什么会这样报错 #7

Open CLM10079 opened 2 years ago

CLM10079 commented 2 years ago

Traceback (most recent call last): File "C:\Users\10079\Desktop\Yolov5_DeepSort_Traffic-counter-main\count.py", line 457, in detect(args) File "C:\Users\10079\Desktop\Yolov5_DeepSort_Traffic-counter-main\count.py", line 288, in detect pred = model(img, augment=opt.augment)[0] File "C:\Users\10079\miniconda3\envs\car\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl return forward_call(*input, *kwargs) File "./yolov5\models\yolo.py", line 117, in forward return self.forward_once(x, profile) # single-scale inference, train File "./yolov5\models\yolo.py", line 148, in forward_once x = m(x) # run File "C:\Users\10079\miniconda3\envs\car\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl return forward_call(input, **kwargs) File "C:\Users\10079\miniconda3\envs\car\lib\site-packages\torch\nn\modules\upsampling.py", line 154, in forward recompute_scale_factor=self.recompute_scale_factor) File "C:\Users\10079\miniconda3\envs\car\lib\site-packages\torch\nn\modules\module.py", line 1207, in getattr raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor'

Process finished with exit code 1

owo12321 commented 2 years ago

Traceback (most recent call last): File "C:\Users\10079\Desktop\Yolov5_DeepSort_Traffic-counter-main\count.py", line 457, in detect(args) File "C:\Users\10079\Desktop\Yolov5_DeepSort_Traffic-counter-main\count.py", line 288, in detect pred = model(img, augment=opt.augment)[0] File "C:\Users\10079\miniconda3\envs\car\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl return forward_call(*input, *kwargs) File "./yolov5\models\yolo.py", line 117, in forward return self.forward_once(x, profile) # single-scale inference, train File "./yolov5\models\yolo.py", line 148, in forward_once x = m(x) # run File "C:\Users\10079\miniconda3\envs\car\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl return forward_call(input, kwargs) File "C:\Users\10079\miniconda3\envs\car\lib\site-packages\torch\nn\modules\upsampling.py", line 154, in forward recompute_scale_factor=self.recompute_scale_factor) File "C:\Users\10079\miniconda3\envs\car\lib\site-packages\torch\nn\modules\module.py", line 1207, in getattr** raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor'

Process finished with exit code 1

我没遇到过这个问题,看网上的应该是pytorch版本的问题吧。参考以下文章:
https://zhuanlan.zhihu.com/p/536044061
https://blog.csdn.net/qq_35207086/article/details/123879980

CLM10079 commented 2 years ago

成功了,谢谢您。再请问这个项目默认是使用CPU进行的吗

owo12321 commented 2 years ago

成功了,谢谢您。再请问这个项目默认是使用CPU进行的吗

不是,默认使用cuda

CLM10079 commented 2 years ago

成功了,谢谢您。再问这个项目默认是使用 CPU 进行的吗?

不是,默认使用cuda

我运行起来CPU飙升,有时间我再看一看,再次感谢您

owo12321 commented 2 years ago

成功了,谢谢您。再问这个项目默认是使用 CPU 进行的吗?

不是,默认使用cuda

我运行起来CPU飙升,有时间我再看一看,再次感谢您

在count.py里第241行打印了使用的设备,可以注意看一下