X-ray security check image hazardous article segmentation and detection system based on improved YOLOv8
By improving the YOLOv8 model and combining SPD-Conv technology, the problem that traditional X-ray security technology is difficult to detect small targets and overlapping items in complex backgrounds is solved, achieving higher detection accuracy and efficiency.
Patent Information
- Application Number
- CN202510018070.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-06
- Publication Date
- 2025-05-02
AI Technical Summary
Traditional X-ray security technology is difficult to ensure efficient and accurate segmentation and detection when facing complex backgrounds, items stacking, occlusion or packaging, especially the detection capabilities of small targets and overlapping items are insufficient.
Improve the YOLOv8 model, and enhance the extraction ability of backbone network and neck network features by combining spatial depth conversion convolution (SPD-Conv), and improve the segmentation accuracy of small targets, occluded objects and dangerous goods under complex backgrounds.
It significantly improves the accuracy and efficiency of small and medium-sized object detection of X-ray security images, enhances the ability to detect dangerous goods in complex backgrounds, reduces false alarms and missed reports, and improves the overall performance of the security inspection system.
Smart Images

Figure BDA0005230504390000071 
Figure BDA0005230504390000072 
Figure BDA0005230504390000081
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of target detection. Background Art
[0002] Baggage security inspection is an important security inspection measure, especially in crowded places such as airports, railway stations, and subways. Scanning luggage and parcels through X-ray security inspection machines has become a common security inspection method in public places. The widespread use of X-ray security inspection machines can efficiently scan luggage and parcels, quickly detect possible dangerous items such as explosives and knives, and ensure public safety. X-ray technology collects security inspection images through special equipment, which can clearly show the shape, size and other characteristics of items inside the luggage, helping security inspectors to make accurate judgments. However, in these images, the types, shapes and sizes of items vary greatly, and the appearance of the same item in different packages or angles may also be different, which poses a great challenge to the automation and accuracy of security inspections.
[0003] One of the advantages of X-ray technology is that it can avoid the trouble of opening luggage. This not only protects the privacy of passengers, but also greatly reduces the time and workload of manual inspection, thereby improving the overall efficiency of travel. For passengers, the speed and accuracy of X-ray security inspection means that they do not need to wait in line for a long time, which greatly improves the travel experience. At the same time, with the continuous increase in security inspection needs, the detection capabilities of X-ray security inspection equipment are also facing increasing challenges. In particular, when the items in the luggage are stacked, blocked or packaged in a complex manner, traditional security inspection technology may be difficult to ensure efficient and accurate segmentation and detection.
[0004] To meet this challenge, deep learning-based object detection algorithms are widely used in the optimization of X-ray security inspection systems. These deep learning models can continuously improve the detection accuracy of various objects through training with large amounts of data. Object detection algorithms are mainly divided into two types: two-stage object detection methods and one-stage object detection methods. The two-stage method first locates the object by generating candidate boxes and then classifies the candidate areas. Although this method has high accuracy, it has a slow processing speed and is therefore not suitable for real-time security inspection scenarios. The one-stage method, such as SSD (Single Shot Multi-box Detector) and YOLO (You Only Look Once), directly regresses the location and category of the object, eliminating the process of generating candidate boxes, improving the processing speed, and is more suitable for real-time detection needs.
[0005] Among the one-stage object detection methods, the YOLO architecture has become one of the most popular detection frameworks due to its high efficiency and accuracy. The advantage of YOLO is that it can simultaneously predict the position and category of the object in one forward propagation by treating the object detection problem as a regression problem, which makes YOLO superior to traditional methods in detection speed.
[0006] With the continuous optimization of the YOLO framework, YOLOv8 has shown significant improvements in many fields, especially in the application of security inspection image processing. Through an improved network structure and a more sophisticated feature extraction method, YOLOv8 can maintain high-precision detection in complex backgrounds, especially when facing small objects or overlapping items. This is particularly important for X-ray security inspection systems, because small dangerous items that may exist in luggage or items that are difficult to detect due to stacking and occlusion are often the weak links of traditional security inspection methods.
[0007] Another outstanding feature of YOLOv8 is its adaptability in dynamic scenes, which can quickly process a large number of baggage images in high-traffic transportation hubs. Its excellent speed and high precision can ensure the accuracy of the security inspection process without affecting traffic efficiency, avoiding missed inspections and misjudgments. In addition, YOLOv8 also has strong robustness and can adapt to different types of items, shooting from different angles, and noise and interference in various environments, significantly improving the overall performance of the security inspection system.
[0008] YOLOv8-seg is a segmentation branch of the YOLOv8 model. YOLOv8-seg performs well in multi-target recognition and processing complex backgrounds. It can effectively detect dangerous goods in X-ray security images under complex backgrounds and capture the shape and edge details of objects. Secondly, YOLOv8-seg can perform segmentation at different scales, which is particularly important for dangerous goods detection in X-ray security images, because objects vary in size, and some small objects (such as blades and bullets) are extremely critical in security inspections. Its multi-scale capability ensures that no matter what the size of the object, it can be effectively detected and accurately judged. YOLOv8-seg can provide accurate pixel-level positioning, fine-grained information, fewer false positives and false negatives, enhanced system robustness and better adaptability, and better visualization effects, making segmentation technology more superior in dealing with complex object detection and analysis in X-ray security inspections. Summary of the invention
[0009] The present invention aims to improve the detection capability of small targets in X-ray security inspection images of dangerous goods under complex backgrounds. A system for segmenting and detecting dangerous goods in X-ray security inspection images based on improved YOLOv8 is provided.
[0010] The present invention discloses an X-ray security inspection image dangerous goods segmentation and detection system based on improved YOLOv8, comprising:
[0011] Step 1: Obtain the PIDray dataset of X-ray security images containing dangerous goods, and divide it into a training set and a test set: The training set contains 29,457 images (60%), which are used for model learning and parameter optimization. The test set contains 18,220 images (40%), which are used to evaluate model performance and generalization ability. This division method ensures both sufficient training data and sufficient test samples to verify the effectiveness and generalization ability of the model;
[0012] Step 2: Improve the YOLOv8-seg architecture, optimize the convolutional layers of the backbone network and the neck network, and enhance the ability to extract features of the backbone network and the neck network by combining the Space-to-Depth Convolution (SPD-Conv), thereby improving the segmentation accuracy of small targets, occluded objects, and dangerous goods in complex backgrounds, and enhancing the model's ability to detect dangerous goods in X-ray security inspection images;
[0013] Step 3: Use the training set to train the improved YOLOv8 model (YOLOv8-SPD) to generate a model suitable for dangerous goods detection in X-ray security inspection images, so as to detect potential dangerous goods in X-ray security inspection images;
[0014] Step 4: Use the test set to test the trained YOLOv8-SPD model and evaluate the model performance. Through comprehensive testing of the test set, the model's generalization ability, robustness, and performance in practical applications can be effectively verified.
[0015] Furthermore, in the present invention, in step 1, a PIDray dataset of X-ray security inspection images containing dangerous goods is obtained. The dataset contains 12 types of dangerous goods, including guns, knives, wrenches, pliers, scissors, etc. The dataset is divided into a training set and a test set. The training set and the test set are randomly divided. All images cover these 12 types of dangerous goods, which can help the model effectively deal with diverse situations in actual security inspections.
[0016] Training set: contains 29,457 images, accounting for about 60% of the entire data set. These images are used for model learning and parameter optimization, including feature extraction, model training, and hyperparameter adjustment. Through the training set, the model can learn from images how to distinguish normal objects from potential dangerous objects, understand the morphological characteristics of objects, and learn how to accurately segment and detect dangerous objects.
[0017] Test set: contains 18,220 images, accounting for about 40% of the entire data set. The test set is mainly used to evaluate the performance and generalization ability of the trained model. The parameters of the model obtained on the training set can be tested on the test set to ensure that it can accurately detect new data samples. The test set performance test results are crucial to evaluating whether the model has good generalization ability and whether it can adapt to different samples in security inspection sites.
[0018] The test set is further divided into three subsets based on the difficulty of detecting dangerous objects: simple, hard, and hidden. The simple mode refers to images in the test set that contain only one dangerous object; the hard mode contains multiple dangerous objects; and the hidden mode refers to images in which dangerous objects are intentionally hidden.
[0019] The advantage of this data division method is that the ratio of training set to test set can ensure that there are enough samples for training the model so that the model can learn rich features and rules, and provide enough test data to effectively evaluate the performance of the model. Specifically, the training set with more data helps the model to fully learn the diversity of various objects and dangerous goods, while the test set with more data ensures that the evaluation process will not cause inaccurate or biased evaluation results due to too few samples.
[0020] Therefore, a reasonable division ratio can maintain a balance between training and testing, thereby improving the practical application effect and robustness of the model.
[0021] Furthermore, in the present invention, in step 2, the YOLOv8-seg architecture is improved, the convolutional layers of the backbone network and the neck network are optimized, and the ability to extract features of the backbone network and the neck network is enhanced by combining SPD-Conv, thereby improving the segmentation accuracy of small targets, occluded objects and dangerous goods under complex backgrounds, and improving the model's ability to detect dangerous goods in X-ray security inspection images, specifically:
[0022] The SPD-Conv module includes a multi-scale feature extraction module designed with piecewise convolution, which uses multiple parallel piecewise convolutional layers to capture rich contextual information with different receptive fields. Each piecewise convolutional layer contains several sub-convolutional blocks, where the convolution kernel size and step size of each sub-block are carefully adjusted according to the target size, allowing the network to flexibly cope with targets of different scales. In this way, the extracted multi-scale features are fused, making the network more robust in detecting small targets.
[0023] The SPD-Conv module converts the feature map from space to depth, reduces the size of the feature map by half, increases the number of channels by 4 times, and makes the model pay more attention to small targets, thereby improving the detection accuracy and efficiency of the model. The SPD-Conv module plays an especially important role in the detection of dangerous goods in security inspection images, because it can efficiently process complex image information and enhance the segmentation and detection capabilities of overlapping targets and small targets in complex backgrounds.
[0024] The network structure of YOLOv8-seg combined with SPD-Conv plays a key role in improving the performance of small target detection in X-ray security inspection images. This combination takes advantage of the powerful capabilities of YOLOv8-seg in target segmentation and detection, and at the same time, through the sparse convolution characteristics of SPD-Conv, it enhances the recognition and processing capabilities of small targets in X-ray security inspection images, and reduces the amount of calculation and memory usage, which enables faster calculations when processing high-resolution images or large-scale data. And due to its sparse characteristics, SPD-Conv can effectively suppress noise and improve image quality when processing images. This network structure can more effectively identify potential dangerous goods and improve the accuracy and efficiency of security inspections.
[0025] Furthermore, in the present invention, in step 3, the improved YOLOv8 model (YOLOv8-SPD) is trained using the training set to generate a model suitable for dangerous goods detection in X-ray security inspection images:
[0026] 1. Modify the cfg file of YOLOv8, including changing the classes in the yaml file of the data to the number of categories in the dataset.
[0027] 2. Set the hyperparameters of the network model, including the input image size, batch size, number of training rounds, and learning rate for training data sets and testing model performance.
[0028] Furthermore, in the present invention, in step 4, the trained YOLOv8-SPD model is tested using a test set to evaluate the model performance. Specifically:
[0029] After the test set is input into the YOLOv8-SPD model, the model will segment each image and output information about the detected potentially dangerous items, including the category, location, and confidence level of the items. We will then compare the model's predictions with the true labels of the images in the test set and calculate key performance indicators such as accuracy, recall, and F1 score.
[0030] This comprehensive evaluation method can not only measure the overall performance of the model, but also reveal its strengths and weaknesses when detecting different types of dangerous goods. Through a detailed analysis of the test results, we can deeply understand the application effect of the YOLOv8-SPD model in actual scenarios and provide some technical support for subsequent optimization and deployment. Such a systematic verification process will help us objectively evaluate the actual performance of the model and ensure its stability and effectiveness in security inspection work. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 It is a flow chart of the X-ray security inspection image dangerous goods segmentation and detection system method of the method YOLOv8-SPD of the present invention.
[0032] Figure 2 It is a schematic diagram of the network structure of X-ray security inspection image dangerous goods segmentation and detection of the method YOLOv8-SPD of the present invention.
[0033] Figure 3 It is a data distribution diagram of the PIDRay data set used in the method of the present invention.
[0034] Figure 4 It is a schematic diagram of the principle of SPD-Conv in the method of the present invention.
[0035] Figure 5 It is a comparison chart of mAP between YOLOv8-SPD and YOLOv8n in the method of the present invention.
[0036] Figure 6 It is a training index result diagram of YOLOv8-SPD on the training set in the method of the present invention.
[0037] Figure 7 It is the performance index curve of YOLOv8-SPD on the training set in the method of the present invention.
[0038] Figure 8 It is a visualization detection result diagram of YOLOv8-SPD on the test set in the method of the present invention. DETAILED DESCRIPTION
[0039] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0040] The X-ray security inspection image dangerous goods segmentation and detection system based on improved YOLOv8 in this specific implementation method is as follows: Figure 1 As shown, the improved YOLOv8-SPD network structure is as follows Figure 2 As shown, the following steps are included:
[0041] Step a: Obtain the PIDray dataset of X-ray security images containing dangerous goods. The dataset contains 12 types of dangerous goods in 47,677 X-ray images, including guns, knives, wrenches, pliers, scissors, etc. Table 1 shows the category quantity distribution of the PIDRay dataset. The dataset is divided into a training set and a test set. The training set and the test set are randomly divided. All images cover these 12 types of dangerous goods, which can help the model effectively deal with the diverse situations in actual security inspections.
[0042] Training set: contains 29,457 images, accounting for about 60% of the entire data set. These images are used for model learning and parameter optimization, including feature extraction, model training, and hyperparameter adjustment. Through the training set, the model can learn from images how to distinguish normal objects from potential dangerous objects, understand the morphological characteristics of objects, and learn how to accurately segment and detect dangerous objects.
[0043] Test set: contains 18,220 images, accounting for about 40% of the entire data set. The test set is mainly used to evaluate the performance and generalization ability of the trained model. The parameters of the model obtained on the training set can be tested on the test set to ensure that it can accurately detect new data samples. The test set performance test results are crucial to evaluating whether the model has good generalization ability and whether it can adapt to different samples in security inspection sites.
[0044] The test set is further divided into three subsets based on the difficulty of detecting dangerous objects: simple, hard, and hidden. The simple mode refers to images in the test set that contain only one dangerous object; the hard mode contains multiple dangerous objects; and the hidden mode refers to images in which dangerous objects are intentionally hidden.
[0045] The advantage of this data division method is that the ratio of training set to test set can ensure that there are enough samples for training the model so that the model can learn rich features and rules, and provide enough test data to effectively evaluate the performance of the model. Specifically, the training set with more data helps the model to fully learn the diversity of various objects and dangerous goods, while the test set with more data ensures that the evaluation process will not cause inaccurate or biased evaluation results due to too few samples.
[0046] Table 1 Distribution of the number of categories in the PIDRay dataset
[0047] category quantity baton 2399 pliers 6814 hammer 6229 Power Bank 8116 Scissors 7060 wrench 6437 firearms 3757 bullet 2957 sprayer 4227 Handcuffs 3388 Knives 5549 lighter 6157
[0048] Therefore, a reasonable division ratio can maintain a balance between training and testing, thereby improving the practical application effect and robustness of the model. The actual annotation box size information of the experimental training data set is as follows: Figure 3As shown, it can be seen that most of the dangerous goods in the data set are small targets, and the present invention mainly detects small target dangerous goods.
[0049] Step b, improve the YOLOv8-seg architecture, optimize the convolutional layers of the backbone network and the neck network, and enhance the ability to extract features of the backbone network and the neck network by combining SPD-Conv, thereby improving the segmentation accuracy of small targets, occluded objects and dangerous goods in complex backgrounds, and enhancing the model's ability to detect dangerous goods in X-ray security inspection images.
[0050] The YOLOv8-seg algorithm is based on the YOLOv8 target detection algorithm. Its network structure mainly includes the following parts:
[0051] Backbone network: CSPDarknet53 is used as the backbone network to extract image features. The CSPDarknet53 network structure is lightweight and efficient, which can reduce the amount of calculation while ensuring accuracy.
[0052] Neck network: Path Aggregation Network (PANet) is used as the Neck network, which is responsible for fusing feature maps of different scales. PANet connects feature maps of different scales through top-down and bottom-up paths, enhancing the semantic and spatial information of the features.
[0053] Both the backbone network and the neck network use SPD-Conv for feature extraction.
[0054] Segmentation head: FPN+U-Net is used as the segmentation head, which is responsible for converting the fused feature map into a segmentation mask. The Feature Pyramid Network (FPN) is responsible for generating feature maps of different scales, and U-Net is responsible for fusing and upsampling feature maps of different scales to finally generate a segmentation mask.
[0055] The SPD-Conv module converts the feature map from space to depth, reduces the size of the feature map by half, increases the number of channels by 4 times, and makes the model pay more attention to small targets, thereby improving the detection accuracy and efficiency of the model. The SPD-Conv module plays an especially important role in the detection of dangerous goods in security inspection images, because it can efficiently process complex image information and enhance the segmentation and detection capabilities of overlapping targets and small targets in complex backgrounds.
[0056] The network structure of YOLOv8-seg combined with SPD-Conv plays a key role in improving the performance of small target detection in X-ray security inspection images. This combination takes advantage of the powerful capabilities of YOLOv8-seg in target segmentation and detection, and at the same time, through the sparse convolution characteristics of SPD-Conv, it enhances the recognition and processing capabilities of small targets in X-ray security inspection images, and significantly reduces the amount of calculation and memory usage, which enables faster calculations when processing high-resolution images or large-scale data. And due to its sparse characteristics, SPD-Conv can effectively suppress noise and improve image quality when processing images. This network structure can more effectively identify potential dangerous goods and improve the accuracy and efficiency of security inspections.
[0057] SPD structure Figure 4 As shown in Figure 2, SPD generalizes the original image conversion technology to the downsampling process of the feature maps inside and throughout the CNN, and slices the given intermediate feature map Y of arbitrary size S×S×C, that is, the obtained sub-feature map p x,y Y is downsampled by ratio, and then all sub-feature maps are concatenated by channel to obtain a new feature map Y′. The feature map has the following transformations:
[0058]
[0059] The feature map is sliced as follows:
[0060] p x,y =Y[x:S:ratio,y:S:ratio] (2)
[0061] After the SPD layer, add a non-strided (i.e., stride = 1) convolutional layer with a C1 convolution kernel, where C1 <ratio 2 C, the intermediate feature map is transformed as follows:
[0062]
[0063] The reason for using non-strided convolution is to retain discriminative feature information as much as possible. Because strided convolution will lead to non-discriminative loss of information, for example, when stride = 2, asymmetric sampling will occur, where the number of sampling times of even and odd rows (columns) is different.
[0064] Step c: Use the training set to train the improved YOLOv8-SPD model to generate a model suitable for dangerous goods detection in X-ray security inspection images.
[0065] Step c1: Use the training set to train the improved YOLOv8-SPD model to generate a model suitable for dangerous goods detection in X-ray security inspection images:
[0066] 1. Modify the cfg file of YOLOv8 and change the classes in the yaml file of the data to the number of categories in the dataset.
[0067] 2. Set the hyperparameters of the network model, including the input image size of 640×640 for training the dataset and testing the model performance, the input data size per batch (batch_size) of 32, the number of training rounds (epochs) of 300, and the learning rate of 0.01.
[0068] Step c2: The present invention uses the evaluation system in the target detection method to evaluate the model, including the precision AP, recall rate (Recall), F1-score, accuracy (Precision) and average accuracy mean mAP@0.5 (meanaverageprecision, IoU threshold is 0.5) of each category. The calculation formula is as follows:
[0069]
[0070] TP represents the number of correctly identified positive samples, TN represents the number of correctly identified negative samples, FP represents the number of negative samples that are incorrectly identified as positive samples, and FN represents the number of positive samples that are incorrectly identified as negative samples. The F1 score can be further calculated using the precision and recall rates. TP refers to the correctly identified positive samples, f TF is a correctly identified negative sample, f TN The average precision (AP) of each target category can be calculated by the area enclosed by the curve (PR curve) composed of the precision rate and the recall rate and the coordinate axis.
[0071] Step c3: Since the purpose of the improved model proposed in the present invention is to improve the target detection capability of the YOLOv8 algorithm, the main indicator for evaluating the model performance is mAP@0.5. Therefore, the average accuracy of the YOLOv8 model and the YOLOv8-SPD proposed in the present invention on the PIDRay data set is compared, which shows that the improved model has a higher detection accuracy. Figure 5 shown.
[0072] Step c4: Use the training set to train the YOLOv8-SPD model. The training results are as follows: Figure 6 and Figure 7As shown in the figure, val_box represents the boundingbox of the validation set. As the number of training rounds increases to 200, its value becomes smaller and smaller and finally stabilizes. val_dfl represents the mean loss of the validation set. After the number of training rounds reaches 200, the mean loss tends to be stable. val_cls represents the mean classification loss of the validation set. After the number of training rounds reaches 150, the mean loss basically converges. Precision represents the percentage of the correct positive class in the validation set to all positive classes. When the number of training rounds reaches 250, the Precision value is basically stable. Recall describes how many real positive examples are recalled by the binary classifier from the perspective of real results. After the number of training rounds reaches 200, the recall rate gradually converges.
[0073] Step d: Use the test set to test the trained YOLOv8-SPD model.
[0074] Step d1: Use the test set to test the trained YOLOv8-SPD model to evaluate the model performance.
[0075] Step d2 and Table 2 show the comparison results of the detection performance of the method proposed in the present invention with mainstream target detection algorithms such as YOLOv5n and YOLOv8n. It can be clearly seen from the comparison that the present invention exhibits higher detection accuracy and stronger robustness, surpassing the existing mainstream algorithms, and the present invention has achieved the highest detection accuracy for eight types of dangerous goods in the data set.
[0076] Table 2 Comparison of the accuracy of different detection methods on the PIDRay dataset
[0077]
[0078] The detection effect of the YOLOv8-SPD model proposed in this invention on the test set is as follows Figure 8 As shown, it can be seen that the YOLOv8-SPD model can accurately detect dangerous goods in X-ray security inspection images.
[0079] Although the present invention has been described in terms of specific embodiments, it should be noted that these examples are intended only to illustrate the principles and applications of the present invention. Therefore, these embodiments may be modified in many ways and other arrangements may be designed without departing from the core and scope of the present invention as defined in the appended claims. In addition, multiple dependent claims and features of the present invention may be combined in a manner different from the original claims. At the same time, features in one embodiment may also be used in combination with other embodiments.
Claims
1. A dangerous goods segmentation and detection system for X-ray security inspection images based on improved YOLOv8, characterized in that: The following steps are involved: Step 1: Obtain the PIDray dataset of X-ray security images containing dangerous goods, and divide it into a training set and a test set: The training set contains 29,457 images (60%), which are used for model learning and parameter optimization. The test set contains 18,220 images (40%), which are used to evaluate model performance and generalization ability. This division method ensures both sufficient training data and sufficient test samples to verify the effectiveness and generalization ability of the model; Step 2: Improve the YOLOv8-seg architecture, optimize the convolutional layers of the backbone network and the neck network, and enhance the ability to extract features of the backbone network and the neck network by combining the Space-to-Depth Convolution (SPD-Conv), thereby improving the segmentation accuracy of small targets, occluded objects, and dangerous goods in complex backgrounds, and enhancing the model's ability to detect dangerous goods in X-ray security inspection images; Step 3: Use the training set to train the improved YOLOv8 model (YOLOv8-SPD) to generate a model suitable for dangerous goods detection in X-ray security inspection images, so as to detect potential dangerous goods in X-ray security inspection images; Step 4: Use the test set to test the trained YOLOv8-SPD model and evaluate the model performance. Through comprehensive testing of the test set, the model's generalization ability, robustness, and performance in practical applications can be effectively verified.
2. A dangerous goods segmentation and detection system for X-ray security inspection images based on improved YOLOv8, characterized in that: The specific operations for obtaining the X-ray security inspection image dataset in step 1 are as follows: Obtain the PIDray dataset of X-ray security images containing dangerous goods. This dataset contains 12 categories of dangerous goods, including guns, knives, wrenches, pliers, scissors, etc. The dataset is divided into a training set and a test set. The training set and the test set are randomly divided. All images cover these 12 categories of dangerous goods, which can help the model effectively deal with the diverse situations in actual security inspections. Training set: contains 29,457 images, accounting for about 60% of the entire data set. These images are used for model learning and parameter optimization, including feature extraction, model training, and hyperparameter adjustment. Through the training set, the model can learn from images how to distinguish normal objects from potential dangerous objects, understand the morphological characteristics of objects, and learn how to accurately segment and detect dangerous objects. Test set: contains 18,220 images, accounting for about 40% of the entire data set. The test set is mainly used to evaluate the performance and generalization ability of the trained model. The parameters of the model obtained on the training set can be tested on the test set to ensure that it can accurately detect new data samples. The test set performance test results are crucial to evaluating whether the model has good generalization ability and whether it can adapt to different samples in security inspection sites. The test set is further divided into three subsets based on the difficulty of detecting dangerous objects: simple, hard, and hidden. The simple mode refers to images in the test set that contain only one dangerous object; the hard mode contains multiple dangerous objects; and the hidden mode refers to images in which dangerous objects are intentionally hidden. The advantage of this data division method is that the ratio of training set to test set can ensure that there are enough samples for training the model so that the model can learn rich features and rules, and provide enough test data to effectively evaluate the performance of the model. Specifically, the training set with more data helps the model to fully learn the diversity of various objects and dangerous goods, while the test set with more data ensures that the evaluation process will not cause inaccurate or biased evaluation results due to too few samples. Therefore, a reasonable division ratio can maintain a balance between training and testing, thereby improving the practical application effect and robustness of the model.
3. A dangerous goods segmentation and detection system for X-ray security inspection images based on improved YOLOv8, characterized in that: In step 2, the YOLOv8-seg architecture is improved, the convolution layers of the backbone network and the neck network are optimized, and the ability to extract features of the backbone network and the neck network is enhanced by combining the space-to-depth convolution (SPD-Conv), thereby improving the segmentation accuracy of small targets, occluded objects and dangerous goods in complex backgrounds, and improving the model's ability to detect dangerous goods in X-ray security inspection images. Specifically: YOLOv8 is mainly composed of three parts: Backbone, Neck, and Head. Both the backbone network Backbone and the neck network Neck use SPD-Conv for feature extraction. The SPD-Conv module converts the feature map from space to depth, reduces the size of the feature map by half, increases the number of channels by 4 times, and makes the model pay more attention to small targets, thereby improving the detection accuracy and efficiency of the model. The SPD-Conv module plays an especially important role in the detection of dangerous goods in security inspection images, because it can efficiently process complex image information and enhance the segmentation and detection capabilities of overlapping targets and small targets in complex backgrounds. SPD extends the original image conversion technology to the downsampling process of the feature map inside and throughout the CNN, and slices the given intermediate feature map Y of any size S×S×C, that is, the obtained sub-feature map p x,y Y is downsampled by ratio, and then all sub-feature maps are concatenated by channel to obtain a new feature map Y′. The feature map has the following transformations: The feature map is sliced as follows: p x,y =X[x:S:ratio,y:S:ratio] (2) After the SPD layer, add a non-strided (i.e., stride = 1) convolutional layer with a C1 convolution kernel, where C1 <ratio 2 C, the intermediate feature map is transformed as follows: The reason for using non-strided convolution is to retain discriminative feature information as much as possible. Because strided convolution will lead to non-discriminative loss of information, for example, when stride = 2, asymmetric sampling will occur, where the number of sampling times of even and odd rows (columns) is different.
4. A dangerous goods segmentation and detection system for X-ray security inspection images based on improved YOLOv8, characterized in that: In step 3, adjust the model configuration file and set the hyperparameters. The specific steps are as follows: The image input size is 640×640, the batch size is 32, the training epochs are 300, and the learning rate is 0.
01. By adjusting the hyperparameters and optimizing the configuration of the YOLOv8 model, as well as using a standard evaluation system, we can comprehensively evaluate the performance of YOLOv8-SPD in the detection of dangerous goods in X-ray security inspection images. In the experiment, reasonable hyperparameter settings (such as image input size, batch size, training rounds, and learning rate) significantly improved the detection accuracy and efficiency of the model. Evaluation indicators such as recall, F1-score, precision, and mean average precision mAP@0.5 (mean average precision, IoU threshold is 0.5) provide a scientific basis for improving model performance.
5. A dangerous goods segmentation and detection system for X-ray security inspection images based on improved YOLOv8, characterized in that: In step 4, the trained YOLOv8-SPD model is tested using the test set to evaluate the model performance. The specific steps are as follows: The method proposed in the present invention is compared with mainstream detection algorithms such as YOLOv5n and YOLOv8n on the PIDray dataset, which shows that the YOLOv8-SPD model has achieved a significant improvement in detection accuracy compared with other mainstream algorithms, proving the effectiveness and superiority of the present invention in dangerous goods detection in X-ray security inspection images.
Citation Information
Cited By
Target detection method and device, equipment and medium
CN120876832A