{'fraction_non_alphanumeric': 0.043653072946582425, 'fraction_numerical': 0.02334865020103389, 'mean_word_length': 4.99225606608157, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Tensor Pooling Driven Instance Segmentation Framework for Baggage Threat Recognition

Automated systems designed for screening contraband items from the X-ray imagery are still facing difficulties with high clutter, concealment, and extreme occlusion. In this paper, we addressed this challenge using a novel multi-scale contour instance segmentation framework that effectively identifies the cluttered contraband data within the baggage X-ray scans. Unlike standard models that employ region-based or keypoint-based techniques to generate multiple boxes around objects, we propose to derive proposals according to the hierarchy of the regions defined by the contours. The proposed framework is rigorously validated on three public datasets, dubbed GDXray, SIXray, and OPIXray, where it outperforms the state-of-the-art methods by achieving the mean average precision score of 0.9779, 0.9614, and 0.8396, respectively. Furthermore, to the best of our knowledge, this is the first contour instance segmentation framework that leverages multi-scale information to recognize cluttered and concealed contraband data from the colored and grayscale security X-ray imagery.

1 Introduction X-ray imagery is a widely used modality for nondestructive testing [1], especially for screening illegal and smuggled items at airports, cargoes, and malls. Manual baggage inspection is a tiring task and susceptible to errors caused due to exhausting work routines and less experienced personnel. Initial systems proposed to address these problems employed conventional machine learning [2]. Driven by hand-engineered features, these methods are only applicable to limited data and confined environmental settings [3]. Recently, attention has turned to deep learning methods, which gave a neat boost in accuracy and generalization capacity towards screening prohibited baggage items [4,5]. However, deep learning methods are also prone to clutter, and occlusion [6]. This limitation emanates from the proposal generation strategies which have been designed for the color images [7]. Unlike RGB scans, X-ray imagery lack texture and exhibit low-intensity variations between cluttered objects. This intrinsic difference makes the region-based or anchor-based proposal generation methods such as Mask R-CNN [8], Faster R-CNN [9], RetinaNet [10], and YOLO [11] less robust for detecting the cluttered contraband data [6]. Moreover, the problem is further accentuated by the class imbalance nature of the contraband items in the real-world [7]. Despite the considerate strategies proposed to alleviate the occlusion and the imbalance nature [12,13], recognizing threatening objects in highly cluttered and concealed scenarios is still an open problem [14].

Contributions
In this paper, we propose a novel multi-scale contour instance segmentation framework for identifying suspicious items using X-ray scans. Unlike standard models that employ region-based or keypoint-based techniques to generate multiple boxes around objects [5,6,15], we propose to derive proposals according to the hierarchy of the regions defined by the contours. The insight driving this approach is that contours are the most reliable cue in the X-ray scans due to the lack of surface texture. For example, the occluded items exhibit different transitional patterns based upon their orientation, contrast, and intensity. We try to amplify and exploit this information through the multi-scale scan decomposition, which boosts the proposed framework's capacity for detecting the underlying contraband data in the presence of clutter. Furthermore, we are also motivated by the fact that organic material's suspicious items show only their outlines in the X-ray scans [42]. To summarize, the main features of this paper are: -Detection of overlapping suspicious items by analyzing their predominant orientations across multiple scales within the candidate scan. Unlike [42][43][44], we propose a novel tensor pooling strategy to decompose the scan across various scales and fuses them via a single multi-scale tensor. This scheme results in more salient contour maps (see Figure 1), boosting our framework's capacity for handling dulled, concealed, and overlapping items. -A thorough validation on three publicly available large-scale baggage X-ray datasets, including the OPIXray [12], which is the only dataset allowing a quantitative measure of the level of occlusion. -Unlike state-of-the-art methods such as CST [42], TST [43], and DTS [44], the performance of the proposed framework to detect occluded items has been quantitatively evaluated on OPIXray [12] dataset. Please see Table 4 for more details.

Related Work
Many researchers have developed computer-aided screening systems to identify potential baggage threats [23]. While a majority of these frameworks are based on conventional machine learning [16], the recent works also employ supervised [5], and unsupervised [17] deep learning, and these methods outperform conventional approaches both in terms of performance, and efficiency [6]. In this section, we discuss some of the major baggage threat detection works. We refer the readers to [14,18] for an exhaustive survey.

Traditional Methods
The early baggage screening systems were driven via classification [3], segmentation [19] and detection [20] approaches to identify potential threats and smuggled items. Here, the work of Bastan et al. [2] is appreciable, which identifies the suspicious and illegal items within the multi-view X-ray imagery through fused SIFT and SPIN driven SVM model. Similarly, SURF [19], and FAST-SURF [22] have also been used with the Bag of Words [21] to identify threatening items from the security X-ray imagery. Moreover, approaches like adapted implicit shape model [24] and adaptive sparse representation [23] were also commendable for screening suspicious objects from the X-ray scans.

Deep Learning Frameworks
The deep learning-based baggage screening frameworks have been broadly categorized into supervised and unsupervised learning schemes.

Supervised Methods
The initial deep learning approaches involved scanlevel classification to identify the suspicious baggage content [5]. However, with the recent advancements in object detection, researchers also employed sophisticated detectors like RetinaNet [10], YOLO [31,32], and Faster R-CNN [9] to not only recognize the contraband items from the baggage X-ray scans but also to localize them via bounding boxes [6]. Moreover, researchers also proposed semantic segmentation [29] and instance segmentation [43] models to recognize threatening and smuggled items from the grayscale and colored X-ray imagery. Apart from this, Xiao et al. [34] presented an efficient implementation of Faster R-CNN [9] to detect suspicious data from the TeraHertz imagery. Dhiraj et al. [38] used Faster R-CNN [9], YOLOv2 [32], and Tiny YOLO [32] to screen baggage threats contained within the scans of a publicly available GDXray dataset [39]. Gaus et al. [7] utilized RetinaNet [10], Faster R-CNN [9], Mask R-CNN [8] (driven through ResNets [35], VGG-16 [37], and SqueezeNet [36]) to detect prohibited baggage items. In another approach [15], they analyzed the transferability of these models on a similarly styled X-ray imagery contained within their local dataset as well as the SIXray10 subset of the publicly available SIXray dataset [13]. Similarly, Akçay et al. [6] compared Faster R-CNN [9], YOLOv2 [32], R-FCN [41], and sliding-window CNN with the AlexNet [40] driven SVM model to recognize occluded contraband items from the X-ray imagery. Miao et al. [13] explored the imbalanced nature of the contraband items in the real-world by developing a class-balanced hierarchical refinement (CHR) framework. Furthermore, they extensively tested their framework (backboned through different classification models) on their publicly released SIXray [13] dataset. Wei et al. [12] presented a plug-and-play module dubbed De-occlusion Attention Module (DOAM) that can be coupled with any object detector to enhance its capacity towards screening occluded contraband items. DOAM was validated on the publicly available OPIXray [12] dataset, which is the first of its kind in providing quantitative assessments of baggage screening frameworks under low, partial, and full occlusion [12]. Apart from this, Hassan et al. [42] also addressed the imbalanced nature of the contraband data by developing the cascaded structure tensors (CST) based baggage threat detector. CST [42] generates a balanced set of contour-based proposals, which are then utilized in training the backbone model to screen the normal and abnormal baggage items within the candidate scan [42]. Similarly, to overcome the need to train the threat detection systems on large-scale and well-annotated data, Hassan et al. [44] introduced meta-transfer learning-based dual tensor-shot (DTS) detector. DTS [44] analyzes the scan's saliency to produce low and high-density contour maps from which the suspicious contraband items are identified effectively with few-shot training [44]. In another approach, Hassan et al. [43] developed an instance segmentation-based threat detection framework that filters the contours of the suspicious items from the regular content via trainable structure tensors (TST) [43] to identify them accurately within the security X-ray imagery.

Unsupervised Methods
While most baggage screening frameworks involved supervised learning, researchers have also explored adversarial learning to screen contraband data as anomalies. Akçay et al. [45], among others, laid the foundation of unsupervised baggage threat detection by proposing GANomaly [45], an encoder-decoder-encoder network trained in an adversarial manner to recognize prohibited items within baggage X-ray scans. In another work, they proposed Skip-GANomaly [17] which em- Fig. 1: (A) An exemplar X-ray scan from the GDXray dataset [39], (B) contour map obtained through the modified structure tensors in [42] and [43], (C) contour map obtained through proposed tensor pooling strategy.
ploys skip-connections in an encoder-decoder topology that not only gives better latent representations for detecting baggage threats but also reduces the overall computational complexity of GANomaly [45]. The rest of the paper is organized as follows: Section 3 presents the proposed framework. Section 4 describes the experimental setup. Section 5 discusses the results obtained with three public baggage X-ray datasets. Section 6 concludes the paper and enlists future directions.

Proposed Approach
The block diagram of the proposed framework is depicted in Figure 2. The input scan is fed to the tensor pooling module (block A) to generate a multi-scale tensor representation, revealing the baggage content's transitional patterns at multiple predominant orientations and across various scales. Afterward, the multiscale tensor is passed to the encoder-decoder backbone (block B), implementing the newly proposed contour maps-based instance segmentation. This block extracts the contours of the prohibited data while eliminating the irrelevant scan content. In the third stage (block C), each extracted contour, reflecting the contraband item instance, is utilized in generating the respective mask and the bounding box for localization. In the subsequent sections, we present a detailed description of each module within the proposed framework.

Tensor Pooling Module
The tensor pooling module decomposes the input scan into n levels of a pyramid. From each level of the pyramid, the baggage content's transitional patterns are generated by analyzing their distribution of orientations within the associated image gradients. In the proposed tensor pooling scheme, we highlight the transitional patterns in N image gradients (corresponding to N directions) by computing the following N × N blockstructured symmetric matrix [42,43]: Each tensor (φ * (∇ k .∇ m )) in the above block-matrix is an outer product of two image gradients and a smoothing filter φ. Moreover, the orientation (θ), of the image gradient ∇ j , is computed through: θ = 2πj N , where j ranges from 0 to N − 1. Since the block-structured matrix in Eq. 1 is symmetric, we obtain N (N −1) 2 unique tensors. From this group, we derive the coherent tensor, reflecting the baggage items' predominant orientations. The coherent tensor is a single tensor representation generated by adding the most useful tensors out of the N (N +1) 2 unique tensor set. Here, it should be noted that these useful tensors are selected by ranking all the N (N +1) 2 unique tensors according to their norm. Moreover, the coherent tensor also reveals the variations in the intensity of the cluttered baggage items, aiding in generating individual contours for each item. However, this scheme analyzes only the intensity variations of the baggage items at a single scale, limiting the extraction of the objects having lower transitions with the background [42,43]. To address this limitation, we propose a multi-scale tensor fusing the X-ray scan transitions from coarsest to finest levels so that each item, even having a low-intensity difference with the background, can be adequately highlighted. For example, see the boundaries of: the razor in a multi-scale tensor representation in Figure 1 (C), the straight knife in Figure 3 (G), the two knives and a gun in Figure 3 (H), and the two guns and a knife in Figure 3 (I).
As mentioned earlier, the multi-scale tensors are computed through pyramid pooling (up to n th level). At any l th level, (such that 2 ≤ l ≤ n), we multiply, pixel-wise, the decomposed image with the transitions obtained at the previous (l − 1) levels. In so doing, we ensure that the edges of the contraband items (procured earlier) are retained across each scale. The full procedure of the proposed tensor pooling module is depicted in Algorithm 1 and also shown in Figure 2.
The multi-scale tensor is then passed to the proposed encoder-decoder model to extract the contours of the individual suspicious items. A detailed discussion about contour instance segmentation is presented in the subsequent section.  Fig. 3: Difference between conventional structure tensors (used in [42,43]), and proposed multi-scale tensor approach. First row shows the original scans from OPIXray [12], GDXray [39], and SIXray [13] dataset. The second row shows the output for the conventional structure tensors [42,43]. The third row shows the output for the proposed tensor pooling module.

Contour Instance Segmentation
The contour instance segmentation is performed through the proposed asymmetric encoder-decoder network, which assigns the pixels in the multi-scale tensors to one of the following categories C k=1:M+1 where M denotes the number of prohibited items' Fig. 4: Contour instance segmentation from multi-scale tensors. The first column shows the original scans, the second column shows the multi-scale tensor representations, the third column shows the ground truths, and the fourth column shows the extracted contours of the contraband items.
instances to which we add the class background which include background and irrelevant pixels (i.e., pixels belonging to a non-suspicious baggage content). Furthermore, to differentiate between the contours of the normal and suspicious items, the custom shapepreserving (SPB) and identity blocks (IB) have been added within the encoder topology. The SPB, as depicted in Figures 2 and 5 (A), integrates the multi-scale tensor map (after scaling) in the feature map extraction to enforce further the attention on prohibited items' outlines. The IB ( Figure 5-A), inspired by ResNet architecture [35], acts as a residual block to emphasize the feature maps of the previous layer. Apart from this, the whole network encompasses one input, one zero-padding, 22 convolution, 20 batch normalization, 12 activation, four pooling, two multiply, six addition, three lambda (that implements the custom functions), and one reshape layer. Moreover, we use skip-connections (via addition) within the encoderdecoder to refine the extracted items' boundaries. The number of parameters within the network is 1,308,160, from which around 6,912 parameters are non-trainable. The detailed summary of the proposed model (including the architectural details of the SPB and IB blocks) is available in the source code repository 1 .

Bounding Box and Mask Generation
After segmenting the contours, we perform morphological post-processing to remove tiny and isolated frag-

Experimental Setup
This section presents the details about the experimental protocols, datasets, and evaluation metrics which were in order to assess the proposed system's performance and compare it with state-of-the-art methods.

Datasets
We validated the proposed framework on three different publicly available baggage X-ray datasets, namely, GDXray [39], SIXray [13], and OPIXray [12]. The detailed description of these datasets are presented below.

GDXray
GDXray [39] was first introduced in 2015 and it contains 19,407 high-resolution grayscale X-ray scans. The dataset is primarily designed for the non-destructive testing purposes and the scans within GDXray [39] are arranged into five categories, i.e., welds, baggage, casting, settings and nature. But baggage is the only relevant group for this study and it contains 8,150 grayscale X-ray scans. Moreover, the dataset also presents the detailed annotations for the prohibited items such as shuriken, knives, guns, and razors. As per the dataset standard, 400 scans from GDXray [39] were used for training purposes, while the remaining scans were used for testing purposes.

SIXray
SIXray [13] is a recently introduced large-scale security inspection X-ray dataset. It contains a total of 1,059,231 colored X-ray scans from which 8,929 scans are positive (containing prohibited items such as knives, wrenches, guns, pliers, hammer and scissors along with their ground truths), and 1,050,302 are negative (containing only the normal items). To validate the performance against class imbalance, the authors of the dataset presented three subset schemes of the dataset, namely, SIXray10, SIXray100, and SIXray1000 [13]. Moreover, SIXray [13] is also the largest and most challenging dataset (to date) designed to assess threat detection frameworks' performance towards screening extremely cluttered and highly imbalanced contraband data [13,44]. As per the SIXray [13] dataset standard, we used 80% scans for the training and the rest of 20% for testing.

OPIXray
OPIXray [12] is the most recent baggage X-ray dataset (released publicly for the research community in 2020). It contains 8,885 colored X-ray scans. As per the dataset standard, out of these 8,885 scans, 7,109 are to be utilized for the training purposes, while the remaining 1,776 are to be used for testing purposes, to detect scissor, straight knife, multi-tool knife, folding knife, and utility knife. Moreover, the dataset authors also quantified occlusion within the test scans into three levels, i.e., OP1, OP2, and OP3. OP1 indicates that the contraband items within the candidate scan contain no or slight occlusion, OP2 depicts a partial occlusion, while OP3 represents severe or full occlusion cases. We also want to highlight here that the resolution of the scans within each dataset varies significantly (except for OPIXray [12]). For example, on GDXray [39], the scan resolution varies as 2688 × 2208, 900 × 1430, 850 × 850 and 601 × 1241, etc. Similarly, on SIXray [13], the scan resolution varies as 681 × 549 × 3, 801 × 482 × 3, 649 × 571 × 3, 1024 × 640 × 3, and 675 × 382 × 3, etc. But on OPIXray [12], the resolution of all the scans is 1225x954x3. In order to process all the scans with the proposed framework, we have re-sized them to the common resolution of 576×768×3, which is extensively used in the recently published frameworks [42][43][44].

Training and Implementation Details
The proposed framework was developed using Python 3.7.4 with TensorFlow 2.2.0 and Keras APIs on a machine havingIntel Core i9-10940X@3.30 GHz CPU, 128 GB RAM and an NVIDIA Quadro RTX 6000 with cuDNN v7.5, and a CUDA Toolkit 10.1.243. Some utility functions are also implemented using MATLAB R2021a. Apart from this, the training on each dataset was conducted for a maximum of 50 epochs using ADADELTA [46] as an optimizer (with the default learning and decay rate configurations) and a batch size of 4. Moreover, 10% of the training samples from each dataset were used for the validation (after each epoch). For the loss function, we used the focal loss [10] expressed below: where c represents the total number of classes, and b s denotes the batch size. p(l i,j ) denotes the predicted probability of the logit l i,j generated from i th training sample for the j th class, t i,j tells if the i th training sample actually belongs to the j th class or not, the term α(1 − p(l i,j )) γ represents the scaling factor that gives more weight to the imbalanced classes (in other words, it penalizes the network to give emphasize to the classes for which the network obtain low prediction scores).
Through rigorous experiments, we empirically selected the optimal value of α and γ as 0.25 and 2, respectively, as they result in faster learning for each dataset while simultaneously showing good resistance to the imbalanced data. Apart from this, architecturally, the kernel sizes within the proposed encoder-decoder backbone vary as 3x3 and 7x7, whereas the number of kernels varies as 64, 128, 256, 512, 1024, and 2048. Moreover, the pooling size within the network remained 2x2 across various network depths to perform the feature decomposition (at each depth) by the factor of 2. For more architectural and implementation details of the proposed framework, we refer the reader to the source code, which we have released publicly for the research community on GitHub 1 .

Evaluation Metrics
In order to assess the proposed approach and compare it with the existing works, we used the following evaluation metrics:

Intersection-over-Union
Intersection-over-Union (IoU) tells how accurately the suspicious items have been extracted, and it is measured by checking the pixel-level overlap between the predictions and the ground truths. Mathematically, IoU is defined as: where T p are true positives (indicating that the pixels of the contraband items are correctly predicted w.r.t the ground truth), F p represents false positives (indicating that the background pixels are incorrectly classified as positives), and F n represents false negatives (meaning that the pixels of the contraband items are misclassified as background). Furthermore, we also calculated the mean IoU (µIoU) by taking an average of the IoU score for each contraband item class.

Dice Coefficient
Apart from IoU scores, we also computed the dice coefficient (DC) scores to assess the proposed system's performance for extracting the contraband items. DC is calculated through: Compared to IoU, DC gives more weightage to the true positives (as evident from Eq. 4). Moreover, the mean DC (µDC) is calculated by averaging DC scores for each category.

Mean Average Precision
The mean average precision (mAP) (in the proposed study) is computed by taking the mean of average precision (AP) score calculated for each contraband item class for the IoU threshold ≥ 0.5. Mathematically, mAP is expressed below:  [39], SIXray [13], and OPIXray [12] datasets, respectively.
where n c denotes the number of contraband items in each dataset. Here, we want to highlight that to achieve fair comparison with the state-of-the-art, we have used the original bounding box ground truths of each dataset for measuring the proposed framework's performance towards extracting the suspicious and illegal items.

Results
In this section, we present the detailed results obtained with GDXray [39], SIXray [13], and OPIXray [12] datasets. Before going into the experimental results, we present detailed ablation studies to determine the proposed framework's hyper-parameters. We also report a detailed comparison of the proposed encoderdecoder network with the popular segmentation models.

Ablation Studies
The ablation studies in this paper aim to determine the optimal values for 1) the number of orientations and scaling levels within the tensor pooling module and 2) the choice of the backbone model for performing the contour instance segmentation.

