# Evaluating GAN-Based Image Augmentation for Threat Detection in Large-Scale X-ray Security Images
## 4 Image Augmentation
### Image Translation  
In this section, we describe our second approach used to create new X-ray security images of threats called image translation. Instead of using the extracted threat objects from the positive samples, we used camera images of threats objects as inputs to the image translation model. The goal of this model is to convert the camera images of threat objects to X-ray images. By doing this, we introduce more intra-class diversity for each threat object since there are far more camera images of threat objects than X-ray images. For instance, we observed that there only 9 types of gun present in the SIXray dataset, but we have collected more than 600 camera images of unique types of gun. Figure 8: Image generation model. \(\xi\) is the cost function, which is the average of the losses per minibatch. Figure 7: Samples of manually extracted threat objects. First, we scraped the internet for camera images of threats objects on a plain white background, as shown in Figure 10. We collected a total of 1670 camera images of threat objects, of which 662, 353, 234, 366, and 55 are guns, knives, wrenches, pliers, and scissors, respectively. We adapted a Cycle-GAN model as our image translation model. We chose Cycle-GAN for image translation to get the lower bound of the results since it is one earliest works in unpaired image-to-image translation. Moreover, prior translation models require paired training data, which is impossible to collect for this study where the X-ray images have been already collected. Cycle-GAN allows for the usage of camera images of threat objects even though they are not the exact counterpart of the X-ray images of threat objects. Figure 11 shows the architecture of the image translation model, which is made up of two sets of GANs with the same structure. The discriminators, \(\mathbf{D_{A}}\) and \(\mathbf{D_{B}}\), are each composed of four convolution blocks, accepts 256 \(\times\) 256 images as inputs, and outputs a scalar value, which determines whether the input was determined real or fake. The generators, \(\mathbf{G_{A}}\) and \(\mathbf{G_{B}}\), are encoder-style networks whose inputs and outputs are 256 \(\times\) 256 images. Each generator is composed of three convolutional blocks at the input side, nine ResNet blocks [8] in the middle, and three deconvolutional blocks, which uses transposed convolutions, at the output side. Similarly, we used a separate Cycle-GAN model for each threat object. \(\mathbf{G_{A}}\) is tasked to translate camera images of threat objects to the equivalent X-ray images, and \(\mathbf{D_{A}}\) is tasked to tell whether the input is a real or fake X-ray image of the threat object. \(\mathbf{G_{B}}\) is tasked to translate X-ray images of threat objects to the equivalent camera images, and \(\mathbf{D_{B}}\) is tasked to tell whether the input is a real or fake camera image of the threat object. Each of these GAN pairs is also trained alternately with the same adversarial loss defined in Equation (1), except that in this case, the input to the generator is no longer a random noise vector but images sampled from another domain. A cycle consistency loss, defined in Equation (2), is added to ensure that the generated \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Gun** & **Knife** & **Wrench** & **Pliers** & **Scissors** \\ \hline
109 & 118 & 103 & 111 & 169 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: FID Scores for each class of the generated threat objects. Figure 9: Samples of generated X-ray images of threat objects. images are strictly the equivalent of the input images and not a random permutation of images in the target domain. \[\mathcal{L}_{cyc}(G_{A},G_{B})=\ \mathbb{E}_{x\sim p_{data}(x)}[\left\|G_{B}(G_{A}(x) )-x\right\|_{1}]+\ \mathbb{E}_{y\sim p_{data}(y)}[\left\|G_{A}(G_{B}(y))-y \right\|_{1}], \tag{2}\]  
wherein \(x\) is the input sampled from the camera images of threat objects, and \(y\) is the input sampled from X-ray images of threat objects.