Trying to run this example on your custom trained Yolov8 model.
Field of study I have a model best.pt
- I do the export to ONNX format
pip install ultralytics yolo mode=export model={HOME}/best.pt format=onnx
- simplify onnx model
pip install onnxsim pip install onnxruntime python -m onnxsim {HOME}/best.onnx {HOME}/best-sim.onnx
Error: [1] 67272 segmentation fault python -m onnxsim best.onnx best-sim.onnx
But I found a solution
- onnx to ncnn
onnx2ncnn best-sim.onnx best.param best.bin
- I changing a new model path and CLASS_NAME in the example (file yoloV8.cpp)
yolo.load_param("best.param"); yolo.load_model("best.bin");
const char *class_names[] = {"bus", "car", "truck"};
- I changing layer name (file yoloV8.cpp). I looked at the structural model https://netron.app/
ex.extract("output0", out); ... std::vector<int> strides = {32};
- Run Test image
I get house, but in the process of training the model, it is working.