Custom Image Classification to continuously classify whatever it sees from the android device's back camera. Inference is performed using the TensorFlow Lite Java API. The demo app classifies frames in real-time, displaying the top most probable classifications. It allows the user to choose between a floating point or quantized model optimization.
These instructions walk you through training,building and running the demo on an Android device.
-
Image dataset of different classes(for custom training)
-
Android Studio
-
Android device in developer mode with USB debugging enabled
-
USB cable (to connect Android device to your computer)
Prepare and upload the dataset to the teachablemachine with google site and define the number of classes accordingly. Train the image classification model over there and finally, export the model in the form of tensorflowlite format.
Clone this GitHub repository to your computer and save it to the folder of your choice. This the java code for android application.
Select Build -> Make Project
and check that the project builds successfully.
You will need Android SDK configured in the settings. You'll need at least SDK
version 23. The build.gradle
file will prompt you to download any missing
libraries.
you have to put the fruits.tflite to the asset folder of the android structure
project directory and change the labels according to the number of class you have trained.
Connect the Android device to the computer and be sure to approve any ADB
permission prompts that appear on your phone. Select Run -> Run app.
Select
the deployment target in the connected devices to the device on which the app
will be installed. This will install the app on the device.