Self-adaptive scene running behavior detection method and device, equipment and storage medium

By using an adaptive scene running behavior detection method, which combines perspective correction function and dynamic threshold with action recognition model, the problem of speed distortion caused by perspective distortion is solved, and efficient and accurate running behavior detection is achieved.

CN121505682APending Publication Date: 2026-02-10PCI TECH GRP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511407127.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-29
Publication Date
2026-02-10

AI Technical Summary

Technical Problem

Existing running detection methods are susceptible to perspective distortion under different scenarios and shooting angles, resulting in speed distortion and making it difficult to balance detection efficiency and accuracy.

Method used

The detection box is obtained through real-time object detection, the speed is corrected by perspective correction function, and two-stage detection is performed by combining dynamic threshold and action recognition model. The threshold is adaptively adjusted to adapt to different scenarios.

Benefits of technology

It improves the accuracy and efficiency of speed detection, can adapt to anomaly detection in different regions, reduces the workload of manually customizing thresholds, and lowers computational overhead.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121505682A_ABST
    Figure CN121505682A_ABST
Patent Text Reader

Abstract

The invention discloses an adaptive scene running behavior detection method and device, equipment and a storage medium. The method comprises the following steps: performing target detection on a collected video stream in real time to obtain a detection frame corresponding to each target in a current video frame; determining the correction speed of each target based on the inter-frame displacement of each detection frame and the perspective correction function; determining a dynamic threshold value corresponding to each target based on the region where each target is located in the current video frame, and judging whether the correction speed of each target exceeds the dynamic threshold value or not; and in response to the condition that the correction speed exceeds the dynamic threshold value and the action recognition result is running, warning a corresponding target that the running behavior occurs. Through the above mode, the target speed can be corrected by adding the perspective correction function so as to avoid speed distortion, the video picture is divided into a plurality of areas and the dynamic thresholds capable of being adaptively adjusted are set respectively so as to improve the speed detection accuracy, and the motion recognition is added after the speed detection so as to improve the speed detection accuracy. And the detection efficiency and accuracy are considered.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of abnormal running behavior detection, and in particular to an adaptive scene running behavior detection method, device, equipment and storage medium. Background Technology

[0002] In applications such as public safety monitoring, smart campuses, and sports venue management, abnormal running behavior detection is an important function. For example, in densely populated areas, abnormal running behavior may indicate an emergency or a potential stampede; in sports scenarios, accurately identifying running movements is helpful for motion analysis and behavior statistics.

[0003] Traditional running detection methods mainly fall into two categories: 1. Velocity threshold-based detection: This method directly compares the target's velocity on the pixel plane with a fixed threshold. However, this method requires manually customizing the threshold depending on the scene and shooting angle, and is easily affected by the camera's installation angle and perspective, resulting in incomparable velocities between the foreground and background. Alternatively, it may require precise camera calibration and projection transformation to restore the true scale, which is often difficult to implement in practice.

[0004] 2. Detection based on deep learning behavior recognition: Identifying the "running" category through a behavior classification model. However, this method requires long-term training, has high inference costs, and is prone to misclassifying similar actions such as jumping or walking quickly.

[0005] Therefore, how to combine the high efficiency of speed detection with the semantic accuracy of behavior recognition, and solve the speed distortion caused by perspective distortion, is a key challenge in existing technologies. Summary of the Invention

[0006] This application provides an adaptive scene running behavior detection method, device, equipment, and storage medium to solve the problems of speed distortion caused by perspective distortion and difficulty in balancing detection efficiency and accuracy in existing running detection methods.

[0007] To address the aforementioned technical problems, this application provides a technical solution: an adaptive scene running behavior detection method. This method includes: Real-time target detection is performed on the acquired video stream to obtain the detection boxes corresponding to each target in the current video frame; Based on the inter-frame displacement and perspective correction function of each detection box, the correction speed of each target is determined; Based on the location of each target in the current video frame, determine the dynamic threshold corresponding to each target, and determine whether the correction speed of each target exceeds the dynamic threshold; In response to the correction speed exceeding the dynamic threshold and the action recognition result being running, an alarm is issued indicating that the target has engaged in running behavior.

