A construction site fence climbing behavior detection method and device
The improved yolov7 and DeepSort algorithms are used to detect construction site fence climbing behaviors, which solves the problem of low efficiency in identifying fence climbing behaviors at construction sites and achieves high-precision safety monitoring and low-cost safety management.
Patent Information
- Application Number
- CN202410382025.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-01
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2044-04-01
AI Technical Summary
Fence climbing behaviors at construction sites are difficult to identify efficiently and accurately, resulting in frequent safety accidents. Existing preventive measures are costly and have low management efficiency.
The worker's climbing behavior detection method based on the improved yolov7 network and DeepSort algorithm is adopted. Video data is collected through the camera to detect the relationship between pedestrians and fences. The Hungarian algorithm is used for data association. The DeepSort algorithm is used for pedestrian trajectory tracking to determine whether there is a climbing behavior and send out alarm.
It achieves high-precision, full-time monitoring of construction site fence climbing behavior, reduces the occurrence of safety accidents, lowers operating costs, and avoids the need for manual monitoring.
Smart Images

Figure CN117994862B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of image processing and pedestrian tracking, and in particular to a method and device for detecting construction site fence climbing behavior. Background Art
[0002] Sometimes, there will be some abnormal climbing behaviors during construction work on the construction site. This unsafe behavior is the main cause of casualties and safety accidents on the construction site. At present, the construction party of the construction site mainly prevents this kind of climbing behavior by having management personnel conduct on-site inspections or set up climbing alarm devices on the fences. However, this method is difficult to conduct real-time supervision of the construction site at all times and in all ranges, and the cost of climbing alarm devices is high, resulting in low management efficiency and poor results. Therefore, how to efficiently and accurately identify workers climbing over fences in order to effectively monitor the construction site and reduce the occurrence of safety accidents has become a technical problem that urgently needs to be solved in this field. Summary of the invention
[0003] In view of the above problems, the present application provides a method and device for detecting construction site fence climbing behavior, which are used to solve the above-mentioned technical problem of low efficiency in identifying workers climbing over fences.
[0004] To achieve the above object, the inventor provides a construction site fence climbing behavior detection method, comprising the following steps:
[0005] The video data of the behavior of climbing over the fence in a simulated construction site scene is collected by the camera;
[0006] A worker climbing behavior detection algorithm based on an improved yolov7 network and a DeepSort algorithm is preset, and the worker climbing behavior detection algorithm is used to perform fence detection, pedestrian detection and tracking;
[0007] Using the video data to train the worker climbing behavior detection algorithm;
[0008] Obtain video stream data from on-site monitoring of the construction site, and detect it using the trained worker climbing behavior detection algorithm to identify pedestrians near the fence in the video stream data and obtain their movement trajectory, including: using the improved yolov7 network to detect the current video frame of the video data Detection is performed, and the detection targets include pedestrians and fences; the pedestrians in the frame are marked using an intra-frame relationship module, and the intra-frame relationship module uses the Euclidean distance D between the center point of the fence boundary box and the center point of the pedestrian boundary box in the detection result of the yolov7 network as the cost matrix; the Hungarian algorithm is used to associate data between intra-frame targets, and the fence boundary box is matched with the pedestrian boundary box. If the pedestrian matches the fence boundary box, it is considered that the pedestrian is close to the fence and the mark is set to 1; if the pedestrian does not match the fence boundary box, it is considered that the pedestrian is not close to the fence and the mark is set to 0; the improved DeepSort algorithm is used to track pedestrian trajectories, and the climbing mark of each motion trajectory is updated according to the mark of the pedestrian in the current frame;
[0009] Judging whether the human body is in a climbing state according to the motion trajectory, when the motion trajectory rises above a threshold value T1, performing a crossing action detection, if so, giving an alarm, otherwise continuing to track;
[0010] It is determined whether the rise of the human body motion trajectory exceeds the threshold value T2. If so, there is suspected climbing behavior, and an alarm is sent to the platform. The T2 is greater than the T1.
[0011] In order to solve the above technical problems, this application also provides another technical solution:
[0012] A construction site fence climbing behavior detection device, comprising:
[0013] The acquisition module is used to collect video data of behaviors of climbing over fences in a simulated construction site scene through a camera, and to collect and obtain video stream data of on-site monitoring of the construction site;
[0014] An algorithm module, used for presetting a worker climbing behavior detection algorithm based on an improved yolov7 network and a DeepSort algorithm, wherein the worker climbing behavior detection algorithm is used for performing fence detection, pedestrian detection and tracking;
[0015] A training module, used to train the worker climbing behavior detection algorithm using video stream data monitored on site;
[0016] The monitoring module is used to detect the worker climbing behavior through the trained detection algorithm, identify the pedestrians near the fence in the video stream data and obtain their movement trajectory, including: using the improved yolov7 network to detect the current video frame of the video data The detection targets include pedestrians and fences; the intra-frame relationship module is used to mark the pedestrians in the frame, and the intra-frame relationship module uses the Euclidean distance D between the center point of the fence boundary box and the center point of the pedestrian boundary box in the detection result of the yolov7 network as the cost matrix; the Hungarian algorithm is used to associate data between the intra-frame targets, and the fence boundary box is matched with the pedestrian boundary box. If the pedestrian matches the fence boundary box, it is considered that the pedestrian is close to the fence, and the mark is set to 1; if the pedestrian does not match the fence boundary box, it is considered that the pedestrian is not close to the fence, and the mark is set to 0; the improved DeepSort algorithm is used to track the pedestrian trajectory, and the climbing mark of each motion trajectory is updated according to the mark of the pedestrian in the current frame; according to the motion trajectory, it is judged whether the human body is in a climbing and rising state, when the motion trajectory rises above the threshold value T1, a crossing action detection is performed, if so, an alarm is issued, otherwise the tracking is continued; it is judged whether the rise of the human body motion trajectory exceeds the threshold value T2, if so, there is suspected climbing behavior, and an alarm is issued to the platform, and the T2 is greater than the T1.
[0017] In order to solve the above technical problems, this application also provides another technical solution:
[0018] A construction site fence climbing behavior detection device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the construction site fence climbing behavior detection method described in any one of the above technical solutions is executed.
[0019] Different from the prior art, the above technical solution pre-sets a worker climbing behavior detection algorithm based on the improved yolov7 and deepsort algorithms, and uses the pre-collected video data of the simulated construction site scene climbing over the fence behavior for annotation, and then trains the worker climbing behavior detection algorithm to obtain the learned model, and uses the trained worker climbing behavior detection algorithm to process the video stream of the construction site, obtain the detection target and its motion trajectory, and use the target's motion to finally determine whether there is a behavior of climbing over the fence and issue an alarm prompt, so as to solve the construction safety problem in time. This technical solution uses the optimized target detection and tracking algorithm to monitor the high-altitude operation situation, which not only has high detection accuracy, but also can monitor uninterruptedly, does not require manpower, avoids a series of safety problems, and has low operating costs. In addition, in this technical solution, the intra-frame relationship module is optimized, and the Euclidean distance D between the center point of the fence boundary box in the detection network result and the center point of the pedestrian body boundary box is used as the cost matrix, and then the Hungarian algorithm is used to associate the data between the targets in the frame, and the fence boundary box is matched with the pedestrian boundary box, so that the pedestrians in the frame can be more accurately marked according to the detection information.
[0020] The above-mentioned records related to the invention content are only an overview of the technical solution of the present application. In order to enable ordinary technicians in the field to more clearly understand the technical solution of the present application, and then implement it according to the text of the specification and the contents recorded in the drawings, and to make the above-mentioned purpose and other purposes, features and advantages of the present application easier to understand, the following is an explanation in combination with the specific implementation mode and drawings of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The drawings are only used to illustrate the principles, implementation methods, applications, characteristics and effects of the specific embodiments of the present invention and other related contents, and shall not be considered as limiting the present application.
[0022] In the drawings of the specification:
[0023] Figure 1 It is a flowchart of the construction site fence climbing behavior detection method described in the specific implementation method;
[0024] Figure 2 A flowchart of monitoring a video stream according to a specific implementation method;
[0025] Figure 3 It is a module block diagram of the construction site fence climbing behavior detection device described in the specific implementation method;
[0026] Figure 4 A module diagram frame of the training module described in the specific implementation method;
[0027] Figure 5 It is a schematic diagram of a construction site fence climbing behavior detection device according to a specific implementation method;
[0028] The reference numerals in the above drawings are described as follows:
[0029] 301, acquisition module; 302, algorithm module; 303, training module; 304, monitoring module;
[0030] 3031, frame detection module; 3032, intra-frame relationship module; 3033, marking module;
[0031] 3034, update module; 500, construction site fence climbing behavior detection device; 501, processor;
[0032] 502. Memory; DETAILED DESCRIPTION
[0033] In order to explain in detail the possible application scenarios, technical principles, specific schemes that can be implemented, and the purposes and effects that can be achieved, the following is a detailed description of the specific embodiments listed in conjunction with the accompanying drawings. The embodiments described herein are only used to more clearly illustrate the technical solutions of the present application, and are therefore only used as examples, and cannot be used to limit the scope of protection of the present application.
[0034] Reference to "embodiment" herein means that the specific features, structures or characteristics described in conjunction with the embodiment may be included in at least one embodiment of the present application. The term "embodiment" appearing in various places in the specification does not necessarily refer to the same embodiment, nor does it particularly limit its independence or association with other embodiments. In principle, in the present application, as long as there is no technical contradiction or conflict, the various technical features mentioned in the embodiments can be combined in any way to form a corresponding implementable technical solution.
[0035] Unless otherwise defined, the technical terms used in this document have the same meanings as those generally understood by those skilled in the art to which this application belongs; the use of relevant terms in this document is only for describing specific embodiments and is not intended to limit this application.
[0036] In the description of this application, the term "and / or" is an expression used to describe the logical relationship between objects, indicating that three relationships may exist, for example, A and / or B, which means: A exists, B exists, and A and B exist at the same time. In addition, the character " / " in this article generally indicates that the objects before and after are in an "or" logical relationship.
[0037] In the present application, terms such as “first” and “second” are merely used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship of quantity, priority or sequence between these entities or operations.
[0038] Without further limitations, in this application, the words "include", "comprises", "has" or other similar open-ended expressions used in sentences are intended to cover non-exclusive inclusion. These expressions do not exclude the presence of additional elements in the process, method or product including the elements, so that the process, method or product including a series of elements may include not only those limited elements, but also other elements not explicitly listed, or also include elements inherent to such process, method or product.
[0039] Similar to the understanding in the Examination Guidelines, in this application, expressions such as "greater than", "less than", "exceed" and the like are understood to exclude the number itself; expressions such as "above", "below", "within" and the like are understood to include the number itself. In addition, in the description of the embodiments of this application, "multiple" means more than two (including two), and similar expressions related to "multiple" are also understood in this way, such as "multiple groups", "multiple times", etc., unless otherwise clearly and specifically limited.
[0040] In the description of the embodiments of the present application, space-related expressions used, such as "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "vertical", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise", "axial", "radial", "circumferential", etc., indicate the orientation or position relationship based on the orientation or position relationship shown in the specific embodiments or drawings, and are only for the convenience of describing the specific embodiments of the present application or facilitating the reader's understanding, and do not indicate or imply that the referred device or component must have a specific position, a specific orientation, or be constructed or operated in a specific orientation, and therefore cannot be understood as a limitation on the embodiments of the present application.
[0041] Unless otherwise expressly specified or limited, in the description of the embodiments of the present application, the terms such as "install", "connect", "connect", "fix", "set", etc. used should be understood in a broad sense. For example, the "connection" can be a fixed connection, a detachable connection, or an integrated setting; it can be a mechanical connection, an electrical connection, or a communication connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium; it can be the internal connection of two elements or the interaction relationship between two elements. For technicians in the technical field to which the present application belongs, the specific meanings of the above terms in the embodiments of the present application can be understood according to the specific circumstances.
[0042] See also Figures 1 to 5 The present embodiment provides a construction site fence climbing behavior detection method and device, which are used to detect whether there are workers climbing over fences on the construction site, and promptly issue an alarm and prompt when climbing behavior is detected. The construction site fence climbing behavior detection method and device can be applied to various construction sites with fences to improve the efficiency and accuracy of identifying fence climbing behavior.
[0043] like Figure 1 As shown, in one embodiment, a construction site fence climbing behavior detection method is provided, and the construction site fence climbing behavior detection method includes the following steps:
[0044] S101, collecting video data of behaviors of climbing over fences in a simulated construction site scene through a camera;
[0045] S102, presetting a worker climbing behavior detection algorithm (hereinafter also referred to as a model) based on an improved yolov7 network and a DeepSort algorithm, wherein the worker climbing behavior detection algorithm is used to perform fence detection, pedestrian detection and tracking;
[0046] S103, using the video data to train the worker climbing behavior detection algorithm;
[0047] S104, obtaining video stream data of on-site monitoring of the construction site, and detecting the pedestrians approaching the fence in the video stream data by using the trained worker climbing behavior detection algorithm, and obtaining their movement trajectories;
[0048] S105, judging whether the human body is in a climbing state according to the motion trajectory, and performing a crossing action detection when the motion trajectory rises above a threshold value T1, and if so, giving an alarm, otherwise continuing tracking;
[0049] S106, determining whether the rise of the human body motion trajectory exceeds a threshold value T2, if so, there is suspected climbing behavior, and an alarm is sent to the platform, and the T2 is greater than the T1.
[0050] The above step S101 includes the following steps:
[0051] Arrange multiple simulation points on the construction site and conduct monitoring, using high-definition cameras to collect videos of workers simulating climbing over fences;
[0052] Use image annotation tools to annotate the filtered video data frames and select the desired targets. The targets are divided into two categories: human body and fence.
[0053] The knowledge data of the construction site (i.e. the image data of the construction site) is enhanced (i.e. general enhancement processing), and the enhancement processing includes methods such as rotation, cropping, and filtering. The image data content is further expanded through enhancement processing to prevent the model (i.e. the worker climbing behavior detection algorithm) from overfitting.
[0054] like Figure 2 As shown, the above step S104 uses the trained worker climbing behavior detection algorithm to perform detection, including:
[0055] 201. Using the improved yolov7 network to analyze the current video frame of the video data Conduct detection, the detection targets include pedestrians and fences;
[0056] S202, using an intra-frame relationship module to mark pedestrians in the frame, the intra-frame relationship module using the Euclidean distance D between the center point of the fence bounding box and the center point of the pedestrian bounding box in the detection result of the yolov7 network as a cost matrix;
[0057] S203, using the Hungarian algorithm to associate data between objects in the frame, matching the fence bounding box with the pedestrian bounding box, if the pedestrian matches the fence bounding box, it is considered that the pedestrian is close to the fence, and the flag is set to 1; if the pedestrian does not match the fence bounding box, it is considered that the pedestrian is not close to the fence, and the flag is set to 0;
[0058] S204: Use the improved DeepSort algorithm to track pedestrian trajectories, and update the climbing mark of each motion trajectory according to the pedestrian mark in the current frame.
[0059] In this embodiment, the optimized target detection and tracking algorithm is used to monitor the high-altitude operation situation. Not only is the detection accuracy high, but it can also monitor continuously without labor consumption, avoid a series of safety issues, and have low operating costs. In addition, in this technical solution, the intra-frame relationship module is optimized, and the Euclidean distance D between the center point of the fence boundary box in the detection network result and the center point of the pedestrian body boundary box is used as the cost matrix. Then, the Hungarian algorithm is used to associate the data between the intra-frame targets, and the fence boundary box is matched with the pedestrian boundary box, so that the pedestrians in the frame can be marked more accurately according to the detection information.
[0060] In some embodiments, the current video frame of the video data is processed using the improved yolov7 network. Perform detection, the detection targets include pedestrians and fences, including the following steps:
[0061] The image of the input video data is passed through the EfficientNet backbone network to extract high-level features, and a series of feature maps of different resolutions are obtained; among them, the high-level features of the image are high-level semantic features, which are simply what people can see directly. For example, for a cat, the high-level features are displayed as a cat, and its underlying features are the outline, color, texture, etc. of the cat. The semantic information of high-level features is relatively rich, but the target position is relatively rough. Therefore, this type of feature is more useful for recognition tasks, and generally, high-level features are extracted through complex multi-layer network convolution layers and pooling layers.
[0062] The different feature maps are respectively sent to different detection branches for detection, and each detection branch includes an adaptive convolution layer, an attention module, a classification subnetwork and a regression subnetwork; the adaptive convolution layer adaptively adjusts the size of the convolution kernel according to the target size, and the attention module is used to enhance the perception ability of the worker climbing behavior detection algorithm for different areas, thereby improving the detection accuracy of the worker climbing behavior detection algorithm; the classification subnetwork is used to predict the object category in the detection frame, and the regression subnetwork is used to predict the position and size of the detection frame.
[0063] The feature pyramid is used to detect the feature maps of different scales to detect objects of different sizes, and multi-level feature fusion is used to fuse the feature maps of different scales together to improve the detection accuracy of the model. Among them, the feature matrices of different scales are mainly transformed by 1*1 convolution for channel transformation and upsampling (downsampling) for resolution (width and height) transformation, and then weighted fusion is formed into a new feature vector.
[0064] The detection results in the feature maps of different resolutions are merged, and a non-maximum algorithm is used to remove duplicates and filter them to obtain the final detection result.
[0065] First, input the image, use the EfficientNet-b0 network as the backbone network to extract features of different resolutions, and then input the feature map into the detection branch. This experiment defines three detection branches; each detection branch contains the adaptive convolution layer in yolov7, the attention mechanism module, and the target classification and coordinate regression module; finally, concatenate the multiple tensor vectors of the detection results of the three branches, and use the non-maximum (NMS) algorithm to remove duplication and filter, and get the final detection result. The adaptive convolution module and the attention module are modules in yolov7; the use of the adaptive convolution module can adapt to targets of different sizes, and can better perform convolution operations on feature maps of different resolutions, thereby improving the perception of the model; the attention mechanism module can improve the model's perception of different areas, and can better handle targets of different scales in complex scenes.
[0066] The spatial attention module can build a rich contextual relationship model on local features, and can encode broader contextual information into local features, thereby enhancing its representation ability; the spatial attention module can assign different weights according to different positions of the input data, so that the model can better focus on important information, thereby improving the model's prediction accuracy and overall performance.
[0067] In some embodiments, when using the improved DeepSort algorithm to track pedestrian trajectories, the apparent features of the tracked target are extracted (the apparent features refer to the outline, shape, color and other features of the target; the nearest neighbor matching is to calculate the similarity of the detected target, calculate the matching degree between the targets of the previous and next frames (the distance between the previous and next targets belonging to the same target is relatively small, and the distance between different targets is relatively large), and the target with the smallest distance is regarded as the target match) and the nearest neighbor matching is performed to improve the target tracking effect under occlusion, including the steps of:
[0068] When the detection target of the DeepSort algorithm is disturbed by similar targets, there is no overlap between the detection box and the prediction box, and the IOU value is always 0, a penalty term is added to the IOU. The IOU value refers to the intersection-over-union ratio of two boxes (intersection divided by union), which is used to measure the degree of overlap of two boxes. When IOU=1, it means that the two boxes are completely overlapped, and when IOU=0, it means that the two boxes are completely separated; its formula is:
[0069] IOU=(A∩B) / (A∪B); where A is the predicted box and B is the actual box (labeled box).
[0070] The penalty term includes the overlap of the border, the center distance and the aspect ratio scale information; after adding the penalty term, the calculation formula of the DeepSort algorithm tracking trajectory and the detection result matching process is as follows:
[0071] ;
[0072] ;
[0073] ;
[0074] In the formula, is the intersection-over-union ratio of the predicted bounding box and the true bounding box, is the intersection-over-union ratio after adding the penalty term, is the Euclidean distance between the center of the predicted box and the center of the real box, X represents the predicted box, and Y represents the real box. is the shortest diagonal length between the predicted box and the real box; u is a trade-off parameter, and v is a parameter to measure the similarity of aspect ratio; and is the width and height of the real box, w and h are the width and height of the predicted box.
[0075] In this embodiment, when the detected target is disturbed, the detection box and the prediction box may not overlap. At this time, the target may be considered to have disappeared and cannot be tracked anymore. The introduction of the penalty term can solve the problem that IOU cannot measure similarity when the two bounding boxes do not intersect. First, the first term We can introduce the variable of the distance between the two bounding boxes (the distance between the center points of the two bounding boxes) to help measure the similarity between the two bounding boxes. The second term Introducing the aspect ratio factor, the most important thing about the bounding box similarity calculation formula is that it can measure the similarity of two bounding boxes when they are in any position. It is necessary to fully consider various special cases (such as bounding box inclusion, separation, etc.). Different positions must reflect different similarity values (except coincidences), so that the similarity can be better measured.
[0076] In some embodiments, the current video frame of the video data is processed using the improved yolov7 network. Detection targets include pedestrians and fences, as well as:
[0077] The intra-frame relationship module uses the output information of the yolov7 network to mark the pedestrian in the frame image as being close to the fence, and adds the mark to the state of the corresponding pedestrian. At this time, the pedestrian state is:
[0078] ;
[0079] in, It is the mark of pedestrians approaching the fence in a single frame image. 1 means close to the fence, and 0 means not close to the fence. is the pedestrian status mark before updating, Mark for updated status;
[0080] The tracking process of the tracker for the pedestrian in the current frame image is divided into two steps. The first step is to track the pedestrian according to the state of the pedestrian. Perform trajectory matching and assign a trajectory ID to each pedestrian; the second step is to update the fence approaching marker of the pedestrian trajectory, and according to the update rule mark Update to The corresponding pedestrian trajectory; the update rule includes: if the pedestrian is observed approaching the fence in the current frame, then The state of is marked as 1, and the mark of the trajectory is updated to 1; if the pedestrian in the current frame is not close to the fence, then The state of is marked as 0, and the mark of the trajectory is updated to 0.
[0081] In some embodiments, when the motion trajectory rises above the threshold value T1 and a crossing action detection is required, the openpose human posture is used for detection to determine whether the current pedestrian is performing a crossing action.
[0082] like Figure 3 As shown, in one embodiment, a construction site fence climbing behavior detection device is disclosed, including: a collection module 301, an algorithm module 302, a training module 303 and a monitoring module 304.
[0083] The acquisition module 301 is used to acquire video data of the behavior of climbing over the fence in a simulated construction site scene through a camera, and to acquire video stream data of on-site monitoring of the construction site.
[0084] The algorithm module 302 is used to preset a worker climbing behavior detection algorithm based on the improved yolov7 network and the DeepSort algorithm, and the worker climbing behavior detection algorithm is used to perform fence detection, pedestrian detection and tracking.
[0085] The training module 303 is used to train the worker climbing behavior detection algorithm using the video data.
[0086] The monitoring module 304 is used to detect through the trained worker climbing behavior detection algorithm, identify pedestrians near the fence in the video stream data and obtain their motion trajectory; judge whether the human body is in a climbing state according to the motion trajectory, and when the motion trajectory rises above the threshold value T1, perform crossing action detection, if so, issue an alarm, otherwise continue tracking; judge whether the human body's motion trajectory rises above the threshold value T2, if so, there is suspected climbing behavior, and issue an alarm to the platform, and the T2 is greater than the T1.
[0087] like Figure 4 As shown, the monitoring module 304 includes: a frame detection module 3031 , an intra-frame relationship module 3032 , a marking module 3033 and an updating module 3034 .
[0088] The frame detection module 3031 is used to detect the current video frame of the video data using the improved yolov7 network. Detection is performed, and the detection targets include pedestrians and fences; the intra-frame relationship module 3032 is used to mark pedestrians in the frame, and the intra-frame relationship module uses the Euclidean distance D between the center point of the fence boundary box and the center point of the pedestrian boundary box in the detection result of the yolov7 network as the cost matrix; the marking module 3033 is used to use the Hungarian algorithm to associate data between targets in the frame, and match the fence boundary box with the pedestrian boundary box. If the pedestrian matches the fence boundary box, it is considered that the pedestrian is close to the fence and the mark is set to 1; if the pedestrian does not match the fence boundary box, it is considered that the pedestrian is not close to the fence and the mark is set to 0; the updating module 3034 is used to use the improved DeepSort algorithm to track pedestrian trajectories, and at the same time, the climbing mark of each motion trajectory is updated according to the mark of the pedestrian in the current frame.
[0089] In some embodiments, when the motion trajectory rises above the threshold value T1 and a crossing action detection is required, the openpose human posture is used for detection to determine whether the current pedestrian is performing a crossing action.
[0090] In some embodiments, when the improved DeepSort algorithm is used to track pedestrian trajectories, the apparent features of the tracking target are extracted to perform nearest neighbor matching to improve the target tracking effect under occlusion conditions.
[0091] like Figure 5As shown, in one embodiment, a construction site fence climbing behavior detection device 500 is provided, and the construction site fence climbing behavior detection device 500 includes a memory 502, a processor 501, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the construction site fence climbing behavior detection method described in any one of the above embodiments is executed.
[0092] Finally, it should be noted that although the above embodiments have been described in the specification and drawings of this application, this does not limit the scope of patent protection of this application. All technical solutions generated by replacing or modifying equivalent structures or equivalent processes based on the essential concept of this application using the contents recorded in the specification and drawings of this application, as well as directly or indirectly implementing the technical solutions of the above embodiments in other related technical fields, are included in the scope of patent protection of this application.
Claims
1. A construction site fence climbing behavior detection method, characterized in that: The following steps are involved: The video data of the behavior of climbing over the fence in a simulated construction site scene is collected by the camera; A worker climbing behavior detection algorithm based on an improved yolov7 network and a DeepSort algorithm is preset, and the worker climbing behavior detection algorithm is used to perform fence detection, pedestrian detection and tracking; Using the video data to train the worker climbing behavior detection algorithm; The video stream data of the construction site monitoring is obtained, and the worker climbing behavior detection algorithm is used to detect the pedestrians near the fence in the video stream data and obtain their movement trajectory, including: using the improved yolov7 network to detect the current video frame of the video data. t Detection is performed, and the detection targets include pedestrians and fences; the pedestrians in the frame are marked using an intra-frame relationship module, and the intra-frame relationship module uses the Euclidean distance D between the center point of the fence boundary box and the center point of the pedestrian boundary box in the detection result of the yolov7 network as the cost matrix; the Hungarian algorithm is used to associate data between intra-frame targets, and the fence boundary box is matched with the pedestrian boundary box. If the pedestrian matches the fence boundary box, it is considered that the pedestrian is close to the fence and the mark is set to 1; if the pedestrian does not match the fence boundary box, it is considered that the pedestrian is not close to the fence and the mark is set to 0; the improved DeepSort algorithm is used to track pedestrian trajectories, and the climbing mark of each motion trajectory is updated according to the mark of the pedestrian in the current frame; Judging whether the human body is in a climbing state according to the motion trajectory, when the motion trajectory rises above a threshold value T1, performing a crossing action detection, if so, giving an alarm, otherwise continuing to track; Determine whether the human body motion trajectory rises above a threshold value T2. If so, there is suspected climbing behavior, and an alarm is sent to the platform. The threshold value T2 is greater than the threshold value T1. The improved yolov7 network is used to analyze the current video frame f of the video data. t Perform detection, the detection targets include pedestrians and fences, including the following steps: The image of the input video data is passed through the EfficientNet backbone network to extract high-level features to obtain a series of feature maps with different resolutions; The different feature maps are respectively sent to different detection branches for detection, and each detection branch includes an adaptive convolution layer, an attention module, a classification subnetwork and a regression subnetwork; the adaptive convolution layer adaptively adjusts the size of the convolution kernel according to the target size, and the attention module is used to enhance the perception ability of the worker climbing behavior detection algorithm for different areas, thereby improving the detection accuracy of the worker climbing behavior detection algorithm; the classification subnetwork is used to predict the object category in the detection frame, and the regression subnetwork is used to predict the position and size of the detection frame; Using feature pyramids to perform detection on the feature maps of different scales to detect objects of different sizes, and using multi-level feature fusion to fuse the feature maps of different scales together to improve the detection accuracy of the model; The detection results in the feature maps of different resolutions are merged, and a non-maximum algorithm is used to remove duplicates and filter them to obtain the final detection result; When the improved DeepSort algorithm is used to track pedestrian trajectories, the apparent features of the tracking target are extracted for nearest neighbor matching to improve the target tracking effect under occlusion conditions, including the following steps: When the detection target of the DeepSort algorithm is disturbed by a similar target, there is no overlap between the detection frame and the prediction frame, and the IOU value is always 0, a penalty item is added to the IOU, and the penalty item includes the overlap degree of the frame, the center distance, and the aspect ratio scale information; after adding the penalty item, the calculation formula of the DeepSort algorithm tracking trajectory and the detection result matching process is as follows: Where IOU is the intersection-over-union ratio between the predicted bounding box and the true bounding box. c is the intersection-over-union ratio after adding the penalty term, ρ 2 is the Euclidean distance between the center of the predicted box and the real box, X represents the predicted box, Y represents the real box, γ is the shortest diagonal length between the predicted box and the real box; u is a trade-off parameter, v is a parameter to measure the similarity of aspect ratio; w gt and h gt is the width and height of the real box, w and h are the width and height of the predicted box.
2. The construction site fence climbing behavior detection method according to claim 1, characterized in that: Also includes: The intra-frame relationship module uses the output information of the yolov7 network to mark the pedestrian in the frame image as being close to the fence, and adds the mark to the state of the corresponding pedestrian. At this time, the pedestrian state is: S p2 ={S p1 ,m t |Im t =1,0}; Among them, m t is the pedestrian close to the fence mark in a single frame image, 1 means close to the fence, 0 means not close to the fence, S p1 is the pedestrian status mark before updating, S p2 Mark for updated status; The tracking process of the tracker for the pedestrian in the current frame image includes: According to the pedestrian status S p1 Perform trajectory matching and assign a trajectory ID to each pedestrian; The fence of the pedestrian trajectory is updated close to the mark, and S is updated according to the update rule. p2 Mark m t Update to S p1 The corresponding pedestrian trajectory; the update rule includes: if the pedestrian is observed approaching the fence in the current frame, then S p2 The state of is marked as 1, and the mark of the trajectory is updated to 1; if the pedestrian in the current frame is not close to the fence, then S p2 The state of is marked as 0, and the mark of the trajectory is updated to 0.
3. The construction site fence climbing behavior detection method according to claim 1, characterized in that: When the motion trajectory rises above the threshold T1 and a crossing action detection is required, the openpose human posture is used for detection to determine whether the current pedestrian is making a crossing action.
4. A construction site fence climbing behavior detection device, characterized in that: include: The acquisition module is used to collect video data of behaviors of climbing over fences in a simulated construction site scene through a camera, and to collect and obtain video stream data of on-site monitoring of the construction site; An algorithm module, used for presetting a worker climbing behavior detection algorithm based on an improved yolov7 network and a DeepSort algorithm, wherein the worker climbing behavior detection algorithm is used for performing fence detection, pedestrian detection and tracking; A training module, used to train the worker climbing behavior detection algorithm using video stream data monitored on site; The monitoring module is used to detect the worker climbing over the fence through the trained detection algorithm, identify the pedestrians near the fence in the video stream data and obtain their movement trajectory, including: using the improved yolov7 network to detect the current video frame of the video data t Detection is performed, and the detection targets include pedestrians and fences; the intra-frame relationship module is used to mark the pedestrians in the frame, and the intra-frame relationship module uses the Euclidean distance D between the center point of the fence boundary box and the center point of the pedestrian boundary box in the detection result of the yolov7 network as the cost matrix; the Hungarian algorithm is used to associate data between the targets in the frame, and the fence boundary box is matched with the pedestrian boundary box. If the pedestrian matches the fence boundary box, it is considered that the pedestrian is close to the fence, and the mark is set to 1; if the pedestrian does not match the fence boundary box, it is considered that the pedestrian is not close to the fence, and the mark is set to 0; the improved DeepSort algorithm is used to track the pedestrian trajectory, and the climbing mark of each motion trajectory is updated according to the mark of the pedestrian in the current frame; according to the motion trajectory, it is determined whether the human body is in a climbing and rising state. When the motion trajectory rises above the threshold value T1, a crossing action detection is performed. If so, an alarm is issued, otherwise the tracking continues; it is determined whether the rise of the human body motion trajectory exceeds the threshold value T2. If so, there is suspected climbing behavior, and an alarm is issued to the platform, and the T2 is greater than the T1; The improved yolov7 network is used to analyze the current video frame f of the video data. t Perform detection, the detection targets include pedestrians and fences, including the following steps: The image of the input video data is passed through the EfficientNet backbone network to extract high-level features to obtain a series of feature maps with different resolutions; The different feature maps are respectively sent to different detection branches for detection, and each detection branch includes an adaptive convolution layer, an attention module, a classification subnetwork and a regression subnetwork; the adaptive convolution layer adaptively adjusts the size of the convolution kernel according to the target size, and the attention module is used to enhance the perception ability of the worker climbing behavior detection algorithm for different areas, thereby improving the detection accuracy of the worker climbing behavior detection algorithm; the classification subnetwork is used to predict the object category in the detection frame, and the regression subnetwork is used to predict the position and size of the detection frame; Using feature pyramids to perform detection on the feature maps of different scales to detect objects of different sizes, and using multi-level feature fusion to fuse the feature maps of different scales together to improve the detection accuracy of the model; The detection results in the feature maps of different resolutions are merged, and a non-maximum algorithm is used to remove duplicates and filter them to obtain the final detection result; When the improved DeepSort algorithm is used to track pedestrian trajectories, the apparent features of the tracking target are extracted for nearest neighbor matching to improve the target tracking effect under occlusion conditions, including the following steps: When the detection target of the DeepSort algorithm is disturbed by a similar target, there is no overlap between the detection frame and the prediction frame, and the IOU value is always 0, a penalty item is added to the IOU, and the penalty item includes the overlap degree of the frame, the center distance, and the aspect ratio scale information; after adding the penalty item, the calculation formula of the DeepSort algorithm tracking trajectory and the detection result matching process is as follows: Where IOU is the intersection-over-union ratio between the predicted bounding box and the true bounding box. c is the intersection-over-union ratio after adding the penalty term, ρ 2 is the Euclidean distance between the center of the predicted box and the real box, X represents the predicted box, Y represents the real box, γ is the shortest diagonal length between the predicted box and the real box; u is a trade-off parameter, v is a parameter to measure the similarity of aspect ratio; w gt and h gt is the width and height of the real box, w and h are the width and height of the predicted box.
5. The construction site fence climbing behavior detection device according to claim 4, characterized in that: When the motion trajectory rises above the threshold T1 and a crossing action detection is required, the openpose human posture is used for detection to determine whether the current pedestrian is making a crossing action.
6. The construction site fence climbing behavior detection device according to claim 5, characterized in that: When the improved DeepSort algorithm is used to track pedestrian trajectories, the apparent features of the tracking target are extracted for nearest neighbor matching to improve the target tracking effect under occlusion conditions.
7. A construction site fence climbing behavior detection device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor executes the construction site fence climbing behavior detection method as described in any one of claims 1 to 3 when executing the computer program.
