Dangerous article identification and detection system based on intelligent AI algorithm

By improving the YOLOv8s algorithm, combined with EMA attention, deformable convolution DCNv2 and improved pigeon flock algorithm, the existing security inspection system has solved the problem of insufficient detection accuracy and efficiency in overlapping occlusion, size change and anchor frame setting, and achieved high-precision and high-efficiency detection of contraband.

CN119863655APending Publication Date: 2025-04-22SUZHOU CANCRIEAS AVIAVTION TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411921269.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-25
Publication Date
2025-04-22

AI Technical Summary

Technical Problem

When existing intelligent security inspection systems face problems such as overlapping occlusion, large changes in size and shape of contraband, and relying on manual marking for anchor frame settings, it is difficult to achieve high-precision and efficient contraband detection.

Method used

Using the improved YOLOv8s algorithm, the feature extraction and learning rate adjustment of the model are optimized to improve detection accuracy and efficiency by adding EMA attention, deformable convolution DCNv2 and improved pigeon flock algorithm.

Benefits of technology

It realizes automatic alarm reminding security inspectors when contraband is detected, improves the detection accuracy of dangerous items, reduces the false detection rate, and improves the work efficiency of security inspectors and the waiting time of passengers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119863655A_ABST
    Figure CN119863655A_ABST
Patent Text Reader

Abstract

The invention relates to a dangerous goods identification and detection system based on an intelligent AI algorithm. The system comprises an environment required for deploying YOLOv8s development training; the attention of the EMA is added to a check layer of a YOLOv8s algorithm; a deformable convolution DCNv2 is added to the backbone part of the YOLOv8s, and the deformable convolution DCNv2 is added to the backbone part of the YOLOv8s; an improved pigeon inspired algorithm is introduced to automatically update and adjust the learning rate, and finally the final detection precision of the improved model is improved on the hyper-parameter optimization level; carrying out an experiment on the improved YOLOv8s model, and carrying out comparative analysis on the improved YOLOv8s model and an experiment result obtained by an original YOLOv8s algorithm; an improved YOLOv8s model is deployed on a PyQt5 platform, a visual interface is constructed, and early warning can be achieved while prohibited goods are detected. The system can automatically give an alarm to remind security inspectors while detecting contraband goods, and can assist the security inspectors in daily work, so that the detection precision of the security inspectors on dangerous goods is improved, the false detection rate is reduced, the working efficiency of the security inspectors is improved, and the waiting time of passengers is greatly shortened.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of security inspection technology, and in particular to a dangerous goods identification and detection system based on an intelligent AI algorithm. Background Art

[0002] With the rapid development of public transportation and the transportation industry, more and more people are choosing to travel by various means of transportation, and security inspection is the first line of defense to ensure the safety of people's travel. For example, in the field of civil aviation, most of the causes of frequent aviation accidents are unsafe behaviors of passengers. In order to maximize the personal safety of passengers, airports have set up extremely strict security inspection procedures. At present, X-ray technology is a widely used security inspection technology. X-ray security inspection equipment is used in public places such as airports and high-speed rail stations because of its advantages such as low cost, high recognition and non-destructive testing. The images obtained by X-ray scanning are visually inspected by trained manual inspectors to ensure that there is no danger. During peak hours, sometimes there are only a few seconds to determine whether a piece of luggage contains dangerous goods. Since each security inspector has to check a large amount of luggage, and contraband is easily blocked by other items, which brings certain difficulties to manual identification, the detection results are sometimes affected by the inspector's fatigue and recognition experience, which ultimately leads to missed detection and false detection. Therefore, it is particularly important to design an intelligent, efficient and accurate detection and recognition algorithm to ensure the safety of public travel.

[0003] Traditional target detection algorithms have made many contributions to the classification and identification of prohibited items in security inspections. The currently commonly used method is to extract packages based on the image features of the package using the contour detection algorithm. Common package image features include grayscale features and edge features. For example: use the edge detection algorithm to extract the golden area of ​​the image; use edge features to extract the contour of the moving target; use a new detection and classification method to decompose the X-ray scanned image using Contourlet transform, and extract the decomposed co-occurrence matrix, Tamura texture features and histogram features, and finally connect the feature vectors of these three features in series to obtain a joint feature vector; use computer vision-based X-ray image foreign body classification research, the algorithm mainly uses Tamura texture features and random forests to automatically identify and classify prohibited objects in X-rays.

