Application detects 3 kinds of objects: hazelnut, fig and date.
This is a front-end solution for object detection on Android. For the back-end solution, please, visit my project for image classification on Android.
There are 2 main components:
- model training scripts -
Google Colab
*.ipynb
scripts to use TensorFlow object detection API. - mobile app - a mobile application that uses trained model in Android. It was copied from TensorFlow Lite object detection Android Demo.
TensorFlow Object Detection API is an open source framework built on top of TensorFlow that makes it easy to construct, train and deploy object detection models.
To run model on your mobile phone:
- Take existing pre-trained model from the
model zoo,
test it with
demo_1.ipynb
script or train your own model on a new dataset (demo_2.ipynb
). - Create
*.tar.gz
or*.zip
file fromdetect.tflite
with your model andlabelmap.txt
with your labels. Save*.tar.gz
or*.zip
to the Google Drive. Note:labelmap.txt
file should start with???
string, because zero position is reserved. So your class labels will start from the 1st position after???
string. - Get downloadable direct link using direct link generator for Google Drive, Dropbox or Onedrive.
- Replace link in the mobile app
download_model.gradle
file on your link. UsezipTree
for*.zip
andtarTree
for*.tar.gz
. - Our model is not quantized, so set quantized to
false
inDetectorActivity.java
file - Delete
build
folder and cleanassets
folder. Rebuild the project:Build --> Make Project
thenBuild --> Build Bundles --> Build APK
. - Run mobile app (
Run --> Run 'app'
) in Android Studio and enjoy!
Links:
- Original article: How to configure Tensorflow object detection API with google colab.
- Original article: How to train an object detection model easy for free.
- Object Detection Demo for the local computer (not Colab).
- This article will help much: Real-time face recognition
- Pre-trained models in the Tensorflow detection model zoo.