0% found this document useful (0 votes)
16 views

Ioegc 13 010 030

This paper presents a model called DCXNet that can detect 14 chest conditions from chest X-rays. DCXNet uses a customized DenseNet-169 model trained on the ChestX-Ray14 dataset. It achieves performance on par with CheXNeXt but trains significantly faster, in just 4 hours compared to CheXNeXt's 20 hours. The paper compares DCXNet's performance to other models and finds it outperforms some models and achieves similar results to CheXNeXt.

Uploaded by

manojbaniya727
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Ioegc 13 010 030

This paper presents a model called DCXNet that can detect 14 chest conditions from chest X-rays. DCXNet uses a customized DenseNet-169 model trained on the ChestX-Ray14 dataset. It achieves performance on par with CheXNeXt but trains significantly faster, in just 4 hours compared to CheXNeXt's 20 hours. The paper compares DCXNet's performance to other models and finds it outperforms some models and achieves similar results to CheXNeXt.

Uploaded by

manojbaniya727
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Proceedings of 13th IOE Graduate Conference

Peer Reviewed
ISSN: 2350-8914 (Online), 2350-8906 (Print)
Year: 2023 Month: April Volume: 13

Chest X-Ray Classification using DenseNet


Ankit Karna a , Aadarsh Jha b , Alish Dahal c , Anup Pandey d , Tantra Nath Jha e
a, b, c, d, e Department of Electronics and Computer Engineering, Purwanchal Campus, IOE, TU, Nepal
a [email protected] , b [email protected], c [email protected], d [email protected], e [email protected],

Abstract
Chest X-Ray classification is a challenging and time consuming task in medical image classification due to the complexity of the
human chest structure and the subtle variations in X-Ray images caused by different medical conditions. This paper presents a
model, DCXNet that can detect 14 different chest conditions from Chest X-Rays. The model makes use of deep learning techniques
and transfer learning methods for better accuracy and faster training time. The presented model, DCXNet is a customized
DenseNet-169 model which is a 169 layer Convolutional Neural Network (CNN) trained on ChestX-Ray14, one of the largest
publicly available Chest X-Ray dataset, containing over 112,000 frontal view X-Ray images of 30,805 unique patients with 14 chest
conditions. This dataset was obtained from National Institutes of Health (NIH), USA. Various tools like NumPy, Pandas were used
for initial data analysis, while Matplotlib and Seaborn was used for data visualization. The presented model was implemented in
Tensorflow.
The presented model is compared to other existing models on the basis of AUC metric. The mean AUC of the presented model
is 0.82 which outperformed Wang (AUC ≥ 0.09) and Yao (AUC ≥ 0.02) and acheived on par performance with CheXNeXt (AUC
≤ 0.02). The training time was much faster than CheXNeXt which took around 20 hours for each training stage while the presented
model DCXNet completed training in just 4 hours.
Keywords
X-Ray, CNN, DenseNet-169, Transfer Learning, Tensorflow

1. Introduction CheXNeXt. CheXNeXt required nearly 20 hours for each


