A method, device, equipment and medium for detecting a human flow channel trajectory

CN121482096BActive Publication Date: 2026-09-18ZKTECO CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202511644322.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-11
Publication Date
2026-09-18
Estimated Expiration
2045-11-11

AI Technical Summary

Technical Problem

[0005]本发明提供了一种人流通道轨迹的检测方法、装置、设备和介质,解决了当前主流人流通道轨迹的检测依赖深度学习方法对视频帧逐像素分析,虽能实现基础检测,但通常依赖于模型训练和大量计算,且对环境敏感性强,难以在降低计算量的同时满足准确性与鲁棒性要求的技术问题

Benefits of technology

[0051]Upon receiving raw video data, the system performs frame-by-frame target tracking, generating a sequence of raw trajectory points for each moving target. A region image is created according to the view size of the raw video data, and multiple candidate regions are extracted from this image. Based on the overlap between each raw trajectory point sequence and the candidate regions, the number of relevant sequences and target trajectory points for each candidate region are determined, and an initial interval corresponding to the target trajectory points is constructed. After merging the initial intervals that match the merging conditions, target intervals are filtered according to the number of merging operations. Based on the number of relevant sequences and the interval length corresponding to the target interval, the target pedestrian flow channel area is selected from the multiple candidate regions, and a channel trajectory marker line is generated and output. This approach expands discrete trajectory points into continuous intervals for trajectory detection, effectively meeting accuracy and robustness requirements while reducing the computational load of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121482096B_ABST
    Figure CN121482096B_ABST
Patent Text Reader

Abstract

A human flow channel track detection method, device, equipment and medium are disclosed, original video data is frame by frame target tracking, original track point sequences of each moving target are generated; a region image is created according to the view size of the original video data, and a plurality of candidate regions are extracted from the region image; according to the overlapping condition of each original track point sequence and the candidate region, the number of related sequences and target track points corresponding to each candidate region are determined, and the initial interval corresponding to the target track point is constructed; after merging the initial interval of the matching merging condition, the target interval is screened according to the merging number; according to the interval length corresponding to each related sequence number and the target interval, the target human flow channel region is selected from the plurality of candidate regions, and a channel track identification line is generated and output. Thus, the discrete track points are expanded into continuous intervals for track detection, while reducing the amount of calculation processed by the model, effectively meeting the accuracy and robustness requirements.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of trajectory detection technology, and in particular to a method, apparatus, equipment and medium for detecting the trajectory of pedestrian flow channels. Background Technology

[0002] In fields such as intelligent security, smart retail, and public safety management, the application value of crowd movement pattern analysis covers public services and governance. In smart retail, identifying customer walking routes can optimize shelf layout and improve operational efficiency; in transportation hubs, analyzing pedestrian flow direction can help guide customer flow and prevent congestion.

[0003] As various fields demand higher precision and real-time performance in analyzing crowd movement patterns, the detection of pedestrian flow trajectories, as a core component, significantly impacts the reliability of analysis results due to its technical performance. In practical applications, detection must handle complex environments (changing lighting, occlusion), massive amounts of video data, and cross-scene adaptation requirements.

[0004] Current mainstream methods for detecting pedestrian flow trajectories rely on deep learning to analyze video frames pixel by pixel. While this can achieve basic detection, it typically depends on model training and a large amount of computation. Furthermore, it is highly sensitive to environmental factors, making it difficult to meet the requirements of accuracy and robustness while reducing computational load. Summary of the Invention

[0005] This invention provides a method, apparatus, device, and medium for detecting pedestrian flow trajectory. It solves the technical problem that current mainstream pedestrian flow trajectory detection relies on deep learning methods to analyze video frames pixel by pixel. Although it can achieve basic detection, it usually depends on model training and a large amount of computation, and is highly sensitive to the environment. It is difficult to meet the requirements of accuracy and robustness while reducing the amount of computation.

[0006] The first aspect of this invention provides a method for detecting the trajectory of pedestrian flow, comprising:

[0007] When the raw video data is received, the raw video data is subjected to frame-by-frame target tracking to generate a sequence of original trajectory points corresponding to each moving target.

[0008] A region image is created according to the view size of the original video data, and multiple candidate regions are extracted by sliding from the region image;

[0009] Based on the overlap between each original trajectory point sequence and the candidate region, determine the number of related sequences and the target trajectory point corresponding to each candidate region, and construct the initial interval corresponding to the target trajectory point;

[0010] After merging the initial intervals that match the merging criteria, filter the target intervals according to the number of mergings;

[0011] Based on the number of each relevant sequence and the interval length corresponding to the target interval, a target pedestrian flow channel area is selected from multiple candidate areas, and a channel trajectory marker line is generated and output.

[0012] Optionally, the step of performing frame-by-frame target tracking on the original video data when the original video data is received, and generating a sequence of original trajectory points corresponding to each moving target, includes:

[0013] When the raw video data is received, the raw video data is split into multiple video images;

[0014] For each moving target within each frame of the video image, target detection is performed to determine the motion position point of each moving target in the video image;

[0015] Associating all the moving position points with the moving target respectively, generating the original trajectory point sequence corresponding to each moving target.

[0016] Optionally, the step of creating a region image according to the view size of the original video data and sliding to extract multiple candidate regions from the region image includes:

[0017] Create a region image according to the view size of the original video data;

[0018] Calculate the sliding window parameters based on the view dimensions and current device performance parameters;

[0019] Create a sliding window according to the extension direction of the original trajectory point sequence and the sliding window parameters;

[0020] Multiple candidate regions are extracted from the region image by sliding the sliding window with a fixed step size.

[0021] Optionally, the step of determining the number of relevant sequences and target trajectory points corresponding to each candidate region based on the overlap between each original trajectory point sequence and the candidate region, and constructing the initial interval corresponding to the target trajectory point, includes:

