Height-aware safety helmet detection network dynamic routing method

By dynamically adjusting the weights of the feature extraction branches of the safety helmet detection network and combining the pedestrian height ratio with the detection results, the problem of poor detection adaptability in existing technologies is solved, and accurate detection of pedestrian targets in high-altitude and ground operations is achieved.

CN122090488BActive Publication Date: 2026-07-03ZHEJIANG QIANWEN TECH CO LTD +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHEJIANG QIANWEN TECH CO LTD
Filing Date
2026-04-24
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Existing helmet detection technology cannot adapt to the differences in imaging features of targets of different heights. The static weight allocation mode cannot follow the changes in pedestrian height distribution within the scene. The detection results cannot be used to adjust the weights of the routing controller, resulting in poor feature extraction adaptability.

Method used

By acquiring the set of pedestrian centroid coordinates in the monitoring scene, pedestrian targets are divided into those working at height and those working on the ground. The average height ratio is calculated, and the weight allocation of the feature extraction branch of the backbone network is dynamically adjusted. The weight allocation ratio is then corrected in reverse based on the detection results, thereby achieving closed-loop optimization of feature fusion and detection results.

Benefits of technology

The feature branch weight ratio is made to fit the height distribution characteristics of pedestrians, adapting to the imaging characteristics of pedestrians of different heights, improving the accuracy and adaptability of safety helmet detection, and optimizing the matching degree between feature extraction and detection output.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122090488B_ABST
    Figure CN122090488B_ABST
Patent Text Reader

Abstract

The application discloses a safety helmet detection network dynamic routing method based on height perception, relates to the technical field of intelligent visual safety detection, and comprises the following steps: acquiring a monitoring scene original video frame sequence and decomposing the same to obtain a pedestrian centroid coordinate set; dividing high-altitude and ground operation pedestrian targets according to a longitudinal coordinate component; calculating an average height value to obtain a scene height ratio; inputting the scene height ratio into a routing controller; dynamically adjusting a shallow layer and a deep layer feature extraction branch weight proportion; and weighting and fusing edge texture feature maps and semantic context feature maps to generate a fusion feature map. The fusion feature map is input into a safety helmet classification head, and a safety helmet wearing state detection result is output. The routing controller weight distribution proportion is corrected reversely through the detection result. The method combines scene height information to regulate and control network feature weights, relies on a detection result to realize weight closed-loop optimization, and improves the feature adaptability of safety helmet detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of intelligent visual safety detection technology, specifically a dynamic routing method for safety helmet detection networks based on high-sensitivity perception. Background Technology

[0002] Current safety helmet detection technologies mostly rely on deep learning networks. They fuse edge texture features from shallow feature extraction branches with semantic context features from deep feature extraction branches using fixed weights to detect helmet wearing status. However, these technologies fail to differentiate based on the spatial height distribution of pedestrian targets within the monitored scene. Using the same feature branch weight parameters for pedestrians working at heights and on the ground fails to adapt to the differences in imaging features at different heights. The static weight allocation cannot adapt to changes in pedestrian height distribution within the scene. When the texture clarity and semantic confidence of targets working at heights fluctuate due to imaging distance and viewing angle, the fixed-weight feature fusion method struggles to accurately extract effective features suitable for detection.

[0003] Existing detection networks lack a mechanism to correlate detection results with network weight allocation. The weight ratios of feature branches are determined solely by preset parameters, and the detection results regarding helmet-wearing status cannot influence the weight adjustment of the routing controller. The network's feature extraction adaptability for pedestrian targets at different heights cannot be optimized through actual detection feedback, and the fusion of shallow and deep features fails to consistently match the actual feature state of the detected target. To address the issues of scene height distribution failing to drive dynamic adjustment of network weights and the inability of detection results to correct weight allocation, dynamic control and closed-loop optimization of network feature branch weights are required. Summary of the Invention

[0004] This invention aims to solve at least one of the technical problems existing in the prior art;

[0005] To this end, the present invention proposes a dynamic routing method for a height-aware helmet detection network, comprising:

[0006] Obtain the original video frame sequence of the monitored scene, decompose the original video frame sequence to form a set of pedestrian centroid coordinates;

[0007] Based on the ordinate components in the set of pedestrian centroid coordinates, pedestrian targets are divided into high-altitude operation pedestrian targets and ground operation pedestrian targets, and the average height value is calculated for each.

[0008] The ratio of the average height of pedestrian targets working at height to the average height of pedestrian targets working on the ground is defined as the scene height ratio. The scene height ratio is input to the routing controller, which dynamically adjusts the weight distribution ratio between the shallow feature extraction branch and the deep feature extraction branch in the backbone network based on the scene height ratio.

[0009] Based on the adjusted weight allocation ratio, the edge texture feature map output by the shallow feature extraction branch and the semantic context feature map output by the deep feature extraction branch in the backbone network are weighted and fused to generate a fused feature map.

[0010] The fused feature map is input into the helmet classification head, which outputs the detection result of the helmet wearing status based on the texture clarity and semantic confidence of the pedestrian target area in the fused feature map.

[0011] Based on the detection results of the helmet wearing status, the weight allocation ratio of the routing controller is adjusted in reverse.

[0012] Furthermore, the original video frame sequence of the monitored scene is obtained, and the original video frame sequence is decomposed to form a set of pedestrian centroid coordinates, including:

[0013] The original video frame sequence is decomposed into a multi-scale Gaussian pyramid to generate an image pyramid containing different resolution levels.

