## GANs 'N Lungs: improving pneumonia prediction

## Tatiana Malygina 1 2 ,

tanya.malygina@botkin.ai

- 1 Intellogic Limited Liability Company (Intellogic LLC), office 1/334/63, building 1, 42 Bolshoi blvd., territory of Skolkovo Innovation Center, 121205, Moscow, Russia

2 Petersburg, 197101,

- The laboratory of bioinformatics, ITMO University, Kronverkskiy pr. 49, St. Russia

Elena Ericheva 1

elena.ericheva@botkin.ai

Ivan Drokin 1

ivan.drokin@botkin.ai

## Abstract

Wepropose a novel method to improve deep learning model performance on highly-imbalanced tasks. The proposed method is based on CycleGAN to achieve balanced dataset. We show that data augmentation with GAN helps to improve accuracy of pneumonia binary classification task even if the generative network was trained on the same training dataset.

Keywords: X-ray medical image classification, data augmentation, CycleGAN.

## 1. Introduction

The ability of generative adversarial networks (GAN) to generate images made them a useful tool in many research areas and in generative art. It was shown [5] that GANs can also be used to improve model training by extending train dataset with generated, previously unseen images.

One of significant problems and limitations of automatic medical image processing is the fact that the numbers of target lesions of different types are highly unbalanced. Many irregular lesions that are visible on medical image do not belong to the target class. As well as number of samples from normal class is overwhelming [7]. As the result, the extraction of main characteristics of lesions is a complex process and requires many heuristic steps. Preprocessing that brings all objects and visualization methods to the same distribution is still an important step that affects the efficiency of the classification. We have designed system for dataset balancing via oversampling with CycleGAN, that deals well with substantially unbalanced datasets.

## 2. Data augmentation framework

We consider binary classification problem. We start with dataset X consisting of n samples x , x 1 2 , . . . , x n and corresponding labels l 1 , l 2 , . . . , l n , where l i ∈ { 0 1 , } for i = 1 , . . . , n . Suppose that X is imbalanced, i.e. one class of labels dominates over another. To deal with this problem, we propose oversampling using generative adversarial network (GAN). We employ two networks G 0 → 1 and G 1 → 0 , that produce complementary samples. E.g., for sample x i with a corresponding label l i = 0 a new sample ˜ x i = G 0 → 1 ( x i ) with ˜ l i = 1 is

generated, and for sample x j with l j = 1 a sample ˜ x j = G 1 → 0 ( x j ) with ˜ l j = 0 is generated. These G 0 → 1 and G 1 → 0 models can be constructed separately with any image-to-image generative networks.

We combine newly generated samples ˜ with samples from X X to produce perfectly balanced dataset X aug consisting of samples x , . . . , x 1 n , x ˜ 1 , . . . , x ˜ n , with labels l 1 , . . . , l n , l ˜ 1 = 1 -l 1 , . . . , l ˜ n = 1 -l n . We use ˜ X to train binary classifiers.

## 3. Experiments

We conducted our experiments on imbalanced dataset with X-ray images subsampled from CheXnext [6] dataset with preserved original train/validation split. We've selected images with pneumonia (with label 1 in Pneumonia class) or with no abnormalities (with l i = 0 for all i ).

CycleGAN [4] with cycle-consistency loss was used to construct G 0 → 1 and G 1 → 0 generators. We've used them to produce X-ray images with pneumonia from images with no pneumonia, and vice versa. Figure 1 shows several pairs of prototype images from CheXnext, corresponding complementary images generated with CycleGAN and the difference between these images.

Our binary classifier is based on DenseNet-121 [3] architecture - in this way it is similar to the CheXnet and CheXnext models. It expects 224 × 224 images as the input and produces probabilities for target classes. As we focus on solving binary classification task, we use binary cross-entropy loss to optimize model during training.