[0022] Traverse the original trajectory point sequence and determine whether any original trajectory point in each original trajectory point sequence is located in any of the candidate regions;

[0023] If so, the original trajectory point sequence to which the original trajectory point belongs is determined as the relevant trajectory point sequence corresponding to the candidate region;

[0024] Count the number of relevant sequences corresponding to each candidate region;

[0025] Select any target trajectory point that overlaps with each of the aforementioned relevant trajectory point sequences and each of the aforementioned candidate regions;

[0026] An initial interval conforming to a preset interval size is generated, with each target trajectory point as the center.

[0027] Optionally, the step of filtering target intervals according to the number of merges after merging the initial intervals that match the merging conditions includes:

[0028] Traverse the initial intervals and merge the initial intervals that match the merging conditions to obtain multiple independent intervals; the merging conditions are that there are adjacent or overlapping pairs of the initial intervals.

[0029] Count the number of merges corresponding to each independent interval;

[0030] By filtering out independent intervals with fewer than the average number of merges, multiple target intervals are obtained.

[0031] Optionally, the step of selecting a target pedestrian flow channel area from multiple candidate areas based on the number of each of the relevant sequences and the interval length corresponding to the target interval, and generating a channel trajectory marker line output, includes:

[0032] Calculate the sum of the interval lengths of all target intervals within each candidate region to obtain the total coverage length corresponding to each candidate region;

[0033] The ratio between the number of each relevant sequence and the total coverage length is calculated to obtain the trajectory point density of each candidate region;

[0034] The candidate region corresponding to the highest trajectory point density is selected as the target pedestrian flow channel region;

[0035] Generate and output the channel trajectory marking lines in the target pedestrian channel area.

[0036] Optionally, the step of generating and outputting the channel trajectory marking line in the target pedestrian channel area includes:

[0037] Select the minimum and maximum axial coordinates of the target interval within the target pedestrian flow channel area;

[0038] Calculate the coordinate difference between the maximum axial coordinate and the minimum axial coordinate, and calculate the ratio between the coordinate difference and the preset interval size to obtain the offset coordinate;

[0039] The difference between the minimum axial coordinate and the offset coordinate is calculated as the starting coordinate;

[0040] The sum of the maximum axial coordinate and the offset coordinate is used as the endpoint coordinate;

[0041] At the centerline position of the target pedestrian flow channel area, generate and output a channel trajectory marker line extending from the starting point coordinates to the ending point coordinates.

[0042] A second aspect of the present invention provides a device for detecting the trajectory of pedestrian flow, comprising:

[0043] The trajectory generation module is used to perform frame-by-frame target tracking on the received raw video data and generate a sequence of original trajectory points corresponding to each moving target.

[0044] The region extraction module is used to create a region image according to the view size of the original video data, and to slide and extract multiple candidate regions from the region image;

[0045] The interval construction module is used to determine the number of related sequences and target trajectory points corresponding to each candidate region based on the overlap between each original trajectory point sequence and the candidate region, and to construct the initial interval corresponding to the target trajectory point;

[0046] The interval merging module is used to merge initial intervals that match the merging conditions and then filter target intervals according to the number of merging operations.

[0047] The trajectory identifier generation module is used to select a target pedestrian flow channel area from multiple candidate areas based on the number of each related sequence and the length of the target interval, and generate a channel trajectory identifier line output.

[0048] A third aspect of the present invention provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of the method for detecting the trajectory of a pedestrian flow channel as described in any one of the first aspects of the present invention.

[0049] A fourth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed, implements the method for detecting the trajectory of a pedestrian flow channel as described in any of the first aspects of the present invention.

[0050] As can be seen from the above technical solutions, the present invention has the following advantages:

[0051] Upon receiving raw video data, the system performs frame-by-frame target tracking, generating a sequence of raw trajectory points for each moving target. A region image is created according to the view size of the raw video data, and multiple candidate regions are extracted from this image. Based on the overlap between each raw trajectory point sequence and the candidate regions, the number of relevant sequences and target trajectory points for each candidate region are determined, and an initial interval corresponding to the target trajectory points is constructed. After merging the initial intervals that match the merging conditions, target intervals are filtered according to the number of merging operations. Based on the number of relevant sequences and the interval length corresponding to the target interval, the target pedestrian flow channel area is selected from the multiple candidate regions, and a channel trajectory marker line is generated and output. This approach expands discrete trajectory points into continuous intervals for trajectory detection, effectively meeting accuracy and robustness requirements while reducing the computational load of the model. Attached Figure Description

[0052] To more clearly illustrate the technical solutions in the embodiments of the present invention 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 the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0053] Figure 1 A flowchart illustrating the steps of a method for detecting pedestrian flow trajectory according to an embodiment of the present invention;

[0054] Figure 2 This is a structural block diagram of a pedestrian flow channel trajectory detection device provided in an embodiment of the present invention. Detailed Implementation

[0055] This invention provides a method, apparatus, device, and medium for detecting pedestrian flow trajectories, which addresses the current mainstream method of detecting pedestrian flow trajectories by relying on deep learning methods to analyze video frames pixel by pixel. Although this method can achieve basic detection, it usually depends on model training and a large amount of computation, and is highly sensitive to the environment, making it difficult to meet the requirements of accuracy and robustness while reducing the amount of computation.

[0056] To make the objectives, features, and advantages of this invention more apparent and understandable, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described below are only some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.

[0057] Please see Figure 1 , Figure 1 The flowchart illustrates the steps of a method for detecting pedestrian flow trajectory according to an embodiment of the present invention.

[0058] This invention provides a method for detecting pedestrian flow trajectory, comprising:

[0059] Step 101: When the original video data is received, perform frame-by-frame target tracking on the original video data to generate the original trajectory point sequence corresponding to each moving target.

[0060] Raw video data refers to video data with a fixed image acquisition perspective and fixed screen size over a period of time, which includes at least multiple moving targets, such as pedestrians, vehicles, or other mobile devices.

