Foreign object target detection ST-YOLOv8 method for mining belt conveyor

By using Swin Transformer and BiFPN models to replace the backbone network and feature fusion structure of YOLOv8 in the detection of foreign objects on coal conveying belts in coal mines, combined with the GELU activation function and multiple loss functions, the problem of poor accuracy of existing detection methods is solved and a higher level is achieved. detection performance and stability.

CN118570536APending Publication Date: 2024-08-30XIAN UNIV OF TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410690105.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-30
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

The accuracy of the existing foreign matter detection methods on coal conveying belts in coal mines is poor, affected by factors such as coal dust interference and uneven lighting conditions, and cannot meet actual needs.

Method used

Using the improved ST-YOLOv8 method, by replacing the backbone network of the YOLOv8 model from DarkNet-53 to the Swin Transformer module, combined with the pre-trained BiFPN model, and using the GELU activation function and multi-loss function strategy in the Neck layer, target detection is performed .

Benefits of technology

Significantly improves the network's representation ability and detection performance of targets, enhances the accuracy and generalization ability of target detection at different scales, reduces the complexity of attention calculations, alleviates the vanishing gradient problem, and improves the training stability of the model and detection performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118570536A
    Figure CN118570536A
Patent Text Reader

Abstract

The invention discloses a mining belt conveyor foreign matter target detection ST-YOLOV8 method, and the method comprises the specific steps: 1, obtaining an image of a conveyor conveying coal mine, carrying out the manual foreign matter marking, obtaining a data set, and dividing the data set into a training set, a verification set, and a test set; step 2, constructing an improved YOLOv8 model; step 3, setting a loss function; and step 4, training the improved YOLOv8 model by adopting the training set to obtain a trained and improved YOLOv8 model, and performing test verification on the trained and improved YOLOv8 model by using the verification set or the test set. According to the method, the target representation capability of the network is effectively improved, the accuracy of the network in detection of different scales of targets is improved, and the detection performance and generalization capability are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of computer image processing, and in particular relates to an ST-YOLOv8 method for detecting foreign matter targets in a mining belt conveyor. Background Art

[0002] In the field of coal mine transportation, coal conveyor belts are one of the important equipment in coal mine production, responsible for transporting mined coal from mines to related processing facilities. However, due to the complexity of the operating environment of coal mine conveyor belts, foreign matter is often mixed in. The presence of these foreign objects not only causes damage to coal mine equipment, such as abnormal belt sound, belt deviation, conveyor slippage, belt breakage, etc., but may also cause production accidents and pose a threat to the safety of miners and equipment. Traditional foreign body detection methods, such as manual detection, sensor technology, radar detection, ray method and rule-based image processing, are currently the most commonly used method. Image processing methods, but existing image processing technologies are restricted by factors such as coal dust interference and uneven lighting conditions, resulting in poor detection accuracy and unable to meet actual needs. In this context, coal mine conveyor belt foreign body detection based on deep learning provides a new idea for solving the limitations of traditional methods. Summary of the invention

[0003] The purpose of the present invention is to provide a ST-YOLOv8 method for detecting foreign matter targets in a mining belt conveyor, so as to solve the problem of poor monitoring accuracy in the existing methods.

[0004] The technical solution adopted by the present invention is the ST-YOLOv8 method for detecting foreign body targets in a mining belt conveyor, which is specifically implemented according to the following steps:

[0005] Step 1, obtain images of coal transported by conveyors, manually annotate foreign objects to obtain a data set, and divide the data set into a training set, a validation set, and a test set;

[0006] Step 2, build an improved YOLOv8 model;

[0007] Step 3, set the loss function;

[0008] Step 4: Use the training set to train the improved YOLOv8 model to obtain the trained improved YOLOv8 model, and use the validation set or the test set to test and verify the trained improved YOLOv8 model.

[0009] The present invention is also characterized in that:

[0010] The specific process of step 2 is:

[0011] Step 2.1, replace the backbone network DarkNet-53 in the backbone module of the original YOLOv8 model with the Swin Transformer module, and specify the input image size as H*W and the number of input image channels as 3;

