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.
HI there! i am facing the similar issue with the detector.py which is
ImportError: cannot import name ‘scale_coords’ from ‘utils.general’
as someone mentioned in this post, after scale_coords changes to scale_segments still there are problems arose. did anyone solve detector.py errors without any problem ? if yes please feel free to suggest me.
My task is to track the objects along with their 3D information using Zed-2i. if anyone has any idea how it can be achieved please share your inputs.
Thank you
Parvathi
This is the actual solution. It’s difficult for us to follow every version of every yolov(x), so we have to stay at a specific commit. The problem is, the documentation seems better on the C++ sample, sorry for that. We’ll improve the python documentation.
Hello, can you be more specific about the exact yolov5 branch that worked for your python code? I’ve tried a few but always had mismatches in the interpreter or a blank screen in a window.
Thank you for the information and for helping out.
Sorry for the late response…
Verified on linux and jetson SDK computers.
Many thanks for the tips to every one of this chain.
momi193, your tip on the link to the code is great!