## 1 Introduction  
Deep learning models for specific target detection has been applied in a wide range especially in the transportation industry [1, 2]. In the security inspection scenario, there is also a need to use deep learning models to assist or even replace labor. In fact, there are already many new security machines that integrate contraband detection. Since the target to be detected is relatively fixed, the deep learning model actually performs quite well in this scenario. However, the use of deep learning models to assist security checks has not been widely used. The main reason is that the input required by the deep learning object detection model is a single image. Although this function is not difficult to implement, the old security detectors of various customs and express delivery stations do not include the function of transmitting a single package image to the deep learning algorithm server at the beginning of the design, so if there is a need to use the deep learning model for contraband detection, the new security detector can only be replaced, resulting in a waste of resources. At present, there are two main solutions to this problem:  
1. The video image of the security detector is input to the algorithm server in a frame-by-frame or frame-skipping manner;
2. Through the combination of target extraction, target tracking and keyframe detection, the package image in the keyframe is input to the algorithm server. In the first method, because the same package appears in multiple frames of the video, it leads to repeated detection of packages, resulting in a large amount of GPU overhead, higher detection costs, and incomplete packages in some frame images, which is prone to false detection. The second method can ensure that each package is only detected once as much as possible, but the current commonly used grayscale-based target extraction method is not accurate, easy to cause incomplete package images. In this scenario, there are generally two methods to achieve package extraction: one is the object detection algorithm based on deep learning, and the other is the unsupervised detection algorithm based on binarization. The advantage of deep learning-based target detection algorithm is that the detection results are accurate, but the disadvantage is that the shape of the target to be detected is highly uniform. Since it is a supervised model, when the shape of the target to be detected is different and not fixed, a convergent model cannot be trained, so the target cannot be detected. Meanwhile, the deep learning model has higher requirements on hardware computing power. With the second method, the package can be distinguished from the background by binarization of the image, and the location of the package area can be obtained by contour detection. Compared with deep learning object detection algorithm, this method has the advantages of less computation and no fixed object shape to be extracted. It is a lightweight unsupervised detection algorithm. It is widely used in the scenarios of pipeline and road foreign body detection. The limitation of the algorithm is that the background features need to be fixed, and the algorithm cannot be used when the background changes. The common binarization method has the disadvantage that the extraction target may not be complete. In this paper, some improvements are made to the method to improve extraction precision. By binarizing the X-ray image and using the set threshold to remove the background information, the wrapped image is finally extracted using contour detection [3; 4]. The contour feature extraction method depends on the relationship between the background gray level and the package gray level, which has certain limitations. When the background gray level is between the maximum and minimum gray level of the package, the method cannot work effectively because there is no threshold to separate the background and the package in this scene. [PERSON] [5] used the edge features to extract the contours of moving objects. [PERSON] et al.