/see-celeb

Primary LanguagePython

Running the Demo

Prerequisites

cd &&
git clone git@github.com:tensorflow/tensorflow.git &&
git clone git@github.com:zyin3/see-celeb.git
  • Download the datasets
mkdir -p ~/datasets/lfw && cd ~/datasets/lfw &&
wget http://vis-www.cs.umass.edu/lfw/lfw.tgz &&
tar -zxvf lfw.tgz
  • Install OpenCV, numpy, sklearn, Green Unicorn and Flask
sudo apt-get install python-opencv gunicorn &&
pip install --user numpy flask sklearn

Train the model

  • Train the final 2 layers of Inception v3 model
cd ~/see-celeb/src &&
sh scripts/finetune_inception_v3_on_lfw.sh
  • Export inference graph
cd ~/see-celeb/src &&
python export_inference_graph.py --alsologtostderr --model_name=inception_v3 \
--output_file /tmp/inception_v3_inf_graph.pb --dataset_name=lfw
  • Freeze the graph
cd ~/tensorflow &&
bazel build tensorflow/python/tools:freeze_graph &&
bazel-bin/tensorflow/python/tools/freeze_graph   --input_graph=/tmp/inception_v3_inf_graph.pb \
--input_checkpoint=/tmp/celeb-models/inception_v3/model.ckpt-<step number> \
--input_binary=true --output_graph=/tmp/frozen_inception_v3.pb \
--output_node_names=InceptionV3/Predictions/Reshape_1

Launch the image classification demo

cd ~/see-celeb/src/serving && sh run.sh

Then open http://localhost:5001 in your browser.