-
Install Microsoft Visual Studio Community 2019 v16.0.4
-
Install Python 3.7 for Windows
-
Install nVidia CUDA 10.1 & CuDNN 7.6
-
Install Tensorflow
-
pip install tensorflow-2.0.0-cp37-cp37m-win_amd64.whl
Tensorflow 2.0.0 cpu for Windows10
Tensorflow 2.0.0 cpu for Windows7 -
pip install tensorflow_gpu-2.0.0-cp37-cp37m-win_amd64.whl
Tensorflow 2.0.0 cpu for Windows10
Tensorflow 2.0.0 cpu for Windows7 -
pip install tensorflow-1.14.0-cp37-cp37m-win_amd64.whl
Tensorflow 1.14.0 cpu for Windows10
Tensorflow 1.14.0 cpu for Windows7 -
pip install tensorflow_gpu-1.14.0-cp37-cp37m-win_amd64.whl
Tensorflow 1.14.0 gpu for Windows10
Tensorflow 1.14.0 gpu for Windows7
-
-
Download Examples
git clone https://github.com/rkuo2000/tf
-
Go to directory
cd tf
jupyter notebook
to run intro.ipynb- run tensorboard :
tensorboard --logdir=./
- use Chrome to open http://localhost:6006
- one neuron network :
python3 easy_net.py
- ten neurons network:
python3 hidden_net.py
- plot data :
python3 mnist_plotdata.py
- DNN :
python3 mnist.py
- CNN :
python3 mnist_cnn.py
- load model to predict :
python3 mnist_cnn_test.py
(test data)
python3 mnist_cnn_image.py
(image file)
python3 mnist_cnn_webcam.py
(camera)
- CNN :
python3 fashionmnist_cnn.py
- Download the FER-2013 dataset from here and unzip it under data folder.
- change directory name from data/data to data/fer2013
- To train the model, run
python3 emotion_detection.py --mode train
- To detect facial expression, run
python3 emotion_detection.py --mode detect
- Download Google Images
python3 download_google_images.py bread
- Download a pretrained model
Download a pretrained model from TensorFlow Model Zoo
cd ~/models/research/object_detection
tar zxvf ~/Downloads/ssd_mobilenet_v2_coco_2018_03_29.tar.gz
- Run Object_Detection
cp ~/tf/Object_detection_*.py .
python3 Object_detection_image.py
python3 Object_detection_webcam.py
- Export Frozen_Inference_Graph
cp ~/tf/export_inference_graph.sh .
./export_inference_graph.sh training model.ckpt-????
- Convert TF model to TFLite (for Android App)
cp ~/tf/tflite_*.sh .
(copy shell files)
./tflite_export.sh
(convert from model.ckpt to tflite_graph.pb)
./tflite_convert_pb.sh
(convert tflite_graph.pb to model.tflite)
./tflite_convert_pb_quant.sh
(convert tflite_graph.pb to model_quant.tflite)
- Transfer Learning using Keras Mobilenet V2
cd ~/tf
python3 download_google_images.py "blue tit"
(download dataset)
python3 download_google_images.py crow
(download dataset)
python3 transfer_learning_mobilenetv2.py
(transfer learning)
python3 transfer_learning_image.py
(load model and test image file)
python3 transfer_learning_webcam.py
(load model and input from webcam ) - Convert Keras model to TFLite (for Android App)
./tflite_convert_h5.sh
(convert tl_mobilenetv2.h5 to tl_mobilenetv2.tflite)
./tflite_convert_h5_quant.sh
(convert tl_mobilenetv2.h5 to tl_mobilenetv2_quant.tflite)
- Convert _quant.tflite to _quant_edgetpu.tflite
- upload tl_mobilenetv2_quant.tflite to EdgeTPU online compiler
- download _quant_edgetput.tflite and copy to RPi3
- On RPi3B
cd ~
git clone https://github.com/rkuo2000/tf
(clone sample codes)
cd ~/tf
vi model/bird_labels.txt
(create label file) - To test the model :
python3 edgetpu_classify_webcam.py --model model/tl_mobilenetv2_quant.tflite --label model/bird_labels.txt
python3 edgetpu_classify_image.py --model model/tl_mobilenetv2_quant.tflite --label model/bird_labels.txt