[0061] The original trajectory point sequence refers to the ordered set of coordinates formed by assigning a unique identifier (ID) to each successfully tracked moving target and recording the spatial position (usually represented by coordinate values ​​in the image coordinate system) of the target in each frame of video image in chronological order. Each coordinate point precisely corresponds to the specific position of the target in a specific frame.

[0062] In this embodiment of the invention, after receiving the raw video data, a target detection algorithm is first used to identify moving targets in each frame of the image. Then, a target tracking algorithm is used to associate the position information of the same target between consecutive frames to ensure the uniqueness of the target's identity and the continuity of tracking, avoiding identity confusion or tracking interruption caused by target occlusion, temporary disappearance, etc. Each successfully tracked moving target is assigned a unique identifier (ID), and the spatial coordinates of the target in each frame of the image (represented by XY coordinates in the image coordinate system) are recorded in chronological order to form the original trajectory point sequence of the target.

[0063] Among them, the target detection algorithm may include, but is not limited to, the YOLO series algorithm based on deep learning, the Faster R-CNN algorithm, etc., and the target tracking algorithm may include, but is not limited to, the Kalman filter algorithm, the Hungarian matching algorithm, etc.

[0064] In one example of the present invention, step 101 may include the following sub-steps:

[0065] When the raw video data is received, it is split into multiple video frames.

[0066] Target detection is performed on each moving target within each frame of video image to determine the motion position point of each moving target in the video image;

[0067] Associate all moving position points with the moving target to generate a sequence of original trajectory points corresponding to each moving target.

[0068] In this embodiment of the invention, upon receiving the original video data, the inherent frame rate of the original video is used as a benchmark to ensure that the resulting multi-frame video images strictly adhere to the temporal continuity of the original video, avoiding temporal sequence disorder (such as dropped frames or misaligned frames) caused by frame rate mismatch. Simultaneously, the split frame images can be preprocessed according to scene requirements (such as size normalization and noise suppression) to eliminate potential transmission noise or shooting interference in the original video data, providing high-quality multi-frame video images for subsequent target detection. Subsequently, target detection is performed on each moving target within each frame of the video image, using algorithms such as the YOLO series based on deep learning, the Faster R-CNN algorithm, or traditional background subtraction combined with morphological processing algorithms. Specifically, moving targets can be distinguished from static backgrounds in frame images based on their visual features (such as contours and dynamic information). For complex scenes (such as sudden changes in lighting, target occlusion, and small targets), multi-scale detection, feature fusion, or contextual information can be introduced to assist in detection, thereby improving the accuracy and robustness of target detection. After detection, the spatial coordinates of each moving target are output based on the image coordinate system (usually with the upper left corner of the image as the origin, the horizontal direction as the X-axis, and the vertical direction as the Y-axis). These coordinates are the moving position points.

[0069] In addition, the validity of the target detection results can be verified to remove falsely detected targets with too small an area and to supplement the position information of partially occluded targets. Finally, by associating all the corresponding motion position points with the identifier of each moving target, a sequence of original trajectory points corresponding to each moving target is generated. Specifically, target association algorithms (such as Kalman filtering, Hungarian matching, DeepSORT, etc.) can be used to match and associate the motion position points of the same moving target in different frames of video images based on the visual features (such as color and shape) and motion features (such as speed and direction) of the moving target. This ensures the uniqueness of each moving target and avoids confusion of position points of different targets. For the interruption of position points caused by the temporary occlusion of the moving target, the missing position points can be filled in by trajectory interpolation (such as linear interpolation and Bézier curve interpolation). For abnormal position points (such as the coordinates of sudden jumps), interference can be eliminated by trajectory smoothing (such as sliding window averaging). Finally, all the motion position points associated with each moving target are arranged in chronological order of video frames to form the original trajectory point sequence track_set unique to the moving target. Each position point in the sequence is accompanied by corresponding timestamp information, which is convenient for subsequent tracking of the target's motion state at a specific time.

[0070] Each moving target within the original trajectory point sequence `track_set` is identified by a unique ID, which corresponds to a trajectory point sequence vector. <pair<int,int> Each point represents the target's coordinates (x, y) in the image.

[0071] In addition, after generating the original trajectory point sequence, for targets with brief interruptions, trajectory completion is performed using interpolation methods, and obviously abnormal trajectories such as sudden jumps or long periods of stillness are removed to ensure the integrity and effectiveness of the original trajectory point sequence.

[0072] Step 102: Create a region image according to the view size of the original video data, and slide to extract multiple candidate regions from the region image;

[0073] View size refers to the specifications of a single frame of video image in the original video data, specifically including the width of the image in the horizontal direction and the height in the vertical direction (usually in pixels).

[0074] A region image refers to a virtual image carrier constructed based on the view size of the original video, which is completely consistent with the spatial range and coordinate system of a single frame image of the original video.

[0075] Candidate regions refer to several sub-regions extracted from the region image by sliding according to preset sliding rules (including sliding direction, sliding step size, and region shape). These sub-regions are potential candidate ranges for pedestrian flow channels. Their number and distribution must completely cover the entire region image to avoid missing any spatial areas where pedestrian flow channels may exist. The region shape can be flexibly adjusted according to the estimated direction of pedestrian flow movement (e.g., horizontal strips for vertical movement and vertical strips for left-right movement).

[0076] In this embodiment, the view size parameters (i.e., horizontal width and vertical height) of the original single-frame image are first extracted. Based on these parameters, a region image is constructed that is completely consistent with the spatial range and coordinate system of the original single-frame image, ensuring that all subsequent operations are performed within the spatial dimension corresponding to the original video. Then, based on the estimated movement direction of people in the scene (such as shopping malls and stations, which are mostly vertical or horizontal), the shape of the candidate region is determined (vertical movement corresponds to horizontal strip regions, and horizontal movement corresponds to vertical strip regions). Sliding rules are set—the sliding direction must match the estimated movement direction of people, and the sliding step size must take into account both detection accuracy and computational efficiency. Sliding operations are performed in the region image according to the preset sliding rules to extract multiple candidate regions.

