Add a script to generate a .tflite

Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
Slendi 2023-11-05 00:41:33 +02:00
parent b8acb45e68
commit b7a20686e9
No known key found for this signature in database
GPG Key ID: FEE30F374BAC2C78
2 changed files with 12 additions and 1 deletions

2
.gitignore vendored
View File

@ -2,4 +2,4 @@ venv
train.json
dataset
final_model
final_model.tflite

11
tfliteify.py Executable file
View File

@ -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)