Using TensorFlow Lite with Xamarin.Android

16 views
Skip to first unread message

Nathan Sokalski

unread,
Sep 17, 2022, 8:15:12 PM9/17/22
to TensorFlow End Users - GETTING STARTED, TUTORIALS & HOW-TO'S
I am attempting to use a *.tflite model (which I created using Custom Vision on Microsoft Azure) in a Xamarin.Android project. However, when I use the following code:

ObjectDetector.ObjectDetectorOptions objoptions = ObjectDetector.ObjectDetectorOptions.InvokeBuilder().SetScoreThreshold(0.6f).Build();
ObjectDetector objdetector = ObjectDetector.CreateFromFileAndOptions(Application.Context, "model.tflite", objoptions);

I receive the following error:

java.lang.RuntimeException: Error occurred when initializing ObjectDetector: Input tensor has type kTfLiteFloat32: it requires specifying NormalizationOptions metadata to preprocess input images.

Everything I have been able to find on adding metadata to the *.tflite file is written in Python so I have been unable to use them with Xamarin.Android. Can anybody help me?
Reply all
Reply to author
Forward
0 new messages