Could you please suggest a library (or a snippet) to implement pre-processing Python methods (e.g. numpy.expand_dims()
or img_to_array
) on Android API 18 (to deploy an app based on TensorFlow Mobile)? There are analogous libraries to Python on Java (e.g. ND4J), but they require device or emulator that runs API level 21 or higher.
from keras.preprocessing.image import img_to_array
import numpy as np
image = img_to_array(image)
image = np.expand_dims(image, axis=0)
image /= 255.