Number of Orientations and the Scaling Levels
The tensor pooling module highlights the baggage content transitions in the image gradients oriented in N directions and up to n scaling levels. Increasing these parameters helps generate the best contour representation leading towards a more robust detection, but also incurs additional computational cost. As depicted in Figure 6 (A), we can see that for GDXray dataset [39] with N = 2, n = 2, we obtain an mAP score of 0.82. With the combination N = 5, n = 5, we get 16.54% improvements in the detection performance but at the expense of a 97.71% increase in computational time (see Figure 6-D). Similarly, on the SIXray dataset [13], we obtain 18.36% improvements in the detection performance (by increasing N and n) at the expense of 95.88% in the computational time (see Figure 6 (B, E)). The same behavior is also noticed for OPIXray dataset [12] in Figure 6 (C, F). Considering all the combinations depicted in Figure 6, we found that N = 4 and n = 3 provide the best trade-off between the detection and run-time performance across all three datasets.

Choice of a Backbone Model
The proposed backbone model has been specifically designed to segment the suspicious items' contours while discarding the normal baggage content. In this series of experiments, we compared the proposed asymmetric encoder-decoder model's performance with popular encoder-decoder, scene parsing, and fully convolutional networks. In terms of µDC and µIoU, we report the performance results in Table 1. We can observe that the proposed framework achieves the best extraction performance on OPIXray [12] and SIXray [13] dataset, leading the second-best UNet [47] by 2.34% and 3.72%. On the GDXray [39], however, it lags from the FCN-8 [48] and PSPNet [49] by 6.54% and 5.91%, respectively. But as our model outperforms all the other architectures on the large-scale SIXray [13] and OPIXray [12] datasets, we chose it as a backbone for the rest of the experimentation.

