tflite_flutter_plugin icon indicating copy to clipboard operation
tflite_flutter_plugin copied to clipboard

Didn't find op for builtin opcode 'FULLY_CONNECTED' version '9'

Open sayannath opened this issue 3 years ago • 9 comments

Loading Model in Flutter

  void _loadModel() async {
    _interpreter = await Interpreter.fromAsset('asl.tflite');

    var inputShape = _interpreter.getInputTensor(0).shape;
    var outputShape = _interpreter.getOutputTensor(0).shape;
    print(inputShape);
    print(outputShape);
    print('Load Model - $inputShape / $outputShape');
  }

Conversion Code

converter = tf.lite.TFLiteConverter.from_saved_model("asl_model")
converter.optimizations = [tf.lite.Optimize.DEFAULT]
converter.target_spec.supported_ops = [
    tf.lite.OpsSet.TFLITE_BUILTINS,
    tf.lite.OpsSet.SELECT_TF_OPS 
]
tflite_model = converter.convert()
open("asl.tflite", 'wb').write(tflite_model)
print('Model size is %f MBs.' % (len(tflite_model) / 1024 / 1024.0))

sayannath avatar Mar 29 '21 22:03 sayannath

Looks like there is a version mismatch between the TensorFlow version you are using to convert and the tflite binary version.

am15h avatar Apr 25 '21 17:04 am15h

I am using tf-nightly to build my model and convert my model into tflite file.

sayannath avatar Apr 25 '21 18:04 sayannath

Please use tensorflow version 2.4.1 and follow this https://github.com/am15h/tflite_flutter_plugin/issues/101#issuecomment-821781506 to use flex delegate.

am15h avatar May 18 '21 18:05 am15h

Sure will try that!

sayannath avatar May 18 '21 19:05 sayannath

@sayannath Did it work?

am15h avatar May 23 '21 18:05 am15h

I will try it asap

sayannath avatar May 23 '21 19:05 sayannath

@sayannath Did it work?

I'm facing the same problem, it didn't work till now, is there is another fix?

1saifj avatar Jun 11 '21 14:06 1saifj