I try to follow this tutorial: Getting Started with TensorFlow Lite for Microcontrollers on i.MX RT to deploy flowers classification model in i.MX RT1050-EVKB. I test the generated .tflite model following the tutorial, and get correct inference result. But I can not get correct inference result after converted .tflite to .h with xxd, and deploy it in i.MX RT1050-EVKB.
Solved! Go to Solution.
Thank you for your help! I solved this problem.
The correct python script:
------------------------------------------------------------------------------------------
Great! Sorry about the missing semicolon. We will make sure to update the lab guide conversion, thanks for trying it out and letting us know about it.
Have fun with eIQ.
Best Regards,
David
Hello @lixianghan,
thank you for your interest in eIQ. Could you please try converting your flower image with the following python script instead of xxd?:
import cv2
import numpy as np
img = cv2.imread('flower.bmp')
img = cv2.resize(img, (128, 128))
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
with open('image_data.h', 'w') as fout:
print('static const uint8_t image_data[] = {', file=fout)
img.tofile(fout, ', ', '0x%02X')
print('}\n', file=fout)
Thanks,
David
Thank you for your help! I solved this problem.
The correct python script:
------------------------------------------------------------------------------------------