Evaluation on GDXray Dataset
The performance of the proposed framework and of the state-of-the-art methods on the GDXray [39] dataset are reported in Table 2. We can observe here that the proposed framework outperforms the CST [42] and the TST framework [43] by 4.98% and 1.07%, respectively. Furthermore, we wanted to highlight the fact that CST [42] is only an object detection scheme, i.e., it can only localize the detected items but cannot generate their Table 1: Performance comparison of the proposed backbone network with PSPNet [49], UNet [47] and FCN-8 [48] for recognizing the boundaries of the contraband items. The best and second-best performances are in bold and underline, respectively. Moreover, the abbreviations are: Met: Metric, Data: Dataset, GDX: GDXray [39], SIX: SIXray [13], OPI: OPIXray [12]. masks. Masks are very important for the human observers in cross-verifying the baggage screening results (and identifying the false positives), especially from the cluttered and challenging grayscale scans. In Figure 7, we report some of the cluttered and challenging cases showcasing the effectiveness of the proposed framework in extracting the overlapping contraband items. For example, see the extraction of merged knife instances in (H), and the cluttered shuriken in (J, L). We can also appreciate how accurately the razors have been extracted in (J, L). Extracting such low contrast objects  in the competitive CST framework requires suppressing first all the sharp transitions in an iterative fashion [42].

