Safety helmet wearing detection system and method for small target

By introducing attention mechanism and multi-scale feature fusion scheme in the safety helmet wear detection system, combining two-dimensional discrete wavelet transformation and WIoU v3 loss function, the YOLOX model is optimized, and the problem of low detection accuracy of small targets in construction site scenarios is solved, and the Higher detection accuracy and accuracy.

CN118942121AActive Publication Date: 2024-11-12CHONGQING UNIV OF POSTS & TELECOMM

Patent Information

Application Number
CN202411121492.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-15
Publication Date
2024-11-12
Estimated Expiration
2044-08-15

AI Technical Summary

Technical Problem

The existing safety helmet wear detection system has low target detection accuracy in construction site scenarios, especially when small target detection, there are problems such as occlusion, insufficient feature information and high positioning accuracy requirements, resulting in large errors.

Method used

Introduce attention mechanism and multi-scale feature fusion scheme, a new downsampling method is constructed through two-dimensional discrete wavelet transformation, combined with ASPP_CBAM multi-scale feature fusion structure and WIoU v3 loss function, the YOLOX model is optimized to improve detection accuracy.

Benefits of technology

It significantly improves the accuracy of small target detection, reduces feature loss, enhances the detection performance of small targets, and improves the accuracy of safety helmet wear detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118942121A_ABST
    Figure CN118942121A_ABST
Patent Text Reader

Abstract

The invention relates to a safety helmet wearing detection system and method for a small target, and belongs to the technical field of computer vision, and the method comprises the steps: collecting a construction site image, carrying out the data marking, constructing a training data set and a test data set, and carrying out the preprocessing; constructing a safety helmet wearing detection network for the small target based on a preset YOLOX model, wherein the safety helmet wearing detection network is used for safety helmet wearing detection; inputting the training set image and the test set image into the safety helmet wearing detection network for training, and adopting WIoU v3 as a bounding box regression loss function to adjust parameters of the safety helmet wearing detection network; and inputting a to-be-detected construction site image into the trained safety helmet wearing detection network, and outputting a real-time detection result of the to-be-detected construction site image. According to the invention, the safety helmet wearing detection precision can be improved, and the identification and detection of the safety helmet wearing condition in the scene can be realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of computer vision and relates to a helmet wearing detection system and method for small targets. Background Art

[0002] The implementation of the automatic helmet wearing detection system on construction sites is based on many considerations. The helmet wearing detection system can automatically monitor the workers' wearing of helmets in real time, reduce the pressure and workload of manual monitoring, and improve efficiency. Through the detection results, workers who are not wearing helmets can be found in time, and alarms or managers can be notified immediately to reduce safety accidents and economic losses.

[0003] At present, the research methods used for helmet wearing detection mainly adopt methods based on deep learning. It is mainly divided into two-stage detection methods and one-stage detection methods: the main methods of two-stage detection include Regions with Convolutional Neural Networks (RCNN), Spatial Pyramid Pooling Network (SPP-net), and improved networks related to RCNN such as Fast R-CNN, Faster R-CNN, Mask R-CNN, etc., which can achieve good detection accuracy, but their real-time performance is poor and are not suitable for the scene of helmet wearing detection on construction sites; one-stage detection uses YOLO series methods and SSD methods, which speed up the detection speed through end-to-end methods, but its accuracy is low.

[0004] There are three main reasons for the low detection accuracy of the target detection task in the scenario: first, the target object is blocked by the helmet in the specific scenario, resulting in information loss; second, during the feature extraction process of small-sized targets, less feature information can be extracted; finally, small-sized targets require high positioning accuracy, and the error caused by a slight deviation in the prediction box is much greater than that of larger-sized targets. Summary of the invention

[0005] To solve the problem of detecting targets with smaller sizes, the present invention introduces an attention mechanism and a multi-scale feature fusion scheme to reduce feature loss during feature extraction and fusion, thereby improving target detection accuracy.

[0006] To achieve the above object, the present invention provides a helmet wearing detection system and method for small targets, including the following technical solutions:

[0007] In a first aspect of the present invention, the present invention provides a method for detecting the wearing of a safety helmet at a small target construction site, comprising the following steps:

[0008] S1: Collect construction site images and annotate them, build training and test datasets, and perform preprocessing;

[0009] S2: Building a helmet wearing detection network for small targets based on a preset YOLOX model, wherein the helmet wearing detection network is used for helmet wearing detection;

[0010] S3: input the training set images and the test set images into the helmet wearing detection network for training, and use WIoU v3 as the bounding box regression loss function to adjust the parameters of the helmet wearing detection network;

[0011] S4: Input the on-site image of the construction site to be tested into the trained safety helmet wearing detection network, and output a real-time detection result of the on-site image of the construction site to be tested.

[0012] In a second aspect of the present invention, the present invention further provides a safety helmet wearing detection system for small target construction sites, which is used to implement the safety helmet wearing detection method for small target construction sites as described in the first aspect of the present invention, and the system comprises:

[0013] Image input module: used to collect construction site images and perform data annotation, build training data sets and test data sets, and perform preprocessing;

[0014] Feature extraction module: Based on the preset YOLOX model, a helmet wearing detection network for small targets is constructed, and the helmet wearing detection network is used for helmet wearing detection; the training set images and the test set images are input into the helmet wearing detection network for training, and WIoU v3 is used as the bounding box regression loss function to adjust the parameters of the helmet wearing detection network;

[0015] Detection and classification module: used to input the on-site image of the construction site to be tested into the trained safety helmet wearing detection network, and output the real-time detection result of the on-site image of the construction site to be tested.

[0016] Beneficial effects of the present invention:

[0017] The present invention proposes a helmet wearing detection system and method for small targets, focusing on improving the detection accuracy of small targets in helmet wearing detection. Firstly, a new downsampling method is constructed by introducing two-dimensional discrete wavelet transform. This method can capture multi-frequency domain feature information, effectively reduce feature loss, and further improve the detection accuracy of small-sized targets; secondly, in order to solve the problem of small target pixel information being less, an ASPP_CBAM multi-scale feature fusion structure combining multi-receptive field branches and attention mechanism is designed. This structure uses dilated convolution to construct features of different receptive fields, thereby enriching feature expression, significantly reducing feature loss caused by the sampling process without increasing computing resources, and using CBAM attention mechanism to improve the focus on key channels and key areas, thereby improving detection accuracy; a new WIoU v3 loss function is used to improve the detection performance of the model. This method has a particularly significant detection effect on small targets, effectively improving the accuracy of helmet wearing detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be described in detail below in conjunction with the accompanying drawings, wherein:

[0019] Figure 1 This is an architecture diagram of a construction site safety helmet wearing system and method for small targets according to an embodiment of the present invention;

[0020] Figure 2 The overall structure diagram of the YOLOX network improved by the embodiment of the present invention;

[0021] Figure 3 The ASPP_CBAM module structure diagram of the Backbone network in the YOLOX network improved by the embodiment of the present invention;

[0022] Figure 4 A comparison diagram showing the detection effect of the traditional YOLOX network and the improved YOLOX network of the embodiment of the present invention on the safety helmets of workers at the construction site; DETAILED DESCRIPTION

[0023] 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.

[0024] In view of the background technology, the present invention aims to improve the accuracy of helmet wearing detection. Figure 1 As shown, the present invention provides a method for detecting the wearing of a safety helmet at a small target construction site, comprising the following steps:

[0025] S1: Collect construction site images and annotate them, build training and test datasets, and perform preprocessing;

[0026] S2: Building a helmet wearing detection network for small targets based on a preset YOLOX model, wherein the helmet wearing detection network is used for helmet wearing detection;

[0027] S3: input the training set images and the test set images into the helmet wearing detection network for training, and use WIoU v3 as the bounding box regression loss function to adjust the parameters of the helmet wearing detection network;

[0028] S4: Input the on-site image of the construction site to be tested into the trained safety helmet wearing detection network, and output a real-time detection result of the on-site image of the construction site to be tested.

[0029] In an embodiment of the present invention, in step S1, a digital camera is first used to capture high-definition images of workers working at an actual construction site; then, 860 sub-images are randomly captured from the high-resolution images obtained by the capture, and the resolution is adjusted to 640×640 pixels to form an image data set; the image data is manually labeled using the labelimg tool, with "hat" representing all people wearing helmets and "person" representing people not wearing helmets; then the label format is output in XML format. Since the label format of Yolo is TXT, Python code is required to convert the XML format labels into TXT format; finally, the data set is divided into a training data set and a test data set in a ratio of 4:1 for model training and testing.

[0030] In the embodiment of the present invention, in step S2, the helmet wearing detection network is designed as follows: Figure 2 As shown, the specific steps include:

[0031] S21: In the Backbone network part of the preset YOLOX model, add an attention mechanism unit after the Focus module;

[0032] S22: In the Backbone network part of the preset YOLOX model, the downsampling module in each stage of the CSPDarknet53 structure is improved by using two-dimensional discrete wavelet transform;

[0033] S23: In the neck network part of the preset YOLOX model, the hole convolution is used with different expansion coefficients to construct a multi-scale feature fusion structure instead of the FPN structure;

[0034] S24: In the Head network part of the preset YOLOX model, the feature map output by the Neck network part is classified and detected.

[0035] It should be noted that the YOLOX model is a deep learning model for target detection. It is an improved version of the YOLO (You Only Look Once) series of models. YOLOX has significantly improved performance and speed compared to previous YOLO versions, mainly due to its innovative design and optimization strategies. The architecture of YOLOX mainly includes the following parts: Backbone network: used to extract image features. YOLOX usually uses CSPDarknet53 as the backbone network, which is an improved version based on Darknet-53 with better feature extraction capabilities and computational efficiency. Neck network: used to fuse features at different levels to better capture the details of the object. YOLOX uses a combination of FPN (Feature Pyramid Network) and PANet (Path Aggregation Network). Head network: responsible for generating the final detection results, including classification probability and bounding box coordinates. YOLOX uses a multi-scale detection head similar to YOLOv3, which can perform target detection at multiple scales. The present invention makes some adjustments to the traditional YOLOX model so that it can be better applied to safety helmet wearing detection and improve the accuracy of safety helmet wearing detection.

[0036] Among them, for step S21, this embodiment adds an attention mechanism unit after the Focus module in the traditional preset YOLOX model, and reduces the impact of pixel separation caused by the "Focus" layer in YOLOX on the detection of smaller targets by strengthening feature connections.

[0037] In some embodiments of the present invention, step S21 may include the following steps:

[0038] S211: The original feature map obtained from the Backbone network part of the preset YOLOX model is fed into the Focus module, and four sub-feature maps are obtained from the original feature map in a manner of one pixel per pixel, and the four sub-feature maps are spliced ​​in the channel dimension to form a new feature map;

[0039] S212: After the new feature map enters the attention mechanism unit, first perform 3×3 convolution on the input feature map to extract local information, then concat the local information with the input feature map, and then generate the attention matrix through two consecutive convolutions; at the same time, encode the input feature map and multiply it with the attention matrix to obtain global information; finally, fuse the local information with the global information;

[0040] In the embodiment of the present invention, Figure 3 As shown, the Contextual Transformer module of the fusion attention mechanism is entered, which is called the COT module in the present invention; first, a 3×3 convolution is performed on the input features to extract local information (key), and then the local information is concat-fused with the input features (query), and then an attention matrix is ​​generated through two consecutive 1×1 convolutions; at the same time, the input features are encoded (value) using a 1×1 convolution operation, and multiplied with the attention matrix to obtain global information; finally, the local information and the global information are fused.

[0041] Among them, the convolution layer for the key includes a grouped convolution, BatchNorm and ReLU activation; the convolution layer for the value includes a 1×1 convolution and BatchNorm; the attention embedding layer consists of two convolution layers, a BatchNorm layer and ReLU activation.

[0042] In some other embodiments of the present invention, the step S21 may further include:

[0043] A1: Divide the image: take a value for every other pixel in an image, similar to neighboring downsampling, and get four images that are complementary; Splice: Splice the four sub-images in the channel dimension to form a new tensor of size (4, 12, 320, 320);

[0044] A2: Enter the COT module: The output of Focus serves as the input of the COT module.

