CVPR2019で提案されたDeep High-Resolution Representation Learning for Human Pose Estimationのオフィシャル実装をEC2上で実行するまでの記録です。
EC2は、Deep Learning Base AMI (Ubuntu 18.04) Version 38.0 のP3インスタンスを起動しました。CUDA10.0からCUDA11.1までがプリインストールされていますが、全ては使わないし、容量も圧迫するので、10.0以外は削除しました。これで、32GBほど空きました。
基本は、オフィシャルのレポジトリREADME通りですが、pytorchやcocoapiも含めて全てpip経由でインストールしました。また、EasyDictのbuildが失敗するので、明示的にpip install wheelが必要でした。
$ git clone https://github.com/leoxiaobin/deep-high-resolution-net.pytorch.git $ cd deep-high-resolution-net $ python3 -m venv hrnet_env $ source hrnet_env/bin/activate $ pip install torch torchvision pycocotools $ pip install wheel $ pip install -r requirements.txt $ cd lib; make ; cd .. $ mkdir log $ mkdir output
あとは、データセットとモデルファイルの準備ですが、これが一番時間かかりますね。mpii_human_pose_v1.tar.gzの画像ファイルはimages以下に展開されます。
data/ └── mpii ├── annot │ ├── gt_valid.mat │ ├── test.json │ ├── train.json │ ├── trainval.json │ └── valid.json ├── images └── mpii_human_pose_v1.tar.gz
models/ └── pytorch └── pose_mpii └── pose_hrnet_w32_256x256.pth
最後に、test.pyを実行して、READMEと同じスコアが見れました。
$ python tools/test.py --cfg experiments/mpii/hrnet/w32_256x256_adam_lr1e-3.yaml TEST.MODEL_FILE models/pytorch/pose_mpii/pose_hrnet_w32_256x256.pth GPUS '(0,)' Test: [0/93] Time 9.480 (9.480) Loss 0.0003 (0.0003) Accuracy 0.958 (0.958) | Arch | Head | Shoulder | Elbow | Wrist | Hip | Knee | Ankle | Mean | Mean@0.1 | |---|---|---|---|---|---|---|---|---|---| | pose_hrnet | 97.101 | 95.941 | 90.336 | 86.449 | 89.095 | 87.084 | 83.278 | 90.330 | 37.702 |