[0077] Among them, the candidate region must completely cover the entire region image to ensure that no space range where there may be pedestrian passage is missed. At the same time, the size of the candidate region can be finely adjusted according to the aspect ratio of the region image to make the candidate region more in line with the spatial characteristics of the actual scene.

[0078] In one example of the present invention, step 102 may include the following sub-steps:

[0079] Create a region image based on the view dimensions of the original video data;

[0080] Calculate the sliding window parameters based on the view dimensions and current device performance parameters;

[0081] Create a sliding window based on the extension direction and sliding window parameters of the original trajectory point sequence;

[0082] Multiple candidate regions are extracted from the region image by sliding a window with a fixed step size.

[0083] In this embodiment of the invention, a region image is constructed with the width and height parameters of the original single-frame video image as a reference, ensuring that the coordinate system of the region image (such as the origin position and axis direction) remains consistent with the original video image. Furthermore, to address potential edge distortion or noise in the original video image, preprocessing (such as edge correction and noise filtering) can be performed simultaneously during the creation of the region image, improving the spatial accuracy of the region image and providing a high-quality platform for subsequent sliding window operations.

[0084] Then, based on the view size and the current device's performance parameters, the stride parameter of the sliding window is calculated:

[0085] stride = (H + W) / (10 * n)

[0086] Where H is the image height, W is the image width, and n is the number of images processed per second by the algorithm on the current device.

[0087] Next, analyze the overall extension direction of all original trajectory point sequences (e.g., trajectory points mainly extend vertically up and down, or horizontally left and right). Determine the shape of the sliding window based on the extension direction (e.g., vertical extension corresponds to a horizontal strip window, and horizontal extension corresponds to a vertical strip window) to avoid misalignment between the window shape and the trajectory extension direction, which could lead to missed areas of dense trajectory data. Combine the view dimensions to determine the spatial range of the sliding window (e.g., window length and width) to ensure that the window can cover the extension segments of one or more trajectories, while avoiding excessively large windows that would reduce subsequent analysis accuracy, or excessively small windows that would result in too many candidate regions to be extracted. For scenarios with complex trajectory extension directions (e.g., multiple trajectories in different directions), various sliding windows adapted to different extension directions can be created for candidate region extraction. For example, a sliding window that needs to slide along the Y-axis has a window height stride_y = stride / 10 and a window width of W.

[0088] Starting from the edge of the region image (e.g., top left or bottom left corner), the sliding window continuously slides in a fixed step size (e.g., 10 pixels) according to a preset sliding direction (adapted to the trajectory extension direction, e.g., vertical trajectory extension corresponds to up-down sliding, horizontal trajectory extension corresponds to left-right sliding). After each slide, a sub-region of the region image covered by the sliding window is captured as a candidate region. Simultaneously, the spatial coordinate range of each candidate region in the region image (e.g., start and end coordinates) is recorded to facilitate subsequent association with the original trajectory point sequence until the entire region image is completely covered, resulting in multiple candidate regions. For each candidate region, its Y-coordinate range is [y, y + stride_y], and its X-coordinate range is the entire image width [0, W]. This coordinate axis can be created with the bottom left corner of the region image as the origin, the horizontal direction as the x-axis, and the vertical direction as the y-axis.

[0089] Step 103: Based on the overlap between each original trajectory point sequence and the candidate region, determine the number of related sequences and the target trajectory point corresponding to each candidate region, and construct the initial interval corresponding to the target trajectory point;

[0090] The number of relevant sequences refers to the total number of trajectory sequences that, for a single candidate region, contain at least one trajectory point falling within that candidate region among all the original trajectory point sequences. This number directly reflects the density of moving targets within the candidate region.

[0091] The target trajectory point refers to any trajectory point in the original trajectory point sequence that actually falls into the candidate region, such as the first position where the trajectory point enters the candidate region.

[0092] In this embodiment of the invention, for each extracted candidate region, all original trajectory point sequences are traversed one by one to determine whether each trajectory point sequence has at least one trajectory point falling into the candidate region. If so, the trajectory point sequence is determined to be related to the current candidate region and identified as a related trajectory point sequence. The total number of all related trajectory point sequences is counted to obtain the number of related sequences for each candidate region.

[0093] At the same time, iterate through all relevant trajectory point sequences that fall into the current candidate region, and select representative trajectory points as target trajectory points based on actual application requirements. For example, select the first trajectory point in the trajectory point sequence to enter the candidate region, the trajectory point that stays in the candidate region for the longest time, or the trajectory point at the center of the trajectory point sequence in the candidate region, so as to ensure that the target trajectory point can accurately reflect the core position of the target in the candidate region.

[0094] Taking a horizontal strip-shaped candidate region as an example, an initial interval corresponding to a preset interval size is constructed based on the horizontal coordinate (X-axis coordinate) of each target trajectory point. This transforms discrete trajectory points into a continuous spatial range. During the construction process, the interval range needs to be set by considering factors such as the positioning error of the trajectory points and the spatial distance between adjacent trajectory points. This avoids the trajectory point distribution characteristics becoming blurred due to an excessively large interval range, or the intervals becoming too small to be effectively merged later. If the candidate region is a vertical strip-shaped region, an initial interval corresponding to a preset interval size is constructed based on the vertical coordinate (Y-axis coordinate).

[0095] In one example of the present invention, step 103 may include the following sub-steps:

[0096] Traverse the original trajectory point sequence and determine whether any original trajectory point in each original trajectory point sequence is located in any candidate region.

[0097] If so, the original trajectory point sequence to which the original trajectory point belongs is determined as the relevant trajectory point sequence corresponding to the candidate region;

