A visual detection method for foreign matter in material conveying lanes

By integrating the SE attention module with GhostNet, and improving the YOLOv4 model, combining the Adam optimization algorithm and the WK-means clustering algorithm, the real-time and accuracy problems in foreign object detection in material conveying tunnels are solved, achieving efficient and accurate foreign object detection effects.

CN115410157BActive Publication Date: 2025-06-06YUNNAN YIHONG INTELLIGENT CONTROL TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211069347.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-02
Publication Date
2025-06-06
Estimated Expiration
2042-09-02

AI Technical Summary

Technical Problem

The prior art has real-time and accuracy problems in the detection of foreign matter in material conveying tunnels. Manual inspection cannot guarantee real-timeness, and the laser detection method has blind spots that lead to missed inspection.

Method used

The SE attention module is fused with GhostNet for feature extraction, the YOLOv4 model is improved, and the Adam adaptive gradient descent algorithm and learning rate equal interval adjustment strategy are introduced to speed up the update speed of model parameters and improve detection accuracy. At the same time, the WK-means clustering algorithm is used to weighted clustering the anchor box to reduce the impact of non-target areas on the foreign object targets in the tunnel.

Benefits of technology

It realizes efficient foreign object detection, with an average detection accuracy of 98.48%, an error detection rate of 0.62%, and a detection speed of 58FPS, which significantly improves the detection accuracy and speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115410157B_ABST
    Figure CN115410157B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of safety monitoring of material conveying lanes, and specifically to a method for visual detection of foreign objects in material conveying lanes. The method uses weighted K-means to cluster anchor frames to solve the problem that the initial anchor frames are not adapted to foreign objects in the lanes. GhostNet fused with SE attention mechanism is used as the feature extraction network of the YOLOv4 model. On the one hand, it solves the problem that the CSPDarknet53 has too many parameters and leads to poor real-time performance; on the other hand, it enhances the feature extraction capability of small objects. Further, the Adam optimization algorithm and the learning rate equal interval adjustment strategy are used to improve the detection accuracy and accelerate the early convergence speed of model training. Finally, through the training and field application of the material conveying lane status data set of the cigarette factory, the results show that the method of the present invention achieves a good detection effect: the average detection accuracy of foreign objects reaches 98.48%, the false detection rate is 0.62%, and the detection speed is 58FPS.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of safety monitoring of material conveying lanes, and in particular to a method for visually detecting foreign matter in material conveying lanes. Background Art

[0002] The safe operation of the material conveying shuttle is an important link to ensure the smooth and continuous production of the cigarette factory. The turns and connections of the material conveying lanes where the shuttle runs form inevitable protection gaps. The materials loaded on the running shuttle are also inevitably scattered, causing the shuttle operation failure and even safety hazards. Therefore, real-time safety detection of the material conveying lanes is of great significance.

[0003] At present, manual inspection and laser detection methods are commonly used in material conveying lanes in cigarette factories. Manual inspection is to ensure the safe operation of the shuttle car through on-site manual inspection or human eye observation of the conveying lane monitoring video. Although the manual method can eliminate safety hazards more accurately, the real-time performance cannot be guaranteed. The laser detection method uses a fixed-point laser emission-reflection from a certain point on the shuttle car-laser reception to feedback whether the conveying lane is unobstructed. Although this method can achieve real-time detection, except for the laser emission-reflection path, it is a blind area, resulting in serious missed detection and unable to guarantee the safe operation of the shuttle car.

[0004] With the development of artificial intelligence deep learning, machine vision detection and its application have achieved a leap forward. The research on track / tunnel safe operation detection based on deep learning methods has received more attention and in-depth development. Some technical experts proposed the use of single shot multibox detector (SSD) for foreign body detection on transport tracks, aiming to solve the problem of high difficulty in feature extraction and algorithm performance being easily affected by the surrounding environment in track foreign body target detection, but the real-time performance and prediction frame accuracy of the algorithm are not high. Some other technical experts use the improved moving target adaptive ViBe algorithm for track foreign body intrusion detection to suppress the Ghost area of ​​the ViBe algorithm and reduce false detection or missed detection caused by environmental changes, but the algorithm has poor adaptability to small target detection. Some other technical experts proposed a track obstacle detection method that uses a Euclidean distance metric instead of a random selection K-means to solve the problem of single detection category and poor real-time performance of the intrusion foreign body detection method, but the detection accuracy of this method and the detection of small target objects did not achieve good results. Summary of the invention