[0004] In recent years, with the rapid development of deep learning methods, convolutional neural networks (CNNs) have been widely used in image processing and analysis. Many computer vision tasks have made great progress and achieved the most advanced and efficient detection performance, such as face recognition, behavior recognition, medical image processing, and autonomous driving. At the same time, researchers have also turned their attention to the field of X-ray security inspection and contraband detection. Prior to this, the main method for image recognition and classification was the bag of visual words (BoVW) model, which extracts visual vocabulary through feature descriptors; clusters features through the k-means algorithm and merges visual vocabulary with similar meanings; and creates a vocabulary through classification using RF, SVM, or sparse representation. Applying the standard BoVW method to the classification and detection of X-ray images can improve performance. A researcher evaluated the X-ray contraband detection method based on the visual word bag model, sparse representation, deep learning and classic pattern recognition schemes, and found that the method based on deep learning was the best; secondly, an improved dilated convolution was added to the YOLOv4 algorithm, and multi-scale aggregated context information was used, and finally the candidate box was optimized by the K-means clustering algorithm, which ultimately improved the detection accuracy; an improved YOLOv5 X-ray contraband detection model was applied. Based on the YOLOv5 algorithm, the model introduced the attention mechanism, border fusion and data enhancement strategies to improve the detection accuracy. Since the volume of contraband is smaller than that of a suitcase, and the ordinary network model has a weak detection ability for small targets, it is easy to cause missed detection and false detection.

[0005] In summary, the current intelligent security inspection technology has made effective progress, but the following problems still exist: (1) In the case of serious overlapping occlusion, it is easy to cause confusion between the target to be inspected and the background. When the image is passed into the network and the features are extracted through the convolution layer, similar feedback will be obtained, resulting in reduced recognition and detection accuracy of contraband. (2) The size and shape of different contraband vary greatly, and ordinary convolution cannot adapt to the receptive field of the actual detection target because the sampling position is fixed, which in turn affects the feature extraction ability of the model and ultimately causes missed detection. (3) The setting of the anchor frame depends on manual labeling, resulting in the initial value of the anchor frame. The generalization ability is not strong, and the detection accuracy of small samples and small targets is not high, which affects the final detection accuracy of the model. Therefore, it is particularly important to design an intelligent AI security inspection system that can recognize small samples, overcome the problems of overlapping occlusion of multiple objects, and achieve high precision and high efficiency. Summary of the invention

[0006] The purpose of the present invention is to overcome the problems existing in the prior art, and to provide a dangerous goods identification and detection system based on an intelligent AI algorithm, based on an improved YOLOv8s algorithm, and to build a system for automatic detection of prohibited items, which can automatically alarm and remind security inspectors when prohibited items are detected, and can assist them in their daily work, thereby improving their detection accuracy of dangerous goods and reducing the false detection rate, while greatly improving the work efficiency of security inspectors, reducing their workload, and the waiting time of passengers.

[0007] In order to achieve the above technical objectives and the above technical effects, the present invention is implemented through the following technical solutions:

[0008] A dangerous goods identification and detection system based on intelligent AI algorithm, the system consists of the following steps:

[0009] Step S1: Deploy the environment required for YOLOv8s development and training, and select the YOLOv8s model as the detection head;

[0010] Step S2: Add EMA attention to the neck layer of the YOLOv8s algorithm to fully integrate features of different scales;

[0011] Step S3: Add deformable convolution DCNv2 to the backbone network of YOLOv8s to extract features at different levels, and fuse and integrate features at different levels to obtain more comprehensive and accurate image features of contraband;

[0012] Step S4: Introduce the improved pigeon flock algorithm to automatically update and adjust the learning rate, and ultimately improve the final detection accuracy of the improved model at the hyperparameter optimization level;

[0013] Step S5: Conduct experiments on the improved YOLOv8s model, including training and reasoning, and compare and analyze the experimental results obtained with those of the original YOLOv8s algorithm;

[0014] Step S6: Deploy the improved YOLOv8s model on the PyQt5 platform and build a visual interface to achieve simultaneous early warning when prohibited items are detected, remind security inspectors in real time, and automatically save the detection video locally for review.

[0015] Furthermore, in step S3, in the deformable convolution DCNv2, the output eigenvalue y(p 0 ) is defined as follows:

[0016] Where R = {(-1,-1), (-1,0), ..., (0,1), (1,1)}, is the receptive field area, w(p n ) is the sampling position pn The convolution kernel weight value at , p n is the position element in R, that is, all sampling positions in the receptive field, △p n represents the learnable offset added by the standard convolution at the sampling point, {△p n |n=1,2,2,N},N=|R|,p=p 0 +p n +△p n Represents any position in the region, introducing the weight coefficient △m n (0≤△m n ≤1), the modulation mechanism is used to adjust the amplitude of the input features at different positions, and the weight at each sampling point is learned to suppress irrelevant background information and reduce the interference of irrelevant factors.

[0017] Furthermore, in step S3, the second, third, and fourth C2f modules of the backbone network backbone are replaced with deformable convolution modules C2f_DCN to improve the model's focus on small and medium-sized targets, laying the foundation for subsequent feature fusion.

[0018] Furthermore, in step S4, the pigeon flock algorithm PIO is composed of two operators: a compass and map operator and a landmark operator; in the pigeon flock optimization model, the position and speed of the pigeon flock are initialized according to the map and compass operators, and during the search process, the position and speed of the pigeon flock are updated in each iteration; wherein the speed and position are respectively recorded as:

[0019] X i (t) = X i (t-1)+V i (t)

