Pedestrian detection and behavior analysis method, device and computing equipment
By using the YOLOv3-tiny model and IoU method to analyze pedestrian movement trajectories and types, the problem of poor computing power and robustness in traditional pedestrian abnormal behavior detection methods is solved, and efficient and reliable pedestrian detection and behavior analysis are achieved.
Patent Information
- Application Number
- CN202011461853.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-11
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2040-12-11
AI Technical Summary
Traditional pedestrian abnormal behavior detection methods have high requirements on bandwidth and network stability, strong computing power, poor robustness, slow processing speed, difficulty in automatically identifying security threats, and are highly dependent on specific situations.
The YOLOv3-tiny model is used to detect pedestrian objects in the video stream, filter non-pedestrian objects, analyze pedestrian movement trajectories and types, use the IoU method to obtain uniquely identified pedestrians, and determine the movement type through shape factors and equivalent speeds.
It achieves a balance between speed and accuracy in pedestrian detection and behavior analysis, improves robustness and objectivity, and is more efficient and reliable than traditional human operations.
Smart Images

Figure CN112613365B
Abstract
Description
Technical Field
[0001] The present application relates to image processing, and in particular to abnormal behavior detection technology for pedestrians in surveillance videos. Background Art
[0002] The traditional method of detecting abnormal pedestrian behavior is to obtain video streams from surveillance and analyze, process and classify them in real time. This method has high requirements on bandwidth and network stability and requires strong computing power. If it is done manually by operators, such real-time processing is a time-consuming and tedious task, and this method has poor robustness and slow processing speed. In addition, the range of security threats is wide and highly dependent on specific situations in the real world, which makes it more difficult to automatically identify security threats. Summary of the invention
[0003] The purpose of this application is to overcome the above problems or at least partially solve or alleviate the above problems.
[0004] According to one aspect of the present application, a pedestrian detection and behavior analysis method is provided, the method comprising:
[0005] Read images from video stream;
[0006] Extracting the ROI of the image and detecting objects in the ROI using the YOLOv3-tiny model;
[0007] Filter out non-pedestrian objects among the detected objects;
[0008] Analyze the type of pedestrian motion trajectory based on pedestrian objects in a number of consecutive frames of images;
[0009] The motion type of pedestrians is analyzed based on pedestrian objects in several consecutive frames of images.
[0010] Optionally, after filtering out non-pedestrian objects from the detected objects, the method further includes:
[0011] The IoU method is used to obtain uniquely identified pedestrians.
[0012] Optionally, the type of analyzing the pedestrian motion trajectory based on the pedestrian object in a plurality of consecutive frames of images includes:
[0013] Calculating a shape factor of the trajectory of the pedestrian according to the center position of the pedestrian in a plurality of consecutive frames of images;
[0014] When the value of the shape factor is 1, the type of the pedestrian motion trajectory is a linear trajectory, otherwise, the type of the pedestrian motion trajectory is a nonlinear trajectory.
[0015] Optionally, the movement types of the pedestrian include standing, walking and running.
[0016] According to another aspect of the present application, a pedestrian detection and behavior analysis device is provided, the device comprising:
[0017] A reading module configured to read images from a video stream;
[0018] A detection module configured to extract a ROI of the image and detect an object in the ROI using a YOLOv3-tiny model;
[0019] a filtering module configured to filter out non-pedestrian objects from the detected objects;
[0020] A first analysis module configured to analyze the type of pedestrian motion trajectory based on pedestrian objects in a plurality of consecutive frames of images; and
[0021] The second analysis module is configured to analyze the movement type of the pedestrian based on the pedestrian object in a plurality of consecutive frames of images.
[0022] Optionally, the device further comprises:
[0023] The IoU module is configured to adopt the IoU method to obtain uniquely identified pedestrians.
[0024] Optionally, the first analysis module includes:
[0025] a shape factor calculation submodule, configured to calculate a shape factor of the trajectory of the pedestrian according to the center position of the pedestrian in a plurality of consecutive frame images; and
[0026] The trajectory type confirmation submodule is configured such that when the value of the shape factor is 1, the type of the pedestrian motion trajectory is a linear trajectory; otherwise, the type of the pedestrian motion trajectory is a non-linear trajectory.
[0027] Optionally, the movement types of the pedestrian include standing, walking and running.
[0028] According to a third aspect of the present application, a computing device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein the processor implements the method described in the present application when executing the computer program.
[0029] The pedestrian detection and behavior analysis method, device and computing equipment of the present application, due to the use of the YOLOv3-tiny model, can well balance speed and accuracy. Compared with traditional manual operations, it is more objective and more robust.
[0030] Based on the detailed description of the specific embodiments of the present application in combination with the accompanying drawings below, those skilled in the art will become more aware of the above and other objects, advantages and features of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Hereinafter, some specific embodiments of the present application will be described in detail in an exemplary and non-limiting manner with reference to the accompanying drawings. The same reference numerals in the accompanying drawings indicate the same or similar components or parts. It should be understood by those skilled in the art that these drawings are not necessarily drawn to scale. In the accompanying drawings:
[0032] Figure 1 is a schematic flow chart of a pedestrian detection and behavior analysis method according to an embodiment of the present application;
[0033] Figure 2 is a structural schematic diagram of a pedestrian detection and behavior analysis device according to an embodiment of the present application;
[0034] Figure 3 is a schematic diagram of a computing device according to an embodiment of the present application;
[0035] Figure 4 It is a structural schematic diagram of a computer-readable storage medium according to an embodiment of the present application. DETAILED DESCRIPTION
[0036] When a surveillance system is to be installed in a new location, an initial setup must be performed, the most important of which is to define a rectangular region of interest in the entire video scene. In addition, some algorithm parameters and thresholds need to be initialized with appropriate values.
[0037] After the initialization settings are completed, the steps of implementing a pedestrian detection and behavior analysis method of an embodiment of the present application are started.
[0038] Figure 1 1 is a schematic flow chart of a pedestrian detection and behavior analysis method according to an embodiment of the present application. The pedestrian detection and behavior analysis method may generally include the following steps S1 to S5.
[0039] Step S1, reading video stream images.
[0040] The video stream comes from a surveillance camera. A pedestrian detection and behavior analysis method of this embodiment first needs to read the video stream at a certain frame step, and the frame step size depends on the video frame rate. If the frame rate is high, as long as the change of the pedestrian position / action between consecutive frames is not obvious, some frames can be ignored. Therefore, as long as the change of the pedestrian position / action between two adjacent frames in a set of video stream images read is relatively obvious, it will be sufficient.
[0041] Step S2: extract the ROI of the image, and use the YOLOv3-tiny model to detect objects in the ROI.
[0042] The read image is processed starting from step S2, and the processing process is continuously performed in an infinite loop.
[0043] Starting from the first frame of the image read, the region of interest (ROI) of the image is extracted and passed to YOLO for object detection. The image is divided into grid-like cells. For each object presented on the image, if its center falls into a grid cell, then the grid cell is responsible for detecting the object. For each detected object, YOLO defines a bounding box and returns a prediction vector.
[0044] Step S3: Filter the objects detected from the prediction vector so that only pedestrians are retained. If no pedestrians are detected, the current frame is abandoned and the process returns to step S1 to read the next video frame.
[0045] Step S4: Since the same pedestrian may be misdetected or detected multiple times, the IoU method is used for the image where the pedestrian is detected to obtain a uniquely identified pedestrian.
[0046] Step S5: Analyze the type of pedestrian motion trajectory based on pedestrian objects in a plurality of consecutive image frames.
[0047] Trajectory types can be divided into two categories: regular and irregular. To this end, it is necessary to consider the shape factor f of the trajectory type (i.e., the ratio of the sum of the Euclidean distances between the center positions of pedestrians in several consecutive frames registered in the buffer to the Euclidean distance between the center positions of pedestrians in the first and last frames in the buffer). For a perfect linear trajectory, its shape factor is f = 1; if the trajectory is nonlinear, then f>1.
[0048] The specific method to determine the trajectory type is as follows:
[0049] Step S51: First, the center position of the pedestrian in each frame of image needs to be registered;
[0050] Step S52: Then, the shape factor f of the pedestrian's trajectory is calculated according to the center position of the pedestrian in a plurality of consecutive frames of images:
[0051]
[0052] Where l is the buffer length (i.e., the number of frames of image data that the buffer can store), k is the number of processed video stream images, and x is the number of frames of image data that can be stored in the buffer. u,j and u,jThey respectively represent the horizontal and vertical coordinates of the center position of the pedestrian in the j-th frame image that has been processed;
[0053] In order to use the time-shift method of the pedestrian's past and current positions, the coordinates of the center of the bounding box are registered into a buffer with a predefined length l. Once the buffer is full, the oldest data is discarded and the current data is registered. This means that in normal operation (after starting the "transient phase"), the buffer contains the bounding box coordinates from the current frame (i.e., the processed k-th frame) back to the processed (k-l+1)-th frame.
[0054] Step S53, finally judging the shape factor: when the value of the shape factor f is 1, the type of the pedestrian motion trajectory is a linear trajectory, otherwise, the type of the pedestrian motion trajectory is a nonlinear trajectory.
[0055] Step S6: Analyze the motion type of the pedestrian according to the pedestrian objects in a plurality of consecutive frames of images. The motion type includes standing, walking and running. The specific analysis method is as follows:
[0056] The equivalent speed is calculated as the ratio of the sum of the Euclidean distances between all consecutive centers registered in the buffer to the length of the buffer. Then two ratio thresholds are set based on experience, and the motion type is determined based on the calculated ratio and the two thresholds.
[0057] For each processed video frame, the trajectory features are updated according to the trajectory type and motion type and can be used for further decision making to evaluate pedestrian behavior.
[0058] A pedestrian detection and behavior analysis method of this embodiment can use the YOLOv3-tiny model, which takes advantage of deep learning technology in the pedestrian detection stage to ensure a good balance between speed and accuracy. Geometric transformation and distance measurement are used in the current video frame and the past few frames to describe pedestrian behavior based on trajectory type and speed, which is more objective and more robust than traditional manual operations. The application of the above method can be implemented in Python, so it can run on all major computer platforms without modification, thus having the advantage of portability.
[0059] Figure 2 1 is a schematic diagram of a pedestrian detection and behavior analysis device according to an embodiment of the present application. The pedestrian detection and behavior analysis device may generally include:
[0060] A reading module 1, which is configured to read images of a video stream;
[0061] A detection module 2, configured to extract a ROI of the image and detect an object in the ROI using YOLO;
[0062] A filtering module 3, configured to filter out non-pedestrian objects from the detected objects;
[0063] A first analysis module 5, which is configured to analyze the type of pedestrian motion trajectory according to pedestrian objects in a plurality of consecutive frames of images; and
[0064] The second analysis module 6 is configured to analyze the movement type of the pedestrian based on the pedestrian objects in a plurality of consecutive frames of images.
[0065] As a preferred embodiment of the present application, the device further includes:
[0066] The IoU module 4 is configured to adopt the IoU method to obtain uniquely identified pedestrians.
[0067] As a preferred embodiment of the present application, the first analysis module 5 includes:
[0068] a shape factor calculation submodule 51, configured to calculate a shape factor f of the trajectory of the pedestrian according to the center position of the pedestrian in a plurality of consecutive frames of images, wherein the shape factor f is a ratio of the sum of the Euclidean distances between the center positions of the pedestrian in a plurality of consecutive frames of images registered in the buffer and the Euclidean distance between the center positions of the pedestrian in the first frame and the last frame in the buffer; and
[0069] The trajectory type confirmation submodule 52 is configured to determine that when the value of the shape factor is 1, the type of the pedestrian motion trajectory is a linear trajectory; otherwise, the type of the pedestrian motion trajectory is a non-linear trajectory.
[0070] As a preferred embodiment of the present application, the movement types of the pedestrian include standing, walking and running;
[0071] Furthermore, the second analysis module 6 includes:
[0072] A calculation submodule 61, configured to calculate an equivalent speed of a pedestrian, wherein the equivalent speed is a ratio of a sum of Euclidean distances between centers of pedestrian objects in a plurality of consecutive frame images registered in a buffer to a length of the buffer; and
[0073] The motion type determination submodule 62 is configured to determine the motion type according to the calculated ratio.
[0074] The pedestrian detection and behavior analysis device of the embodiment of the present application can execute the steps of the pedestrian detection and behavior analysis method of the embodiment of the present application, and its principles and effects are not repeated here.
[0075] The present application also provides a computing device, referring to Figure 3The computing device includes a memory 1120, a processor 1110, and a computer program stored in the memory 1120 and executable by the processor 1110. The computer program is stored in a space 1130 for program code in the memory 1120. When the computer program is executed by the processor 1110, it is implemented to execute any one of the method steps 1131 according to the present invention.
[0076] The present application also provides a computer-readable storage medium. Figure 4 The computer-readable storage medium comprises a storage unit for program code, the storage unit being provided with a program 1131 ′ for executing the method steps according to the present invention, the program being executed by a processor.
[0077] The embodiment of the present application further provides a computer program product including instructions. When the computer program product is run on a computer, the computer is caused to execute the method steps according to the present invention.
[0078] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer loads and executes the computer program instructions, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integration. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
[0079] The professionals should also be further aware that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0080] A person skilled in the art can understand that all or part of the steps in the above-mentioned embodiment method can be completed by instructing a processor through a program, and the program can be stored in a computer-readable storage medium, and the storage medium is a non-transitory medium, such as a random access memory, a read-only memory, a flash memory, a hard disk, a solid-state drive, a magnetic tape, a floppy disk, an optical disc, and any combination thereof.
[0081] The above is only a preferred specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A pedestrian detection and behavior analysis method, comprising: Read images from video stream; Extracting the ROI of the image and detecting objects in the ROI using the YOLOv3-tiny model; Filter out non-pedestrian objects among the detected objects; Analyzing the type of pedestrian motion trajectory according to pedestrian objects in a plurality of consecutive frame images, including: calculating a shape factor f of the pedestrian trajectory according to the center position of the pedestrian in a plurality of consecutive frame images, wherein the shape factor f is a ratio of the sum of the Euclidean distances between the center positions of the pedestrians in a plurality of consecutive frame images registered in a buffer and the Euclidean distance between the center positions of the pedestrians in the first frame and the last frame in the buffer; when the value of the shape factor is 1, the type of the pedestrian motion trajectory is a linear trajectory, otherwise, the type of the pedestrian motion trajectory is a nonlinear trajectory; The motion type of pedestrians is analyzed based on pedestrian objects in several consecutive frames of images.
2. The method according to claim 1, characterized in that After filtering out non-pedestrian objects from the detected objects, the method further includes: The IoU method is used to obtain uniquely identified pedestrians.
3. The method according to claim 1, characterized in that The movement types of the pedestrians include standing, walking and running.
4. The method according to claim 3, characterized in that Analyzing the motion type of pedestrians according to pedestrian objects in a plurality of consecutive frames of images includes: Calculating the equivalent speed of pedestrians, where the equivalent speed is the ratio of the sum of the Euclidean distances between the centers of pedestrian objects in a plurality of consecutive frames of images registered in the buffer to the length of the buffer; The type of movement is determined based on the calculated ratio.
5. A pedestrian detection and behavior analysis device, comprising: A reading module configured to read images from a video stream; A detection module configured to extract a ROI of the image and detect an object in the ROI using a YOLOv3-tiny model; a filtering module configured to filter out non-pedestrian objects from the detected objects; A first analysis module is configured to analyze the type of pedestrian motion trajectory according to pedestrian objects in a plurality of consecutive frame images, including: calculating a shape factor f of the pedestrian trajectory according to the center position of the pedestrian in a plurality of consecutive frame images, wherein the shape factor f is a ratio of the sum of the Euclidean distances between the center positions of the pedestrians in a plurality of consecutive frame images registered in a buffer and the Euclidean distance between the center positions of the pedestrians in the first frame and the last frame in the buffer; when the value of the shape factor is 1, the type of the pedestrian motion trajectory is a linear trajectory, otherwise, the type of the pedestrian motion trajectory is a nonlinear trajectory; and The second analysis module is configured to analyze the movement type of the pedestrian based on the pedestrian object in a plurality of consecutive frames of images.
6. The device according to claim 5, characterized in that Also includes: The IoU module is configured to adopt the IoU method to obtain uniquely identified pedestrians.
7. The device according to claim 5, characterized in that The types of movement of the pedestrians include standing, walking and running; The second analysis module comprises: A calculation submodule configured to calculate an equivalent speed of a pedestrian, wherein the equivalent speed is a ratio of a sum of Euclidean distances between centers of pedestrian objects in a plurality of consecutive frame images registered in a buffer to a length of the buffer; and The motion type determination submodule is configured to determine the motion type according to the calculated ratio.
8. A computing device comprising a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Speed activated time delay system
CA2232739A1
Morphogenetic modelling of in-flight icing
CA2430823A1
Pedestrian event detection method based on shape features and trajectory analysis
CN103324913A
Unmanned aerial vehicle man-machine interaction method based on three-dimensional continuous gesture recognition
CN105807926A
Human body emotion judgment method based on bracelet
CN106510658A
