So, I have come across a pain point in model deployment on android platform. I have trained a model in python and converted it into tensorflow lite format for android platform. The problem is how to do things/processing that I did in python in Java. After a tedious search on net and going through no. of examples, nothing really explains this process clearly.
Eg: How to emulate preprocess/normalization algorithm in Java i.e. do pre-processing and post-processing of images.
Also what changes to make in code if using quantized model for inference and how to implement passing of multiple inputs to the model.
Below are corresponding code in python:
def preprocess(img):
return (img / 255. - 0.5) * 2
def deprocess(img):
return (img + 1) / 2
Can anyone please guide me as to how to do the same in Java and for multiple inputs. This can be a holy grail for someone looking for model integration in Android.
Thanks in advance!!!