diff options
author | Slendi <slendi@socopon.com> | 2023-11-05 00:41:33 +0200 |
---|---|---|
committer | Slendi <slendi@socopon.com> | 2023-11-05 00:41:33 +0200 |
commit | b7a20686e985a5375a25cff8e77226c524c3068e (patch) | |
tree | 0391f970498ab60502b8edf835fe986e45ca4403 | |
parent | b8acb45e6837dbdd22b96a48110f4137236618d5 (diff) |
Add a script to generate a .tflite
Signed-off-by: Slendi <slendi@socopon.com>
-rw-r--r-- | .gitignore | 2 | ||||
-rwxr-xr-x | tfliteify.py | 11 |
2 files changed, 12 insertions, 1 deletions
@@ -2,4 +2,4 @@ venv train.json dataset final_model - +final_model.tflite diff --git a/tfliteify.py b/tfliteify.py new file mode 100755 index 0000000..d366235 --- /dev/null +++ b/tfliteify.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python3 + +import tensorflow as tf + +converter = tf.lite.TFLiteConverter.from_saved_model("final_model") +converter.target_spec.supported_ops = [ + tf.lite.OpsSet.TFLITE_BUILTINS, # enable TensorFlow Lite ops. + tf.lite.OpsSet.SELECT_TF_OPS # enable TensorFlow ops. +] +tflite_model = converter.convert() +open("final_model.tflite", "wb").write(tflite_model) |