Abstract
A common problem found in real-word medical image classification is the inherent imbalance of the positive and negative patterns in the dataset where positive patterns are usually rare. Moreover, in the classification of multiple classes with neural network, a training pattern is treated as a positive pattern in one output node and negative in all the remaining output nodes. In this paper, the weights of a training pattern in the loss function are designed based not only on the number of the training patterns in the class but also on the different nodes where one of them treats this training pattern as positive and the others treat it as negative. We propose a combined approach of weights calculation algorithm for deep network training and the training optimization from the state-of-the-art deep network architecture for thorax diseases classification problem. Experimental results on the Chest X-Ray image dataset demonstrate that this new weighting scheme improves classification performances, also the training optimization from the EfficientNet improves the performance furthermore. We compare the aggregate method with several performances from the previous study of thorax diseases classifications to provide the fair comparisons against the proposed method.
Subject terms: Cancer, Computational biology and bioinformatics, Diseases, Health care, Medical research, Mathematics and computing, Biomedical engineering
Introduction
The traditional classifiers such as an SVM, a decision tree or a logistic regression require feature engineering to perform classification. The better features chosen during the feature engineering will produce more accurate classification performance. Despite the necessity of the feature engineering, a neural network has the advantages of performing end-to-end training to output a final classification’s prediction. The removal of feature engineering in the neural network will reduce the risk of the use of incorrect features for classification. To develop a neural network for medical diagnosis, patient data are necessary; however, the positive class is minority and the negative class is majority. The neural network is biased to the majority class and has poor performance on the minority class. The common methods to balance the number of positive and negative class for the traditional classifiers is by the use of undersampling and oversampling approaches. After applying those methods, the numbers of each training-pattern are equal. The more sophisticated approach might involve algorithmic technique to perform cost-sensitive training1. “The effective number of samples is defined as the volume of sample”2. Cui et al.2 developed a metric to determine the effective samples and reformulated the loss function based on the numbers of effective samples in the positive and negative classes. The work of Wang et al.3 contributes to provide the availability of a novel Chest X-Ray dataset. Both3,4 use the same formulation to balance the dataset, however the method from3,4 is different than2 to deal with the imbalance problem. Cui et al.’s approach2 treats the contributions of training patterns to the loss function equally for all the output nodes, this is contrary to the Wang and Gundel et al.’s methods3,4 which use the distinct weights from positive and negative classes as the multipliers in the loss-function. Although better classification performance can potentially be achieved by Cui et al.2, the approach only addresses effective samples2 and the imbalances of positive-negative classes have not been tackled. In this paper, a novel weights function for focal-loss is proposed to address the imbalance of positive-negative classes,which tackles the classification correctness in both positive and negative samples when training the neural networks. The performance of the proposed focal-loss function is evaluated by performing Chest X-Ray classification which is involved with imbalanced data3. We also propose the use of EfficientNet5 with progressive image resizing under two-stage training in complement with the proposed loss-function. The motivation to use EfficientNet is to inspect the outcome of the proposed loss function into different architecture scaling. The aggregate of the proposed loss-function and the two-stage EficientNet training achieved improvement, which is measured with the area under the receiver-operating-characteristic curve (AUROC). Also, heatmap visualization shows that the proposed aggregate approach can achieve better coverage of the diseases. According to Baltruschat et al.6 the current state-of-the-art performance for the dataset3 classification performance was achieved by Gündel et al.4. Further research by Guan et al.7 which use three-stage training procedures reported better performance than Gündel et al.4. However, the work7 did not share the split-sets which is critical for the performance evaluation, also the re-implementation by another party in github8 reported lower results. We also notice that the re-implementation8 of7 did not share identical sets with the work of Gündel et al.4. Baltruschat et al.6 noticed that different split-sets would lead to different performances for the dataset3. To have the fair benchmarks, we report several results from various split-sets options for the performance evaluation. We perform three split-sets experiments configuration setup, which aims to provide better evaluation and have the comprehensive analysis; the first is by the use of “official” split from9, the second is under fivefolds cross-validation configuration which has also been used in the work of Baltruschat et al.6, and the last one is by the use of identical splits from the public Github-page8,10. We achieve state-of-the-art results for the classification problem of the Chest X-Ray dataset3, measured under these three split-sets configurations. This research is mainly contributing to the improvement of medical image classification problem. We tackle the imbalance problem within Chest X-Ray dataset and propose the advancement of the use of state-of-the-art neural net architecture for the final classification performance;The EfficientNet with two-stage training. In summary, our contribution is to propose an approach which can combine weights calculation algorithm for deep-network and the optimization of training strategy from the state-of-the-art architecture. The “Introduction” section of this paper provides a brief introduction and overview of the research. The “Method” section mainly discusses the existing classification approach and the proposed method. The “Experiments and results” section presents the results from experiments. The “Discussion” section give a more in-depth discussion about the outcome, then The “Conclusion” section explains the conclusion from the research.
Method
The existing weights function and network architecture
Wang et al.3 and Gündel et al.4 defined the weights, and , of the positive and negative samples for the pattern.
1 |
where and are the numbers of positive and negative samples for the the pattern. However, Cui et al.2 used both and equally to develop the loss function. In the manuscript, Wang et al.3 and Gündel et al.4 did not use an identical dataset. Wang et al.3 used Chest X-Ray 8 which consists of eight classes with 108,948 images. Whilst4 used Chest X-Ray 14 which consists of fourteen classes with 121,120 images. However, we can find the results from the method of Wang et al.3 under the Chest X-Ray 14 “official split” configuration in the manuscript of Gündel et al.4. Both works implemented Eq. (1) in the loss-function according to the literature3,4. Therefore, we can conclude the Eq. (1) applies to the samples of the training set. Lin et al.11 proposed the focal-loss function:
2 |
p is the prediction. In Eq. (2), the parameter attempts to balance the positive-negative samples while adjusted to release the easy samples and to dominate the hard samples, where the easy and hard samples are those classified correctly and incorrectly respectively. Generally, ; when focal-loss is the same as an ordinary cross-entropy loss11. The experimental results showed that the easy samples are down-weighed when ; The samples are further down-weighed when . Determination of is discussed to demonstrate the impact to the focal loss function (Eq. 2). The parameters chosen as below2:
3 |
where is the number of the pattern, and N is the number of samples. Conceptually, is used to adjust the significance of the number of samples. is the sum of all -s which is corresponded to the value for each k-pattern. is used for normalization with the number of patterns. However, the work from Cui et al.2 ignores the negative patterns into the weight calculations, this dismissed the very important variables because the negative patterns from negative classes are commonly to find in the medical images classification problem.
The DenseNet-121 network
DenseNet-121 is popular to perform classification3 with some other methods3,4,6,12 which use ResNet13. DenseNet14 and ResNet13 utilize different skip-connection approaches to pass features from previous layers to later layers. ResNet13 performs a summation of features for the skip-connections while DenseNet14 performs concatenation from features. After the input layer, DenseNet utilises 7 × 7 convolution in a stride 2 mode and it uses 3 × 3 max pooling also in stride 2 mode. Then it concatenate features in the first Dense block. There are four Dense blocks in DenseNet, each Dense block at least consists of six consecutive of a 1 × 1 convolution layer followed by a 3 × 3 convolution layer. The numbers of these consecutive 1 × 1 and 3 × 3 layers in Dense blocks are depend on the types of DenseNet which are either 121,169,201 or 264 layered DenseNet, but all of these DenseNet configurations have four Dense blocks and the differences are only in the number of consecutive convolution layers within a Dense block. The concatenated features from a Dense block in DenseNet are then downsampled through a transition layer. The transition layer consists of a 1 × 1 convolutional layer and a 2 × 2 average pool layer in stride 2 mode. A Dense block in DenseNet is followed by a transition layer consecutively. ChexNet by Rajpurkar et al.15 initiates the popularity of DenseNet-121 as the backbone network to perform the Chest X-Ray classification. ChexNet15 consists the sigmoid functions in the last layer. ChexNet changes the output dimension of the final classification layer of DenseNet-121 from 1024 dimension of softmax output into 14 dimension of sigmoid functions. The change from 1024 to 14 nodes reflects the number of classification’s labels in the Chest X-Ray dataset3. Table 1 depicts the layer-differences between ChexNet15 and DenseNet14.
Table 1.
The layer comparison DenseNet-121 and ChexNet.
Layers | Output size | DenseNet-121 | ChexNet | ||
---|---|---|---|---|---|
112 × 112 | 7 × 7 CONV stride 2 | 7 × 7 CONV stride 2 | |||
56 × 56 | Max Pool stride 2 | Max Pool stride 2 | |||
Dense block (1) | 56 × 56 | 1 × 1 CONV | × 6 | 1 × 1 CONV | × 6 |
3 × 3 CONV | 3 × 3 CONV | ||||
Transition (1) | 56 × 56 | 1 × 1 CONV | 1 × 1 CONV | ||
28 × 28 | 2 × 2 Avg Pool stride 2 | 2 × 2 Avg Pool stride 2 | |||
Dense block (2) | 28 × 28 | 1 × 1 CONV | × 12 | 1 × 1 CONV | × 12 |
3 × 3 CONV | 3 × 3 CONV | ||||
Transition (2) | 28 × 28 | 1 × 1 CONV | 1 × 1 CONV | ||
14 × 14 | 2 × 2 Avg Pool stride 2 | 2 × 2 Avg Pool stride 2 | |||
Dense block (2) | 14 × 14 | 1 × 1 CONV | × 24 | 1 × 1 CONV | × 24 |
3 × 3 CONV | 3 × 3 CONV | ||||
Transition (3) | 14 × 14 | 1 × 1 CONV | 1 × 1 CONV | ||
7 × 7 | 2 × 2 Avg Pool stride 2 | 2 × 2 Avg Pool stride 2 | |||
Dense block (4) | 7 × 7 | 1 × 1 CONV | × 16 | 1 × 1 CONV | × 16 |
3 × 3 CONV | 3 × 3 CONV | ||||
Classification layer | 1 × 1 | 7 × 7 GLOBAL AVG POOL | 7 × 7 GLOBAL AVG POOL | ||
1000D SOFTMAX | 14D SIGMOID |
The proposed weights function and network architecture
The normalization of formulated in Eq. (4) is used to weight the pattern:
4 |
where C is the number of class. Although Cui et al.2 proposed the grid search to determine based on their formulation, the separable weights of a positive and negative pattern have not been addressed. In this paper, we integrate the separability of positive and negative patterns into the loss-function in order to improve the classification capability of Cui et al’s approach. The hypotheses address the importance of both positive and negative pattern weights to improve end-to-end training.
5 |
where are the weights for positive samples of the pattern. Equation 5 is an elaboration point between2 and our proposed method. We deliberately assign to each sample in pattern based on the specified weights. The work2 emphasized the importance of effective samples to define the weights and we have two types of weights and come into the proposal. In our proposed approach, from2 attempts to determine the weights of only the positively labeled samples, which is given in Eq. (5). Also, we determine the weight of the negative patterns:
6 |
Experimental results evaluate the performance of the proposed weights in Eqs. (5) and (6) to balance the imbalanced samples.
The weighted cross entropy loss
The formulation for cross entropy loss16 with the proposed weight is:
7 |
where are the ground-truth labels for each samples in pattern k. To perform the experiments in Section 4, we set the for a particular case, the case where we want to see the outcome from Cui et al.’s2 formulation into the dataset3 classification problem. The Cross Entropy loss use softmax output by default, whereas the Binary Cross Entropy loss use sigmoid output.
The weighted focal loss
The formulation for focal loss with the proposed weight is:
8 |
The proposed focal-loss attempts to weight both the easy-hard samples and the positive-negative patterns, which are not addressed by Cui et al.’s approach2. The proposed focal loss also suits the multiclass classification problem. There is no existing focal-loss method which addresses both effective number of samples and positive-negative patterns weighting.
The progressive image resizing
Progressive image resizing is the procedure to train a single deep network architecture with incremental input sizes in multiple stages of training. The first stage trains the network with the default image size for the network and then followed by the next stage which utilises the bigger size images and the use of the best performance of the pre-trained model from the previous stage. There is no formal definition of the exact number of steps, but the classification performance will improve to some extents and then saturates, and gain diminishes; this is very specific to the classification problems. We report that the third stage of training with progressive image resizing did not improve the performance of the existing Chest X-Ray classification problem. Another functionality from the progressive-image-resizing is to provide another form of augmentation. It (re)trains the model with the augmentations of different sized-inputs. Several works17–20 of literature mention that augmentation is a proven method to reduce overfitting. We need to have our final model is risk-free from overfitting, and the two-stage training is our approach to perform that. In summary, we perform the two-stage training to achieve two aims: (1) to improve the classification accuracy, (2) to prevent overfitting.
EfficientNet
The recent work by Tan et al.5 introduced EfficientNet. It proposed a formulation to perform grid-search among three prominent aspects of the deep network’s architecture: depth, width and input resolution. The depth defines the number of layers, the width defines the number of nodes for each layer, and the input resolution defines the size of the input images. The compound scaling from those three components are then composed into different architectures from EfficientNet-B0 into EfficientNet-B7. The networks use the mobile inverted bottleneck layers similar to21,22, the layers then concatenated to squeeze-excitation layer23. The ReLu6 function is capped at the magnitude of 6; it was used in MobileNetV222. However, EfficientNet replaces the use of ReLu6 with Swish. Equation 9 shows the difference among the ordinary ReLu function, the ReLu624 and the Swish activation function:
9 |
The layers of EfficientNet-B0 are depicted in Table 2. The further scaling of EfficientNets B0 into B7 are then defined by the grid-search formula as reported in5. After the input layer the EfficientNet use 3 × 3 spatial convolutional layer in stride 2 mode, then it uses MBConv1 the linear bottleneck and inverted residual layer22. After the MBconv1 layer the network has six consecutive MBConv6 layers with various 3 × 3 and 5x5 kernel as listed in Table 2. Each MBConv6 has three consecutive layers consist of a 1 × 1 convolutional layer, a 3 × 3 or 5 × 5 depth-wise convolutional layer and another 1 × 1 convolutional layer. Each MBConv1 has two consecutive layers consist of a 3 × 3 depth-wise convolutional layer and another 1 × 1 convolutional layer. The final layer consists of 1 × 1 convolutional, the global average pooling and 1280 nodes of a fully connected layer. Following the previous modification of DenseNet-121 into the specific implementation of the Chest X-Ray3 classification problem, we also modify the final output layer from 1280 nodes into 14 nodes.
Table 2.
The EfficientNet-B0 layer5.
Stage | Operator | Resolution | Channels | Layers |
---|---|---|---|---|
i | × | |||
1 | Conv 3 × 3 | 224 × 224 | 32 | 1 |
2 | MBConv1, k3 × 3 | 112 × 112 | 16 | 1 |
3 | MBConv6, k3 × 3 | 112 × 112 | 24 | 2 |
4 | MBConv6, k5 × 5 | 56 × 56 | 40 | 2 |
5 | MBConv6, k3 × 3 | 28 × 28 | 80 | 3 |
6 | MBConv6, k5 × 5 | 28 × 28 | 112 | 3 |
7 | MBConv6, k5 × 5 | 14 × 14 | 192 | 4 |
8 | MBConv6, k3 × 3 | 7 × 7 | 320 | 1 |
9 | Conv 1 × 1 and pooling and FC | 7 × 7 | 1280 | 1 |
The performance evaluation
Suppose we want to have a better perspective about the algorithm performance; we need to apply different metrics to evaluate the results. We apply the AU-PRC (Area Under Precision-Recall Curve) metric for further evaluation; the metric has a different characteristic than AU-ROC (Area Under Receiver-Operating-Characteristics). In the term of baseline, AU-ROC has a fixed baseline of .50 for random classifier and 1 for the perfect classifier, respectively25,26. In contrast, AU-PRC baseline is dynamic since it heavily depends on the ratio between positive and negative samples27. AU-PRC is more sensitive to data distribution. AU-PRC will have the baseline .50 for a random classifier under the equal number of positive and negative samples; when the number of negative samples ten times than positive samples this baseline will decrease to a smaller number .0927. The formulation to calculate the baseline of AU-PRC shown in Eq. (10) is from the literature27.
10 |
Suppose we have two classes with an identical value of AU-PRC .50, the interpretation from this particular result will vary for both classes. The .50 AU-PRC is a good result for the class with low positive samples, but it may not be satisfactory for the class with a remarkable number of positive samples.
Experiments and results
The chest X-ray dataset3 is used to evaluate the performance of the proposed method. It contains 112,120 Chest X-Ray images from 30,805 unique patients, and it has multilabel of 14 classes diseases. The image resolution is 1024 × 1024 with the 8-bit channel. We downsampled the resolution as 224 × 224 and converted the channel into RGB which can be adopted to our backbone network. Chest X-Ray 14 only consists of frontal-view images. It does not have any lateral-view cases. The number of positive samples for each class is much less than the negative samples as depicted in Fig. 1 . In our proposed method, the five hyperparameters are given in Eq. (11).
11 |
where is determined by Eq. (3). The grid-search determines the other -s. In the exception of the , the grid search was performed by changing the value with standard deviation of 10 from . The current value of was chosen because that magnitude is the median between and . Also the results obtained by the proposed method is compared to those obtained by the other six methods, Wang et al.3, Yao et al.12, baseline ChexNet15, weighted binary cross entropy loss, Balturschat et al.6 and Gündel et al.4. The comparison is depicted in Table 4.
Figure 1.
Training distribution from official split.
Table 4.
Comparison results with previous study under the official split.
Wang et al.3 | Yao et al.12 | Baseline reproduce ChexNet15 | Weighted binary cross entropy loss | Baltruschat et al.6 | Gündel et al.4 | Weighted focal loss
DenseNet-121 two-stage |
Weighted focal loss EfficientNet-B3 two-stage |
|
---|---|---|---|---|---|---|---|---|
Atelectasis | 0.700 | 0.733 | 0.7541 | 0.7625 | 0.763 | 0.767 | 0.7820 | 0.7919 |
Cardiomegaly | 0.810 | 0.856 | 0.8787 | 0.8812 | 0.875 | 0.883 | 0.8845 | 0.8917 |
Effusion | 0.759 | 0.806 | 0.8236 | 0.8266 | 0.822 | 0.806 | 0.8380 | 0.8414 |
Infiltration | 0.661 | 0.673 | 0.6928 | 0.6939 | 0.694 | 0.709 | 0.7022 | 0.7051 |
Mass | 0.693 | 0.777 | 0.8053 | 0.8023 | 0.820 | 0.821 | 0.8329 | 0.8356 |
Nodule | 0.669 | 0.724 | 0.7318 | 0.7383 | 0.747 | 0.758 | 0.7863 | 0.8036 |
Pneumonia | 0.658 | 0.684 | 0.6980 | 0.7019 | 0.714 | 0.731 | 0.7338 | 0.7366 |
Pneumothorax | 0.799 | 0.805 | 0.8378 | 0.8344 | 0.819 | 0.846 | 0.8706 | 0.8909 |
Consolidation | 0.703 | 0.711 | 0.7349 | 0.7390 | 0.749 | 0.745 | 0.7537 | 0.7601 |
Edema | 0.805 | 0.806 | 0.8345 | 0.8305 | 0.846 | 0.835 | 0.8534 | 0.8609 |
Emphysema | 0.833 | 0.842 | 0.8666 | 0.8701 | 0.895 | 0.895 | 0.9413 | 0.9424 |
Fibrosis | 0.786 | 0.743 | 0.7957 | 0.8040 | 0.816 | 0.818 | 0.8229 | 0.8408 |
Pleural thickening | 0.684 | 0.724 | 0.7456 | 0.7502 | 0.763 | 0.761 | 0.7970 | 0.8080 |
Hernia | 0.872 | 0.775 | 0.8684 | 0.8589 | 0.937 | 0.896 | 0.9260 | 0.9286 |
Average | 0.745 | 0.761 | 0.7906 | 0.7924 | 0.806 | 0.807 | 0.8232 | 0.8313 |
Backbone network training
Since we use the DenseNet 12114 as the primary backbone network, the availability of pre-trained ImageNet can be used for the classification. Here we used the pre-trained weights from Imagenet to develop the network. The dataset3 for base metrics, including the same training, validation, test splitting set from9. We refer the split-set9 as “official split”. Summers9 has two groundtruth files as label, they are train_val_list.txt which consists of 86,524 samples and test_list.txt which consists of 25,596 samples. Baltruschat et al.6 emphasized that different splitting of dataset3 has significantly impact to the classification performance. Since the splitting of training and test data is exactly the same, the benchmark is fair. Figure 1 and Table 3 show that the class distribution is imbalance since the positive and negative samples are very different. We use a single Titan V with 12 Gb GPU memory to develop the network, where 24 hours with 25 epochs of training are required. We only train the Densenet-121 in single-stage training cycle and do not perform progressive image resizing.
Table 3.
The imbalance number of samples.
Samples | Number |
---|---|
Healthy | 60,361 |
Hernia | 227 |
Pneumonia | 1431 |
Fibrosis | 1686 |
Edema | 2303 |
Emphysema | 2516 |
Cardiomegaly | 2776 |
Pleural thick. | 3385 |
Consolidation | 4667 |
Pneumothorax | 5302 |
Mass | 5782 |
Nodule | 6331 |
Atelectasis | 11,559 |
Effusion | 13,317 |
Infiltration | 19,894 |
Because we aim to improve the overall classification performance, we also modify the architecture of backbone network from DenseNet-121 into EfficientNet5. The approach is mainly to expand the performances from the proposed cost-sensitive loss function into better architecture. We are limited only to the use of the EfficientNet-B0 and the EfficientNet-B3 networks for the experiments. This is mainly because we have achieved the peak of the computing-resources limits, and to perform the experiments over all the EfficientNet architectures are not feasible at this stage. Consecutive EfficientNets training requires extensive computations; due the scaling of the image sizes, the depth and also the width of the network. In the other hand, the approach of progressive image resizing only take into account the aspect of image sizes into computational resources; it ignores the depth and the width of the network. To train the EfficientNets, we use the Tesla v100 with 32 Gb of GPU memory. For each network, we performed the two-stage training procedure with progressive-image-resizing as previously discussed. On the first stage we train the network with pre-trained model from ImageNet, then on the second stage we train the network with the best performing model from first stage. The important finetune is the size of the image input; the first stage we use the default input size from the network then we doubled the input size on the second stage. This has been implemented with size of 224 × 224 on the first stage of EfficientNet-B0 and 448 × 448 on the second stage EfficientNet-B0, also 300 × 300 on the first stage of EfficientNet-B3 and 600 × 600 on the second stage EfficientNet-B3. We reduce the batch size into half, from 32 on the first stage to 16 on the second stage. The reduced batch size is mainly to ensure the batched-images for each step on each epoch will fit into the GPU’s memory boundary. The two-stage training with progressive-image-resizing has successfully improved to the classification outputs between first stage and second stage for each model.
The baseline network
We reproduce ChexNet15 based on28. The experiments performed by our proposed method and the other methods3,4,6 are based on the training and test split in9 are reported in Table 4. However, Rajpurkar et al.15 never share the split-set for the public. The use of official split9 results in lower performance than reported in Rajpurkar et al.15. We use the ADAM optimizer as in15 to develop the neural network of which the optimization is converged at epoch 11. Other researches also used ADAM4,6 and stochastic gradient descent3.
Weighted binary cross entropy with effective number of samples
This experiment is an adoption of Cui et al.’s2 method into the Chest X-Ray dataset3 classification problem. In Cui et al.’s approach2, the balanced weights between positive and negative is not used; the weights are computed based on the effectiveness number of samples. Cui et al.’s2 used the Eq. (3) to compute the weights. We perform this experiment to provide evidence of performances which come from2 versus the one come from our approach. In this experiment, we use binary-cross-entropy as loss function and combine with the weighting into the loss-function. We set the for the implementation of Eq. (7) for this particular case, since2 ignores the balanced positives-negatives. The best performance classification for the model is also achieved on epoch 11, similar to Baseline. The comparison results with our other experiments are shown in Table 4. This method perform only slightly better than the baseline with the area under ROC curve.
Weighted focal loss with positive and negative pattern
In this experiment, we use the loss function11 which is integrated with the focal loss and the proposed weighting. We choose the value of value based on11 which is between ; we found that and is the best of focal-loss hyperparameters for our proposed method. We use the RANGER (Rectified Adam and LookAhead) optimizer, which requires a smaller number of training epochs to converge. The optimizer converges at epoch 5. We deliberately assign the two-stage training to prevent overfitting and also to improve the performance. This method achieves area under ROC curve with two-stage DenseNet-121 and with two-stage EfficientNet-B3. The training time took 71 min for one epoch on the first stage with 32 batch size, 180 min for one epoch on the second stage with 16 batch size. The test-time took 15 min with 8 batch size for the first-stage and took 27 min with 8 batch size for the second-stage.
The intuitive theoretical background and the evidence from experiment
Since part of our approach inherits the strength of focal loss11, and also the class-balanced approach2. We can have further theoretical analysis from the proposed approach intuitively based on11 and2. The main distinction of focal-loss with binary cross entropy loss is the existence of and parameter. Cui et al. mention on the paper: “the class-balanced term can be viewed as an explicit way to set in focal loss based on the effective number of samples”2. However, Lin et al. also mention “a common method for addressing class imbalance is to introduce a weighting factor for class 1 and for ”11. We can inference those two statements into our elaboration in Eq. (6). The experiments provide a further evidence for the theory. The improvement from the change of the proposed formula is under the test-set according to the Table 5. Both experiments were performed with and for the Focal Loss’s parameters. Both Tables 5 and 8 use an identical split8. The training-set consists of 78,468 images, the validation-sets consists of 11,219 images, the test-sets consists of 22433 images. The training time took 38 min for one epoch with 32 batch size and the test time took 12 min with 8 batch size.
Table 5.
The improvement of the proposed weight calculation.
Pathology | Focal loss DenseNet-121 | Weighted focal loss 0.9998 DenseNet-121 | ||
---|---|---|---|---|
Validation | Test | Validation | Test | |
Cardiomegaly | 0.9155 | 0.9096 | 0.9092 | 0.9090 |
Emphysema | 0.9140 | 0.9178 | 0.9056 | 0.9327 |
Edema | 0.9141 | 0.8851 | 0.9147 | 0.8917 |
Hernia | 0.8614 | 0.9135 | 0.9067 | 0.9404 |
Pneumothorax | 0.8896 | 0.8663 | 0.8973 | 0.8749 |
Effusion | 0.8822 | 0.8762 | 0.8792 | 0.8827 |
Mass | 0.8622 | 0.8430 | 0.8655 | 0.8514 |
Fibrosis | 0.8277 | 0.8219 | 0.8313 | 0.8308 |
Atelectasis | 0.8191 | 0.8079 | 0.8228 | 0.8259 |
Consolidation | 0.8247 | 0.8007 | 0.8224 | 0.8043 |
Pleural thicken. | 0.8219 | 0.7874 | 0.8214 | 0.7910 |
Nodule | 0.7823 | 0.7751 | 0.7888 | 0.7756 |
Pneumonia | 0.7722 | 0.7504 | 0.7586 | 0.7698 |
Infiltration | 0.7061 | 0.7073 | 0.7113 | 0.7166 |
Average | 0.8424 | 0.8330 | 0.8453 | 0.8427 |
Table 8.
Identical split comparison8.
Pathology | Third party8 of Guan et al.7 | Weighted focal loss 0.9998 DenseNet-121 | Weighted focal loss 0.9998 EfficientNet-B3 | ||
---|---|---|---|---|---|
Stage 1 | Stage 2 | Stage 1 | Stage 2 | ||
Cardiomegaly | 0.9097 | 0.9090 | 0.9142 | 0.9137 | 0.9144 |
Emphysema | 0.8905 | 0.9327 | 0.9425 | 0.9471 | 0.9558 |
Edema | 0.9185 | 0.8917 | 0.8930 | 0.9021 | 0.9071 |
Hernia | 0.9064 | 0.9404 | 0.9427 | 0.9357 | 0.9409 |
Pneumothorax | 0.8794 | 0.8749 | 0.8854 | 0.9003 | 0.9092 |
Effusion | 0.8843 | 0.8827 | 0.8885 | 0.8899 | 0.8923 |
Mass | 0.8707 | 0.8514 | 0.8568 | 0.8596 | 0.8669 |
Fibrosis | 0.8208 | 0.8308 | 0.8458 | 0.8526 | 0.8657 |
Atelectasis | 0.8225 | 0.8259 | 0.8307 | 0.8350 | 0.8397 |
Consolidation | 0.8210 | 0.8043 | 0.8115 | 0.8124 | 0.8208 |
Pleural thicken. | 0.8127 | 0.7910 | 0.8011 | 0.8041 | 0.8136 |
Nodule | 0.7691 | 0.7756 | 0.8144 | 0.8043 | 0.8293 |
Pneumonia | 0.7614 | 0.7698 | 0.7726 | 0.7721 | 0.7703 |
Infiltration | 0.7006 | 0.7166 | 0.7178 | 0.7297 | 0.7363 |
Average | 0.8405 | 0.8426 | 0.8512 | 0.8542 | 0.8616 |
The imbalance metric evaluation
Table 6 and Fig. 2 show the advancement from the proposed method in comparison with previous work15 also with the baseline retrieved from the dataset. We calculate the baseline of AU-PRC metric directly from the dataset’s distribution of positives and negatives samples with the use of Eq. (10). The bold fonts show the top-scores achieved between a same split-set configuration. The hernia has the lowest number of positive samples in the distribution. Despite being the most minority, the proposed algorithm results from hernia a couple of hundred higher AU-PRC than the baseline; shown in Table 6 and Fig. 2.
Table 6.
The AU-PRC improvement.
Pathology | Reproduce ChexNet15 | Weighted focal loss 0.9998 EfficientNet-B3 two-stage | Baseline AU-PRC from distribution | ||
---|---|---|---|---|---|
Split | Official | Identical8 | Official | Identical8 | |
Cardiomegaly | 0.3288 | 0.2880 | 0.3444 | 0.3127 | 0.0247 |
Emphysema | 0.3125 | 0.2948 | 0.4706 | 0.4515 | 0.0224 |
Edema | 0.1497 | 0.1455 | 0.2048 | 0.1835 | 0.0205 |
Hernia | 0.0785 | 0.0311 | 0.4147 | 0.5372 | 0.0020 |
Pneumothorax | 0.3683 | 0.2929 | 0.4965 | 0.4242 | 0.0472 |
Effusion | 0.5012 | 0.5149 | 0.5428 | 0.5439 | 0.1187 |
Mass | 0.2887 | 0.2847 | 0.3355 | 0.3357 | 0.0515 |
Fibrosis | 0.0773 | 0.0886 | 0.1231 | 0.1405 | 0.0150 |
Atelectasis | 0.3208 | 0.3262 | 0.3664 | 0.3859 | 0.1030 |
Consolidation | 0.1488 | 0.1479 | 0.1736 | 0.1692 | 0.0416 |
Pleural thicken. | 0.1109 | 0.1159 | 0.1831 | 0.1754 | 0.0301 |
Nodule | 0.1899 | 0.2025 | 0.2595 | 0.2919 | 0.0564 |
Pneumonia | 0.0448 | 0.0381 | 0.0609 | 0.0484 | 0.0127 |
Infiltration | 0.3891 | 0.3342 | 0.4067 | 0.3592 | 0.1774 |
Average | 0.2364 | 0.2218 | 0.3130 | 0.3114 | 0.0517 |
Figure 2.
The area under precision-recall curve.
Discussion
In order to provide more insights of the effect from different splits into the classification performance, several split-sets has been taken into performance evaluation. The standard procedure is to follow the “official” splits9 and we report the results in Table 4. To the best of our knowledge, only6 reported the performance evaluation of a random fivefolds cross validation from the Chest X-Ray dataset3 and we report the results from the proposed method in Table 7. There are other split-sets which are considered “non-standard” settings, these splits are from github pages. Ren8 is the third party re-implementation of7, and also10 is the third party re-implementation of15. However, after further investigation8 and10 are under the identical training, validation and testing sets. We report the results with the custom-sets8,10 in Table 8. The results in Table 9 are the improvements made in compare with the most recent research7. The one-by-one comparison for each disease with latest research7 as listed in Table 8. We achieve better performances in compare with the work of Guan et al.7 and we propose technically more simple approach to achieve the results. Since the diversity of split-sets is a well-known problem for the dataset’s3 evaluation, the use cross validation is a fair method to follow. Baltruschat et al.6 is the only work that reported performing cross-validation to the dataset3, we achieve better performance in fivefolds cross validation experiment than the work of Baltruschat et al.6. The class-activation-mapping (CAM) method29,30 visualizes the discriminative-features from the deep-network’s last layer in the form of heatmap localisation, the more heatmap visualization match the groundtruth bounding-box from dataset means the network has better understanding of the images. We visualize our classification performances with heatmap from CAM method in Table 10. We obtain the bounding-boxes as the annotation groundtruth for only 8 (eight) classes which are available from the file BBox_List _2017.csv9. The annotations consists of 984 images, and the number of samples for each class is not distributed evenly. Table 10 shows that the networks which are equipped with the proposed method read the area of the disease better than the baseline.
Table 7.
Results from fivefolds cross-validation.
Pathology | Baltruschat et al.6 | Weighted focal loss = 0.9998 EfficientNet-B3 two-stage |
---|---|---|
Cardiomegaly | 89.8 ± 0.8 | 90.6 ± 2.4 |
Emphysema | 89.1 ± 1.2 | 94.6 ± 1.2 |
Edema | 88.9 ± 0.3 | 90.3 ± 0.9 |
Hernia | 89.6 ± 4.4 | 92 ± 1.3 |
Penumothorax | 85.9 ± 1.1 | 91.2 ± 1.2 |
Effusion | 87.3 ± 0.3 | 88.5 ± 0.5 |
Mass | 83.2 ± 0.3 | 86.9 ± 1.1 |
Fibrosis | 78.9 ± 0.5 | 82.2 ± 2.5 |
Atelectasis | 79.1 ± 0.4 | 83.3 ± 0.7 |
Consolidation | 80.0 ± 0.7 | 80.9 ±0.5 |
Pleural thicken. | 77.1 ± 1.3 | 82.7 ±1.3 |
Nodule | 75.8 ± 1.4 | 81.7 ± 1.4 |
Pneumonia | 76.7 ± 1.5 | 77 ± 1.9 |
Infiltration | 70.0 ± 0.7 | 72.8 ± 4.5 |
Average | 82.2 ± 1.1 | 85.3 ± 0.6 |
Table 9.
The improvement rate.
(A) | ||||||||
---|---|---|---|---|---|---|---|---|
Name | Hernia | Pneumonia | Fibrosis | Edema | Emphysema | Cardiomegaly | Pleural Thick. | Pneumothorax |
Rate |
(B) | ||||||||
---|---|---|---|---|---|---|---|---|
Consolidation | Mass | Nodule | Atelectasis | Effusion | Infiltration | Average | ||
Table 10.
The heatmap from different methods.
We found the third party re-implementation8 reported lower performances than reported in the paper7.
Guan et al.7 did not provide the official code and split-sets. The critical classification problems for the dataset3, different splits will lead to different performances6.
Conclusion
We proposed an aggregate of novel weighting function to formula the focal-loss function in complement with the two-stage training of EfficientNet, a state-of-the-art neural network architecture. We aim to improve the classification capability. Existing approaches of weighting function did not address the sample characteristics of both the positive-negative and easy-hard. The proposed weighting function attempts to improve the classification capability by address both the sample characteristics,which are ignored by the existing methods. The proposed approach provides a better decision boundary to the multiclass classification problem since the proposed approach addresses the imbalances of both positive-negative and hard-easy samples, also the use of recent network architecture scale-up the performances better. The proposed approach is able to improve the classification rates by than the latest research’s outputs which is measured in the area under the receiver operating characteristic curve (AUROC). The proposed method also achieved state-of-the-art results under three distinct experiments setup, currently the results are the best improvements for the Chest X-Ray dataset being used. Since the proposed approach only addresses multiclass classification problem and multilabel classifications are not tackled, future research will target on multilabel problems. The proposed approach will be further validated.
Acknowledgements
This work is supported and funded by Ministry of Religious Affair (MORA) Scholarship, Republic of Indonesia. We also very thankful for NIH Clinical Center for their publicly released dataset.
Author contributions
Author contributions statement B.A.N. performed the works for the manuscript.
Data availability
The dataset for this research is available publicly in the Chest X-ray NIHCC repository: https://nihcc.app.box.com/v/ChestXray-NIHCC.
Code availability
The code for to reproduce the research is available publicly at the repository: https://github.com/bayu-ladom-ipok/weOpen.
Competing interests
B.A.N. is a MORA Scholarship recipient from Sunan Ampel Islamic State University Surabaya—Indonesia, and he is also a research student in Curtin University Bentley - Australia. The scholarship recipient’s primary email addresses are: bayu@uinsby.ac.id and bayu.lecture@gmail.com. There are no potential conflict of interests for the manuscript.
Footnotes
Publisher's note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
References
- 1.Johnson JM, Khoshgoftaar TM. Survey on deep learning with class imbalance. J. Big Data. 2019;6:27. doi: 10.1186/s40537-019-0192-5. [DOI] [Google Scholar]
- 2.Cui, Y., Jia, M., Lin, T., Song, Y. & Belongie, S. J. Class-balanced loss based on effective number of samples. In IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2019, Long Beach, CA, USA, June 16-20, 2019, Vol. 1, 9268–9277 (2019).
- 3.Wang, X. et al. Chestx-ray8: Hospital-scale chest x-ray database and benchmarks on weakly-supervised classification and localization of common thorax diseases. In 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 3462–3471 (2017).
- 4.Gündel, S. et al. Learning to recognize abnormalities in chest x-rays with location-aware dense networks. In Progress in Pattern Recognition, Image Analysis, Computer Vision, and Applications - 23rd Iberoamerican Congress, CIARP 2018, Madrid, Spain, November 19-22, 2018, Proceedings, 757–765, 10.1007/978-3-030-13469-3 (2018).
- 5.Tan, M. & Le, Q. EfficientNet: Rethinking model scaling for convolutional neural networks. In (eds Chaudhuri, K. & Salakhutdinov, R) Proceedings of the 36th International Conference on Machine Learning, vol. 97 of Proceedings of Machine Learning Research, 6105–6114 (PMLR, Long Beach, 2019).
- 6.Baltruschat IM, Nickisch H, Grass M, Knopp T, Saalbach A. Comparison of deep learning approaches for multi-label chest x-ray classification. Sci. Rep. 2019;9:6381. doi: 10.1038/s41598-019-42294-8. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 7.Guan Q, et al. Thorax disease classification with attention guided convolutional neural network. Pattern Recogn. Lett. 2020;131:38–45. doi: 10.1016/j.patrec.2019.11.040. [DOI] [Google Scholar]
- 8.Ren, I. This is a reimplementation of ag-cnn: https://github.com/ien001/ag-cnn (2019).
- 9.Summers, R. https://nihcc.app.box.com/v/chestxray-nihcc (2017).
- 10.Weng, X., Zhuang, N., Tian, J. & Liu, Y. A pytorch reimplementation of chexnet: https://github.com/arnoweng/chexnet (2017).
- 11.Lin, T.-Y., Goyal, P., Girshick, R., He, K. & Dollar, P. Focal loss for dense object detection 2999–3007, 10.1109/ICCV.2017.324 (2017). [DOI] [PubMed]
- 12.Yao, L., Prosky, J., Poblenz, E., Covington, B. & Lyman, K. Weakly supervised medical diagnosis and localization from multiple resolutions. CoRR (2018). arxiv:1803.07703.
- 13.He, K., Zhang, X., Ren, S. & Sun, J. Deep residual learning for image recognition. In 2016 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2016, Las Vegas, NV, USA, June 27-30, 2016, Vol. 1, 770–778, 10.1109/CVPR.2016.90(2016).
- 14.Huang, G., Liu, Z., van der Maaten, L. & Weinberger, K. Q. Densely connected convolutional networks. In CVPR, 2261–2269 (IEEE Computer Society, 2017).
- 15.Rajpurkar, P. et al. Chexnet: Radiologist-level pneumonia detection on chest x-rays with deep learning. CoRR (2017). arxiv:1711.05225.
- 16.Zhang, Z. & Sabuncu, M. R. Generalized cross entropy loss for training deep neural networks with noisy labels. In Advances in Neural Information Processing Systems 31: Annual Conference on Neural Information Processing Systems 2018, NeurIPS 2018, 3-8 December 2018, Montréal, Canada, 8792–8802 (2018).
- 17.Cao, K., Wei, C., Gaidon, A., Aréchiga, N. & Ma, T. Learning imbalanced datasets with label-distribution-aware margin loss. In Advances in Neural Information Processing Systems 32: Annual Conference on Neural Information Processing Systems 2019, NeurIPS 2019, 8–14 December 2019 (eds Wallach, H. M. et al.) 1565–1576 (Canada, Vancouver, BC, 2019).
- 18.Shorten C, Khoshgoftaar TM. A survey on image data augmentation for deep learning. J. Big Data. 2019;6:60. doi: 10.1186/s40537-019-0197-0. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 19.Wong, S. C., Gatt, A., Stamatescu, V. & McDonnell, M. D. Understanding data augmentation for classification: When to warp? In 2016 International Conference on Digital Image Computing: Techniques and Applications (DICTA), 1–6 (2016).
- 20.Peng, X., Tang, Z., Yang, F., Feris, R. S. & Metaxas, D. N. Jointly optimize data augmentation and network training: Adversarial data augmentation in human pose estimation. CoRR (2018). arxiv:1805.09707.
- 21.Tan, M. et al. Mnasnet: Platform-aware neural architecture search for mobile. In IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2019, Long Beach, CA, USA, June 16–20, 2019, Vol. 1, 2820–2828, 10.1109/CVPR.2019.00293 (Computer Vision Foundation / IEEE, 2019).
- 22.Sandler, M., Howard, A. G., Zhu, M., Zhmoginov, A. & Chen, L.-C. Mobilenetv2: Inverted residuals and linear bottlenecks. In CVPR, 4510–4520 (IEEE Computer Society, 2018).
- 23.Hu, J., Shen, L. & Sun, G. Squeeze-and-excitation networks. In IEEE Conference on Computer Vision and Pattern Recognition (2018).
- 24.Krizhevsky, A. Convolutional deep belief networks on cifar-10 (2010).
- 25.Hanley JA, McNeil BJ. The meaning and use of the area under a receiver operating characteristic (ROC) curve. Radiology. 1982;143:29–36. doi: 10.1148/radiology.143.1.7063747. [DOI] [PubMed] [Google Scholar]
- 26.Cortes, C. & Mohri, M. AUC optimization vs. error rate minimization. In Advances in Neural Information Processing Systems 16 [Neural Information Processing Systems, NIPS 2003, December 8-13, 2003, Vancouver and Whistler, British Columbia, Canada], (eds Thrun, S. et al.) 313–320 (MIT Press, 2003).
- 27.Saito T, Rehmsmeier M. The precision-recall plot is more informative than the roc plot when evaluating binary classifiers on imbalanced datasets. PLOS ONE. 2015;10:1–21. doi: 10.1371/journal.pone.0118432. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 28.Chou, B. This project is a tool to build chexnet-like models, written in keras: https://github.com/brucechou1983/chexnet-keras (2018).
- 29.Zhou, B., Khosla, A., Lapedriza, A., Oliva, A. & Torralba, A. Learning deep features for discriminative localization. In 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2921–2929, 10.1109/CVPR.2016.319 (2016).
- 30.Yang, W. et al. Towards rich feature discovery with class activation maps augmentation for person re-identification. In IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2019, Long Beach, CA, USA, June 16–20, 2019, Vol. 1, 1389–1398, 10.1109/CVPR.2019.00148 (2019).
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Data Availability Statement
The dataset for this research is available publicly in the Chest X-ray NIHCC repository: https://nihcc.app.box.com/v/ChestXray-NIHCC.
The code for to reproduce the research is available publicly at the repository: https://github.com/bayu-ladom-ipok/weOpen.