Chemical safety scene safety helmet detection improved algorithm based on YOLOv5

By adopting the improved safety helmet detection algorithm based on YOLOv5 in chemical safety scenarios, combined with the CBAM hybrid attention mechanism module, BiFPN module and Focal Loss function, the problem of insufficient accuracy and real-time detection of safety helmet wear in chemical safety scenarios is solved. It achieves efficient, accurate and real-time detection effects.

CN119445069APending Publication Date: 2025-02-14HUNAN INSTITUTE OF ENGINEERING
View PDF 0 Cites 1 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In chemical safety scenarios, traditional safety helmet wear detection methods have problems with insufficient detection accuracy and real-time performance, especially when facing challenges such as complex backgrounds, occlusions, scale changes and small object detection.

Method used

Using the improved algorithm for chemical safety scene safety helmet detection based on YOLOv5, the monitoring equipment is collected, framed, manually labeled, and built the YOLOv5 detection model and used the training set, verification set and test set to train the model, combined with CBAM mixed attention Mechanism module, BiFPN module and Focal Loss function to improve detection accuracy and speed.

Benefits of technology

It realizes the efficiency, accuracy and real-time performance of safety helmet wear detection in chemical safety scenarios, ensures the improvement of detection accuracy and speed, and is suitable for practical application needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119445069A_ABST
    Figure CN119445069A_ABST
Patent Text Reader

Abstract

The invention discloses a chemical safety scene safety helmet detection improved algorithm based on YOLOv5. The algorithm comprises the following steps: collecting videos of monitoring equipment and framing the videos to obtain data of a plurality of pictures; converting the picture into a JPG format; manually labeling the picture by adopting a LabelImg tool, outputting a label format in an xml format, and then converting the label in the xml format into a txt format; dividing the pictures converted into the txt format into a training set, a verification set and a test set; building a YOLOv5 detection model, and training the YOLOv5 detection model by using the training set, the verification set and the test set; and detecting and outputting a result by using a YOLOv5 detection model. The detection effect of the method is better than that of an original YOLOv5 model, and the requirements for accuracy and real-time performance of safety helmet wearing detection in a chemical safety scene are met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of safety detection technology, and in particular to an improved algorithm for detecting safety helmets in chemical safety scenarios based on YOLOv5. Background Art

[0002] Safety helmets are personal protective equipment used in many industries such as chemical industry and construction. Safety helmets can protect the head well when working in these scenarios. To ensure the safety of workers, workers must wear safety helmets. However, due to the large number of people, lack of supervision and safety awareness, safety accidents caused by not wearing safety helmets occur from time to time. Traditional supervision methods rely on manual supervision, which cannot guarantee that workers always wear safety helmets during the entire operation process, and such supervision methods will consume a lot of time and manpower. Therefore, it is of great significance to study the detection method of safety helmet wearing.

[0003] In recent years, many researchers at home and abroad have studied and developed some technologies for detecting helmets. In 2015, DongS et al. used pressure sensors to collect pressure information and used radio modules for position detection and information transmission to detect the wearing of helmets. However, the range of information transmitted by this method is very limited, and the module needs to be charged from time to time. The commonly used sensors for industrial park safety detection are visible light imaging sensors. People have studied many algorithms to solve the problem of helmet detection and similar applications in videos and images. For example, the Rubaiyat AHM group and the Fang W group. However, in the face of problems such as occlusion, scale change, perspective distortion and small target detection, the imaging sensor-based method faces great challenges.

[0004] With the development of computer vision, people began to use machine learning and image processing technology to detect helmets. Viola et al. proposed a Haar-like feature extraction method by studying human facial features. In order to improve the efficiency of feature extraction, the directional gradient histogram was also used for target detection. R. Girshick et al. proposed the regional convolutional neural network (RCNN) algorithm, marking the rapid development of convolutional neural networks in the field of target detection. Although these methods have achieved good results, due to problems such as complex detection background and dense objects, they will lead to problems such as poor detection stability, slow detection speed, and inaccurate helmet detection.

[0005] Object detection is a very important core direction of computer vision. Deep learning neural networks can automatically learn powerful feature extraction and fitting capabilities from a large amount of data, so many object detection algorithms with excellent performance have emerged. Object detection algorithms based on deep learning are generally divided into two categories: two-stage object detection and single-stage object detection. The former mainly extracts candidate boxes based on the image first, and classifies these samples through convolutional neural networks. Classic algorithms include RCNN, Fast RCNN and Faster RCNN. The latter directly calculates the image to generate detection results, such as YOLO, SSD and other algorithms. The two-stage algorithm has high detection accuracy, but slow speed, and it is difficult to meet the real-time requirements of helmet detection. The single-stage algorithm has fast detection speed, but low detection accuracy. Although the prediction accuracy is not as good as the two-stage object detection algorithm, due to its fast running speed, YOLO has become the mainstream in the industry. Summary of the invention

[0006] In order to solve the accuracy and real-time requirements of safety helmet wearing detection in chemical safety scenarios, the present invention provides an improved algorithm for safety helmet detection in chemical safety scenarios based on YOLOv5.

