Lightweight target detection method and system based on improved YOLOv8
By building a SHM-YOLO model with interference data sets and introducing attention mechanism modules, the problem of small and medium-sized object detection of tower crane top monitoring equipment is solved, the detection accuracy and model lightweight characteristics are improved in severe weather conditions, and it is suitable for tower crane environments.
Patent Information
- Application Number
- CN202411417998.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-11
- Publication Date
- 2025-01-17
- Estimated Expiration
- 2044-10-11
AI Technical Summary
The existing object detection model is difficult to effectively detect small targets and accurately identify personnel positions in images collected by the top monitoring equipment of the tower set. Due to the low image resolution, complex background, many interference factors and uneven sample The problem.
By constructing the interference data set, introducing Gaussian noise and other interference factors, a lightweight object detection model SHM-YOLO is established, and the HWD convolution module and the C2f feature fusion module are used to combine the attention mechanism module SEAM, and the model is optimized using the Inner-MPDIoU loss function. Improve detection accuracy and adaptability.
It improves the accuracy of small target detection under harsh conditions and the lightweight feature of the model, enhances the target detection capability in the tower crane environment, and is suitable for the practical application of tower crane top monitoring equipment.
Smart Images

Figure CN119323668A_ABST
Abstract
Description
Technical Field
[0001] This document relates to the field of target detection technology, and in particular to a lightweight target detection method and system based on improved YOLOv8. Background Art
[0002] Construction sites are prone to accidents. As a large-scale mechanical equipment, workers often encounter hook collisions when working around tower cranes, which can lead to accidents. Multiple tower cranes may also collide with each other due to scheduling issues, affecting the safety of workers at the bottom. These phenomena are more likely to occur in sudden severe rain and snow weather. At the same time, the tower crane operator's work location is at the top of the equipment, which will be blocked from sight when working, making it difficult to observe whether the people at the bottom of the tower crane are in a safe working environment. The real-time images collected by the camera on the top of the tower crane are transmitted to the target detection model, and the detection results are output and visualized. The tower crane operator can grasp the position of people within the detection range in real time and promptly avoid and deal with possible safety issues.
[0003] After a long period of development, the object detection methods in computer vision have been widely used, such as the YOLO series. However, the superior performance of these networks is mostly affected by the quality of the training set. The detected targets in these data sets usually have the characteristics of a large proportion of large target objects, clear images, and simple backgrounds, so these targets are easy to detect. In real-life object detection scenarios, due to the influence of different image specifications, acquisition angles, light factors, weather factors, etc., the object detection model cannot play its original effect. The monitoring equipment on the tower crane is located in the sky, and the images captured have the characteristics of small size, low resolution, and small amount of information. For small target detection, it has few features, and it is difficult to extract favorable feature information in network training. After multiple downsampling and pooling operations, most of the feature information of small targets will be deleted, making it difficult for the model to accurately locate and identify small targets. At the same time, the image background in the construction site scene is extremely complex, and dust will make the detected image more blurred. These factors have great interference with detection. The angles and sizes of the images collected by the tower crane when it is raised and lowered and rotated are also very different, which leads to an imbalance in the samples of the detected images and increases the difficulty of detection. Sudden extreme rain and snow weather may cover the detection target due to the perspective, resulting in missed detection and false detection. In summary, for the scenario where the monitoring equipment on the top of the tower crane collects images of workers under the tower crane for target detection, the detection target is interfered and affected by multiple factors from multiple directions, and the detection difficulty is far greater than the target price detection in general scenarios, which puts higher requirements on the detection method and model. Summary of the invention
[0004] One or more embodiments of this specification provide a lightweight target detection method based on improved YOLOv8, including:
[0005] The construction workers' working images are collected through the monitoring equipment on the top of the tower crane to obtain the normal data set under normal working conditions. The interference data set is constructed by introducing interference factors. The normal data set and the interference data set are marked and classified, and divided into training set, verification set and test set according to the predetermined ratio.
[0006] A lightweight target detection model SHM-YOLO is established. The SHM-YOLO network architecture includes a backbone network Backbone, a neck network Neck, and a head network Head. The backbone network Backbone includes a combination module HWD-C2f of an HWD convolution module and a C2f feature fusion module. The neck network Neck introduces an attention mechanism module SEAM, which is combined with the HWD convolution module and the C2f feature fusion module. SEAM is placed after each C2f feature fusion module.
[0007] Set training parameters, use the training set to train the lightweight target detection model SHM-YOLO, use the Inner-MPDIoU loss function to optimize the constructed target detection model, and evaluate the target detection results through evaluation indicators;
[0008] Use the test set to test the effect of the trained target detection model.
[0009] Furthermore, the specific method of constructing the interference data set by introducing interference factors is as follows:
[0010] Gaussian noise is added to the normal data set to construct an interference data set.
[0011] Further, the HWD convolution module includes a lossless feature encoding module and a feature representation learning module;
[0012] The lossless feature encoding module is used to perform Haar wavelet transform on the input image, convert the image features and retain the image information while reducing the spatial resolution;
[0013] The feature representation learning module consists of a standard convolution layer, a batch normalization layer and a ReLU activation layer. The 1x1 convolution layer is used to process the number of channels of the feature map so that the input and output channels of the previous and next layers are consistent. The input image is further reduced through the batch normalization layer and the ReLU activation layer to reduce redundant information.
[0014] Furthermore, the attention mechanism module SEAM is specifically used for:
[0015] In the attention mechanism module SEAM, the input image first passes through the channel and spatial mixing module CSMM to adjust the channel and spatial dimensions of the image. The Patch Embedding layer can change according to the set size and number of channels, and then passes through the GELU loss function; after being processed by the BatchNorm layer, the importance of different channels is learned through deep separable convolution, important channels are retained, and irrelevant parameters are removed;
[0016] The input before depthwise separable convolution and the input after channel separation are combined through 1x1 convolution. After the input image is processed by three CSMM modules of different scales, the main channels of the occluded images in different dimensions are highlighted while compensating for the loss of details between channels. Then Average Pooling is performed to remove redundant information, and all information is fused through two fully connected layers to enhance the connection between channel information. Finally, the output of the SEAM module is used as attention and multiplied with the original feature.
[0017] Furthermore, when training the constructed target detection model, the loss function used is the MPDIoU loss function Inner-MPDIoU fused with Inner-IoU, as shown below:
[0018] L inner-MPDIoU =L MPDIoU +IoU-IoU inner .
[0019] Furthermore, the setting of training parameters includes:
[0020] Set the training round epoch = 300, batch size batch size = 16, set the network initial learning rate to 0.001, use the stochastic gradient descent (SGD) optimizer, and uniformly scale the input image size to 640×640.
[0021] Furthermore, the evaluation indicators include precision, recall rate, mAP@0.5, Params and GFLOPs; the precision is used to evaluate the ratio of positive samples correctly identified as positive samples in the recognized images. The higher the precision, the better the detection effect of the detection model; the recall rate is used to evaluate the ratio of positive samples among all samples detected as positive; the mAP is used to evaluate the average value of the average accuracy AP of multiple categories. The larger the mAP value, the better the performance of the detection model; the Params and GFLOPs are used to evaluate the lightweight characteristics of the improved model.
[0022] One or more embodiments of this specification provide a lightweight target detection system based on improved YOLOv8, including:
[0023] Data processing module: used to collect construction workers' working images through the monitoring equipment on the top of the tower crane, obtain the normal data set under normal working conditions, construct the interference data set by introducing interference factors, mark and classify the normal data set and the interference data set, and divide them into training set, verification set and test set according to the predetermined ratio;
[0024] Model building module: used to build a lightweight target detection model SHM-YOLO. The SHM-YOLO network architecture includes a backbone network Backbone, a neck network Neck, and a head network Head. The backbone network Backbone includes a combination module HWD-C2f of an HWD convolution module and a C2f feature fusion module. The neck network Neck introduces an attention mechanism module SEAM, which is combined with the HWD convolution module and the C2f feature fusion module. SEAM is placed after each C2f feature fusion module.
[0025] Model training module: used to set training parameters, use the training set to train the lightweight target detection model SHM-YOLO, use the Inner-MPDIoU loss function to optimize the constructed target detection model, and evaluate the target detection results through evaluation indicators;
[0026] Model testing module: used to test the effect of the trained target detection model using the test set.
[0027] One or more embodiments of the present specification provide an electronic device, including:
[0028] processor; and,
[0029] A memory arranged to store computer executable instructions, which, when executed, cause the processor to implement the steps of the above-mentioned lightweight target detection method based on improved YOLOv8.
[0030] One or more embodiments of the present specification provide a storage medium for storing computer-executable instructions, which, when executed, implement the steps of the above-mentioned lightweight target detection method based on improved YOLOv8.
[0031] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate one or more embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0033] Figure 1 A flowchart of a lightweight target detection method based on improved YOLOv8 provided for one or more embodiments of this specification;
[0034] Figure 2 A schematic diagram of the SHM-YOLO network structure of a lightweight target detection method based on an improved YOLOv8 provided in one or more embodiments of this specification;
[0035] Figure 3 A schematic diagram of the HWD module structure of a lightweight target detection method based on improved YOLOv8 provided in one or more embodiments of this specification;
[0036] Figure 4 A schematic diagram of the structure of a SEAM attention mechanism module of a lightweight target detection method based on an improved YOLOv8 provided in one or more embodiments of this specification;
[0037] Figure 5 A schematic diagram of the MPDIoU structure of a lightweight target detection method based on improved YOLOv8 provided in one or more embodiments of this specification;
[0038] Figure 6 A schematic diagram of the composition of a lightweight target detection system based on improved YOLOv8 provided in one or more embodiments of this specification;
[0039] Figure 7 A schematic diagram of the structure of an electronic device provided for one or more embodiments of this specification. DETAILED DESCRIPTION
[0040] In order to enable those skilled in the art to better understand the technical solutions in one or more embodiments of this specification, the following will be combined with the drawings in one or more embodiments of this specification to clearly and completely describe the technical solutions in one or more embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on one or more embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this document.
[0041] Method Embodiment
[0042] According to an embodiment of the present invention, a lightweight target detection method based on improved YOLOv8 is provided. Figure 1 A flowchart of a lightweight target detection method based on improved YOLOv8 is provided for one or more embodiments of this specification, such as Figure 1 As shown, the lightweight target detection method based on improved YOLOv8 according to an embodiment of the present invention specifically includes:
[0043] S1. Collect the working images of construction workers through the monitoring equipment on the top of the tower crane to obtain the normal data set under normal working conditions. By introducing interference factors, construct the interference data set, mark and classify the normal data set and the interference data set, and divide them into training set, verification set and test set according to the predetermined ratio.
[0044] In this embodiment, working images of construction workers in an undisturbed state under normal weather conditions are captured by the monitoring equipment on the top of the tower crane. These images represent the normal data set OP under normal working conditions. In order to simulate various interference factors that may be encountered in the real environment, such as weather changes, changes in light conditions or other external interferences, we introduced these interference factors. In this embodiment, Gaussian noise is used in the normal data set to simulate the working images captured in extreme rainy and snowy weather, and a data set containing interference factors is constructed, which is called the interference data set.
[0045] Specifically, first, add Gaussian noise with a probability percentage of 70% to the normal data set, then add Gaussian blur with a radius of 2 pixels and set the color level to 75, and finally, add dynamic blur with an angle of 70 degrees and a distance of 50 pixels to construct the interference data set RSOP. The OP data set and the RSOP data set consist of the same number of pictures, a total of 4118 pictures, and use the YOLO format to annotate and classify the data set so that the training model can recognize and understand these objects and behaviors, and divide the training set, validation set, and test set into a ratio of 8:1:1.
[0046] S2. Establish a lightweight target detection model SHM-YOLO. The SHM-YOLO network architecture includes a backbone network Backbone, a neck network Neck and a head network Head. The backbone network Backbone includes a combination module HWD-C2f of a HWD convolution module and a C2f feature fusion module. The neck network Neck introduces an attention mechanism module SEAM, which is combined with the HWD convolution module and the C2f feature fusion module. SEAM is placed after each C2f feature fusion module.
[0047] The SHM-YOLO network structure is a lightweight, high-performance target detection network based on the YOLOv8n network structure and the addition of HWD downsampling in the Haar wavelet. At the same time, the SEAM attention mechanism is introduced to further improve the detection performance, and the Inner-MPDIoU loss function is used to improve the convergence speed and detection accuracy.
[0048] The SHM-YOLO network structure is as follows Figure 2 As shown in the figure, it includes a backbone network Backbone, a neck network Neck and a head network Head. The collected image data is input into the backbone network Backbone. The backbone network includes a combination module HWD-C2f of a HWD convolution module and a C2f feature fusion module. C2, C3, C4, and C5 are output feature factor maps, and the number of output channels is 128, 256, 512, and 1024, respectively. SPPF is a spatial pyramid pooling layer for aggregating features at multiple scales. The attention mechanism module SEAM is introduced into the neck network Neck. The Attention-Neck part is an efficient aggregation network that can pay more attention to image details, including an HWD convolution module, an attention mechanism module SEAM, and a C2f feature fusion module. The attention mechanism module SEAM is placed after each C2f feature fusion module to further focus on the image details after feature fusion. The Attention-Neck part inputs 3 feature maps and outputs 3 feature maps at the same time, and the number of input and output channels remains consistent.
[0049] Haar wavelet transform is a simple and efficient vector transformation method, which can be divided into two steps: decomposition and reconstruction. Haar wavelet transform can perform lossless decomposition and reconstruction of image features at multiple scales in image processing. The more image detail features are retained in the encoder module, the more detection features can be extracted later, thereby improving the detection performance. The HWD module proposed based on Haar wavelet transform retains the original spatial feature information as much as possible while using Haar wavelet transform to increase the number of channels of feature mapping. Then, in order to reduce redundant information features, the resolution of feature mapping is reduced before convolution operation is performed on representative learning features. The structure of HWD module is as follows: Figure 3 As shown in the figure, the module mainly consists of two parts: a feature representation learning module and a lossless feature encoding module. The lossless feature encoding module uses Haar wavelet transform to convert image features and retain image information while reducing spatial resolution. The feature representation learning module consists of a standard convolutional layer, a batch normalization layer, and a ReLU activation layer. H, W, and C are the height, width, and number of channels of the image, respectively.
[0050] In the lossless feature coding module, the input image is first subjected to Haar wavelet transform. Through two decompositions and reconstructions, the image features are converted and the image information is retained while reducing the spatial resolution. Haar wavelet transform can be understood as a bandpass filter that only allows signals with frequencies close to the frequency of the wavelet basis function to pass through. The processing process is as follows: First, the average value of adjacent pixel pairs of the input image is calculated to obtain a new image with a relatively low resolution. The resolution of the new image is the original In this step, the information of the image has been partially lost. Secondly, in order to reconstruct the original image composed of original pixels from the image composed of average pixels, it is necessary to store some image detail coefficients so as to retrieve the lost information during reconstruction. The method used in this step is to divide the difference of this pixel pair by 2. Finally, the average pixel in the first step and the detail information in the second step are spliced. This is the pixel pair that contains the overall information and detail information of the image. Then repeat the first two steps, decompose the overall information again, and obtain the secondary decomposition result. In this process, images of various resolutions can be reconstructed from the recorded pixel pairs. No information is lost during the transformation process because the original image can be reconstructed from the recorded data. After the Haar wavelet transform, the image will generate low-frequency information and high-frequency information. Low-frequency information stores the contour information and approximate information of the image, which corresponds to the average value. High-frequency information stores the detail information, local information, and noise of the image, which corresponds to the difference value. Hhigh is a high-pass filter that allows high-frequency information to pass, and Hlow is a low-pass filter that allows low-frequency information to pass.
[0051] ↓2 represents the downsampling applied to the approximate component and the detail component. After the two-dimensional image is filtered twice by high-pass and low-pass filters, four components are generated. The resolution of each component becomes half of the original one, and the number of channels increases to four times the original one. The Haar wavelet transform can encode part of the information of the spatial dimension into the channel dimension without losing information.
[0052] In the feature representation learning module, the 1x1 convolution layer is used to process the number of channels of the feature map so that the input and output channels of the previous and next layers remain consistent. After the image passes through the batch normalization layer and the Relu activation layer, it can further reduce redundant information, making it easier for subsequent layers to learn features more efficiently.
[0053] like Figure 4As shown in the figure, the left side is the overall structure of the SEAM module, and the right side is CSMM (Channel and SpatialMixing Module), which is used to learn the correlation between spatial dimensions and channels. In the attention mechanism module SEAM, the input image first passes through the channel and spatial mixing module CSMM to adjust the channel and spatial dimensions of the image. The PatchEmbedding layer can change according to the set size and number of channels, and then the GELU loss function is used to enhance the fitting; after being processed by the BatchNorm layer, the importance of different channels is learned through deep separable convolution, important channels are retained, and irrelevant parameters are removed;
[0054] In order to reduce the loss of detail information, the input before the depthwise separable convolution and the input after the channel separation are combined through 1x1 convolution, so that the attention mechanism can learn the main feature information and complete detail information, that is, the main features and detail information of the occluded image. After the input image is processed by three CSMM modules of different scales, the main channels of the occluded image in different dimensions are highlighted while compensating for the loss of details between channels. Then AveragePooling is performed to remove redundant information, and then all information is fused through two fully connected layers to enhance the connection of channel information. Finally, the output of the SEAM module is used as attention and multiplied with the original feature, so that the model can handle occluded targets more effectively and is more suitable for small target detection.
[0055] In terms of SHM-YOLO's improvement ideas, because convolutional layers are everywhere in the network structure, using lighter and more efficient convolutions can effectively reduce the size of the overall network and optimize the network's performance. The Neck layer is located between the backbone network and the detection head in the overall network, and can perform feature fusion and enhancement. Adding an attention mechanism to the Neck layer can further explore the features of the detection object and help small target detection achieve better results. SHM-YOLO also optimizes the loss function, allowing network training and reasoning to have better speed and accuracy.
[0056] S3. Set the training parameters, use the training set to train the lightweight target detection model SHM-YOLO, use the Inner-MPDIoU loss function to optimize the constructed target detection model, and evaluate the target detection results through evaluation indicators.
[0057] At present, the loss function of bounding box regression (BBR) is constantly developing, but the existing IoU-based BBR-based means of accelerating convergence still stays on adding new loss terms, resulting in ignoring the limitations of IoU itself. IoU cannot be adaptively adjusted according to the performance of different detection models and different detection tasks, and does not have a certain generalization ability. Distinguishing different regression samples and using auxiliary bounding boxes of different scales to calculate losses can effectively accelerate the bounding box regression process. For high IoU samples, using smaller auxiliary bounding boxes to calculate losses can accelerate convergence, while larger auxiliary bounding boxes are suitable for low IoU samples. When the predicted box and the true box have the same aspect ratio, there is a better regression effect, but in most cases the aspect ratio is different, and the log loss function cannot achieve a good effect. MPDIoU is a metric based on intersection-over-union ratio. Inspired by the geometric characteristics of the bounding box, it uses the coordinates of the upper left corner and the lower right corner to define a unique rectangle, minimizing the distance between the upper left corner and the lower right corner of the predicted box and the true box. The calculation formula is as follows:
[0058]
[0059]
[0060] In the above formula, A and B are two arbitrary input bounding boxes, and w and h are the width and height of the input image respectively. For bounding boxes A and B, Represents the coordinates of the upper left and lower right points of A, and the same is true for the bounding box B. MPDIoU can evaluate the similarity between two bounding boxes and can better adapt to the overlapping or non-overlapping phenomenon in bounding box regression. The structure diagram of the loss function based on MPDIoU is shown in Figure 5 As shown, the blue box is the real box, the red box is the predicted box, and the calculation formula of the loss function based on MPDIoU is as follows:
[0061]
[0062]
[0063] In the above formula, the coordinates of the upper left corner and lower right corner of the real box are d 1 , d 2 is the distance between the upper left corner and the lower right corner of the real box and the predicted box, A gt is the area of the real box region, A prd is the area of the predicted box. Then the intersection β of the real box and the predicted box is calculated as follows:
[0064]
[0065]
[0066]
[0067]
[0068] In this embodiment, when training the constructed target detection model, the training round epoch is set to 300, the batch size is set to 16, the initial learning rate of the network is set to 0.001, and the stochastic gradient descent (SGD) optimizer is used. The input image size is uniformly scaled to 640×640, and the loss function used is the MPDIoU loss function Inner-MPDIoU fused with Inner-IoU. The ratio scaling factor in Inner-IoU is used to control the size of the auxiliary bounding box for calculating the loss. MPDIoU uses the coordinates of the upper left corner and the lower right corner of the rectangle to define a unique rectangle, minimizing the distance between the upper left corner and the lower right corner of the predicted box and the real box. Compared with the IoU loss, when the ratio is less than 1 and the size of the auxiliary bounding box is smaller than the actual bounding box, the effective range of regression is smaller than the IoU loss, but the absolute value of the gradient is greater than the gradient obtained from the IoU loss, which can accelerate the convergence of high IoU samples. On the contrary, when the ratio is greater than 1, the larger scale auxiliary bounding box expands the effective range of regression and has an enhanced effect on the regression of low IoU samples, as shown below:
[0069] L inner-MPDIoU =L MPDIoU +IoU-IoU inner ;
[0070] The fused Inner-MPDIoU loss function has the advantages of strong generalization adaptability, high precision improvement, and fast regression speed, which can further enhance the detection effect in small target detection.
[0071] In this embodiment, the evaluation indicators for evaluating the target detection results include precision, recall rate, mAP@0.5, Params and GFLOPs; the precision is used to evaluate the ratio of positive samples correctly identified as positive samples in the recognized images. The higher the precision, the better the detection effect of the detection model; the recall rate is used to evaluate the proportion of positive samples among all samples detected as positive; the mAP is used to evaluate the average value of the average accuracy AP of multiple categories. The larger the mAP value, the better the performance of the detection model. mAP@0.5 indicates the value of mAP when the IOU threshold is 0.5. When the IOU between the predicted box and the labeled box is greater than 0.5, the object is considered to be predicted correctly. Under this premise, the mean AP mAP is calculated; the Params and GFLOPs are used to evaluate the lightweight characteristics of the improved model. GFLOPs can measure the amount of floating-point operations, and then compare the computational complexity of different models. The larger the GFLOPs, the more complex the model, and the more data it can "throughput", which can complete complex tasks, but has greater requirements for hardware computing resources; a smaller GFLOPs value indicates that the computing requirements of the task or model are lower, which may be more efficient or lightweight. Most of the hardware equipment on the tower crane are industrial computers, single-chip microcomputers, etc., and the hardware computing level is not high, so the detection model with low GFLOPs is more suitable for use on tower crane equipment.
[0072] S4. Use the test set to test the effectiveness of the trained object detection model.
[0073] System Example
[0074] According to an embodiment of the present invention, a lightweight target detection system based on improved YOLOv8 is provided. Figure 6 A schematic diagram of the composition of a lightweight target detection system based on improved YOLOv8 provided in one or more embodiments of this specification is as follows: Figure 6 As shown, the lightweight target detection system based on improved YOLOv8 according to an embodiment of the present invention specifically includes:
[0075] Data processing module 60: used to collect working images of construction personnel through the monitoring equipment on the top of the tower crane, obtain a normal data set under normal working conditions, construct an interference data set by introducing interference factors, mark and classify the normal data set and the interference data set, and divide them into a training set, a verification set and a test set according to a predetermined ratio;
[0076] Model building module 62: used to establish a lightweight target detection model SHM-YOLO, the SHM-YOLO network architecture includes a backbone network Backbone, a neck network Neck and a head network Head, the backbone network Backbone includes a combination module HWD-C2f of an HWD convolution module and a C2f feature fusion module, the neck network Neck introduces an attention mechanism module SEAM, which is combined with the HWD convolution module and the C2f feature fusion module, and SEAM is placed after each C2f feature fusion module;
[0077] Model training module 64: used to set training parameters, train the lightweight target detection model SHM-YOLO using the training set, optimize the constructed target detection model using the Inner-MPDIoU loss function, and evaluate the target detection results through evaluation indicators;
[0078] Model testing module 66: used to test the effect of the trained target detection model using a test set.
[0079] The embodiment of the present invention is a system embodiment corresponding to the above-mentioned method embodiment. The specific operations of each module can be understood by referring to the description of the method embodiment, which will not be repeated here.
[0080] Device Example 1
[0081] An embodiment of the present invention provides an electronic device, such as Figure 7 As shown, it includes: a memory 70, a processor 72, and a computer program stored in the memory 70 and executable on the processor 72. When the computer program is executed by the processor 72, the following method steps are implemented:
[0082] S1. Collect the working images of the construction workers through the monitoring equipment on the top of the tower crane to obtain the normal data set under normal working conditions, construct the interference data set by introducing interference factors, mark and classify the normal data set and the interference data set, and divide them into training set, verification set and test set according to the predetermined ratio;
[0083] S2. Establish a lightweight target detection model SHM-YOLO. The SHM-YOLO network architecture includes a backbone network Backbone, a neck network Neck and a head network Head. The backbone network Backbone includes a combination module HWD-C2f of an HWD convolution module and a C2f feature fusion module. The neck network Neck introduces an attention mechanism module SEAM, which is combined with the HWD convolution module and the C2f feature fusion module. SEAM is placed after each C2f feature fusion module.
[0084] S3. Set training parameters, use the training set to train the lightweight target detection model SHM-YOLO, use the Inner-MPDIoU loss function to optimize the constructed target detection model, and evaluate the target detection results through evaluation indicators;
[0085] S4. Use the test set to test the effectiveness of the trained object detection model.
[0086] Device Example 2
[0087] An embodiment of the present invention provides a computer-readable storage medium, on which a program for implementing information transmission is stored. When the program is executed by the processor 72, the following method steps are implemented:
[0088] S1. Collect the working images of the construction workers through the monitoring equipment on the top of the tower crane to obtain the normal data set under normal working conditions, construct the interference data set by introducing interference factors, mark and classify the normal data set and the interference data set, and divide them into training set, verification set and test set according to the predetermined ratio;
[0089] S2. Establish a lightweight target detection model SHM-YOLO. The SHM-YOLO network architecture includes a backbone network Backbone, a neck network Neck and a head network Head. The backbone network Backbone includes a combination module HWD-C2f of an HWD convolution module and a C2f feature fusion module. The neck network Neck introduces an attention mechanism module SEAM, which is combined with the HWD convolution module and the C2f feature fusion module. SEAM is placed after each C2f feature fusion module.
[0090] S3. Set training parameters, use the training set to train the lightweight target detection model SHM-YOLO, use the Inner-MPDIoU loss function to optimize the constructed target detection model, and evaluate the target detection results through evaluation indicators;
[0091] S4. Use the test set to test the effectiveness of the trained object detection model.
[0092] The computer-readable storage medium in this embodiment includes, but is not limited to, ROM, RAM, magnetic disk or optical disk, etc.
[0093] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A lightweight target detection method based on improved YOLOv8, characterized in that: include: The construction workers' working images are collected through the monitoring equipment on the top of the tower crane to obtain the normal data set under normal working conditions. The interference data set is constructed by introducing interference factors. The normal data set and the interference data set are marked and classified, and divided into training set, verification set and test set according to the predetermined ratio. A lightweight target detection model SHM-YOLO is established. The SHM-YOLO network architecture includes a backbone network Backbone, a neck network Neck, and a head network Head. The backbone network Backbone includes a combination module HWD-C2f of an HWD convolution module and a C2f feature fusion module. The neck network Neck introduces an attention mechanism module SEAM, which is combined with the HWD convolution module and the C2f feature fusion module. SEAM is placed after each C2f feature fusion module. Set training parameters, use the training set to train the lightweight target detection model SHM-YOLO, use the Inner-MPDIoU loss function to optimize the constructed target detection model, and evaluate the target detection results through evaluation indicators; Use the test set to test the effect of the trained target detection model.
2. The method according to claim 1, characterized in that The specific method of constructing the interference data set by introducing interference factors is as follows: Gaussian noise is added to the normal data set to construct an interference data set.
3. The method according to claim 1, characterized in that The HWD convolution module includes a lossless feature encoding module and a feature representation learning module; The lossless feature encoding module is used to perform Haar wavelet transform on the input image, convert the image features and retain the image information while reducing the spatial resolution; The feature representation learning module consists of a standard convolution layer, a batch normalization layer and a ReLU activation layer. The 1x1 convolution layer is used to process the number of channels of the feature map so that the input and output channels of the previous and next layers are consistent. The input image is further reduced through the batch normalization layer and the ReLU activation layer to reduce redundant information.
4. The method according to claim 1, characterized in that: The attention mechanism module SEAM is specifically used for: In the attention mechanism module SEAM, the input image first passes through the channel and spatial mixing module CSMM to adjust the channel and spatial dimensions of the image. The Patch Embedding layer can change according to the set size and number of channels, and then passes through the GELU loss function; after being processed by the BatchNorm layer, the importance of different channels is learned through deep separable convolution, important channels are retained, and irrelevant parameters are removed; The input before depthwise separable convolution and the input after channel separation are combined through 1x1 convolution. After the input image is processed by three CSMM modules of different scales, the main channels of the occluded images in different dimensions are highlighted while compensating for the loss of details between channels. Then Average Pooling is performed to remove redundant information, and all information is fused through two fully connected layers to enhance the connection between channel information. Finally, the output of the SEAM module is used as attention and multiplied with the original feature.
5. The method according to claim 1, characterized in that When training the constructed target detection model, the loss function used is the MPDIoU loss function Inner-MPDIoU fused with Inner-IoU, as shown below: L inner-MPDIoU =L MPDIoU +IoU-IoU inner .
6. The method according to claim 1, characterized in that The setting of training parameters includes: Set the training round epoch = 300, batch size batch size = 16, set the network initial learning rate to 0.001, use the stochastic gradient descent optimizer SGD, and uniformly scale the input image size to 640×640.
7. The method according to claim 1, characterized in that The evaluation indicators include precision, recall rate, mAP@0.5, Params and GFLOPs; the precision is used to evaluate the ratio of positive samples correctly identified as positive samples in the recognized images. The higher the precision, the better the detection effect of the detection model; the recall rate is used to evaluate the ratio of positive samples among all samples detected as positive; the mAP is used to evaluate the average value of the average accuracy AP of multiple categories. The larger the mAP value, the better the performance of the detection model; the Params and GFLOPs are used to evaluate the lightweight characteristics of the improved model.
8. A lightweight target detection system based on improved YOLOv8, characterized in that: include: Data processing module: used to collect construction workers' working images through the monitoring equipment on the top of the tower crane, obtain the normal data set under normal working conditions, construct the interference data set by introducing interference factors, mark and classify the normal data set and the interference data set, and divide them into training set, verification set and test set according to the predetermined ratio; Model building module: used to build a lightweight target detection model SHM-YOLO. The SHM-YOLO network architecture includes a backbone network Backbone, a neck network Neck, and a head network Head. The backbone network Backbone includes a combination module HWD-C2f of an HWD convolution module and a C2f feature fusion module. The neck network Neck introduces an attention mechanism module SEAM, which is combined with the HWD convolution module and the C2f feature fusion module. SEAM is placed after each C2f feature fusion module. Model training module: used to set training parameters, use the training set to train the lightweight target detection model SHM-YOLO, use the Inner-MPDIoU loss function to optimize the constructed target detection model, and evaluate the target detection results through evaluation indicators; Model testing module: used to test the effect of the trained target detection model using the test set.
9. An electronic device, characterized in that: include: processor; as well as, A memory arranged to store computer executable instructions, wherein when the computer executable instructions are executed, the processor implements the steps of the lightweight target detection method based on improved YOLOv8 as described in any one of claims 1 to 7.
10. A storage medium, characterized in that: Used to store computer executable instructions, which, when executed, implement the steps of the lightweight target detection method based on improved YOLOv8 as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Unmanned aerial vehicle aerial photography small target detection method based on background noise weakening
CN118229965A
Lightweight PCB defect detection method based on improved YOLOv8 algorithm
CN118608509A
Cited By
WSSRNet-based SAR image ship small target detection method
CN119942092A
Lightweight target detection method and system for abnormal rice detection
CN120047678A
Data defense detection method and system based on artificial intelligence
CN120301705A
Contact network dropper state detection method based on improved YOLOv11s
CN120451064A
Catenary dropper state detection method based on improved YOLOv11s
CN120451064B