[PYTHON] [Kaggle] Classify colorectal cancer [fine tuning]

Introduction

[Learn while making! Development Deep Learning by 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% 1 of the book B3% E3% 82% B0-% E5% B0% 8F% E5% B7% 9D-% E9% 9B% 84% E5% A4% AA% E9% 83% 8E-ebook / dp / B07VPDVNKW) I tried to classify cells with -5 fine tuning. (You can see all the code at Author GitHub) The data used was Kaggle's Colorectal Histology MNIST.

Development environment

What i did

There are 8 types of images in the Kather_texture_2016_image_tiles_5000 folder, so you can tell them apart.

Execution result

Device used: 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

Since the val loss has reached a steady state around here, I will leave it here. Isn't the accuracy 95% really good?

Consideration / end

It is surprising that the histopathological image can also be distinguished. Peach tree Sansho tree.

Recommended Posts

[Kaggle] Classify colorectal cancer [fine tuning]
BigTransfer (BiT) Fine Tuning