Safety helmet wearing intelligent monitoring method based on YOLOv8-CBAM

By adopting the YOLOv8-CBAM-based intelligent monitoring method for safety helmet wear in complex industrial scenarios, the existing target detection model has solved the problems of low detection accuracy, poor robustness and slow operation speed in complex industrial scenarios, and achieved higher detection accuracy and robustness.

CN119625631APending Publication Date: 2025-03-14YUNNAN AGRICULTURAL UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411668598.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-21
Publication Date
2025-03-14

AI Technical Summary

Technical Problem

The existing target detection model has problems such as low accuracy in safety helmet wear, poor robustness of the model, and slow operation speed in complex industrial scenarios.

Method used

The intelligent monitoring method of hard helmet wearing based on YOLOv8-CBAM is adopted to detect the hard helmet wearing condition by constructing a data set and combining the YOLOv8 object detection algorithm and CBAM attention mechanism.

Benefits of technology

It improves the accuracy and robustness of safety helmet wear detection, optimizes the accuracy and operating speed of target detection, reduces false detection and missed detection, and enhances the monitoring effect of the system in complex industrial scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119625631A_ABST
    Figure CN119625631A_ABST
Patent Text Reader

Abstract

The invention discloses a safety helmet wearing intelligent monitoring method based on YOLOv8-CBAM. The method comprises the following steps: constructing a safety helmet wearing condition data set; a YOLOv8-CBAM deep learning model is constructed; training the safety helmet wearing condition data set based on a YOLOv8-CBAM deep learning model until the loss function converges or reaches a preset number of iterations; and detecting the wearing condition of the safety helmet based on the YOLOv8-CBAM model. According to the invention, whether the worker wears the safety helmet can be monitored, the detection accuracy is high, the model robustness is high, and the operation speed is high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer vision technology, and in particular relates to an intelligent monitoring method for helmet wearing based on YOLOv8-CBAM. Background Art

[0002] Wearing a hard hat is an effective way to prevent head injuries, especially in high-risk environments such as construction sites, factories, and mines. Wearing a hard hat is essential to ensure personal safety. However, in real life, some people often fail to wear hard hats, which not only increases their own safety risks, but also may cause potential safety hazards to people around them. Traditional hard hat wearing monitoring methods mainly rely on manual inspections, which have problems such as low recognition accuracy, low efficiency, and high cost.

[0003] In recent years, with the rapid development of artificial intelligence technology, especially deep learning and computer vision technology, it has become possible to use intelligent video analysis technology for real-time helmet monitoring. At present, the target detection algorithm YOLOv8 (You Only Look Once version 8) based on deep learning has been widely used in the field of computer vision with high accuracy and efficiency. It realizes the target detection task in an end-to-end manner, with the characteristics of single-stage detection, integration of classification and positioning, feature sharing and efficient post-processing. It uses multi-scale feature maps to detect targets of different sizes and uses feature sharing mechanisms to improve performance. It improves accuracy through post-processing methods such as NMS, and shows good results and generalization capabilities on various data sets, providing a solution for the field of target detection.

[0004] However, due to the movement of people and occlusion of buildings in complex industrial scenes, the existing target detection models still have problems such as low accuracy in detecting helmet wearing, poor model robustness, and slow running speed. Summary of the invention

[0005] The purpose of the embodiment of the present invention is to provide an intelligent monitoring method for helmet wearing based on YOLOv8-CBAM, so as to realize automatic monitoring of whether workers are wearing helmets, thereby solving the problems of low accuracy of helmet wearing detection, poor model robustness and slow running speed of existing target detection models.

[0006] In order to solve the above technical problems, the technical solution adopted by the present invention is:

[0007] The intelligent monitoring method for helmet wearing based on the YOLOv8-CBAM model includes the following steps:

[0008] S1. Build a helmet wearing data set;

[0009] S2. Build the YOLOv8-CBAM deep learning model;

[0010] S3. Train the helmet wearing data set based on the YOLOv8-CBAM deep learning model until the loss function converges or reaches the preset number of iterations;

[0011] S4. Detect the wearing status of the helmet based on the YOLOv8-CBAM model.

[0012] Furthermore, in step S1, constructing the helmet wearing condition data set includes the following steps:

[0013] S11, obtaining a picture of the helmet wearing condition;

[0014] S12, perform data enhancement on the pictures of helmet wearing conditions and expand the number of pictures;