[0014] Semantic segmentation is performed independently at each resolution level in the image pyramid to extract the pixel region where the pedestrian target is located, and the centroid coordinates of each pedestrian target are calculated to form a set of pedestrian centroid coordinates;

[0015] The original video frame sequence is subjected to multi-scale Gaussian pyramid decomposition to generate an image pyramid containing different resolution levels, specifically including:

[0016] Each frame in the original video frame sequence is downsampled step by step according to the preset scaling factor to generate images at four resolution levels: original size, half the original size, one-quarter the original size, and one-eighth the original size.

[0017] Gaussian smoothing filtering is applied to the downsampled images at each level to eliminate the aliasing effect generated during downsampling. The four levels of images that have undergone Gaussian smoothing are arranged from high to low resolution to construct an image pyramid with a four-level structure.

[0018] Furthermore, the step of independently performing semantic segmentation at each resolution level in the image pyramid, extracting the pixel region where the pedestrian target is located, and calculating the centroid coordinates of each pedestrian target includes:

[0019] The images at each resolution level in the image pyramid are input into a pre-trained lightweight segmentation network, which outputs the probability value of each pixel belonging to a pedestrian.

[0020] The probability values ​​are binarized, and pixels with probability values ​​greater than the segmentation threshold are marked as pedestrian pixels. Adjacent pedestrian pixels are aggregated into connected components to obtain the pixel region where the pedestrian target is located.

[0021] For each connected component, calculate the average x-coordinate and average y-coordinate of all pedestrian pixels, and use the average x-coordinate and average y-coordinate as the centroid coordinates of the pedestrian target, storing them in the pedestrian centroid coordinate set.

[0022] Furthermore, based on the ordinate components of the pedestrian centroid coordinate set, pedestrian targets are divided into high-altitude operation pedestrian targets and ground operation pedestrian targets, including:

[0023] The ordinate components of all centroids in the set of pedestrian centroid coordinates are counted. Pedestrian targets with ordinate components greater than two-thirds of the total scene height are classified as high-altitude operation pedestrian targets, and pedestrian targets with ordinate components less than or equal to two-thirds of the total scene height are classified as ground operation pedestrian targets.

[0024] Calculate the average ordinate of the centroid of the pedestrian target working at height and the average ordinate of the centroid of the pedestrian target working on the ground, respectively, and use the average ordinate as the average height value of the pedestrian target working at height and the average height value of the pedestrian target working on the ground.

[0025] Further, defining the ratio of the average height of pedestrian targets working at height to the average height of pedestrian targets working on the ground as the scene height ratio, and inputting the scene height ratio to the routing controller, includes:

[0026] Read the average height value of pedestrian targets working at height and the average height value of pedestrian targets working on the ground, divide the two average height values, and calculate the scene height ratio.

[0027] The scene height ratio is mapped to a preset routing adjustment range, which is between 0.2 and 0.8. The mapped value is used as the input parameter of the routing controller to control the weight allocation of the two feature extraction branches in the backbone network.

[0028] Furthermore, the routing controller dynamically adjusts the weight allocation ratio between shallow feature extraction branches and deep feature extraction branches in the backbone network based on the scene height ratio, including:

[0029] The routing controller internally presets a baseline weight value and an adjustment gain coefficient. The baseline weight value corresponds to the weight allocation ratio under standard scenarios.

[0030] The routing controller calculates the difference between the input scene height ratio and the baseline weight value to obtain the weight deviation value;

[0031] Multiply the weight deviation value by the adjustment gain coefficient to obtain the weight correction amount;

[0032] The adjusted weight value is obtained by adding the weight correction amount to the baseline weight value, and the adjusted weight value of the deep feature extraction branch is one minus the adjusted weight value.

[0033] Furthermore, the weighted fusion of the edge texture feature map output by the shallow feature extraction branch and the semantic context feature map output by the deep feature extraction branch in the backbone network, based on the adjusted weight allocation ratio, includes:

[0034] Read the edge texture feature map output by the shallow feature extraction branch and the semantic context feature map output by the deep feature extraction branch, wherein the size of the edge texture feature map is consistent with the size of the semantic context feature map;

[0035] Multiply each pixel value of the edge texture feature map by the shallow weight value in the adjusted weight allocation ratio to obtain the weighted edge texture feature map;

[0036] Multiply each pixel value of the semantic context feature map by the deep weight value in the adjusted weight allocation ratio to obtain the weighted semantic context feature map.

[0037] The weighted edge texture feature map and the weighted semantic context feature map are added together in the pixel dimension to generate the final fused feature map.

[0038] Further, the fused feature map is input into the helmet classification head, including:

[0039] The fused feature map is input into a helmet classification head with a fully convolutional neural network structure, which consists of three consecutive convolutional layers and two fully connected layers;

[0040] The helmet classification head performs convolution operations on the fused feature map to extract fine-grained texture features of the pedestrian target region, and combines them with deep semantic context features to determine whether the pedestrian target is wearing a helmet.

[0041] Output a binary detection result, where zero in the binary detection result represents not wearing a safety helmet, and one in the binary detection result represents wearing a safety helmet.

[0042] Furthermore, based on the detection results of the helmet wearing status, the weight allocation ratio of the routing controller is corrected in reverse, including:

[0043] When there are missed detections of pedestrians working at heights in the detection results, the weight ratio of the deep feature extraction branch is increased; when there are false alarms of pedestrians working on the ground in the detection results, the weight ratio of the shallow feature extraction branch is increased.

