Trouble finding example material for the DNN functionality

Good day to whichever beautiful person is reading this.
I’m currently working on a project with which i would like to identify different sorts of Dutch fryable snacks. I have trained myself a yolov5 model, which i can convert to the .onnx format, or the .pb format. Only thing is, i’m having a lot of trouble finding example material and understandable information on how to properly implement the model into OpenCV. I have already checked the documentation but i’m still having difficulty getting it up and running. I’m wondering if anyone here has some good examples available, or another source of information which i could use. Thank you for reading and have a good day.

that’s no wonder it only works since a few weeks,
so make sure to use latest code for all this.

assuming , you did

git clone https://github.com/ultralytics/yolov5
cd yolov5

... train your model ...

you can export it to onnx using:

python export.py --weights yolov5s.pt --img 640 --opset 12 --include onnx

(opset version seems crucial !)

unfortunately, the result parsing differs a lot from v3 or v4, and so far, we only have a working c++ example code here (at least, give it a star, please !):

hopefully someone will port it to python soon, gl in the meantime…

update: python example: