TF Lite runtime error: "Didn't find op for builtin opcode 'PLACEHOLDER_FOR_GREATER_OP_CODES' version '1'"
Hi @andynewman10 

I'm not sure if there is a build for 2.13.0 because the Flutter packages are not officially supported but rather contributed by the community.

You may try updating package dependencies  https://docs.flutter.dev/packages-and-plugins/using-packages#updating-package-dependencies or use flutter tflite plugin https://github.com/tensorflow/flutter-tflite which has been recently migrated to tensorflow.

Please check this [blog](https://blog.tensorflow.org/2023/08/the-tensorflow-lite-plugin-for-flutter-officially-available.html?_gl=1*1gvogab*_ga*OTQ0MDM3NDM1LjE2Njg1Nzc1NzU.*_ga_W0YLR4190T*MTY5NTczMDE1MC45MDkuMS4xNjk1NzMyNzc1LjAuMC4w) for the same.

Thanks. I have solved this issue by using TensorFlow 2.12.0 (not 2.13.0) and by changing the way I create the model (ie. use TF Hub functions). Both were necessary.

### 1. System information

- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 11, Python 3.10.11
- TensorFlow installation (pip package or built from source): pip
- TensorFlow library (version, if pip package or github SHA, if built from source): 2.13.0

### 2. Code

Repro steps:

1) Download the `lite-model_efficientnet_lite4_uint8_2.tflite` model from here: https://tfhub.dev/tensorflow/lite-model/efficientnet/lite4/uint8/2 (click the 14.34Mb download [link](https://tfhub.dev/tensorflow/lite-model/efficientnet/lite4/uint8/2?lite-format=tflite) ; leave this page open in your browser)
2) Start a TF Lite application using Android or Flutter. I use Flutter and the latest ML Kit.
3) Use the model in your code : it works perfectly fine.
4) Back in your browser, now click the `TF` tab on the left side on the page your left open. The TF tab allows you to download the TF (not TF lite) version of the model. Download the 46.61Mb model file `efficientnet_lite4_classification_2.tar.gz` ([here](https://tfhub.dev/tensorflow/efficientnet/lite4/classification/2)). Uncompress this archive into a `saved_model` folder somewhere.
5) Use the following code to convert the TF model into a TF Lite model;

```
converter = tf.lite.TFLiteConverter.from_saved_model(saved_model_dir, tags='train')
converter.optimizations = [tf.lite.Optimize.DEFAULT]
tflite_model = converter.convert()
outputPath = os.path.join(cur_dir, 'tf_converted_to_tflite.tflite')
fo = open(outputPath, "wb")
fo.write(tflite_model)
fo.close()
```
6) Following the instructions from https://www.tensorflow.org/lite/models/convert/metadata, add model metadata by using `metadata_writer_for_image_classifier.py`, and with the following model specification (updated lines ~60 to 70, as instructed):

```
_MODEL_INFO = {
    "tf_converted_to_tflite.tflite":
        ModelSpecificInfo(
            name="EfficientNetB4 image classifier",
            version="v1",
            image_width=380, # As specified in the TF tab in the web page (not the TF Lite tab, which input dimension is listed as 300x300)
            image_height=380, #
            image_min=0,
            image_max=255,
            mean=[127.5],
            std=[127.5],
            num_classes=1000,
            author="TensorFlow")
}
```
The processing completes normally.

7) Now use that model `tf_converted_to_tflite.tflite` instead of the original, readily-available TF Lite model available on TF Hub, `lite-model_efficientnet_lite4_uint8_2.tflite` (that was working fine).
In other words, we are now trying to use approximately the same model, except that this time we ran the TF -> TF Lite model conversion ourselves (quantization is a bit different, but it does not matter at all).
8) Run the same application. The following PlatformException is raised:

```
"com.google.mlkit.common.MlKitException: Failed to initialize detector.
Didn't find op for builtin opcode 'PLACEHOLDER_FOR_GREATER_OP_CODES' version '1'.
An older version of this builtin might be supported.
Are you using an old TFLite binary with a newer model?
```

### 3. Failure after conversion

I would expect the conversion process and runtime behavior to be smooth considered the model is hosted on TF Hub: the TF Lite model proposed by TF Hub works fine, but if I manually convert the TF model myself, it doesn't.
Is there anything wrong in the above conversion code? I have been debugging this for days, to no avail.
I have another (custom) model with a similar bug, and so far this is the best repro I could build.

### 4. First investigations

One thing I figured is that I should try to use the same version of TensorFlow on my PC and on my embedded system - as suggested in the following post from the TensorFlow Team:

https://discuss.tensorflow.org/t/tensorflowlite-error-didnt-find-op-for-builtin-opcode-softmax-version-1-an-older-version-of-this-builtin-might-be-supported-are-you-using-an-old-tflite-binary-with-a-newer-model/3885/6

Currently I am using TensorFlow 2.13.0 on my PC, however, how can I determine the version used in Flutter ? I use ML Kit on the Flutter side, which uses, on Android, the following Maven artifact:

https://mvnrepository.com/artifact/com.google.mlkit/image-labeling-custom/17.0.1

Which TF version is this artifact using?
