Using opencv 4.7.0 for object detection, run the following inference:
…
ReadNetFromONNX (…)
Net. setPreferableBackend (DNN_BackEND-CUDA);
Net. setPreferableTarget (DNN_TARGetCUDA);
Net. setInput (blob);
Net. forward (outs, this. unconnectedOutLayersName);
…
The returned inference result is correct, and the coordinates, width, height, and confidence of each box are all correct.
But using opencv4.9.0 for inference, each box has a confidence level, but the coordinates and width and height are both 0.0
why? help me
without a link to your model I don’t know how to help you.
It’s not a problem with the model, any onnx model can trigger this bug.
Wait. Somebody certainly can solve your problem without model…
It’s not the same question
The inference results of the ONNX model differ between GPU inference and CPU inference
and
Using dnn+onnx in opencv4.9 outs error
but may be it’s the same user
It’s the same problem.
The same model, the same code (dnn+onnx+cuda), the same image to be inspected, but changing opencv4.7 to opencv4.9, the inference result will lose the target box coordinates and width and height.