[0045] Furthermore, the process of entering the COT module in A2 is specifically divided into the following steps:

[0046] A21: Use 3×3 convolution operation, batch normalization and ReLU activation function on the input features to obtain the local information (key) of the image;

[0047] A22: Use the Concat operation to fuse local information with input features (query) and concatenate them along the channel dimension;

[0048] A23: Use two consecutive convolutions to obtain the attention matrix of the fused features. Set the size of each convolution kernel to 1×1, and obtain an attention matrix of size (4, 12, 3*3, 320, 320);

[0049] A24: Perform average pooling on the attention matrix along the third dimension (dimension of dim=2) to restore the size of (4, 12, 320, 320);

[0050] A25: Use 1×1 convolution operation and batch normalization to encode the input features and obtain the Value matrix;

[0051] A26: Perform matrix multiplication on the encoded Value matrix and the attention matrix, that is, multiply them element by element to obtain the weighted global features;

[0052] A27: Use the Concat operation to fuse local information with global information, and perform matrix addition operations.

[0053] Among them, for step S22, this implementation uses two-dimensional discrete wavelet transform to improve the downsampling module in the CSPDarknet53 structure, and reduces feature loss through an efficient downsampling method; this embodiment calls the improved downsampling module DWT_Down downsampling, first decomposes the original image in the row direction through a Haar wavelet high-pass filter and a low-pass filter, and decomposes the original image into a low-frequency part and a high-frequency part; and then decomposes it again in the column direction through a Haar wavelet filter, thereby obtaining four sub-bands, which represent the features of different frequency domains, respectively, to reduce the loss of features with discriminative effectiveness in the conventional downsampling process. In some embodiments of the present invention, step S22 may include the following steps:

[0054] S221: Perform 2D-DWT two-dimensional discrete wavelet transform on each channel feature of the image: Use Haar wavelet filter to apply low-pass filtering and high-pass filtering to the row direction of the feature to generate low-frequency components and high-frequency components. Apply low-pass filtering and high-pass filtering to the column direction of the obtained low-frequency components and high-frequency components to generate low-frequency components and high-frequency components respectively. Each channel finally obtains four sub-bands, and the width and height of each sub-band are half of the input feature map, where the four sub-bands are: low-frequency information (LL), horizontal high-frequency information (LH), vertical high-frequency information (HL) and diagonal high-frequency information (HH);

[0055] S222: splicing the four sub-band images obtained from each channel in the channel dimension;

[0056] S223: Adjustment of the number of channels: Since the number of channels of the concatenated feature map has increased fourfold, a 1x1 convolution operation is used to adjust the number of channels from 4*C back to C for subsequent network layer processing.

[0057] Among them, for step S23, this embodiment uses hollow convolution and different expansion coefficients to construct a multi-scale feature fusion structure instead of the FPN structure, which expands the receptive field while reducing the number of parameters and operations of traditional downsampling. The Neck network includes two parallel ASPP_CBAM modules, with inputs of F Dark2 、F Dark3 The features of the two levels are then fused to obtain feature maps with different receptive fields. In order to reduce the information loss caused by zero calculation during dilated convolution and the interference of some background information after feature fusion, the CBAM attention mechanism is combined to re-weight important information. The fused feature map is used to obtain channel attention and spatial attention through the attention mechanism, and then convolution is used to reduce the dimension of the feature.

[0058] In some embodiments of the present invention, step S23 may include the following steps:

[0059] S231: Output feature maps F of the second and third stages in the CSPDarknet53 structure Dark2 、F Dark3 They are respectively used as inputs of the parallel ASPP_CBAM modules;

[0060] Among them, the output feature maps of the second and third stages here actually correspond to the output feature maps FDark2 and FDark3 of the second Resblock_body and the third Resblock_body, and these two output feature maps are respectively used as the input of the parallel ASPP_CBAM module; for example, when the input is (640, 640, 3), the shapes of the two feature layers are feat1 = (80, 80, 256) and feat2 = (40, 40, 512).