[0015] S13, marking the enhanced helmet wearing condition picture and recording the marking information;

[0016] S14. Divide the enhanced helmet wearing pictures into a training set and a test set.

[0017] Further, in step S2, constructing the YOLOv8-CBAM deep learning model includes the following steps:

[0018] S21. Build the YOLOv8 model network structure, including a feature extractor, a feature fusion layer and an output layer. The feature fusion layer includes a cross-feature fusion module.

[0019] S22. Add a convolutional attention module CBAM after the cross-feature fusion module to build a YOLOv8-CBAM model. The convolutional attention module includes a channel attention module and a spatial attention module.

[0020] S23. Initialize the parameters of the YOLOv8-CBAM model, specifically, set a pre-trained model, which pre-trains the annotation information through hyperparameters, and loads the pre-trained parameters into the YOLOv8-CBAM model.

[0021] Furthermore, in step S3, the helmet wearing condition data set training includes the following steps:

[0022] S31, dynamic distribution of positive and negative samples;

[0023] S32. Loss calculation, including classification loss calculation and regression loss calculation.

[0024] Further, in step S13, the annotation information includes helmet wearing information and helmet bounding box information, specifically:

[0025] Safety helmet wearing information: if a safety helmet is worn, it is marked as 0; if a safety helmet is not worn, it is marked as 1;

[0026] Safety helmet bounding box information: including the center point coordinates of the safety helmet bounding box, the width of the safety helmet bounding box, and the height of the safety helmet bounding box.

[0027] Furthermore, in step S31, the dynamically distributed positive and negative samples are:

[0028] The calculation can measure the degree of alignment as:

[0029] t=s α +u β

[0030] Among them, t is the measurable degree of alignment, s is the prediction score corresponding to the annotation information, u is the intersection-over-union ratio of the prediction box and the helmet bounding box, α is the weight hyperparameter of s, and β is the weight hyperparameter of u;

[0031] The YOLOv8-CBAM model sets the allocation threshold Y. If t≥Y, it is used as a positive sample. If t<Y, it is used as a negative sample. The allocation threshold Y is adjusted in real time according to the training situation to achieve dynamic allocation of positive and negative samples.

[0032] Furthermore, in step S32, the classification loss is calculated as:

[0033]

[0034] In the formula, L is the confidence of the data sample, N is the number of data samples, i is the i-th data sample, and y i For helmet wearing information label, p i is the predicted probability value.

[0035] Further, in step S32, the regression damage calculation includes bounding box regression loss calculation and distribution focus loss calculation, and the bounding box regression loss calculation is:

[0036]

[0037] Where, L CIoU is the bounding box regression loss, IoU is the intersection over union ratio, b is the coordinate of the center point of the predicted box, and b gt is the coordinate of the center point of the helmet bounding box, ρ is the Euclidean distance between the predicted box and the helmet bounding box, c is the diagonal distance between the predicted box and the helmet bounding box, v is the consistency parameter of the relative proportion of the predicted box and the helmet bounding box, and α is the weight coefficient;

[0038] The distribution focal loss is calculated as:

[0039] DFL(S i ,S i+1 )=-((y i+1 -y i )log(S i )+(yy i )log(S i+1 ))

[0040] In the formula, DFL(S i , S i+1 ) is the distribution focus loss, S i is the data prediction value, S i+1 is the predicted value of the data, y is the actual value of the data, and y i is the integral value of the data prediction value, y i+1 is the adjacent integral value of the data's adjacent prediction value, and i is the i-th data sample.

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

[0042] (1) The present invention performs data enhancement on existing helmet wearing pictures to generate a large amount of diversified training data. The diversified training data enables the model to better adapt to the helmet wearing conditions in different environments, avoids the problem of low helmet wearing condition detection accuracy caused by personnel movement or building occlusion, and has a higher recognition accuracy in complex industrial scenarios;

[0043] (2) The present invention combines the YOLOv8 target detection algorithm and the CBAM attention mechanism. The CBAM effectively captures the channel correlation and spatial information in the image through the channel attention and spatial attention mechanisms, strengthens the attention and response to the target area, further enhances the target detection accuracy of the intelligent monitoring system for helmet wearing, and optimizes the accuracy and running speed of target detection, improves the system's ability to quickly identify the wearing of helmets, reduces false detections and missed detections, increases the robustness of the system, optimizes the monitoring effect of the system in complex industrial scenes, and improves its practical value. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the embodiments of the present invention 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 of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0045] Figure 1 It is a flow chart of the intelligent monitoring method for helmet wearing based on YOLOv8-CBAM of the present invention;

