Skip to content

Commit e99d181

Browse files
authored
Update README.md
1 parent 5b7a737 commit e99d181

File tree

1 file changed

+98
-1
lines changed

1 file changed

+98
-1
lines changed

README.md

Lines changed: 98 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,99 @@
1-
# NIH-Chest-X-Rays-Multi-Label-Image-Classification-In-Pytorch
1+
# NIH-Chest-X-rays-Multi-Label-Image-Classification-In-Pytorch
22
Multi-Label Image Classification of the Chest X-Rays In Pytorch
3+
4+
# Dataset
5+
[NIH Chest X-ray Dataset](https://www.kaggle.com/nih-chest-xrays/data#Data_Entry_2017.csv) is used for Multi-Label Disease Classification of of the Chest X-Rays.
6+
There are a total of 15 classes (14 diseases, and one for 'No findings')
7+
Images can be classified as "No findings" or one or more disease classes:
8+
* Atelectasis
9+
* Consolidation
10+
* Infiltration
11+
* Pneumothorax
12+
* Edema
13+
* Emphysema
14+
* Fibrosis
15+
* Effusion
16+
* Pneumonia
17+
* Pleural_thickening
18+
* Cardiomegaly
19+
* Nodule Mass
20+
* Hernia
21+
22+
There are 112,120 X-ray images of size 1024x1024 pixels, in which 86,524 images are for training and 25,596 are for testing.
23+
24+
# Model
25+
Pretrained Resnet50 model is used for Transfer Learning on this new image dataset.
26+
27+
# Loss Function
28+
There is a choice of loss function
29+
* Focal Loss (default)
30+
* Binary Cross Entropy Loss or BCE Loss
31+
32+
# Training
33+
* ### From Scratch
34+
Following are the layers which are set to trainable-
35+
* layer2
36+
* layer3
37+
* layer4
38+
* fc
39+
40+
Terminal Code:
41+
```
42+
python main.py
43+
```
44+
45+
* ### Resume From a Saved Checkpoint
46+
A Saved Checkpoint needs to be loaded which is nothing but a dictionary containing the
47+
* epochs (number of epochs the model has been trained till that time)
48+
* model (architecture and the learnt weights of the model)
49+
* lr_scheduler_state_dict (state_dict of the lr_scheduler)
50+
* losses_dict (a dictionary containing the following loses)
51+
52+
* mean train epoch losses for all the epochs
53+
* mean val epoch losses for all the epochs
54+
* batch train loss for all the training batches
55+
* batch train loss for all the val batches
56+
57+
Different layers of the model are freezed/unfreezed in different stages, defined inside the *main.py* to fit the model well on the data.
58+
59+
Terminal Code:
60+
```
61+
python main.py --resume --ckpt checkpoint_file.pth
62+
```
63+
64+
Training the model will create a **models** directory and will save the checkpoints in there.
65+
66+
# Testing
67+
A Saved Checkpoint needs to be loaded using the **--ckpt** argument and **--test** argument needs to be passed for activating the Test Mode
68+
69+
Terminal Code:
70+
```
71+
python main.py --test --ckpt checkpoint_file.pth
72+
```
73+
74+
# Result
75+
The model achieved the **ROC AUC Score** of **0.88420** after training in the following stages-
76+
77+
#### STAGE 1
78+
* Loss Function: FocalLoss
79+
* lr: 1e-5
80+
* Training Layers: layer2, layer3, layer4, fc
81+
* Epochs: 2
82+
83+
#### STAGE 2
84+
* Loss Function: FocalLoss
85+
* lr: 3e-4
86+
* Training Layers: layer3, layer4, fc
87+
* Epochs: 1
88+
89+
#### STAGE 3
90+
* Loss Function: FocalLoss
91+
* lr: 1e-3
92+
* Training Layers: layer4, fc
93+
* Epochs: 3
94+
95+
#### STAGE 4
96+
* Loss Function: FocalLoss
97+
* lr: 1e-3
98+
* Training Layers: fc
99+
* Epochs: 2

0 commit comments

Comments
 (0)