Open chyphen777 opened 2 years ago
Are you talking about the sample Object-Detection-using-YOLOv5-and-OpenCV-DNN-in-CPP-and-Python/yolov5.cpp
?
It did not even compile for me, needed to adapt line 168 to make a separate copy/clone, as the method post_process()
expects a non-const-reference.
After this I get a runtime-exception in pre_process()
while net.forward(outputs, net.getUnconnectedOutLayersNames());
:
terminate called after throwing an instance of 'ngraph::NodeValidationFailure'
what(): Check 'PartialShape::broadcast_merge_into( pshape, node->get_input_partial_shape(i), autob)' failed at core/src/op/util/elementwise_args.cpp:40:
While validating node 'v1::Multiply Multiply_546 (470[0]:f32{1,3,80,80,2}, Constant_545[0]:f32{1,38400,1,1,1}) -> (dynamic?)' with friendly_name 'Multiply_546':
Argument shapes are inconsistent.
Can you describe your code-changes, please?
are you using the latest version of OpenCV? I think the code works if the version is > 4.5.4
Sorry! I was using OpenCV in version 4.5.3 (from an OpenVINO v2021.4.2). Using a Python virtual-env, now I'm using v4.5.5 and see the Python version "yolov5.py" working.
I cloned opencv and opencv_contrib from the branch "4.5.5", built it. And can confirm the C++ variant "yolov5.cpp" is working now as well:
But I needed to adapt line 168 to make a separate copy/clone, as the method post_process()
expects a non-const-reference.
I also had to change the line 167 ,,frame.clone()'' to just frame. It worked and i also have Opencv 4.5.4 So this version also runs fine.
Is the C++ version of Object Detection using Yolov5 working? I ran it with sample.jpg and yolov5s.onnx, but it output zero index. (at line 122/123 of yolov5.cpp. Any help will be appreciated.