Evaluations on SIXray Dataset
The proposed framework has been evaluated on the whole SIXray dataset [13] (containing 1,050,302 negative scans and 8,929 positive scans) and also on each of its subsets [13]. In Table 2, we can observe that the proposed framework achieves an overall performance gain of 0.190% and 0.980% over CST [42] and TST [43] framework, respectively. In Table 3, we report the results obtained with each subset of the SIXray dataset [13], reflecting different imbalanced normal and prohibited item categories. The results further confirm the superiority of the proposed framework against other state-of-the-art solutions, especially w.r.t the CHR [13], and [15]. In addition to this, in an extremely challenging SIXray1000 subset, we notice that the proposed framework leads the second-best TST framework [43] by 3.22%, and CHR [13] by 44.36%. Apart from this, Figure 8 depicts the qualitative evaluations of the proposed framework on the SIXray [13] dataset. In this figure, the first row shows examples containing one instance of the suspicious item, whereas the second and third rows show scans containing two or more instances of the suspicious items. Here, we can appreciate how accurately the proposed scheme has picked the cluttered knife in (B). Moreover, we can also observe the extracted chopper (knife) in (D) despite having similar contrast with the background. More examples such as (F, H, and J) demonstrate the proposed framework's capacity in picking the cluttered items from the SIXray dataset [13].

