am15h / tflite_flutter_plugin

TensorFlow Lite Flutter Plugin
https://pub.dev/packages/tflite_flutter
Apache License 2.0
508 stars 353 forks source link

How to run my custom .tflite model? #138

Closed EunyoungY closed 3 years ago

EunyoungY commented 3 years ago

Is there anything I need to add when converting python based model to .tflite model? OR What should I do to run my custom .tflte model? Should I make my own function?

I made my custom .tflite model, and the results are completely different from those tested on Python. Also, I don't think the output is being made properly through this; interpreter.run(input, output);

                var interpreterOptions = InterpreterOptions()..useNnApiForAndroid = true;
                final interpreter = await Interpreter.fromAsset('SF_Clinical_model.tflite', options: interpreterOptions); 

                var input = [[0.0,-0.04022876485894776,-0.5520815050009201,-0.6615042764480691,0.6177825151941436,0.8481974594001157,0.5220291280415329,0.19848625174566584,0.08613599446070798,-1.367889730879442,-2.7532515061409404,-1.1236142999603174,0.0,0.0,0.0,-1.5906063695575046,-0.7698213853461967,-0.07695863888915364,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0]]; 

                var output = List<double>.filled(1, 0).reshape([1, 1]);
                interpreter.run(input, output);

                print("output:" + output.toString());
EunyoungY commented 3 years ago

It worked..!