[0008] In an optional embodiment of this application, after obtaining the detection boxes corresponding to each target in the current video frame, the method further includes: Assign a target identifier to each target, and cache the detection box in the first queue corresponding to the target identifier based on the target identifier; In response to the correction speed exceeding the dynamic threshold and the number of detection boxes cached in the first queue reaching a first preset number, the first preset number of detection boxes in the first queue are input into the action recognition model to obtain the action recognition result.

[0009] In an optional embodiment of this application, determining the correction speed of each target based on the inter-frame displacement and perspective correction function of each detection box includes: Based on the time difference between the current video frame and the video frame with a preset number of previous frames and the displacement of the detection box, the original velocity of each target is determined; The original velocity of each target is corrected based on the perspective correction function to determine the corrected velocity of each target; The perspective correction function is: , formula 1; in, The corrected speed; y is the original velocity; y is the ordinate of the detection box in the current video frame; a, b, and c are all fitting parameters.

[0010] In one optional implementation of this application's embodiments, it includes: Track multiple targets in a pre-acquired video stream, and collect the center ordinate of the detection box of each target and the corresponding original velocity until a second preset number is reached; Based on the second preset number of center ordinates and the corresponding original velocities, the fitting parameters are obtained by fitting a quadratic regression equation to obtain the perspective correction function.

[0011] In an optional embodiment of this application, before determining the dynamic threshold corresponding to each of the targets based on the region where each target is located in the current video frame, the following steps are included: The video stream is divided into several regions, a second queue is allocated to each region, and all the corrected speeds in each region are collected and cached in the second queue. In response to the number of the corrected speeds cached in the second queue exceeding a third preset number, a threshold function is constructed by statistically analyzing the speed distribution of each corrected speed in the second queue, and a dynamic threshold corresponding to each region is determined.

[0012] In an optional embodiment of this application, the threshold function is: , formula 2; in, The dynamic threshold; The median of all the corrected speeds; denoted as the median absolute deviation among the various correction speeds; k is a preset parameter.

[0013] In an optional embodiment of this application, after determining the dynamic threshold corresponding to each region, the method further includes: The corrected speed of each target in the current video frame is cached in the corresponding second queue to update the second queue; The threshold function is updated by statistically updating the median and median absolute deviation of the corrected speed in the updated second queue, so as to update the dynamic threshold corresponding to each region.

[0014] To address the aforementioned technical problems, another technical solution adopted in this application is: providing an adaptive scene running behavior detection device, comprising: The target detection module is used to perform target detection on the acquired video stream in real time and obtain the detection box corresponding to each target in the current video frame; A velocity correction module is used to determine the correction velocity of each target based on the inter-frame displacement and perspective correction function of each detection box; The speed determination module is used to determine the dynamic threshold corresponding to each target based on the region where each target is located in the current video frame, and to determine whether the corrected speed of each target exceeds the dynamic threshold. The running alarm module is used to alarm the target for running behavior when the corrected speed exceeds the dynamic threshold and the action recognition result is running.

[0015] To solve the above-mentioned technical problems, another technical solution adopted in this application is: to provide a computer device, including a memory, a processor and a computer program stored in the memory, characterized in that the processor executes the computer program to implement the steps of the above-mentioned adaptive scene running behavior detection method.

[0016] To solve the above-mentioned technical problems, another technical solution adopted in this application is: to provide a storage medium on which a computer program is stored, characterized in that the computer program, when executed by a processor, implements the steps of the above-mentioned adaptive scene running behavior detection method.

[0017] The beneficial effects of this application are as follows: Unlike existing technologies, this application discloses an adaptive scene running behavior detection method, apparatus, device, and storage medium. This method performs real-time target detection on a video stream, obtains detection boxes for each target, calculates the speed of each target based on the inter-frame displacement of the detection boxes, and corrects the target speed by adding a perspective correction function to avoid speed distortion and improve the comparability of speeds at different locations. By dividing the video frame into multiple regions and setting dynamic thresholds for each, the dynamic thresholds can be dynamically adjusted according to different crowd flow scenarios and densities, exhibiting stronger adaptability than fixed thresholds and adaptively detecting anomalies in different regions, reducing the workload of threshold customization. After comparing the corrected target speed with the corresponding dynamic threshold for speed detection, action recognition is added for further filtering, achieving a balance between detection efficiency and accuracy. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort, wherein: Figure 1 This is a flowchart illustrating an embodiment of the adaptive scene running behavior detection method provided in this application; Figure 2 This is a flowchart illustrating another embodiment of the adaptive scene running behavior detection method provided in this application; Figure 3 This is a schematic diagram of the structure of an embodiment of the adaptive scene running behavior detection device provided in this application; Figure 4 This is a schematic diagram of the structure of an embodiment of the storage medium provided in this application; Figure 5 This is a schematic diagram of the structure of an embodiment of the computer device provided in this application. Detailed Implementation

