learnopencv
learnopencv copied to clipboard
Can't read .onnx file in c++
Hi,
opencv version : tried opencv-4.5.5 & opencv-4.6 but got the same error.
I'm trying the same c++ code from the repo, but I have an error in the line net = readNet("yolo5n.onnx"); :
// Load model.
Net net;
net = readNet("yolo5n.onnx");
I got the following error.
OpenCV: terminate handler is called! The last OpenCV error is: OpenCV(4.5.5) Error: Bad argument (Can't read ONNX file: yolo5n.onnx) in cv::dnn::dnn4_v20211220::ONNXImporter::ONNXImporter, file C:\build\master_winpack-build-win64-vc15\opencv\modules\dnn\src\onnx\onnx_importer.cpp, line 194
Does anybody have the same problem ? Thanks
Can you try using an absolute path for "yolo5n.onnx"? Are you sure it is in the "current working directory CWD"?
Problem solved, I had to build the opencv-contrib repository
i met the same problem when i run the python code as following:
(base) ubuntu@ubuntu-XPS-8930:~/heop_devel_kit/volume/visionanalyticsAI$ python yolov5.py
Traceback (most recent call last):
File "yolov5.py", line 120, in