[0044] Iterate through each pedestrian target in the detection results of the helmet wearing status, and count the number of missed detections of pedestrian targets in high-altitude operations and the number of false alarms of pedestrian targets in ground operations;

[0045] When the number of missed detections of pedestrian targets in high-altitude operations exceeds the preset missed detection threshold, it is determined that the weight ratio of the current deep feature extraction branch is insufficient, and the routing controller automatically increases the weight ratio of the deep feature extraction branch by a preset step size.

[0046] When the number of false alarms for pedestrian targets on the ground exceeds the preset false alarm threshold, it is determined that the weight ratio of the current shallow feature extraction branch is insufficient. The routing controller automatically increases the weight ratio of the shallow feature extraction branch by a preset step size.

[0047] Further, the step of multiplying each pixel value of the edge texture feature map by the shallow weight value in the adjusted weight allocation ratio to obtain the weighted edge texture feature map includes:

[0048] Obtain the edge texture feature map output by the shallow feature extraction branch. The edge texture feature map is a multi-channel feature map containing three dimensions: channel, height, and width.

[0049] Read the shallow weight values ​​calculated by the routing controller, where the shallow weight values ​​are the weight values ​​used for the shallow feature extraction branch in the adjusted weight allocation ratio;

[0050] Create a feature matrix of identical size to the edge texture feature map;

[0051] Multiply each element value of the all-one feature matrix by the shallow weight value to obtain a weight matrix in which all elements are shallow weight values.

[0052] Each pixel value of the edge texture feature map is multiplied by the element value at the same position in the weight matrix to generate a weighted edge texture feature map.

[0053] Compared with the prior art, the beneficial effects of the present invention are:

[0054] Based on the ordinate component of the pedestrian centroid coordinate set, pedestrian targets for high-altitude operations and those for ground operations are categorized. The average height of each type of target is calculated, and the scene height ratio is obtained. After inputting the scene height ratio into the routing controller, the weight distribution ratio of the shallow feature extraction branch and the deep feature extraction branch in the backbone network can be dynamically adjusted. This technique allows the weight allocation of feature branches to match the pedestrian height distribution characteristics of the monitored scene. It also adapts the weighted fusion process of shallow edge texture feature maps and deep semantic context feature maps to the imaging characteristics of pedestrian targets at different heights, matching the differences in texture clarity and semantic confidence between high-altitude and ground operation targets, thus achieving precise adaptation of feature fusion and scene height information.

[0055] By using the helmet-wearing status detection results output by the helmet classification head to correct the weight allocation ratio of the routing controller, a linkage adjustment logic between detection results and weight allocation can be constructed. This technique allows the weight ratio of feature branches to be optimized in real time according to the actual detection results, making the feature representation of the fused feature map more closely match the actual state of the pedestrian target area. This ensures that the detection results output by the helmet classification head based on the fused features match the actual wearing status of the target, achieving closed-loop adaptation between weight allocation and detection results, and optimizing the matching degree between feature extraction and detection output. Attached Figure Description

[0056] Figure 1 This is a flowchart illustrating the steps of the height-sensing-based safety helmet detection network dynamic routing method described in this invention.

[0057] Figure 2 A flowchart for forming the set of pedestrian centroid coordinates;

[0058] Figure 3 A flowchart for adjusting the weight allocation ratio for the routing controller;

[0059] Figure 4 Line graph showing the accuracy of the safety helmet testing network at each stage;

[0060] Figure 5 This is a trend graph showing the ratio of pedestrian number to scene height in a helmet testing scenario over time. Detailed Implementation

[0061] The technical solution of the present invention will be clearly and completely described below with reference to the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0062] See Figure 1The system acquires the original video frame sequence of the monitored scene, analyzes and processes it to form a set of pedestrian centroid coordinates containing the location information of all pedestrian targets within the scene. Based on the ordinate component of each centroid in this set, all pedestrian targets are classified into two categories: high-altitude operation pedestrian targets and ground operation pedestrian targets. The average height value of each category of pedestrian targets in the image is calculated. The average height value of high-altitude operation pedestrian targets is divided by the average height value of ground operation pedestrian targets, and the ratio is defined as the scene height ratio, reflecting the scene's operational height distribution characteristics. This scene height ratio value is input into a dedicated routing controller, which dynamically adjusts the weight distribution ratio between the shallow feature extraction branch responsible for extracting detailed edge textures and the deep feature extraction branch responsible for extracting abstract semantic context in real time based on the input value. Subsequently, based on this adjusted weight distribution ratio, a weighted fusion operation is performed on the edge texture feature map output by the shallow feature extraction branch and the semantic context feature map output by the deep feature extraction branch to generate a fused feature map that is rich in both detailed and semantic information. The fused feature map is input into the helmet classification head, which makes a comprehensive judgment based on the texture clarity and semantic confidence of each pedestrian target area in the fused feature map, and finally outputs the detection result of whether each pedestrian target is wearing a helmet. The system will also reverse-correct the weight allocation strategy of the routing controller based on the missed detections or false alarms in the helmet wearing status detection results of the current frame, so as to achieve continuous adaptive optimization of the weight allocation ratio.