[0005] The purpose of the present invention is to solve the defects of the prior art and provide a method for visually detecting foreign matter in a material conveying lane.

[0006] In order to achieve the above object, the technical solution adopted by the present invention is as follows:

[0007] A method for visually detecting foreign matter in a material conveying lane comprises the following steps:

[0008] S1. In order to enrich the feature information of the feature map, the SE attention module is fused with GhostNet for feature extraction, ensuring the robustness of foreign body feature extraction while increasing the weight of foreign body features;

[0009] S2. Use SE attention module to improve the feature maps of 19×19, 38×38 and 76×76 in GhostNet network and fuse them with the feature maps sampled and output on the feature extraction network to obtain the feature layer of the final detection model.

[0010] S3, using the improved Adam adaptive gradient descent algorithm to optimize the YOLOv4 model;

[0011] S4. Based on the Adam algorithm, the learning rate equal interval adjustment strategy is introduced to speed up the update speed of model parameters, thereby improving the early convergence speed of the Adam algorithm and the detection accuracy of the model;

[0012] S5. Use the WK-means clustering algorithm to perform weighted clustering on the anchor frame. Each feature dimension is assigned an initial weight value. When the objective function converges, the weight corresponding to the non-target detection area tends to 0, reducing the impact of the non-target area on the foreign object target in the lane and improving the detection accuracy of foreign objects.

[0013] Furthermore, in S1, the material conveying tunnel image is firstly passed through GhostNet to obtain the feature layer X, and the number of image channels, image height and image width are set to c, h and w respectively;

[0014] Perform traditional convolution to obtain the feature layer Y, set the number of image channels, image height and image width to c 1 , h and w, and then the feature layer Y is squeezed and excitation operated through the SE attention module:

[0015] Perform global average pooling on the feature layer Y to convert the h×w feature layer into a 1×1 feature layer;

[0016] The 1×1 feature layer passes through two fully connected layers to obtain the weights of different channels. Finally, sigmoid is used to normalize the weight information to obtain the channel weights. The channel weights are respectively compared with the c 1 Multiply the channel feature map data to get the new c 1 ×h×w feature layer.

[0017] Furthermore, in S3, the Adam optimization algorithm adaptively adjusts the model parameters by calculating the model's own descent gradient. The algorithm is as follows: First, the first-order and second-order moment estimates m are calculated. i and v i The decaying average of:

[0018] First moment estimate:

[0019]

[0020] Second moment estimate:

[0021]

[0022] Among them, β 1 , β 2 are the exponential decay rates of the first-order and second-order moment estimates, d y is the gradient;

[0023] Then, the deviation is corrected according to the calculated attenuated average value. By calculating the deviation, the first-order and second-order moment estimates are corrected. The corrected deviations are:

[0024]

[0025]

[0026] Parameter update:

[0027]

[0028] Among them, y i ,y i+1 is the model parameter vector, φ represents the learning rate, x 0 is an initial value close to 0. At the same time, in order to prevent the denominator from being 0, take x 0 =1×10 -5 .

[0029] Furthermore, in S4, the equal-interval adjustment strategy allows the learning rate to be attenuated and adjusted in an equal-interval manner as the number of iterations increases, and then the global optimal solution is obtained based on the adjusted learning rate. This can effectively reduce the oscillation of the convergence curve during the iteration process and improve the model convergence speed and stability. At the same time, in order to avoid the learning rate decaying to 0, the minimum learning rate is set to 0.00001, that is, when the learning rate is less than 0.00001 during training, the learning rate no longer decays.

[0030] Furthermore, in S5, the objective function of the WK-means clustering algorithm is:

[0031]

[0032] And all weights should obey:

[0033]

[0034] Where A represents the cluster allocation matrix:

[0035]

[0036] C represents the cluster center matrix:

[0037]

[0038] W is the weight matrix:

[0039]

[0040] in Represents the sum of the distances of all sample points in the jth dimension.

[0041] Furthermore, detection speed, average detection accuracy, precision, recall rate and false positive rate are used as evaluation indicators, and the calculation formulas are:

[0042]

[0043]

[0044]

[0045]

