# Pixel-Level Analysis for Enhancing Threat Detection in Large-Scale X-ray Security Images
## 5 Proposed Method
### Model Selection
#### 5.1.1 Detection Models  
In selecting the best detection model, we evaluated four of the most popular state-of-the-art approaches.  
**Faster R-CNN**[11] belongs to the family of two-stage object detection models known as region-based CNNs. The first stage of the algorithm is known as the region proposal network (RPN), where areas in the image that are suspected of containing the target objects are extracted and passed down to the second stage of the algorithm, which then classifies the objects contained in the extracted area. The localization is improved by considering the prediction of the bounding boxes as a regression task, where the difference between the coordinates of the real bounding boxes and the coordinates of the proposed regions are considered. This model is designed to be the fastest and most accurate compared to its previous iterations [24; 25].  
**You Only Look Once (YOLOv3)**[26] belongs to the one-stage object detectors that do not require a region proposal as part of the algorithm and, instead, analyze a dense sampling of the possible locations. In YOLO, the input image is divided into grid cells, and each cell forecasts a fixed number of bounding boxes, called priors, along with the confidence scores. All these predictions are simultaneously made using a single CNN, making it one of the fastest algorithms suitable for real-time applications. In this paper, we adopted the third version of the algorithm, which is designed to detect small objects better with the help of the incorporation of shortcut connections.  
**Single-shot Multibox Detector (SSD)**[27] is also a one-stage algorithm that performs detection at every pyramidal layer of the CNN to focus on objects of varying scales. Instead of dividing the input into grids, SSD predicts the offset of the default boxes, also known as anchor boxes, for every point in the feature map. Receptive fields of feature maps differ at every level in the pyramid of the CNN. Earlier layers tend to have fine-grained feature maps, and later layers tend to have coarse-grained feature maps. Since the anchor boxes have fixed sizes relative to their corresponding cell, predictions at later layers capture larger objects in the image, while predictions at the earlier layers capture smaller objects in the image.  
**RetinaNet**[28] is another one-stage algorithm that bears a resemblance to SSD in the sense that it also uses the concept of detection at each level of pyramidal layers of the CNN. Yet, they also attach a feature pyramid network (FPN) [29], which concatenates later feature maps with earlier feature maps to gain stronger representations. Furthermore, they introduce a different loss function, called focal loss, with the aim of putting more weight on hard samples, i.e., samples that are often misclassified.  
We only used positive samples to evaluate the effectiveness of each detection model in detecting threats when they are present in the image. We divided the data into training and validation sets. We used the same backbone network for all the models, i.e., ResNet-50 [30], and trained them all for 60,000 iterations. Table 2 shows the per-category \(AP\) and the m\(AP\) of the detectors on the validation set. Although per-category results are not consistent, the overall evaluation favors Faster R-CNN as the most accurate detector. Moreover, RetinaNet already has the advantage of having an FPN attached to its backbone network, which all the other models did not have. This may have been the reason why among the other one-stage detectors, it achieved the closest overall performance to the Faster R-CNN approach. On the basis of this result, we selected Faster R-CNN as our object detection model.