To compare DenseNet model performance with and without augmentation, we use the same validation dataset. We compare results for 3 train datasets in binary classification task: pure CXR14 (no augmentation was used); augmented with CycleGAN pretrained on CXR14 dataset; augmented with CycleGAN, which was pretrained on additional dataset [2] . ROC and precision-recall curves for all classifiers are shown at Figure 3. You can see that with our balancing method ROC AUC score increased from 0.9745 to 0.9929 (0.9939 if we use additional dataset to train CycleGAN), PR AUC value increased from 0.9580 to .9865 (0.9883 if we use additional dataset to train CycleGAN) on validation data.

Also we provide examples of class activation maps [1] on Figure 2. It highlights the most informative image regions relevant to the predicted class.

## 4. Conclusion and Future Work

The proposed data augmentation method has improved performance of binary classifier in biomedical field, and it might be useful in other computer vision tasks.

Despite CheXnext dataset is quite large even for binary classification task and all experiments are conducted with very limited hardware resources (single NVIDIA 1070 graphical card) the method produce visually-distinguishable classes of image. Thus this augmentation technique does not require extensive computational resources and could be applied in everyday machine learning practice.

For non-radiologist it might be unclear if generated images belong to pneumonia or no pneumonia class (see Figure 1). That's why we plan to test both the model and augmented images against human radiologists on different datasets, including private datasets.

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00433v1-figure-878983dd-120b-4a07-a922-e6697ed2214c.jpg)

Figure 2: Class activation maps example from models: a) trained without augmentation; b) trained with augmentation.

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00433v1-figure-fd90384f-4b4c-4ec4-8ff7-dfd1cb7ec053.jpg)

Figure 1: Picture shows Original images from CheXnext and their CycleGAN-generated pairs. Difference between Original and Generated images is shown in Difference row.

Figure 3: Test metrics for pure CheXnext subset and GAN-augmented datasets: a) ROC curve; b) Precision-Recall curve.

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00433v1-figure-b98979fb-e933-4e69-a916-dd3289612a95.jpg)

We plan to develop effective procedure and extend proposed augmentation method for multi-class tasks as well as for multi-label datasets, i.e. full CheXnext dataset with 14 classes, in cross-domain CycleGAN for x-rays/fluorography.We also plan to run a more detailed analysis of G 0 → 1 and G 1 → 0 models and explore classification model robustness against generative model output.

## References

- [1] Bolei Zhou et al. Learning deep features for discriminative localization. In IEEE CVPR , 2016.
- [2] Daniel S. Kermany et al. Identifying medical diagnoses and treatable diseases by imagebased deep learning. Cell , 172(5):1122-1131.e9, February 2018.
- [3] G. Huang et al. Densely connected convolutional networks. In IEEE CVPR , pages 2261-2269, July 2017.
- [4] Jun-Yan Zhu et al. Unpaired image-to-image translation using cycle-consistent adversarial networks. In IEEE ICCV , 2017.
- [5] Maayan Frid-Adar et al. GAN-based synthetic medical image augmentation for increased CNN performance in liver lesion classification. CoRR , abs/1803.01229, 2018.

## Malygina Ericheva Drokin

- [6] Pranav Rajpurkar et al. Deep learning for chest radiograph diagnosis: A retrospective comparison of the CheXNeXt algorithm to practicing radiologists. PLOS Medicine , 15 (11):1-17, 11 2018.
- [7] Xiaosong Wang et al. ChestX-ray8: Hospital-scale chest x-ray database and benchmarks on weakly-supervised classification and localization of common thorax diseases. IEEE CVPR , pages 2097-2106, 2017.
Tatiana Malygina Elena Ericheva Ivan Drokin
GANs 'N Lungs: improving pneumonia prediction
We propose a novel method to improve deep learning model performance on
highly-imbalanced tasks. The proposed method is based on CycleGAN to achieve
balanced dataset. We show that data augmentation with GAN helps to improve
accuracy of pneumonia binary classification task even if the generative network
was trained on the same training dataset.