[0046] Among them, P i (r) is the detection accuracy of each target; TP is the number of positive samples predicted correctly by the model; TN is the number of negative samples predicted correctly by the model; FP is the number of negative samples predicted incorrectly by the model; FN is the number of positive samples predicted incorrectly by the model; and n is the detection category.

[0047] The beneficial effects of the present invention are as follows: the present invention uses WK-means to cluster anchor frames to solve the problem that the initial anchor frames are not adapted to foreign objects in the lanes; GhostNet with SE attention mechanism is then used as the feature extraction network of the YOLOv4 model to solve the problem of poor real-time performance caused by too many parameters in CSPDarknet53 while enhancing the feature extraction capability of small objects. The Adam optimization algorithm and the learning rate equal interval adjustment strategy are further used to improve the detection accuracy and accelerate the early convergence speed of model training. Finally, through the training and field application of the material conveying lane state data set of the cigarette factory, the results show that the method achieves a good detection effect: the average detection accuracy of foreign objects reaches 98.48%, the false detection rate is 0.62%, and the detection speed is 58FPS. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 Schematic diagram of traditional convolution and GhostNet convolution;

[0049] Figure 2 Schematic diagram of SE attention mechanism;

[0050] Figure 3 This is a loss curve diagram of the model of the present invention. DETAILED DESCRIPTION

[0051] A method for visually detecting foreign matter in a material conveying lane comprises the following steps:

[0052] S1. In order to enrich the feature information of the feature map, the SE attention module is fused with GhostNet for feature extraction, ensuring the robustness of foreign body feature extraction while increasing the weight of foreign body features;

[0053] S2. Use SE attention module to improve the feature maps of 19×19, 38×38 and 76×76 in GhostNet network and fuse them with the feature maps sampled and output on the feature extraction network to obtain the feature layer of the final detection model.

[0054] S3, using the improved Adam adaptive gradient descent algorithm to optimize the YOLOv4 model;

[0055] S4. Based on the Adam algorithm, the learning rate equal interval adjustment strategy is introduced to speed up the update speed of model parameters, thereby improving the early convergence speed of the Adam algorithm and the detection accuracy of the model;

[0056] S5. Use the WK-means clustering algorithm to perform weighted clustering on the anchor frame. Each feature dimension is assigned an initial weight value. When the objective function converges, the weight corresponding to the non-target detection area tends to 0, reducing the impact of the non-target area on the foreign object target in the lane and improving the detection accuracy of foreign objects.

[0057] Specifically, the present invention is an improved YOLOv4 material conveying lane foreign body visual detection method. The YOLOv4 model is a regression-based target detection algorithm. Its main idea is to divide the input feature image into grids of different sizes. If the detection target is located in a certain grid, the corresponding grid is responsible for completing the detection of the target. Based on YOLOv3, YOLOv4 has made the following major improvements. Specifically, it is embodied in:

[0058] (1) In the input stage of the original image, the mosaic data enhancement method is used to splice the four original images together to enhance the diversity of the training data set and improve the detection speed of objects.

[0059] (2) In the feature extraction network stage, CSPDarknet53 is used as the backbone feature extraction network. Compared with Darknet53 in YOLOv3, the CSP (Cross Stage Paritial) network structure is added, and the Mish activation function is used to replace the Leaky ReLU activation function after the initial convolutional layer, which improves the network feature extraction capability.

[0060] (3) In the feature fusion stage, a spatial pyramid pooling (SPP) module is added to the FPN feature pyramid of YOLOv3, which can significantly improve the network receptive field.

[0061] (4) Introduce the aggregation network (PANet) structure to repeatedly extract features and enrich feature map information.

[0062] (5) The anchor box mechanism of region recommendation is used to accurately detect the target.

[0063] Therefore, compared with YOLOv3, YOLOv4 greatly improves the target detection accuracy while ensuring the detection speed.

[0064] The GhostNet-SE network model is as follows:

[0065] GhostNet network model:

[0066] GhostNet is based on the Ghost module, which combines traditional convolution and linear transformation. Figure 1 As shown in area b, the traditional convolution module is as follows Figure 1 As shown in area a in the middle. The Ghost module works as follows: First, the input image is compressed (redundant) through a 1×1 traditional convolution to obtain a feature map with half the number of channels of the traditional convolution; second, the feature map is convolved layer by layer, and a new feature map is obtained through a simple linear operation; finally, the feature map is stacked with the new feature map to obtain the final feature layer. This method of generating feature maps based on traditional convolution and then using feature maps for linear transformation to obtain similar feature maps, thereby producing a high-dimensional convolution effect, reduces model parameters and computational complexity.

