# Error loading yolov8 detector with opencv 4.6.0 cpp interface

**URL:** <https://forum.opencv.org/t/error-loading-yolov8-detector-with-opencv-4-6-0-cpp-interface/18079>\
**Category:** C++\
**Tags:** dnn\
**Created:** [June 25, 2024, 8:00am UTC](https://forum.opencv.org/t/error-loading-yolov8-detector-with-opencv-4-6-0-cpp-interface/18079 "2024-06-25T08:00:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Astha\_Kumari](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/astha_kumari/32/10652_2.png) [@Astha\_Kumari](https://forum.opencv.org/u/Astha_Kumari)\
**Post date:** [June 25, 2024, 8:00am UTC](https://forum.opencv.org/t/error-loading-yolov8-detector-with-opencv-4-6-0-cpp-interface/18079/1 "2024-06-25T08:00:29Z")

</div>

[ERROR:0@0.025] global /home/…/dnn/src/onnx/onnx\_importer.cpp(1018) handleNode DNN/ONNX:ERROR during processing node with 2 inputs and 2 outputs [split]:(onnx\_node!/model.22/split)from domain=‘ai.onnx’ terminate called after throwing an instance of ‘cv::Exception’

what():OpenCV(4.6.0) /home/…/dnn/src/onnx/onnx\_importer.cpp:1040:error:(-2 :unspecified error) in function ‘handleNode’

> Node[Split@ai.onnx]:(onnx\_node!/model.22/split) parse error:OpenCV(4.6.0) /home/…/dnn/src/layer/slice\_layer.cpp:235:error:(-215 :Assertion failed)splits\>0 && inpshape[axis\_rw]%splits==0 in function ‘getMemoryShapes’

i am getting the above error when i am reading my yolov8 model trained on custom dataset saved as best.pt and then converted to best.onnx Net net=readNetFromONNX(“./best.onnx”)  
i have tried downgrading its opset from 17 to 12 but i couldn’t go below 15 so i tried testing it on opset 15 but got the same error

when i am reading the same model in python i.e. cv2.dnn.readNetFromONNX(“./best.onnx”) i am getting no error

the input shape of my model is static [1,3,640,640]  
opencv version:4.6.0  
offline debian machine  
cmake version 3.25.0

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [June 25, 2024, 8:24am UTC](https://forum.opencv.org/t/error-loading-yolov8-detector-with-opencv-4-6-0-cpp-interface/18079/2 "2024-06-25T08:24:30Z")

</div>

[crosspost](https://meta.stackoverflow.com/a/266159):

> <https://stackoverflow.com/questions/78666111/error-loading-yolov8-detector-in-opencv-cpp-interface>

---

<div class="post-metadata">

**Author:** ![Astha\_Kumari](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/astha_kumari/32/10652_2.png) [@Astha\_Kumari](https://forum.opencv.org/u/Astha_Kumari)\
**Post date:** [June 25, 2024, 9:17am UTC](https://forum.opencv.org/t/error-loading-yolov8-detector-with-opencv-4-6-0-cpp-interface/18079/4 "2024-06-25T09:17:50Z")

</div>

it was my first time asking questions on an online community forum and i wasn’t aware of crossposting and its downsides. So kindly look into my issue.
