Open hanifizzudinrahman opened 1 year ago
I am getting the same error as well.
After installing all the libraries in requirement.txt of yolov5 and deepsort, we run the command python main.py --cam 0
and get the error as:
Traceback (most recent call last):
File "D:/Projects/yolov5-deepsort/DeepSORT_YOLOv5_Pytorch/main.py", line 259, in
Initialize DeepSORT & YOLO-V5 Using CPU.
Please help.
In the file parser.py in line 34,
if name == "main": cfg = YamlParser(config_file="../configs/yolov3.yaml") cfg.merge_from_file("../configs/deep_sort.yaml")
import ipdb; ipdb.set_trace()
We are creating a cfg object by passing yolov3.yaml in the configs directory. This file is absent in the configs directory. Moreover, we are using yolov5 here. I guess this could be the error here. Will passing the yolov5 yaml file correct this error?
Still getting the same error. Please help.
Still getting the same error. Please help.
hi, i find a method to solve this. as stack-overflow, you can just change load()
to safe_load()
in ./ultils_ds/paser.py line23. OR !pip install pyyaml==5.4.1
.
but other errors still occurs for some module not found, i think maybe requirements.txt
need to be updated. i am try to find a Docker image which could run this repo or build one now.
Replace with this code
def merge_from_file(self, config_file): with open(config_file, 'r') as fo: self.update(yaml.load(fo.read(), Loader=yaml.FullLoader))
File "/root/miniconda3/envs/py38/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl return forward_call(*args, *kwargs) File "/root/MOT/DeepSORT_YOLOv5_Pytorch/yolov5/models/yolo.py", line 109, in forward return self.forward_once(x, profile) # single-scale inference, train File "/root/MOT/DeepSORT_YOLOv5_Pytorch/yolov5/models/yolo.py", line 129, in forward_once x = m(x) # run File "/root/miniconda3/envs/py38/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl return forward_call(args, **kwargs) File "/root/miniconda3/envs/py38/lib/python3.8/site-packages/torch/nn/modules/upsampling.py", line 157, in forward recompute_scale_factor=self.recompute_scale_factor) File "/root/miniconda3/envs/py38/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1614, in getattr raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor'
After modifying the parser, there is still error msg
请在后面加入这个,这是因为yaml文件的加载函数已经更新了。yaml.load(file,Loader=yaml.FullLoader)
replace yaml.load with yaml.safe_load
请问您这个问题解决了吗?