[0007] To achieve the above purpose, the technical solution adopted by the present invention is as follows: The improved algorithm for chemical safety helmet detection based on YOLOv5 includes: Collect the video footage from the monitoring equipment and process it frame by frame to obtain multiple image data; Convert the image to JPG format; Use the LabelImg tool to manually label the images, output the label format in XML format, and then convert the XML format labels into TXT format; Divide the converted txt format images into training set, validation set, and test set; Build a YOLOv5 detection model and use the training set, validation set, and test set to train the YOLOv5 detection model; Use the YOLOv5 detection model to detect and output the results.

[0008] Further: the YOLOv5 detection model includes an Input input end, which processes the input image by random cropping, scaling, rotation, and color transformation, and then inputs it into the Backbone backbone network. The Backbone backbone network converts the input image into a multi-layer feature map, and then inputs it into the Neck network layer. The Neck network layer performs network feature fusion by introducing a BiFPN module, and then inputs it into the CBAM hybrid attention mechanism module. The CBAM hybrid attention mechanism module adaptively pays attention to and adjusts the spatial position and channel features, and then outputs them through the Head output end.

[0009] Further: the Backbone network includes a Conv module, a C3 module, and a SPPF module.

[0010] Further: the Neck network layer includes an FPN+PAN structure.

[0011] Further: the CBAM hybrid attention mechanism module includes a channel attention module and a spatial attention module.

[0012] Further: the Head output end includes a YOLOv5 head structure.

[0013] The Focal Loss function is introduced into the loss function of the YOLOv5 detection model to automatically adjust the weight of the loss function according to the confidence of the predicted box, thereby reducing the interference of simple samples on model training. The formula is as follows:

[0014] Compared with the prior art, the present invention has the following technical advances: This method detects safety helmets in chemical safety scenarios based on the YOLOv5s detection model. Compared with traditional manual supervision and computer vision-based methods, the target detection technology used is efficient, accurate, and real-time, ensuring the accuracy of safety helmet wearing detection while improving the speed of real-time detection of safety helmet wearing, which has practical application significance.

[0015] The CBAM hybrid attention mechanism module is introduced into the YOLOv5 target detection algorithm to adaptively focus on and adjust key spatial positions and channel features to improve the feature expression ability of the network; the weighted bidirectional feature pyramid network structure (BiFPN) is adopted to promote effective feature fusion and cross-scale information transmission to improve the performance of the algorithm; at the same time, the FocalLoss function is introduced to deal with the imbalance problem of safety helmet detection categories in chemical safety scenarios, thereby enhancing the robustness of the algorithm; through a reasonable data enhancement strategy, the training samples of the target detection algorithm are increased to improve the robustness and generalization ability of the model. The detection effect of the improved model is better than the original YOLOv5 model, which meets the accuracy and real-time requirements of safety helmet wearing detection in chemical safety scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention.

[0017] In the attached picture: Figure 1 is a flow chart of the present invention; Figure 2 It is a structural diagram of the YOLOv5 detection model of the present invention; Figure 3 It is a structural diagram of the BiFPN module of the present invention; Figure 4 It is a structural diagram of the CBAM hybrid attention mechanism module of the present invention. DETAILED DESCRIPTION

[0018] The following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. The embodiments of the present invention will be described below in conjunction with the accompanying drawings.

[0019] like Figure 1 As shown, the present invention discloses an improved algorithm for detecting safety helmets in chemical safety scenarios based on YOLOv5, including: Collect the video footage from the monitoring equipment and process it frame by frame to obtain multiple image data; Convert the image to JPG format; Use the LabelImg tool to manually label the images, output the label format in XML format, and then convert the XML format labels into TXT format; Divide the converted txt format images into training set, validation set, and test set; Build a YOLOv5 detection model and use the training set, validation set, and test set to train the YOLOv5 detection model; Use the YOLOv5 detection model to detect and output the results.

[0020] Specifically, for the detection of helmet wearing in chemical safety scenarios, the video recordings of monitoring equipment are collected to obtain image data of chemical plant workers, construction site workers, and high-altitude workers wearing and not wearing helmets; the video recordings of monitoring equipment are collected and framed, the image data are collected and sorted, and the images are converted to JPG format. Secondly, the image data are manually labeled using the LabelImg tool, and the workers are labeled as "helmet" and "head". The label format is then output in xml format, and the xml format labels are converted to txt format through Python code to meet the format of YOLO; the test data set is divided, and the image data and label data set of the custom test are divided into: training set, validation set, and test set, respectively, with a ratio of 96%:2%:2%, and the training set and test set are strictly independent.