[0020] V i (t) = V i (t-1)·e -Rt +rand·(X gbest -X i (t-1))

[0021] In the above formula, R is the compass and map operator, rand is used to generate a random number between 0 and 1; X gbest is the best global position after the t-1th iteration cycle, V i (t) is the current speed of the pigeon at the tth time, X i (t) is the current position of the i-th pigeon in the t-th iteration;

[0022] For the landmark operator, the number of pigeons will be halved in each generation, using N p To represent the number of pigeons in each generation, use X c(t) represents the center position of the remaining pigeons. The pigeons close to the destination are landmarks and used as reference directions for flight, based on the following formula:

[0023]

[0024] Among them, N p (t) represents the number of pigeons in the tth generation, and the fitness value is fitness(X i (t)) indicates that the fitness value of each pigeon is evaluated and arranged to find the optimal path, and the following formula is used to update the position of the pigeon group:

[0025] X i (t) = X i (t-1)+rand·(X c (t)-X i (t-1))

[0026] For each individual in the population:

[0027] X i,t =(x 1i,t ,x 2i,t ,2,x ni,t )

[0028] The mutation operation is the core operation of the evolutionary operator. Its main purpose is to generate an intermediate individual through the mutation mechanism. Its mutation equation is:

[0029] W i,t+1 =ηX r1,t +(1-η)·F·(X r2,t -X r3,t )

[0030]

[0031] F=F 0 ×2 ω

[0032] W i,t+1 =(w 1i,t+1 ,w 2i,t+1 ,2,w ni,t+1 )

[0033] In the formula, the intermediate individual produced by the mutation of the i-th individual in the t-th generation, r 1 , r 2 , r 3 Different from each other, they are taken from [1,N p ], F is a constant between 0 and 1, and is represented by F 0 Determined together with ω, it is usually called a mutation factor or scaling factor, and η is a mutation weight parameter used to expand the search capabilities in local and global scopes;

[0034] In order to increase the diversity of the interference parameter vector, a crossover operation is introduced, and the experimental variables become:

[0035] U i,t+1 =(u 1i,t+1 ,u 2i,t+1 ,2,u ni,t+1 )

[0036]

[0037] (i=1,2,2,N p ; j = 1, 2, 2, n)

[0038] CR represents the crossover probability operator between 0 and 1, which determines the probability that the mutated individual component value replaces the current individual score. rand(j) is a uniformly distributed random number between 0 and 1. rnbi(i) is a random integer between 1 and n to ensure that the candidate individual obtains at least one component value from the mutation vector.

[0039] Based on the above improved strategy, an adaptive differential mutation crossover operator is introduced, which can adjust the position of pigeons by randomly selecting individuals in the pigeon flock to improve the global and local search capabilities of the algorithm and enhance the diversity of the population;

[0040] The pigeon flock optimization algorithm improved by the mutation crossover operator has the following compass and map operators:

[0041] X i (t) = X i (t-1)+V i (t)+W i

[0042] The landmark operator is:

[0043] X i (t) = X i (t-1)+rand·(X c (t)-X i (t-1))+W i

[0044] Among them, W i It is an improved adaptive mutation crossover operator;

[0045] The above-mentioned pigeon colony optimization algorithm based on the crossover mutation operator is used for iterative search to obtain the global optimal candidate solution and the corresponding optimal fitness value, that is, the optimal learning rate and the optimal detection accuracy mAP.

[0046] Furthermore, in step S5, the collected images are selected, classified, and labeled to create several data sets containing prohibited items to be detected. The data sets contain various common types of prohibited items. According to the construction principle of the training set, the validation set, and the test set, the data sets are divided in a ratio of 7:1.5:1.5, and several rounds of training are performed using the corresponding training environment. The SGD optimizer is used in the model to iteratively update parameters and dynamically adjust the learning rate so that the loss function can converge better.

[0047] The beneficial effects of the present invention are:

[0048] The system of the present invention is based on the improved YOLOv8 s algorithm, and has built a system for automatic detection of prohibited items. It can automatically alarm and remind security inspectors when prohibited items are detected, which can assist them in their daily work, thereby improving their detection accuracy of dangerous goods and reducing the false detection rate. At the same time, it greatly improves the work efficiency of security inspectors, reduces their workload, and the waiting time of passengers. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 It is a network structure diagram of the YOLOv8s algorithm of the present invention;

[0050] Figure 2 It is a structural diagram of the EMA attention of the present invention;

[0051] Figure 3 This is a structural diagram of the 3×3 deformable convolution DCNv2 of the present invention;

[0052] Figure 4 This is a structural diagram of the improved YOLOv8 s model of the present invention;

[0053] Figure 5 The present invention is a flow chart of optimizing learning rate based on improved pigeon algorithm;

[0054] Figure 6 It is an outer loop evolution curve diagram of the improved pigeon flock optimization algorithm in the embodiment of the present invention;

[0055] Figure 7 This is an interface diagram of a baggage contraband detection system in an embodiment of the present invention;