[0061] S232: For each ASPP_CBAM module, firstly, the input feature map is subjected to dilated convolution, and dilated holes are inserted between the convolution kernel elements to expand the receptive field; feature maps with different receptive fields are obtained by adjusting different dilation coefficients; and then the feature maps are spliced ​​with the original feature map along the channel dimension;

[0062] S233: Name the concatenated output features F 2_Dark2 、F 2_Dark3 , obtain its channel attention map through the attention mechanism, and then continue to calculate the spatial attention map; then reduce the dimension of the obtained feature map through the convolution operation; finally, get the output of the parallel ASPP_CBAM module for subsequent Head network detection.

[0063] Furthermore, by inputting F 2_Dark2For example, the ASPP_CBAM module in S232 includes four parallel dilated convolutional layers to obtain a larger receptive field and extract more context information. The specific steps are as follows:

[0064] F 2_1 =AtrousConv(F Dark2 ,AX AtrousRate_1 ) (1)

[0065] F 2_2 =AtrousConv(F Dark2 ,AX AtrousRate_2 ) (2)

[0066] F 2_3 =AtrousConv(F Dark2 ,AX AtrousRate_3 ) (3)

[0067] F 2_4 =AtrousConv(F Dark2 ,AX AtrousRate_4 ) (4)

[0068] F 2_Dark2 =Concat(F 2_1 ,F 2_2 ,F 2_3 ,F 2_4 ,F Dark2 ) (5)

[0069] Among them, AtrousConv represents the input feature map F 2_Dark2 Perform a dilated convolution operation, and set the convolution operation parameters to kernel_size=3. Perform batch normalization and ReLU activation function after dilated convolution. AtrousRate_1 , AX AtrousRate_2 , AX AtrousRate_3 and AX AtrousRate_4 They represent different void coefficients, for example, they can be set to 6, 12, 18, and 24; Concat represents an operation of splicing by channel, and the output feature map F is obtained after the Concat operation. 2_Dark2 , spliced ​​with F after the dilated convolution 2_1 ,F 2_2 ,F 2_3 ,F 2_4 And the input feature map F Dark2 , the number of channels is F Dark2 five times.

[0070] In some other embodiments of the present invention, the step S23 may further include:

[0071] The process of attention mechanism operation in S233 is as follows:

[0072] B1: Infer a one-dimensional channel attention map M based on CBAM c_Dark2 ∈R 5C×1×1 : Use the maximum pooling and average pooling to aggregate the spatial information of the feature map and generate the maximum pooling feature and average pooling features The output results are sent to the shared fully connected layer respectively; the two results are added and normalized by the Sigmoid function to obtain the weight matrix M on the channel c_Dark2 ; The calculation formula is as follows:

[0073]

[0074] Among them, σ represents the Sigmoid function, MLP is an important component of the shared network multilayer perceptron, W 1 and W 0 represents the weight of MLP, Avg and Max represent average pooling and maximum pooling respectively.

[0075] B2: Multiply the weight matrix of the input feature and the channel feature to get the result

[0076] B3: Calculate the two-dimensional spatial attention map M s_Dark2 ∈R 1×H×W :Different from the channel mechanism, the feature map is first pooled along the channel axis using maximum pooling and average pooling; the two results are concat spliced; then a 3×3 convolutional layer is used to learn the spatial correlation to obtain a single channel weight; finally, the sigmoid function is used for normalization to obtain the spatial weight matrix M s_Dark2 ; The calculation formula is as follows:

[0077]

[0078] B4: Substitute the result F′ obtained in B2 2 Then with the output weight M in space s_Dark2 Multiply and get the result

[0079] B5: Subtract the result F from B4 2 ∈R 5C×H×W A 1×1 convolution operation is performed to compress the number of channels from 5C to C, thereby reducing the amount of calculation.

[0080] In the embodiment of the present invention, step S3 may specifically include the following steps:

[0081] The training set is input into the network, and the precision and recall are used as model measurement indicators. The training weight file with the highest accuracy is selected as the optimal weight file. The test set and the optimal weight file are input into the trained input network to obtain the helmet wearing status in the image to be detected.