[0067] The attention mechanism is as follows:

[0068] In order to enrich the feature information of the feature map, the present invention integrates the SE (Squeeze-and-Excitation) attention module with GhostNet for feature extraction, aiming to ensure the robustness of foreign body feature extraction while increasing the weight of foreign body features.

[0069] SE attention mechanism Figure 2The SE attention mechanism first passes the material conveying tunnel image through GhostNet to obtain the feature layer X (the number of image channels, image height and image width are c, h and w respectively) and performs traditional convolution to obtain the feature layer Y (the number of image channels, image height and image width are c 1 , h and w), and then pass the feature layer Y through the SE attention module, including the squeeze and excitation operations, namely: (1) perform global average pooling on the feature layer Y to convert the h×w feature layer into a 1×1 feature layer; (2) pass the 1×1 feature layer through two fully connected layers to obtain the weights of different channels. Finally, use sigmoid to normalize the weight information to obtain the channel weights, and compare the channel weights with the c corresponding to Y. 1 Multiply the channel feature map data to get the new c 1 The present invention enriches the feature map information through the SE attention mechanism, enhances the characteristics of foreign objects in the lane, and further enhances the directionality of foreign object feature extraction.

[0070] The present invention uses the SE attention module to improve the feature maps of three different sizes of 19×19, 38×38 and 76×76 in the GhostNet network and fuses them with the feature maps sampled and output on the feature extraction network to obtain the feature layer of the final detection model.

[0071] The model network weight optimization algorithm is as follows:

[0072] Because the YOLOv4 target detection model uses the stochastic gradient descent algorithm (Sgd) to iteratively update the neural network weights, and the Sgd algorithm has a slow convergence speed in the early stage and is prone to precision degradation. In order to speed up the convergence speed of the model's early training and thus improve the model's accuracy, the present invention uses an improved Adam adaptive gradient descent algorithm to optimize the YOLOv4 model.

[0073] The specific Adam optimization algorithm is:

[0074] The Adam optimization algorithm adaptively adjusts the model parameters by calculating the model's own descent gradient. The algorithm is as follows: First, calculate the first-order and second-order moment estimates and The decaying average of:

[0075] First moment estimate:

[0076]

[0077] Second moment estimate:

[0078]

[0079] Among them, β1 , β 2 are the exponential decay rates of the first-order and second-order moment estimates, d y is the gradient.

[0080] Then, the deviation is corrected according to the calculated decay average value, and the first-order and second-order moment estimates are corrected by calculating the deviation. The corrected deviations are:

[0081]

[0082]

[0083] Parameter update:

[0084]

[0085] Among them, y i ,y i+1 is the model parameter vector, φ represents the learning rate, x 0 is an initial value close to 0. At the same time, in order to prevent the denominator from being 0, take x 0 =1×10 -5 .

[0086] The specific optimization strategy for equal interval adjustment is as follows:

[0087] The present invention introduces a learning rate equal-interval adjustment strategy based on the Adam algorithm, which can speed up the updating speed of model parameters, improve the early convergence speed of the Adam algorithm and improve the detection accuracy of the model.

[0088] The equal-interval adjustment strategy adjusts the learning rate attenuation in an equal-interval manner as the number of iterations increases, and then obtains the global optimal solution based on the adjusted learning rate, which can effectively reduce the oscillation of the convergence curve during the iteration process and improve the model convergence speed and stability. At the same time, in order to avoid the learning rate decaying to 0, the present invention sets the minimum learning rate to 0.00001, that is, when the learning rate is less than 0.00001 during training, the learning rate no longer decays.

[0089] The specific Wk-means anchor box optimization algorithm is as follows:

[0090] YOLOv4 target detection training uses a method of pre-setting prior anchor frame parameters. This method has good adaptability to COCO, VOC and other datasets. However, the detection targets of the dataset of the present invention are mainly shuttles, people and stools, which are quite different from the various detection targets of open environment datasets such as COCO and VOC. In addition, different detection targets are suitable for different prior frame sizes, resulting in that the anchor frame mechanism of YOLOv4 is not suitable for the cigarette factory material conveying lane operation status dataset of the present invention.

