Become a leader in the IoT community!
New DevHeads get a 320-point leaderboard boost when joining the DevHeads IoT Integration Community. In addition to learning and advising, active community leaders are rewarded with community recognition and free tech stuff. Start your Legendary Collaboration now!
Hey man @enthernetcode it’s few things I would want you to do , firstly you have to export to tensor flow by saving your keras model as a tensor flow saved model or frozen Graph
you will now need to convert to tensor flow lite by using tensor flow lite converter to transform the model into a tensor flow lite format but consider quantization to reduce model size and optimize for performance
Integrate it now into your microcontroller project using the tensor flow lite for microcontrollers library
This is just a quick overview of what you would need to do
@marveeamasi Great points! Just to add a bit more detail:
1/Export Keras model:
“`python
model.save(‘saved_model’)
“`
2/Convert to TensorFlow Lite:
“`python
import tensorflow as tf
converter = tf.lite.TFLiteConverter.from_saved_model(‘saved_model’)
converter.optimizations = [tf.lite.Optimize.DEFAULT] # Optional but recommended
tflite_model = converter.convert()
with open(‘model.tflite’, ‘wb’) as f:
f.write(tflite_model)
“`
3/Integrate with microcontroller: Use TensorFlow Lite for Microcontrollers library.
More details here: [TensorFlow Lite for Microcontrollers](https://www.tensorflow.org/lite/microcontrollers).
CONTRIBUTE TO THIS THREAD