[0063] In one embodiment of the present invention, see [reference] Figure 2 The process involves acquiring the original video frame sequence of the monitored scene, decomposing it to form a set of pedestrian centroid coordinates. The original video frame sequence can come from construction site monitoring video captured by a fixed camera, with each video frame having a resolution of 1920 pixels wide and 1080 pixels high. Each frame in the original video frame sequence is then subjected to multi-scale Gaussian pyramid decomposition to generate an image pyramid containing different resolution levels. The original image is then downsampled level by level according to a preset scaling factor (set to 0.5), generating images at four resolution levels: the original image size, half the original image size, one-quarter of the original image size, and one-eighth of the original image size. The generated image is 960×540 as the second layer, 480×270 as the third layer, and 240×135 as the fourth layer. Gaussian smoothing is applied to the downsampled image of each layer, and the image is convolved using a Gaussian kernel with a standard deviation of 1.0 to eliminate the aliasing effect that may be introduced by downsampling. The four layers of images after Gaussian smoothing are arranged in order of resolution from high to low, thus constructing an image pyramid with a four-layer structure.

[0064] In some embodiments, semantic segmentation is performed independently on the image at each resolution level of the image pyramid to extract the precise pixel region where the pedestrian target is located. This segmentation operation is accomplished by inputting the image at each level into a pre-trained lightweight segmentation network. The lightweight segmentation network uses MobileNetV3 as its backbone network and outputs a probability value for each pixel in the image belonging to the pedestrian category, with the probability value ranging from 0 to 1. These probability values ​​are binarized, and a segmentation threshold of 0.5 is set. Pixels with a probability value greater than the segmentation threshold of 0.5 are marked as pedestrian pixels, and pixels with a probability value less than or equal to the segmentation threshold of 0.5 are marked as background pixels. Spatially adjacent pedestrian pixels are aggregated to form connected components, and an eight-neighbor connectivity analysis algorithm is used for pixel aggregation. Each connected component corresponds to a pixel region where a pedestrian target is located.

[0065] In practice, for each identified pedestrian target connected region, the average x-coordinate and average y-coordinate of all pixels marked as pedestrians within that region are calculated. The formulas for calculating the average x-coordinate and average y-coordinate are as follows:

[0066]

[0067]

[0068] in: The x-coordinate represents the centroid of the pedestrian target. The ordinate represents the centroid of the pedestrian target. This represents the total number of pedestrian pixels within the connected component of the pedestrian target. Indicates the first The x-coordinate of each pedestrian pixel. Indicates the first The ordinate of each pedestrian pixel is used as the centroid coordinate of the pedestrian target. The centroid coordinates of all pedestrian targets together constitute the set of pedestrian centroid coordinates.

[0069] It is understandable that the processing of each frame in the original video frame sequence follows the same process, and the final output set of pedestrian centroid coordinates will dynamically change as the video frame sequence is updated. In specific implementation, for a specific surveillance image, the above process may identify five pedestrian target connected components, calculate five corresponding centroid coordinates, and record these five coordinates in the pedestrian centroid coordinate set for subsequent height perception analysis.

[0070] In one embodiment of the present invention, pedestrian targets are classified into high-altitude operation pedestrian targets and ground operation pedestrian targets based on the ordinate components of the pedestrian centroid coordinate set. The pedestrian centroid coordinate set is derived from the processing of a specific frame of monitoring image. This set contains the centroid coordinates of five pedestrian targets, with coordinates of (320, 850), (700, 200), (150, 900), (900, 150), and (500, 880), respectively. The total height H_total of the monitoring scene image is 1080 pixels. The ordinate components of all centroid points in the pedestrian centroid coordinate set are counted, and the five ordinate components are 850, 200, 900, 150, and 880. According to a preset height classification rule, the height classification rule is defined as classifying pedestrian targets with ordinate components greater than two-thirds of the total scene height as high-altitude operation pedestrian targets. Two-thirds of the total scene height is 720 pixels. Pedestrian targets with a vertical coordinate component greater than 720 pixels are classified as high-altitude work pedestrian targets. This category includes three pedestrian targets with vertical coordinates of 850, 900, and 880. Pedestrian targets with a vertical coordinate component less than or equal to 720 pixels are classified as ground work pedestrian targets. This category includes two pedestrian targets with vertical coordinates of 200 and 150.

[0071] In some embodiments, after classification, the average centroid ordinate of all pedestrian targets classified as high-altitude workers and the average centroid ordinate of all pedestrian targets classified as ground-based workers are calculated. For the three pedestrians classified as high-altitude workers, their ordinates are 850, 900, and 880, respectively. The average height value of the high-altitude worker targets is... Calculated using the following formula:

[0072]

[0073] in: This represents the average height of pedestrian targets during high-altitude operations. This indicates the number of pedestrian targets categorized as high-altitude work targets; in the example, M=3. Indicates the first The centroid ordinate of each pedestrian working at height is determined. The average height of the pedestrians working at height is calculated. Pixels. For two people classified as pedestrian targets in ground operations, their ordinates are 200 and 150, respectively. Average height value of the pedestrian targets in ground operations. Calculated using the following formula:

[0074]

[0075] in: This represents the average height of pedestrian targets during ground operations. This represents the number of pedestrian targets categorized as ground-based work targets; in the example, K=2. Indicates the first The centroid ordinate of each ground-based pedestrian target is determined. The average height of the ground-based pedestrian target is then calculated. Pixels. The average of these two vertical axes is used as the average height of pedestrian targets for high-altitude operations and the average height of pedestrian targets for ground operations, respectively.

