Error when load custom ML model in flutter

1,256

If you have trained a Keras model(HDF5) ,convert it to Tensorflow model(.pb) and then convert it to Tflite Please refer to code below:

converter = tf.lite.TFLiteConverter.from_saved_model(saved_model_dir)

tflite_model = converter.convert()

open("converted_model.tflite", "wb").write(tflite_model)

Share:
1,256
Bruno Justino Praciano
Author by

Bruno Justino Praciano

Updated on December 14, 2022

Comments

  • Bruno Justino Praciano
    Bruno Justino Praciano over 1 year

    I can't load tensorflow lite model in flutter. I am using this library

    https://github.com/shaqian/flutter_tflite

    And when I tried to load the model, I received this error.

    E/flutter ( 7258): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: PlatformException(error, Unsupported value: java.io.FileNotFoundException: flutter_assets/assets/output.tflite, 
    

    I have followed all the steps in the documentation of the library. Is there another method to load this model in flutter without this library?