Hi, NXP supporter,
I'm tried running model mobilenet-v1 with tensorflow 1.15 and quantized with eIQ-tool. However, when I run on NPU it gets fallback error to CPU but still recognizes the object and I want it to run on NPU. I tried with exporting tflite_graph.pb to saved_model and quantization with tensorflow 2.16.2 environment. I used the following method to quant but it still doesn't work, how can I run it completely on NPU without falling back to CPU for processing.
def representative_data_gen():
dataset_list = quant_image_list
quant_num = 500
for i in range(quant_num
pick_me = random.choice(dataset_list)
image = tf.io.read_file(pick_me)
if pick_me.endswith('.png') or pick_me.endswith('.PNG'
image = tf.io.decode_jpeg(image, channels=3)
image = tf.image.resize(image, [width, height])
image = tf.cast(image / 255., tf.float32)
image = tf.expand_dims(image, 0)
yield [image]
converter = tf.lite.TFLiteConverter.from_saved_model(saved_model)
converter.optimizations = [tf.lite.Optimize.DEFAULT]
converter.representative_dataset = representative_data_gen
converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS_INT8]
converter.target_spec.supported_types = [tf.int8]
converter.inference_input_type = tf.int8
converter.inference_output_type = tf.int8
tflite_model = converter.convert()