[0082] Furthermore, the model training related parameters are set: input image size: train_img_size = 640, training batch size: batch_size = 4, number of iterations: epochs = 50, learning rate: learning-rate = 0.01, SGD momentum parameter: momentum = 0.9, weight decay rate: weight_decay = 0.0005, NMS threshold (used to remove duplicate detection boxes in the detection stage): nms_thres = 0.5, confidence threshold (used to filter low-confidence prediction boxes in the detection stage): conf_thres = 0.005, number of working processes: num-workers = 4, and the rest of the parameters use the default values; after the training is completed, the best performing model weights are saved as the file best.pt for subsequent helmet wearing detection tasks.

[0083] In the embodiment of the present invention, in step S3, in order to solve the problem that the traditional IoU has a small gradient when the overlapping area is small, which makes it difficult to effectively optimize the model, the WIoU v3 loss function is adopted to enhance the gradient through a weighted mechanism, thereby improving the performance of the model when processing small overlapping areas and targets of different sizes, thereby avoiding the performance degradation when detecting small targets. The calculation is shown in formulas (8)-(11):

[0084] L WIoUv3 =r×L WIoUv1 (8)

[0085]

[0086]

[0087]

[0088] Among them, L WIoUv3 is the loss function of WIoU v3; (x, y) and (x gt ,y gt ) represents the coordinates of the center points of the predicted box and the true box, Indicates that W g and H g Separated from the computational graph, R WIoURepresents the normalized distance between the center points of the real box and the predicted box; r is the non-monotonic focusing factor; α and β are hyperparameters that can be adjusted to adapt to different models, and δ is a positive number; is the constructed monotone focusing factor coefficient; is the sliding average of momentum m. β is used to describe the outlier degree of the bounding box quality. A small outlier degree means a high quality anchor box. Based on the gradient gain allocation strategy of the WIoU v3 loss function, a small gradient gain is allocated to it, so that the bounding box regression can focus on the anchor box of normal quality; a small gradient gain is allocated to the anchor box with a large outlier degree, which will effectively prevent low-quality examples from generating large harmful gradients. is dynamic, and the quality division criteria of the anchor boxes are also dynamic, so that the gradient gain allocation strategy of WIoU v3 is the optimal adjustment strategy at present. In some embodiments, the hyperparameters α and β are set to 1.9 and 3, respectively.

[0089] In some embodiments of the present invention, step S4 specifically includes taking regular photos of the target area for safety monitoring, or extracting key frames from surveillance videos, for real-time capturing the on-site images of the construction site to be tested corresponding to the actual construction site; transmitting the collected on-site images of the construction site to be tested to the terminal computer; the terminal computer uses the trained hard hat wearing detection network to identify and detect the incoming on-site images of the construction site to be tested, and obtains the hard hat wearing detection results in the on-site images of the construction site to be tested. For obtaining the on-site images of the construction site to be tested, hard hat wearing detection equipment and devices, such as multiple smart cameras, can be installed on the construction site to achieve the purpose of regular monitoring.

[0090] In some other embodiments of the present invention, step S4 may further include:

[0091] S41: Install construction site safety helmet wearing detection equipment and devices, including multiple intelligent cameras, to take regular photos of the safety monitoring target area, or extract key frames from the surveillance video to capture the target area image corresponding to the actual construction site in real time, or directly upload the image file to be detected;

[0092] S42: Transmitting the collected construction site image to the terminal computer;

[0093] S43: The terminal computer uses the improved YOLOX network model to identify and detect the incoming image, uses the pre-trained best weight file best.pt to perform analysis, and obtains the helmet wearing detection result in the target area image;

[0094] S44: The detection result can be displayed on the terminal computer through a graphical interface, and the predicted box of the detected helmet and its corresponding confidence level can be marked, or a report file can be generated for the management personnel to view. In order to improve management efficiency, the system can set an alarm mechanism, and immediately issue an alarm when it is detected that the helmet is not worn.

[0095] In some embodiments of the present invention, a system for detecting the wearing of a safety helmet at a small target construction site is also provided, which is used to implement the method for detecting the wearing of a safety helmet at a small target construction site as described in the first aspect of the present invention, and also refers to Figure 1 As shown, the system includes:

[0096] Image input module: used to collect construction site images and perform data annotation, build training data sets and test data sets, and perform preprocessing;