[0098] Count the number of relevant sequences corresponding to each candidate region;

[0099] Select any target trajectory point that overlaps with each candidate region from each relevant trajectory point sequence;

[0100] An initial interval that conforms to the preset interval size is generated, with each target trajectory point as the center.

[0101] In this embodiment, for each candidate region, all original trajectory point sequences are traversed. By comparing the spatial coordinates of each original trajectory point in the original trajectory point sequence with the coordinate range of the candidate region, it is determined whether any original trajectory point in the sequence falls within the current candidate region. If so, the original trajectory point sequence is identified as the relevant trajectory point sequence corresponding to the candidate region, and the association basis (such as the coordinates of the original trajectory point within the region and its frame number) is recorded for subsequent verification and tracing. After determining the relevant trajectory point sequence for the candidate region, the number of relevant trajectory point sequences corresponding to the candidate region is counted as the number of relevant sequences. During the count, duplicates are removed using the unique ID of the trajectory point sequence (to avoid duplicate counting due to the same trajectory entering the region multiple times) to ensure accurate counting.

[0102] For each relevant trajectory point sequence, select the target trajectory point from all original trajectory points that overlap with the current candidate region. For example, select the point where the trajectory first enters the candidate region, which can reflect the initial position of the target entering the region, or select the point where the trajectory stays in the region for the longest time, which can reflect the core activity position of the target in the region.

[0103] Finally, using each target trajectory point as the spatial center, continuous initial intervals are created according to a preset interval size. This transforms discrete trajectory points into continuous intervals, laying the foundation for subsequent interval fusion analysis of trajectory continuity and selection of mainstream motion directions. Simultaneously, the relevant trajectory point sequence IDs corresponding to each initial interval are recorded to facilitate subsequent tracking of interval origins and validity. All initial intervals generated from related trajectories constitute an initial interval set, intervals.

[0104] The preset interval size can be 4. Taking the initial interval in the horizontal direction as an example, its range can be [x-4, x+4].

[0105] Step 104: After merging the initial intervals that match the merging conditions, filter the target intervals according to the number of mergings;

[0106] Merging conditions refer to the preset rules used to determine whether two or more horizontal intervals need to be merged. These include, but are not limited to, the existence of spatial overlap between intervals (i.e., the numerical range of one interval intersects with the numerical range of another interval) or spatial adjacency (i.e., the endpoints of one interval are closely adjacent to the endpoints of another interval without gaps).

[0107] In this embodiment of the invention, for all initial intervals corresponding to each candidate region, the initial intervals are sorted in ascending or descending order according to their starting coordinates and traversed. It is determined whether each initial interval meets a preset merging condition. If so, the corresponding initial intervals are merged. Specifically, the first initial interval is initialized as a temporary merge interval. Then, it is sequentially determined whether each subsequent initial interval and the temporary merge interval meet the merging condition. If so, the current initial interval is merged into the temporary merge interval, and the range of the temporary merge interval is updated, until all initial intervals can no longer be merged, resulting in an independent interval. During the merging process, the number of initial intervals merged into each independent interval is recorded in real time and used as the merging count.

[0108] After merging, calculate the statistical threshold for the number of merges of all large intervals (e.g., calculate the mean of all merges, or use the median as the threshold according to the scenario requirements. The threshold selection should balance robustness and accuracy to ensure that noisy intervals are eliminated without missing valid intervals). Large intervals with a number of merges below the threshold are determined as invalid intervals and eliminated. Large intervals with a number of merges higher than or equal to the threshold are retained as the target intervals of the candidate regions. This screening process effectively removes interference intervals formed by noisy trajectories and occasional non-mainstream trajectories, improving the accuracy of subsequent analysis.

[0109] In one example of the present invention, step 104 may include the following sub-steps:

[0110] Traversing the initial intervals and merging the initial intervals that meet the merging conditions to obtain a plurality of independent intervals; the merging condition is that every two initial intervals are adjacent or overlapping;

[0111] Counting the merging times corresponding to each independent interval;

[0112] Filtering out independent intervals with merging times less than the average merging times to obtain a plurality of target intervals.

[0113] In this embodiment, when traversing all initial intervals, to improve merging efficiency, the initial intervals may be sorted in ascending or descending order according to their starting coordinates (e.g., the starting coordinate on the horizontal X-axis) first, so as to ensure that the intervals are arranged orderly according to spatial positions and avoid repeated judgment or missing merging caused by disordered traversal; then the first initial interval is initialized as a temporary merging interval, and each subsequent initial interval is sequentially subjected to spatial relationship determination with the temporary merging interval. If the two meet the merging condition of "adjacent" or "overlapping", the current initial interval is incorporated into the temporary merging interval, and the spatial range of the temporary merging interval is updated (e.g., taking the minimum starting coordinate of the two intervals as the new starting point and the maximum ending coordinate as the new ending point). After all initial intervals are traversed, a plurality of independent intervals are obtained. Meanwhile, by counting the number of initial intervals incorporated by each independent interval in the merging process, the corresponding merging times of each independent interval are counted. The average value of the merging times is calculated, and independent intervals with merging times less than the average value are filtered out, so as to filter out intervals formed by noise trajectories or sparse trajectories in non-mainstream directions and obtain a plurality of target intervals.

[0114] Generally speaking, the more data in the trackset, the smaller this value. For two trajectory points t1 and t2, if |t1.y-t2.y|<stride_y, and [t1.x-4, t1.x+4] intersects with [t2.x-4, t2.x+4], t1 and t2 can be considered to be in the same channel and merged into the same interval [min(t1.x-4, t2.x-4), max(t1.x+4, t2.x+4)].

[0115] In addition, after obtaining the target intervals, secondary verification can also be performed on the target intervals to check whether the spatial distribution of the target intervals covers the main trajectory concentration area in the candidate region, so as to avoid the mean offset caused by individual abnormal independent intervals and ensure that the target intervals can accurately reflect the continuous distribution characteristics of the mainstream moving targets in the candidate region.