[0076] It's understandable that the two-thirds threshold in the height classification rule is a preset value. In practice, this threshold can be adjusted based on the installation angle and field of view of different monitoring scenarios. For example, in scenarios with a large overhead angle, the threshold can be set to half the total scene height. In a specific implementation, for a monitoring image containing pedestrians at different heights in another frame, the set of pedestrian centroid coordinates may contain multiple targets with ordinates of 100, 300, and 500. According to the same rule, assuming the total scene height is still 1080 pixels, only targets with ordinates greater than 720 pixels are classified as high-altitude work pedestrian targets. However, in this example, all targets have ordinates less than 720, so all targets are classified as ground-based work pedestrian targets. At this point, the average height value calculation set for high-altitude work pedestrian targets is empty. The processing logic can be set to assign a default height value or skip the dynamic routing calculation for the current frame. The result of the average height value calculation is two scalar values, which are directly used for subsequent scene height ratio calculations.

[0077] In one embodiment of the present invention, see [reference] Figure 3 The ratio of the average height of pedestrian targets working at height to the average height of pedestrian targets working on the ground is defined as the scene height ratio, and this scene height ratio is input to the routing controller. The calculated average height values ​​of pedestrian targets working at height and on the ground are read. Taking the calculation results from the previous embodiment as an example, the average height value of the pedestrian target working at height... The average height of a pedestrian target on the ground is 876.7 pixels. The value is 175.0 pixels. The scene height ratio is calculated by dividing the average height of the pedestrian target in high-altitude operations by the latter. Next, the scene height ratio value will be... Mapping to a preset routing adjustment range, which is set between 0.2 and 0.8. The mapping function is designed as follows:

[0078]

[0079] in: This represents the mapped numerical value. Indicates the original scene height ratio. and These represent the minimum and maximum expected values ​​for the preset original scene height ratio, respectively. In the example, they are set... , Then the calculation yields The mapped value of 0.47 is used as the input parameter for the routing controller.

[0080] In some embodiments, the routing controller dynamically adjusts the weight distribution ratio between shallow and deep feature extraction branches in the backbone network based on the input scene height ratio. Internally, the routing controller has a preset baseline weight value corresponding to the weight distribution ratio under a standard scene. And an adjustment gain coefficient for adjusting the intensity. In practice, a benchmark weight value is set. Adjust the gain coefficient The route controller will input the scene height ratio compared to the mapped value. Compared with internal benchmark weight values Perform the interpolation operation to obtain a weighted deviation value. . This weighted deviation value With adjustment gain coefficient Multiply by each other to calculate the amount by which the baseline weights need to be adjusted, i.e., the weight adjustment amount. Finally, adjust this weight. Compared with the benchmark weight value The sum is then used as the weight value for the adjusted shallow feature extraction branch. The adjusted weight value of the deep feature extraction branch is obtained by subtracting the weight value of the shallow feature extraction branch from the number one, i.e. .

[0081] It is understandable that in the mapping function and The parameters need to be pre-calibrated based on the possible height distribution range in the actual monitoring scenario. In practice, if the input scene height is higher than the numerical value... Beyond the preset range, then It will be clamped to a boundary value of 0.2 or 0.8. For example, if (less than) ),but It is set to 0.2; if (greater than) ),but It is set to 0.8. Baseline weight value. This represents the initial weight allocation between shallow and deep features under a pre-defined standard height distribution scenario; its values ​​can be obtained through training on a standard dataset. Adjusting the gain coefficient... The sensitivity of the scene height ratio to the final weight is controlled. The larger the coefficient, the greater the weight adjustment caused by the difference in scene height ratio.

[0082] In one embodiment of the present invention, the edge texture feature map output by the shallow feature extraction branch and the semantic context feature map output by the deep feature extraction branch in the backbone network are weighted and fused according to the adjusted weight allocation ratio. During the fusion process, the edge texture feature map output by the shallow feature extraction branch and the semantic context feature map output by the deep feature extraction branch are first read, ensuring that the edge texture feature map and the semantic context feature map have the same dimensions in the height and width dimensions. For example, the edge texture feature map has a size of 256 pixels in height, 256 pixels in width, and 64 channels, and the semantic context feature map also has a size of 256 pixels in height, 256 pixels in width, and 64 channels. The adjusted weight allocation ratio calculated by the routing controller is obtained, which includes the shallow weight values ​​used for the edge texture feature map. and deep weight values ​​used for semantic context feature maps In the example, shallow weight values ​​are set. Deep weight values .

[0083] In some embodiments, a fully one feature matrix with the exact same size as the edge texture feature map is created. The fully one feature matrix is ​​a tensor with all elements equal to 1, and has a height of 256, a width of 256, and 64 channels. Each element of the fully one feature matrix is ​​then multiplied by a shallow weight value. This generates a value where all element values ​​are shallow weight values. weight matrix Edge texture feature map Each pixel value, and the weight matrix Multiply the element values ​​at the same position to generate a weighted edge texture feature map. The calculation formula is as follows:

[0084] in: This indicates the weighted edge texture feature map at the height index. Width Index Channel Index The value of the position, This represents the value of the original edge texture feature map at the corresponding location. These are shallow weight values. These represent the height, width, and channel dimension indices of the feature map, respectively. The semantic context feature map output from the deep feature extraction branch... The same approach is used. A feature matrix of all ones with the same size as the semantic context feature map is created, and each element is multiplied by the deep layer weight value. The weight matrix is ​​obtained. Semantic context feature map Each pixel value and weight matrix Multiply the element values ​​at corresponding positions to generate a weighted semantic context feature map. The calculation follows the formula Finally, the weighted edge texture feature map With weighted semantic context feature map Element-wise addition is performed along the pixel dimension to generate a final fused feature map that incorporates features from different levels. Its calculation satisfies .

