diahretnou commited on
Commit
f224e07
·
verified ·
1 Parent(s): b330f9f

Upload 2 files

Browse files
Files changed (2) hide show
  1. cnn_model.tflite +3 -0
  2. convert_to_tflite.py +17 -0
cnn_model.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:57bd3d4148ba6382d25855fdebd6a7ce3cb3a14e223b7a2cdfeef2be14bfc9e4
3
+ size 27260696
convert_to_tflite.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import tensorflow as tf
2
+
3
+ # Convert CNN model
4
+ cnn_model = tf.keras.models.load_model("ProyekCV_model.h5")
5
+ cnn_converter = tf.lite.TFLiteConverter.from_keras_model(cnn_model)
6
+ cnn_tflite = cnn_converter.convert()
7
+ with open("cnn_model.tflite", "wb") as f:
8
+ f.write(cnn_tflite)
9
+
10
+ # Convert MobileNet model
11
+ mobilenet_model = tf.keras.models.load_model("ProyekCV_model_v2.h5")
12
+ mobilenet_converter = tf.lite.TFLiteConverter.from_keras_model(mobilenet_model)
13
+ mobilenet_tflite = mobilenet_converter.convert()
14
+ with open("mobilenet_model.tflite", "wb") as f:
15
+ f.write(mobilenet_tflite)
16
+
17
+ print("✅ Conversion selesai! File .tflite berhasil dibuat.")