[0019] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0020] The terms "first," "second," and "third" used in the embodiments of this application are for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first," "second," or "third" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices.

[0021] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a mutually exclusive, independent, or alternative embodiment. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0022] This application provides an adaptive scene running behavior detection method, see reference. Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the adaptive scene running behavior detection method provided in this application. The adaptive scene running behavior detection method includes: S10: Perform target detection on the acquired video stream in real time to obtain the detection box corresponding to each target in the current video frame.

[0023] In this application, the video stream collected can be a video stream from a crowded scene or a sports scene, such as public safety monitoring, smart campus and sports venue management. The shooting equipment used to collect the video stream can be a standard surveillance camera, infrared camera, panoramic camera and wearable camera, etc., which can capture pedestrian behavior information. In this application, a standard surveillance camera fixed in a certain place is used as an example for illustration.

[0024] The system acquires video streams captured in real-time by a camera and performs object detection on the video stream in real-time, targeting "pedestrians" in the footage. It then performs object tracking on the detected targets. Object detection refers to the technique of automatically identifying targets of interest, such as pedestrians, in video frames and outputting the bounding box position and category of the target. Object tracking refers to consistently identifying detected targets across video frames, obtaining a unique target identifier (ID) and trajectory for each target across frames.

[0025] Specifically, a lightweight YOLO model can be used for object detection in video streams. Each time object detection is performed on a video frame, each object in the current frame is bounded by a detection box, resulting in the corresponding detection box for each object in the current frame. Furthermore, a multi-object tracking algorithm is used to assign a target identifier (target ID) to targets that appear for the first time in the video stream, enabling continued tracking of targets with assigned identifiers in subsequent video frames. The lightweight YOLO model includes models such as YOLOv5n, YOLOv8n, and YOLOv10n, while the multi-object tracking algorithm includes algorithms such as SORT, DeepSORT, and BoT-SORT. These two methods can be flexibly combined according to actual application requirements to achieve object detection and tracking; no specific limitations are specified here.

[0026] In this application, after obtaining the detection bounding boxes corresponding to each target in the current video frame, the method further includes: Assign a target identifier to each target, and cache the detection box to the first queue corresponding to the target identifier based on the target identifier.

[0027] Each target detected and tracked in the video stream is assigned a unique target identifier. A target identifier dictionary can be created to store and manage these identifiers. For example, in the video frame where pedestrian A first appears, a target identifier 001 is assigned to its detection box, and a first queue is created for target identifier 001. In subsequent video frames where pedestrian A appears, the target identifier corresponding to its detection box remains unchanged at 001. During the detection process in the video stream, each time a detection box with target identifier 001 is obtained, the image at that detection box is cropped and cached in the first queue corresponding to target identifier 001.

[0028] The first queue is a fixed-length queue that stores image sequences corresponding to the same target identifier. When the queue buffer is full, whenever a new image is added to the end of the queue, the image at the front of the queue will be automatically cleared from the buffer. The length of the first queue is set to at least the length of the sequence input to the action recognition model. For example, if the action recognition model requires at least 16 frames of image sequences for action recognition, the length of the first queue can be set to 16, 17, or 18 frames, etc., without specific limitations here.

[0029] S20: Determine the correction speed for each target based on the inter-frame displacement and perspective correction function of each detection box.

[0030] In this application, the correction speed of each target is determined based on the inter-frame displacement and perspective correction function of each detection box, including: The original velocity of each target is determined based on the time difference between the current video frame and the video frame with a preset number of previous frames and the displacement of the detection box. The original velocity of each target is corrected based on the perspective correction function to determine the corrected velocity of each target; The perspective correction function is: , formula 1; in, To correct the speed; y is the original velocity; y is the ordinate of the detection box in the current video frame; a, b, and c are all fitting parameters.