[0091] The present invention adopts the WK-means clustering algorithm to perform weighted clustering processing on the anchor frame, assigns an initial weight value to each feature dimension, and waits until the objective function converges and the weight corresponding to the non-target detection area tends to 0, thereby minimizing the impact of the non-target area on the foreign object target in the lane and improving the detection accuracy of foreign objects.

[0092] The objective function of the WK-means clustering algorithm is:

[0093]

[0094] And all weights should obey:

[0095]

[0096] Where A represents the cluster allocation matrix:

[0097]

[0098] C represents the cluster center matrix:

[0099]

[0100] W is the weight matrix:

[0101]

[0102] in Represents the sum of the distances of all sample points in the jth dimension.

[0103] WK-means calculates the weighted distance sum of each dimension while minimizing the distance within the entire cluster, and adjusts the influence of each dimension on the clustering result through different weight values. In the experiment, the prior box obtained by the WK-means clustering algorithm is closer to the detection target than the prior box used by YOLOv4.

[0104] In summary, the present invention improves the visual detection method of foreign objects in the material conveying lanes of cigarette factories based on the fusion of WK-means and GhostNet to improve YOLOv4, thereby improving the foreign object positioning and classification effects while increasing the convergence speed of foreign object detection training.

[0105] The following is an analysis based on specific experiments and results:

[0106] Dataset:

[0107] This system sets up a visual system in the auxiliary material warehouse of the cigarette factory of Longyan Tobacco Industry Co., Ltd. to collect image data sets of the running status of the material conveying lane. The foreign objects in the lane in this data set mainly include intruders and scattered auxiliary materials carried by shuttle vehicles.

[0108] The dataset consists of 4686 images with a resolution of 390×882 and a format of bmp. Data preprocessing uses Label to label the shuttles, people, and stools in the dataset. The label file is in XML format.

[0109] Experimental environment:

[0110] The experimental environment of the present invention is shown in Table 1.

[0111] Table 1 Experimental environment

[0112]

[0113] Model training:

[0114] Before training, the data set was randomly divided into a training set and a validation set in a ratio of 9:1. The parameters of the training phase were set as follows: Focal Loss was used to balance positive and negative samples, the positive and negative sample balance parameter was set to 0.25, and the difficult and easy classification sample balance parameter was set to 2; the momentum term of the Adam optimization algorithm was set to 0.937; the maximum learning rate of the learning rate equal interval adjustment strategy was set to 0.001, and the minimum learning rate was 0.00001.

[0115] The present invention trains the material conveying tunnel operation status data set. In the experiment, 100 Epochs are trained, and the weight file corresponding to each Epoch is retained. The loss curve obtained by training is as follows: Figure 3 As shown, it can be seen that the total loss of the model decreases rapidly in the first five Epochs, and the trainloss and val loss remain basically stable after Epoch 20. This shows that the learning rate of the algorithm of the present invention decays significantly and reaches the optimal value quickly.

[0116] Experimental evaluation indicators:

[0117] The model of the present invention uses detection speed (Frames Per Second, FPS), average detection accuracy (MeanAverage Precision, MAP), precision (Precision), recall rate (Recall) and false positive rate (Noise factor) as evaluation indicators, and the calculation formulas are:

[0118]

[0119]

[0120]

[0121]

[0122] Among them, Pi (r) is the detection accuracy of each target; TP is the number of positive samples predicted correctly by the model; TN is the number of negative samples predicted correctly by the model; FP is the number of negative samples predicted incorrectly by the model; FN is the number of positive samples predicted incorrectly by the model; and n is the detection category.

[0123] Experimental results analysis:

[0124] The larger the network model size, the stricter the processor performance requirements. The number of parameters of the backbone feature extraction network model is proportional to the model size. The commonly used lightweight feature extraction networks mainly include Densenet, Vgg, Mobilenet, Resnet and GhostNet. The network parameter quantities are shown in Table 2. The data set of the present invention is used to train a variety of lightweight feature extraction networks, among which GhostNet has the least number of parameters, that is, GhostNet has the fastest feature extraction network speed.

[0125] Table 2 Parameters of each lightweight feature extraction network

[0126]