[0046] Figure 2 It is the YOLOv8-CBAM network structure diagram of the present invention;

[0047] Figure 3 is the PR curve of YOLOv8-CBAM in Example 1 of the present invention;

[0048] Figure 4 It is the PR curve of YOLOv8 in Comparative Example 1 of the present invention. DETAILED DESCRIPTION

[0049] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0050] The intelligent monitoring method for helmet wearing based on YOLOv8-CBAM includes the following steps:

[0051] S1. Construct a helmet wearing data set, including:

[0052] S11. Obtain pictures of helmet wearing conditions in construction sites, mines, and traffic control scenes;

[0053] S12. Perform data enhancement on the helmet wearing condition pictures and expand the number of pictures. Data enhancement includes horizontal / vertical flipping, random cropping, rotation, scaling, translation, and perspective transformation of the picture data to change the position, direction, and size of the target helmet. It is necessary to ensure that the helmet is relatively centered in the image, fully displayed, and maintains its proportion to avoid deformation.

[0054] S13. Use annotation software to annotate the enhanced helmet wearing situation picture, mark with Helmet and No Helmet according to the wearing situation, and record the annotation information, including helmet wearing information and helmet bounding box information, specifically:

[0055] Safety helmet wearing information: if a safety helmet is worn, it is marked as 0; if a safety helmet is not worn, it is marked as 1;

[0056] Helmet bounding box information: including the coordinates of the center point of the helmet bounding box (x_center, y_center), the width of the helmet bounding box, and the height of the helmet bounding box.

[0057] S14. Divide the enhanced helmet wearing pictures into a training set and a test set.

[0058] S2. Build the YOLOv8-CBAM deep learning model, including:

[0059] S21. Build the YOLOv8 model network structure, including Backbone (feature extractor), Neck (feature fusion layer) and Head (output layer);

[0060] Backbone: extracts edge features, texture features, scale information, color and intensity information, and spatial structure from images;

[0061] Neck: includes a cross-feature fusion module, which performs feature fusion on the features extracted by backbone and outputs three feature maps

[0062] Head: Processes the feature map output by Neck and outputs the result.

[0063] S22. Add CBAM (convolutional attention module) after the cross-feature fusion module to build the YOLOv8-CBAM model. The convolutional attention module can improve feature expression, enhance the model's emphasis on important information, and improve the overall performance of object detection.

[0064] CBAM includes channel attention and spatial attention, which can make the network pay more attention to the target of interest, help the network to more effectively capture and utilize important information in the feature map, improve the performance and generalization ability of the network, and thus improve the performance of the model.

[0065] S23. Initialize the parameters of the YOLOv8-CBAM model, specifically, set a pre-trained model, select hyperparameters according to actual conditions, including learning rate, batch size or training rounds, and pre-train the annotation information through the hyperparameters of the pre-trained model, and load the pre-trained parameters into the YOLOv8-CBAM model.

[0066] This pre-trained parameter initialization can accelerate the convergence of the model and improve the performance of the model in the helmet wearing detection task, allowing for more effective training.

[0067] S3. Training the helmet wearing data set based on the YOLOv8-CBAM deep learning model, including:

[0068] S31, Dynamically distribute positive and negative samples, first calculate the measurable alignment degree:

[0069] t=s α +u β

[0070] Where t is the measurable degree of alignment, s is the predicted score corresponding to the annotation information, u is the intersection-over-union ratio of the predicted box and the helmet bounding box, α is the weight hyperparameter of s, and β is the weight hyperparameter of u;

[0071] The YOLOv8-CBAM model sets an allocation threshold Y. If t≥Y, it is considered a positive sample. If t<Y, it is considered a negative sample. After each training iteration, the mean loss value of all samples is calculated. Samples with loss values ​​lower than the mean are considered "easy" samples, while samples with loss values ​​higher than the mean are considered "difficult" samples. By monitoring the loss value of the entire process, the weight of the sample is dynamically adjusted. The weight of the sample with a loss value higher than the loss threshold is increased, and the weight of the sample with a loss value lower than the loss threshold is reduced. The allocation threshold Y is adjusted in real time according to the training situation to achieve dynamic allocation of positive and negative samples.