[0116] Step 105: selecting a target pedestrian flow channel region from the plurality of candidate regions according to the number of each relevant sequence and the interval length corresponding to each target interval, and generating and outputting a channel trajectory identification line.

[0117] Interval length refers to the length of a single target interval. The interval length is the difference between the coordinates of the endpoint and the starting point of the interval, reflecting the total coverage of the target interval in the axial direction.

[0118] The channel trajectory marking line refers to the linear visual marking generated based on the spatial characteristics (horizontal coverage range, vertical center position) of the target pedestrian channel area. Its function is to intuitively represent the central direction and horizontal coverage width of the pedestrian channel, providing a clear visual reference for subsequent applications such as passenger flow guidance, route planning, and traffic statistics.

[0119] In this embodiment of the invention, after statistically obtaining the number of relevant sequences and filtering out the target intervals, the interval length of all target intervals within each candidate region is calculated, and the difference between the endpoint coordinates and the starting coordinates (i.e., the length of a single interval) is calculated. Then, the total coverage length of the candidate region is obtained by summing all the lengths of the single intervals. Furthermore, the ratio of the number of relevant sequences to the total coverage length of the candidate region is calculated. This indicator reflects both the density and concentration of trajectories: a higher number of relevant sequences indicates a denser concentration of moving targets within the region; a smaller total coverage length of the target interval indicates a more concentrated distribution of trajectory points in the horizontal direction. Combining these two factors allows for accurate determination of whether a candidate region is a major pedestrian flow channel.

[0120] The trajectory point density of all candidate areas is calculated and sorted, and the candidate area with the highest trajectory point density is selected as the target pedestrian flow channel area. Taking the horizontal direction as an example, the horizontal coordinate range of all target intervals within the target pedestrian flow channel area is analyzed to determine the starting point of the interval with the smallest horizontal coordinate and the ending point of the interval with the largest horizontal coordinate, thereby defining the horizontal coverage of the channel. At the same time, the vertical center position of the target pedestrian flow channel area is calculated (i.e., the average of the starting and ending coordinates of the area in the vertical direction, ensuring that the marking line is located at the vertical center position of the channel). Finally, the channel trajectory marking line is generated based on the horizontal coverage and the vertical center position.

[0121] In one example of the present invention, step 105 may include the following sub-steps S11-S14:

[0122] S11. Calculate the sum of the interval lengths of all target intervals within each candidate region to obtain the total coverage length corresponding to each candidate region;

[0123] For each candidate region, since invalid regions with insufficient merging counts have been eliminated, the length of all target regions can be calculated by subtracting the starting coordinate from the ending coordinate of a single target region. Then, the lengths of all target regions are summed to obtain the total coverage length corresponding to the candidate region.

[0124] S12. Calculate the ratio between the number of each relevant sequence and the total coverage length to obtain the trajectory point density of each candidate region;

[0125] S13. Select the candidate region corresponding to the highest trajectory point density as the target pedestrian flow channel region;

[0126] In this embodiment, by calculating the trajectory point density, a higher number of related sequences indicates a denser concentration of moving targets within the area, while a smaller total coverage length indicates a more spatially concentrated trajectory. A high ratio of these two values ​​indicates that the area simultaneously satisfies both the core characteristics of "dense" and "concentrated," making it more consistent with the spatial attributes of major pedestrian channels. The trajectory point densities of all candidate areas are uniformly sorted, and the candidate area with the highest trajectory point density is selected as the target pedestrian channel area.

[0127] Furthermore, if multiple candidate regions have the same density of trajectory points and all have the highest value (i.e., the density is tied for first), then auxiliary screening conditions need to be introduced (such as prioritizing regions whose total coverage length is closer to the typical channel width of the scene, or regions whose vertical distribution is more in line with the normal passage height of pedestrians) to ensure the uniqueness and rationality of the target pedestrian channel region. After selection, the complete spatial parameters of the target pedestrian channel region (such as the start / end coordinates in the vertical direction and the core coverage range in the axial direction) need to be recorded to provide basic data for the subsequent generation of channel trajectory marking lines.

[0128] S14. Generate and output the channel trajectory marking line in the target pedestrian channel area.

[0129] Furthermore, S14 may include the following sub-steps:

[0130] Select the minimum and maximum axial coordinates of the target interval within the target pedestrian flow channel area;

[0131] Calculate the coordinate difference between the maximum and minimum axial coordinates, and then calculate the ratio between the coordinate difference and the preset interval size to obtain the offset coordinates;

[0132] Calculate the difference between the minimum axial coordinate and the offset coordinate as the starting coordinate;

[0133] Calculate the sum of the maximum axial coordinate and the offset coordinate as the endpoint coordinate;

[0134] At the centerline of the target pedestrian flow channel area, generate and output the channel trajectory marker line extending from the starting coordinates to the ending coordinates.

[0135] In this embodiment of the invention, the axial coordinates of all target intervals within the target pedestrian flow channel area are retrieved. After verifying the integrity of the coordinates, the minimum value (minimum axial coordinate) of the axial start coordinates and the maximum value (maximum axial coordinate) of the axial end coordinates are selected. Then, the difference between the maximum and minimum axial coordinates (i.e., the core axial width of the channel) is calculated. Combined with the preset interval size set according to the scene characteristics (such as pedestrian passage width and monitoring accuracy), the offset coordinates are calculated (while setting an anomaly protection mechanism to avoid excessive or insufficient offset). Subsequently, the starting coordinates are obtained by subtracting the offset coordinates from the minimum axial coordinates, and the ending coordinates are obtained by adding the offset coordinates to the maximum axial coordinates. The two points are then checked to see if they are within the axial range of the area image. If they are outside the range, they are adjusted to the effective boundary. Finally, the average value of the vertical start and end coordinates of the target pedestrian flow channel area is calculated to determine the centerline position. Using this position as the vertical reference, the starting point and the ending point are connected to generate the channel trajectory marking line (ensuring that its coordinate system is consistent with the original video and area image). Finally, the data is output in a visual form (overlaid on the original video or area image) and in a data form (output coordinate parameters), providing connection support for subsequent applications such as passenger flow management and intelligent analysis.

