How to add Metadata in the Tensorflow Lite for a model taken from Github?

Viewed 128

I have used this project from Github: https://github.com/nicknochnack/TFODCourse

The project contains a model that can detect License Plate on a given Vehicle image. The Github repo also contains code for the conversion of model into Tensorflow Lite file.

I used that code to generate TFLite file.

And then, I followed this link: https://developers.google.com/codelabs/tflite-object-detection-android

Where I downloaded the sample Application of Object detection model and following the instructions, I copied my TFLite files into the Android Application.

Now, if I run the application and take a photo, it gives me this error,

/TaskJniUtils: Error getting native address of native library: task_vision_jni
    java.lang.RuntimeException: Error occurred when initializing ObjectDetector: Input tensor has type kTfLiteFloat32: it requires specifying NormalizationOptions metadata to preprocess input images.
        at org.tensorflow.lite.task.vision.detector.ObjectDetector

I understand that I have to add Metadata in my TFLite model. so, I searched about it and ended up on this link: https://www.tensorflow.org/lite/models/convert/metadata#model_with_metadata_format

But I didn't understand at all what exactly should I be doing. Can anyone please help me in pointing to the right direction that for my problem specifically, what exactly do I need to do?

0 Answers
Related