[0056] Figure 8 This is a diagram of an interface in which contraband is detected in an embodiment of the present invention;

[0057] Fig. 9 FIG2 is a second interface of detecting contraband in an embodiment of the present invention;

[0058] Fig.10 Figure 3 is an interface of detecting contraband in an embodiment of the present invention;

[0059] Fig.11 Figure 4 is an interface for detecting contraband in an embodiment of the present invention;

[0060] Fig.12 This is an interface diagram of an embodiment of the present invention in which no contraband is detected;

[0061] Fig.13 This is a test result saving interface diagram in an embodiment of the present invention;

[0062] Fig.14 Schematic diagram of file information saved locally in an embodiment of the present invention. DETAILED DESCRIPTION

[0063] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments.

[0064] A dangerous goods identification and detection system based on intelligent AI algorithm, the system consists of the following steps:

[0065] Step S1: Deploy the environment required for YOLOv8s development and training. YOLOv8 networks can be divided into YOLOv8n, YOLOv8s, YOLOv8m, YOLOv8l and YOLOv8x according to the model parameters from small to large. Considering the real-time detection and detection accuracy of prohibited items in security baggage and the size of items, the YOLOv8s model is selected as the detection head. The network structure of YOLOv8s mainly consists of four parts: the input layer, the backbone network backbone layer, the feature enhancement module Neck layer, and the output Head layer. The specific network structure of the YOLOv8s algorithm is as follows: Figure 1 shown.

[0066] Step S2: Add EMA attention to the neck layer of the YOLOv8s algorithm to fully integrate features of different scales; EMA uses three paths to extract the attention weight descriptor of the grouped feature map; two parallel routes are located in the 1×1 branch, and the third route is located in the 3×3 branch; in order to capture the dependencies between all channels and reduce the amount of computation, two 1D global average pooling operations are used in the 1×1 branch to encode the channels along two spatial directions respectively, while only a single 3×3 kernel is stacked in the 3×3 branch to capture multi-scale feature representations; the structure of EMA is as follows Figure 2 As shown in the figure; in the YOLOv8 network, the Neck end plays an important connecting role because it is between the backbone network and the prediction output head. Due to the special bottom-up and top-down structure of the neck end, features of different scales are fully integrated here, laying the foundation for subsequent predictions. Therefore, the network structure of the neck end can greatly affect the performance of the algorithm, so EMA is added to this position.

[0067] Step S3: Add deformable convolution DCNv2 to the backbone network of YOLOv8s to extract features at different levels, and fuse and integrate features at different levels to obtain more comprehensive and accurate image features of contraband;

[0068] Step S4: Introduce the improved pigeon flock algorithm to automatically update and adjust the learning rate, and ultimately improve the final detection accuracy of the improved model at the hyperparameter optimization level;

[0069] Step S5: Conduct experiments on the improved YOLOv8s model, including training and reasoning, and compare and analyze the experimental results obtained with those of the original YOLOv8s algorithm;

[0070] Step S6: Deploy the improved YOLOv8s model on the PyQt5 platform and build a visual interface to achieve simultaneous early warning when prohibited items are detected, remind security inspectors in real time, and automatically save the detection video locally for review.

[0071] In the step S3, the deformable convolution DCNv2 is further expanded on the basis of the deformable convolution DCNv 1. The principle of the deformable convolution DCNv 1 is to add an offset to each sampling point on the basis of the traditional convolution to realize random sampling near the current position. Assuming that the size of the convolution kernel is 3×3, there are 9 sampling points of the convolution kernel. An offset variable is assigned to each of the 9 sampling points, so that the size and position of the convolution kernel can be dynamically adjusted according to the target object, thereby improving the detection performance of the network model for objects with irregular shapes and sizes;

[0072] For traditional two-dimensional convolution, at a certain sampling point p 0 The output feature map at is defined as:

[0073]

[0074] In the above formula, R = {(-1,-1), (-1,0), ..., (0,1), (1,1)}, is the receptive field area, w(p n ) is the sampling position p n The convolution kernel weight value at , x(p 0 +p n ) is the input feature map x in p 0 +p n The feature at the position, p n is the position element in R, that is, all sampling positions in the receptive field;

[0075] In the deformable convolution, the output feature value y(p 0 ) is defined as follows:

[0076]

[0077] In the above formula, △p n Represents the learnable offset added by the standard convolution at the sampling point, generally a small number, p 0 +p n +△p n is also a decimal, where {△p n |n=1,2,2,N},N=|R|, therefore, the pixel x(p 0 +p n +△p n ) is usually implemented using bilinear interpolation; the formula for bilinear interpolation is:

[0078]

[0079] Where p = p 0 +p n +△p n represents any position in the region, and q represents all integer spatial positions in the input feature map, i.e., p 0 +p n +△p n The four integer points around, x(q) represents the value of all integer positions in the feature map, G(q,p) represents the bilinear interpolation kernel function, which is a two-dimensional kernel and can be decomposed into two one-dimensional kernels, expressed as follows:

[0080] G(q,p)=g(q x ,p x )·g(q y ,p y )

[0081] Among them, g(α,β)=max{0,1-|α-β|};

[0082] In the entire deformable convolution DCNv1 operation process, the input image is firstly extracted using a conventional convolution kernel, and then the obtained output feature map is passed through an additional offset field layer to obtain the offset field of the convolution kernel sampling point; since it contains the offsets in the x and y directions on the two-dimensional plane, the number of channels is 2N; the size of the obtained offset field is proportional to the input feature map. Figure 1 The bias matrix of the sampling point can be obtained from it, and the offset △p can be obtained from it. n Considering that DCNv1 will introduce a lot of irrelevant background information to interfere with the model when fitting the detection target, the present invention proposes DCNv2 based on DCNv 1, thereby improving the ability of the model to focus on the target image area;

[0083] Compared with DCNv1, in the deformable convolution DCNv2, the output eigenvalue y(p 0 ) is defined as follows:

[0084] In the formula, the weight coefficient △m is introduced n (0≤△m n ≤1), using the modulation mechanism to adjust the amplitude of the input features at different positions, learning the weights at each sampling point position, thereby suppressing irrelevant background information and reducing the interference of irrelevant factors. The process of DCNv2 is as follows Figure 3 shown.

[0085] The present invention adds the deformable convolution DCNv2 module to the backbone network of the YOLOv8s model; the backbone network plays the role of extracting image features, and is usually composed of multiple convolutional layers to extract features at different levels; by fusing and integrating features at different levels, more comprehensive and accurate image features of contraband can be obtained; the present invention replaces the second, third, and fourth C2f modules of the backbone network with the deformable convolution module C2f_DCN to improve the model's focus on small and medium-sized targets, laying the foundation for subsequent feature fusion; the model structure after fusing DCNv2 and EMA is as follows Figure 4 shown.

[0086] In step S4, the pigeon flock algorithm PIO consists of two operators: a compass and map operator and a landmark operator. In the pigeon flock optimization model, the position and speed of the pigeon flock are initialized according to the map and compass operators, and during the search process, the position and speed of the pigeon flock are updated in each iteration. The speed and position are recorded as:

[0087] X i (t) = X i (t-1)+V i (t)

[0088] V i (t) = V i (t-1)·e -Rt +rand·(X gbest -X i (t-1))

[0089] In the above formula, R is the compass and map operator, rand is used to generate a random number between 0 and 1; X gbest is the best global position after the t-1th iteration cycle, V i (t) is the current speed of the pigeon at the tth time, X i(t) is the current position of the i-th pigeon in the t-th iteration;

[0090] For the landmark operator, the number of pigeons will be halved in each generation, using N p To represent the number of pigeons in each generation, use X c (t) represents the center position of the remaining pigeons. The pigeons close to the destination are landmarks and used as reference directions for flight, based on the following formula:

[0091]

[0092] Among them, N p (t) represents the number of pigeons in the tth generation, and the fitness value is fitness(X i (t)) indicates that the fitness value of each pigeon is evaluated and arranged to find the optimal path, and the following formula is used to update the position of the pigeon group:

[0093] X i (t) = X i (t-1)+rand·(X c (t)-X i (t-1))

[0094] For each individual in the population:

[0095] X i,t =(x 1i,t ,x 2i,t ,2,x ni,t )

[0096] The mutation operation is the core operation of the evolutionary operator. Its main purpose is to generate an intermediate individual through the mutation mechanism. Its mutation equation is:

[0097] W i,t+1 =ηX r1,t +(1-η)·F·(X r2,t -X r3,t )

[0098]

[0099] F=F 0 ×2 ω

[0100] W i,t+1 =(w 1i,t+1 ,w 2i,t+1 ,2,w ni,t+1 )

[0101] In the formula, the intermediate individual produced by the mutation of the i-th individual in the t-th generation, r 1 , r 2 , r 3Different from each other, they are taken from [1,N p ], F is a constant between 0 and 1, and is represented by F 0 Determined together with ω, it is usually called a mutation factor or scaling factor, and η is a mutation weight parameter used to expand the search capabilities in local and global scopes;

[0102] In order to increase the diversity of the interference parameter vector, a crossover operation is introduced, and the experimental variables become:

[0103] U i,t+1 =(u 1i,t+1 ,u 2i,t+1 ,2,u ni,t+1 )

[0104]

[0105] (i=1,2,2,N p ; j = 1, 2, 2, n)

[0106] Where CR represents the crossover probability operator between 0 and 1, which determines the probability that the mutated individual component value replaces the current individual score, rand(j) is a uniformly distributed random number between 0 and 1, and rnbi(i) is a random integer between 1 and n to ensure that the candidate individual obtains at least one component value from the mutation vector;

