Skip to content

MobileNetV2 Training

Katsuya Hyodo edited this page Jun 7, 2020 · 17 revisions

Tensorflow-GPU v1.15.2 - CUDA10.1, cuDNN7, Python3.6, Ubuntu1804 https://drive.google.com/file/d/1QjmkICCoTUPyPW0H4q84brQqWAI3Ymcr/view?usp=sharing

mkdir -p /media/b920405/Windows/datasets/coco/dataset
cd /media/b920405/Windows/datasets/coco/dataset
curl -sc /tmp/cookie "https://drive.google.com/uc?export=download&id=1P5pir4LVhev_S1Yvu_K3q_hGERAcFpg6" > /dev/null
CODE="$(awk '/_warning_/ {print $NF}' /tmp/cookie)"
curl -Lb /tmp/cookie "https://drive.google.com/uc?export=download&confirm=${CODE}&id=1P5pir4LVhev_S1Yvu_K3q_hGERAcFpg6" -o annotations_trainval2017.zip
unzip annotations_trainval2017.zip
rm annotations_trainval2017.zip
curl -sc /tmp/cookie "https://drive.google.com/uc?export=download&id=1llUu6071hd0QY2DY5vs_7VPaceI7EVst" > /dev/null
CODE="$(awk '/_warning_/ {print $NF}' /tmp/cookie)"
curl -Lb /tmp/cookie "https://drive.google.com/uc?export=download&confirm=${CODE}&id=1llUu6071hd0QY2DY5vs_7VPaceI7EVst" -o train2017.zip
unzip train2017.zip
rm train2017.zip
curl -sc /tmp/cookie "https://drive.google.com/uc?export=download&id=1bB8M-WG2LJwmB6YpLMsxUTWwIX3BwYkr" > /dev/null
CODE="$(awk '/_warning_/ {print $NF}' /tmp/cookie)"
curl -Lb /tmp/cookie "https://drive.google.com/uc?export=download&confirm=${CODE}&id=1bB8M-WG2LJwmB6YpLMsxUTWwIX3BwYkr" -o val2017.zip
unzip val2017.zip
rm val2017.zip
export PYTHONPATH=$PYTHONPATH:${HOME}/models/research:${HOME}/models/research/slim
python3 tf_pose/train.py \
  --model=mobilenet_v2_1.0 \
  --datapath=/media/b920405/Windows/datasets/coco/dataset/annotations/ \
  --imgpath=/media/b920405/Windows/datasets/coco/dataset/ \
  --batchsize=2 \
  --gpus=1 \
  --max-epoch=10 \
  --lr=0.001
    with tf.Session(config=config) as sess:
        loader = tf.train.Saver(net.restorable_variables())
        loader.restore(sess, pretrain_path)

        tf.train.write_graph(sess.graph_def, './tmp', 'graph.pb', as_text=True)

    with tf.Session(config=config) as sess:
        loader = tf.train.Saver(net.restorable_variables())
        loader.restore(sess, 'models/train/test/model_latest-370000')

        tf.train.write_graph(sess.graph_def, './tmp', 'graph.pbtxt', as_text=True)
python3 run_checkpoint.py \
  --model=mobilenet_v2_1.0 \
  --resize=432x368
python3 run_checkpoint.py \
  --model=mobilenet_v2_1.0 \
  --resize=256x256
python3 -m tensorflow.python.tools.freeze_graph \
  --input_graph=./tmp/graph.pbtxt \
  --output_graph=models/train/test/frozen_graph.pb \
  --input_checkpoint=models/train/test/model_latest-370000 \
  --output_node_names="Openpose/concat_stage7"
Clone this wiki locally