# How to use ultralytics models in opencv/samples/dnn/object\_detection.cpp

**URL:** <https://forum.opencv.org/t/how-to-use-ultralytics-models-in-opencv-samples-dnn-object-detection-cpp/24325>\
**Category:** C++\
**Tags:** dnn\
**Created:** [January 25, 2026, 11:50am UTC](https://forum.opencv.org/t/how-to-use-ultralytics-models-in-opencv-samples-dnn-object-detection-cpp/24325 "2026-01-25T11:50:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![paul\_12481248](https://avatars.discourse-cdn.com/v4/letter/p/977dab/32.png) [@paul\_12481248](https://forum.opencv.org/u/paul_12481248)\
**Post date:** [January 25, 2026, 11:50am UTC](https://forum.opencv.org/t/how-to-use-ultralytics-models-in-opencv-samples-dnn-object-detection-cpp/24325/1 "2026-01-25T11:50:54Z")

</div>

Hello,

On OpenCV 4.14.0-pre, I tried ultralytics models yolov5lu.pt, yolov5nu.pt yolov8l.pt, yolov8n.pt, yolo11l.pt, yolo11n.pt, yolo26l.pt, yolo26n.pt (downloaded from ultralytics), which I have converted to onnx with model.export(format=“onnx”,dynamic=False,opset=12,simplify=True).

All models have outLayerType “Identity”, which is not supported by the function **postprocess** in file opject\_detection.cpp (line 407).

Is there an existing sample code working with these models? How to do to use cv::dnn for object detection?

Best regards

Paul
