|
| 1 | +# Training Recipe |
| 2 | + |
| 3 | +## Get datasets |
| 4 | + |
| 5 | +### MPII Human Pose Dataset |
| 6 | + |
| 7 | +- Download the [dataset](https://datasets.d2.mpi-inf.mpg.de/andriluka14cvpr/mpii_human_pose_v1.tar.gz) and create a link to the `images` directory at `./data/mpii/ |
| 8 | +images` |
| 9 | + ``` |
| 10 | + ln -s ${MPII_PATH}/images ./data/mpii/images |
| 11 | + ``` |
| 12 | + |
| 13 | +- Download the [annotation file](https://drive.google.com/open?id=1mQrH_yVHeB93rzCfyq5kC9ZYTwZeMsMm) in our JSON format, and save it to `./data/mpii/mpii_annotations.json` |
| 14 | + |
| 15 | +- You are good to go! |
| 16 | + |
| 17 | + |
| 18 | +### COCO Keypoints 2014/2017 |
| 19 | + |
| 20 | +- Download datasets: |
| 21 | + ``` |
| 22 | + cd ./data/mscoco |
| 23 | + wget http://images.cocodataset.org/zips/train2014.zip |
| 24 | + wget http://images.cocodataset.org/zips/val2014.zip |
| 25 | + wget http://images.cocodataset.org/zips/train2017.zip |
| 26 | + wget http://images.cocodataset.org/zips/val2017.zip |
| 27 | + unzip train2014.zip -d images |
| 28 | + unzip train2014.zip -d images |
| 29 | + unzip train2014.zip -d images |
| 30 | + unzip train2014.zip -d images |
| 31 | + rm -rf *.zip |
| 32 | + ``` |
| 33 | + |
| 34 | +- You are good to go! |
| 35 | + |
| 36 | +### Leeds Sports Pose (LSP) |
| 37 | +- Download datasets: |
| 38 | + ``` |
| 39 | + mkdir -p ./data/lsp/images |
| 40 | + cd ./data/lsp/images |
| 41 | + wget http://sam.johnson.io/research/lsp_dataset.zip |
| 42 | + wget http://sam.johnson.io/research/lspet_dataset.zip |
| 43 | + unzip lsp_dataset.zip -d lsp_dataset |
| 44 | + unzip lspet_dataset.zip -d lspet_dataset |
| 45 | + ``` |
| 46 | +- You are good to go! |
| 47 | + |
| 48 | +## Training |
| 49 | +- Example 1: Train from scratch - ECCV'16 8-stack hourglass network |
| 50 | +``` |
| 51 | +CUDA_VISIBLE_DEVICES=0 python ./example/main.py \ |
| 52 | +--dataset mpii \ |
| 53 | +--arch hg \ |
| 54 | +--stack 8 \ |
| 55 | +--block 1 \ |
| 56 | +--features 256 \ |
| 57 | +--checkpoint ./checkpoint/mpii/hg-s8-b1 |
| 58 | +``` |
| 59 | + |
| 60 | +- Example 2: Train a much faster version of HG (e.g., 1-stack) |
| 61 | +``` |
| 62 | +CUDA_VISIBLE_DEVICES=0 python ./example/main.py \ |
| 63 | +--dataset mpii \ |
| 64 | +--arch hg \ |
| 65 | +--stack 1 \ |
| 66 | +--block 1 \ |
| 67 | +--features 256 \ |
| 68 | +--checkpoint ./checkpoint/mpii/hg-s1-b1 |
| 69 | +``` |
| 70 | + |
| 71 | +- Example 3: Train on COCO 2014/2017 (set `--year` argument ) |
| 72 | +``` |
| 73 | +CUDA_VISIBLE_DEVICES=0 python ./example/main.py \ |
| 74 | +--dataset mscoco \ |
| 75 | +--year 2017 \ |
| 76 | +--arch hg \ |
| 77 | +--stack 1 \ |
| 78 | +--block 1 \ |
| 79 | +--features 256 \ |
| 80 | +--checkpoint ./checkpoint/mscoco/hg-s1-b1 |
| 81 | +``` |
| 82 | + |
| 83 | +- Example 4: resume training from a checkpoint |
| 84 | +``` |
| 85 | +CUDA_VISIBLE_DEVICES=0 python ./example/main.py \ |
| 86 | +--dataset mpii \ |
| 87 | +--arch hg \ |
| 88 | +--stack 8 \ |
| 89 | +--block 1 \ |
| 90 | +--features 256 \ |
| 91 | +--checkpoint ./checkpoint/mpii/hg-s8-b1 \ |
| 92 | +--resume ./checkpoint/mpii/hg-s8-b1/checkpoint.pth.tar |
| 93 | +``` |
| 94 | + |
| 95 | + |
| 96 | +- **Evaluation** from an existing model: use `-e` |
| 97 | +``` |
| 98 | +CUDA_VISIBLE_DEVICES=0 python ./example/main.py \ |
| 99 | +--dataset mpii \ |
| 100 | +--arch hg \ |
| 101 | +--stack 8 \ |
| 102 | +--block 1 \ |
| 103 | +--features 256 \ |
| 104 | +--checkpoint ./checkpoint/mpii/hg-s8-b1 \ |
| 105 | +--resume ./checkpoint/mpii/hg-s8-b1/checkpoint.pth.tar \ |
| 106 | +-e |
| 107 | +``` |
| 108 | + |
| 109 | +- **Debug**: Use `-d` if you want to visualize the keypoints with images |
| 110 | +``` |
| 111 | +CUDA_VISIBLE_DEVICES=0 python ./example/main.py \ |
| 112 | +--dataset mpii \ |
| 113 | +--arch hg \ |
| 114 | +--stack 1 \ |
| 115 | +--block 1 \ |
| 116 | +--features 256 \ |
| 117 | +--checkpoint ./checkpoint/mpii/hg-s1-b1 \ |
| 118 | +--resume ./checkpoint/mpii/hg-s1-b1/checkpoint.pth.tar \ |
| 119 | +-e \ |
| 120 | +-d |
| 121 | +``` |
| 122 | + |
| 123 | +The visualized images should be like |
| 124 | + |
| 125 | + |
0 commit comments