Skip to content

Commit

Permalink
fix 第4章
Browse files Browse the repository at this point in the history
  • Loading branch information
YutaroOgawa committed Jul 3, 2019
1 parent 6709029 commit 9732d21
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 52 deletions.
7 changes: 6 additions & 1 deletion 4_pose_estimation/4-5_TensorBoardX.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@
"\n",
"tensorbordXを利用するためにtensorbordXとTensorFlowをインストールする必要があります。以下のようにインストールしてください。\n",
"\n",
"pip install tensorflow tensorboardx\n"
"pip install tensorflow \n",
"\n",
"pip install tensorboardx\n",
"\n",
"※ pip install tensorflow tensorboardx でやるとうまくインストールできないようです。。\n",
"\n"
]
},
{
Expand Down
76 changes: 38 additions & 38 deletions 4_pose_estimation/4-6_OpenPose_training.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,16 @@
" ----------\n",
" saved_for_loss : OpenPoseNetの出力(リスト)\n",
"\n",
" heatmap_target : [num_batch, 368, 368, 19]\n",
" heatmap_target : [num_batch, 19, 46, 46]\n",
" 正解の部位のアノテーション情報\n",
"\n",
" heatmap_mask : [num_batch, 368, 368, 19]\n",
" heatmap_mask : [num_batch, 19, 46, 46]\n",
" heatmap画像のmask\n",
"\n",
" paf_target : [num_batch, 368, 368, 38]\n",
" paf_target : [num_batch, 38, 46, 46]\n",
" 正解のPAFのアノテーション情報\n",
"\n",
" paf_mask : [num_batch, 368, 368, 38]\n",
" paf_mask : [num_batch, 38, 46, 46]\n",
" PAF画像のmask\n",
"\n",
" Returns\n",
Expand Down Expand Up @@ -236,7 +236,7 @@
" num_train_imgs = len(dataloaders_dict[\"train\"].dataset)\n",
" batch_size = dataloaders_dict[\"train\"].batch_size\n",
"\n",
" # イタレーションカウンタをセット\n",
" # イテレーションカウンタをセット\n",
" iteration = 1\n",
"\n",
" # epochのループ\n",
Expand Down Expand Up @@ -298,7 +298,7 @@
" if (iteration % 10 == 0): # 10iterに1度、lossを表示\n",
" t_iter_finish = time.time()\n",
" duration = t_iter_finish - t_iter_start\n",
" print('イタレーション {} || Loss: {:.4f} || 10iter: {:.4f} sec.'.format(\n",
" print('イテレーション {} || Loss: {:.4f} || 10iter: {:.4f} sec.'.format(\n",
" iteration, loss.item()/batch_size, duration))\n",
" t_iter_start = time.time()\n",
"\n",
Expand Down Expand Up @@ -336,46 +336,46 @@
"Epoch 1/2\n",
"-------------\n",
"(train)\n",
"イタレーション 10 || Loss: 0.0094 || 10iter: 114.8943 sec.\n",
"イタレーション 20 || Loss: 0.0082 || 10iter: 91.4217 sec.\n",
"イタレーション 30 || Loss: 0.0069 || 10iter: 88.4489 sec.\n",
"イタレーション 40 || Loss: 0.0058 || 10iter: 91.0510 sec.\n",
"イタレーション 50 || Loss: 0.0050 || 10iter: 91.0006 sec.\n",
"イタレーション 60 || Loss: 0.0042 || 10iter: 90.0249 sec.\n",
"イタレーション 70 || Loss: 0.0038 || 10iter: 91.3758 sec.\n",
"イタレーション 80 || Loss: 0.0031 || 10iter: 91.2255 sec.\n",
"イタレーション 90 || Loss: 0.0027 || 10iter: 91.3037 sec.\n",
"イタレーション 100 || Loss: 0.0026 || 10iter: 91.9523 sec.\n",
"イタレーション 110 || Loss: 0.0023 || 10iter: 91.6260 sec.\n",
"イタレーション 120 || Loss: 0.0020 || 10iter: 89.9008 sec.\n",
"イタレーション 130 || Loss: 0.0020 || 10iter: 90.9183 sec.\n",
"イタレーション 140 || Loss: 0.0019 || 10iter: 91.6469 sec.\n",
"イタレーション 150 || Loss: 0.0016 || 10iter: 89.6191 sec.\n",
"イテレーション 10 || Loss: 0.0094 || 10iter: 113.7127 sec.\n",
"イテレーション 20 || Loss: 0.0082 || 10iter: 90.4145 sec.\n",
"イテレーション 30 || Loss: 0.0069 || 10iter: 88.4890 sec.\n",
"イテレーション 40 || Loss: 0.0058 || 10iter: 90.9961 sec.\n",
"イテレーション 50 || Loss: 0.0050 || 10iter: 90.8274 sec.\n",
"イテレーション 60 || Loss: 0.0042 || 10iter: 89.7553 sec.\n",
"イテレーション 70 || Loss: 0.0038 || 10iter: 91.1155 sec.\n",
"イテレーション 80 || Loss: 0.0031 || 10iter: 91.3307 sec.\n",
"イテレーション 90 || Loss: 0.0027 || 10iter: 91.7214 sec.\n",
"イテレーション 100 || Loss: 0.0026 || 10iter: 92.2645 sec.\n",
"イテレーション 110 || Loss: 0.0023 || 10iter: 91.7421 sec.\n",
"イテレーション 120 || Loss: 0.0020 || 10iter: 90.7930 sec.\n",
"イテレーション 130 || Loss: 0.0020 || 10iter: 91.3045 sec.\n",
"イテレーション 140 || Loss: 0.0019 || 10iter: 91.6105 sec.\n",
"イテレーション 150 || Loss: 0.0016 || 10iter: 90.2619 sec.\n",
"-------------\n",
"epoch 1 || Epoch_TRAIN_Loss:0.0043 ||Epoch_VAL_Loss:0.0000\n",
"timer: 1448.9023 sec.\n",
"timer: 1462.0789 sec.\n",
"-------------\n",
"Epoch 2/2\n",
"-------------\n",
"(train)\n",
"イタレーション 160 || Loss: 0.0017 || 10iter: 64.3781 sec.\n",
"イタレーション 170 || Loss: 0.0017 || 10iter: 90.2099 sec.\n",
"イタレーション 180 || Loss: 0.0015 || 10iter: 90.9731 sec.\n",
"イタレーション 190 || Loss: 0.0015 || 10iter: 90.4459 sec.\n",
"イタレーション 200 || Loss: 0.0015 || 10iter: 89.5932 sec.\n",
"イタレーション 210 || Loss: 0.0016 || 10iter: 90.2821 sec.\n",
"イタレーション 220 || Loss: 0.0014 || 10iter: 90.0555 sec.\n",
"イタレーション 230 || Loss: 0.0016 || 10iter: 90.4467 sec.\n",
"イタレーション 240 || Loss: 0.0017 || 10iter: 89.5933 sec.\n",
"イタレーション 250 || Loss: 0.0014 || 10iter: 90.4516 sec.\n",
"イタレーション 260 || Loss: 0.0012 || 10iter: 92.1089 sec.\n",
"イタレーション 270 || Loss: 0.0012 || 10iter: 91.3861 sec.\n",
"イタレーション 280 || Loss: 0.0015 || 10iter: 90.2696 sec.\n",
"イタレーション 290 || Loss: 0.0011 || 10iter: 91.4904 sec.\n",
"イタレーション 300 || Loss: 0.0012 || 10iter: 90.5319 sec.\n",
"イテレーション 160 || Loss: 0.0017 || 10iter: 64.3399 sec.\n",
"イテレーション 170 || Loss: 0.0017 || 10iter: 91.2324 sec.\n",
"イテレーション 180 || Loss: 0.0015 || 10iter: 92.3138 sec.\n",
"イテレーション 190 || Loss: 0.0015 || 10iter: 90.3904 sec.\n",
"イテレーション 200 || Loss: 0.0015 || 10iter: 90.9617 sec.\n",
"イテレーション 210 || Loss: 0.0016 || 10iter: 91.2119 sec.\n",
"イテレーション 220 || Loss: 0.0014 || 10iter: 90.6868 sec.\n",
"イテレーション 230 || Loss: 0.0016 || 10iter: 90.8710 sec.\n",
"イテレーション 240 || Loss: 0.0017 || 10iter: 90.3973 sec.\n",
"イテレーション 250 || Loss: 0.0014 || 10iter: 90.8158 sec.\n",
"イテレーション 260 || Loss: 0.0012 || 10iter: 92.8508 sec.\n",
"イテレーション 270 || Loss: 0.0012 || 10iter: 91.9698 sec.\n",
"イテレーション 280 || Loss: 0.0015 || 10iter: 90.8905 sec.\n",
"イテレーション 290 || Loss: 0.0011 || 10iter: 91.2742 sec.\n",
"イテレーション 300 || Loss: 0.0012 || 10iter: 91.0789 sec.\n",
"-------------\n",
"epoch 2 || Epoch_TRAIN_Loss:0.0015 ||Epoch_VAL_Loss:0.0000\n",
"timer: 1411.6697 sec.\n"
"timer: 1437.0403 sec.\n"
]
}
],
Expand Down
34 changes: 21 additions & 13 deletions 4_pose_estimation/make_folders_and_data_downloads.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -106,39 +106,46 @@
"https://www.dropbox.com/s/bd9ty7b4fqd5ebf/mask.tar.gz?dl=0"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## mask.tar.gzを以下で解凍します"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"# tensorboyさんによる、学習済みのOpenPoseモデル「pspnet50_30.pth」を用意します。\n",
"\n",
"フォルダ「weights」に以下の「pose_model_scratch.pth」を配置\n",
"学習済みモデル「pose_model_scratch.pth」\n",
"# mask.tar.gzの解凍\n",
"save_path = os.path.join(data_dir, \"mask.tar.gz\") \n",
"\n",
"https://www.dropbox.com/s/5v654d2u65fuvyr/pose_model_scratch.pth?dl=0\n",
" \n"
"with tarfile.open(save_path, 'r:*') as tar:\n",
" tar.extractall(data_dir)\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## mask.tar.gzを以下で解凍します"
"# 学習済みモデルのダウンロード"
]
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# mask.tar.gzの解凍\n",
"save_path = os.path.join(data_dir, \"mask.tar.gz\") \n",
"# tensorboyさんによる、学習済みのOpenPoseモデル「pspnet50_30.pth」を用意します。\n",
"\n",
"with tarfile.open(save_path, 'r:*') as tar:\n",
" tar.extractall(data_dir)\n"
"フォルダ「weights」に以下の「pose_model_scratch.pth」を配置\n",
"学習済みモデル「pose_model_scratch.pth」\n",
"\n",
"https://www.dropbox.com/s/5v654d2u65fuvyr/pose_model_scratch.pth?dl=0\n",
" \n"
]
},
{
Expand All @@ -147,6 +154,7 @@
"metadata": {},
"outputs": [],
"source": [
"【※(実施済み)】\n",
"草野球の画像を手動でダウンロード\n",
"\n",
"https://pixabay.com/ja/photos/%E3%83%92%E3%83%83%E3%83%88-%E3%82%AD%E3%83%A3%E3%83%83%E3%83%81%E3%83%A3%E3%83%BC-%E9%87%8E%E7%90%83-1407826/\n",
Expand Down

0 comments on commit 9732d21

Please sign in to comment.