training stage while DCXNet only required 4 hours of training.
The most used imaging test worldwide is chest radiography, It was found that the presented model, DCXNet performs on par
which is essential for the early detection, diagnosis, and with CheXNeXt and even outperforms it on 4 of the chest
treatment of many serious illnesses. Chest illnesses are a major conditions namely Cardiomegaly, Emphysema, Fibrosis and
public health concern in the country. Radiology is currently a Hernia.
growing field in Nepal. Nepal has evolved over the years, with
the introduction of new technologies and advanced imaging
techniques. However, there are still challenges that need to be 2. Literature Review
addressed, such as the shortage of trained radiologists. Only 300
radiologists are registered in Nepal as of 2021, which is In the realm of medical image processing, categorization of
insufficient to service the entire country’s population, according chest X-rays has been a hotly debated subject. The authors of
to the Nepal Medical Council. In remote locations, where there [1] defined a network architecture called Densenet. This
are few or no radiologists accessible, the lack of radiologists is architecture shows methods on how convolutional networks can
extremely severe, making it challenging for patients to get be trained much more thoroughly, precisely, and quickly which
diagnostic imaging services. The availability of skilled helps in multi-label classifcation problems. The authors in [4]
radiologists is essential for the difficult process of identifying presented a dataset called ChestX-ray8, which contains 108,948
various chest ailments from X-rays. X-Ray images with 8 chest conditions. They also demonstrated
that these 8 conditions can be located via weakly-supervised
This paper presents a model which can automatically detect 14 multi-label image classification. The authors of [5] introduced
different chest conditions namely Effusion, Cardiomegaly, and assessed a partial resolution that utilizes LSTMs to exploit
Emphysema, Nodule, Pneumonia, Pleural Thickening, Hernia, connections among target labels to predict 14 pathological
Fibrosis, Infiltration, Pneumothorax, Edema, Consolidation, patterns from chest X-ray images. They achieved leading
Mass and Atelectasis from chest X-Rays. This paper proposes performance results on the most extensive publicly accessible
the use of customized Densent-169[1] for the classification of chest X-ray dataset from the NIH without any pre-training in
chest X-Rays. The paper proposes the use of a customized 2018. In order to diagnose 14 distinct chest disorders, the
weighted cross-entropy loss to handle the problem of class authors of [3] compares the effectiveness of the CheXNeXt
imbalance in the dataset. This paper also proposes using algorithm to that of professional radiologists. The outcomes
Grad-CAM1 [2] to create images of each class with localized demonstrate that the algorithm performed on par with
heatmaps. radiologists and has the ability to support clinical judgment.
The performance of this model was compared to CheXNeXt[3]. This paper produces best outcomes on ChestX-Ray14 dataset
The training period of DCXNet was significantly less than with the help of ensemble methods but requires vey large
training periods as training is done in two steps. In the 1st step
1 Gradient-weighted Class Activation Maps nearly 10 different networks are trained and then few of the best

Pages: 64 – 67
Proceedings of 13th IOE Graduate Conference

performing models are then selected to create the final model. following results:
This does produce better results but at high cost of training time.

3. Methodology

3.1 Block Diagram

Figure 1: Block Diagram

3.2 Data Figure 2: Imbalance in the dataset

The data used for training the model was obtained from NIH2
which contained 112,000 frontal-view X-Ray images of 30,805 • The most unbalanced pathology is Hernia, with 0.1% of
unique patients. The dataset is known as ChestX-Ray14. The patients testing positive for training..
dataset contains 14 labels for each image with values either 0 • However, only 17.5% of the training instances for the
indicating negative for the label and 1 meaning that the image is Infiltration pathology, which has the least degree of
positive for the label. imbalance, have been classified as positive.

3.2.1 Data Preprocessing This class imbalace issue doesnot allow for a normal
The total size of obtained database was 42.5 GB. The labels for cross-entropy loss for each class. For a balanced data set the loss
all images were stored in a CSV file. The file was then loaded into function is:
dataframe using pandas. The path to each image was obtained
and added to dataframe. All of labels were identified and one-hot- L(xi ) = −(yi log( f (xi )) + (1 − yi )log(1 − f (xi )))
encoding was performed. The images were normalized based on
the mean and standard deviation of images in the dataset. The where xi and yi are the input features and their corresponding
images were then resized to target size of 320x320. labels and f (xi ) is the output of the model which indicates the
probability that it is positive. With the use of this formulation, we
3.2.2 Training Set can observe that the loss will be dominated by the negative class
in situations when there is a significant imbalance and there are
The dataset was initially split randomly using group shuffle split few positive training events. One way of balancing such datasets
into 70% and 30%, with 70% being the training set. Remaining require multiplying each class by a class-specific weight factors,
30% of data was then again split into two equal halves for test w p and wn where w p is the frequency of negative samples and
and validation sets. The training set contains 78,566 images wn is the frequency of positive samples for each class. Then the
while both the validation and test contains 16,777 images each. previous unweighted loss function was modified as:
No data overlapping was found between these sets.
Lw (x) = −(w p ylog( f (x)) + wn (1 − y)log(1 − f (x)))
3.2.3 Test Set

After splitting the data, the test set had 16,777 frontal chest X- This equation was used to calculate the loss for each class and
Rays. According to NIH, these images were annotated by four then the total loss can be calculated as the mean of the loss of
practicing radiologists at Stanford University. Radiologists were each of the classes.
not given access to any patient information or were informed of
the prevalence of any diseases in the data.
3.4 Model Architecture and Training

3.3 Loss function and Class Imbalance The presented model, DCXNet is a customized Densent-169[1],
a 169 layer Convolutional Neural Network trained on the
The dataset that was used to train the model is prone to class ChestX-ray14 dataset. DenseNets enhance information flow and
imabalce problem. EDA3 on the training dataset led to the gradients inside the network, making very deep network
2 National Institutes of Health optimization feasible. The final fully connected layer was
3 Exploratory Data Analysis replaced with a global average pooling layer after which a fully