[0012] Step 2.2, download the pre-trained BiFPN model, and make the output size and number of channels of the pre-trained BiFPN model compatible with the Neck part of the original YOLOv8 model;

[0013] Step 2.3, replace the FPN+PAN structure of the Neck layer of the original YOLOv8 model with the pre-trained BiFPN model downloaded in step 2.2, and connect the feature map obtained in step 2.1 with the subsequent feature map by using the 40x40 feature map formed by 16-fold downsampling, and introduce additional weights for each feature through the weighted feature fusion method;

[0014] In step 2.4, the RELU activation function of the CSP module in the Neck layer of the original YOLOv8 model is replaced with the GELU function to obtain the improved YOLOv8 model.

[0015] In step 2.3, the value range of each weight must be limited to between 0 and 1, and the expression is:

[0016]

[0017] In formula (6), I b represents the input feature, ω b Indicates the size of the weight that can be learned, ω j represents the learnable weights of different input features, and ε is a constant.

[0018] In step 3, the loss function uses the cross entropy loss function to calculate the classification loss, the square loss function to calculate the positioning loss, and the binary cross entropy loss function to calculate the confidence loss.

[0019] The expression for calculating the classification loss using the cross entropy loss function is:

[0020]

[0021] In formula (12), N obj is the number of grids containing the target in the image, S is the number of grids, C is the number of categories, is an indicator function indicating whether the d-th category of the c-th grid contains the target. is the probability of the dth category of the cth grid predicted by the model.

[0022] The expression for calculating the positioning loss using the square loss function is:

[0023]

[0024] In formula (13), is the center coordinate of the fth bounding box of the eth grid predicted by the model, is the width of the fth bounding box of the eth grid predicted by the model, is the height of the fth bounding box of the eth grid predicted by the model, are the center coordinates of the ground-truth bounding box, is the width of the ground-truth bounding box, is the height of the ground-truth bounding box, λ coord is the weight of the positioning loss, and F is the number of bounding boxes predicted for each grid.

[0025] The expression for calculating the confidence loss using the binary cross entropy loss function is:

[0026]

[0027] In formula (14), is the confidence of the fth bounding box of the eth grid predicted by the model, is the true label, Whether the fth bounding box of the eth grid contains the target, is whether the fth bounding box of the eth grid does not contain the target, λ noobj is the weight of the confidence loss of the grid where the target is not detected, N noobj is the number of cells in the image that do not contain the target.

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

[0029] (1) The ST-YOLOv8 method for detecting foreign bodies in mining belt conveyors of the present invention uses the Swin Transformer model to replace the backbone network DarkNet-53 in the original YOLOv8 model, effectively constructs a hierarchical feature map, reduces the original attention calculation complexity, and can capture the details and global information of the image at different levels, effectively improving the network's ability to represent the target;

[0030] (2) The ST-YOLOv8 method for detecting foreign bodies in mining belt conveyors of the present invention adopts the BiFPN model to replace the FPN+PAN structure in the original YOLOv8 model, which can better retain the semantic information of the features during the feature fusion process, thereby improving the accuracy of the network in detecting targets of different scales;

[0031] (3) The ST-YOLOv8 method for detecting foreign bodies in mining belt conveyors of the present invention replaces the RELU activation function of the CSP module in the original YOLOv8 model with the GELU function, which helps to alleviate the gradient vanishing problem and improves the training stability and convergence speed of the model. It adopts a multi-loss function strategy for training and comprehensively considers the losses in classification, positioning, and confidence prediction, making the model more comprehensive and superior in target detection tasks, and significantly improving the detection performance and generalization ability. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 This is a network architecture diagram of the Swin Transformer module in the ST-YOLOv8 method for detecting foreign matter targets in a mining belt conveyor of the present invention;

[0033] Figure 2 It is a structural diagram of Swin TransformerBlock in the ST-YOLOv8 method for detecting foreign matter targets in a mining belt conveyor of the present invention;

