# Evaluating GAN-Based Image Augmentation for Threat Detection in Large-Scale X-ray Security Images
## 4 Image Augmentation
### Image Synthesis  
In this section, we discuss our process of creating entirely new X-ray security images by combining the generated and translated X-ray images of threat objects with the images from the negative samples.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Gun** & **Knife** & **Wrench** & **Pliers** & **Scissors** \\ \hline
92 & 106 & 86 & 62 & 130 \\ \hline \hline \end{tabular}
\end{table}
Table 2: FID Scores for each class of the translated threat objects.  
Figure 10: Samples of camera images of threat objects.  
instances is greater than the count of threats, we use the count of threats as the upper bound. On the other hand, if the count of instances is less than the count of threats, we need to select another type of threat from the class distribution of threats excluding the threats already selected. Then, we need to sample again from the distribution of instances for the newly selected threat until we complete the counts of threats per image. Knowing the exact count and type of threats, we then randomly select images from the dataset of generated or translated X-ray images of threat objects and blend it with an image from the 10,000 negative samples in a similar manner done in [30]. Another distinction in our approach is that we do not just randomly select locations in the image to place the threats, instead the location of the threats is randomly selected from the allowed areas in the image defined by the high-density regions found using the method described in [37]. Without this step, threats might appear outside of the baggage, which is unrealistic. We repeat this process until we have combined all 10,0  
threat objects, and the overall performance of the model is represented by the mean across all classes of threat objects.  
\[AP=\ \sum_{n=0}(r_{n+1}-\ r_{n})\ p_{interp}(r_{n+1}) \tag{3}\]  
where \(r\) is the recall, \(p_{interp}\) is the interpolated precision given by \(p_{interp}(r_{n+1})=\max_{r\geq r_{n+1}}p(\widetilde{r})\), wherein \(p\) is the precision at \(\widetilde{r}\), and \(n\) includes all the recall points. This metric is one of the most popular metrics used to evaluate object detection models. LAMR is the AUC of the miss rate-false positives per image (FPPI) curve calculated for each class of threat objects, and the overall performance of the model is represented by the mean across all classes of threat objects.  
\[LAMR=\ exp^{[\frac{1}{n}\sum_{i=1}^{n}ln(\alpha_{i})]} \tag{4}\]  
where \(a\) is a positive value corresponding to the miss rate at \(n\) evenly spaced FPPI points in log-space, between \(10^{-2}\) and \(10^{0}\). This metric is often used in detection tasks where failure to detect the target must be avoided at high costs.  
To draw further comparisons to the original work on the SIXray dataset, we also used the Localization Accuracy (LA) defined in Equation (5). A hit is counted if the intersection-over-union (IoU) of the detected and the ground truth bounding boxes is at least 50%, and a miss is counted, otherwise.  
\[LA=\ \frac{\#\ of\ hits}{\#\ of\ hits+\#\ of\ miss} \tag{5}\]  
Finally, we inspect the effect of augmentation at the image level by observing the TPR and FPR defined in Equations (6) and (7), respectively. A detection is considered True Positive (TP) if the model detected at least one threat object in a positive sample, False Positive (FP) if the model detected at least one threat object in a negative sample, False Negative (FN) if the model did not detect any threat object in a positive sample and True Negative (TN) if the model did not detect any threat in a negative sample.  
\[TPR=\ \frac{TP}{TP+FN} \tag{6}\]  
\[FPR=\ \frac{FP}{FP+TN} \tag{7}\]