A Tangka target detection method based on improved YOLOv8
By improving the YOLOv8 network and replacing the bottleneck layer with the depth-separable-grouped convolution-SE attention module, the problem of declining accuracy of the traditional target detection algorithm in small targets and complex image processing is solved, and the accuracy of thangka target detection is improved. degree and achieved model lightweighting.
Patent Information
- Application Number
- CN202410964537.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-18
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-07-18
AI Technical Summary
Traditional target detection algorithms are ineffective when processing small targets and complex thangka images, are prone to missed detections or misdetections, and cannot fully extract texture and semantic features, resulting in a decrease in detection accuracy.
Improve the YOLOv8 network model by replacing the bottleneck layer in the feature pyramid layer with the depth separable-grouped convolution-SE attention module (DGST), and use the data set to be divided into training, verification and test sets during the training process, using letterbox Scaling, backbone network feature extraction, neck network feature fusion and detection head loss function calculation are combined with the decoupling head for classification and detection to reduce the gap between the predicted frame and the real frame.
The accuracy of Thangka target detection is improved, the model parameters are reduced, the model is lightweight, and the processing ability of complex images is enhanced.
Smart Images

Figure CN118505983B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of target detection, and in particular to a thangka target detection method based on improved YOLOv8. Background Art
[0002] With the rapid development of Internet technology and artificial intelligence technology in recent years, target detection technology has made a huge leap from traditional manual methods to today's deep learning methods. Under the impact of the fast pace and multiculturalism of modern society, thangka, as a national intangible cultural heritage, is experiencing a decline in its inheritance. At the same time, understanding and appreciating thangka requires a lot of professional knowledge, and manually labeling and explaining the various elements of each thangka is an extremely time-consuming and labor-intensive process. In view of some problems existing in the target detection network in the field of thangka image defect detection with complex background colors, traditional target detection algorithms are not effective in processing small targets, and the targets may be occluded, which is easy to miss or misdetect; due to the complexity of thangka patterns, traditional methods may not be able to fully extract texture and semantic features, resulting in a decrease in detection accuracy; therefore, these problems need to attract our attention, and some deep learning methods should be continuously improved to improve the performance of thangka target detection. Summary of the invention
[0003] Technical solution: The method for detecting thangka targets based on improved YOLOv8 described in the present invention comprises the following steps:
[0004] (1) Obtain the thangka image or video to be tested and perform preprocessing;
[0005] (2) Build an improved YOLOv8 network model, replace the bottleneck layer Bottleneck in the feature pyramid layer C2f with the deep separable-grouped convolution-SE attention module DGST; the DGST module includes: SE attention mechanism layer, grouped convolution and neural network ConvFFN module; input the image or video to be detected into the improved YOLOv8 network for training;
[0006] (3) Process the model output data to obtain the prediction results.
[0007] Furthermore, step (1) is specifically as follows: the collected data set is annotated in Yolo format by automatic labeling software X-anylabeling to create a data set, and the data set is divided into a training set, a validation set, and a test set.
[0008] Furthermore, step (2) includes the following steps:
[0009] (21) For the image to be detected, letterbox scaling is adopted to scale the image to a standard size and input it into the network for recognition;
[0010] (22) The processed image is passed into the backbone network for feature extraction. The network is divided into layers 0-9;
[0011] (23) The extracted features are input into the neck network, and the features are fused and enhanced again. The 4th and 6th layers are downsampled; the resolutions of the 4th, 6th and 9th layers are set to 80*80, 40*40 and 20*20 respectively; the 4th, 6th and 9th layers are used as the input of the dynamic anchor network PANnet structure, and after upsampling and channel fusion, the three output branches of PANet are finally sent to the detection head for loss function calculation or result solution;
[0012] (24) The enhanced and fused features are input into the head network, and the classification and detection heads are separated using the decoupled head node; the loss function formula is as follows:
[0013] ;
[0014] in, represents the coordinates of the true bounding box, Represents the coordinates of the predicted bounding box; the loss function serves as an optimization objective to guide the model to reduce the gap between the predicted box and the true box during training.
[0015] Furthermore, step (22) is as follows: the processed image is serially stacked 4 times through the convolution layer CBS and the feature pyramid improvement layer C2f_improve (DGST module), the image is convolved with the convolution kernel, and after batch normalization, the features are extracted through the activation function to obtain the tensor x; then through C2f_improve (DGST module), the input tensor x is divided into four parts along the channel dimension: x1, x2, x3, x4, among which x1, x2, x3, x4 are processed respectively: x1 remains unchanged, x2 undergoes ordinary convolution, x3 passes through the SE block, and x4 undergoes depthwise separable convolution; the processed four parts are shuffled along the channel dimension by calling the channel_shuffle function to shuffle the spliced channels, and finally processed through the ConvFFN module and returned as output; the extracted features are passed through the spatial feature pooling layer for feature fusion.
[0016] Furthermore, step (3) is as follows: the output result obtained by the model is firstly subjected to confidence filtering, then subjected to NMS non-maximum suppression, and finally subjected to coordinate transformation to obtain the final result.
[0017] Beneficial effects: Compared with the prior art, the present invention has the following significant advantages: by improving the YOLOv8 model, the detection accuracy is improved, the model parameters are reduced to a certain extent, and the model is lightweight. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is the overall flow chart of the present invention;
[0019] Figure 2 Schematic diagram of the improved YOLOv8 of the present invention. DETAILED DESCRIPTION
[0020] like Figure 1 As shown, the embodiment of the present invention provides a thangka target detection method based on improved YOLOv8, comprising the following steps:
[0021] (1) Obtain the thangka images or videos to be detected and perform preprocessing; specifically, use the automatic labeling software X-anylabeling to label the collected data set in Yolo format, create a data set, and divide the data set into a training set, a validation set, and a test set.
[0022] (2) If Figure 2 As shown in the figure, an improved YOLOv8 network model is constructed, and the bottleneck layer Bottleneck in the feature pyramid layer C2f is replaced by the depthwise separable-grouped convolution-SE attention module DGST (Depthwise Separable-Grouped Convolution-SE Attention Module); wherein the DGST module includes: SE attention mechanism layer, grouped convolution and neural network ConvFFN module; the picture or video to be detected is input into the improved YOLOv8 network for training. The following steps are included:
[0023] (21) For the image to be detected, letterbox scaling is adopted to scale the image to a standard size and input it into the network for recognition;
[0024] (22) The processed image is passed to the backbone network for feature extraction, where the network is divided into layers 0-9; specifically, the processed image is serially stacked four times through the convolution layer CBS and the feature pyramid improvement layer C2f_improve (DGST module), the image is convolved with the convolution kernel, and after batch normalization, the features are extracted through the activation function to obtain the tensor x; then through C2f_improve (DGST module), the input tensor x is divided into four parts along the channel dimension: x1, x2, x3, x4, where x1, x2, x3, x4 are processed separately: x1 remains unchanged, x2 undergoes ordinary convolution, x3 passes through the SE block, and x4 undergoes depthwise separable convolution; the processed four parts are shuffled along the channel dimension by calling the channel_shuffle function to shuffle the spliced channels, and finally processed through the ConvFFN module and returned as the output; the extracted features are passed through the spatial feature pooling layer for feature fusion.
[0025] (23) The extracted features are input into the neck network, and the features are fused and enhanced again. The 4th and 6th layers are downsampled. The resolutions of the 4th, 6th and 9th layers are set to 80*80, 40*40 and 20*20 respectively. The 4th, 6th and 9th layers are used as the input of the dynamic anchor network PANnet structure. After upsampling and channel fusion, the three output branches of PANet are finally sent to the detection head for loss function calculation or result solution.
[0026] (24) The enhanced and fused features are input into the head network, and the classification and detection heads are separated using the decoupled head node; the loss function formula is as follows:
[0027] ;
[0028] in, represents the coordinates of the true bounding box, Represents the coordinates of the predicted bounding box; the loss function serves as an optimization objective to guide the model to reduce the gap between the predicted box and the true box during training.
[0029] (3) Process the model output data to obtain the prediction results. Specifically, the output results obtained by the model are firstly subjected to confidence filtering, then subjected to NMS non-maximum suppression, and finally subjected to coordinate transformation to obtain the final result.
Claims
1. A Tangka target detection method based on improved YOLOv8, characterized in that: The following steps are involved: (1) Obtain the thangka image or video to be tested and perform preprocessing; (2) Construct an improved YOLOv8 network model, replace the bottleneck layer Bottleneck in the feature pyramid layer C2f with the deep separable-grouped convolution-SE attention module DGST; the DGST module includes: SE attention mechanism layer, grouped convolution and neural network ConvFFN module; input the image or video to be detected into the improved YOLOv8 network for training; the following steps are included: (21) Use letterbox to scale the image to be detected, scale it to the standard size, and then input it into the network for recognition; (22) The processed image is passed into the backbone network for feature extraction, where the network is divided into layers 0-9; specifically, the processed image is serially stacked four times through the convolution layer CBS and the feature pyramid improvement layer C2f_improve, the image is convolved with the convolution kernel, and after batch normalization, the features are extracted through the activation function to obtain the tensor x; then through C2f_improve, the input tensor x is divided into four parts along the channel dimension: x1, x2, x3, x4, where x1, x2, x3, x4 are processed separately: x1 remains unchanged, x2 undergoes ordinary convolution, x3 undergoes SE block, and x4 undergoes depthwise separable convolution; the processed four parts are shuffled along the channel dimension by calling the channel_shuffle function to shuffle the spliced channels, and finally processed through the ConvFFN module and returned as output; the extracted features are passed through the spatial feature pooling layer for feature fusion; (23) The extracted features are input into the neck network, and the features are fused and enhanced again. The 4th and 6th layers are downsampled; the resolutions of the 4th, 6th and 9th layers are set to 80*80, 40*40 and 20*20 respectively; the 4th, 6th and 9th layers are used as the input of the dynamic anchor network PANnet structure, and after upsampling and channel fusion, the three output branches of PANet are finally sent to the detection head for loss function calculation or result solution; (24) The enhanced and fused features are input into the head network, and the classification and detection heads are separated using the decoupled head node; the loss function formula is as follows: ; in, represents the coordinates of the true bounding box, Represents the coordinates of the predicted bounding box; (3) Process the model output data to obtain the prediction results.
2. According to claim 1, a Tangka target detection method based on improved YOLOv8 is characterized in that: Step (1) is as follows: Use the automatic labeling software X-anylabeling to label the collected data set in Yolo format, create a data set, and divide the data set into a training set, a validation set, and a test set.
3. According to a method for thangka target detection based on improved YOLOv8 according to claim 1, it is characterized in that: Step (3) is as follows: the output result obtained by the model is firstly subjected to confidence filtering, then subjected to NMS non-maximum suppression, and finally subjected to coordinate transformation to obtain the final result.
Citation Information
Patent Citations
Target detection method, terminal equipment and storage medium
CN114418064A
Lightweight infrared target detection algorithm based on improved YOLOv8
CN117636111A