Evaluations on OPIXray Dataset
The performance evaluation of the proposed framework on OPIXray dataset [12] is reported in Table 2. We can observe here that the proposed system achieves an overall mAP score of 0.8396, outperforming the secondbest DOAM framework [12] (driven via FCOS [50]) by 1.55%. Here, although the performance of both frameworks is identical, we still achieve a significant lead of 7.91% over the DOAM [12] for extracting the straight knives.
Concerning the level of occlusion (as aforementioned, OPIXray [12] splits the test data into three subsets, OP1, OP2, OP3, according to the level of occlusion), we can see in Table 4 that the proposed framework achieves the best performance at each occlusion level as compared to the second-best DOAM [12] framework driven by the single-shot detector (SSD) [51]. Figure 9 reports some qualitative evaluation, where we can appreciate the recognition of the cluttered scissor (e.g. see B and F), and overlapping straight knife (in H). We can also notice the detection of the partially occluded folding and straight knife in (D) and (J). Fig. 9: Qualitative evaluations of the proposed framework on OPIXray [12] dataset. Please zoom-in for a best visualization.

Failure Cases
In Figure 10, we report examples of failure cases encountered during the testing. In cases (B, H, N, and P), we can see that the proposed framework could not pick-up the whole regions of the contraband items, even though the items were detected correctly. However, such cases are observed in highly occluded scans such as (A and G), where it is difficult, even for a human observer, to distinguish the items' regions properly. The second type of failure corresponds to the pixels misclassification as shown in (D) where some of the gun's pixels have been misclassified as knife. We can address these scenarios through post-processing steps like blob removal and region filling. The third failure case relates to the proposed framework's inability to generate a single bounding box for the same item. Such a case is depicted in (F), where two bounding boxes were generated for the single orange knife item. One possible remedy here is to generate the bounding boxes based upon the minimum and maximum mask value in both image dimensions for each label. Another type of failure is shown in (J) and (L). Here, the scans contain only normal baggage content, but some pixels occupying tiny regions have been misclassified as false positive (i.e., knife). We can also address this kind of failure through blob removal scheme.
Examining the failure cases' statistical distributions, we found a majority of 86.09% cases belonging to the curable categories (i.e., second, third, and fourth), meaning that the proposed framework's performance can be further improved using the post-processing techniques mentioned above.  [12] 0.7787 0.7245 0.7078 SSD [51] 0.7545 0.6954 0.6630