[0127] To verify the superiority of the GhostNet feature extraction network, ablation experiments were performed on the algorithms and improved models in Table 2 on the same training set and validation set. The commonly used lightweight feature extraction network was used to replace the CSPDarkNet 53 network of YOLOv4, and the detection performance was verified. The results are shown in Table 3. From the performance comparison results, it can be seen that GhostNet has superiority in both detection speed and accuracy.

[0128] Table 3 Detection performance of each lightweight feature extraction network

[0129]

[0130] In order to verify the detection performance of the GhostNet feature extraction network fused with the SE attention mechanism, the present invention conducts ablation experiments before and after the introduction of the SE attention mechanism, and the results are shown in Table 4. As can be seen from Table 4, the use of the SE attention mechanism increases the model detection speed by 2%, the average detection accuracy by 1.75%, the precision by 12.11%, and the false detection rate by 0.79%.

[0131] Table 4 Impact of SE attention module on the algorithm

[0132]

[0133] In the model gradient descent algorithm, the present invention adopts Adam and Sgd for comparison, and in the learning rate decay strategy, the cosine annealing algorithm and the equal interval adjustment strategy are selected for comparison in the GhostNet-SE network. The results are shown in Table 5. It can be found that Adam+Step has the best detection performance, with a detection speed of 55FPS, an average detection accuracy of 97.38%, a recall rate of 92.41%, a precision rate of 98.70%, and a false detection rate of 0.7%.

[0134] Table 5 The impact of learning rate optimization algorithm and decay strategy on the algorithm

[0135]

[0136] The anchor box is optimized by using the WK-means clustering algorithm, and a comparative experiment is conducted with the K-means anchor box optimization algorithm for the model of the present invention, and the experimental results are shown in Table 6. The detection speed of the WK-means clustering algorithm is 3FPS ​​higher than that of the K-means detection performance, the average detection accuracy is increased by 1.1%, the recall rate is increased by 0.18%, the precision rate is increased by 1%, and the false detection rate is reduced by 0.08%.

[0137] Table 6 Impact of WK-means on the algorithm

[0138]

[0139] In summary, the YOLOv4-GhostNet-SE-Adam-step-WK-means model proposed in the present invention has a good detection effect on foreign objects in the material conveying lanes of cigarette factories. The detection speed of the algorithm of the present invention reaches 58FPS, the average detection accuracy is 98.48%, and the false detection rate is 0.62%.

[0140] In order to further study and verify the generalization ability of the model of the present invention, the model of the present invention is trained on the VOC2007 dataset and the COCO2017 dataset, and the detection results are shown in Table 7.

[0141] Table 7 Detection results of the proposed model on VOC and COCO datasets

[0142]

[0143]

[0144] As can be seen from Table 7, the detection accuracy of the model of the present invention for the VOC2007 and COCO2017 datasets is more than 90%, the detection speed is 48FPS and 52FPS respectively, and the false detection rate is 3.15% and 2.93% respectively, indicating that the model of the present invention also has good detection performance on the VOC2007 and COCO2017 datasets and has good generalization ability.

[0145] In summary, the present invention aims at the real-time and accuracy problems of foreign body detection in the material conveying lanes of cigarette factories, and proposes a visual detection method with an improved YOLOv4 model. The following conclusions are drawn:

[0146] (1) The anchor frames are optimized using the WK-means clustering algorithm, which can remove some anchor frames that are not suitable for foreign object detection in the lanes of cigarette factories and improve the detection speed of targets.

[0147] (2) The SE attention mechanism is used to integrate the GhostNet feature extraction network, which greatly reduces the number of model parameters and improves the detection speed and accuracy of the model.

[0148] (3) The Adam optimization algorithm and the learning rate equal-interval adjustment strategy are used to quickly and accurately find the global optimal solution, which improves the detection accuracy and speed of the model and reduces the false detection rate of the model.

[0149] Experiments show that the model of the present invention has an average accuracy improvement of 4.61% and a detection speed improvement of 26.59FPS compared to the YOLOv4 model, and has good generalization ability. Compared with the commonly used lightweight feature extraction network, the model of the present invention has shown strong superiority, and has achieved accurate detection of foreign objects in the material conveying lanes of the cigarette factory, providing a reliable guarantee for the safe operation of the material conveying shuttle.