[0097] Feature extraction module: Based on the preset YOLOX model, a helmet wearing detection network for small targets is constructed, and the helmet wearing detection network is used for helmet wearing detection; the training set images and the test set images are input into the helmet wearing detection network for training, and WIoU v3 is used as the bounding box regression loss function to adjust the parameters of the helmet wearing detection network;

[0098] Detection and classification module: used to input the on-site image of the construction site to be tested into the trained safety helmet wearing detection network, and output the real-time detection result of the on-site image of the construction site to be tested.

[0099] It can be understood that the present invention uses a two-dimensional discrete wavelet transform to construct a downsampling module method, and captures features with discriminative effectiveness through multi-frequency domain information. In the feature fusion part, the characteristics of different receptive fields can be obtained by using dilated convolution to improve the feature fusion network, and by reducing the loss of features, the detection accuracy of smaller targets in the helmet wearing detection is improved, and the accuracy of the helmet wearing detection is further improved. Compared with the original YOLOX, this method not only reduces the number of parameters, but also further improves the accuracy of the helmet wearing detection, such as Figure 4 As shown, Figure 4 The figure shows a comparison of the detection effects of the traditional YOLOX and the improved YOLOX network (corresponding to CDA-YOLOX) according to the embodiment of the present invention on the safety helmets of workers at a construction site. The present invention has a lower missed detection rate.

[0100] A person skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the relevant hardware through a program, and the program can be stored in a computer-readable storage medium, which can include: ROM, RAM, disk or CD, etc.

[0101] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A construction site safety helmet wearing detection method for small targets, Features: The following steps are involved: S1: Collect construction site images and annotate them, build training and test datasets, and perform preprocessing; S2: Building a helmet wearing detection network for small targets based on a preset YOLOX model, where the helmet wearing detection network is used for helmet wearing detection; S3: input the training set images and the test set images into the helmet wearing detection network for training, and use WIoU v3 as the bounding box regression loss function to adjust the parameters of the helmet wearing detection network; S4: Input the on-site image of the construction site to be tested into the trained safety helmet wearing detection network, and output a real-time detection result of the on-site image of the construction site to be tested.

2. The method for detecting the wearing of safety helmets at small target construction sites according to claim 1, Features: Step S2 specifically includes the following steps: S21: In the Backbone network part of the preset YOLOX model, add an attention mechanism unit after the Focus module; S22: In the Backbone network part of the preset YOLOX model, the downsampling module in each stage of the CSPDarknet53 structure is improved by using two-dimensional discrete wavelet transform; S23: In the neck network part of the preset YOLOX model, the hole convolution is used with different expansion coefficients to construct a multi-scale feature fusion structure instead of the FPN structure; S24: In the Head network part of the preset YOLOX model, the feature map output by the Neck network part is classified and detected.

3. The method for detecting the wearing of safety helmets at small target construction sites according to claim 2, Features: In step S21, constructing the Focus module of the fused attention mechanism unit includes the following steps: S211: The original feature map obtained from the Backbone network part of the preset YOLOX model is fed into the Focus module, and four sub-feature maps are obtained from the original feature map in a manner of one pixel per pixel, and the four sub-feature maps are spliced ​​in the channel dimension to form a new feature map; S212: After the new feature map enters the attention mechanism unit, the input feature map is first convolved 3×3 to extract local information, and then the local information is concat fused with the input feature map, and then the attention matrix is ​​generated through two consecutive convolutions; at the same time, the input feature map is encoded and multiplied with the attention matrix to obtain global information; finally, the local information and the global information are fused.

4. The method for detecting the wearing of safety helmets at small target construction sites according to claim 2, Features: In the step S22, the downsampling module in each stage of the CSPDarknet53 structure is improved by using a two-dimensional discrete wavelet transform, including first selecting a Haar wavelet filter, applying low-pass filtering and high-pass filtering in the row direction and column direction to each channel of the original image, and obtaining four sub-bands in different frequency domains and different spatial domains; splicing the four sub-bands of each channel along the channel direction; and finally adjusting the number of channels through a convolution operation, wherein the four sub-bands are low-frequency information, horizontal high-frequency information, vertical high-frequency information, and diagonal high-frequency information.

