[Kaggle]大腸癌を分類[fine tuning]

## はじめに
[つくりながら学ぶ！PyTorchによる発展ディープラーニング](https://www.amazon.co.jp/%E3%81%A4%E3%81%8F%E3%82%8A%E3%81%AA%E3%81%8C%E3%82%89%E5%AD%A6%E3%81%B6%EF%BC%81PyTorch%E3%81%AB%E3%82%88%E3%82%8B%E7%99%BA%E5%B1%95%E3%83%87%E3%82%A3%E3%83%BC%E3%83%97%E3%83%A9%E3%83%BC%E3%83%8B%E3%83%B3%E3%82%B0-%E5%B0%8F%E5%B7%9D-%E9%9B%84%E5%A4%AA%E9%83%8E-ebook/dp/B07VPDVNKW)という本の1-5のファインチューニングで細胞の分類をしてみました。([筆者GitHub](https://github.com/YutaroOgawa/pytorch_advanced/tree/master/1_image_classification)で全てのコードが見られます)
データはKaggleの[Colorectal Histology MNIST](https://www.kaggle.com/kmader/colorectal-histology-mnist)を使いました。

## 開発環境
- Google Colaboratory

## やったこと

Kather_texture_2016_image_tiles_5000フォルダ内に8種類に画像が分類されているのでそれを見分けます。

## 実行結果
```python
使用デバイス： cuda:0
  0%|          | 0/47 [00:00<?, ?it/s]Epoch 1/100
-------------
100%|██████████| 47/47 [07:26<00:00,  9.49s/it]
  0%|          | 0/110 [00:00<?, ?it/s]val Loss: 2.1278 Acc: 0.1060
Epoch 2/100
-------------
100%|██████████| 110/110 [17:17<00:00,  9.43s/it]
  0%|          | 0/47 [00:00<?, ?it/s]train Loss: 0.8146 Acc: 0.7206
100%|██████████| 47/47 [00:12<00:00,  3.76it/s]
  0%|          | 0/110 [00:00<?, ?it/s]val Loss: 0.4196 Acc: 0.8547
Epoch 3/100
-------------
100%|██████████| 110/110 [01:04<00:00,  1.71it/s]
  0%|          | 0/47 [00:00<?, ?it/s]train Loss: 0.3953 Acc: 0.8597
100%|██████████| 47/47 [00:12<00:00,  3.79it/s]
  0%|          | 0/110 [00:00<?, ?it/s]val Loss: 0.3262 Acc: 0.8853
Epoch 4/100
-------------
100%|██████████| 110/110 [01:04<00:00,  1.71it/s]
  0%|          | 0/47 [00:00<?, ?it/s]train Loss: 0.3165 Acc: 0.8894
100%|██████████| 47/47 [00:12<00:00,  3.84it/s]
  0%|          | 0/110 [00:00<?, ?it/s]val Loss: 0.2910 Acc: 0.8973
Epoch 5/100
-------------
100%|██████████| 110/110 [01:04<00:00,  1.71it/s]
  0%|          | 0/47 [00:00<?, ?it/s]train Loss: 0.2828 Acc: 0.8971
100%|██████████| 47/47 [00:12<00:00,  3.81it/s]
  0%|          | 0/110 [00:00<?, ?it/s]val Loss: 0.2194 Acc: 0.9247
Epoch 6/100
-------------
100%|██████████| 110/110 [01:04<00:00,  1.71it/s]
  0%|          | 0/47 [00:00<?, ?it/s]train Loss: 0.2596 Acc: 0.9097
100%|██████████| 47/47 [00:12<00:00,  3.83it/s]
  0%|          | 0/110 [00:00<?, ?it/s]val Loss: 0.2573 Acc: 0.9087
Epoch 7/100
-------------
100%|██████████| 110/110 [01:04<00:00,  1.71it/s]
  0%|          | 0/47 [00:00<?, ?it/s]train Loss: 0.2405 Acc: 0.9171
100%|██████████| 47/47 [00:12<00:00,  3.84it/s]
  0%|          | 0/110 [00:00<?, ?it/s]val Loss: 0.2294 Acc: 0.9240
Epoch 8/100
-------------
100%|██████████| 110/110 [01:04<00:00,  1.71it/s]
  0%|          | 0/47 [00:00<?, ?it/s]train Loss: 0.2199 Acc: 0.9223
100%|██████████| 47/47 [00:12<00:00,  3.88it/s]
  0%|          | 0/110 [00:00<?, ?it/s]val Loss: 0.2053 Acc: 0.9267
Epoch 9/100
-------------
100%|██████████| 110/110 [01:04<00:00,  1.71it/s]
  0%|          | 0/47 [00:00<?, ?it/s]train Loss: 0.1993 Acc: 0.9309
100%|██████████| 47/47 [00:12<00:00,  3.85it/s]
  0%|          | 0/110 [00:00<?, ?it/s]val Loss: 0.2009 Acc: 0.9293
Epoch 10/100
-------------
100%|██████████| 110/110 [01:03<00:00,  1.72it/s]
  0%|          | 0/47 [00:00<?, ?it/s]train Loss: 0.2097 Acc: 0.9280
100%|██████████| 47/47 [00:12<00:00,  3.85it/s]
  0%|          | 0/110 [00:00<?, ?it/s]val Loss: 0.1770 Acc: 0.9400
Epoch 11/100
-------------
100%|██████████| 110/110 [01:03<00:00,  1.72it/s]
  0%|          | 0/47 [00:00<?, ?it/s]train Loss: 0.1860 Acc: 0.9363
100%|██████████| 47/47 [00:12<00:00,  3.90it/s]
  0%|          | 0/110 [00:00<?, ?it/s]val Loss: 0.1753 Acc: 0.9400
Epoch 12/100
-------------
100%|██████████| 110/110 [01:03<00:00,  1.74it/s]
  0%|          | 0/47 [00:00<?, ?it/s]train Loss: 0.1751 Acc: 0.9429
100%|██████████| 47/47 [00:11<00:00,  3.95it/s]
  0%|          | 0/110 [00:00<?, ?it/s]val Loss: 0.2092 Acc: 0.9260
Epoch 13/100
-------------
100%|██████████| 110/110 [01:03<00:00,  1.73it/s]
  0%|          | 0/47 [00:00<?, ?it/s]train Loss: 0.1595 Acc: 0.9466
100%|██████████| 47/47 [00:11<00:00,  3.92it/s]
  0%|          | 0/110 [00:00<?, ?it/s]val Loss: 0.2082 Acc: 0.9307
Epoch 14/100
-------------
100%|██████████| 110/110 [01:03<00:00,  1.73it/s]
  0%|          | 0/47 [00:00<?, ?it/s]train Loss: 0.1653 Acc: 0.9431
100%|██████████| 47/47 [00:11<00:00,  3.94it/s]
  0%|          | 0/110 [00:00<?, ?it/s]val Loss: 0.1639 Acc: 0.9500
```
大体この辺でval lossが定常状態に達したので載せるのはここまでにしておきます。
精度95%はすごくないですか。
## 考察・終わりに
病理組織画像も見分けられるというのは驚き桃の木山椒の木。