[0031] In this application, for each target in the current video frame, the current original velocity of each target can be obtained by the displacement of the corresponding detection box of each target between the current video frame and the video frames with a preset number of frames in between. The preset number of frames is the number of frames between the current video frame and the previous video frame it is comparing with. For example, if the preset number of frames is 0, then the detection boxes of the same target in the current video frame (the 5th frame in the video stream) are compared with those in the previous video frame (the 4th frame in the video stream). Or, if the preset number of frames is 2, then the detection boxes of the same target in the current video frame (the 5th frame in the video stream) are compared with those in the video frame with a two-frame interval in between (the 2nd frame in the video stream).

[0032] The inter-frame displacement of the detection box refers to the displacement of the detection box corresponding to the same target between the current video frame and the video frame with a preset number of frames in between. The position of the detection box is based on the coordinates of the center point of the detection box, so the displacement of the detection box can be converted into the displacement of the center point coordinates of the detection box.

[0033] The time difference between the current video frame and the previous video frame with a preset interval, i.e. the time interval between two video frames, can be calculated using the formula: Time difference (seconds) = Frame difference / Frame rate (FPS). For example, in a 30FPS video stream, the time difference between two consecutive frames is 1 / 30 ≈ 0.033 seconds.

[0034] The original velocity of the target can be obtained by removing the inter-frame bit of the detection box corresponding to the same target and calculating the time difference between two video frames. The original velocity calculation formula is as follows: , formula 3; in, This is the original speed; Let J represent the coordinates of the center point of the detection box in frame j. is the coordinate of the center point of the detection box in the i-th frame; ji is the time difference between the two video frames.

[0035] The original speed is obtained by treating all points on the video frame as the same plane. It does not take into account the difference in speed measurement caused by perspective distortion at different heights (positions in the vertical axis) of the target in the surveillance video. Therefore, further perspective correction is required.

[0036] Unlike traditional velocity thresholding methods that directly compare the target's velocity in the pixel plane with a fixed threshold, which are susceptible to the influence of camera installation angle and perspective (leading to incomparable velocities between foreground and background) or require precise camera calibration and projection transformation to restore true scale (often difficult to implement in practice), this application provides an adaptive scene running behavior detection method. This method uses a perspective correction function obtained through polynomial fitting to scale the original velocity of targets at different locations, making the velocities of targets at different locations comparable and solving the problem of velocity measurement distortion caused by perspective in the image.

[0037] In this application, multiple targets are tracked in a pre-acquired video stream, and the center ordinate of the detection box of each target and the corresponding original velocity are collected until a second preset number is reached; Based on the second preset number of center ordinates and the corresponding original velocities, the fitting parameters are obtained by fitting a quadratic regression equation to obtain the perspective correction function.