65
Chest X-Ray Classification using DenseNet

connected layer which produces a 14-dimensional output was diagnostic performance measure, AUC4 was used. AUC is a
added. After which, element-wise sigmoid non-linearity was metric that indicates how well a model fits. In the medical field,
applied. this value also represents the likelihood that a patient who
suffered a condition would have a greater risk score than a
The weights of the presented model were initialized with weights
patient who didn’t experience the event, if chosen at random. It
from a model pretrained on ImageNet[6]. This network was
summarizes the model’s performance across various thresholds
trained using Adam[7] optimizer. Adam is a powerful variation
and provides a reliable indication of its ability to distinguish
of the stochastic gradient descent optimization technique, which
between different cases. AUC was chosen because it doesnot
iteratively adjusts parameters to reduce training-related loss. The
require a threshold value and we donot need to convert our
model was trained in mini-batches of size of 32.
model outputs to binary predictions as the model outputs a
While training there were 100 steps per epoch and 50 validation vector between 0 − 1 for every class which indicates the
steps for each epoch. Initial learning rate of 1e − 4 was used probability of every class for a provided image. This AUC was
which was decayed by a factor of 20 each time the validation calculated using sklearn library which plots a ROC5 curve and
loss plateaued after 3 epochs. Model checkpointing was used then calculates the area under the curve using Simpson’s rule.
to save the model every time after validation loss improved.
The performance of the presented model was compared to
Early stopping callback was used to stop the training once the
Wang[4], Yao[5] and CheXNeXt[3] in Table 1. From the table,
validation loss didnot improve for the last 15 epochs. Other forms
it can be seen that DCXNet performs on par with CheXNeXt on
of regularization such as dropout or weight decay was not used.
labels Atelectasis, Cardiomegaly, Effusion, Infiltration, Fibrosis,
Then, the model with the lowest validation loss was picked. Each
Hernia, Pnemothatorax and Pleural thickening (Difference of
step of training completed after 3 minutes on a single NVIDIA
AUC ≤ 0.07 ). CheXNeXt has higher performance on Mass,
Tesla P100. The presented network had 12,507,790 trainable
Nodule and Pneumonia class(AUC ≥ 0.1). DCXNet has
parameters.
marginal improvement over CheXNeXt in Cardiomegaly,
Fibrosis and Hernia class. DCXNet has larger improvement in
the Emphysema class with the AUC difference > 0.2 .
4. Results and comparision with previous
State-of-the-Art models One can also see that DCXNet performly poorly on Mass,
Pneumonia and Nodule pathology if compared to CheXNeXt[3]
The presented model outputs a vector for each label with values but still better than Wang[4] and Yao[5]. This is because
ranging between 0 − 1 providing the probability of presence of CheXNeXt uses ensemble methods which creates multiple
the following 14 chest conditions: Atelectasis, Cardiomegaly, models and chooses best among them to create a final model.
Consolidation, Edema, Effusion, Emphysema, Fibrosis, Hernia, This was a necessary trade-off to reduce the training period for
Mass, Nodule, Pleural Thickening, Infiltration, Pneumonia and DCXNet, hence DCXNet performs poorly on some classes than
Pneumothorax. CheXNeXt.

Table 1: Performance comparision of presented model with


state-of-the-art models on basis of AUC
Condition Wang[4] Yao[5] CheXNeXt[3] DCXNet
Atelectasis 0.716 0.772 0.862 0.804
Cardiomegaly 0.807 0.904 0.831 0.897
Effusion 0.784 0.859 0.901 0.874
Infiltration 0.609 0.695 0.721 0.706
Mass 0.706 0.792 0.909 0.792
Nodule 0.671 0.717 0.894 0.735
Pneumonia 0.633 0.713 0.851 0.735
Pneumothorax 0.806 0.841 0.944 0.876
Consolidation 0.708 0.788 0.893 0.823
Edema 0.835 0.882 0.924 0.89
Emphysema 0.815 0.829 0.704 0.907
Fibrosis 0.769 0.767 0.806 0.81
Plural Thickening 0.708 0.765 0.798 0.782
Hernia 0.767 0.914 0.851 0.856
Figure 3: Training/Validation Loss Curve