[0072] In object detection, the positive and negative sample allocation strategy assigns a weight to each sample during training so that the model pays more attention to difficult samples and important samples, that is, dynamically adjusts the weight according to the progress of training and the characteristics of the samples. In the early stages of training, it may be difficult for the model to distinguish between positive and negative samples, so more attention should be paid to samples that are easily misclassified. As training progresses, the model gradually becomes more powerful and can better distinguish samples, so the weight of difficult samples should be gradually reduced, while the weight of easy-to-classify samples should be increased. The dynamic allocation strategy can be adjusted according to the training loss or other indicators, which can better adapt to different data sets and models.

[0073] S32, loss calculation, including classification loss calculation and regression loss calculation, specifically

[0074] The classification loss is calculated by judging whether the category is "this type" and outputting the confidence level, that is:

[0075]

[0076] In the formula, L is the confidence of the data sample, N is the number of data samples, i is the i-th data sample, and y i is the helmet wearing information tag, with a value of 0 or 1, p i is the predicted probability value, ranging from 0 to 1;

[0077] The present invention uses classification loss to measure the difference between the model output and the actual label. For each category of prediction, a binary cross entropy loss value will be calculated to measure the model's classification performance for that category. The ultimate goal is to make the prediction results as consistent as possible with the actual label, and improve the model's classification accuracy for each category.

[0078] The regression loss calculation includes CIou_Loss (bounding box regression loss calculation) and Distribution FocalLoss (distribution focal loss calculation);

[0079] The bounding box regression loss is calculated as:

[0080]

[0081] Where, L CIoU is the bounding box regression loss, IoU is the intersection over union ratio, b is the coordinate of the center point of the predicted box, and b gt is the coordinate of the center point of the helmet bounding box, ρ is the Euclidean distance between the predicted box and the helmet bounding box, c is the diagonal distance between the predicted box and the helmet bounding box, v is the consistency parameter of the relative proportion of the predicted box and the helmet bounding box, and α is the weight coefficient;

[0082] The distribution focus loss calculation optimizes the probability of two positions (yi and yi+1) near the actual value y of the data, so that the network distribution focuses on the actual value of the data:

[0083] DFL(S i ,S i+1 )=-((y i+1 -y i )log(S i )+(yy i )log(S i+1 ))

[0084] In the formula, DFL(S i , S i+1 ) is the distribution focus loss, S i is the data prediction value, S i+1 is the predicted value of the data, y is the actual value of the data, and y i is the integral value of the data prediction value, y i+1 It is the near integral value of the data near prediction value.

[0085] The model repeatedly calculates the loss until the loss function converges or reaches a preset number of iterations.

[0086] S4. Detect the wearing status of the helmet based on the YOLOv8-CBAM model.

[0087] like Figure 1 As shown, it is a flow chart of the intelligent helmet wearing monitoring method of YOLOv8-CBAM of the present invention.

[0088] like Figure 2 As shown, this is the YOLOv8-CBAM network structure diagram of the present invention.

[0089] Example 1

[0090] The pictures of helmet wearing were obtained and enhanced to obtain a total of 7581 enhanced pictures. The training set and the test set were divided into training set and test set according to the ratio of 8:2, where the training set contained 6064 pictures and the test set contained 1517 pictures. The number of iterations was set to 250 to train the YOLOv8-CBAM model proposed in the present invention.

[0091] Comparative Example 1

[0092] The difference from Example 1 is that the convolutional attention module is not added to the model, and the other steps are the same.

[0093] Figure 3 is the PR curve of the YOLOv8-CBAM model of Example 1. It can be seen that the mAP@0.5 of the PR curve is above 0.94, and the average value is 0.946. It can be seen that the YOLOv8-CBAM model proposed in the present invention has a high detection accuracy.

[0094] Figure 4 This is the PR curve of the YOLOv8 model of Example 1. It can be seen that the mAP@0.5 of the PR curve reaches above 0.92, and the average value is 0.925, that is, the performance of the model without the convolutional attention module has declined to a certain extent.

[0095] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0096] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims

1. The intelligent monitoring method for helmet wearing based on YOLOv8-CBAM is characterized by: The following steps are involved: S1. Build a helmet wearing data set; S2. Build the YOLOv8-CBAM deep learning model; S3. Train the helmet wearing data set based on the YOLOv8-CBAM deep learning model until the loss function converges or reaches the preset number of iterations; S4. Detect the wearing status of the helmet based on the YOLOv8-CBAM model.

