-
Notifications
You must be signed in to change notification settings - Fork 45.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
34f03db
commit d35d29d
Showing
1 changed file
with
18 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import tensorflow as tf | ||
|
||
def convert_tflite_to_pb(tflite_model_path, pb_model_path): | ||
# Load the TFLite model | ||
with open(tflite_model_path, 'rb') as f: | ||
tflite_model = f.read() | ||
|
||
# Convert the TFLite model to a TensorFlow model | ||
converter = tf.lite.TFLiteConverter.from_saved_model(tflite_model) | ||
tf_model = converter.convert() | ||
|
||
# Save the TensorFlow model as a .pb file | ||
tf.saved_model.save(tf_model, pb_model_path) | ||
|
||
if __name__ == "__main__": | ||
tflite_model_path = "face_landmark.tflite" | ||
pb_model_path = "face_landmark.pb" | ||
convert_tflite_to_pb(tflite_model_path, pb_model_path) |