You need change the dtype from np.float32 to np.uint8:
input_data = np.array(np.random.random_sample(input_shape), dtype=np.uint8)
You can always check with
print(interpreter.get_input_details())
which dtype is required
Regards
Hi,
I want to test a TensorFlow custom model on the i.MX 8M Plus processor. I have generated the "saved_model.pb" file, how could I run it on the processor?
Best regards,
Pablo.
Hello pablomoreno555,
You can start reading the machine learning guide document in your yocto documentation, it has example of how to upload a different models.
Regards
Hi,
Following the documentation, I have converted my TensorFlow model into ".tflite". Then, I have performed the benchmark with this command:
# ./benchmark_model --graph=<name_of_the_model.tflite>
and everything is OK. However, when I try to run the model using PyeIQ, with the following command:
# pyeiq --run object_detection_ tflite --model <name_of_the_model.tflite> -- labels <name_of_the_labelmap.txt>
I get this error:
INFO: Created TensorFlow Lite delegate for NNAPI.
Failed to apply NNAPI delegate.
Traceback (most recent call last):
File "/usr/bin/pyeiq", line 144, in <module>
PyeIQ().main()
File "/usr/bin/pyeiq", line 138, in main
self.run(self.args.run)
File "/usr/bin/pyeiq", line 119, in run
self.pyeiq_set[target]().run()
File "/usr/lib/python3.7/site-packages/eiq/modules/detection/object_detection_ssd.py", line 133, in run
self.start()
File "/usr/lib/python3.7/site-packages/eiq/modules/detection/object_detection_ssd.py", line 129, in start
self.labels = self.load_labels(self.labels)
File "/usr/lib/python3.7/site-packages/eiq/modules/utils.py", line 133, in load_labels
return {int(num): text.strip() for num, text in lines}
File "/usr/lib/python3.7/site-packages/eiq/modules/utils.py", line 133, in <dictcomp>
return {int(num): text.strip() for num, text in lines}
File "/usr/lib/python3.7/site-packages/eiq/modules/utils.py", line 132, in <genexpr>
lines = (p.match(line).groups() for line in f.readlines())
AttributeError: 'NoneType' object has no attribute 'groups'
I wanted to know how could I solve it.
Thank you very much.
Best regards,
I have converted the TensorFlow model into *.tflite using the following script:
You need change the dtype from np.float32 to np.uint8:
input_data = np.array(np.random.random_sample(input_shape), dtype=np.uint8)
You can always check with
print(interpreter.get_input_details())
which dtype is required
Regards