2. The intelligent monitoring method for helmet wearing based on YOLOv8-CBAM according to claim 1 is characterized in that: In step S1, constructing a helmet wearing condition data set includes the following steps: S11, obtaining a picture of the helmet wearing condition; S12, perform data enhancement on the pictures of helmet wearing conditions and expand the number of pictures; S13, marking the enhanced helmet wearing condition picture and recording the marking information; S14. Divide the enhanced helmet wearing pictures into a training set and a test set.

3. The intelligent monitoring method for helmet wearing based on YOLOv8-CBAM according to claim 1 is characterized in that: In step S2, the construction of the YOLOv8-CBAM deep learning model includes the following steps: S21. Build the YOLOv8 model network structure, including a feature extractor, a feature fusion layer and an output layer. The feature fusion layer includes a cross-feature fusion module. S22. Add a convolutional attention module CBAM after the cross-feature fusion module to build a YOLOv8-CBAM model. The convolutional attention module includes a channel attention module and a spatial attention module. S23. Initialize the parameters of the YOLOv8-CBAM model, specifically, set a pre-trained model, which pre-trains the annotation information through hyperparameters, and loads the pre-trained parameters into the YOLOv8-CBAM model.

4. The intelligent monitoring method for helmet wearing based on YOLOv8-CBAM according to claim 1 is characterized in that: In step S3, the helmet wearing condition data set training includes the following steps: S31, dynamic distribution of positive and negative samples; S32. Loss calculation, including classification loss calculation and regression loss calculation.

5. The intelligent monitoring method for helmet wearing based on YOLOv8-CBAM according to claim 2 is characterized in that: In step S13, the annotation information includes helmet wearing information and helmet bounding box information, specifically: Safety helmet wearing information: if a safety helmet is worn, it is marked as 0; if a safety helmet is not worn, it is marked as 1; Safety helmet bounding box information: including the center point coordinates of the safety helmet bounding box, the width of the safety helmet bounding box, and the height of the safety helmet bounding box.

6. The intelligent monitoring method for helmet wearing based on YOLOv8-CBAM according to claim 4 is characterized in that: In step S31, the dynamic distribution of positive and negative samples is: The calculation can measure the degree of alignment as: t=s α +u β Among them, t is the measurable degree of alignment, s is the prediction score corresponding to the annotation information, u is the intersection-over-union ratio of the prediction box and the helmet bounding box, α is the weight hyperparameter of s, and β is the weight hyperparameter of u; The YOLOv8-CBAM model sets the allocation threshold Y. If t≥Y, it is used as a positive sample. If t<Y, it is used as a negative sample. The allocation threshold Y is adjusted in real time according to the training situation to achieve dynamic allocation of positive and negative samples.

7. According to the YOLOv8-CBAM-based intelligent monitoring method for helmet wearing according to claim 4, it is characterized in that: In step S32, the classification loss is calculated as: In the formula, L is the confidence of the data sample, N is the number of data samples, i is the i-th data sample, and y i For helmet wearing information label, p i is the predicted probability value.

8. According to the YOLOv8-CBAM-based intelligent monitoring method for helmet wearing according to claim 4, it is characterized in that: In step S32, the regression damage calculation includes bounding box regression loss calculation and distribution focus loss calculation, and the bounding box regression loss calculation is: Where, L CIoU is the bounding box regression loss, IoU is the intersection over union ratio, b is the coordinate of the center point of the predicted box, and b gt is the coordinate of the center point of the helmet bounding box, ρ is the Euclidean distance between the predicted box and the helmet bounding box, c is the diagonal distance between the predicted box and the helmet bounding box, v is the consistency parameter of the relative proportion of the predicted box and the helmet bounding box, and α is the weight coefficient; The distribution focal loss is calculated as: DFL(S i ,S i+1 )=-((y i+1 -y i )log(S i )+(y-y i )log(S i+1 )) In the formula, DFL(S i , S i+1 ) is the distribution focus loss, S i is the data prediction value, S i+1 is the predicted value of the data, y is the actual value of the data, and y i is the integral value of the data prediction value, y i+1 is the adjacent integral value of the data's adjacent prediction value, and i is the i-th data sample.

Citation Information

Patent Citations

  • Helmet wearing detection method and device based on deep learning

    CN111160440A

  • Vehicle-mounted gesture recognition method

    CN118760356A