[0107] Due to the lack of interaction between pigeons in the traditional pigeon swarm algorithm, it is easy to converge prematurely and fall into the local optimal solution. At the same time, the global search ability of the pigeon swarm position update formula in the algorithm is weak, which will also cause the problem of poor diversity. The above-mentioned improvement strategy introduces an adaptive differential mutation crossover operator, which can adjust the position of the pigeons by randomly selecting individuals in the pigeon swarm, so as to improve the global and local search ability of the algorithm and enhance the diversity of the population.

[0108] The pigeon flock optimization algorithm improved by the mutation crossover operator has the following compass and map operators:

[0109] X i (t) = X i (t-1)+V i (t)+W i

[0110] The landmark operator is:

[0111] X i (t) = X i (t-1)+rand·(X c (t)-X i (t-1))+W i

[0112] Among them, Wi It is an improved adaptive mutation crossover operator;

[0113] The present invention applies the improved pigeon flock optimization algorithm to the hyperparameter optimization of deep learning. By selecting the corresponding parameters as the optimization target, the test results of the convolutional neural network are used as indicators for evaluating the candidate solutions of the fitness function. The pigeon flock optimization algorithm based on the crossover mutation operator is used for iterative search to obtain the global optimal candidate solution and the corresponding optimal fitness value, that is, the optimal learning rate and the optimal detection accuracy mAP. The main process is as follows Figure 5 shown.

[0114] In step S5, X-ray scanned images are collected from security inspection systems such as airports and subways, as well as relevant information on the Internet. The collected images are selected, classified, and annotated, and finally a data set of 30,000 images containing prohibited items to be detected is produced. The data set has 10 common types of prohibited items, such as knives, scissors, power banks, etc.; according to the construction principle of the training set, the validation set, and the test set, the data set is divided according to the ratio of 7:1.5:1.5; the input size of the model image is 640×640; the operating system used in the experiment is 64-bit Ubuntu 20.04, the CPU is Intel(R) Core(TM) i 7-11800H@2.30GHz, the GPU is NVIDIA GeForce RTX 4090D, the CUDA version is 12.2, the deep learning framework is pytorch2.0 framework, and the Python version is 3.10; for the setting of hyperparameters, the initial learning rate is set to 0.01, the number of training rounds is 100 times, and the batch size is 8; Mo is closed for the last 10 rounds of the entire training process Sai c enhancement; the SGD optimizer is used in the model to iteratively update parameters. The SGD optimizer can dynamically adjust the learning rate so that the loss function can converge better.

[0115] Example 1

[0116] The original YOLOv8s model is trained. At the same time, in order to verify the detection effect of the improved model based on deformable convolution (DCNv2) and channel attention (EMA), the improved YOLOv8s model with added convolution layer and attention module is used for experiment in this embodiment. The experimental results are as follows: As can be seen from the overall, the mAP values ​​corresponding to the best models trained by YOLOv8s, YOLOv8s-EMA, YOLOv8 s-DCN, and YOLOv8s-DCN-EMA on the test set are 95.59%, 96.44%, 97.00%, and 97.62%, respectively. The detection effect mAP of the YOLOv8s-DCN-EMA model optimized by deformable convolution and channel attention is 2.03% higher than that of the original model, which shows that YOLOv8s-DCN-EMA has stronger feature extraction ability and the ability to distinguish different information. In each category of detection tasks, the improved model has greatly improved the detection accuracy of small prohibited items such as lighters, scissors, slingshots, and knives. The corresponding improvement values ​​are 2.8%, 2.1%, 2.3%, and 3.3%, respectively. This shows that the improved module has a better effect on the detection task of small targets. In summary, although the two improvements have different effects on different categories of items, both will bring great improvements to the entire contraband detection task, and the effect of the combination of the two is even greater than the original method. It can meet the actual application needs in the security inspection of dangerous goods detection tasks. The test results are shown in Table 1:

[0117] Table 1 Comparative experimental results of different improved models for the detection accuracy of various types of contraband

[0118]

[0119]

[0120] The improved pigeon swarm algorithm is used to perform multiple rounds of iterative training on the improved YOLOv8 s model, and the final detection accuracy is improved by optimizing the learning rate.

[0121] According to the content of the improved pigeon swarm algorithm, the number of pigeons N is first set to 4, and each pigeon in the pigeon swarm represents the learning rate. The lower limit of the learning rate is set to 0.001, the upper limit is set to 0.1, and the compass factor is set to 0.3. The maximum number of iterations is set to 20, the maximum number of iterations of the compass operator is 12, the maximum number of iterations of the landmark operator is 8, the initial F value is set to 0.5, and the mutation parameter is set to 0.5. Update the corresponding parameters in each iteration. The model input of YOLOv8 s-DCN-EMA is 640×640, the batch size is 8, and the number of training rounds is 100. Here, the process of training the model is called inner loop training. In the iterative process of the compass operator, since the number of pigeons is set to 4, each iterative optimization contains 4 inner loop trainings. The update iteration operation of each parameter is called outer loop evolution. The detection accuracy mAP value obtained by each inner loop training is used as the fitness value of the pigeon swarm, and the highest accuracy value obtained by each round of outer loop evolution is called the optimal fitness value, that is, the optimal mAP. At this time, the next generation pigeon flock position is updated according to the learning rate corresponding to the optimal mAP and the compass operator update formula, that is, the learning rate required for the next round of outer loop evolution training. The fitness values ​​obtained by the next generation of outer loop evolution are sorted to obtain the corresponding optimal fitness value, and so on, until the number of iterations reaches the maximum number of iterations of the compass operator. At this time, stop using the compass operator and use the landmark operator instead, that is, the number of pigeon flocks is halved from generation to generation, and the optimal mAP value is obtained through inner loop training and precision value sorting. The present invention iteratively trains the improved pigeon flock optimization algorithm based on the YOLOv8s-DCN-EMA model. The experimental environment and environment configuration are the same as above. The final experimental results are shown in the figure and table below. In the test of the model obtained by the 15th round of outer loop evolution, the optimal mAP, i.e., 98.15%, was obtained. The corresponding optimal learning rate was 0.01354. The experimental results are shown in Tables 2 and Figure 6 As shown:

[0122] Table 2 Comparative experiments of YOLOv8s-DCN-EMA-IPIO detection model and YOLOv8s-DCN-EMA detection model

[0123]

[0124] The results show that the YOLOv8s-DCN-EMA model with optimized learning rate has a detection accuracy 0.43% higher than the unoptimized model, and the overall detection performance has been improved. At the same time, the detection accuracy of each prohibited item has been improved accordingly. In the operation of the outer loop evolution, when the number of iterative training reaches the 15th round, the optimal mAP measured by the model on the test set reaches the highest, and the mAP value of the next five rounds gradually stabilizes and no longer rises. In summary, the improved pigeon flock algorithm based on the cross-variation learning strategy can dynamically optimize the learning rate of the model, so that the model can converge to the optimal learning rate faster and better, thereby further improving the detection accuracy and performance.

[0125] The contraband detection algorithm is deployed to a visualization platform, and this effect is achieved through the corresponding program in the PyQt5 library.

[0126] In the embodiment of the present invention, an intuitive and beautiful interface is constructed, in which the manual adjustment functions of confidence and IOU are added; at the same time, different functions of image detection, video detection, and camera detection are provided to users. There is a real-time time display at the top of the interface, and the user can choose whether to save the detection results locally; the interface also includes three functional bars: input image display area, output image display area, and result display area. The input display area displays the original image, and the output display area displays the output image with a detection frame. The result display area shows whether contraband is detected and how many contraband are detected. The specific content is as follows Figure 7 shown.

[0127] When prohibited items are detected, the result display area at the bottom of the system will be marked in red and will display: x prohibited items detected. At the same time, an alarm will be sounded, a window will pop up and the detection will stop. At this time, the security inspector needs to manually click OK, and then the system will continue to detect. When prohibited items are detected, the system will repeat the above steps. When no prohibited items are detected, the system will automatically maintain the detection status, and the result display area at the bottom will be marked in green, showing: No prohibited items detected. The interface for detecting prohibited items is as follows Figures 8 to 11 As shown; the interface where no prohibited items are detected is as follows Fig.12 shown.

[0128] When the inspection is completed or the passenger has objections and needs to be reviewed, the video inspection can be directly turned off and saved locally. The security inspector can then retrieve the video recording saved in the background for review to confirm whether the inspection is correct. If there is indeed a problem, the baggage inspection process will be carried out. If there is no problem, the inspection will continue. Fig.13 Indicates the display interface for saving video. Fig.14 It is a file that has been saved locally. The file is named according to the specific time of saving, accurate to seconds.

[0129] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A dangerous goods identification and detection system based on intelligent AI algorithm, characterized in that: The system consists of the following steps: Step S1: Deploy the environment required for YOLOv8s development and training, and select the YOLOv8s model as the detection head; Step S2: Add EMA attention to the neck layer of the YOLOv8s algorithm to fully integrate features of different scales; Step S3: Add deformable convolution DCNv2 to the backbone network of YOLOv8s to extract features at different levels, and fuse and integrate features at different levels to obtain more comprehensive and accurate image features of contraband; Step S4: Introduce the improved pigeon flock algorithm to automatically update and adjust the learning rate, and ultimately improve the final detection accuracy of the improved model at the hyperparameter optimization level; Step S5: Conduct experiments on the improved YOLOv8s model, including training and reasoning, and compare and analyze the experimental results obtained with those of the original YOLOv8s algorithm; Step S6: Deploy the improved YOLOv8s model on the PyQt5 platform and build a visual interface to achieve simultaneous early warning when prohibited items are detected, remind security inspectors in real time, and automatically save the detection video locally for review.