[0034] Figure 3 A conventional window partitioning strategy is used for the SW-MSA layer and the W-MSA layer in the ST-YOLOv8 method for detecting foreign matter targets in a mining belt conveyor according to the present invention. DETAILED DESCRIPTION

[0035] The present invention is described in detail below with reference to the accompanying drawings and specific embodiments.

[0036] Example 1

[0037] The ST-YOLOv8 method for detecting foreign matter targets in a mining belt conveyor of the present invention is specifically implemented according to the following steps:

[0038] Step 1, obtain images of coal transported by conveyors, manually annotate foreign objects to obtain a data set, and divide the data set into a training set, a validation set, and a test set;

[0039] Step 2, build an improved YOLOv8 model;

[0040] Step 3, set the loss function;

[0041] Step 4: Use the training set to train the improved YOLOv8 model to obtain the trained improved YOLOv8 model, and use the validation set or the test set to test and verify the trained improved YOLOv8 model.

[0042] Example 2

[0043] The ST-YOLOv8 method for detecting foreign matter targets in a mining belt conveyor of the present invention, the specific process of the improved YOLOv8 model constructed in step 2 is:

[0044] Step 2.1, replace the backbone network DarkNet-53 in the backbone module of the original YOLOv8 model with the Swin Transformer module, and specify the input image size as H*W and the number of input image channels as 3;

[0045] In the original YOLOv8 model, the backbone module uses the DarkNet-53 network structure. DarkNet-53 uses a convolutional structure to extract features. The convolutional structure is translation invariant and is insensitive to the global position of the feature. It can only extract a small part of the local information. The Swin Transformer module uses an attention mechanism. In the process of attention calculation, it considers global information and expands the receptive field. The Swin Transformer module is similar to DarkNet-53 in structure.

[0046] The network architecture of the Swin Transformer module is as follows Figure 1 As shown in the figure, it consists of a Patch Partition layer and four Swin-Transformer block groups, and the four Swin-Transformer block groups are denoted as: C1, C2, C3 and C4; among them, C1 is composed of a Linear Embedding layer and two Swin Transformer Blocks in sequence; C2 is composed of a PatchMerging layer and two Swin Transformer Blocks in sequence; C3 is composed of a Patch Merging layer and six Swin Transformer Blocks in sequence; C4 is composed of a Patch Merging layer and two Swin Transformer Blocks in sequence; the downsampling multiples corresponding to C1, C2, C3 and C4 are [4,8,16,32];

[0047] The process of Swin Transformer module graph processing is as follows: input image (image of coal mine transported by conveyor) (H, W, 3), 4x4 patch partitioning is performed through Patch Partition layer, and the image data dimension is converted to (H / 4, W / 4, 48), and then transformed through Linear Embedding layer, the number of channels is doubled, and the image dimension becomes (H / 4, W / 4, 96). Subsequently, each Patch Merging layer in C2, C3 and C4 divides the input feature map into 2x2 patches and doubles the number of channels of the feature map to achieve downsampling of the feature map. The dimensions of the feature map become (H / 8, W / 8, 192), (H / 16, W / 16, 384) and (H / 32, W / 32, 768) respectively; in C1, a 7x7 window is used to calculate multi-head self-attention and extract image features. The output feature map dimension remains unchanged, which is (H / 4, W / 4, 96). The Swin of C2, C3 and C4 Transformer Block is only used to extract image data features and does not change the dimension of the feature map.

[0048] Swin Transformer Block is the main module for feature extraction, and its structure is as follows Figure 2 As shown, for the input feature X i , perform Layer Norm to standardize LN(X i ), and then calculate the window attention W-MSA(LN(X i )), and then add it to the residual structure to get the intermediate result of this layer. The expression of the result is shown in formula (1):

[0049]

[0050] Standardize again Finally, the fully connected layer The output of this layer is obtained by superimposing the residual structure. The output expression is shown in formula (2):

[0051]

[0052] In the above expression, i refers to a specific layer or a specific Swin Transformer Block in the Swin Transformer module. In a multi-layer Swin Transformer, there are usually multiple Swin Transformer Blocks, each of which processes the input features and generates intermediate results. Here, i represents the i-th or i-th layer in these Swin Transformer Blocks, which is used to indicate the difference between different layers.