[0150] The above shows and describes the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The above embodiments and descriptions only describe the principles of the present invention. The present invention may be subject to various changes and improvements without departing from the spirit and scope of the present invention. These changes and improvements fall within the scope of the present invention. The scope of protection claimed by the present invention is defined by the attached claims and their equivalents.

Claims

1. A visual detection method for foreign matter in material conveying lanes, It is characterized in that The steps include: S1. In order to enrich the feature information of the feature map, the SE attention module is fused with GhostNet for feature extraction, ensuring the robustness of foreign body feature extraction while increasing the weight of foreign body features; In S1, the material conveying tunnel image is firstly passed through GhostNet to obtain the feature layer X, and the number of image channels, image height and image width are set to c, h and w respectively; Perform traditional convolution to obtain the feature layer Y, set the number of image channels, image height and image width to c 1 , h and w, and then the feature layer Y is squeezed and excitation operated through the SE attention module: Perform global average pooling on the feature layer Y to convert the h×w feature layer into a 1×1 feature layer; The 1×1 feature layer passes through two fully connected layers to obtain the weights of different channels. Finally, sigmoid is used to normalize the weight information to obtain the channel weights. The channel weights are respectively compared with the c 1 Multiply the channel feature map data to get the new c 1 ×h×w feature layer; S2. Use SE attention module to improve the feature maps of 19×19, 38×38 and 76×76 in GhostNet network and fuse them with the feature maps sampled and output on the feature extraction network to obtain the feature layer of the final detection model. S3, using the improved Adam adaptive gradient descent algorithm to optimize the YOLOv4 model; S4. Based on the Adam algorithm, the learning rate equal interval adjustment strategy is introduced to speed up the update speed of model parameters, thereby improving the early convergence speed of the Adam algorithm and the detection accuracy of the model; S5. Use the WK-means clustering algorithm to perform weighted clustering on the anchor frame, assign an initial weight value to each feature dimension, and wait until the objective function converges and the weight corresponding to the non-target detection area tends to 0, thereby reducing the impact of the non-target area on the foreign body target in the lane and improving the detection accuracy of foreign bodies; In S5, the objective function of the WK-means clustering algorithm is: And all weights should obey: Where A represents the cluster allocation matrix: C represents the cluster center matrix: W is the weight matrix: in Represents the sum of the distances of all sample points in the jth dimension.

2. A visual detection method for foreign matter in a material conveying tunnel according to claim 1, It is characterized in that In S3, the Adam optimization algorithm adaptively adjusts the model parameters by calculating the descent gradient of the model itself. The algorithm is as follows: First, the first-order and second-order moment estimates are calculated. and The decaying average of: First moment estimate: Second moment estimate: Among them, β 1 , β 2 are the exponential decay rates of the first-order and second-order moment estimates, d y is the gradient; Then, the deviation is corrected according to the calculated attenuated average value. By calculating the deviation, the first-order and second-order moment estimates are corrected. The corrected deviations are: Parameter update: Among them, y i ,y i+1 is the model parameter vector, φ represents the learning rate, x 0 is an initial value close to 0. At the same time, in order to prevent the denominator from being 0, take x 0 =1×10 -5 .

3. A visual detection method for foreign matter in a material conveying tunnel according to claim 1, It is characterized in that In S4, the equal-interval adjustment strategy allows the learning rate to be attenuated and adjusted in an equal-interval manner as the number of iterations increases, and then the global optimal solution is obtained based on the adjusted learning rate. This can effectively reduce the oscillation of the convergence curve during the iteration process and improve the model convergence speed and stability. At the same time, in order to avoid the learning rate decaying to 0, the minimum learning rate is set to 0.00001, that is, when the learning rate is less than 0.00001 during training, the learning rate no longer decays.

4. A method for visually detecting foreign matter in a material conveying tunnel according to claim 1, It is characterized in that The detection speed, average detection accuracy, precision, recall rate and false positive rate are used as evaluation indicators, and the calculation formulas are: Among them, P i (r) is the detection accuracy of each target; TP is the number of positive samples predicted correctly by the model; TN is the number of negative samples predicted correctly by the model; FP is the number of negative samples predicted incorrectly by the model; FN is the number of positive samples predicted incorrectly by the model; and n is the detection category.

Citation Information

Patent Citations

  • Automatic Filter Pruning Technique For Convolutional Neural Networks

    US20190294929A1

  • Learning method of object detection model, and object detection device in which object detection model is executed

    WO2021085784A1