[0136] It should be noted that this axial coordinate is related to the overall extension direction of the original trajectory point sequence. Taking an overall extension direction from bottom to top or from top to bottom as an example, this axial coordinate is the X-axis coordinate, and the starting point of the smallest X-coordinate interval, line_x1, and the ending point of the largest X-coordinate interval, line_x2, are selected. Finally, at the middle height (area_y1+area_y2) / 2 of the channel, a line segment is generated from the left extension point (line_x1-dist, mid_y) to the right extension point (line_x1+dist, mid_y) (where the offset coordinate dist is (line_x2-line_x1) / 4). This line segment can intuitively represent the centerline and direction of the detected pedestrian flow channel. If the overall extension direction is from left to right or from right to left as an example, this axial coordinate is the Y-axis coordinate.

[0137] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps.

[0138] The following describes a pedestrian flow path detection device provided by an embodiment of the present invention. The pedestrian flow path detection device described below and the pedestrian flow path detection method described above can be referred to and correspond to each other.

[0139] Please see Figure 2 , Figure 2 This is a structural block diagram of a pedestrian flow channel trajectory detection device provided in an embodiment of the present invention.

[0140] This invention provides a device for detecting the trajectory of pedestrian flow, comprising:

[0141] The trajectory generation module 201 is used to perform frame-by-frame target tracking on the original video data when the original video data is received, and generate the original trajectory point sequence corresponding to each moving target.

[0142] The region extraction module 202 is used to create a region image according to the view size of the original video data, and to slide and extract multiple candidate regions from the region image;

[0143] The interval construction module 203 is used to determine the number of relevant sequences and target trajectory points corresponding to each candidate region based on the overlap between each original trajectory point sequence and the candidate region, and to construct the initial interval corresponding to the target trajectory point;

[0144] The interval merging module 204 is used to merge initial intervals that match the merging conditions and then filter target intervals according to the number of merging.

[0145] The trajectory identifier generation module 205 is used to select the target pedestrian flow channel area from multiple candidate areas based on the number of each relevant sequence and the length of the corresponding target interval, and generate the channel trajectory identifier line output.

[0146] Optionally, the trajectory generation module 201 is specifically used for:

[0147] When the raw video data is received, it is split into multiple video frames.

[0148] Target detection is performed on each moving target within each frame of video image to determine the motion position point of each moving target in the video image;

[0149] Associate all moving position points with the moving target to generate a sequence of original trajectory points corresponding to each moving target.

[0150] Optionally, the region extraction module 202 is specifically used for:

[0151] Create a region image based on the view dimensions of the original video data;

[0152] Calculate the sliding window parameters based on the view dimensions and current device performance parameters;

[0153] Create a sliding window based on the extension direction and sliding window parameters of the original trajectory point sequence;

[0154] Multiple candidate regions are extracted from the region image by sliding a window with a fixed step size.

[0155] Optionally, the interval construction module 203 is specifically used for:

[0156] Traverse the original trajectory point sequence and determine whether any original trajectory point in each original trajectory point sequence is located in any candidate region.

[0157] If so, the original trajectory point sequence to which the original trajectory point belongs is determined as the relevant trajectory point sequence corresponding to the candidate region;

[0158] Count the number of relevant sequences corresponding to each candidate region;

[0159] Select any target trajectory point that overlaps with each candidate region from each relevant trajectory point sequence;

[0160] An initial interval that conforms to the preset interval size is generated, with each target trajectory point as the center.

[0161] Optionally, the interval merging module 204 is specifically used for:

[0162] Traverse the initial intervals and merge the initial intervals that match the merging condition to obtain multiple independent intervals; the merging condition is that there are adjacent or overlapping pairs of initial intervals.

[0163] Count the number of merges for each independent interval;

[0164] Independent intervals with fewer merges than the average number of merges are removed, resulting in multiple target intervals.

[0165] Optionally, the trajectory identifier generation module 205 includes:

[0166] The length calculation submodule is used to calculate the sum of the interval lengths of all target intervals within each candidate region, and obtain the total coverage length corresponding to each candidate region;

[0167] The trajectory point density calculation submodule is used to calculate the ratio between the number of each relevant sequence and the total coverage length to obtain the trajectory point density of each candidate region.

[0168] The region selection submodule is used to select the candidate region corresponding to the highest trajectory point density as the target pedestrian flow channel region.

[0169] The marker line generation submodule is used to generate and output the channel trajectory marker lines in the target pedestrian channel area.

[0170] Optionally, the marker line generation submodule is specifically used for:

[0171] Select the minimum and maximum axial coordinates of the target interval within the target pedestrian flow channel area;

[0172] Calculate the coordinate difference between the maximum and minimum axial coordinates, and then calculate the ratio between the coordinate difference and the preset interval size to obtain the offset coordinates;

[0173] Calculate the difference between the minimum axial coordinate and the offset coordinate as the starting coordinate;

[0174] Calculate the sum of the maximum axial coordinate and the offset coordinate as the endpoint coordinate;

[0175] At the centerline of the target pedestrian flow channel area, generate and output the channel trajectory marker line extending from the starting coordinates to the ending coordinates.

[0176] This invention provides an electronic device, including a memory and a processor. The memory stores a computer program, which, when executed by the processor, causes the processor to perform the steps of the pedestrian flow path detection method as described in any embodiment of this invention.

