HowieMa / DeepSORT_YOLOv5_Pytorch

DeepSORT + YOLOv5
332 stars 64 forks source link

TypeError: load() missing 1 required positional argument: 'Loader' #7

Closed fatbringer closed 2 years ago

fatbringer commented 2 years ago

Hello. I am trying to run your programme after installing pip install -r requirements.txt However, i have ran into an error "TypeError: load() missing 1 required positional argument: 'Loader'"

This is the full output:

$ python main.py --cam 0 --display
Namespace(agnostic_nms=False, augment=False, cam=0, classes=[0], conf_thres=0.5, config_deepsort='./configs/deep_sort.yaml', device='', display=True, display_height=600, display_width=800, fourcc='mp4v', frame_interval=2, img_size=640, input_path='input_480.mp4', iou_thres=0.5, save_path='output/', save_txt='output/predict/', weights='yolov5/weights/yolov5s.pt')
Initialize DeepSORT & YOLO-V5
Using CPU

Using webcam 0
Traceback (most recent call last):
  File "main.py", line 259, in <module>
    with VideoTracker(args) as vdo_trk:
  File "main.py", line 53, in __init__
    cfg.merge_from_file(args.config_deepsort)
  File "/home/dji/Desktop/targetTrackers/howieMa/DeepSORT_YOLOv5_Pytorch/utils_ds/parser.py", line 23, in merge_from_file
    self.update(yaml.load(fo.read()))
TypeError: load() missing 1 required positional argument: 'Loader'

I have found some suggestions on github, such as in here https://stackoverflow.com/questions/69564817/typeerror-load-missing-1-required-positional-argument-loader-in-google-col, which suggests to change yaml.load to yaml.safe_load

However, doing so leads me to this error instead


$ python main.py --cam 0 --display
Namespace(agnostic_nms=False, augment=False, cam=0, classes=[0], conf_thres=0.5, config_deepsort='./configs/deep_sort.yaml', device='', display=True, display_height=600, display_width=800, fourcc='mp4v', frame_interval=2, img_size=640, input_path='input_480.mp4', iou_thres=0.5, save_path='output/', save_txt='output/predict/', weights='yolov5/weights/yolov5s.pt')
Initialize DeepSORT & YOLO-V5
Using CPU

Using webcam 0
Done..
Camera ...
Done. Create output file  output/results.mp4
Illegal instruction (core dumped)

Has anyone encountered anything similar ? Thank you !

fatbringer commented 2 years ago

Hi i asked this question on stackoverflow and had gotten the answer.

Here is the linked, with solution quoted. Someone else had answered. I shall not take credit for this. https://stackoverflow.com/questions/69849870/typeerror-load-missing-1-required-positional-argument-loader/69923655#69923655

yaml.load(fo.read(), Loader=yaml.FullLoader)

Because It seems that pyyaml>=5.1 requires a Loader argument.

sunnykim2021 commented 2 years ago

it works ,good comment @fatbringer

blackCmd commented 2 years ago

Hi i asked this question on stackoverflow and had gotten the answer.

Here is the linked, with solution quoted. Someone else had answered. I shall not take credit for this. https://stackoverflow.com/questions/69849870/typeerror-load-missing-1-required-positional-argument-loader/69923655#69923655

yaml.load(fo.read(), Loader=yaml.FullLoader)

Because It seems that pyyaml>=5.1 requires a Loader argument.

Good~! Thank you @fatbringer