Machine vision-based construction site dangerous area warning method
By integrating the dynamic visual features of construction site drawings and on-site videos, the system updates the hazardous area mask in real time and optimizes trajectory tracking, thus overcoming the shortcomings of existing technologies in dynamic hazardous area updates and multi-target tracking, and achieving efficient forward-looking early warning and safety management.
Patent Information
- Application Number
- CN202611268539.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-20
- Publication Date
- 2026-11-20
AI Technical Summary
Existing machine vision-based methods for early warning of hazardous areas on construction sites cannot dynamically update hazardous areas. Multi-target tracking algorithms have poor physical rationality and robustness in complex construction site scenarios, lack foresight and initiative, and have low efficiency in personnel positioning and safety equipment detection.
By deeply integrating the spatial topology information of construction plan drawings with the dynamic visual features of on-site videos, the mask of dangerous areas is updated in real time. Trajectory tracking is optimized by combining physical space constraints, and a multi-branch collaborative detection network is used to synchronously output personnel location and safety equipment status, thereby constructing a short-term motion prediction model for forward-looking early warning.
It enables adaptive definition of dynamic and static hazards at the construction site, improves the accuracy and robustness of trajectory tracking, provides forward-looking early warning, and enhances the safety management level of the construction site.
Smart Images

Figure CN123142401A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of construction site hazard warning, and in particular to a machine vision-based method for warning of hazardous areas on construction sites. Background Technology
[0002] With the continuous advancement of infrastructure construction and urbanization in my country, the construction industry has experienced rapid development. However, construction sites are complex and ever-changing environments, containing many high-risk areas such as edges, openings, and areas where large machinery operates. Due to the dense concentration of construction workers, frequent cross-operations, and the weak safety awareness of some workers who fail to wear safety helmets, vests, and other protective equipment as required, accidents such as falls from heights and being struck by objects occur frequently. Traditional construction site safety management mainly relies on manual inspections, which not only consumes a lot of manpower and resources but also has blind spots and delays in supervision, making it difficult to meet the real-time safety monitoring needs of modern large-scale construction projects. In recent years, with the rapid development of artificial intelligence and machine vision technologies, intelligent safety early warning systems based on video surveillance have gradually been introduced into the construction of "smart construction sites," becoming an important means to improve the level of construction safety management.
[0003] While existing machine vision-based methods for early warning of hazardous areas at construction sites have improved regulatory efficiency to some extent, they still have the following significant drawbacks when considering the complex practical needs of construction sites: First, existing methods for defining hazardous areas are largely limited to static delineation. The common practice is to manually delineate fixed polygons as warning zones in video footage (such as fixed edges or openings). However, construction sites contain numerous dynamic hazards, especially large lifting machinery like tower cranes. During lifting operations, the rotation direction of the crane's boom and the load's suspension status constantly alter the hazard coverage area on the ground. Existing technologies often cannot dynamically update the hazardous area mask based on the tower crane's real-time operating status (such as whether it is unloaded or loaded, and the boom's rotation angle), causing dynamic operating areas to become blind spots in safety supervision and greatly increasing the risk of serious falling object accidents.
[0004] Secondly, existing multi-target tracking algorithms suffer from poor physical plausibility and robustness in complex construction site scenarios. Traditional tracking algorithms, when performing cross-frame target association, primarily rely on the similarity of target appearance features and simple spatial Euclidean distance. Because they ignore the actual spatial topology of the construction site, the algorithm is prone to trajectory interruptions or identity jumps when construction workers are briefly obscured by impassable structures such as walls or scaffolding. More seriously, existing algorithms may generate erroneous motion vectors that cross physical walls or building components during matching, causing the generated motion trajectories to violate basic physical principles and severely impacting the accuracy of subsequent behavior analysis.
[0005] Secondly, existing early warning mechanisms generally lack foresight and initiative. Most existing systems employ a "post-event alarm" or "triggered alarm" mechanism, meaning that the system only issues an alarm after construction workers have crossed the boundary and entered the danger zone. This passive response method cannot provide construction workers with sufficient reaction and avoidance time. In real-world scenarios, the movement of construction workers is continuous, and existing methods fail to effectively utilize historical trajectory characteristics (such as speed changes and path deviations) to accurately predict short-term future movement trajectories. This prevents the issuance of tiered approach warnings before personnel are "about" entering the danger zone, thus missing the optimal opportunity for accident intervention.
[0006] Finally, existing technologies are inefficient in the collaborative processing of personnel location and safety equipment detection. Current methods mostly adopt a cascaded approach, where one model first detects the personnel's location, and then the cropped image is fed into other independent models for classifying safety helmets and vests. This separate architecture not only increases the consumption of computing resources and degrades the real-time performance of video processing, but also makes it difficult to ensure the synchronization and consistency of location information and equipment wearing status in situations with dense crowds or partial obstruction.
[0007] In summary, the industry urgently needs a machine vision early warning method that can integrate static and dynamic hazardous areas, optimize trajectory tracking by combining physical space constraints, possess forward-looking trajectory prediction capabilities, and efficiently coordinate inspection personnel and safety protection equipment, so as to comprehensively improve the level of intelligent safety management at construction sites. Summary of the Invention
[0008] In view of this, the present invention provides a machine vision-based method for early warning of dangerous areas in construction sites. The purpose is to reconstruct dangerous area perception and target tracking prediction algorithms by deeply integrating the spatial topology information of construction plan drawings with the dynamic visual features of on-site videos. This enables adaptive definition of dynamic and static hazard sources at the construction site, physical compliance tracking of personnel movement trajectories, and proactive early warning of potential hazards, thereby comprehensively improving the proactive safety defense capabilities of construction sites.
[0009] To achieve the above objectives, the present invention provides a machine vision-based method for early warning of hazardous areas at construction sites, comprising the following steps: S1: Obtain the outline coordinates of the dangerous areas near the edges and the dangerous areas at the openings marked on the construction plan drawings. Combine the camera's internal and external parameter calibration results and use perspective transformation to map the outline coordinates to the pixel coordinate system of each camera's video frame to generate a static dangerous area mask. For the hoisting operation area, detect the rotation azimuth angle of the tower crane boom and the load suspension status in the video image, calculate the projection coverage of the boom on the ground in real time, dynamically update the dangerous area mask boundary of the area, and merge the static dangerous area mask and the dynamic dangerous area mask into a comprehensive dangerous area mask. S2: Taking video frames as input, the multi-branch collaborative detection and perception network synchronously outputs the bounding boxes of the positions of all construction workers in the picture, as well as the classification results of the helmet wearing status in the head area and the safety vest wearing status in the torso area of each construction worker. S3: Extract the outline coordinates of the impassable structural areas of walls, scaffold bases and building components from the construction plan drawings. In the process of frame-by-frame multi-target matching and association, apply a penalty coefficient to the corresponding matching value of candidate matching pairs whose cross-frame motion vectors need to cross the impassable structural areas, and form the historical motion trajectory sequence of each construction worker. S4: Extract the velocity change feature vector and path deflection feature vector corresponding to the continuous frame segments in the historical movement trajectory sequence of each construction worker whose nearest distance to the boundary of the comprehensive danger area mask is less than a preset threshold. Predict the short-term future movement position of each tracked construction worker, spatially superimpose the predicted trajectory points with the comprehensive danger area mask, and combine the safety equipment wearing status classification results to determine the violation type and danger level of each construction worker in the current and predicted time domains. S5: Based on the type of violation and the level of danger of each construction worker, issue a graded warning trigger command to the on-site sound and light alarm device in the corresponding area. Output an approach warning signal to construction workers whose predicted trajectory will enter the coverage area of the comprehensive danger zone mask, and output an immediate alarm signal to construction workers who have entered the coverage area of the comprehensive danger zone mask or who are missing safety equipment. Simultaneously push the location of the violation, the type of violation, and the level of danger to the construction site monitoring and management platform.
[0010] As a further improvement of the present invention: Optionally, step S1 further includes: S101: Read the construction plan drawing, extract the outline coordinate set of the dangerous area near the edge and the outline coordinate set of the dangerous area of the opening marked in the drawing coordinate system respectively, and use the pre-calibrated camera intrinsic parameter matrix and extrinsic parameter matrix to construct the perspective transformation matrix between the construction plan drawing coordinate system and the pixel coordinate system of each camera image. S102: Map the contour coordinate set of the adjacent danger zone and the contour coordinate set of the opening danger zone to the pixel coordinate system of the current video frame of each camera through the perspective transformation matrix, and generate a static danger zone mask covering the entire pixel range of the adjacent danger zone and the opening danger zone on the video frame image. ; S103: In the video frame, the overall target of the tower crane is first located using a target detection network to obtain the target bounding box; then, within the target bounding box, the coordinates of key points at the base of the tower crane boom are located using a key point regression network. Coordinates of key points at the end of the boom , will be point to The angle between the direction vector formed and the reference direction of the image coordinate system is calculated as the azimuth angle of the tower crane boom rotation. ; Coordinates of the key point at the end of the boom Within the preset pixel range below, perform connectivity analysis on the foreground pixels. When the area of the connected region exceeds a preset area threshold, indicate that the load is suspended. Set to 1, otherwise set the load hanging status flag. Set to 0, where A value of 1 indicates that the load is suspended. A value of 0 indicates that the device is in an unloaded state. S104: When When the value is 1, it is based on the rotation azimuth angle. And the camera extrinsic parameter matrix, calculates the projection coverage area of the boom on the ground as a circle with the pixel coordinates of the tower crane base as the center, the pixel projection value of the effective length of the boom as the radius, and the rotation azimuth angle as the radius. Generate a dynamic hazard area mask for a fan-shaped region along the axial direction. and will and Perform pixel-level union to obtain the composite danger zone mask for the current frame. ;when When the value is 0, Set to an empty mask. equal .
[0011] Optionally, step S2 further includes: S201: Input the current video frame into the shared convolutional backbone network, and extract hierarchical features from the image through multiple convolutional layers and pooling layers in sequence, and output a shared feature map containing multi-scale spatial semantic information; S202: Input the shared feature map into the personnel localization branch. Through anchor box classification convolutional layer and bounding box regression convolutional layer, perform foreground confidence scoring and bounding box coordinate regression on the candidate regions of each spatial location on the feature map, and output the set of bounding boxes of all construction personnel positions in the image. The set of location bounding boxes Includes the bounding boxes of the locations of all construction workers detected in the current frame; S203: For the set of location bounding boxes For each construction worker's location bounding box, corresponding head region feature sub-images and torso region feature sub-images are cropped from the shared feature map. The head region feature sub-image is input into the safety helmet recognition branch, and the safety helmet wearing status classification result for the construction worker is output through a convolutional layer, a global average pooling layer, and a fully connected classification layer. The torso region feature sub-image is input into the safety vest recognition branch, and the safety vest wearing status classification result for the construction worker is output through a convolutional layer, a global average pooling layer, and a fully connected classification layer. The classification result is 1 to indicate that the safety vest is worn, and 0 to indicate that the safety vest is not worn.
[0012] Optionally, step S3 further includes: S301: Extract the outline coordinates of the walls, scaffold bases, and building components from the construction plan drawings, and map these outline coordinates to the video frame pixel coordinate system using the perspective transformation matrix to generate a mask for impassable structural areas. ; S302: Set of bounding boxes showing the locations of construction workers detected in the current frame. Using the established trajectory state set from historical frames as input, an initial matching cost matrix is constructed using the cosine distance of appearance features and the Euclidean distance of the center point space. The initial matching cost matrix contains the [missing information - likely a specific value or component]. The historical trajectory and the first The initial matching cost between the detection results of each current frame The calculation formula is: ; in, For the first The appearance features of the last frame of the historical trajectory are similar to those of the first The cosine distance between the appearance features of each test result For the first The coordinates of the center point of the last frame of the historical trajectory and the first The Euclidean distance between the coordinates of the center points of each detection result This is a dimensionally normalized reference distance, with a value taken as the pixel length of the diagonal of the current video frame. For appearance cost weighting coefficient, The value range is (0,1); S303: Apply spatial passage constraint penalty to the initial matching cost matrix to generate a passage constraint cost matrix. The first element in the passage constraint cost matrix... The historical trajectory and the first The final matching value between the detection results of each current frame The calculation formula is: ; in, The spatial access constraint penalty weight coefficient, For the penalty instruction quantity for crossing, when the first The coordinates of the center point at the end of the historical trajectory to the first The straight line segment formed by the coordinates of the center points of each detection result and the mask of the impassable structural region. When there is pixel region overlap The value is 1, otherwise The value is 0; S304: Taking the passage constraint cost matrix as input, the optimal global matching scheme is solved by the Hungarian matching algorithm to complete the cross-frame association between the current frame detection result and the historical trajectory status. Trajectory statuses that have not completed matching for more than a preset frame number threshold are deleted. New trajectory statuses are initialized for newly appearing detection results in multiple consecutive frames. The coordinate sequence of the center point of the historical associated bounding box of each construction worker is output as the historical motion trajectory sequence. The passage constraint cost penalty trajectory association algorithm masks inaccessible structural regions. Spatial distribution information for crossing penalty indicators The process of embedding the cost matrix in the form of the initial matching cost matrix is as follows: Based on this, a spatial traffic constraint penalty term is superimposed to form a traffic constraint cost matrix. This enables the Hungarian matching algorithm to automatically apply a rejection effect to candidate matching pairs that the cross-frame motion vector needs to traverse inaccessible structural regions during the global optimal matching solution process. It also embeds the spatial topological constraints in the construction plan drawings into the multi-target trajectory association process, ensuring the spatial and physical rationality of the historical motion trajectory sequence.
[0013] Optionally, step S4 further includes: S401: For each construction worker's historical movement trajectory sequence, extract the center point of the construction worker and the comprehensive danger zone mask from the historical movement trajectory sequence. The nearest distance to the boundary is less than a preset threshold The features corresponding to consecutive frame segments, among which the velocity change feature vector The path deflection feature vector is composed of a sequence of differences in displacement magnitudes between adjacent time points within the continuous frame segment. It is composed of a sequence of differences in motion direction angles between adjacent moments within the continuous frame segment; S402: Transform the velocity change characteristic vector With path deflection feature vector Input into a two-dimensional feature fusion short-time motion prediction model; in the most recent historical motion trajectory sequence Within a frame, the mean vector of the current motion velocity is calculated based on the displacement vectors between adjacent time points. The average deflection direction unit vector is calculated based on the mean of the motion direction angle at each moment. ; Velocity change characteristic vector With path deflection feature vector Used for dynamically adjusting path deflection correction coefficient ; Calculate the first Step-by-step prediction of location coordinates Specifically: ; in, The coordinates of the center point of the construction personnel at the current moment. To predict the step size, Based on the most recent historical motion trajectory sequence The mean vector of the current motion velocity is obtained by calculating the displacement vector between adjacent time points of each frame. The unit of measurement is pixels / frame. This is the path deflection correction coefficient, measured in pixels per frame, and its value varies according to the velocity variation feature vector. With path deflection feature vector The magnitude of the historical movement deflection reflected is dynamically determined, and its range is as follows: ,in The preset maximum value for the movement speed of construction workers. Based on the most recent historical motion trajectory sequence The dimensionless unit direction vector corresponding to the mean motion direction angle at each moment of the frame; S403: Predict step size From 1 to the preset maximum number of prediction steps By gradually increasing the number of points, a complete sequence of predicted trajectory points is generated. Each predicted position coordinate in the predicted trajectory point sequence is determined to fall within the comprehensive danger zone mask. The pixel coverage area; S404: Combining the classification results of each construction worker's safety helmet wearing status, safety vest wearing status, and predicted trajectory point sequence with comprehensive hazard area mask. Based on the superposition judgment results, the violation type and danger level of each construction worker are determined according to the following rules: when the coordinates of the center point of the current frame of the construction worker have fallen into... When the pixel coverage area is within the specified range, the violation type is determined to be a dangerous area intrusion, and the danger level is determined to be Level 1; when the coordinates of the current frame center point of the construction worker do not fall within the specified range... Pixel coverage area, but there are instances of falling into the predicted trajectory point sequence. When predicting the location coordinates of the pixel coverage area, the violation type is determined to be "approaching a dangerous area," and the danger level is determined to be level two; when the classification result of the construction worker's safety helmet wearing status or safety vest wearing status is 0, and the location coordinates of the current frame center point do not fall within... When the pixel coverage area is defined, the violation type is determined to be missing safety equipment, and the danger level is determined to be level three. When the same construction worker has multiple violation types at the same time, the highest danger level among all coexisting violation types is taken as the final danger level of the construction worker.
[0014] Optionally, step S5 further includes: S501: From the violation types and hazard levels of each construction worker output in step S4, select the sets of construction workers with hazard level 1, hazard level 2, and hazard level 3 respectively. S502: For construction workers with a hazard level of Level 2, a proximity warning trigger command is sent to the on-site audible and visual alarm device corresponding to the area where the construction worker's current location is located, triggering intermittent audible and visual signals that repeat at a preset interval frequency; S503: For construction workers with a hazard level of Level 1, send an immediate alarm trigger command to the on-site audible and visual alarm device corresponding to the area where the construction worker is currently located, triggering a continuous audible and visual signal; for construction workers with a hazard level of Level 3, send a safety equipment missing alarm trigger command to the on-site audible and visual alarm device corresponding to the area where the construction worker is currently located, triggering an intermittent audible and visual signal that repeats at a preset interval frequency. S504: Encapsulate the location coordinates, violation type, and hazard level of all construction workers with violations into alarm record data, push it to the construction site monitoring and management platform in real time, and label the violation type and hazard level information on the location boundary of the corresponding construction worker on the video display interface of the construction site monitoring and management platform.
[0015] Compared with the prior art, the present invention has at least the following beneficial effects: First, this invention not only accurately maps static hazardous areas in drawings to a pixel coordinate system through perspective transformation, but also innovatively introduces key point regression and connected component analysis algorithms for large machinery such as tower cranes. By sensing the rotational orientation of the boom and the load suspension status in real time, the algorithm can dynamically calculate and update the projected coverage area of the boom on the ground. This comprehensive mask generation mechanism, which deeply integrates static spatial prior information with dynamic mechanical pose, enables the system to adaptively adjust the warning range according to the construction operation status, completely eliminating blind spots in the supervision of dynamically overlapping work areas.
[0016] Secondly, this invention transforms inaccessible structures such as walls and scaffolding in construction plan drawings into spatial accessibility constraint penalties, deeply embedding them into the cost calculation of trajectory association. This improvement enables the matching algorithm to automatically apply a repulsion effect to erroneous cross-frame motion vectors attempting to traverse physical obstacles when solving for the global optimum. This mechanism endows the visual tracking algorithm with real physical spatial topological constraints, fundamentally ensuring that the generated motion trajectory conforms to physical common sense, and significantly improving the accuracy and robustness of trajectory tracking in complex construction site scenarios with dense crowds and frequent occlusion.
[0017] Furthermore, regarding hazard perception and early warning strategies, this invention abandons the traditional passive triggering alarm and constructs a short-term motion prediction model based on the fusion of two-dimensional features. This model deeply mines the speed changes and path deflection features in the historical trajectory of personnel, dynamically adjusting the path deflection correction coefficient to achieve high-precision prediction of the future movement position of personnel. This forward-looking prediction based on multi-dimensional motion features buys construction workers valuable time to avoid danger.
[0018] Finally, the various algorithmic improvements in this invention are not simply a collection of technologies, but rather the construction of a holistic solution characterized by data interoperability and deep coupling. The prior information from the construction drawings serves as the foundation for generating static hazard masks and provides indispensable spatial topological constraints for the underlying trajectory tracking algorithm. The high-quality historical trajectories output after physical constraint correction directly ensure the reliability of short-term motion prediction. The final forward-looking predicted trajectory is then spatially superimposed with the dynamically updated comprehensive hazard area mask, and, in conjunction with the efficient synchronous output of safety equipment wearing status from a multi-branch network, together constitute a multi-dimensional, hierarchical early warning decision-making center. This close linkage from environmental perception and physical constraint tracking to forward-looking behavior prediction effectively avoids the limitations of single algorithm modules and significantly enhances the creativity and practical value of the overall solution in real-world, complex business scenarios. Attached Figure Description
[0019] Figure 1 This is a flowchart illustrating a machine vision-based early warning method for hazardous areas at construction sites according to an embodiment of the present invention. Figure 2 A schematic diagram illustrating the process of constructing a comprehensive hazard mask; Figure 3 A schematic diagram of the personnel and safety equipment inspection process; Figure 4 This is a schematic diagram of the trajectory tracking process under physical constraints. Figure 5 This is a schematic diagram of the trajectory prediction and hazard assessment process; Figure 6 This is a schematic diagram of the tiered early warning and information dissemination process. Detailed Implementation
[0020] The present invention will be further described below with reference to the accompanying drawings, but this is not intended to limit the present invention in any way. Any modifications or substitutions made based on the teachings of the present invention shall fall within the protection scope of the present invention.
[0021] Example 1: A machine vision-based method for early warning of hazardous areas at construction sites, such as... Figure 1 As shown, it includes the following steps: S1: Obtain the outline coordinates of the adjacent danger zone and the opening danger zone marked on the construction plan. Combined with the camera's intrinsic and extrinsic parameter calibration results, map the outline coordinates to the pixel coordinate system of each camera video frame through perspective transformation to generate a static danger zone mask. For the hoisting operation area, detect the rotation azimuth angle of the tower crane boom and the load suspension status in the video image, calculate the boom's projection coverage on the ground in real time, dynamically update the danger zone mask boundary of this area, and merge the static danger zone mask and the dynamic danger zone mask into a comprehensive danger zone mask, such as... Figure 2 As shown, it includes: S101: Read the construction plan drawing and extract the contour coordinate sets of the adjacent danger zone and the opening danger zone marked in the drawing coordinate system. Using the pre-calibrated camera intrinsic and extrinsic parameter matrices, construct the perspective transformation matrix between the construction plan drawing coordinate system and the pixel coordinate system of each camera image. In this embodiment, the camera intrinsic parameter calibration adopts Zhang's calibration method. During calibration, no less than 15 calibration images are collected at different distances and angles. The camera intrinsic parameter matrix is solved by minimizing the reprojection error. ; It is a 3×3 upper triangular matrix containing the focal length in the horizontal direction. Vertical focal length coordinates of the principal point Four valid parameters; the camera extrinsic parameter matrix consists of a 3×3 rotation matrix. With 3×1 translation vector The structure is determined by measuring known world coordinate points such as tower crane bases and wall corners at the construction site and their corresponding pixel coordinates in video frames, then solving the perspective transformation matrix using the PnP algorithm. Given a 3×3 homography matrix, at least four pairs of known corresponding control points are selected in both the construction plan coordinate system and the video frame pixel coordinate system. The initial solution is obtained by using the direct linear transformation method, and then the robust estimation result is obtained by iteratively eliminating out-of-match points using the RANSAC algorithm. S102: Map the contour coordinate set of the adjacent danger zone and the contour coordinate set of the opening danger zone to the pixel coordinate system of the current video frame of each camera through the perspective transformation matrix, and generate a static danger zone mask covering the entire pixel range of the adjacent danger zone and the opening danger zone on the video frame image. In this embodiment, The size is the same as the resolution of the current video frame. Pixels with a value of 1 in the mask indicate that the location belongs to a static danger zone, and pixels with a value of 0 indicate that the location is in a static safe zone. The set of contour coordinates of the adjacent danger zone and the opening danger zone are transformed by the perspective matrix. After mapping each point to the pixel coordinate system, all pixels within the area enclosed by each closed contour are assigned a value of 1 using a polygon filling algorithm. The pixel-level union of the masks corresponding to the two types of dangerous areas is then obtained. ; S103: In the video frame, the overall target of the tower crane is first located using a target detection network to obtain the target bounding box; then, within the target bounding box, the coordinates of key points at the base of the tower crane boom are located using a key point regression network. Coordinates of key points at the end of the boom , will be point to The angle between the direction vector formed and the reference direction of the image coordinate system is calculated as the azimuth angle of the tower crane boom rotation. ; Coordinates of the key point at the end of the boom Within the preset pixel range below, perform connectivity analysis on the foreground pixels. When the area of the connected region exceeds a preset area threshold, indicate that the load is suspended. Set to 1, otherwise set the load hanging status flag. Set to 0, where A value of 1 indicates that the load is suspended. A value of 0 indicates an unloaded state. In this embodiment, the tower crane overall target detection network adopts a single-stage target detection framework, with ResNet-50 as the backbone network. The pre-trained weights are from the ImageNet dataset, and the network is deployed after fine-tuning and training on a dataset of tower crane images labeled at the construction site. Adaptive threshold segmentation is performed on the image within the detection window to extract foreground pixels, and then connected component analysis is performed. When the maximum connected component area is... satisfy When Set to 1 otherwise set to 0; in this embodiment, a preset area threshold is used. Set to 200 square pixels; S104: When When the value is 1, it is based on the rotation azimuth angle. And the camera extrinsic parameter matrix, calculates the projection coverage area of the boom on the ground as a circle with the pixel coordinates of the tower crane base as the center, the pixel projection value of the effective length of the boom as the radius, and the rotation azimuth angle as the radius. Generate a dynamic hazard area mask for a fan-shaped region along the axial direction. and will and Perform pixel-level union to obtain the composite danger zone mask for the current frame. ;when When the value is 0, Set to an empty mask. equal In this embodiment, The generation is achieved through pixel-by-pixel judgment: Let the pixel coordinates of the tower crane base be... ,in and These are the pixel coordinates of the tower crane base along the horizontal and vertical axes of the image coordinate system, respectively; for the pixel coordinates in a video frame, they are... A pixel is considered to belong to a dynamic danger zone if it is a pixel that is adjacent to another pixel in the same region as the pixel in the dynamic danger zone. Euclidean distance satisfy , This is the pixel projection value corresponding to the effective length of the boom, and this pixel point is relative to... Direction angle satisfy ,in: ; ; Where atan2 is the arctangent function in the four quadrants; in this embodiment, the sector half-angle Set to 22.5°; The assignment rule for taking the pixel-level union is: when or hour ,otherwise .
[0022] S2: Taking video frames as input, a multi-branch collaborative detection and perception network synchronously outputs the bounding boxes of all construction workers in the scene, as well as the classification results of the helmet wearing status in the head area and the safety vest wearing status in the torso area for each construction worker, such as... Figure 3 As shown, it includes: S201: The current video frame is input into the shared convolutional backbone network, which sequentially extracts hierarchical features from the image through multiple convolutional and pooling layers, outputting a shared feature map containing multi-scale spatial semantic information. In this embodiment, the shared convolutional backbone network adopts a ResNet-50 structure, containing four residual module groups (conv2_x to conv5_x). The ResNet-50 pre-trained weights are from the ImageNet dataset, and all parameters participate in gradient updates during fine-tuning. Intermediate feature maps are extracted from the outputs of the two residual module groups, conv3_x and conv4_x, respectively. Multi-scale feature fusion is performed from top to bottom through a feature pyramid network, outputting two scale shared feature maps with downsampling strides of 8 and 16, respectively. and In this embodiment, a batch normalization layer is added after all convolutional layers, and the ReLU function is used as the activation function. S202: Input the shared feature map into the personnel localization branch. Through anchor box classification convolutional layer and bounding box regression convolutional layer, perform foreground confidence scoring and bounding box coordinate regression on the candidate regions of each spatial location on the feature map, and output the set of bounding boxes of all construction personnel positions in the image. The set of location bounding boxes This includes the bounding boxes of the locations of all construction workers detected in the current frame; in this embodiment, the personnel localization branch is based on the shared feature map. and Each spatial location on the screen has three preset anchor frames with different aspect ratios, and the set of aspect ratios is set as follows: To accommodate the typical proportions of longitudinal stretching of the human body when construction workers are standing; the anchor frame classification convolutional layer outputs a foreground confidence score for each candidate region, with scores exceeding a confidence threshold. Candidate regions are preserved in this embodiment. Set to 0.5; the offset of the candidate region output by the bounding box regression convolutional layer relative to the anchor box and the logarithmic scaling of the candidate box's width and height relative to the anchor box; overlapping redundant detection results are removed by non-maximum suppression, and the IoU threshold for non-maximum suppression is set to 0.5. ; S203: For the set of location bounding boxes For each construction worker's location bounding box, corresponding head region feature sub-images and torso region feature sub-images are cropped from the shared feature map. The head region feature sub-image is input to the safety helmet recognition branch, and through convolutional layers, global average pooling layers, and fully connected classification layers, the classification result of the construction worker's safety helmet wearing status is output. The torso region feature sub-image is input to the safety vest recognition branch, and through convolutional layers, global average pooling layers, and fully connected classification layers, the classification result of the construction worker's safety vest wearing status is output. The classification result takes a value of 1 to indicate that the worker is wearing a safety vest, and a value of 0 to indicate that the worker is not wearing a safety vest. In this embodiment, the head region feature sub-image is obtained from the shared feature map through ROI alignment. The top cropping is performed on the head region, which is a rectangular area bounded by the top boundary of the location bounding box to 25% of the bounding box height. The ROI-aligned output feature size is normalized to 7×7. The torso region feature sub-map is obtained from the shared feature map through ROI alignment. The top cropping is performed on the torso, with the cropping range being the rectangular region of the torso enclosed at 25% to 75% of the height of the location bounding box. The ROI-aligned output feature size is also normalized to 7×7. The helmet recognition branch and the safety vest recognition branch each contain two convolutional layers with a kernel size of 3×3 and 64 output channels, as well as one global average pooling layer and one fully connected classification layer with an output dimension of 1. The two branches have the same structure but their parameters are trained independently. The fully connected classification layer maps the output score to a sigmoid function. Wearing probability within the range ,when The classification result is 1 if the condition is met, and 0 otherwise. The training of the multi-branch collaborative detection perception network adopts an end-to-end joint training strategy. Under the premise of sharing the parameters of the convolutional backbone network, the personnel localization branch, safety helmet recognition branch, and safety vest recognition branch are simultaneously and jointly optimized; the total loss function... Loss due to personnel location Safety helmet identification loss Identifying losses with safety vests It consists of three linearly weighted parts, and the calculation formula is as follows: ; in, To identify the balance coefficient of branch loss for the safety helmet, In this embodiment, the balance coefficient for identifying branch loss in safety vest identification is used. ; It is composed of a 1:1 weighted combination of Focal loss and Smooth L1 loss, with the modulation factor of Focal loss set to [value missing]. The category balance coefficient is set to ,in and Focal loses its own hyperparameters; and Both methods employ the binary cross-entropy loss function, with the positive class weight for samples not wearing helmets set to 2.0. The training dataset consists of labeled video frames collected from multiple actual construction sites. Each image is labeled with the pixel coordinates of the construction worker's location bounding box and the corresponding safety helmet and safety vest wearing status labels. The Adam optimizer is used during training, with an initial learning rate of 0.001, which decays to 0.00001 using a cosine annealing strategy. The total number of training epochs is set to 100, and the batch size is set to 16.
[0023] S3: Extract the outline coordinates of impassable structural areas of walls, scaffold bases, and building components from the construction plan drawings. During frame-by-frame multi-target matching and association, for candidate matching pairs whose cross-frame motion vectors need to traverse the impassable structural areas, apply a penalty coefficient to their corresponding matching cost, forming a sequence of historical motion trajectories for each construction worker. Figure 4 As shown, it includes: S301: Extract the outline coordinates of the walls, scaffold bases, and building components from the construction plan drawings, and map these outline coordinates to the video frame pixel coordinate system using the perspective transformation matrix to generate a mask for impassable structural areas. In this embodiment, The size is the same as the resolution of the current video frame. Pixels with a value of 1 in the mask indicate that the position belongs to a non-passable structural area, and pixels with a value of 0 indicate that the position is a passable area. S302: Set of bounding boxes showing the locations of construction workers detected in the current frame. Using the established trajectory state set from historical frames as input, an initial matching cost matrix is constructed using the cosine distance of appearance features and the Euclidean distance of the center point space. The initial matching cost matrix contains the [missing information - likely a specific value or component]. The historical trajectory and the first The initial matching cost between the detection results of each current frame The calculation formula is: ; in, For the first The appearance features of the last frame of the historical trajectory are similar to those of the first The cosine distance between the appearance features of each test result For the first The coordinates of the center point of the last frame of the historical trajectory and the first The Euclidean distance between the coordinates of the center points of each detection result This is a dimensionally normalized reference distance, with a value taken as the pixel length of the diagonal of the current video frame. For appearance cost weighting coefficient, The value range is (0,1); In this embodiment, the appearance features are extracted from the location bounding box cropping image of each construction worker by a lightweight appearance feature extraction network with MobileNetV2 as the backbone network and outputting 128-dimensional feature vectors. The feature vectors are normalized by L2 before output so that their magnitude is 1. Set to 0.5; S303: Apply spatial passage constraint penalty to the initial matching cost matrix to generate a passage constraint cost matrix. The first element in the passage constraint cost matrix... The historical trajectory and the first The final matching value between the detection results of each current frame The calculation formula is: ; in, The spatial access constraint penalty weight coefficient, For the penalty instruction quantity for crossing, when the first The coordinates of the center point at the end of the historical trajectory to the first The straight line segment formed by the coordinates of the center points of each detection result and the mask of the impassable structural region. When there is pixel region overlap The value is 1, otherwise The value is 0; in this embodiment, Set to 3.0; Crossing penalty indicator The judgment is made using the Bresenham line algorithm; S304: Using the passage constraint cost matrix as input, the optimal global matching scheme is solved through the Hungarian matching algorithm to complete the cross-frame association between the current frame detection result and the historical trajectory state. Trajectory states that have not completed matching for more than a preset frame number threshold are deleted. New trajectory states are initialized for newly appearing detection results within multiple consecutive frames. The coordinate sequence of the center point of the historical associated bounding box of each construction worker is output as the historical motion trajectory sequence. In this embodiment, the preset frame number threshold is set to... 30 frames; the conditions for initializing a new trajectory are: a new target is detected in 3 consecutive frames, and the displacement between the center points of the detection results in each frame does not exceed 50 pixels; when the above conditions are met, a new trajectory identifier is assigned to the target and the trajectory state is initialized; otherwise, initialization is postponed. The passage constraint cost penalty trajectory association algorithm masks inaccessible structural regions. Spatial distribution information for crossing penalty indicators The process of embedding the cost matrix in the form of the initial matching cost matrix is as follows: Based on this, a spatial traffic constraint penalty term is superimposed to form a traffic constraint cost matrix. This enables the Hungarian matching algorithm to automatically apply a rejection effect to candidate matching pairs that the cross-frame motion vector needs to traverse inaccessible structural regions during the global optimal matching solution process. It also embeds the spatial topological constraints in the construction plan drawings into the multi-target trajectory association process, ensuring the spatial and physical rationality of the historical motion trajectory sequence.
[0024] Optionally, for cases where construction workers are continuously lost due to obstruction by building components or scaffolding panels, matching is required for more than [number missing]. In cases where a trajectory is deleted after a frame and construction workers re-enter the field of vision when the occlusion is removed, a trajectory re-identification mechanism based on appearance features can be introduced during the trajectory initialization phase: a memory bank of the appearance features of deleted trajectories is maintained, storing the most recent... The mean vector of the appearance feature vectors of the last few frames of each deleted historical trajectory within the frame. , In this embodiment, the historical trajectory is numbered in the memory bank. Set to 300 frames; for new targets that meet the new trajectory initialization conditions, before formally assigning new trajectory identifiers, first adjust the mean vector. L2 normalization is performed to obtain the normalized mean eigenvector. Then calculate the new target appearance feature vector. With all in the memory bank The cosine similarity; if the maximum cosine similarity exceeds the re-identification matching threshold. In this embodiment If the value is set to 0.80, the new target is identified as a construction worker re-appearing in the memory bank that was tracked by the corresponding historical trajectory. The new target is then re-associated with the historical trajectory, the original trajectory identifier is used, and the continuity of the historical trajectory coordinate sequence is restored.
[0025] S4: Extract the velocity change feature vector and path deflection feature vector corresponding to consecutive frame segments in the historical movement trajectory sequence of each construction worker whose nearest distance to the boundary of the comprehensive hazard area mask is less than a preset threshold. Predict the short-term future movement position of each tracked construction worker, spatially overlay the predicted trajectory points with the comprehensive hazard area mask, and combine the safety equipment wearing status classification results to determine the violation type and hazard level of each construction worker in the current and predicted time domains. Figure 5 As shown, it includes: S401: For each construction worker's historical movement trajectory sequence, extract the center point of the construction worker and the comprehensive danger zone mask from the historical movement trajectory sequence. The nearest distance to the boundary is less than a preset threshold The features corresponding to consecutive frame segments, among which the velocity change feature vector The path deflection feature vector is composed of a sequence of differences in displacement magnitudes between adjacent time points within the continuous frame segment. It is composed of a sequence of differences in motion direction angles between adjacent moments within the continuous frame segment; in this embodiment, a preset threshold is used. Set to 80 pixels; center point of construction personnel and The calculation of the closest distance to the boundary is performed by pre-testing... The distance field is obtained by performing a distance transformation on the mask. At each pixel location in the distance field, the pixel's position is stored in the distance field. The Euclidean distance value of the boundary, the Boundary The pixel boundary where the value changes from 0 to 1; S402: Transform the velocity change characteristic vector With path deflection feature vector Input into a two-dimensional feature fusion short-time motion prediction model; in the most recent historical motion trajectory sequence Within a frame, the mean vector of the current motion velocity is calculated based on the displacement vectors between adjacent time points. The average deflection direction unit vector is calculated based on the mean of the motion direction angle at each moment. ; Velocity change characteristic vector With path deflection feature vector Used for dynamically adjusting path deflection correction coefficient ; Calculate the first Step-by-step prediction of location coordinates Specifically: ; in, The coordinates of the center point of the construction personnel at the current moment. To predict the step size, Based on the most recent historical motion trajectory sequence The mean vector of the current motion velocity is obtained by calculating the displacement vector between adjacent time points of each frame. The unit of measurement is pixels / frame. This is the path deflection correction coefficient, measured in pixels per frame, and its value varies according to the velocity variation feature vector. With path deflection feature vector The magnitude of the historical movement deflection reflected is dynamically determined, and its range is as follows: ,in The preset maximum value for the movement speed of construction workers. Based on the most recent historical motion trajectory sequence The dimensionless unit direction vector corresponding to the mean motion direction angle at each moment of the frame; in this embodiment, the number of historical frames. Set to 10. Set to 20 pixels / frame; current motion velocity mean vector The calculation formula is: ; in, For the historical motion trajectory sequence, the number of moments preceding the current moment The two-dimensional vector of the center point coordinates of the construction workers in the frame. For the current moment, going back to the first The center point coordinates of the frame are in two dimensions. For the most recent The arithmetic mean of all inter-frame displacement vectors; the unit vector of the average deflection direction. The calculation is based on the cyclic mean of the direction angle, and the formula is as follows: ; ; in, For the historical motion trajectory sequence, the number of moments preceding the current moment The motion direction angle of the frame; Indicates transpose operation; path deflection correction factor The dynamic determination method is as follows: Calculate the path deflection feature vector. Mean of the absolute values of all elements As an indicator of directional instability; calculating the velocity change characteristic vector. Mean of the absolute values of all elements As an indicator of rate fluctuation; and Divide each quantity by its respective normalized reference value to eliminate dimensions, then weight and combine them before scaling to... , The calculation formula is: ; in, As a reference for the normalization of the rate of change of direction, it is set to [value] in this embodiment. radians / frame In this embodiment, the normalized reference value for the rate of change of speed is set to 5 pixels / frame; The function returns the smaller of the two numbers compared. S403: Predict step size From 1 to the preset maximum number of prediction steps By gradually increasing the number of points, a complete sequence of predicted trajectory points is generated. Each predicted position coordinate in the predicted trajectory point sequence is determined to fall within the comprehensive danger zone mask. The pixel coverage area; in this embodiment, the maximum prediction step number is preset. Set to 30; S404: Combining the classification results of each construction worker's safety helmet wearing status, safety vest wearing status, and predicted trajectory point sequence with comprehensive hazard area mask. Based on the superposition judgment results, the violation type and danger level of each construction worker are determined according to the following rules: when the coordinates of the center point of the current frame of the construction worker have fallen into... When the pixel coverage area is within the specified range, the violation type is determined to be a dangerous area intrusion, and the danger level is determined to be Level 1; when the coordinates of the current frame center point of the construction worker do not fall within the specified range... Pixel coverage area, but there are instances of falling into the predicted trajectory point sequence. When predicting the location coordinates of the pixel coverage area, the violation type is determined to be "approaching a dangerous area," and the danger level is determined to be level two; when the classification result of the construction worker's safety helmet wearing status or safety vest wearing status is 0, and the location coordinates of the current frame center point do not fall within... When the pixel coverage area is defined, the violation type is determined to be missing safety equipment, and the danger level is determined to be level three. When the same construction worker has multiple violation types at the same time, the highest danger level among all the coexisting violation types is taken as the final danger level of the construction worker. In this embodiment, the smaller the danger level number, the higher the priority. The final danger level is the one with the smallest danger level number among the coexisting violation types.
[0026] S5: Based on the type and level of violation of each construction worker, issue graded early warning trigger commands to the on-site audible and visual alarm devices in the corresponding area. For construction workers whose predicted trajectories will enter the coverage area of the comprehensive hazard zone mask, output an approach warning signal; for construction workers who have already entered the coverage area of the comprehensive hazard zone mask or are not wearing safety equipment, output an immediate alarm signal. Simultaneously, the location, type, and level of the violation are pushed to the construction site monitoring and management platform. Figure 6 As shown, it includes: S501: From the violation types and hazard levels of each construction worker output in step S4, select the sets of construction workers with hazard level 1, hazard level 2, and hazard level 3 respectively; In this embodiment, step S4 outputs a violation record list containing information on all violating construction workers in the current frame at the end of each frame processing. Each record in the list contains the construction worker trajectory identifier, the pixel coordinates of the center point of the current frame, the violation type set, and the final hazard level. S502: For construction workers with a hazard level of Level 2, a proximity warning trigger command is sent to the on-site audible and visual alarm device corresponding to the area where the construction worker's current location is located, triggering intermittent audible and visual signals that repeat at a preset interval frequency; in this embodiment, the Level 2 proximity warning alarm device is triggered in a cyclical repeating pattern of 0.25 seconds for light to turn on / sound and 0.25 seconds for silence. S503: For construction workers with a hazard level of 1, an immediate alarm trigger command is sent to the on-site audible and visual alarm device corresponding to the area where the construction worker's current location is located, triggering a continuous audible and visual signal; for construction workers with a hazard level of 3, a safety equipment missing alarm trigger command is sent to the on-site audible and visual alarm device corresponding to the area where the construction worker's current location is located, triggering an intermittent audible and visual signal that repeats at a preset interval frequency; in this embodiment, the continuous audible and visual signal triggered by the hazard level 1 immediate alarm remains active until an alarm cancellation command is sent to the alarm device, without an automatic timeout stop mechanism; the intermittent audible and visual signal of the hazard level 3 safety equipment missing alarm is triggered in a cyclical repeating pattern of 0.5 seconds for light / sound and 0.5 seconds for extinguish / silence; when the same alarm device receives trigger commands from different hazard levels simultaneously within the same frame processing cycle, the alarm mode corresponding to the highest hazard level, i.e., the one with the smallest level number, is executed, and the trigger commands of the other lower hazard levels are temporarily stored and executed in order of level after the alarm state of the highest hazard level is cancelled. S504: Encapsulate the location coordinates, violation type, and hazard level of all construction workers with violations into alarm record data, push it to the construction site monitoring and management platform in real time, and label the violation type and hazard level information on the location boundary of the corresponding construction worker on the video display interface of the construction site monitoring and management platform.
[0027] Optionally, to avoid the center point of construction personnel being in When there is slight back-and-forth movement near the boundary or short-term fluctuations in the location boundary box detection results, the violation judgment result of the same construction worker frequently switches between violation and non-violation, causing a large number of redundant alarm trigger commands to be repeatedly sent to the same alarm device in a short period of time. An alarm cooling-off time mechanism can be introduced: the system maintains a timestamp of the last alarm trigger for each type of violation for each construction worker indexed by the trajectory identifier. Initialized to 0; when the alarm trigger condition for a certain type of violation by a construction worker is met in the current frame, it is triggered only if the timestamp of the current frame is set. and The difference is greater than the cooling time interval. Only then will a trigger command be actually sent to the alarm device and... Updated to Otherwise, skip sending this instruction; in this embodiment The cooldown time is set to 10 seconds for level 2 hazard and 15 seconds for level 3 hazard. It should be noted that the cooldown mechanism does not apply to level 1 hazard alarms. Once the level 1 alarm is deactivated, the corresponding time for the level 1 violation by the construction worker will be reduced. Immediately reset to 0 to ensure that a new round of alarms can be triggered immediately upon re-intrusion after the initial clearing, eliminating the blind spot of the first-level alarm window introduced by the cooldown time and ensuring real-time response capability for intrusion events in dangerous areas.
[0028] It should be noted that the sequence numbers of the above embodiments of the present invention are merely for descriptive purposes and do not represent the superiority or inferiority of the embodiments. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, apparatus, article, or method. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, apparatus, article, or method that includes that element.
[0029] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0030] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.
Claims
1. A machine vision-based method for early warning of hazardous areas at construction sites, characterized in that, Includes the following steps: S1: Obtain the outline coordinates of the dangerous areas near the edges and the dangerous areas at the openings marked on the construction plan drawings. Combine the camera's internal and external parameter calibration results and use perspective transformation to map the outline coordinates to the pixel coordinate system of each camera's video frame to generate a static dangerous area mask. For the hoisting operation area, detect the rotation azimuth angle of the tower crane boom and the load suspension status in the video image, calculate the projection coverage of the boom on the ground in real time, dynamically update the dangerous area mask boundary of the area, and merge the static dangerous area mask and the dynamic dangerous area mask into a comprehensive dangerous area mask. S2: Taking video frames as input, the multi-branch collaborative detection and perception network synchronously outputs the bounding boxes of the positions of all construction workers in the picture, as well as the classification results of the helmet wearing status in the head area and the safety vest wearing status in the torso area of each construction worker. S3: Extract the outline coordinates of the impassable structural areas of walls, scaffold bases and building components from the construction plan drawings. In the process of frame-by-frame multi-target matching and association, apply a penalty coefficient to the corresponding matching value of candidate matching pairs whose cross-frame motion vectors need to cross the impassable structural areas, and form the historical motion trajectory sequence of each construction worker. S4: Extract the velocity change feature vector and path deflection feature vector corresponding to the continuous frame segments in the historical movement trajectory sequence of each construction worker whose nearest distance to the boundary of the comprehensive danger area mask is less than a preset threshold. Predict the short-term future movement position of each tracked construction worker, spatially superimpose the predicted trajectory points with the comprehensive danger area mask, and combine the safety equipment wearing status classification results to determine the violation type and danger level of each construction worker in the current and predicted time domains. S5: Based on the type of violation and the level of danger of each construction worker, issue a graded warning trigger command to the on-site sound and light alarm device in the corresponding area. Output an approach warning signal to construction workers whose predicted trajectory will enter the coverage area of the comprehensive danger zone mask, and output an immediate alarm signal to construction workers who have entered the coverage area of the comprehensive danger zone mask or who are missing safety equipment. Simultaneously push the location of the violation, the type of violation, and the level of danger to the construction site monitoring and management platform.
2. The method for early warning of hazardous areas at construction sites based on machine vision according to claim 1, characterized in that, Step S1 includes: S101: Read the construction plan drawing, extract the outline coordinate set of the dangerous area near the edge and the outline coordinate set of the dangerous area of the opening marked in the drawing coordinate system respectively, and use the pre-calibrated camera intrinsic parameter matrix and extrinsic parameter matrix to construct the perspective transformation matrix between the construction plan drawing coordinate system and the pixel coordinate system of each camera image. S102: Map the contour coordinate set of the adjacent danger zone and the contour coordinate set of the opening danger zone to the pixel coordinate system of the current video frame of each camera through the perspective transformation matrix, and generate a static danger zone mask covering the entire pixel range of the adjacent danger zone and the opening danger zone on the video frame image. ; S103: In the video frame, the overall target of the tower crane is first located using a target detection network to obtain the target bounding box; then, within the target bounding box, the coordinates of key points at the base of the tower crane boom are located using a key point regression network. Coordinates of key points at the end of the boom , will be point to The angle between the direction vector formed and the reference direction of the image coordinate system is calculated as the azimuth angle of the tower crane boom rotation. ; Coordinates of the key point at the end of the boom Within the preset pixel range below, perform connectivity analysis on the foreground pixels. When the area of the connected region exceeds a preset area threshold, indicate that the load is suspended. Set to 1, otherwise set the load hanging status flag. Set to 0, where A value of 1 indicates that the load is suspended. A value of 0 indicates that the device is in an unloaded state. S104: When When the value is 1, it is based on the rotation azimuth angle. And the camera extrinsic parameter matrix, calculates the projection coverage area of the boom on the ground as a circle with the pixel coordinates of the tower crane base as the center, the pixel projection value of the effective length of the boom as the radius, and the rotation azimuth angle as the radius. Generate a dynamic hazard area mask for a fan-shaped region along the axial direction. and will and Perform pixel-level union to obtain the composite danger zone mask for the current frame. ;when When the value is 0, Set to an empty mask. equal .
3. The method for early warning of hazardous areas at construction sites based on machine vision according to claim 1, characterized in that, Step S2 includes: S201: Input the current video frame into the shared convolutional backbone network, and extract hierarchical features from the image through multiple convolutional layers and pooling layers in sequence, and output a shared feature map containing multi-scale spatial semantic information; S202: Input the shared feature map into the personnel localization branch. Through anchor box classification convolutional layer and bounding box regression convolutional layer, perform foreground confidence scoring and bounding box coordinate regression on the candidate regions of each spatial location on the feature map, and output the set of bounding boxes of all construction personnel positions in the image. The set of location bounding boxes Includes the bounding boxes of the locations of all construction workers detected in the current frame; S203: For the set of location bounding boxes For each construction worker's location bounding box, corresponding head region feature sub-images and torso region feature sub-images are cropped from the shared feature map. The head region feature sub-image is input into the safety helmet recognition branch, and the safety helmet wearing status classification result for the construction worker is output through a convolutional layer, a global average pooling layer, and a fully connected classification layer. The torso region feature sub-image is input into the safety vest recognition branch, and the safety vest wearing status classification result for the construction worker is output through a convolutional layer, a global average pooling layer, and a fully connected classification layer. The classification result is 1 to indicate that the safety vest is worn, and 0 to indicate that the safety vest is not worn.
4. The method for early warning of hazardous areas at construction sites based on machine vision according to claim 1, characterized in that, Step S3 includes: S301: Extract the outline coordinates of the walls, scaffold bases, and building components from the construction plan drawings, and map these outline coordinates to the video frame pixel coordinate system using the perspective transformation matrix to generate a mask for impassable structural areas. ; S302: Set of bounding boxes showing the locations of construction workers detected in the current frame. Using the established trajectory state set from historical frames as input, an initial matching cost matrix is constructed using the cosine distance of appearance features and the Euclidean distance of the center point space. The initial matching cost matrix contains the [missing information - likely a specific value or component]. The historical trajectory and the first The initial matching cost between the detection results of each current frame The calculation formula is: ; in, For the first The appearance features of the last frame of the historical trajectory are similar to those of the first The cosine distance between the appearance features of each test result For the first The coordinates of the center point of the last frame of the historical trajectory and the first The Euclidean distance between the coordinates of the center points of each detection result This is a dimensionally normalized reference distance, with a value taken as the pixel length of the diagonal of the current video frame. For appearance cost weighting coefficient, The value range is (0,1); S303: Apply spatial passage constraint penalty to the initial matching cost matrix to generate a passage constraint cost matrix. The first element in the passage constraint cost matrix... The historical trajectory and the first The final matching value between the detection results of each current frame The calculation formula is: ; in, The spatial access constraint penalty weight coefficient, For the penalty instruction quantity for crossing, when the first The coordinates of the center point at the end of the historical trajectory to the first The straight line segment formed by the coordinates of the center points of each detection result and the mask of the impassable structural region. When there is pixel region overlap The value is 1, otherwise The value is 0; S304: Taking the passage constraint cost matrix as input, the optimal global matching scheme is solved by the Hungarian matching algorithm to complete the cross-frame association between the current frame detection result and the historical trajectory state. Trajectory states that have not completed matching for more than a preset frame number threshold are deleted. New trajectory states are initialized for newly appearing detection results in multiple consecutive frames. The coordinate sequence of the center point of the historical associated bounding box of each construction worker is output as the historical motion trajectory sequence.
5. The machine vision-based early warning method for hazardous areas at construction sites according to claim 4, characterized in that, Step S3 further includes: The passage constraint cost penalty trajectory association algorithm masks inaccessible structural regions. Spatial distribution information for crossing penalty indicators The process of embedding the cost matrix in the form of the initial matching cost matrix is as follows: Based on this, a spatial traffic constraint penalty term is superimposed to form a traffic constraint cost matrix. This enables the Hungarian matching algorithm to automatically apply a rejection effect to candidate matching pairs that the cross-frame motion vector needs to traverse inaccessible structural regions during the global optimal matching solution process. It also embeds the spatial topological constraints in the construction plan drawings into the multi-target trajectory association process, ensuring the spatial and physical rationality of the historical motion trajectory sequence.
6. The method for early warning of hazardous areas at construction sites based on machine vision according to claim 1, characterized in that, Step S4 includes: S401: For each construction worker's historical movement trajectory sequence, extract the center point of the construction worker and the comprehensive danger zone mask from the historical movement trajectory sequence. The nearest distance to the boundary is less than a preset threshold The features corresponding to consecutive frame segments, among which the velocity change feature vector The path deflection feature vector is composed of a sequence of differences in displacement magnitudes between adjacent time points within the continuous frame segment. It is composed of a sequence of differences in motion direction angles between adjacent moments within the continuous frame segment; S402: Transform the velocity change characteristic vector With path deflection feature vector Input into a two-dimensional feature fusion short-time motion prediction model; in the most recent historical motion trajectory sequence Within a frame, the mean vector of the current motion velocity is calculated based on the displacement vectors between adjacent time points. The average deflection direction unit vector is calculated based on the mean of the motion direction angle at each moment. ; Velocity change characteristic vector With path deflection feature vector Used for dynamically adjusting path deflection correction coefficient ; Calculate the first Step-by-step prediction of location coordinates Specifically: ; in, The coordinates of the center point of the construction personnel at the current moment. To predict the step size, Based on the most recent historical motion trajectory sequence The mean vector of the current motion velocity is obtained by calculating the displacement vector between adjacent time points of each frame. The unit of measurement is pixels / frame. This is the path deflection correction coefficient, measured in pixels per frame, and its value varies according to the velocity variation feature vector. With path deflection feature vector The magnitude of the historical movement deflection reflected is dynamically determined, and its range is as follows: ,in The preset maximum value for the movement speed of construction workers. Based on the most recent historical motion trajectory sequence The dimensionless unit direction vector corresponding to the mean motion direction angle at each moment of the frame.
7. The machine vision-based early warning method for hazardous areas at construction sites according to claim 6, characterized in that, Step S4 further includes: S403: Predict step size From 1 to the preset maximum number of prediction steps By gradually increasing the number of points, a complete sequence of predicted trajectory points is generated. Each predicted position coordinate in the predicted trajectory point sequence is determined to fall within the comprehensive danger zone mask. The pixel coverage area; S404: Combining the classification results of each construction worker's safety helmet wearing status, safety vest wearing status, and predicted trajectory point sequence with comprehensive hazard area mask. Based on the superposition judgment results, the violation type and danger level of each construction worker are determined according to the following rules: when the coordinates of the center point of the current frame of the construction worker have fallen into... When the pixel coverage area is within the specified range, the violation type is determined to be a dangerous area intrusion, and the danger level is determined to be Level 1; when the coordinates of the current frame center point of the construction worker do not fall within the specified range... Pixel coverage area, but there are instances of falling into the predicted trajectory point sequence. When predicting the location coordinates of the pixel coverage area, the violation type is determined to be "approaching a dangerous area," and the danger level is determined to be level two; when the classification result of the construction worker's safety helmet wearing status or safety vest wearing status is 0, and the location coordinates of the current frame center point do not fall within... When the pixel coverage area is defined, the violation type is determined to be missing safety equipment, and the danger level is determined to be level three. When the same construction worker has multiple violation types at the same time, the highest danger level among all coexisting violation types is taken as the final danger level of the construction worker.
8. The method for early warning of hazardous areas at construction sites based on machine vision according to claim 1, characterized in that, Step S5 includes: S501: From the violation types and hazard levels of each construction worker output in step S4, select the sets of construction workers with hazard level 1, hazard level 2, and hazard level 3 respectively. S502: For construction workers with a hazard level of Level 2, a proximity warning trigger command is sent to the on-site audible and visual alarm device corresponding to the area where the construction worker's current location is located, triggering intermittent audible and visual signals that repeat at a preset interval frequency; S503: For construction workers with a hazard level of Level 1, send an immediate alarm trigger command to the on-site audible and visual alarm device corresponding to the area where the construction worker is currently located, triggering a continuous audible and visual signal; for construction workers with a hazard level of Level 3, send a safety equipment missing alarm trigger command to the on-site audible and visual alarm device corresponding to the area where the construction worker is currently located, triggering an intermittent audible and visual signal that repeats at a preset interval frequency. S504: Encapsulate the location coordinates, violation type, and hazard level of all construction workers with violations into alarm record data, push it to the construction site monitoring and management platform in real time, and label the violation type and hazard level information on the location boundary of the corresponding construction worker on the video display interface of the construction site monitoring and management platform.
