Safety helmet identification method for monitoring type unmanned aerial vehicle
By extracting the appearance and spatial relationship features of the safety helmet, and combining improved edge detection and target localization algorithms, the feature weights are dynamically adjusted, and a deep learning model is used to identify drone safety helmets. This solves the problems of recognition accuracy and adaptability in existing technologies, and achieves higher recognition accuracy and reliability.
Patent Information
- Application Number
- CN202511093531.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-06
- Publication Date
- 2025-11-21
AI Technical Summary
Existing drone helmet recognition technologies suffer from problems such as incomplete feature extraction, inaccurate edge detection, inaccurate target localization, unreasonable feature fusion methods, and poor adaptability of recognition models, resulting in insufficient recognition accuracy and reliability.
The method simultaneously extracts the appearance features of the safety helmet and the spatial relationship features between the person's head and the safety helmet, combines the improved Canny algorithm for edge detection, uses the YOLO series algorithms for target localization, performs feature fusion by dynamically adjusting feature weights, and uses a deep learning-based convolutional neural network model for recognition.
It improves the accuracy and reliability of safety helmet recognition, effectively distinguishes safety helmets from similar objects in complex scenes, adapts to different lighting conditions and population density, and reduces the false judgment rate.
Smart Images

Figure CN120997634A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of safety monitoring technology, specifically to a method for identifying safety helmets used in monitoring drones. Background Technology
[0002] In numerous scenarios such as construction and industrial production, safety helmets are crucial protective equipment for ensuring the safety of personnel's heads. Timely and accurate monitoring of whether personnel are wearing safety helmets is of great significance for preventing accidents and protecting lives. Traditional safety helmet monitoring methods mainly rely on manual inspections, which are not only inefficient but also difficult to achieve comprehensive and real-time monitoring, easily overlooking some violations. With the development of technology, image recognition-based safety helmet monitoring technology has gradually emerged. Currently, some fixed-location surveillance cameras combined with image recognition algorithms are used for safety helmet monitoring. However, these fixed monitoring devices have the drawback of limited monitoring range, unable to cover large areas, and are insufficient for scenarios with complex terrain or requiring dynamic monitoring.
[0003] Monitoring drones have advantages such as high flexibility and wide monitoring range, and their application to safety helmet recognition has become a new research direction. However, existing drone-based safety helmet recognition technologies still have many shortcomings: (1) Incomplete feature extraction: Some existing technologies only focus on the appearance features of the safety helmet, such as color and shape, while ignoring the spatial positional relationship between the person's head and the safety helmet. In actual scenarios, relying solely on appearance features can easily lead to misjudgment. For example, some objects with similar colors to the safety helmet may be mistakenly identified as safety helmets. Spatial positional relationship features can provide more accurate information to help distinguish real safety helmets from other similar objects. (2) Inaccurate edge detection: Edge detection is an important step in extracting the appearance features of the safety helmet, but existing edge detection algorithms are prone to edge breakage and noise interference when processing complex backgrounds or low-contrast images, resulting in inaccurate extracted safety helmet contours, which in turn affects the accuracy of subsequent feature extraction and recognition. (3) Inaccurate target localization: Accurate localization of the person's head and the safety helmet is the basis for calculating spatial positional relationship features. However, existing target localization algorithms experience a significant drop in localization accuracy when faced with dense crowds or occlusion, leading to inaccurate spatial positional relationship features and affecting the final helmet recognition result. (4) Inappropriate feature fusion methods: When fusing appearance features and spatial positional relationship features, most existing methods use simple splicing or weighted averaging, without fully considering the differences in importance of different features in different scenarios. They cannot dynamically adjust feature weights according to actual application scenarios, resulting in fused features that cannot accurately reflect the true situation of the helmet and reducing recognition accuracy. (5) Poor adaptability of recognition models: Existing recognition models are usually trained on fixed datasets and have poor adaptability to complex scenarios such as different lighting conditions and crowd density. In practical applications, due to changes in environmental factors, the recognition performance of the model will be greatly affected, and misjudgment or missed judgment is likely to occur. Summary of the Invention
[0004] The purpose of this invention is to provide a method, system, electronic device, and computer-readable storage medium for identifying safety helmets on monitoring drones, in order to solve the problems of incomplete feature extraction, inaccurate edge detection, inaccurate target positioning, unreasonable feature fusion methods, and poor adaptability of recognition models in the prior art, thereby improving the accuracy and reliability of safety helmet identification.
[0005] Specifically, the technical solution provided by this invention is: a method for identifying safety helmets for monitoring drones, comprising the following steps:
[0006] S1. Obtain raw image data containing people in the target area using image acquisition equipment mounted on a monitoring drone;
[0007] S2. Extract the appearance features of the safety helmet and the spatial relationship features between the person's head and the safety helmet from the acquired raw image data;
[0008] S3. The extracted appearance features and spatial relationship features are fused to generate a fused feature vector;
[0009] S4. Based on the fused feature vector, use the preset recognition model to monitor and identify whether people in the target area are wearing safety helmets, and output the recognition results.
[0010] Preferably, S2 further includes:
[0011] S2.1. Perform grayscale processing on the original image data to convert the color image to a grayscale image. The formula is as follows:
[0012] Gray = 0.299R + 0.587G + 0.114B, where R, G, and B are the red, green, and blue component values of a pixel in the original image, respectively, and Gray is the converted gray value.
[0013] S2.2. The Canny algorithm is used to perform edge detection on the grayscale image to obtain the outline edge information of the safety helmet;
[0014] S2.3. Based on the contour edge information, extract the geometric shape features of the safety helmet, including aspect ratio, area, perimeter, and color histogram features, using the following formula: Where i = 0, 1, ..., L-1, L is the color quantization level, and n i Let N be the number of pixels with color value i in the image, N be the total number of pixels in the image, and H(i) be the proportion of pixels with color value i in the image.
[0015] S2.4. Use the YOLO series of algorithms to locate the head of the person and the safety helmet in the original image and determine their coordinate position in the image;
[0016] S2.5 Calculate the Euclidean distance d between the center of the person's head and the center of the safety helmet. The formula is:
[0017] Where (x1, y1) are the coordinates of the center of the person's head, and (x2, y2) are the coordinates of the center of the safety helmet;
[0018] S2.6. Based on the bounding box information of the person's head and the safety helmet, calculate the overlap area S between them. overlap and the head area S of the personnel head and the area S of the safety helmet helmet And calculate the overlap rate.
[0019]
[0020] S2.7, Combine the Euclidean distance d and the overlap rate R overlap Features representing the spatial relationship between a person's head and their safety helmet.
[0021] Preferably, S2.2 further includes:
[0022] S2.2.1. Perform convolution processing on the grayscale image using a Gaussian filter;
[0023] S2.2.2 Calculate the gradient G of the image in the horizontal and vertical directions using the Sobel operator. x and G y Calculate the gradient magnitude G and gradient direction θ;
[0024] S2.2.3. Compare the gradient magnitude of each pixel with the gradient magnitude of its neighboring pixels along the gradient direction. If the gradient magnitude of the pixel is not a local maximum, set its magnitude to 0.
[0025] S2.2.4, Set two thresholds, T high and T low Gradient magnitude greater than T high The pixels are considered strong edge points, and the gradient magnitude is less than T. low Pixels that are strong or weak are considered non-edge points, and pixels that fall between them are considered weak edge points. Weak edge points are then evaluated for edge connectivity. If a weak edge point is connected to a strong edge point, it is retained as an edge point; otherwise, it is suppressed.
[0026] Preferably, S2.4 further includes:
[0027] S2.4.1 Scale the original image to the input size specified by the YOLO model;
[0028] S2.4.2 Input the preprocessed image into the YOLO model. The YOLO model predicts the feature map. For each grid cell, the model predicts B bounding boxes. Each bounding box contains the center coordinates (x, y), width w, height h, and confidence C.
[0029] S2.4.3 Sort all bounding boxes in descending order according to the confidence level of each bounding box, select the bounding box with the highest confidence level as the retained bounding box, and calculate its intersection-union ratio (IoU) with the remaining bounding boxes.
[0030] S2.4.4. Based on the position of the grid cells and the offset of the bounding box center coordinates, calculate the coordinates (x, y, y) of the bounding box center in the original image. abs y abs Based on the ratio of the bounding box's width to its height and the size of the anchor box, calculate the width w of the bounding box in the original image. absand height h abs .
[0031] Preferably, S3 also includes:
[0032] S3.1, Let the appearance feature vector be F. appearance =(f a1 f a2 , ..., f an The spatial positional relationship feature vector is F. position =(f p1 ,f p2 ,…,f pm );
[0033] S3.2 Assign weights ω to the appearance feature vector and the spatial position relationship feature vector respectively. appearance and ω position , and ω appearance +ω position =1;
[0034] S3.3 Calculate the fused feature vector, the formula is:
[0035] F fusion =ω appearance F appearance +ω position F position =(ω appearance f a1 +ω position f p1 ,ω appearance f a2 +ω position f p2 ,…,ω appearance f an +ω position f pm ).
[0036] Preferably, ω appearance and ω position The weight values are determined through experiments based on actual application scenarios and historical data, and are dynamically adjusted under different lighting conditions and population density scenarios.
[0037] Preferably, in S4, the recognition model is a deep learning-based convolutional neural network model, which is trained using a large amount of image data labeled with whether or not a safety helmet is worn. The recognition process involves inputting the fused feature vector into the trained convolutional neural network model, and the model outputs the recognition result of whether the person in the target area is wearing a safety helmet. The recognition result is presented in the form of a probability value. A threshold θ is set. When the probability value is greater than or equal to θ, it is determined that the person is wearing a safety helmet. When the probability value is less than θ, it is determined that the person is not wearing a safety helmet.
[0038] Preferably, a helmet recognition system for monitoring drones is also provided, comprising:
[0039] The image acquisition module sends image data to the image preprocessing module via a data transmission line or wireless communication protocol. It is responsible for acquiring raw image data containing people in the target area in real time, providing basic data for subsequent safety helmet recognition.
[0040] The image preprocessing module transfers data between its sub-modules through internal function calls or message queues, converting color images to grayscale images and performing data splitting processing.
[0041] The edge detection module receives the grayscale image from the image preprocessing module, performs edge detection, and then transmits the outline edge information of the safety helmet to the appearance feature extraction submodule.
[0042] The appearance feature extraction module receives the helmet outline edge information from the edge detection module, extracts the geometric shape features and color histogram features of the helmet, and then transmits the appearance feature vector to the feature fusion module.
[0043] The target localization module receives the raw image from the image preprocessing module, locates the person's head and safety helmet, and then transmits the localization information to the spatial position relationship feature extraction submodule.
[0044] The spatial position relationship feature extraction module receives the positioning information of the person's head and safety helmet from the target positioning module, calculates the Euclidean distance and overlap rate, and then transmits the spatial position relationship feature vector to the feature fusion module.
[0045] The feature fusion module receives the appearance feature vector from the appearance feature extraction module and the spatial position relationship feature vector from the spatial position relationship feature extraction module, performs fusion processing, and then transmits the fused feature vector to the recognition module.
[0046] The recognition module receives the fused feature vector from the feature fusion module, performs recognition and judgment, and outputs the recognition result.
[0047] Preferably, an electronic device is also provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of any of the above-described methods for identifying a safety helmet for a monitoring drone.
[0048] Preferably, a computer-readable storage medium is also provided, on which a computer program is stored, which, when executed by a processor, implements the steps of any of the above-described methods for identifying a safety helmet for a monitoring drone.
[0049] Compared with existing technologies, the advantages of this invention are: (1) Comprehensive feature extraction: This invention extracts both the appearance features of the safety helmet and the spatial relationship features between the person's head and the safety helmet, taking into account multiple aspects of information. It can effectively distinguish between real safety helmets and other similar objects, greatly reducing the possibility of misjudgment and improving the accuracy of recognition. (2) Precise edge detection: An improved Canny algorithm is used for edge detection. Gaussian filtering is used to reduce noise interference, and the gradient magnitude and direction are accurately calculated. Double threshold processing and edge connection judgment are used to obtain more accurate safety helmet contour edge information, providing a reliable foundation for subsequent feature extraction. (3) Accurate target positioning: YOLO series algorithms are used to locate the person's head and safety helmet. This algorithm has high positioning accuracy and real-time performance, and can accurately determine the position of the target in the image. Even in complex situations such as dense crowds and occlusion, it can maintain a good positioning effect, thereby ensuring the accuracy of spatial relationship feature calculation. (4) Reasonable feature fusion: Dynamic weights are assigned to appearance features and spatial relationship features based on actual application scenarios and historical data. This fully considers the differences in importance of different features in different scenarios, making the fused features more reflective of the actual situation of the safety helmet and improving the adaptability of the recognition model to different scenarios. (5) Strong adaptability of the recognition model: A deep learning-based convolutional neural network model is used as the recognition model and trained with a large amount of labeled data, which can learn the complex features and patterns of the safety helmet. At the same time, combined with comprehensive feature extraction and reasonable feature fusion methods, the model has stronger adaptability to complex scenarios such as different lighting conditions and population density, which can effectively improve the accuracy and reliability of safety helmet recognition. Attached Figure Description
[0050] To make the content of this invention easier to understand, the invention will be further described in detail below with reference to specific embodiments and accompanying drawings.
[0051] Figure 1 This is a schematic diagram of the overall steps of a helmet identification method for monitoring drones according to the present invention.
[0052] Figure 2 This is a schematic diagram showing the steps of S2.
[0053] Figure 3 This is a schematic diagram of the steps in S3.
[0054] Figure 4 This is a schematic diagram of the architecture of a helmet recognition system for monitoring drones according to the present invention. Detailed Implementation
[0055] Example 1
[0056] like Figures 1 to 3As shown, this embodiment provides a method for identifying safety helmets for monitoring drones, specifically including: S1, acquiring original image data containing people in the target area using an image acquisition device mounted on the monitoring drone; S2, extracting the appearance features of the safety helmet and the spatial positional relationship features between the person's head and the safety helmet from the acquired original image data; S3, fusing the extracted appearance features and spatial positional relationship features to generate a fused feature vector; S4, based on the fused feature vector, using a preset recognition model to monitor and identify whether people in the target area are wearing safety helmets, and outputting the recognition result.
[0057] S2 also includes: S2.1, converting the original image data to grayscale, using the formula: Gray = 0.299R + 0.587G + 0.114B, where R, G, and B are the red, green, and blue component values of pixels in the original image, respectively, and Gray is the converted grayscale value; S2.2, using the Canny algorithm to perform edge detection on the grayscale image to obtain the contour edge information of the safety helmet; S2.3, based on the contour edge information, extracting the geometric shape features of the safety helmet, including aspect ratio, area, perimeter, and color histogram features, using the formula: Where i = 0, 1, ..., L-1, L is the color quantization level, and n i S2.4 Let N be the number of pixels with color value i in the image, N be the total number of pixels in the image, and H(i) be the proportion of pixels with color value i in the image; S2.5 Use YOLO series algorithms to locate the person's head and safety helmet in the original image and determine their coordinate positions in the image; S2.6 Calculate the Euclidean distance d between the center of the person's head and the center of the safety helmet, using the formula:
[0058] Where (x1, y1) are the coordinates of the center of the person's head, and (x2, y2) are the coordinates of the center of the safety helmet; S2.6, Calculate the overlap area S between the person's head and the safety helmet based on their bounding box information. overlap and the head area S of the personnel head and the area S of the safety helmet helmet And calculate the overlap rate. S2.7, Combine the Euclidean distance d and the overlap rate R overlap Features representing the spatial relationship between a person's head and their safety helmet.
[0059] S3 also includes: S3.1, Let the appearance feature vector be F. appearance =(f a1 f a2 , ..., f an The spatial positional relationship feature vector is F. position =(f p1 fp2 , ..., f pm S3.2, assign weights ω to the appearance feature vector and the spatial position relationship feature vector respectively. appearance and ω position , and ω appearance +ω position =1; S3.3, Calculate the fused feature vector, the formula is:
[0060] F fusion =ω appearance F appearance +ω position F position =(ω appearance f a1 +ω position f p1 ,ω appearance f a2 +ω position f p2 ,…,ω appearance f an +ω posstion f pm ). ω appearance and ω position The weight values are determined through experiments based on actual application scenarios and historical data, and are dynamically adjusted under different lighting conditions and population density scenarios.
[0061] In S4, the recognition model is a deep learning-based convolutional neural network model, which is trained using a large amount of image data labeled with whether or not a safety helmet is worn. The recognition process involves inputting the fused feature vector into the trained convolutional neural network model, and the model outputs the recognition result of whether the person in the target area is wearing a safety helmet. The recognition result is presented in the form of a probability value. A threshold θ is set. When the probability value is greater than or equal to θ, it is determined that the person is wearing a safety helmet. When the probability value is less than θ, it is determined that the person is not wearing a safety helmet.
[0062] Example 2
[0063] like Figures 1 to 3 As shown, this embodiment elaborates on S2.2, which further includes:
[0064] S2.2.1. Perform a convolution operation on the grayscale image using a Gaussian filter. Let the input image be I(x, y), and the Gaussian filter be... Where σ is the standard deviation of the Gaussian kernel, which controls the degree of smoothing. The smoothed image is Is(x,y)=I(x,y)*G(x,y), where * represents the convolution operation;
[0065] S2.2.2 Calculate the gradient G of the image in the horizontal and vertical directions using the Sobel operator. x and Gy ,
[0066] Calculate the gradient magnitude G and gradient direction θ.
[0067]
[0068] S2.2.3. Compare the gradient magnitude of each pixel with the gradient magnitude of its neighboring pixels along the gradient direction. If the gradient magnitude of the pixel is not a local maximum, set its magnitude to 0.
[0069] S2.2.4, Set two thresholds, T high and T low Traverse the image and assign gradient magnitudes G(x, y) greater than T. high Pixels marked as strong edge points retain their gradient magnitude unchanged; those less than T low Pixels marked as non-edge points are assigned a gradient magnitude of 0; between T low and T high Pixels between weak edge points are marked as weak edge points, and their gradient magnitudes are temporarily retained. For each weak edge point, check whether there are strong edge points in its neighborhood. If there are, the weak edge point is retained as an edge point and its gradient magnitude remains unchanged; otherwise, the point is suppressed and its gradient magnitude is set to 0.
[0070] Example 3
[0071] like Figures 1 to 3 As shown, this embodiment elaborates on S2.4, which further includes:
[0072] S2.4.1 Scale the original image to the input size specified by the YOLO model, and normalize the image pixel values from the range [0,255] to the range [0,1], using the following formula: Where I is the original image pixel value, I normalized These are the normalized pixel values;
[0073] S2.4.2 Input the preprocessed image into the YOLO model. The YOLO model uses Darknet-53 as the backbone network to predict the feature map. For each grid cell, the model will predict B bounding boxes. Each bounding box contains the bounding box center coordinates (x, y), width w, height h, and confidence C.
[0074] The bounding box center coordinates (x, y) are the offset relative to the top-left corner of the current grid cell, mapped to the range [0, 1] using the Sigmoid function. The formula is: x pred =σ(x raw ), y pred =σ(y raw), where x raw and y raw The original predicted values are given by the model, and σ is the Sigmoid function.
[0075] The bounding box width w and height h are proportions relative to the entire image size, and their actual values are obtained through exponential operations. The formula is: w pred =w raw ×w anchor ,h pred =h raw ×h anchor , where w raw and h raw w represents the original predicted value from the model. anchor and h anchor The width and height of the anchor frame are preset.
[0076] The confidence score C is mapped to the range [0,1] using the Sigmoid function, representing the probability that the bounding box contains a target (person's head or safety helmet). The formula is: C pred =σ(C raw ).
[0077] S2.4.3. Sort all bounding boxes in descending order based on their confidence scores, select the bounding box with the highest confidence score as the retained bounding box, and calculate its Intersection over Union (IoU) with the remaining bounding boxes. The formula is as follows: Where A∩B represents the intersection area of two bounding boxes, and A∪B represents the union area of two bounding boxes; if the IoU between a bounding box and the retained bounding boxes is greater than a preset threshold T. nms If the value is 0.5, it is considered that the bounding box and the retained bounding box detect the same target, and it is suppressed, that is, deleted from the bounding box list;
[0078] S2.4.4. Based on the position of the grid cells and the offset of the bounding box center coordinates, calculate the coordinates (x, y, y) of the bounding box center in the original image. abs y abs Let the coordinates of the top-left corner of the grid cell be (i×S). grid j×S grid ), where i and j are the row and column indices of the grid cell, and S grid Let the size of the mesh cell be:
[0079] x abs =i×S grid +ω pred ×S grid y abs =j×S grid +y pred ×S gridBased on the ratio of the bounding box's width to its height and the size of the anchor box, calculate the width w of the bounding box in the original image. abs and height h abs Let the width of the original image be W and the height be H, then
[0080] w abs =w pred ×W, h abs =h pred ×H.
[0081] Example 4
[0082] like Figures 1 to 4 As shown, this embodiment provides a helmet recognition system for monitoring drones. It utilizes an image acquisition device mounted on the monitoring drone, specifically a high-definition camera. This high-definition camera features autofocus and light compensation functions to adapt to image acquisition needs in different environments, ensuring clear and complete raw image data. The raw image data includes images of people in the target area under different angles and lighting conditions. The system functional modules include:
[0083] 1. Image acquisition module
[0084] It mainly consists of image acquisition equipment mounted on a monitoring drone. This equipment collects image data of the target area in real time and transmits the raw image data to the subsequent processing module. The image data is sent to the image preprocessing module via a data transmission line (such as a wired connection) or a wireless communication protocol (such as Wi-Fi, Bluetooth, etc.). It is responsible for acquiring raw image data containing people in the target area in real time, providing the foundational data for subsequent helmet identification.
[0085] 2. Image preprocessing module
[0086] Implemented using Python computer programming language and OpenCV image processing library, it receives raw image data from image acquisition module, performs grayscale processing, and then transmits the grayscale image to edge detection submodule; at the same time, it directly transmits the raw image to target localization submodule. Module functions: (1) Grayscale processing: Converts color image to grayscale image, the formula is: Gray=0.299R+0.587G+0.114B, where R, G, and B are the red, green, and blue component values of the pixels in the raw image, respectively, and Gray is the converted grayscale value; (2) Data splitting: Transmits the processed grayscale image and the raw image to different subsequent processing submodules respectively.
[0087] 3. Edge detection module
[0088] The Canny algorithm is implemented based on image processing libraries such as OpenCV. The grayscale image received from the image preprocessing module is processed for edge detection, and then the outline edge information of the safety helmet is transmitted to the appearance feature extraction submodule. Module functions: (1) Gaussian filtering: A Gaussian filter is used to perform convolution on the grayscale image. Let the input image be I(x, y), and the Gaussian filter be... Where σ is the standard deviation of the Gaussian kernel, controlling the degree of smoothing, and the smoothed image I s (x, y) = I(x, y) * G(x, y), * represents convolution operation; (2) Gradient calculation: use the Sobel operator to calculate the gradient G of the image in the horizontal and vertical directions. x and G y ,
[0089] Calculate the gradient magnitude G and gradient direction θ.
[0090]
[0091] (3) Non-maximum suppression: Compare the gradient magnitude of each pixel with the gradient magnitude of its neighboring pixels along the gradient direction. If the gradient magnitude of the pixel is not a local maximum, set its magnitude to 0; (4) Dual threshold detection and edge connection: Set two thresholds, T high and T low Gradient magnitude greater than T high The pixels are considered strong edge points, and the gradient magnitude is less than T. low Pixels that are strong or weak are considered non-edge points, while pixels in between are considered weak edge points. Then, edge connectivity is determined for weak edge points. If a weak edge point is connected to a strong edge point, it is retained as an edge point; otherwise, it is suppressed.
[0092] 4. Appearance Feature Extraction Module
[0093] The system receives the helmet contour edge information from the edge detection module, extracts the helmet's geometric shape features and color histogram features, and then transmits the appearance feature vector to the feature fusion module. Module functions: (1) Geometric shape feature extraction: Based on the contour edge information, extract the helmet's aspect ratio, area, perimeter, and other features. (2) Color histogram feature extraction: The formula is as follows: Where i = 0, 1, ..., L-1, L is the color quantization level, and n i (2) Number of pixels with color value i in the image, N is the total number of pixels in the image, and H(i) is the proportion of pixels with color value i in the image; (3) Feature vector generation: Combine the extracted geometric features and color histogram features into an appearance feature vector.
[0094] 5. Target localization module
[0095] This is implemented based on the YOLO series algorithms and related PyTorch deep learning framework. It receives the original image from the image preprocessing module, locates the person's head and safety helmet, and then transmits the location information to the spatial position relationship feature extraction submodule. Module functions: (1) Image preprocessing: Scales the original image to the input size specified by the YOLO model, and normalizes the image pixel values from the range [0,255] to the range [0,1], using the formula: Where I is the original image pixel value, I normalized (2) Model inference: Input the preprocessed image into the YOLO model. The YOLO model uses Darknet-53 as the backbone network to predict the feature map. For each grid cell, the model will predict B bounding boxes. Each bounding box contains the bounding box center coordinates (x, y), width w, height h, and confidence C. The bounding box center coordinates (x, y) are the offset relative to the upper left corner of the current grid cell. After being mapped to the [0,1] range by the Sigmoid function, the formula is:
[0096] x pred =σ(x raw ),y pred =σ(y raw ), where x raw and y raw The original predicted values are given by the model, and σ is the Sigmoid function. The bounding box width w and height h are proportions relative to the entire image size, and their actual values are obtained through exponential operations, as shown in the formula:
[0097] w pred =w raw ×w anchor h pred =h raw ×h anchor , where w raw and h raw w represents the original predicted value from the model. anchor and h anchor The width and height of the anchor box are preset. The confidence score C is mapped to the range [0,1] using the Sigmoid function, representing the probability that the bounding box contains a target (person's head or safety helmet), and the formula is: C pred =σ(C raw (3) Non-maximum suppression: Sort all bounding boxes in descending order according to the confidence level of each bounding box, select the bounding box with the highest confidence level as the retained bounding box, and calculate its intersection-union ratio (IoU) with the remaining bounding boxes. The formula is: Where A∩B represents the intersection area of two bounding boxes, and A∪B represents the union area of two bounding boxes; if the IoU between a bounding box and the retained bounding boxes is greater than a preset threshold T. nms (Take 0.5), then it is considered that the bounding box and the retained bounding box detect the same target, and it is suppressed, that is, deleted from the bounding box list; (4) Coordinate transformation: According to the position of the grid cell and the offset of the bounding box center coordinates, calculate the coordinates (x, y, x) of the bounding box center in the original image. abs y abs Let the coordinates of the top-left corner of the grid cell be (i×S). grid ,j×S grid ), where i and j are the row and column indices of the grid cell, and S grid Let the size of the mesh cell be:
[0098] x abs =i×S grid +x pred ×S grid y abs =j×S grid +y pred ×S grid Based on the ratio of the bounding box's width to its height and the size of the anchor box, calculate the width w of the bounding box in the original image. abs and height h abs Let the width of the original image be W and the height be H, then
[0099] w abs =w pred ×W, h abs =h pred ×H.
[0100] 6. Spatial Location Relationship Feature Extraction Module
[0101] The system receives positioning information of the person's head and safety helmet from the target positioning module, calculates the Euclidean distance and overlap rate, and then transmits the spatial positional relationship feature vector to the feature fusion module. Module functions: (1) Euclidean distance calculation: Calculates the Euclidean distance d between the center of the person's head and the center of the safety helmet, using the formula:
[0102] Where (x1, y1) are the center coordinates of the person's head, and (x2, y2) are the center coordinates of the safety helmet; (2) Overlap rate calculation: Based on the bounding box information of the person's head and the safety helmet, calculate the overlap area S between them. overlap and the head area S of the personnel head and the area S of the safety helmet helmet And calculate the overlap rate. (3) Feature vector generation: Combine the Euclidean distance d and the overlap ratio R overlapFeatures representing the spatial relationship between a person's head and their safety helmet.
[0103] 7. Feature Fusion Module
[0104] The module receives appearance feature vectors from the appearance feature extraction module and spatial position relationship feature vectors from the spatial position relationship feature extraction module, performs fusion processing, and then transmits the fused feature vector to the recognition module. Module functions: (1) Weight allocation: Assign weights ω to the appearance feature vector and the spatial position relationship feature vector respectively. appearance and ω position , and ω appearance +ω position =1; (2) Feature fusion: Calculate the fused feature vector, the formula is:
[0105] F fusion =ω appearance F appearance +ω position F position =(ω appearance f a1 +ω position f p1 ,ω appearance f a2 +ω postion f p2 ,…,ω appearonce f an +ω position f pm ).
[0106] 8. Recognition Module
[0107] The ResNet model is based on deep learning. It receives the fused feature vector from the feature fusion module, performs recognition judgment, and outputs the recognition result. It receives the fused feature vector through the model input interface and outputs the recognition result through the output interface. Module functions: (1) Model training: The model is trained by a large amount of image data labeled with whether or not a safety helmet is worn. (2) Recognition judgment: The fused feature vector is input into the trained convolutional neural network model. The model outputs the recognition result of whether the person in the target area is wearing a safety helmet. The recognition result is presented in the form of probability value. A threshold θ is set. When the probability value is greater than or equal to θ, it is judged as wearing a safety helmet. When the probability value is less than θ, it is judged as not wearing a safety helmet.
[0108] Obviously, the above embodiments are merely illustrative examples for clear explanation and are not intended to limit the implementation. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively list all possible implementations here. However, obvious variations or modifications derived therefrom are still within the scope of protection of this invention.
Claims
1. A method for identifying safety helmets for monitoring drones, characterized in that... Includes the following steps: S1. Obtain raw image data containing people in the target area using image acquisition equipment mounted on a monitoring drone; S2. Extract the appearance features of the safety helmet and the spatial relationship features between the person's head and the safety helmet from the acquired raw image data; S3. The extracted appearance features and spatial relationship features are fused to generate a fused feature vector; S4. Based on the fused feature vector, use the preset recognition model to monitor and identify whether people in the target area are wearing safety helmets, and output the recognition results.
2. The method for identifying safety helmets for monitoring drones according to claim 1, characterized in that... S2 further includes: S2.
1. Perform grayscale processing on the original image data to convert the color image to a grayscale image. The formula is as follows: Gray = 0.299R + 0.587G + 0.114B, where R, G, and B are the red, green, and blue component values of a pixel in the original image, respectively, and Gray is the converted gray value. S2.
2. The Canny algorithm is used to perform edge detection on the grayscale image to obtain the outline edge information of the safety helmet; S2.
3. Based on the contour edge information, extract the geometric shape features of the safety helmet, including aspect ratio, area, perimeter, and color histogram features, using the following formula: Where i = 0, 1, ..., L-1, L is the color quantization level, and n i Let N be the number of pixels with color value i in the image, N be the total number of pixels in the image, and H(i) be the proportion of pixels with color value i in the image. S2.
4. Use the YOLO series of algorithms to locate the head of the person and the safety helmet in the original image and determine their coordinate position in the image; S2.5 Calculate the Euclidean distance d between the center of the person's head and the center of the safety helmet. The formula is: Where (x1, y1) are the coordinates of the center of the person's head, and (x2, y2) are the coordinates of the center of the safety helmet; S2.
6. Based on the bounding box information of the person's head and the safety helmet, calculate the overlap area S between them. overlap and the head area S of the personnel head and the area S of the safety helmet helmet And calculate the overlap rate. S2.7, Combine the Euclidean distance d and the overlap rate R overlap Features representing the spatial relationship between a person's head and their safety helmet.
3. The method for identifying safety helmets for monitoring drones according to claim 2, characterized in that... S2.2 also includes: S2.2.
1. Perform convolution processing on the grayscale image using a Gaussian filter; S2.2.2 Calculate the gradient G of the image in the horizontal and vertical directions using the Sobel operator. x and G y Calculate the gradient magnitude G and gradient direction θ; S2.2.
3. Compare the gradient magnitude of each pixel with the gradient magnitude of its neighboring pixels along the gradient direction. If the gradient magnitude of the pixel is not a local maximum, set its magnitude to 0. S2.2.4, Set two thresholds, T high and T low Gradient magnitude greater than T high The pixels are considered strong edge points, and the gradient magnitude is less than T. low Pixels that are strong or weak are considered non-edge points, and pixels that fall between them are considered weak edge points. Weak edge points are then evaluated for edge connectivity. If a weak edge point is connected to a strong edge point, it is retained as an edge point; otherwise, it is suppressed.
4. The method for identifying safety helmets for monitoring drones according to claim 2, characterized in that... S2.4 also includes: S2.4.1 Scale the original image to the input size specified by the YOLO model; S2.4.2 Input the preprocessed image into the YOLO model. The YOLO model predicts the feature map. For each grid cell, the model predicts B bounding boxes. Each bounding box contains the center coordinates (x, y), width w, height h, and confidence C. S2.4.3 Sort all bounding boxes in descending order according to the confidence level of each bounding box, select the bounding box with the highest confidence level as the retained bounding box, and calculate its intersection-union ratio (IoU) with the remaining bounding boxes. S2.4.
4. Based on the position of the grid cells and the offset of the bounding box center coordinates, calculate the coordinates (x, y, y) of the bounding box center in the original image. abs y abs Based on the ratio of the bounding box's width to its height and the size of the anchor box, calculate the width w of the bounding box in the original image. abs and height h abs .
5. A method for identifying safety helmets for monitoring drones according to claim 1, characterized in that... S3 further includes: S3.1, Let the appearance feature vector be F. appearance =(f a1 ,f a2 ,…,f an The spatial positional relationship feature vector is F. position =(f p1 f p2 , ..., f pm ); S3.2 Assign weights ω to the appearance feature vector and the spatial position relationship feature vector respectively. appearance and ω position , and ω appearance +ω position =1; S3.3 Calculate the fused feature vector, the formula is: F fusion =ω appearance F appearance +oh position F position =(ω appearance f a1 +oh position f p1 ,oh appearance f a2 +oh position f p2 ,…,oh appearance f an +oh position f pm )。 6. The method for identifying safety helmets for monitoring drones according to claim 5, characterized in that: The ω appearance and ω position The weight values are determined through experiments based on actual application scenarios and historical data, and are dynamically adjusted under different lighting conditions and population density scenarios.
7. The method for identifying safety helmets for monitoring drones according to claim 1, characterized in that: In step S4, the recognition model is a deep learning-based convolutional neural network model, which is trained using a large amount of image data labeled with whether or not a safety helmet is worn. The recognition process involves inputting the fused feature vector into the trained convolutional neural network model, and the model outputs the recognition result of whether the person in the target area is wearing a safety helmet. The recognition result is presented in the form of a probability value. A threshold θ is set. When the probability value is greater than or equal to θ, it is determined that the person is wearing a safety helmet. When the probability value is less than θ, it is determined that the person is not wearing a safety helmet.
8. A helmet recognition system for monitoring unmanned aerial vehicles, characterized in that... include: The image acquisition module sends image data to the image preprocessing module via a data transmission line or wireless communication protocol. It is responsible for acquiring raw image data containing people in the target area in real time, providing basic data for subsequent safety helmet recognition. The image preprocessing module transfers data between its sub-modules through internal function calls or message queues, converting color images to grayscale images and performing data splitting processing. The edge detection module receives the grayscale image from the image preprocessing module, performs edge detection, and then transmits the outline edge information of the safety helmet to the appearance feature extraction submodule. The appearance feature extraction module receives the helmet outline edge information from the edge detection module, extracts the geometric shape features and color histogram features of the helmet, and then transmits the appearance feature vector to the feature fusion module. The target localization module receives the raw image from the image preprocessing module, locates the person's head and safety helmet, and then transmits the localization information to the spatial position relationship feature extraction submodule. The spatial position relationship feature extraction module receives the positioning information of the person's head and safety helmet from the target positioning module, calculates the Euclidean distance and overlap rate, and then transmits the spatial position relationship feature vector to the feature fusion module. The feature fusion module receives the appearance feature vector from the appearance feature extraction module and the spatial position relationship feature vector from the spatial position relationship feature extraction module, performs fusion processing, and then transmits the fused feature vector to the recognition module. The recognition module receives the fused feature vector from the feature fusion module, performs recognition and judgment, and outputs the recognition result.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, it implements the steps of the helmet identification method for a monitoring drone as described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, it implements the steps of the helmet identification method for a monitoring drone as described in any one of claims 1 to 7.