idealo / image-super-resolution

🔎 Super-scale your images and run experiments with Residual Dense and Adversarial Networks.
https://idealo.github.io/image-super-resolution/
Apache License 2.0
4.56k stars 755 forks source link

Upload to TFLITE #245

Closed md-rifatkhan closed 8 months ago

md-rifatkhan commented 8 months ago

can you please upload the model to tflite?

I tried with this but it not working

import tensorflow as tf

Define the path to the HDF5 model file

file_path = r'C:\Users\user.keras\datasets\rrdn-C4-D3-G32-G032-T10-x4_epoch299.hdf5'

Load the HDF5 model

model = tf.keras.models.load_model(file_path)

Convert the model to a TFLite model

tflite_converter = tf.lite.TFLiteConverter.from_keras_model(model) tflite_model = tflite_converter.convert()

Save the TFLite model

with open('model.tflite', 'wb') as f: f.write(tflite_model)