Exploiting transfer learning methods to try and classify X-ray chest Images into normal(healthy) vs abnormal(sick)
we will see the performance of transfer learning using the official pre-trained model offered by Google (INCEPTION-RESNET-V2 MODEL), which can be found in TensorFlow’s model library
In this little/first try we will be retraining the last layer of inception v2 of google to classify the images using adam optimizer and learning rate decay
python 3 tensorflow = 1.0.1 matplotlib lxml
model used : INCEPTION-RESNET-V2
learning rate : 0.0001 with a decay factor of 0.7 each 2 epochs
batch size : 16
number of epochs : 30
Recall : coming soon
Precision : coming soon
In the data
folder (cd data/
) :
1 - Use python get_data.py
to download scrapped image data from openi.nlm.nih.gov. It has a large base of Xray,MRI, CT scan images publically available.Specifically Chest Xray Images have been scraped.The images will be downloaded and saved in images/
and the labels in data_new.json
(it might take a while)
Some info about the dataset :
Total number of Images : 7469
The classes with most occurence in the dataset:
('normal', 2696)
('No Indexing', 172)
('Lung/hypoinflation', 88)
('Thoracic Vertebrae/degenerative/mild', 55)
('Thoracic Vertebrae/degenerative', 44)
('Spine/degenerative/mild', 36)
('Spine/degenerative', 35)
('Spondylosis/thoracic vertebrae', 33)
('Granulomatous Disease', 32)
('Cardiomegaly/mild', 32)
2 - Use python gen_data.py
to sort labels into Normal/Abnormal classes, generate full path to coresponding Images and write them to data.txt
number of normal chest Images(healthy people) 2696:
number of abnormal chest Images(sick people) 4773:
3 - Use python convert_to_tf_records.py
to generate tf records of the data.
Download the Pre-trained inception model in here and unzip it in ckpt/
folder.
Use python train.py
to start the training !(trained model will be saved in logs/
)
Use python evaluate.py
to run evaluation using the model saved in logs/
(metric : streaming accuracy over all mini batches)