In this blog, I will outline how to build a reliable image classification model using a convolutional neural network to detect the presence of pneumonia from chest X-ray images.
Pneumonia is a common infection that inflames the air sacs in the lungs causing symptoms such as difficulty breathing and fever. Even though pneumonia is not difficult to treat, a timely diagnosis is crucial. Without proper treatment, pneumonia can become fatal especially among children and elders. Chest X-ray is an affordable method for the diagnosis of pneumonia. Developing a model that can reliably classify pneumonia from X-ray images can alleviate a load of physicians in the areas where the demand is high.
Kermany and his colleagues at UCSD took the initiative to identify diseases based on the chest X-rays and Optical Coherence Tomography scans using deep learning. We used chest X-ray images provided in their study as our dataset.
A data folder should be structured as below.
DATA
│
├── train
│ ├── NORMAL
│ └── PNEUMONIA
│
├── test
│ ├── NORMAL
│ └── PNEUMONIA
│
└── validation
├── NORMAL
└── PNEUMONIA
After removing image files without proper encodings, we had 5,639 files in our data set, and we used 15% of these images as our validation set and the other 15% as a testing set. Our final training set included 1,076 normal cases and 2,873 cases of pneumonia.
#medical #data-science #keras #image-classification