[0038] In this application, a perspective correction function is obtained by pre-collecting the positions and original velocities of multiple targets and fitting them with a quadratic regression equation. Specifically, target detection and tracking are performed on the pre-collected video stream. For each video frame in the video stream, the ordinate y-coordinates of the center points of multiple detection boxes corresponding to multiple targets are collected, and the original velocities corresponding to each target are calculated. Thus, multiple sets (y, ), collect (y, This continues until a second preset number is reached, which is then used for fitting via a quadratic regression equation. Since pedestrian walking speeds typically do not vary significantly, it can be assumed that pedestrian walking speeds are constant. If the value is constant at 1, then Formula 1 above can be transformed into... , will the second preset number (y, Substitute these values ​​into the equation to perform a fitting operation, obtaining the values ​​of the fitting parameters a, b, and c, thus obtaining the perspective correction function. The value of the second preset quantity can be set according to actual fitting requirements, such as 4000, 5000, or 6000, etc., without specific limitations here.

[0039] Since roads in surveillance video are typically horizontal, and perspective distortion occurs at different heights (vertical coordinate positions) of targets due to distance, the aforementioned perspective correction function primarily considers the correction for perspective distortion caused by targets at their vertical coordinate positions. In other embodiments, perspective distortion caused by targets at their horizontal coordinate positions can also be considered. In this case, the horizontal coordinate x of the center of the detection box for each target and its corresponding original velocity can be collected. Until the second preset quantity is reached, through A fitting process is performed to obtain the perspective correction function in the horizontal axis direction. In some other embodiments, the two can be combined to simultaneously correct the perspective distortion generated in the horizontal and vertical axis directions, which will not be elaborated here.

[0040] The original velocities of each target are corrected using the perspective correction formula 1 above to obtain the corrected velocities. Its function is to scale the original velocity so that the velocity measurements of near and far targets are consistent, so as to compare the velocities between targets at different locations.

[0041] S30: Based on the location of each target in the current video frame, determine the dynamic threshold corresponding to each target, and determine whether the correction speed of each target exceeds the dynamic threshold.

[0042] In this application, before determining the dynamic threshold corresponding to each target based on the region where each target is located in the current video frame, the process includes: The video stream is divided into several regions, a second queue is assigned to each region, and all corrected speeds in each region are collected and cached into the second queue. In response to the number of cached correction speeds in the second queue exceeding the third preset number, a threshold function is constructed by statistically analyzing the speed distribution of each correction speed in the second queue, and the dynamic threshold corresponding to each region is determined.

[0043] The threshold function is: , formula 2; in, The dynamic threshold; The median of all the corrected speeds; is the median absolute deviation of each of the correction speeds; k is a preset parameter, which can take values ​​of 3, 4, or 5, etc., and can be set according to actual needs. The larger the value of k, the larger the dynamic threshold.

[0044] In this application, to further control the impact of perspective distortion on velocity measurement differences, the video stream can be partitioned and thresholds can be set. Specifically, the video stream can be divided into M×N regions, where M and N can be understood as region IDs. For example, when M=3 and N=3, the image is divided into 9 regions, and the ID of each region is (i...M j N ), where i M The value range is {1,2,3}, j N The value range is {1,2,3}. For each region, a sliding window of fixed length (i.e., the second queue) is assigned to it. The correction speed of the target acquired in this region in each video frame is cached in the second queue until the number of cached correction speeds in the second queue exceeds a third preset number. Then, the speed distribution of each correction speed in the second queue is statistically analyzed.

[0045] By partitioning the image into regions and setting individual thresholds for each region, the impact of perspective distortion causing incomparable speeds at different locations can be further reduced. Compared to a global threshold, a regional threshold improves the accuracy of speed detection. Furthermore, the framework for region-based speed detection can be flexibly adjusted to support multiple camera perspectives, enhancing scalability.

[0046] In this application, in response to the number of cached correction speeds in the second queue exceeding a third preset number, the speed distribution of all correction speeds in the second queue is statistically analyzed, the median is taken, and the median absolute deviation (MAD) is calculated based on the median using the following formula 4: , formula 4; in, The median absolute deviation is a metric used in statistics to measure the dispersion or variability of data. The median of all corrected speeds; This represents the absolute value of the difference between each corrected rate and the median. The median is the absolute deviation of the median from the absolute values ​​of the differences between all corrected speeds and the median.

[0047] In this application, the calculated median Substituting the median absolute deviation (MAD) into the threshold function of Formula 2 above, we can obtain the dynamic threshold of each region corresponding to each second queue at the current time.

[0048] Unlike existing technologies that use traditional Z-scores to represent the deviation of a sample from the population mean, which are easily distorted by outliers and difficult to adapt to outlier and crowded scenarios, the adaptive scene running behavior detection method provided in this application uses a more robust median absolute deviation (MAD) to calculate the dynamic threshold. This method can better distinguish between normal and rapid movement. Neither the median nor the MAD is affected by extreme values, providing more reliable and robust judgments and better adapting to outlier and crowded scenarios.

[0049] In this application, after determining the dynamic threshold corresponding to each region, the following is also included: The corrected speed of each target in the current video frame is cached into the corresponding second queue to update the second queue; The median and median absolute deviation of the corrected velocity in the updated second queue are used to update the threshold function, thereby updating the dynamic threshold corresponding to each region.

[0050] In this application, after the dynamic threshold corresponding to each region is calculated for the first time, when video frames are subsequently acquired, the correction speed of the target collected in each region is still cached in the corresponding second queue. The second queue is also a fixed-length queue, and its length can be flexibly set, such as 4000, 5000, or 6000. When the second queue is full, whenever a new correction speed is added to the end of the queue, the correction speed at the head of the queue will be automatically cleared from the cache.

[0051] With the existing dynamic threshold in place, each subsequent update of the second queue will recalculate the median based on all the correction rates cached in the second queue. The median absolute deviation (MAD) and the newly obtained median and median absolute deviation are substituted into Formula 2 above to update the dynamic threshold, which is that the dynamic threshold changes dynamically with the detection of new video frames.

[0052] This can be understood as follows: when the corresponding corrected speed is calculated for each target in the current video frame, these corrected speeds are added to the corresponding second queue to update the dynamic threshold, and then the updated dynamic threshold is compared with each corrected speed in the current video frame.

[0053] Unlike global fixed-threshold speed detection methods that directly compare the target's motion speed in the pixel plane with a fixed threshold, this method addresses the issue of manually customizing the threshold for different scenes and shooting angles, and the inability of fixed thresholds to adapt to various scenarios. The adaptive scene running behavior detection method provided in this application divides the image into regions and sets a dynamic threshold for each region. This dynamic threshold is adaptively updated based on the target speed in the current detection frame, enabling dynamic threshold adjustment according to different crowd flow and density scenarios. This results in strong scene adaptability, reduces the workload of manually customizing thresholds, and allows for more reasonable threshold settings, thus improving the accuracy of speed detection.

[0054] In each region, if the correction speed of a target in that region does not exceed the dynamic threshold of that region, it is considered that the target has not engaged in running behavior, and no action is taken on the target. If the correction speed of a target in that region exceeds the dynamic threshold of that region, it is considered that the target is suspected of engaging in running behavior at the current moment, and the target can be marked as "suspected running".

[0055] In this application, in response to the correction speed exceeding the dynamic threshold and the number of detection boxes cached in the first queue reaching the first preset number, the first preset number of detection boxes in the first queue are input into the action recognition model to obtain the action recognition result.

[0056] Action recognition models (or temporal behavior recognition models) are deep learning models that identify human actions or behaviors in video sequences. Their core idea is to simultaneously consider spatial information (image features of each frame) and temporal information (dynamic changes between frames) to recognize actions. Action recognition models include I3D, Two-Stream, R(2+1)D, etc., and can be flexibly selected according to actual application needs; no specific limitations are made here.

[0057] For a target marked as "suspected running," when the number of detection boxes cached in its corresponding first queue reaches a first preset number, the first preset number of detection box image sequences cached in the first queue are obtained according to the target identifier. These first preset number of detection box image sequences are then input into the action recognition model for secondary detection. The first preset number does not exceed the length of the first queue and is set to at least the number of sequences required for the action recognition model to input. For example, if the action recognition model requires at least 16 frames of image sequences for action recognition, the first preset number can be set to 16, 17, or 18 frames, etc., without specific limitations here.

[0058] Unlike existing deep learning-based behavior recognition detection methods that identify "running" through behavior classification models, which require long-term training, have high inference costs, and are prone to misclassifying similar actions such as jumping or walking, this application provides an adaptive scene running behavior detection method. This method combines the efficiency of speed detection with the semantic accuracy of action recognition for a two-stage target detection process. The first stage relies on speed detection to identify targets in a "suspected running" state, while the second stage only requires action recognition for these targets. This significantly reduces computational overhead while maintaining both efficiency and accuracy.

[0059] S40: In response to the correction speed exceeding the dynamic threshold and the action recognition result being running, an alarm is issued for the corresponding target to have running behavior.

[0060] The sequence of detection bounding box images of targets marked as "suspected running" is input into the action recognition model for secondary detection to obtain the action recognition result. If the action recognition result is running, it is determined that the target has engaged in running behavior, and a running alarm can be issued. If the action recognition result is not running, it is considered that the target may have exceeded the dynamic threshold due to jumping or other reasons, and therefore has not actually engaged in running behavior. In this case, the target can be considered to be in a "normal walking" state, and no alarm is required.

[0061] The process of detecting running behavior in the current video frame in steps S10 to S40 can be performed once for each video frame, or once every few video frames. For example, after detecting the current video frame, the current video frame can be detected again after a two-video-frame interval. No specific limitation is made here.

[0062] In some embodiments, the detection bounding box of the target detection can also be visualized and accompanied by information such as the correction speed corresponding to the detection bounding box and the target status label (such as running or walking).

[0063] See Figure 2 , Figure 2 This is a flowchart illustrating another embodiment of the adaptive scene running behavior detection method provided in this application. First, a video stream is acquired and input into a target detection model and a multi-target tracking algorithm to obtain target detection boxes and assign target identifiers. The target identifiers are added to a target identifier dictionary, and a first queue is allocated to cache cropped images of the target detection boxes. For the current video frame and the previous n video frames, the original velocity is calculated based on the inter-frame displacement and frame difference of the detection boxes. Then, determine whether the perspective correction function has been properly fitted. If not, collect the currently obtained raw velocity. Add perspective correction fitting until the original velocity is collected. When the number reaches the second preset number C, the fitting is completed. If the fitting is already complete, the original velocity is adjusted using the perspective correction function obtained from the fitting. Make corrections to obtain the correction speed. Then, based on the location of the detection box in the current video frame, determine the region where the detection box is located (i M j N ), in region (i M j N The corresponding cache correction speed in the second queue And determine the correction speed of the cache in the current second queue. Does it exceed the third preset quantity P? If not, continue collecting and correcting the speed. Until it exceeds the third preset quantity P, if it does, then the correction speed is calculated based on the third preset quantity. The dynamic threshold is obtained from the median and the absolute deviation of the median. Finally, determine the current correction speed. Does it exceed the currently obtained dynamic threshold? If the number of detection box images does not exceed the limit, the target is considered to be walking normally. If the number of detection box images exceeds the limit, the first preset number of detection box image sequences cached in the first queue corresponding to the target are input into the action recognition model. When the action recognition result is "running", an alarm is output; otherwise, it is filtered as "walking".

[0064] This application provides an adaptive scene running behavior detection device, see reference. Figure 3 , Figure 3 This is a schematic diagram of an embodiment of the adaptive scene running behavior detection device provided in this application. The adaptive scene running behavior detection device includes: The target detection module 10 is used to perform target detection on the acquired video stream in real time and obtain the detection box corresponding to each target in the current video frame; The velocity correction module 20 is used to determine the correction velocity of each target based on the inter-frame displacement and perspective correction function of each detection box; The speed determination module 30 is used to determine the dynamic threshold corresponding to each target based on the region where each target is located in the current video frame, and to determine whether the corrected speed of each target exceeds the dynamic threshold. The running alarm module 40 is used to alarm the target for running behavior in response to the correction speed exceeding the dynamic threshold and the action recognition result being running.

[0065] The process of adaptive scene running behavior detection through the interaction between the above modules can be referred to the specific process of steps S10 to S40 of the adaptive scene running behavior detection method. The repeated parts will not be repeated here.

[0066] See Figure 4 , Figure 4 This is a schematic diagram of an embodiment of the storage medium provided in this application.

[0067] The storage medium 400 stores program data 410, which, when executed by the processor, implements, as follows: Figure 1 The steps of the adaptive scene running behavior detection method are described.

[0068] The program data 410 is stored in a storage medium 400 and includes several instructions for causing a network device (which may be a router, personal computer, server, or other network device) or processor to execute all or part of the steps of the methods described in the various embodiments of this application.

[0069] Optionally, the storage medium 400 can be any medium that can store program data, such as a USB flash drive, portable hard drive, read-only memory (ROM), random access memory (RAM), disk, or optical disc.

[0070] See Figure 5 , Figure 5 This is a schematic diagram of the structure of an embodiment of the computer device provided in this application.

[0071] The device 500 includes a processor 520 and a memory 510 connected to each other. The memory 510 stores a computer program. When the processor 520 executes the computer program, it implements the steps of the adaptive scene running behavior detection method described above.

[0072] Unlike existing technologies, this application discloses an adaptive scene running behavior detection method, apparatus, device, and storage medium. This method performs real-time target detection on a video stream, obtaining detection boxes for each target. Based on the inter-frame displacement of the detection boxes, the speed of each target is calculated. A perspective correction function is added to correct the target speed to avoid speed distortion and improve the comparability of speeds at different locations. By dividing the video frame into multiple regions and setting dynamic thresholds for each region, the dynamic thresholds can be dynamically adjusted according to different pedestrian flow scenarios and densities, exhibiting stronger adaptability than fixed thresholds. This allows for adaptive detection of anomalies in different regions, reducing the workload of threshold customization. After comparing the corrected target speed with the corresponding dynamic threshold for speed detection, action recognition is added for further filtering, achieving a balance between detection efficiency and accuracy.

[0073] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on its differences from other embodiments. In particular, the storage medium embodiments and computer device embodiments are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0074] This application can be used in a wide range of general-purpose or special-purpose computing system environments or configurations. For example: personal computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, network PCs, minicomputers, distributed computing environments including any of the above systems or devices, etc.

[0075] In the several embodiments provided in this application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device embodiments described above are merely illustrative; multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed.

[0076] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.

[0077] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0078] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

Claims

1. An adaptive scene running behavior detection method, characterized in that, include: Real-time target detection is performed on the acquired video stream to obtain the detection boxes corresponding to each target in the current video frame; Based on the inter-frame displacement and perspective correction function of each detection box, the correction speed of each target is determined; Based on the location of each target in the current video frame, determine the dynamic threshold corresponding to each target, and determine whether the correction speed of each target exceeds the dynamic threshold; In response to the correction speed exceeding the dynamic threshold and the action recognition result being running, an alarm is issued indicating that the target has engaged in running behavior.

2. The adaptive scene running behavior detection method according to claim 1, characterized in that, After obtaining the detection boxes corresponding to each target in the current video frame, the process further includes: Assign a target identifier to each target, and cache the detection box in the first queue corresponding to the target identifier based on the target identifier; In response to the correction speed exceeding the dynamic threshold and the number of detection boxes cached in the first queue reaching a first preset number, the first preset number of detection boxes in the first queue are input into the action recognition model to obtain the action recognition result.

3. The adaptive scene running behavior detection method according to claim 1, characterized in that, The determination of the correction speed for each target based on the inter-frame displacement and perspective correction function of each detection box includes: Based on the time difference between the current video frame and the video frame with a preset number of previous frames and the displacement of the detection box, the original velocity of each target is determined; The original velocity of each target is corrected based on the perspective correction function to determine the corrected velocity of each target; The perspective correction function is: , Formula 1; in, The corrected speed; y is the original velocity; y is the ordinate of the detection box in the current video frame; a, b, and c are all fitting parameters.

4. The adaptive scene running behavior detection method according to claim 3, characterized in that, include: Track multiple targets in a pre-acquired video stream, and collect the center ordinate of the detection box of each target and the corresponding original velocity until a second preset number is reached; Based on the second preset number of center ordinates and the corresponding original velocities, the fitting parameters are obtained by fitting a quadratic regression equation to obtain the perspective correction function.

5. The adaptive scene running behavior detection method according to claim 1, characterized in that, Before determining the dynamic threshold corresponding to each of the targets based on their location in the current video frame, the process includes: The video stream is divided into several regions, a second queue is allocated to each region, and all the corrected speeds in each region are collected and cached in the second queue. In response to the number of the corrected speeds cached in the second queue exceeding a third preset number, a threshold function is constructed by statistically analyzing the speed distribution of each corrected speed in the second queue, and a dynamic threshold corresponding to each region is determined.

6. The adaptive scene running behavior detection method according to claim 5, characterized in that, The threshold function is: , Formula 2; in, The dynamic threshold; The median of all the corrected speeds; denoted as the median absolute deviation among the various correction speeds; k is a preset parameter.

7. The adaptive scene running behavior detection method according to claim 5, characterized in that, After determining the dynamic threshold corresponding to each of the aforementioned regions, the method further includes: The corrected speed of each target in the current video frame is cached in the corresponding second queue to update the second queue; The threshold function is updated by statistically updating the median and median absolute deviation of the corrected speed in the second queue, so as to update the dynamic threshold corresponding to each region.

8. An adaptive scene running behavior detection device, characterized in that, include: The target detection module is used to perform target detection on the acquired video stream in real time and obtain the detection box corresponding to each target in the current video frame; A velocity correction module is used to determine the correction velocity of each target based on the inter-frame displacement and perspective correction function of each detection box; The speed determination module is used to determine the dynamic threshold corresponding to each target based on the region where each target is located in the current video frame, and to determine whether the corrected speed of each target exceeds the dynamic threshold. The running alarm module is used to alarm the target for running behavior when the corrected speed exceeds the dynamic threshold and the action recognition result is running.

9. A computer device, comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the steps of the adaptive scene running behavior detection method according to any one of claims 1-7.

10. A storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the steps of the adaptive scene running behavior detection method according to any one of claims 1-7.