Skip to content

sunyu912/tensorflow-mobile-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

  1. Run Docker in your Mac

  2. Open the terminal

  3. Downlaod the project workspace. Run:

git clone https://github.com/sunyu912/tensorflow-mobile-example.git

If you see errors on not recognizing git, you need to install Git first. Please see https://git-scm.com/book/en/v2/Getting-Started-Installing-Git

  1. Get into the folder:

cd tensorflow-mobile-example/

  1. Copy your trained tf_files:

cp -r ~/tf_files .

  1. Run Docker environment:

docker run -it --publish 6006:6006 --volume ${HOME}/tensorflow-mobile-example:/tensorflow-mobile-example --workdir /tensorflow-mobile-example tensorflow/tensorflow:1.1.0 bash

  1. Verify the tool and model prediction works:

python scripts/label_image.py tf_files/flower_photos/daisy/21652746_cc379e0eea_m.jpg tf_files/retrained_graph.pb

If you can see the prediction output, that means the tool has been installed correctly.

  1. Optimze the model for mobile:

python -m tensorflow.python.tools.optimize_for_inference --input=tf_files/retrained_graph.pb --output=tf_files/optimized_graph.pb --input_names="Cast" --output_names="final_result"

  1. Copy the optimized models to mobile Android projecT:

cp tf_files/optimized_graph.pb android/assets/retrained_graph.pb

cp tf_files/retrained_labels.txt android/assets/

  1. Open Android Studio (Please install it first at https://developer.android.com/studio/index.html

  2. Import an existing Android project. Please choose the android folder in the tensorflow-mobile-example folder.

  3. Run the project.

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published