Segmentation fault during detection yolov5

Which Khadas SBC do you use?

VIM3 Pro

Which system do you use? Android, Ubuntu, OOWOW or others?

Ubuntu 20.04

Hi,

I want to convert my yolov5n model to run in Khadas. I converted my onnx model (with aml_npu_sdk/acuity-toolkit/python) by creating environment on my own computer.

I created the dataset0.txt file based on my own images.

dataset txt format

I moved the ‘nb’ and ‘so’ files to Khadas. I want to detect using my own model with KSNN repo. When I test the 1080p.bmp image located in the ksnn/example/onnx/data folder, it produces output.

orig img

However, when I try to test it on my own image, I get the error ‘segmentation fault’.

can you help me?

@ahmet_karazor Segfault, looks like your post-processing isn’t handling the correct array length. Have you confirmed that the length of the array in your post-processing code is the same as the length of the output array of your model?

@Frank,

I am getting “segfault” error in “model.nn_inference” command. Before proceeding with post processing.

Model input size:

input_size

Model output size:

out_size

image size (w , h) = (640 , 360). I also tried to resize it to be the same as the model input without going into the inference phase. but same error.

@ahmet_karazor If you need me to debug, you need to give me your mode and source code .

hey,

when i try it on my own onnx model the output should be like below. But it gives segfault error in khadas.

expect_result

so, nb, onnx, detection code python file and sample image on github link.

@ahmet_karazor I will found time to test it.

hey,

Thanks. I am waiting your answer.

Hi @Frank,

Do you have a solution?

@ahmet_karazor

Convet parameter

./convert --model-name test --platform onnx --model /home/yan/Downloads/yolox_nano.onnx --mean-values '0 0 0 0.00390625' --quantized-dtype asymmetric_affine --source-files ./data/dataset/dataset0.txt --kboard VIM3 --print-level 1

Edit code

data = yolov3.nn_inference(cv_img, platform='DARKNET', reorder='2 1 0', output_tensor=1, output_format=output_format.OUT_FORMAT_FLOAT32)

It work for me.

 |---+ KSNN Version: v1.3 +---| 
Start init neural network ...
Done.
Get input data ...
Done.
Start inference ...
Done. inference time:  0.15771770477294922
1 Like