KSNN Yolov8n Segmentation Fault

I’m using Khadas Vim3 Pro
I’ve downloaded KSNN and tried your example of Yolov8n and it works.

But then I decided to the same on my own dataset.
I cloned Ultralytics repo, trained a model,
yolo train data=D:/Work/ElCub/NN./Dataset/data.yaml model=yolov8n.pt epochs=10 lr0=0.01 batch=2
Changed head.py and then exported the file, I got .onnx file, here it’s visualization in Netron:

(I have 19 classes)
Then I cloned aml_npu_sdk and converted my .onnx in .nb and .so files
I changed class number, list size and classes in yolo8n-picture.py
And here what I keep getting:

Segmentation Fault
What I should do in this situation? What am I doing wrong?

The question is already not relevant, I have fixed it

Hello @Agent_kapo
after performing all the steps I also getting the same error that segmentation fault.
I also have change class number, list size and classes in yolo8n-cap.py
can you please help me with this how you have resolved this ??

Can you provide your code?

.py file

Are you using usual yolov8 weights with 80 classes?

Forgot, 5 classes
Of course you’ll have an error

box_0 = softmax(input[…, 80:96], -1)
Is correct if you have only 80 classes
My suggestion:

1 Like

Thank you @Agent_kapo for your response. Will there be change in the GRID 0-2 as the number of classes are 5…because I am getting an error
ValueError: cannot reshape array of size 75600 into shape (1,69,20,20)…?
Thank you in advance :slightly_smiling_face:

That’s strange, 75600 = 8400 * 9, interesting…
If you provide me your onnx and pb+so weights and new py file, maybe I can deal with it

Thank you @Agent_kapo for your response as I am successfully running the model on NPU.

Okay, glad to here it
So where was the main mistake? My suggestion was that it were classes, am I wright?

Not only classes, also due to different version which hampered model and its outputs. but now everything is okay.