[0021] like Figure 2As shown in the figure, the YOLOv5 detection model architecture is divided into the Input input, Backbone backbone network, Neck network layer, CBAM hybrid attention mechanism module and Head output. The Input input processes the input image and improves the speed of model training and the accuracy of the network through data enhancement techniques such as random cropping, scaling, rotation, and color transformation; the Backbone network structure includes Conv module, C3 module, and SPPF module. Its main function is to convert the original input image into a multi-layer feature map for subsequent target detection tasks; the Neck network adopts the FPN+PAN structure to enhance the network feature fusion capability, and introduces a new network structure BiFPN module for target detection and semantic segmentation, which covers efficient bidirectional cross-scale connections and weighted feature map fusion, so that when building the network, it can effectively process the information interaction between features of different scales, promote the effective fusion between different feature maps, and improve the performance and efficiency of the safety helmet wearing detection model in chemical safety scenarios. The BiFPN network structure is shown in the figure. Figure 3 As shown; the Head part uses the YOLOv5 head structure, which can output the network's prediction results.

[0022] Combination Figure 4 In order to further improve the YOLOv5 model's ability to detect helmet wearing in chemical safety scene detection tasks, the present invention introduces the CBAM hybrid attention mechanism module as part of the backbone network. The CBAM hybrid attention mechanism module consists of channel attention and spatial attention modules. By learning the relationship between different channels and spatial positions, it assigns weights to each channel and pixel to highlight important feature channels and regions, thereby improving the network's feature expression ability and thus improving image recognition performance.

[0023] Due to the possible category imbalance problem in the data set and the difficulty in detecting the wearing of safety helmets in chemical safety scenes. The present invention introduces the Focal Loss function in the loss function to make the model pay more attention to difficult samples. Its advantage is that it can automatically adjust the weight of the loss function according to the confidence of the prediction box, thereby reducing the interference of simple samples on model training, effectively solving the various imbalance problems in the data set, and improving the detection performance of the model. The formula is as follows:

[0024] After optimizing the model, input the dataset into the network for training. Before training the model, add the pre-trained weights of YOLOv5 to optimize the model training, shorten the network training time and improve the accuracy of model prediction. Change the training model parameters, set the path, type and number of training datasets; select hyperparameters and activation functions that match the dataset training type; set the training worker thread, the number of images input to the network and the number of training rounds, and then start training the model to obtain the model weights that meet the system.

[0025] After the training is completed, the algorithm method is judged based on evaluation indicators such as loss value, precision, and recall rate. The chemical safety scene helmet detection system uses the target detection network to extract the data of workers. The system records the data of workers wearing and not wearing helmets at a set time, and transmits the data to the information management module for the optimization of helmet detection. The recognition of chemical safety scene helmet detection is realized by the target detection method, which can effectively detect the wearing of helmets in real time.

[0026] Finally, it should be noted that the above is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein with equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the scope of protection of the claims of the present invention.

Claims

1. An improved algorithm for detecting safety helmets in chemical safety scenarios based on YOLOv5, characterized in that: include: Collect the video footage from the monitoring equipment and process it frame by frame to obtain multiple image data; Convert the image to JPG format; Use the LabelImg tool to manually label the images, output the label format in XML format, and then convert the XML format labels into TXT format; Divide the converted txt format images into training set, validation set, and test set; Build a YOLOv5 detection model and use the training set, validation set, and test set to train the YOLOv5 detection model; Use the YOLOv5 detection model to detect and output the results.

2. According to the improved algorithm for detecting safety helmets in chemical safety scenarios based on YOLOv5 in claim 1, it is characterized in that: The YOLOv5 detection model includes an Input input end, which processes the input image by random cropping, scaling, rotation, and color transformation, and then inputs it into the Backbone backbone network. The Backbone backbone network converts the input image into a multi-layer feature map, which is then input into the Neck network layer. The Neck network layer performs network feature fusion by introducing a BiFPN module, and then inputs the CBAM hybrid attention mechanism module. The CBAM hybrid attention mechanism module adaptively pays attention to and adjusts spatial position and channel features, and then outputs them through the Head output end.

3. According to the improved algorithm for detecting safety helmets in chemical safety scenarios based on YOLOv5 in claim 2, it is characterized in that: The Backbone network includes a Conv module, a C3 module, and a SPPF module.

4. According to the improved algorithm for detecting safety helmets in chemical safety scenarios based on YOLOv5 in claim 3, it is characterized in that: The Neck network layer includes an FPN+PAN structure.

5. According to claim 4, the improved algorithm for detecting safety helmets in chemical safety scenarios based on YOLOv5 is characterized in that: The CBAM hybrid attention mechanism module includes a channel attention module and a spatial attention module.

6. The improved algorithm for detecting safety helmets in chemical safety scenarios based on YOLOv5 according to claim 5 is characterized in that: The Head output includes a YOLOv5 head structure.

7. The improved algorithm for detecting safety helmets in chemical safety scenarios based on YOLOv5 according to claim 6 is characterized in that: The Focal Loss function is introduced into the loss function of the YOLOv5 detection model to automatically adjust the weight of the loss function according to the confidence of the predicted box, thereby reducing the interference of simple samples on model training. The formula is as follows: 。

Citation Information

Cited By

  • Real-time detection method and system for apparent diseases of concrete dam

    CN116309370A