[0053] The W-MSA layer and SW-MSA layer in the Swin Transformer Block use the conventional window partitioning strategy, such as Figure 3 As shown, for each individual window tile vector, a linear transformation is performed in the channel dimension to double the number of channels and split it into h subspaces in the feature dimension (h is the number of attention heads), through h different parameter matrices W Q , W K , W V , linearly transform the query Q (Query), key K (Key) and weight V (Value) of each pixel in h subspaces, and perform scaled dot product attention calculation; then, the h calculation results are passed through the learnable weight matrix W O Splicing and fusion are performed to integrate the feature information learned from different subspaces to obtain Multi-head self-attention features; among them, the scaled dot product attention calculation result of the a-th attention head is head a The expression of is shown in formula (3):

[0054]

[0055] In formula (3), are the ath parameter matrix W Q , W K , W V ,Attention() is a normalized scaled dot product model, and its expression is shown in formula (4):

[0056]

[0057] In formula (4), QK T The dot product is used to calculate the similarity between different features. It is the process of information interaction between different features. is a scaling operation that ensures the stability of the gradient, d is the dimension of the vector, also known as the query and key dimension, which is usually equal to the dimension of each head; B is the attention bias term (Bias), which is used to adjust the attention weight, and M is the number of attention heads, indicating how many heads the attention mechanism is divided into for parallel calculation;

[0058] The feature concatenation and fusion expression of the Mulit-head self-attention mechanism is shown in formula (5):

[0059] MultiHead(Q,K,V)=Concat(head 1 ,…,head h )W O (5)

[0060] In formula (5), Q is the query vector (Query), K is the key vector (Key), and V is the value vector (Value).

[0061] Step 2.2, download the pre-trained BiFPN model, and make the output size and number of channels of the pre-trained BiFPN model compatible with the Neck part of the original YOLOv8 model;

[0062] Step 2.3, replace the FPN+PAN structure of the Neck layer of the original YOLOv8 model with the pre-trained BiFPN model downloaded in step 2.2, and connect the 40x40 feature map formed by 16-fold downsampling of the feature map obtained in step 2.1 with the subsequent feature maps to fully extract the position information, reduce the loss of feature information, and enhance the network's detection ability for small targets. By using the weighted feature fusion method, additional weights are introduced for each feature, and the fast normalization fusion formula (6) is used to limit the value range of each weight to between 0 and 1, thereby improving the model's computing speed on the GPU;

[0063]

[0064] In formula (6), I b represents the input feature, ω b Current input feature I b The learnable weights, ω j Represents the learnable weights of different input features, ε is a very small constant used to avoid the denominator being zero;

[0065] Output feature maps after multiple feature fusions and updates. These feature maps contain information from different scales and levels, and have richer semantic information and better spatial resolution.

[0066] The feature fusion layer of the original YOLOV8 model uses the PANet structure, which has a large number of network parameters. It is replaced by the BiFPN bidirectional feature pyramid network (BiFPN model), which enhances the network's information extraction ability and enables the network to more effectively integrate low-level location information and high-level semantic information, thereby further improving the target detection performance. Compared with the PANet structure in the Neck layer of the YOLOV8 model, BiFPN not only superimposes channels, but also considers weight information and realizes bidirectional cross-scale feature fusion at the same time;

[0067] Step 2.4, replace the RELU activation function of the CSP module in the Neck layer of the original YOLOv8 model with the GELU function to obtain the improved YOLOv8 model;

[0068] In order to bring better convergence and stability during training, and possibly improve the performance and generalization of the model on test data, we replace the RELU activation function of the CSP module with the GELU function;

[0069] The formula for the ReLU activation function is:

[0070] f(x)=max(0,x) (7)

[0071] When the input x is greater than zero, the derivative of the ReLU activation function is a constant 1, that is:

[0072]