[0085] Optionally, to illustrate the weighting process, data from a local region of the feature map can be extracted for explanation. For example, consider extracting a 2x2 local block from the first channel of the edge texture feature map, as shown in Table 1.

[0086] Table 1: Example of Local Data and Weighted Calculation Process for Edge Texture Feature Map

[0087]

[0088] It is understandable that the weighting operation is performed independently, channel-by-channel and pixel-by-pixel. Table 1 only shows example calculations for four positions in a single channel. In a specific implementation, for a feature map of size 256x256x64, the above multiplication operation will be performed in parallel for all 65,536 pixel positions across all 64 channels. In a specific implementation, the weighting process for the semantic context feature map is completely consistent with that for the edge texture feature map, the only difference being that the weight values ​​used are deep weight values. After the weighting operation, the values ​​of the two feature maps at corresponding channels and corresponding pixel positions are directly added together. For example, assuming the weighted semantic context feature map is at position (1,1), the values ​​are added together. If the value is 0.692, then the value of the fused feature map at that location is... Feature map fusion It contains shallow detail information and deep semantic information after being adjusted by high perception weights, and will be sent to the subsequent helmet classification head for processing.

[0089] See Figure 4This is a line graph showing the accuracy of the safety helmet detection network at different stages, visually illustrating the changing trends in detection accuracy for high-altitude and ground-based operations at various process stages. The detection accuracy for both types of operations continuously increases as the process progresses, indicating that the end-to-end design from the original frame to weight correction effectively improves detection performance. In the "original frame decomposition" stage, the accuracy of high-altitude operations is significantly lower than that of ground-based operations, reflecting the greater difficulty in detecting high-altitude targets due to factors such as distance and occlusion. With the advancement of steps such as height classification, weight allocation, and feature fusion, the accuracy of high-altitude operations quickly catches up, reaching only 0.1% difference with ground-based operations by the "weight correction" stage, validating the effectiveness of the height-aware dynamic routing mechanism. In the final stage, the accuracy for both types of operations approaches 98.6%, and the overall model performance reaches a stable and efficient level.

[0090] In one embodiment of the present invention, the fused feature map is input to a helmet classification head, which is composed of a fully convolutional neural network structure, specifically consisting of three consecutive convolutional layers followed by two fully connected layers. The number of filters in the three convolutional layers are 128, 256, and 512, respectively, and the filter size is 3x3. The number of neurons in the two fully connected layers are 1024 and 2, respectively. The helmet classification head performs a convolution operation on the input fused feature map. The fused feature map has a size of 256 pixels in height, 256 pixels in width, and 64 channels. After three convolutional layers and pooling operations, the feature map is flattened into a one-dimensional vector. This vector is then transformed by the fully connected layers to further extract fine-grained texture features of the pedestrian target region. Combined with the deep semantic context information contained in the fused feature map, the system determines whether each pedestrian target is wearing a helmet. For a specific pedestrian target region, its corresponding feature vector is calculated by the fully connected layers and output as a two-dimensional vector. , where vector The second element The calculation can be performed using the formula:

[0091]

[0092] in: This represents the predicted probability that the pedestrian is classified as "wearing a helmet". This represents the Sigmoid activation function. Represents the ReLU activation function. and These are the weight matrix and bias vector of the first fully connected layer, respectively. and These are the weight vector and bias scalar of the second fully connected layer, respectively. This is the flattened feature vector input to the fully connected layer. The classification head outputs a binary detection result, where a value of zero indicates that the pedestrian is judged to be not wearing a helmet, and a value of one indicates that the pedestrian is judged to be wearing a helmet.

[0093] In some embodiments, after obtaining the detection result of the helmet wearing status, the weight allocation ratio of the routing controller is adjusted in reverse based on this result. The adjustment logic sets a preset missed detection threshold based on the type of detection error. Set the threshold to 1, which is the preset false alarm threshold. The preset weight adjustment step size is 2. The value is 0.05. When pedestrian targets working at heights are missed in the detection results, it indicates that the network's current deep semantic context features are insufficiently utilized, and the weight of the deep feature extraction branch should be increased. When pedestrian targets working on the ground are falsely detected, it indicates that the network's reliance on detailed texture features is insufficient, and the weight of the shallow feature extraction branch should be increased. By traversing all pedestrian targets in the detection results and combining the known true height categories of pedestrian targets with the detection results, the number of missed pedestrian targets working at heights is counted. Number of pedestrians working on the ground that were falsely reported In practical implementation, assuming the detection results of a frame of image are analyzed, and it is known that there are 3 pedestrian targets working at heights and 4 pedestrian targets working on the ground in this frame, after comparing the binary detection results output by the safety helmet classification head with the true labels, it is found that 1 pedestrian target working at heights was missed (judged as not wearing a safety helmet when it should be), and 3 pedestrian targets working on the ground were falsely detected (judged as wearing a safety helmet when it is not). The number of missed detections of pedestrian targets working at heights is then calculated. Number of false alarms for pedestrian targets on the ground .