Conclusion
In this work, we proposed a novel contour-driven approach for detecting cluttered and occluded contraband items (and their instances) within the baggage X-ray scans, hypothesizing that contours are the most robust cues given the lack of texture in the X-ray imagery. We concretized this original approach through a tensor pooling module, producing multi-scale tensor maps highlighting the items' outlines within the X-ray scans and an instance segmentation model acting on this representation. We validated our approach on three publicly available datasets encompassing graylevel and colored scans and showcased its overall superiority over competitive frameworks in various aspects. For instance, the proposed framework outperforms the state-of-the-art methods [12,[42][43][44]] by 1.07%, 0.190%, and 1.55% on GDXray [39], SIXray [13], and OPIXray [12] dataset, respectively. Furthermore, on each SIXray subsets (i.e., SIXray10, SIXray100, SIXray1000) [13], the proposed framework leads the state-of-the-art by 1.92%, 2.02%, and 3.22%, respectively. In future, we aim to apply the proposed framework to recognize 3D printed contraband items from the X-ray scans. Such items exhibit poor visibility in the X-ray scans because of their organic material, making them an enticing and challenging case to investigate and address. Ethics Approval: All the authors declare that no prior ethical approval was required from their institutes to conduct this research. Consent for Participate and Publication: All the authors declare that no prior consent was needed to disseminate this article as there were no human (or animal) participants involved in this research. Availability of Data and Material: All the datasets that have been used in this article are publicly available. Code Availability: The source code of the proposed framework is released publicly on GitHub 1 . Authors' Contributions: T. Hassan formulated the idea, wrote the manuscript, and performed the experiments. S. Akçay improved the initial design of the framework and contributed to manuscript writing. M. Bennamoun co-supervised the whole research, reviewed the manuscript and experiments. S. Khan reviewed the manuscript, experiments and improved the manuscript writing. N. Werghi supervised the whole research, contributed to manuscript writing, and reviewed the experimentation.