VIM3 Segmentation fault with Tflite NPU

@Pedro_Fernandes I can’t open you link

Understood here you go

@Pedro_Fernandes I have solved your problem, I will push the new code tomorrow, you can try to update


  1. Update you system.
  1. Update you ksnn repo.
  1. Try you model again.

You model input is float16. It is actually int16, so please use the input data of int16 when testing

Hey thanks for sucha a fast reply however I’m now getting :

OSError: cannot open shared object file: No such file or directory

Any clues?

@Pedro_Fernandes Did you upgrade you code repo to least ? In the latest version of the code, this library is no longer needed and removed

Yes I did I git pulled master branch

@Pedro_Fernandes Which one example you run ? Share you command. I test it just now. It work for me.

1 Like

I’m running the code I shared before

import numpy as np
import os
import argparse
import sys
from ksnn.api import KSNN
from ksnn.types import *
import cv2 as cv
import IPython
import time

model = "/home/khadas/mnv2_tflite/mnv2_tflite.nb"
library = "/home/khadas/mnv2_tflite/"
model_knn = KSNN("VIM3")
model_knn.nn_init(library=library, model=model, level=0)
CSV_IMG = cv.cvtColor(np.ones((640,820,3), dtype=np.float32), cv.COLOR_RGB2GRAY)
cv2_im = []
outputs = model_knn.nn_inference(cv2_im, platform='TFLITE')
print(outputs, outputs[0].shape)

@Pedro_Fernandes Do you reinstall ksnn v1.2 and re-convert you model again ?

1 Like

@Frank Hey yes I did all of those, is there any other step I have to take? I updated both git repos and the device

Were you able to reproduce this issue?

@Pedro_Fernandes I tried many times, but this problem did not reproduce. In the latest version of the code, I have removed this library. This is in the latest code, which is definitely not needed.

1 Like

is this then related to model conversion?

@Pedro_Fernandes I’m not sure where the problem occurred, because I can’t reproduce it. My approach is to reburn the latest firmware, then convert it with the latest SDK, and test it with the latest KSNN

1 Like

Can you share the conversion script?


--model-name mobilenet \
--platform tflite \
--model /home/yan/yan/Yan/models-zoo/tflite/mobilenet_v1/mobilenet_v1.tflite \
--mean-values '127.5,127.5,127.5,127.5' \
--quantized-dtype asymmetric_affine \
--kboard VIM3 --print-level 1

Just change the model path to the model which you share to me

1 Like

I got it working! First I wasn’t converting with the latest version and then I was giving 128 128 128 128 as mean values and the conversion script was exiting before the library creation. now I finished thanks so much for your help!

@Pedro_Fernandes The parameter of this setting is mainly to make your data perfectly fall between [0,1] or [-1,1] after normalization. This value can be adjusted. Appropriate use can filter out a lot of noise

hey @Frank I don’t know if you’ll be able to help me but I’m not being able to get the same output from this model converted for khadas as in my tflite model. Also I have some questions imagine my original tflite model’s input is float32 and I want the values between -1 and 1 what dtype should I input in the ksnn model and what should be the mean values? Do I have to input uint8 images?