terminate called after throwing an instance of ‘cv::Exception’ what(): OpenCV(4.10.0-dev) /root/opencv/modules/dnn/src/onnx/onnx_importer.cpp:278: error: (-5:Bad argument) Can’t read ONNX file: /root/inference/best.onnx in function ‘ONNXImporter’
在使用
cv::dnn::Net net = cv::dnn::readNetFromONNX("/root/inference/best.onnx");
调用模型时,发现一直报错,也没找到哪里报错。
最后的最后,发现是 文件名字inference的问题,我的文件名字是infernce(哭)。所以找不到我的onnx文件报错。
最后,修改名字后就可以了:
cv::dnn::Net net = cv::dnn::readNetFromONNX("/root/infernce/best.onnx");