[0094] It is understandable that the number of missed detections will be... Compared with the preset missed detection threshold Compare the number of false alarms Compared with the preset false alarm threshold A comparison is made. If the number of missed detections of pedestrian targets during high-altitude operations exceeds the preset missed detection threshold, i.e. If the weight ratio of the current deep feature extraction branch is insufficient, the routing controller will automatically adjust the weight ratio according to the preset step size. Increase the weight percentage of the deep feature extraction branch. In the example, Not greater than Therefore, this correction will not be triggered. If the number of false alarms for pedestrian targets during ground operations exceeds the preset false alarm threshold, i.e. If the weight ratio of the current shallow feature extraction branch is insufficient, the routing controller will automatically adjust the weight ratio according to the preset step size. Increase the weight percentage of the shallow feature extraction branch. In the example, The condition is met, therefore weight adjustment is triggered. Assume the weight values ​​of the shallow feature extraction branch before adjustment are... The weight values ​​of the deep feature extraction branch Based on the correction logic, the weight ratio of the shallow feature extraction branch needs to be increased, by a predetermined step size. Then the new shallow weight values New deep weight values The routing controller will use the revised new weight values. and Process the next frame or the next batch of image data.

[0095] In practice, the preset false negative threshold, false positive threshold, and weight adjustment step size are all configurable hyperparameters. The false negative threshold and false positive threshold can be set to the same value, or they can be set separately according to the different tolerances for false negatives and false positives in actual applications. The weight adjustment step size determines the magnitude of a single correction. Setting the step size too small may result in slow adjustment, while setting it too large may result in weight oscillation. Each correction only adjusts the weight of the corresponding branch for the error type that triggered the condition. If both types of errors exceed the threshold simultaneously, the weights of both branches may be adjusted simultaneously. The net effect depends on the step size setting and the current weight value, ultimately ensuring that the sum of the shallow weight value and the deep weight value is always 1.

[0096] See Figure 5 This is a trend chart showing the ratio of pedestrians to scene height in a safety helmet detection scenario over time, intuitively reflecting the dynamic changes in the work scene. The initial number of pedestrians working at height is approximately 5, peaking at about 7 between frames 20-40, then continuously decreasing to about 3 between frames 80-100, showing a single-peak trend of first rising and then falling. The initial number of pedestrians working on the ground is approximately 13, continuously decreasing over time, reaching a trough of about 7 around frame 80, then slightly rising to 8, showing a trend of first falling and then stabilizing. The initial scene height ratio is approximately 1.5, peaking at about 2 between frames 20-30, then slowly decreasing to a trough of about 1 around frame 80, then slightly rising to about 1.3, with relatively small fluctuations, remaining between 1 and 2.

[0097] The above embodiments are only used to illustrate the technical methods of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical methods of the present invention without departing from the spirit and scope of the technical methods of the present invention.

Claims

1. A dynamic routing method for a helmet detection network based on height perception, characterized in that, include: Obtain the original video frame sequence of the monitored scene, decompose the original video frame sequence to form a set of pedestrian centroid coordinates; Based on the ordinate components in the set of pedestrian centroid coordinates, pedestrian targets are divided into high-altitude operation pedestrian targets and ground operation pedestrian targets, and the average height value is calculated for each. The ratio of the average height of pedestrian targets working at height to the average height of pedestrian targets working on the ground is defined as the scene height ratio. The scene height ratio is input to the routing controller, which dynamically adjusts the weight distribution ratio between the shallow feature extraction branch and the deep feature extraction branch in the backbone network based on the scene height ratio. Based on the adjusted weight allocation ratio, the edge texture feature map output by the shallow feature extraction branch and the semantic context feature map output by the deep feature extraction branch in the backbone network are weighted and fused to generate a fused feature map. The fused feature map is input into the helmet classification head, which outputs the detection result of the helmet wearing status based on the texture clarity and semantic confidence of the pedestrian target area in the fused feature map. Based on the detection results of the helmet wearing status, the weight allocation ratio of the routing controller is adjusted in reverse.

2. The dynamic routing method for safety helmet detection network based on height perception according to claim 1, characterized in that, Obtain the original video frame sequence of the monitored scene, decompose the original video frame sequence to form a set of pedestrian centroid coordinates, including: The original video frame sequence is decomposed into a multi-scale Gaussian pyramid to generate an image pyramid containing different resolution levels. Semantic segmentation is performed independently at each resolution level in the image pyramid to extract the pixel region where the pedestrian target is located, and the centroid coordinates of each pedestrian target are calculated to form a set of pedestrian centroid coordinates; The original video frame sequence is subjected to multi-scale Gaussian pyramid decomposition to generate an image pyramid containing different resolution levels, specifically including: Each frame in the original video frame sequence is downsampled step by step according to the preset scaling factor to generate images at four resolution levels: original size, half the original size, one-quarter the original size, and one-eighth the original size. Gaussian smoothing filtering is applied to the downsampled images at each level to eliminate the aliasing effect generated during downsampling. The four levels of images that have undergone Gaussian smoothing are arranged from high to low resolution to construct an image pyramid with a four-level structure.

3. The dynamic routing method for safety helmet detection network based on height perception according to claim 2, characterized in that, The process of independently performing semantic segmentation at each resolution level of the image pyramid, extracting the pixel region where the pedestrian target is located, and calculating the centroid coordinates of each pedestrian target includes: The images at each resolution level in the image pyramid are input into a pre-trained lightweight segmentation network, which outputs the probability value of each pixel belonging to a pedestrian. The probability values ​​are binarized, and pixels with probability values ​​greater than the segmentation threshold are marked as pedestrian pixels. Adjacent pedestrian pixels are aggregated into connected components to obtain the pixel region where the pedestrian target is located. For each connected component, calculate the average x-coordinate and average y-coordinate of all pedestrian pixels, and use the average x-coordinate and average y-coordinate as the centroid coordinates of the pedestrian target, storing them in the pedestrian centroid coordinate set.