5. The method for detecting the wearing of safety helmets at small target construction sites according to claim 2, Features: In step S23, the neck network includes two parallel ASPP_CBAM modules, and the inputs are the second stage and the third stage of the CSPDarknet53 structure, i.e., F Dark2 、F Dark3, The features of the two levels are combined, and the feature maps of different receptive fields are obtained through the fusion structure; the fused feature maps are used to obtain channel attention and spatial attention through the attention mechanism, and then the convolution is used to reduce the dimension of the features; wherein the ASPP_CBAM module includes four parallel hole convolution layers.

6. The construction site safety helmet wearing detection method for small targets according to claim 2 or 5, Features: In step S23, the specific implementation process is as follows: S231: Output feature maps F of the second and third stages in the CSPDarknet53 structure Dark2 、F Dark3 They are respectively used as inputs of the parallel ASPP_CBAM modules; S232: For each ASPP_CBAM module, firstly, dilated convolution is performed on the input feature map, and dilated holes are inserted between the convolution kernel elements to expand the receptive field; feature maps with different receptive fields are obtained by adjusting different dilation coefficients; and then they are spliced ​​with the original feature map along the channel dimension; S233: Name the concatenated output features F 2_hark2 、F 2_Dark3 , obtain its channel attention map through the attention mechanism, and then continue to calculate the spatial attention map; then reduce the dimension of the obtained feature map through the convolution operation; finally, get the output of the parallel ASPP_CBAM module for subsequent Head network detection.

7. The method for detecting the wearing of safety helmets at small target construction sites according to claim 1, Features: The step S3 comprises the following steps: inputting the training set images into the helmet wearing detection network, taking the precision rate Precision and the recall rate ReECAll as the model measurement indicators, and selecting the training weight file with the highest accuracy as the optimal weight file; inputting the test set images and the optimal weight file into the trained helmet wearing detection network for verification.

8. The method for detecting the wearing of safety helmets at small construction sites according to claim 1, Features: The step S4 specifically includes taking photos of the safety monitoring target area at regular intervals, or extracting key frames from the surveillance video, for real-time capturing the on-site images of the construction site to be tested corresponding to the actual construction site; transmitting the collected on-site images of the construction site to be tested to the terminal computer; the terminal computer uses the trained safety helmet wearing detection network to identify and detect the incoming on-site images of the construction site to be tested, and obtains the safety helmet wearing detection results in the on-site images of the construction site to be tested.

9. A safety helmet wearing detection system for small target construction sites, used to implement the safety helmet wearing detection method for small target construction sites as claimed in any one of claims 1 to 8, It is characterized in that The system includes: Image input module: used to collect construction site images and perform data annotation, build training data sets and test data sets, and perform preprocessing; Feature extraction module: Based on the preset YOLOX model, a helmet wearing detection network for small targets is constructed, and the helmet wearing detection network is used for helmet wearing detection; the training set images and the test set images are input into the helmet wearing detection network for training, and WIoU v3 is used as the bounding box regression loss function to adjust the parameters of the helmet wearing detection network; Detection and classification module: used to input the on-site image of the construction site to be tested into the trained safety helmet wearing detection network, and output the real-time detection result of the on-site image of the construction site to be tested.

Citation Information

Patent Citations

  • Lightweight YOLOv4 construction site safety helmet wearing detection method and device

    CN113989852A

  • Construction site safety helmet wearing detection method based on improved YOLOX network

    CN115223093A

  • Safety helmet detection and identification method

    CN116152546A

  • Safety helmet wearing detection method and device based on improved YOLOX

    CN116503707A

  • Metal surface defect detection method and device based on improved YOLO model

    CN116977294A

Cited By

  • Safety helmet detection method

    CN119964074A

  • Safety helmet wearing identification method and system based on multi-scale feature fusion

    CN120339592A

  • A safety helmet wearing recognition method and system based on multi-scale feature fusion

    CN120339592B

  • Traditional Chinese medicine decoction piece identification method and system based on improved YOLOv7 algorithm

    CN121281033A