Tuesday, May 1, 2018

How to use a trained model of TF Detect in Android

1. How to use Tensorflow Object Detection API
2. How to train for Tensorflow Object Detection API
3. How to use Tensorboard
4. How to use a trained model of TF Detect in Android

We trained a model in previous posts. We will use it for android.

At first, install tensorflow and test if demo apps work.
How to use tensorflow demo apps on android

If it works in your PC, now we change the model used for TF detect.

Open this directory:
$HOME/Documents/tensorflow/tensorflow/examples/android/assets
Maybe it should be something like ~/Documents/tensorflow/tensorflow/examples/android/assets or /home/yourname/Documents/tensorflow/tensorflow/examples/android/assets

Then move your trained .pb file here. Also we will create a label file.

The inside of the thora_label.txt is:
???
thora

Now open "DetectorActivity".


Change the path and point them to the files we created in assets folder like this:

Now start the demo app in your phone! It should detect based on your trained model.
This is a capture of my demo app. You can see that it is detecting Thora's face.