Skip to content

ArnoldKuo/tf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tensorflow

Tensorflow Installation (on Windows)

Tensorflow Sample Code

Intro - Tensorflow Session & Tensorboard

  • jupyter notebook to run intro.ipynb
  • run tensorboard : tensorboard --logdir=./
  • use Chrome to open http://localhost:6006

Basic Machine Learning

  • one neuron network : python3 easy_net.py
  • ten neurons network: python3 hidden_net.py

MNIST : Handwritten Number Recognition

  • 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)

Fashion-MNIST : Fashion Wearing Recongition

  • CNN : python3 fashionmnist_cnn.py

Emotion Detection : Facial Expression Recognition

  • 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

Object Detection

  • 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 (on Windows)

  • 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)

Edge TPU (USB Accelerator on RPi3B)

  • 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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published