[0073] Therefore, when the input function gradient is too large, that is, when the value of x is large, the derivative of the ReLU activation function always remains at 1, which will cause the output of the neuron to remain activated after the parameters are updated and will not be affected by the gradient, thus losing the activation function.

[0074] The GELU function is the abbreviation of Gaussian Error Linear Unit, and its mathematical expression is shown in formula (9):

[0075]

[0076] When the absolute value of the input data x is small, the GELU function behaves like a linear function. When |x| approaches zero, the value of the hyperbolic tangent function tan(x) also approaches zero; therefore, the GELU function can be approximately expressed as:

[0077]

[0078] This means that when the absolute value of the input data is small, the change trend of the GELU function is mainly determined by the input x linearly, and is not affected by the nonlinearity of the hyperbolic tangent function. This approximate linearity makes it easier for the neural network to learn linear relationships during training, which helps to improve the convergence speed of the model because linear relationships are easier to be learned and fitted by the neural network.

[0079] When the input data x is close to zero, x and x 3 The values ​​are very small, so 0.044715x 3 is approximately zero, then the GELU function can be approximated as:

[0080]

[0081] Due to the property of the tan function as it approaches zero, lim x→0 tan(x) = 0, so when x approaches zero, The value of is also close to zero, so the output of the GELU function when the input data is close to zero is mainly composed of This normalization property helps to avoid the gradient explosion and gradient disappearance problems and maintains the stability of the gradient.

[0082] Example 3

[0083] The ST-YOLOV8 method for detecting foreign matter targets in a mining belt conveyor of the present invention, the specific process of setting the loss function in step 3 is:

[0084] (1) Use the cross entropy loss function to calculate the classification loss, which is used to measure the classification accuracy of the model for the target category;

[0085] Suppose there are C categories. For each target box, its predicted category probability needs to be compared with the true category probability, and the cross entropy loss is calculated. The expression is:

[0086]

[0087] In formula (12), N obj is the number of grids containing the target in the image, S is the number of grids, C is the number of categories, is an indicator function indicating whether the d-th category of the c-th grid contains the target. is the probability of the dth category of the cth grid predicted by the model;

[0088] (2) Use the square loss function to calculate the positioning loss, which is used to measure the model's prediction accuracy of the target location;

[0089] Assume that each grid predicts F bounding boxes. For each target box, its predicted bounding box needs to be compared with the true bounding box and the positioning loss is calculated. The expression is:

[0090]

[0091] In formula (13), is the center coordinate of the fth bounding box of the eth grid predicted by the model, is the width of the fth bounding box of the eth grid predicted by the model, is the height of the fth bounding box of the eth grid predicted by the model, are the center coordinates of the ground-truth bounding box, is the width of the ground-truth bounding box, is the height of the ground-truth bounding box, λ coord is the weight of the positioning loss;

[0092] (3) Use the binary cross entropy loss function to calculate the confidence loss, which is used to measure the model's prediction accuracy on whether the target exists;

[0093] Assume that each grid predicts F bounding boxes. For each bounding box, it is necessary to compare its predicted confidence with the true label and calculate the confidence loss, which is expressed as:

[0094]

[0095] In formula (14), is the confidence of the fth bounding box of the eth grid predicted by the model, is the true label, Whether the fth bounding box of the eth grid contains the target, is whether the fth bounding box of the eth grid does not contain the target, λ noobj is the weight of the confidence loss of the grid where the target is not detected, N noobj is the number of grids in the image that do not contain the target;

[0096] The ST-YOLOV8 method for detecting foreign bodies in a mining belt conveyor of the present invention uses a Swin Transformer model to replace the backbone network DarkNet-53 in the original YOLOV8 model; the Swin Transformer model is a groundbreaking visual transformer model, which mainly calculates the attention between pixels in the form of a displacement window, effectively constructs a hierarchical feature map, reduces the original attention calculation complexity, and can also capture the details and global information of the image at different levels; at the same time, when performing feature fusion, the PAN+FPN structure of the Neck part in the original YOLOV8 model is improved, and the size of the network structure can be adjusted automatically while reducing the calculation complexity, achieving a certain lightweight effect. The RELU activation function of the Neck layer in the original YOLOV8 model is replaced with a GELU function to solve the problem that when the input function gradient is too large, it is easy to cause the neuron to no longer have an activation function after the parameter is updated.

