## 3 Experiments
### Pre-Processing and Training  
Image data and label data need to be pre-processed before training. For image data, all chest X-ray images were first scaled from a size of 1024 \(\times\) 1024 to 224 \(\times\) 224 and converted into RGB channels. To reduce the risk of overfitting, chest X-ray images were then rotated at 45 and 90 degree angles for data augmentation. Fourteen lesion types were converted into 14 integers ranging from 0 to 13 when the image extractors were trained and tested. For the detection task of multiple lesions on single images, lesion types were converted into 14 integers, ranging from 3 to 16, while '0' represents the null character '<NULL>', '1' represents the start indicator '<START>', and '2' represents the end indicator '<END>'. For example, infiltration, effusion, and atelectasis grew represented by 3, 4, and 5, respectively. After preprocessing, the label of a multi-lesion chest X-ray image containing infiltration, effusion, and atelectasis is [1 3 4 5 2]. The image data and the label data were saved in two.pkl files and connected by the corresponding image ID during training.  
There are three steps to train our whole model. The CNN part of CAL network was first trained as a simple 14-class classification task using images with lesions on ChestX-ray14, as shown in Figure 12. The purpose of this step is to increase the transfer efficiency between medical images and natural images, acquiring more discriminative features. Then, image features extracted from low-level layer of CNN encoder were input into the attention-based LSTM decoder and trained iteratively, as shown in Figure 12. After that, reordered labels obtained from CLA network were utilized to train a new attention-based LSTM decoder using original image features and updated ground truth, as shown in Figure 12.  
When training the image feature extractor in the first step, both single-lesion images and multi-lesion images were used. [PERSON] et al. [6] first built the ChestX-ray14 dataset and classified ChestX-ray14 dataset into different lesion types. Similar to [PERSON] et al. [6], the images were divided into a training set, validation set, and test set at a ratio of 7:1:2 in our experiments. Further, cross-validation was used to get a credible evaluation of the model.  
Multi-lesion images were used in the second and third steps because the final outputs of our method were multiple lesion types. The 20,795 multi-lesion images were divided into a training set, validation set, and test set at a ratio of 8:1:1 and a ten-fold cross validation procedure was also applied. The images were first shuffled and then divided into 10 folds. In each type of lesion combination, images should be shuffled by patient ID rather than image ID to reduce the overlap of both patient ID and lesion combination type between three subsets. We only adopted this \"shuffle\" strategy for lesion combinations with large scale samples in the experiment because there are hundreds of types of lesion combinations and most of them only hold a few samples. Each time, eight folds were used as the training set, one fold was used as the validation set, and one fold was used as the test set. The above process was repeated 10 times and each image was only used once for the validation or test.  
The experimental environment was an ubuntu linux server with 2 GeForce GTX 1080 Ti GPUs and the models were developed with Python and Tensorflow 1.2 (GPU and ubuntu version), a deep learning framework. The neural network was trained by stochastic gradient descent (SGD), with a batch size of 32 and a learning rate of 0.001. According to the distribution of label length, the length of LSTM \(C\) was set as 2, 3, and 4 (except for the start indicator and end indicator), respectively.