[0177] This invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed, implements a method for detecting pedestrian flow trajectory as described in any embodiment of this invention.

[0178] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described device and module can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0179] In the several embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.

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

[0181] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.

[0182] If the integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0183] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for detecting the trajectory of pedestrian flow channels, characterized in that, include: When the raw video data is received, the raw video data is subjected to frame-by-frame target tracking to generate a sequence of original trajectory points corresponding to each moving target. A region image is created according to the view size of the original video data, and multiple candidate regions are extracted by sliding from the region image; Based on the overlap between each original trajectory point sequence and the candidate region, determine the number of related sequences and the target trajectory point corresponding to each candidate region, and construct the initial interval corresponding to the target trajectory point; After merging the initial intervals that match the merging criteria, filter the target intervals according to the number of mergings; Based on the number of each relevant sequence and the length of the interval corresponding to the target interval, a target pedestrian flow channel area is selected from multiple candidate areas, and a channel trajectory marker line is generated and output. The step of selecting a target pedestrian flow channel area from multiple candidate areas based on the number of each relevant sequence and the interval length corresponding to the target interval, and generating a channel trajectory marker line output, includes: Calculate the sum of the interval lengths of all target intervals within each candidate region to obtain the total coverage length corresponding to each candidate region; The ratio between the number of each relevant sequence and the total coverage length is calculated to obtain the trajectory point density of each candidate region; The candidate region corresponding to the highest trajectory point density is selected as the target pedestrian flow channel region; Generate and output the channel trajectory marking lines in the target pedestrian channel area.

2. The method according to claim 1, characterized in that, The step of performing frame-by-frame target tracking on the received raw video data to generate a sequence of original trajectory points corresponding to each moving target includes: When the raw video data is received, the raw video data is split into multiple video images; For each moving target within each frame of the video image, target detection is performed to determine the motion position point of each moving target in the video image; Associating all the moving position points with the moving target respectively, generating the original trajectory point sequence corresponding to each moving target.

3. The method according to claim 1, characterized in that, The step of creating a region image according to the view size of the original video data and extracting multiple candidate regions from the region image includes: Create a region image according to the view size of the original video data; Calculate the sliding window parameters based on the view dimensions and current device performance parameters; Create a sliding window according to the extension direction of the original trajectory point sequence and the sliding window parameters; Multiple candidate regions are extracted from the region image by sliding the sliding window with a fixed step size.

4. The method according to claim 1, characterized in that, The step of determining the number of relevant sequences and target trajectory points corresponding to each candidate region based on the overlap between each original trajectory point sequence and the candidate region, and constructing the initial interval corresponding to the target trajectory point, includes: Traverse the original trajectory point sequence and determine whether any original trajectory point in each original trajectory point sequence is located in any of the candidate regions; If so, the original trajectory point sequence to which the original trajectory point belongs is determined as the relevant trajectory point sequence corresponding to the candidate region; Count the number of relevant sequences corresponding to each candidate region; Select any target trajectory point that overlaps with each of the aforementioned relevant trajectory point sequences and each of the aforementioned candidate regions; An initial interval conforming to a preset interval size is generated, with each target trajectory point as the center.

5. The method according to claim 1, characterized in that, After merging the initial intervals that match the merging conditions, the step of filtering the target intervals according to the number of mergings includes: Traverse the initial intervals and merge the initial intervals that match the merging conditions to obtain multiple independent intervals; the merging conditions are that there are adjacent or overlapping pairs of the initial intervals. Count the number of merges corresponding to each independent interval; By filtering out independent intervals with fewer than the average number of merges, multiple target intervals are obtained.

6. The method according to claim 1, characterized in that, The step of generating and outputting the channel trajectory marking line in the target pedestrian channel area includes: Select the minimum and maximum axial coordinates of the target interval within the target pedestrian flow channel area; Calculate the coordinate difference between the maximum axial coordinate and the minimum axial coordinate, and calculate the ratio between the coordinate difference and the preset interval size to obtain the offset coordinate; The difference between the minimum axial coordinate and the offset coordinate is calculated as the starting coordinate; The sum of the maximum axial coordinate and the offset coordinate is used as the endpoint coordinate; At the centerline position of the target pedestrian flow channel area, generate and output a channel trajectory marker line extending from the starting point coordinates to the ending point coordinates.

7. A device for detecting the trajectory of pedestrian flow, characterized in that, include: The trajectory generation module is used to perform frame-by-frame target tracking on the received raw video data and generate a sequence of original trajectory points corresponding to each moving target. The region extraction module is used to create a region image according to the view size of the original video data, and to slide and extract multiple candidate regions from the region image; The interval construction module is used to determine the number of related sequences and target trajectory points corresponding to each candidate region based on the overlap between each original trajectory point sequence and the candidate region, and to construct the initial interval corresponding to the target trajectory point; The interval merging module is used to merge initial intervals that match the merging conditions and then filter target intervals according to the number of merging operations. The trajectory identifier generation module is used to select a target pedestrian flow channel area from multiple candidate areas based on the number of each related sequence and the interval length corresponding to the target interval, and generate a channel trajectory identifier line output. The trajectory identifier generation module includes: The length calculation submodule is used to calculate the sum of the interval lengths of all the target intervals within each candidate region, so as to obtain the total coverage length corresponding to each candidate region. The trajectory point density calculation submodule is used to calculate the ratio between the number of each of the relevant sequences and the total coverage length to obtain the trajectory point density of each of the candidate regions; The region selection submodule is used to select the candidate region corresponding to the highest trajectory point density as the target pedestrian flow channel region. The marking line generation submodule is used to generate and output the channel trajectory marking lines in the target pedestrian channel area.

8. An electronic device, characterized in that, The device includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of the method for detecting the trajectory of a pedestrian flow channel as described in any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed, it implements the method for detecting pedestrian flow trajectory as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method and device for acquiring pedestrian flow information

    CN110717926A