EnoxSoftware / YOLOv8WithOpenCVForUnityExample

An example of using OpenCV dnn module with YOLOv8. (ObjectDetection, Segmentation, Classification, PoseEstimation)
15 stars 2 forks source link

Running with error for can't read ONNX file #5

Open yunlianwangluo opened 1 month ago

yunlianwangluo commented 1 month ago

After following steps for setting up project. every thing just looks fine, but when I try to run it, error happened: dnn::readNet_12() : OpenCV(4.10.0-dev) C:\Users\satoo\Desktop\opencv\modules\dnn\src\onnx\onnx_importer.cpp:277: error: (-5:Bad argument) Can't read ONNX file: C:/Users/David/YOLOv8WithOpenCVForUnityExample/Assets/StreamingAssets\YOLOv8WithOpenCVForUnityExample/yolov8n-seg.onnx in function 'cv::dnn::dnn4_v20240521::ONNXImporter::ONNXImporter'

And I had checked with the directory path, the file do exist and the file attributes are all good for anyone accessing.

Any idea for solving this?

EnoxSoftware commented 1 month ago

From the error text it seems that the onnx model file is incorrect, but we do not know why this is the case. What about other model examples? (YOLOv8ObjectDetection or YOLOv8Classification) We have confirmed that the problem does not occur in a project set up in our environment (Windows, Editor) using the latest version of OpenCVForUniy. The completed project has the following file structure.

2024-08-09_04h08_53