Zed Examples YoloV5 custom detection needs update

When following the instructions on zed-examples/object detection/custom detector/python/pytorch_yolov5 at master · stereolabs/zed-examples · GitHub we encountered an issue:

The installation went flawlessly but there seems to be an incompatibility issue with the newest version (commit #10220 SHA: 6992dde4bd628f6bffe7d4c5025afadf79ed679b of yoloV5:

When executing python detector.py with the specified parameters, we encountered:

ImportError: cannot import name ‘scale_coords’ from ‘utils.general’

The detection window did not open.

In some version of yoloV5, presumably commit #9570 on Sept. 24 2022:

“new scale_segments() function” the scale_coords function was changed to the scale_segments function. We tried earlier commits which at least opened the detection window but with a black screen and further issues arose:

“/home/(my paths)…/yolov5/detector.py”, line 100, in torch_thread
model = attempt_load(weights, map_location=device) # load FP32
TypeError: attempt_load() got an unexpected keyword argument ‘map_location’

The attempt_load() function apparently does not accept this argument.
We went down the road of even older commits but at one point there was an issue with the pytorch version, because the yoloV5 repo we chose was so old.

If you have any help or further questions please do not hesitate to ask. We think that an updated version of detector.py might fix the problem.

Thank you!!

Hello, thank you for the notice. We’ll check this out.

Antoine

1 Like

Thank you! FYI I think I forgot to mention that we use linux (pop!_OS), but you probably recognized it was linux from the Folder path.

Moritz