Which Khadas SBC do you use?
VIM3
Which system do you use? Android, Ubuntu, OOWOW or others?
Debian 11 Server Fenix
Which version of system do you use? Khadas official images, self built images, or others?
Fenix
Please describe your issue below:
TFLite crashing on init on NPU
khadas@Khadas:~$ python3 test.py aa
Vx delegate: allowed_cache_mode set to 0.
Vx delegate: device num set to 0.
Vx delegate: allowed_builtin_code set to 0.
Vx delegate: error_during_init set to 0.
Vx delegate: error_during_prepare set to 0.
Vx delegate: error_during_invoke set to 0.
========== INPUT DETAILS ========
[{'name': 'input_1', 'index': 13, 'shape': array([ 1, 28, 28, 1], dtype=int32), 'shape_signature': array([ 1, 28, 28, 1], dtype=int32), 'dtype': <class 'numpy.uint8'>, 'quantization': (0.007843137718737125, 128), 'quantization_parameters': {'scales': array([0.00784314], dtype=float32), 'zero_points': array([128], dtype=int32), 'quantized_dimension': 0}, 'sparsity_parameters': {}}]
====== OUTPUT DETAILS ==========
[{'name': 'dense/Softmax', 'index': 11, 'shape': array([ 1, 10], dtype=int32), 'shape_signature': array([ 1, 10], dtype=int32), 'dtype': <class 'numpy.uint8'>, 'quantization': (0.00390625, 0), 'quantization_parameters': {'scales': array([0.00390625], dtype=float32), 'zero_points': array([0], dtype=int32), 'quantized_dimension': 0}, 'sparsity_parameters': {}}]
[ 1] HAL user version: 6.4.6.345497
[ 2] HAL kernel version: 6.4.8.415784
E [/Source/wksp/tflite-vx-delegate/build/_deps/tim-vx-src/src/tim/vx/tensor.cc:Init:341]Create tensor fail!
E [/Source/wksp/tflite-vx-delegate/build/_deps/tim-vx-src/src/tim/vx/tensor.cc:Init:341]Create tensor fail!
E [/Source/wksp/tflite-vx-delegate/build/_deps/tim-vx-src/src/tim/vx/tensor.cc:Init:341]Create tensor fail!
E [/Source/wksp/tflite-vx-delegate/build/_deps/tim-vx-src/src/tim/vx/tensor.cc:Init:341]Create tensor fail!
E [/Source/wksp/tflite-vx-delegate/build/_deps/tim-vx-src/src/tim/vx/tensor.cc:Init:341]Create tensor fail!
Segmentation fault
khadas@Khadas:~$
I have a simple Python app… that just loads the delegate…
import numpy as np
import tflite_runtime.interpreter as tflite
# Load TFLite model and allocate tensors.
# (if you are using the complete tensorflow package you can find load_delegate in tf.experimental.load_delegate)
delegate = tflite.load_delegate( library="libvx_delegate.so", options={"logging-severity":"debug"})
# Delegates/Executes all operations supported by Arm NN to/with Arm NN
interpreter = tflite.Interpreter(model_path="mock_model.tflite",
experimental_delegates=[delegate])
interpreter.allocate_tensors()
# Get input and output tensors.
input_details = interpreter.get_input_details()
print("========== INPUT DETAILS ========")
print(input_details)
print()
print("====== OUTPUT DETAILS ==========")
output_details = interpreter.get_output_details()
print(output_details)
# Test model on random input data.
input_shape = input_details[0]['shape']
input_data = np.array(np.random.random_sample(input_shape), dtype=np.uint8)
interpreter.set_tensor(input_details[0]['index'], input_data)
interpreter.invoke()
# Print out result
output_data = interpreter.get_tensor(output_details[0]['index'])
print(output_data)
Galcore version 6.4.8.7.1.1.1
Is there a known model to try out? … another simple test app?
Regards,
Richard