How to update only specific layers from Tensorflow Lite model into Android app?

Viewed 427

I have a custom tensorflow.keras.models.Model CNN model with layers from tensorflow.keras.layers that I aim to deploy in an Android app, using Tensorflow Lite.

I am currently converting this model from a saved one (folder containing a .pb file, an assets folder and variables folder - created from my_model.save(path_save)) by using the Python API :

import tensorflow as tf

converter = tf.lite.TFLiteConverter.from_saved_model('./my_model')
tflite_model = converter.convert()
with tf.io.gfile.GFile('my_model.tflite', 'wb') as f:
  f.write(tflite_model)

I then download this TFLite model on my app using Firebase and its ML Kit.

However, I'd like to make regular updates of this model (changes that would concern only a few layers) without having to download it all (which is what I'm doing as of now) : this is a waste of ressources, as my model is quite heavy and most of the layers will not be changed at all.

Is there a way to do it ? Ideally it would just receive a file describing the layers to be changed.

0 Answers
Related