Many security detectors do not have the ability to output individual luggage package images and are not compatible with deep learning algorithms. In this paper, a luggage package extraction of X-ray images based on the ES-MBD (Edge Sensitive Multi-channel Background Difference Algorithm) method is proposed, which is aiming at the problem that background difference binarization is insensitive to texture features and edge detection binarization is insensitive to smooth areas. In this method, X-ray luggage package images from complex original video images are used as a key target, the RGB three-channel background difference is calculated from the original X-ray image, the edge detection of the grayscale map is performed using the Sobel operator optimized by local gradient enhancement, and the morphological expansion process is performed on the combined results to obtain the complete wrapping target. The Suzuki algorithm is used to detect the outline of the binarized package image, match the package frame area and determine the key target. The ES-MBD method solves the problem of information loss in the traditional binarization method, and retains the information of insensitive regions while reducing noise. Through experimental comparison, the accuracy of ES-MBD binarization method reaches 97.3%, the recall rate reaches 96.5%, and ES-MBD method has obvious advantages in key target extraction of X-ray images.
To address the shortage of public datasets for customs X-ray images of contraband and the difficulties in deploying trained models in engineering applications, a method has been proposed that employs the Extract-Transform-Load (ETL) approach to create an X-ray dataset of contraband items. Initially, X-ray scatter image data is collected and cleaned. Using Kafka message queues and the Elasticsearch (ES) distributed search engine, the data is transmitted in real-time to cloud servers. Subsequently, contraband data is annotated using a combination of neural networks and manual methods to improve annotation efficiency and implemented mean hash algorithm for quick image retrieval. The method of integrating targets with backgrounds has enhanced the X-ray contraband image data, increasing the number of positive samples. Finally, an Airport Customs X-ray dataset (ACXray) compatible with customs business scenarios has been constructed, featuring an increased number of positive contraband samples. Experimental tests using three datasets to train the Mask Region-based Convolutional Neural Network (Mask R-CNN) algorithm and tested on 400 real customs images revealed that the recognition accuracy of algorithms trained with Security Inspection X-ray (SIXray) and Occluded Prohibited Items X-ray (OPIXray) decreased by 16.3% and 15.1%, respectively, while the ACXray dataset trained algorithm’s accuracy was almost unaffected. This indicates that the ACXray dataset-trained algorithm possesses strong generalization capabilities and is more suitable for customs detection scenarios.