4. The dynamic routing method for safety helmet detection network based on height perception according to claim 3, characterized in that, Based on the ordinate components of the pedestrian centroid coordinate set, pedestrian targets are divided into high-altitude operation pedestrian targets and ground operation pedestrian targets, including: The ordinate components of all centroids in the set of pedestrian centroid coordinates are counted. Pedestrian targets with ordinate components greater than two-thirds of the total scene height are classified as high-altitude operation pedestrian targets, and pedestrian targets with ordinate components less than or equal to two-thirds of the total scene height are classified as ground operation pedestrian targets. Calculate the average ordinate of the centroid of the pedestrian target working at height and the average ordinate of the centroid of the pedestrian target working on the ground, respectively, and use the average ordinate as the average height value of the pedestrian target working at height and the average height value of the pedestrian target working on the ground.

5. The dynamic routing method for helmet detection network based on height perception according to claim 4, characterized in that, The ratio of the average height of pedestrian targets working at height to the average height of pedestrian targets working on the ground is defined as the scene height ratio, and the scene height ratio is input to the routing controller, including: Read the average height value of pedestrian targets working at height and the average height value of pedestrian targets working on the ground, divide the two average height values, and calculate the scene height ratio. The scene height ratio is mapped to a preset routing adjustment range, which is between 0.2 and 0.

8. The mapped value is used as the input parameter of the routing controller to control the weight allocation of the two feature extraction branches in the backbone network.

6. The dynamic routing method for safety helmet detection network based on height perception according to claim 5, characterized in that, The routing controller dynamically adjusts the weight distribution ratio between shallow feature extraction branches and deep feature extraction branches in the backbone network based on the scene height ratio, including: The routing controller internally presets a baseline weight value and an adjustment gain coefficient. The baseline weight value corresponds to the weight allocation ratio under standard scenarios. The routing controller calculates the difference between the input scene height ratio and the baseline weight value to obtain the weight deviation value; Multiply the weight deviation value by the adjustment gain coefficient to obtain the weight correction amount; The adjusted weight value is obtained by adding the weight correction amount to the baseline weight value, and the adjusted weight value of the deep feature extraction branch is one minus the adjusted weight value.

7. The dynamic routing method for safety helmet detection network based on height perception according to claim 6, characterized in that, The step of weighted fusion of the edge texture feature map output by the shallow feature extraction branch and the semantic context feature map output by the deep feature extraction branch in the backbone network, based on the adjusted weight allocation ratio, includes: Read the edge texture feature map output by the shallow feature extraction branch and the semantic context feature map output by the deep feature extraction branch, wherein the size of the edge texture feature map is consistent with the size of the semantic context feature map; Multiply each pixel value of the edge texture feature map by the shallow weight value in the adjusted weight allocation ratio to obtain the weighted edge texture feature map; Multiply each pixel value of the semantic context feature map by the deep weight value in the adjusted weight allocation ratio to obtain the weighted semantic context feature map. The weighted edge texture feature map and the weighted semantic context feature map are added together in the pixel dimension to generate the final fused feature map.

8. The dynamic routing method for helmet detection network based on height perception according to claim 7, characterized in that, The fused feature map is input into the helmet classification head, including: The fused feature map is input into a helmet classification head with a fully convolutional neural network structure, which consists of three consecutive convolutional layers and two fully connected layers; The helmet classification head performs convolution operations on the fused feature map to extract fine-grained texture features of the pedestrian target region, and combines them with deep semantic context features to determine whether the pedestrian target is wearing a helmet. Output a binary detection result, where zero in the binary detection result represents not wearing a safety helmet, and one in the binary detection result represents wearing a safety helmet.

9. The dynamic routing method for safety helmet detection network based on height perception according to claim 8, characterized in that, Based on the detection results of the helmet wearing status, the weight allocation ratio of the routing controller is corrected in reverse, including: When there are missed detections of pedestrians working at heights in the detection results, the weight ratio of the deep feature extraction branch is increased; when there are false alarms of pedestrians working on the ground in the detection results, the weight ratio of the shallow feature extraction branch is increased. Iterate through each pedestrian target in the detection results of the helmet wearing status, and count the number of missed detections of pedestrian targets in high-altitude operations and the number of false alarms of pedestrian targets in ground operations; When the number of missed detections of pedestrian targets in high-altitude operations exceeds the preset missed detection threshold, it is determined that the weight ratio of the current deep feature extraction branch is insufficient, and the routing controller automatically increases the weight ratio of the deep feature extraction branch by a preset step size. When the number of false alarms for pedestrian targets on the ground exceeds the preset false alarm threshold, it is determined that the weight ratio of the current shallow feature extraction branch is insufficient. The routing controller automatically increases the weight ratio of the shallow feature extraction branch by a preset step size.

10. The dynamic routing method for a helmet detection network based on height perception according to claim 9, characterized in that, The step of multiplying each pixel value of the edge texture feature map by the shallow weight value in the adjusted weight allocation ratio to obtain the weighted edge texture feature map includes: Obtain the edge texture feature map output by the shallow feature extraction branch. The edge texture feature map is a multi-channel feature map containing three dimensions: channel, height, and width. Read the shallow weight values ​​calculated by the routing controller, where the shallow weight values ​​are the weight values ​​used for the shallow feature extraction branch in the adjusted weight allocation ratio; Create a feature matrix of identical size to the edge texture feature map; Multiply each element value of the all-one feature matrix by the shallow weight value to obtain a weight matrix in which all elements are shallow weight values. Each pixel value of the edge texture feature map is multiplied by the element value at the same position in the weight matrix to generate a weighted edge texture feature map.