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
*.ipynbscripts 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.ipynbscript or train your own model on a new dataset (demo_2.ipynb). - Create
*.tar.gzor*.zipfile fromdetect.tflitewith your model andlabelmap.txtwith your labels. Save*.tar.gzor*.zipto the Google Drive. Note:labelmap.txtfile 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.gradlefile on your link. UsezipTreefor*.zipandtarTreefor*.tar.gz.
- Our model is not quantized, so set quantized to
falseinDetectorActivity.javafile
- Delete
buildfolder and cleanassetsfolder. Rebuild the project:Build --> Make ProjectthenBuild --> 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.