Claims

1. The ST-YOLOv8 method for detecting foreign bodies in mining belt conveyors is characterized by: Follow the steps below to implement it: Step 1, obtain images of coal transported by conveyors, manually annotate foreign objects to obtain a data set, and divide the data set into a training set, a validation set, and a test set; Step 2, build an improved YOLOv8 model; Step 3, set the loss function; Step 4: Use the training set to train the improved YOLOv8 model to obtain the trained improved YOLOv8 model, and use the validation set or the test set to test and verify the trained improved YOLOv8 model.

2. The ST-YOLOv8 method for detecting foreign matter targets in a mining belt conveyor according to claim 1 is characterized in that: The specific process of step 2 is: Step 2.1, replace the backbone network DarkNet-53 in the backbone module of the original YOLOv8 model with the SwinTransformer module, and specify the input image size as H*W and the number of input image channels as 3; Step 2.2, download the pre-trained BiFPN model, and make the output size and number of channels of the pre-trained BiFPN model compatible with the Neck part of the original YOLOv8 model; Step 2.3, replace the FPN+PAN structure of the Neck layer of the original YOLOv8 model with the pre-trained BiFPN model downloaded in step 2.2, and connect the feature map obtained in step 2.1 with the subsequent feature map by using the 40x40 feature map formed by 16-fold downsampling, and introduce additional weights for each feature through the weighted feature fusion method; In step 2.4, the RELU activation function of the CSP module in the Neck layer of the original YOLOv8 model is replaced with the GELU function to obtain the improved YOLOv8 model.

3. The ST-YOLOv8 method for detecting foreign matter targets in a mining belt conveyor according to claim 2 is characterized in that: In step 2.3, the value range of each weight must be limited to between 0 and 1, and the expression is: In formula (6), I b represents the input feature, ω b Indicates the size of the weight that can be learned, ω j represents the learnable weights of different input features, and ε is a constant.

4. The ST-YOLOv8 method for detecting foreign matter targets in a mining belt conveyor according to claim 1 is characterized in that: In step 3, the loss function uses the cross entropy loss function to calculate the classification loss, the square loss function to calculate the positioning loss, and the binary cross entropy loss function to calculate the confidence loss.

5. The ST-YOLOv8 method for detecting foreign matter targets in a mining belt conveyor according to claim 4 is characterized in that: The expression for calculating the classification loss using the cross entropy loss function is: In formula (12), N obj is the number of grids containing the target in the image, S is the number of grids, C is the number of categories, is an indicator function indicating whether the d-th category of the c-th grid contains the target. is the probability of the dth category of the cth grid predicted by the model.

6. The ST-YOLOv8 method for detecting foreign matter targets in a mining belt conveyor according to claim 4 is characterized in that: The expression for calculating the positioning loss using the square loss function is: In formula (13), is the center coordinate of the fth bounding box of the eth grid predicted by the model, is the width of the fth bounding box of the eth grid predicted by the model, is the height of the fth bounding box of the eth grid predicted by the model, are the center coordinates of the ground-truth bounding box, is the width of the ground-truth bounding box, is the height of the ground-truth bounding box, λ coord is the weight of the positioning loss, and F is the number of bounding boxes predicted for each grid.

7. The ST-YOLOv8 method for detecting foreign matter targets in a mining belt conveyor according to claim 4 is characterized in that: The expression for calculating the confidence loss using the binary cross entropy loss function is: In formula (14), is the confidence of the fth bounding box of the eth grid predicted by the model, is the true label, Whether the fth bounding box of the eth grid contains the target, is whether the fth bounding box of the eth grid does not contain the target, λ noobj is the weight of the confidence loss of the grid where the target is not detected, N noobj is the number of cells in the image that do not contain the target.

Citation Information

Cited By

  • Training method and device for foreign matter classification model of coal conveying belt

    CN120656014A