am15h / tflite_flutter_plugin

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

Didn't find op for builtin opcode 'ADD' version '4'. #209

Open TetrixGauss opened 2 years ago

TetrixGauss commented 2 years ago

Hello everyone!

I am just getting this one: E/tflite ( 6643): Didn't find op for builtin opcode 'ADD' version '4'. An older version of this builtin might be supported. Are you using an old TFLite binary with a newer model? E/tflite ( 6643): Registration failed. E/flutter ( 6643): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: Invalid argument(s): Unable to create interpreter. E/flutter ( 6643): #0 checkArgument (package:quiver/check.dart:45:5) E/flutter ( 6643): #1 new Interpreter._create (package:tflite_flutter/src/interpreter.dart:43:5) E/flutter ( 6643): #2 new Interpreter.fromBuffer (package:tflite_flutter/src/interpreter.dart:94:37) E/flutter ( 6643): #3 Interpreter.fromAsset (package:tflite_flutter/src/interpreter.dart:112:24)

I am getting the .tflite file from another organization and i need to use it in my flutter mobile app! I know that they have used tensorflow 2.7.0 to create the model and when i am trying to create the interpreter i am getting the above.

Any ideas? maybe we need an update on the plugin? i am getting the latest binaries which are 2.5.0. Maybe they are outdated?

Thank you in advance!

mfagerdal commented 1 year ago

For ios: Change or make a new project where you include tflite swift cocoa pod. Choose in podfile a version 2.7+ (in your case). Include coreml and metal subsets if required.

Run pod install / build xcode etc. Break, find the framework files and copy to flutter cache for tflite, overwriting existing.

You should now have updated tflite frameworks

For android: just change app .gradle to have newer version code for tflite.

xyzacademic commented 1 year ago

For ios: Change or make a new project where you include tflite swift cocoa pod. Choose in podfile a version 2.7+ (in your case). Include coreml and metal subsets if required.

Run pod install / build xcode etc. Break, find the framework files and copy to flutter cache for tflite, overwriting existing.

You should now have updated tflite frameworks

For android: just change app .gradle to have newer version code for tflite.

Thank you for replying. I am a new user of flutter. Can you tell me where I should modify in .gradle? There are several folders.