2. The dangerous goods identification and detection system based on intelligent AI algorithm according to claim 1 is characterized in that: In step S3, in the deformable convolution DCNv2, the output eigenvalue y(p0) is defined as follows: Where R = {(-1,-1), (-1,0), ..., (0,1), (1,1)}, is the receptive field area, w(p n ) is the sampling position p n The convolution kernel weight value at , p n is the position element in R, that is, all sampling positions in the receptive field, △p n represents the learnable offset added by the standard convolution at the sampling point, {△p n |n=1,2,2,N},N=|R|,p=p0+p n +△p n Represents any position in the region, introducing the weight coefficient △m n (0≤△m n ≤1), the modulation mechanism is used to adjust the amplitude of the input features at different positions, and the weight at each sampling point is learned to suppress irrelevant background information and reduce the interference of irrelevant factors.

3. The dangerous goods identification and detection system based on intelligent AI algorithm according to claim 2 is characterized in that: In the step S3, the second, third and fourth C2f modules of the backbone network backbone are replaced with the deformable convolution module C2f_DCN to improve the model's focus on small and medium-sized targets and lay the foundation for subsequent feature fusion.

4. The dangerous goods identification and detection system based on intelligent AI algorithm according to claim 1 is characterized in that: In step S4, the pigeon flock algorithm PIO consists of two operators: a compass and map operator and a landmark operator. In the pigeon flock optimization model, the position and speed of the pigeon flock are initialized according to the map and compass operators, and during the search process, the position and speed of the pigeon flock are updated in each iteration. The speed and position are recorded as: X i (t)=X i (t-1)+V i (t) V i (t)=V i (t-1)·e -Rt +rand·(X gbest -X i (t-1)) In the above formula, R is the compass and map operator, rand is used to generate a random number between 0 and 1; X gbest is the best global position after the t-1th iteration cycle, V i (t) is the current speed of the pigeon at the tth time, X i (t) is the current position of the i-th pigeon in the t-th iteration; For the landmark operator, the number of pigeons will be halved in each generation, using N p To represent the number of pigeons in each generation, use X c (t) represents the center position of the remaining pigeons. The pigeons close to the destination are landmarks and used as reference directions for flight, based on the following formula: Among them, N p (t) represents the number of pigeons in the tth generation, and the fitness value is fitness(X i (t)) indicates that the fitness value of each pigeon is evaluated and arranged to find the optimal path, and the following formula is used to update the position of the pigeon group: X i (t)=X i (t-1)+rand·(X c (t)-X i (t-1)) For each individual in the population: X i,t =(x 1i,t ,x 2i,t ,2,x ni,t ) The mutation operation is the core operation of the evolutionary operator. Its main purpose is to generate an intermediate individual through the mutation mechanism. Its mutation equation is: W i,t+1 =ηX r1,t +(1-η)·F·(X r2,t -X r3,t ) F=F0×2 ω IN i,t+1 =(in 1i,t+1 ,In 2i,t+1 ,2,in ni,t+1 ) In the formula, the intermediate individuals produced by the mutation of the i-th individual in the t-th generation, r1, r2, r3 are different from each other and are taken from [1, N p ], F is a constant between 0 and 1, which is determined by F0 and ω, and is usually called a mutation factor or scaling factor. η is a mutation weight parameter used to expand the search capabilities in local and global scopes. In order to increase the diversity of the interference parameter vector, a crossover operation is introduced, and the experimental variables become: IN i,t+1 =(in 1i,t+1 ,in 2i,t+1 ,2,in ni,t+1 ) (i=1,2,2,N p ;j=1,2,2,n) CR represents the crossover probability operator between 0 and 1, which determines the probability that the mutated individual component value replaces the current individual score. rand(j) is a uniformly distributed random number between 0 and 1. rnbi(i) is a random integer between 1 and n to ensure that the candidate individual obtains at least one component value from the mutation vector. Based on the above improved strategy, an adaptive differential mutation crossover operator is introduced, which can adjust the position of pigeons by randomly selecting individuals in the pigeon flock to improve the global and local search capabilities of the algorithm and enhance the diversity of the population; The pigeon flock optimization algorithm improved by the mutation crossover operator has the following compass and map operators: X i (t)=X i (t-1)+V i (t)+W i The landmark operator is: X i (t)=X i (t-1)+rand·(X c (t)-X i (t-1))+W i Among them, W i It is an improved adaptive mutation crossover operator; The above-mentioned pigeon colony optimization algorithm based on the crossover mutation operator is used for iterative search to obtain the global optimal candidate solution and the corresponding optimal fitness value, that is, the optimal learning rate and the optimal detection accuracy mAP.

5. The dangerous goods identification and detection system based on intelligent AI algorithm according to claim 1 is characterized in that: In the step S5, the collected images are selected, classified, and labeled to produce a plurality of data sets containing prohibited items to be detected. The data sets contain various common types of prohibited items. According to the construction principle of the training set, the validation set, and the test set, the data sets are divided in a ratio of 7:1.5:1.

5. A corresponding training environment is used to perform several rounds of training. The SGD optimizer is used in the model to iteratively update parameters and dynamically adjust the learning rate so that the loss function can converge better.

Citation Information

Cited By

  • Metal detection security door based on intelligent sensor

    CN121325266A

  • Marine target detection and three-dimensional point cloud sensing method based on infrared binocular vision

    CN122157239A