5. Model Interpretation
Figure 3 shows the training/validation loss curve. In the image
one can see that both training and validation losses are high in Using class activation mappings(CAMs)[2], the presented model
the beginning. They gradually decrease upto the 20th epoch. created heat maps to show the regions of the chest radiograph
After which, the validation loss decreases very less with respect that contributed most to the network’s categorization for use
to training loss. However, the least validation loss is obtained in interpreting predictions. To generate these CAMs, images
at 65th epoch. The training was stopped at 80th epoch by early were fed to the trained network and feature maps were obtained
stopping callback. Spikes can be seen in the curve which is the from final layer of the network. A map of most salient features
effect of using mini-batch gradient descent.
4 Area Under the Curve
To compare the DCXNet to previous algorithms, a single 5 Receiver Operating Characteristic

66
Proceedings of 13th IOE Graduate Conference

used to classify image containg a class is obtained by taking the proposed model was able to achieve on par score with
weighted sum of feature maps using associated weights in the CheXNeXt just by replacing Densenet-121 in CheXNeXt
final fully connected layer. By scaling the map to fit the image’s algorithm with Densenet-169. The training time was significatly
size and superimposing it on top of the image, the most crucial reduced only to 4 hours because of using transfer learning.
features, the model utilized to predict the condition were shown
With the automation of this calibre, we anticipate that this
in the image.
technology will enhance the delivery of healthcare and provide
access to medical imaging expertise in regions with a shortage
of qualified radiologists.

7. Limitations
There are a few limitations of the presented model. Only frontal
X-Rays were used to train this model but some of the conditions
require lateral view for accurate diagnosis. Thus, it is
anticipated that this configuration offers a conservative estimate
of performance. The model’s inability to access patient history
is another drawback, which lowers its diagnostic performance
when analyzing chest X-rays.

Acknowledgments

The authors would like to express their sincere gratitude towards


the Department of Electronics and Computer Engineering,
Figure 4: Patient with cardiomegaly. The model was able to Purwanchal Campus for their invaluable contribution to this
correctly predict the presence of cardiomegaly (Enlarged Heart) project. Their support, guidance, and expertise were
and localize it using CAM instrumental in achieving the successful completion of this
project. Finally, the authors would like to extend their
appreciation to their colleagues and friends who provided them
with their unwavering encouragement and support throughout
the duration of this project.

6. Conclusion
References
The majority of patient morbidity and mortality is caused by
disorders of the chest. In order to avoid consequences, including [1] Gao Huang, Zhuang Liu, Laurens van der Maaten, and Kilian Q.
Weinberger. Densely connected convolutional networks. 2016.
death, early diagnosis of these illnesses is essential. The most
often used imaging examination tool in practice is the Chest [2] Ramprasaath R. Selvaraju, Michael Cogswell, Abhishek Das,
Ramakrishna Vedantam, Devi Parikh, and Dhruv Batra. Grad-
X-Ray, which is essential for the screening, diagnosis, and cam: Visual explanations from deep networks via gradient-based
treatment of a number of disorders. However, the shortage of localization. 2019.
radiologists is particularly acute in rural areas in Nepal which [3] Pranav Rajpurkar, Jeremy Irvin, and Brandon Yang Robyn L. Ball,
makes it difficult for patients to access diagnostic imaging Kaylie Zhu. Deep learning for chest radiograph diagnosis: A
services. Even with the availability of imaging technology, there retrospective comparison of the chexnext algorithm to practicing
radiologists. 2018.
is a lack of specialists who can interpret X-rays, which increases
mortality from diseases that are curable. [4] Xiaosong Wang, Yifan Peng, Le Lu, Zhiyong Lu, Mohammadhadi
Bagheri, and Ronald M. Summers. Chestx-ray8: Hospital-
This paper presents a model, DCXNet, which detects 14 scale chest x-ray database and benchmarks on weakly-supervised
classification and localization of common thorax diseases. 2017.
different chest conditions from frontal-view chest X-Ray images
whose performance is on par with CheXNeXt[3] which claims [5] Li Yao, Eric Poblenz, Dmitry Dagunts, Ben Covington, Devon
Bernard, and Kevin Lyman. Learning to diagnose from scratch by
their performances are at a level exceeding practicing exploiting dependencies among labels. 2018.
radiologists. The presented model has a mean AUC of 0.82 [6] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-
while CheXNeXt has mean AUC of 0.84. This marginal Fei. Imagenet: A large-scale hierarchical image database. 2009.
improvement of CheXNeXt is the result of using ensemble [7] Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic
methods which takes significantly larger training time. But the optimization. 2014.

67

You might also like