A passenger flow statistical method and device, computer equipment and readable storage medium
By performing multi-frame filtering, quality scoring, and static interference filtering on the personnel trajectory data in passenger flow statistics technology, the noise problem introduced by low-quality detection results is solved, thereby improving the accuracy and stability of passenger flow statistics and adapting to the long-term operation needs of complex scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HANGZHOU JIEFENG SOFTWARE CO LTD
- Filing Date
- 2026-04-03
- Publication Date
- 2026-07-31
AI Technical Summary
Existing passenger flow statistics technology lacks systematic quality control over multiple frames of detection results in the continuous trajectory of the same person. This results in low-quality detection results being used in the feature extraction and re-identification process, increasing computational load and storage overhead. Furthermore, it introduces invalid noise, reducing the stability and statistical accuracy of identity association.
By acquiring personnel trajectory data from multiple frames of detection results for the same target, preliminary screening is performed based on geometric conditions and spatiotemporal relationships. Quality scores are calculated and sorted to form static human area filtering. Feature vectors are extracted for re-identification and matching, and finally, passenger flow statistics results are generated.
It improves the accuracy and stability of passenger flow statistics, reduces system computing and storage overhead, adapts to long-term stable operation in complex scenarios, and provides multi-dimensional customer profile data to support decision-making.
Smart Images

Figure CN121982653B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer vision technology, and more specifically, to a passenger flow statistics method, apparatus, computer equipment, and readable storage medium. Background Technology
[0002] With the rapid development of intelligent video analytics technology, customer flow statistics methods based on personnel detection and re-identification have become a core technological support for scenarios such as store operation optimization, shopping mall traffic control, and public place management. This type of technology requires no manual intervention and can automatically capture, extract features, and associate identities of people through video acquisition equipment, efficiently outputting key data such as customer flow and entry / exit behavior. This provides scene managers with data-driven decision-making support, and its application scope is continuously expanding to various densely populated places.
[0003] Current mainstream passenger flow statistics technologies use single frames or simple time segments as the core processing unit. The core idea is to extract the visual features of people at different time points and perform global similarity comparison, thereby associating them with the identity records of the same person, and finally realizing passenger flow counting and behavior analysis.
[0004] However, research has found that existing technologies do not systematically control the quality of multi-frame detection results in the continuous trajectory of the same person. A large number of low-quality detection results, including those with occlusion, half-body shots, morphological distortion, or high repetition, directly participate in the feature extraction and re-identification process. This not only significantly increases the computational load and storage overhead of the system, but also introduces invalid noise into the feature matching process, leading to a decrease in the stability of personnel identity association. Ultimately, this results in deviations in passenger flow statistics, making it difficult to meet the core requirements of the scenario for statistical accuracy. Summary of the Invention
[0005] In view of this, the purpose of this application is to provide a passenger flow statistics method, apparatus, computer equipment and readable storage medium that can significantly improve the accuracy and stability of passenger flow statistics.
[0006] In a first aspect, embodiments of this application provide a passenger flow statistics method, the method comprising: Acquire personnel trajectory data containing multiple frames of detection results for the same target; The multi-frame detection results are initially screened based on preset geometric conditions and the spatiotemporal relationship between adjacent detection results to obtain preliminary screening results; The quality score of the initial screening test results is calculated and sorted, and a predetermined number of target test results are selected based on the sorting results; Static human figure regions are formed by accumulating the detection results of continuously stationary objects in different trajectories. The target detection results are then filtered based on these static human figure regions to obtain an image of the person to be identified. Extract the feature vector of the image of the person to be identified, and re-identify and match the feature vector in the corresponding feature matching space according to the behavior type of the person's trajectory; Based on the re-identification and matching results and personnel attribute information, passenger flow statistics are generated.
[0007] Optionally, the preliminary screening of the multi-frame detection results based on preset geometric conditions and the spatiotemporal relationship between adjacent detection results to obtain preliminary screening results includes: Based on the preset aspect ratio threshold of the detection frame, detection results with abnormal size are rejected. Calculate the intersection-union ratio (CUP) between adjacent detection boxes; The intersection-union ratio is compared with a preset threshold to determine whether adjacent detection boxes are relatively stationary. The test results that are determined to be relatively static are filtered to obtain the initial screening test results.
[0008] Optionally, the step of calculating a quality score and sorting the initial screening test results, and selecting a predetermined number of target test results based on the sorting results, includes: Based on the height and width of the detection frame in each initial screening test result, the quality score is calculated according to the preset formula. All initial screening results were sorted in descending order based on the aforementioned quality score; The predetermined number of results with the highest ranking are selected from the sorted results and used as the target detection results.
[0009] Optionally, the static human-shaped region is formed by accumulating the detection results based on continuous stillness in different trajectories, including: Identify detection results whose spatial position remains unchanged across multiple consecutive frames and record their center points as static point candidates; Static point candidates from different trajectories are accumulated according to their spatial coordinates, and spatially adjacent static points are merged. When the duration of the merged static point exceeds a preset threshold, a rectangular area is generated centered on it, which serves as the static human-shaped area.
[0010] Optionally, the step of filtering the target detection results based on the static human-shaped region to obtain the image of the person to be identified includes: Determine whether the center point of each target detection result is located within the static humanoid area; If the center point is located within the area, the detection result for that target is discarded. The cropped image of the person corresponding to the retained target detection result is used as the image of the person to be identified.
[0011] Optionally, the step of re-identifying and matching the feature vector in the corresponding feature matching space based on the behavior type of the personnel trajectory includes: Determine the type of behavior based on the personnel's trajectory; Within the feature matching space corresponding to the behavior type, calculate the similarity between the feature vector and the historical feature vector; The identity verification is performed based on the similarity, and the verification result is output as the matching result.
[0012] Optionally, generating passenger flow statistics based on the re-identification matching results and personnel attribute information includes: Based on the re-identification and matching results, personnel are assigned or associated with identity identifiers; Personnel attribute information is obtained through attribute recognition models; By combining the identity identifier with the personnel attribute information, a passenger flow statistics result is generated.
[0013] Secondly, embodiments of this application provide a passenger flow counting device, the device comprising: The personnel trajectory data acquisition module is used to acquire personnel trajectory data containing multiple frames of detection results for the same target; The initial screening result determination module is used to perform preliminary screening of the multi-frame detection results based on preset geometric conditions and the spatiotemporal relationship between adjacent detection results to obtain the initial screening result. The target detection result determination module is used to calculate the quality score and sort the initial screening detection results, and select a predetermined number of target detection results based on the sorting results; The image determination module for the person to be identified is used to accumulate the detection results of continuously stationary objects in different trajectories to form a static human shape region, and to filter the target detection results according to the static human shape region to obtain the image of the person to be identified; The re-identification and matching module is used to extract the feature vector of the image of the person to be identified, and perform re-identification and matching on the feature vector in the corresponding feature matching space according to the behavior type of the person's trajectory. The passenger flow statistics generation module is used to generate passenger flow statistics based on the re-identification matching results and personnel attribute information.
[0014] Optionally, the preliminary screening of the multi-frame detection results based on preset geometric conditions and the spatiotemporal relationship between adjacent detection results to obtain preliminary screening results includes: Based on the preset aspect ratio threshold of the detection frame, detection results with abnormal size are rejected. Calculate the intersection-union ratio (CUP) between adjacent detection boxes; The intersection-union ratio is compared with a preset threshold to determine whether adjacent detection boxes are relatively stationary. The test results that are determined to be relatively static are filtered to obtain the initial screening test results.
[0015] Optionally, the step of calculating a quality score and sorting the initial screening test results, and selecting a predetermined number of target test results based on the sorting results, includes: Based on the height and width of the detection frame in each initial screening test result, the quality score is calculated according to the preset formula. All initial screening results were sorted in descending order based on the aforementioned quality score; The predetermined number of results with the highest ranking are selected from the sorted results and used as the target detection results.
[0016] Optionally, the static human-shaped region is formed by accumulating the detection results based on continuous stillness in different trajectories, including: Identify detection results whose spatial position remains unchanged across multiple consecutive frames and record their center points as static point candidates; Static point candidates from different trajectories are accumulated according to their spatial coordinates, and spatially adjacent static points are merged. When the duration of the merged static point exceeds a preset threshold, a rectangular area is generated centered on it, which serves as the static human-shaped area.
[0017] Optionally, the step of filtering the target detection results based on the static human-shaped region to obtain the image of the person to be identified includes: Determine whether the center point of each target detection result is located within the static humanoid area; If the center point is located within the area, the detection result for that target is discarded. The cropped image of the person corresponding to the retained target detection result is used as the image of the person to be identified.
[0018] Optionally, the step of re-identifying and matching the feature vector in the corresponding feature matching space based on the behavior type of the personnel trajectory includes: Determine the type of behavior based on the personnel's trajectory; Within the feature matching space corresponding to the behavior type, calculate the similarity between the feature vector and the historical feature vector; The identity verification is performed based on the similarity, and the verification result is output as the matching result.
[0019] Optionally, generating passenger flow statistics based on the re-identification matching results and personnel attribute information includes: Based on the re-identification and matching results, personnel are assigned or associated with identity identifiers; Personnel attribute information is obtained through attribute recognition models; By combining the identity identifier with the personnel attribute information, a passenger flow statistics result is generated.
[0020] Thirdly, embodiments of this application provide a computer device, including: a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the computer device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, the steps of the passenger flow statistics method described in any of the optional embodiments of the first aspect are performed.
[0021] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the passenger flow statistics method described in any of the optional embodiments of the first aspect.
[0022] The technical solution provided in this application includes, but is not limited to, the following beneficial effects: It acquires personnel trajectory data containing multiple frames of detection results for the same target; using the continuous trajectory of the same person as the core processing unit, it breaks through the processing limitations of existing technologies that only process single frames or simple time segments, ensuring that all subsequent operations are based on complete personnel motion data, and providing solid data support for improving the coherence and completeness of passenger flow statistics.
[0023] The multi-frame detection results are initially screened based on preset geometric conditions and the spatiotemporal relationship between adjacent detection results to obtain preliminary screening results. Detection results with abnormal size or unreasonable shape are quickly eliminated by geometric conditions, and duplicate or static invalid data are filtered out by spatiotemporal relationship. The dual screening greatly reduces the amount of invalid data in subsequent processes, reduces basic computing and storage overhead, and avoids the premature introduction of noise by low-quality data.
[0024] The quality score of the initial screening test results is calculated and sorted. A predetermined number of target test results are selected based on the sorting results. The quality of the test results is distinguished by a quantitative formula. High-scoring candidate frames are selected to participate in subsequent processes, thereby improving the effectiveness of feature vectors from the source and enhancing the stability and accuracy of re-identification matching. At the same time, the predetermined number is controlled to avoid resource waste caused by excessive data volume.
[0025] Static human figure regions are formed by accumulating detection results from continuously stationary targets on different trajectories. The target detection results are then filtered based on these static human figure regions to obtain images of the people to be identified. Static human figure interference is automatically identified through spatiotemporal accumulation and merging, without the need for manual configuration or fixed rules. This approach can adapt to changes in the position of static targets in the scene, such as changes in location or additions, completely avoiding the misjudgment of static interference as real passenger flow and ensuring the purity of statistical data.
[0026] The feature vector of the image of the person to be identified is extracted. Based on the behavior type of the person's trajectory, the feature vector is re-identified and matched in the corresponding feature matching space. A dedicated feature matching space is divided for different behavior types, making the similarity comparison more targeted, effectively reducing the probability of mismatch between people with different behaviors, improving the consistency of the identity association of people across time periods, and avoiding the problems of duplicate or missed statistics.
[0027] Based on the re-identification and matching results and personnel attribute information, passenger flow statistics are generated. While outputting the accurate passenger flow number after deduplication, it integrates multi-dimensional customer profile data such as age and gender, which not only meets the core statistical needs, but also provides rich reference for scenario operation decisions, significantly improving the practical application value of the statistical results.
[0028] In summary, the above steps, progressing step by step and working together to form a closed-loop optimization, address the core pain points of existing technologies across the entire process from data acquisition to result generation. Through trajectory processing, multi-stage filtering, adaptive static interference filtering, and differentiated re-identification strategies, the accuracy and stability of passenger flow statistics are significantly improved, while effectively reducing the system's computational and storage overhead, fully adapting to the actual needs of long-term stable operation in real and complex scenarios.
[0029] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0030] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0031] Figure 1 A flowchart of a passenger flow statistics method provided in Embodiment 1 of this application is shown; Figure 2 This paper shows a system architecture diagram for implementing passenger flow statistics provided in Embodiment 1 of this application; Figure 3 A flowchart of a preliminary screening method provided in Embodiment 1 of this application is shown; Figure 4 A flowchart of a target detection result determination method provided in Embodiment 1 of this application is shown; Figure 5 The flowchart of a static humanoid region determination method provided in Embodiment 1 of this application is shown; Figure 6A flowchart of a method for determining an image of a person to be identified, provided in Embodiment 1 of this application, is shown; Figure 7 A flowchart of a re-identification matching method provided in Embodiment 1 of this application is shown; Figure 8 A flowchart of a method for generating passenger flow statistics results provided in Embodiment 1 of this application is shown; Figure 9 A flowchart of a specific method for generating passenger flow statistics results provided in Embodiment 1 of this application is shown; Figure 10 This paper shows a schematic diagram of the structure of a passenger flow statistics device provided in Embodiment 2 of this application; Figure 11 A schematic diagram of the structure of a computer device provided in Embodiment 3 of this application is shown. Detailed Implementation
[0032] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0033] Example 1 To facilitate understanding of this application, the following is combined with... Figure 1 The flowchart illustrating a passenger flow statistics method provided in Embodiment 1 of this application will be described in detail for Embodiment 1 of this application.
[0034] See Figure 1 As shown, Figure 1 A flowchart of a passenger flow statistics method provided in Embodiment 1 of this application is shown, wherein the method includes steps S101 to S106: S101: Obtain personnel trajectory data containing multiple frames of detection results for the same target.
[0035] Specifically, the personnel trajectory data is generated from real-time image or video stream data collected by user cameras deployed in the scene. The camera has a built-in human detection and tracking algorithm to perform continuous frame trajectory association for each person target in the image, completing human trajectory tracking and trajectory status judgment. Afterwards, the camera pushes the trajectory information to the cloud trajectory data analysis service through Kafka (Distributed Streaming Platform). The personnel trajectory data includes multiple frame detection results corresponding to the same person in a continuous time period. Each detection result contains at least the frame timestamp information and the spatial position coordinate information of the detection box in the image. The spatial position coordinates are based on the OpenCV format image coordinate system, that is, the upper left corner is the origin (0,0), the horizontal axis is the x-axis, and the vertical axis is the y-axis.
[0036] S102: Based on preset geometric conditions and the spatiotemporal relationship between adjacent detection results, the multi-frame detection results are initially screened to obtain preliminary screening results.
[0037] Specifically, the preset geometric conditions are based on the pixel size and aspect ratio of the detection box. The ideal pixel size of the detection box is 256 pixels long and 128 pixels wide, and the ideal aspect ratio is width / height = 1:2. When the actual aspect ratio of the detection box is less than 1.5, it is judged as an abnormal size detection result and is directly rejected. For example, if the detection box is 100 pixels wide and 80 pixels high, the aspect ratio is 1.25, which is less than 1.5, and it will be judged as an abnormal frame. The spatiotemporal relationship between adjacent detection results is determined by calculating the IOU (Intersection over Union) of the detection boxes in adjacent frames. The preset IOU threshold is 0.85. When calculating, the coordinates of the detection boxes in the preceding and following frames must be determined first. The coordinates of the detection box in the preceding frame are (x1,y1,x2,y2), and the coordinates of the detection box in the following frame are (x3,y3,x4,y4). The coordinates of the intersection region are (max(x1,x3),max(y1,y3),min(x2,x4),min(y2,y4)). If the width or height of the intersection region is negative, the intersection area is 0. Then the intersection area and the union area are calculated separately. When the IOU of the detection boxes in the preceding and following frames is less than 0.85, it is determined to be a duplicate or static detection result. For cases where adjacent frames remain stationary, the duration can be inferred from the number of frames in a fixed frame rate video. For example, if the video stream frame rate is 10 FPS and the IOU of multiple consecutive frame detection frames is less than 0.85, it can be determined that the person is stationary, thus avoiding the impact of continuously judging stationary frames on the effectiveness of the screening results.
[0038] S103: Calculate the quality score and sort the initial screening test results, and select a predetermined number of target test results based on the sorting results.
[0039] Specifically, the quality score is calculated based on the size and shape features of the detection box. The scoring formula is height*(1 / (1+abs(height / width-2.5))), where height is the pixel height of the human detection box, width is the pixel width of the human detection box, and abs is an absolute value function. In this formula, the height term ensures that the detection box has sufficient height information, and the term in parentheses is the aspect ratio correction coefficient. The closer the aspect ratio of the detection box is to 1:2.5, the closer the correction coefficient is to 1, and the higher the final quality score. The predetermined number is an absolute value, currently set to select the top 12 images with the highest ranking. This number will be flexibly adjusted by taking into account factors such as the length of the person's trajectory. If a person's trajectory contains only a small number of initial screening results, all results will be selected directly; if the trajectory contains a large number of initial screening results, the top 12 frames with the highest quality scores will be selected as the target detection results.
[0040] S104: Based on the cumulative detection results of continuously stationary objects in different trajectories, a static human figure region is formed. The target detection results are filtered according to the static human figure region to obtain the image of the person to be identified.
[0041] Specifically, the criteria for determining static point candidates are: the center point of the detection box is used as a key point; the pixel distance it moves in the tracking trajectory is less than a preset jitter pixel threshold, and the duration exceeds a preset time threshold. The jitter pixel threshold can be set to a fixed pixel value, and the duration threshold for a single trajectory is more than 10 frames (10 FPS for video stream, i.e., 1 second). When the moving distance of the center point of the detection box is ≤ the preset threshold and the duration is ≥ 1 second, the key point will be recorded as a static point candidate. Static point coordinates and durations are stored as key-value pairs in a Redis (Remote Dictionary Server) database. The key is a string concatenated with the x and y coordinates of the static point, in the format (x, y), where x and y are the horizontal and vertical coordinates of the OpenCV image. For example, if the center point coordinates are (200, 300), the key is "200_300". The value is the duration of the static point. If the coordinates of a new candidate static point match the coordinates of a historical static point stored in Redis, the durations of both are added together. The time of static points from different trajectories is accumulated, and spatially adjacent static points are merged. When merging, a coordinate difference threshold is set. If the difference between the x-coordinate and the difference between the y-coordinate of two static points are both less than or equal to the preset threshold, they are determined to be spatially adjacent static points, and their duration is accumulated. When the duration of the merged static point exceeds the preset threshold, a rectangular static human-shaped area is delineated with the static point as the center, combined with the jitter pixel thresholds of the x and y axes. If the center point of the target detection result falls into the static human figure area, it indicates that the detection result is likely a static human figure interference such as a model or billboard, and it will be removed from the re-identification process. The target detection result that is not removed is the result corresponding to the image of the person to be identified.
[0042] S105: Extract the feature vector of the image of the person to be identified, and perform re-identification matching on the feature vector in the corresponding feature matching space according to the behavior type of the person's trajectory.
[0043] Specifically, the system will use a deep learning model to extract features from all the cropped images of the screened individuals to be identified, generating high-dimensional feature vectors with fixed dimensions for re-identification of individuals; at the same time, it will perform attribute recognition on the human bounding box images with the highest quality scores after screening, using a convolutional neural network (CNN) attribute recognition model, inputting high-quality human bounding box images, and outputting the age range and gender information of the individuals; The behavior type of a person's trajectory is determined by the trajectory information reported by the camera. The camera will pre-set two virtual door frame lines, namely the outer line and the inner line. By analyzing the interaction between the coordinate changes of the person's trajectory and the door frame lines, the behavior type of the person is determined. For example, if the person's trajectory passes from the outside of the outer line to the inside of the inner line, it is determined as "entering the store" behavior; if the person's trajectory passes along the outside of the outer line without crossing the inner line, it is determined as "passing through the store" behavior. This judgment process is unrelated to the information in the previous detection result screening steps. Different behavior types correspond to different feature matching spaces. The system will establish independent feature matching spaces for the three types of behavior: "entering the store", "exiting the store", and "passing through the store". Each space corresponds to a customer flow feature library stored in Redis. The system will retrieve the customer flow feature library in the feature matching space of the corresponding behavior type and perform cosine similarity calculation between the generated feature vector and the historical feature vector in the feature library.
[0044] S106: Generate passenger flow statistics based on the re-identification matching results and personnel attribute information.
[0045] Specifically, the system will preset a cosine similarity threshold. If the calculated similarity is greater than or equal to the threshold, the person to be identified will be associated with an existing passenger flow ID. If the similarity is less than the threshold, a new passenger flow ID will be generated and its feature vector will be inserted into the passenger flow feature database of the corresponding behavior type. The customer flow ID represents a unique identifier for each customer. Ultimately, the customer flow ID, age range, gender, behavior type, trajectory timestamp, and other information will be combined into an alarm body, which is stored in JSON data format. This alarm body is pushed by the application framework to the upper-layer business system or the MySQL (Relational Database Management System) storage module. Users can view the accurate statistical results of deduplicated customer flow on PC (Personal Computer) front-end, APP (Application) mobile client, etc.
[0046] See Figure 2 As shown, Figure 2 This document illustrates the overall architecture of a system for implementing passenger flow statistics as provided in Embodiment 1 of this application. The core modules of the system include a user camera, Kafka, an AI open platform, a gateway, a passenger flow deduplication module, a license plate recognition module, a PC front-end, an APP mobile client, a Redis database, and a MySQL database. Each module forms a complete architecture through data transmission and functional linkage: the user camera acts as a data acquisition terminal, collecting real-time image or video data from the scene. After completing human trajectory tracking and trajectory status judgment, the trajectory information is pushed to the cloud-based AI open platform via Kafka. The AI open platform, through the gateway, links with core functional modules such as passenger flow deduplication and license plate recognition to process the trajectory data. The feature data and trajectory information generated during processing are stored in the Redis and MySQL databases, respectively. The final accurate passenger flow statistics results are displayed to users through the PC front-end and the APP mobile client, allowing users to view the deduplicated passenger flow statistics in real time.
[0047] This implementation plan addresses the core issues of low-quality detection frame interference, static human figure miscounting, and mismatches caused by behavioral confusion in existing technologies through a comprehensive design encompassing trajectory acquisition, hierarchical filtering, static interference filtering, differentiated re-identification and matching, and statistical result generation. Multi-stage filtering directly reduces the amount of invalid data, lowering MySQL storage pressure and Kafka data transmission load; automatic static human figure filtering requires no manual rule configuration, adapts to changing scenarios, and avoids miscounting caused by static interference; the differentiated feature matching space reduces mismatches between different behaviors; ultimately, it achieves a dual improvement in passenger flow statistics accuracy and system operating efficiency, enabling long-term stable operation in real-world, complex scenarios.
[0048] In an optional implementation, see Figure 3 As shown, Figure 3The flowchart of a preliminary screening method provided in Embodiment 1 of this application is shown. The preliminary screening of the multi-frame detection results based on preset geometric conditions and the spatiotemporal relationship between adjacent detection results to obtain preliminary screening results includes steps S301-S304: S301: Based on the preset aspect ratio threshold of the detection frame, reject detection results with abnormal dimensions.
[0049] Specifically, the preset ideal pixel size of the detection box is 256 pixels long and 128 pixels wide, with an ideal aspect ratio of width / height = 1:2. The aspect ratio is calculated by dividing the width of the detection box by the height. When the calculated aspect ratio is less than 1.5, it is judged as an abnormal size detection result and is directly rejected. For example, if a person is obscured by a pillar, causing the detection box to only contain the upper body, with a width of 120 pixels and a height of 150 pixels, the aspect ratio is 0.8, which is less than 1.5. This will be judged as an abnormal frame and rejected.
[0050] S302: Calculate the cross-union ratio between adjacent frame detection boxes.
[0051] Specifically, the Intersection over Union (IOU) is the percentage of the area of the intersection region to the area of the union region between two detection boxes. Its calculation formula is IOU={Area(B_pred∩B_gt)} / {Area(B_pred∪B_gt)}; Each character in the formula has a unique definition: B_pred is the predicted bounding box in the current frame, usually obtained from the model output, with coordinates (x1, y1, x2, y2), where (x1, y1) are the coordinates of the top-left corner of the detection box, and (x2, y2) are the coordinates of the bottom-right corner; B_gt is the ground truth bounding box in the previous frame, i.e., the determined person detection box, with coordinates (x3, y3, x4, y4); ∩ is the intersection operator, used to calculate the overlapping area of two bounding boxes, with the intersection area coordinates being (max(x1, x3), max(y1, y3)). The functions `min(x2,x4),min(y2,y4)` are used to calculate the area of the intersection region if the width or height of the intersection region is negative. `∪` is the union operator, used to calculate the total area covered by two bounding boxes, calculated as `Area(B_pred)+Area(B_gt)-Area(B_pred∩B_gt)`. `Area` is the area calculation function, used to calculate the area of the corresponding rectangular region, calculated as `(lower right x-coordinate - upper left x-coordinate) × (lower right y-coordinate - upper left y-coordinate)`.
[0052] S303: Compare the intersection-union ratio with a preset threshold to determine whether adjacent detection boxes are relatively stationary.
[0053] Specifically, the preset IOU threshold is 0.85. The calculated IOU values of adjacent frame detection boxes are compared with this threshold. When the IOU value is less than 0.85, it indicates that the overlap between the detection boxes of the two frames is low and the position of the person has not changed significantly. It is determined that the person corresponding to the detection box is in a relatively stationary state.
[0054] S304: Filter the test results that are determined to be relatively static to obtain the initial screening test results.
[0055] Specifically, for cases where adjacent frames remain stable, the duration can be deduced from the number of frames in a fixed frame rate video to avoid false filtering caused by single-frame judgment. All test results deemed relatively static will be skipped and will not participate in subsequent quality scoring and sorting processes. Only test results with significant changes in position and normal size and shape will be retained as initial screening results.
[0056] This implementation scheme achieves precise removal of abnormally sized and duplicate static detection frames through a dual screening mechanism of geometric rules and IOU temporal filtering. Geometric rules can directly filter low-quality detection frames such as half-body, occluded, and distorted frames, reducing the computational load of subsequent quality scoring. IOU temporal filtering can effectively remove redundant static frames within the same trajectory, avoiding duplicate detection data of the same person from consuming system resources. The combination of dual screening can significantly improve the effectiveness of the initial screening results, laying a solid data foundation for subsequent high-quality feature extraction, while reducing the real-time computational load of the system.
[0057] In an optional implementation, see Figure 4 As shown, Figure 4 The flowchart of a target detection result determination method provided in Embodiment 1 of this application is shown, wherein the step of calculating a quality score and sorting the initial screening detection results, and selecting a predetermined number of target detection results based on the sorting results, includes steps S401 to S403: S401: Calculate the quality score based on the height and width of the detection frame in each initial screening result according to the preset formula.
[0058] Specifically, the quality score is calculated based on the size and shape features of the detection frame. The preset score calculation formula is height*(1 / (1+abs(height / width-2.5))). `height` is the pixel height of the human detection bounding box; a larger value indicates that the bounding box contains more complete human body information. `width` is the pixel width of the human detection bounding box. `abs` is the absolute value function used to calculate the absolute value of the corresponding value. In this formula, the `height` term is the base score, which guarantees the basic score for a complete human bounding box. The term in parentheses is the aspect ratio correction coefficient. The closer the aspect ratio of the detection box is to 1:2.5, the closer the correction coefficient is to 1, and the higher the final quality score.
[0059] For example, if the detection box has a height of 200 and a width of 80, a height / width of 2.5, abs(2.5-2.5)=0, and a correction factor of 1, the quality score is 200×1=200. If the width is 100, the height / width is 2, abs(2-2.5)=0.5, and the correction factor is 1 / (1+0.5)≈0.67, the quality score is 200×0.67≈134. The score calculated by this formula directly reflects the quality of the detection result.
[0060] S402: Sort all initial screening test results in descending order based on the quality score.
[0061] Specifically, the core basis for sorting is the quality score. The higher the quality score, the more complete the personnel information and the more standard the form of the corresponding test results. When sorting, test results with high scores will be ranked first, and test results with low scores will be ranked last.
[0062] S403: Select the predetermined number of results with the highest ranking from the self-sorting results as the target detection results.
[0063] Specifically, the number of images to be selected is an absolute number, currently set to the top 12 images with the highest ranking. The predetermined number is not fixed and will be flexibly adjusted based on factors such as the actual length of the personnel trajectory. If the number of preliminary screening test results for the personnel trajectory is less than 12, all preliminary screening test results will be selected directly; if the number of preliminary screening test results exceeds 12, the top 12 test results will be selected to ensure that the selected test results are representative and the amount of data is controllable.
[0064] This implementation scheme achieves standardized and refined screening of detection frame quality through a quantitative quality scoring formula and a fixed number of optimization strategies. The scoring formula takes into account both the height integrity and aspect ratio of the detection box, accurately distinguishing between high-quality complete human-shaped frames and low-quality distorted frames. Selecting a fixed number of high-scoring frames for subsequent processes ensures the effectiveness of feature extraction data while controlling the amount of data involved in matching for a single trajectory, reducing resource consumption for feature vector storage and similarity calculation. At the same time, it improves the accuracy of feature matching and reduces the storage capacity occupied by the feature library.
[0065] In an optional implementation, see Figure 5 As shown, Figure 5 The flowchart of a static human figure region determination method provided in Embodiment 1 of this application is shown, wherein the static human figure region is formed by accumulating the detection results of continuous stillness in different trajectories, including steps S501~S504: S501: Identify detection results whose spatial position remains unchanged across multiple consecutive frames and record their center points as static point candidates.
[0066] Specifically, the judgment criteria are: the center point of the detection box is taken as the key point, the pixel distance moved in the tracking trajectory is less than the preset pixel threshold, and the duration exceeds the preset time threshold; The duration threshold for a single trajectory is more than 10 frames. If the video stream is 10 FPS, that is, the corresponding duration is more than 1 second, key points that meet this condition will be recorded as static point candidates.
[0067] S502: Accumulate static point candidates from different trajectories according to their spatial coordinates, and merge spatially adjacent static points.
[0068] Specifically, the static point coordinates and duration are stored in the Redis database as key-value pairs. The key is a string concatenated with coordinate values, and the coordinate format is (x, y). x and y are the horizontal and vertical coordinate values in the OpenCV format image coordinate system. If the candidate coordinates of a static point are consistent with the historical coordinates of a static point stored in Redis, the durations of both are accumulated. At the same time, the durations of static points from different trajectories are accumulated, and spatially adjacent static points are merged. When merging, a coordinate difference threshold is set. If the difference between the x-coordinate and the difference between the y-coordinate of two static points are both ≤ the preset threshold, they are determined to be spatially adjacent static points, and their durations are accumulated.
[0069] S503: When the duration of the merged static point exceeds a preset threshold, a rectangular area is generated centered on it as the static human-shaped area.
[0070] Specifically, when the duration of the merged static point exceeds a preset threshold, a rectangular area is delineated centered on the static point, combined with the jitter pixel thresholds on the x and y axes, to form a rectangular region covering the static target. This rectangular area is the static humanoid region. The merged static humanoid region will be displayed as the minimum bounding rectangle. The size of the rectangle can be adaptively adjusted according to the actual size of the static target for subsequent filtering of static interference targets.
[0071] This implementation scheme achieves automated and adaptive identification of static human-shaped interference through the spatiotemporal accumulation and merging of static points, completely solving the drawbacks of traditional solutions that rely on manual rule configuration. Based on Redis key-value pair storage, it supports efficient accumulation and fast querying of static points with multiple trajectories; merging spatially adjacent static points to generate rectangular regions can accurately define the location range of static targets such as models and billboards; this scheme requires no manual intervention, can adapt to changes in scenarios such as adjustments to static target positions and the addition of new static targets, supports long-term stable online operation of the system, and avoids misstatistics caused by static interference.
[0072] In an optional implementation, see Figure 6 As shown, Figure 6 The flowchart illustrates a method for determining an image of a person to be identified according to Embodiment 1 of this application, wherein the step of filtering the target detection result based on the static human-shaped region to obtain the image of the person to be identified includes steps S601-S603: S601: Determine whether the center point of each target detection result is located within the static humanoid area.
[0073] Specifically, firstly, extract the coordinates of the center point of the detection box corresponding to each target detection result. The coordinate calculation method is ((x-coordinate of the top left corner of the detection box + x-coordinate of the bottom right corner) / 2, (y-coordinate of the top left corner of the detection box + y-coordinate of the bottom right corner) / 2), and the coordinate format is (x,y) in the OpenCV image coordinate system. The extracted center point coordinates are compared one by one with the rectangular coordinates of the static human figure region. The rectangular coordinates of the static human figure region are (x_min, y_min, x_max, y_max). If the x-coordinate of the center point of the target detection result satisfies x_min≤x≤x_max and the y-coordinate satisfies y_min≤y≤y_max, then the center point is determined to be within the static human figure region.
[0074] S602: If the center point is located within the area, the detection result of the target is removed.
[0075] Specifically, the detection results of targets whose center point falls within the static human shape area are most likely static human shape interference such as models, billboards, and posters. Such targets do not have the value of passenger flow statistics and will be directly removed from the re-identification process, and will not participate in subsequent feature extraction and matching operations.
[0076] S603: The cropped image of the person corresponding to the retained target detection result is used as the image of the person to be identified.
[0077] Specifically, the target detection results that were not rejected are the effective results after geometric rule filtering, temporal redundancy filtering, quality score optimization, and static interference filtering. These results only contain complete human figure detection data of real mobile people. The cropped images of the people corresponding to these valid detection results are the images of the people to be identified, which can be directly used for subsequent feature vector extraction operations.
[0078] This implementation scheme, based on precise filtering of static human-shaped regions, further purifies the data sources involved in re-identification. Filtering is performed by comparing center point coordinates, resulting in high algorithm efficiency that fully meets the system's real-time requirements. The filtered images of the people to be identified are all valid frames of real, moving individuals, avoiding interference from static targets at the data source and improving the accuracy of passenger flow statistics. Furthermore, this filtering operation requires no additional computational resources, requiring only coordinate comparison, thus balancing filtering effectiveness and system efficiency.
[0079] In an optional implementation, see Figure 7 As shown, Figure 7 The flowchart of a re-identification and matching method provided in Embodiment 1 of this application is shown, wherein the re-identification and matching of the feature vector in the corresponding feature matching space based on the behavior type of the personnel trajectory includes steps S701 to S703: S701: Determine the behavior type based on the personnel trajectory.
[0080] Specifically, the behavior type is determined based on the trajectory information reported by the camera. Two virtual door frame lines are pre-set on the camera end, namely the outer door line and the inner door line. By analyzing the interaction between the coordinate changes of people's trajectories and the door frame lines, it is possible to determine whether people belong to different behavior types such as entering the store, leaving the store, or passing through the store. This judgment process is unrelated to the information in the previous detection result screening steps.
[0081] S702: Calculate the similarity between the feature vector and the historical feature vector within the feature matching space corresponding to the behavior type.
[0082] Specifically, different behavior types correspond to different feature matching spaces. The system will establish independent feature matching spaces for the three types of behavior: "entering the store", "exiting the store", and "passing through the store". Each space corresponds to a unique customer flow feature database. The customer flow feature database is stored in a Redis database. The structure of the feature database is key=customer flow ID, value={feature vector: fixed dimension vector, attribute information: age + gender, behavior type: entering / exiting / passing through the store}. The system will retrieve the customer flow feature database in the corresponding space according to the determined behavior type, and calculate the cosine similarity between the feature vector of the image of the person to be identified and the historical feature vector in the feature database.
[0083] S703: Based on the similarity, determine the identity of the individuals and output the determination result as the matching result.
[0084] Specifically, the system will set differentiated similarity thresholds for feature matching spaces of different behavior types. If the calculated similarity is greater than or equal to the corresponding threshold, it will determine that the person to be identified and the person corresponding to the historical feature vector are the same person. If the similarity is less than the corresponding threshold, the person to be identified is determined to be a new person, and the determination result will serve as the core basis for generating subsequent passenger flow statistics.
[0085] This implementation plan solves the problem of mismatches between different behaviors by dividing the feature matching space into independent feature matching spaces based on behavior types. The feature distribution of personnel for behaviors such as entering a store and passing through a store varies significantly. Independent matching spaces allow for targeted threshold settings to avoid cross-behavior mismatches. Based on Redis feature library storage, it supports fast similarity calculation queries, improving the real-time performance of re-identification and matching. Simultaneously, differentiated threshold settings ensure the consistency of personnel identity associations across time periods, avoiding duplicate counting.
[0086] In an optional implementation, see Figure 8 As shown, Figure 8 The flowchart of a method for generating passenger flow statistics results according to Embodiment 1 of this application is shown. The step of generating passenger flow statistics results based on re-identification matching results and personnel attribute information includes steps S801-S803: S801: Assign or associate identity identifiers to personnel based on the re-identification matching results.
[0087] Specifically, the customer flow ID represents a unique identifier for each customer and is automatically generated by the system; if it is determined that the person to be identified is the same person as a historical person, then it is associated with an existing customer flow ID. If the person to be identified is determined to be a new person, a new passenger flow ID is generated, and its feature vector is inserted into the corresponding behavior type passenger flow feature library in the Redis database to complete the real-time update of the feature library.
[0088] S802: Obtain personnel attribute information through attribute recognition model.
[0089] Specifically, the system will select the human frame image with the highest quality score after filtering, which has the most complete human form and the highest clarity, and input it into the pre-trained attribute recognition model; The attribute recognition model is built on a convolutional neural network (CNN). The input is a human figure cropped image with a fixed pixel size, and the output is the age range and gender information of the person. This attribute information is associated with the person's customer flow ID and stored in the Redis feature library.
[0090] S803: Combine the identity identifier with the personnel attribute information to generate passenger flow statistics results.
[0091] Specifically, the system will combine information such as passenger ID, age range, gender, behavior type, trajectory timestamp, and location coordinates into an alarm body, which will be in JSON data format. The alarm is pushed by the application framework to the upper-layer business system or MySQL storage module. Users can view the accurate statistical results of passenger flow after deduplication on PC front-end, APP mobile client and other clients. The overall system architecture also uses Kafka to realize data transmission and MySQL to realize persistent data storage, supporting the query and analysis of historical passenger flow data.
[0092] This implementation plan generates multi-dimensional, high-precision customer flow statistics by associating identity tags and fusing attribute information. The uniqueness of the customer flow ID ensures effective deduplication, completely solving the problem of duplicate counting of people in traditional statistical methods. Attribute information such as age and gender provides merchants with accurate customer profile analysis data support, helping them optimize their operational strategies. The architecture based on Kafka and MySQL achieves efficient data transmission and persistent storage, supporting long-term customer flow data tracking and trend analysis, meeting the refined operational needs of merchants.
[0093] See Figure 9 As shown, Figure 9The flowchart illustrates a specific method for generating passenger flow statistics provided in Embodiment 1 of this application. This flowchart fully presents the entire process from personnel re-identification and matching results to the final storage and display of statistical data: The process begins with "Assigning or associating unique passenger flow IDs based on personnel re-identification and matching results," involving textual information such as "feature vector of the person to be identified," "behavioral type feature matching space (e.g., 'entering the store' or 'passing through the store' space)," "historical feature vector," "similarity result," "preset threshold (e.g., 0.75)," "unique passenger flow ID (format can be set to 'scene number_date_serial number', representing the identity of different customers)," "passenger flow feature library (stored in Redis)," and "real-time update of the feature library," clearly defining the logic of associating the same person with an existing passenger flow ID, generating a new passenger flow ID for a new person, and updating the feature library; Next is "obtaining personnel attribute information through an attribute recognition model," including "the human bounding box image with the highest quality score," "a pre-trained convolutional neural network (CNN) attribute recognition model," and "personnel attribute information." (Age ranges such as 18-25 years old, 26-35 years old, gender such as male / female) "Customer Flow ID" "Cache Module" etc., explaining the process of selecting high-quality images as input to the model to obtain attributes and associate them with customer flow IDs; followed by "combining trajectory behavior and regional interaction to calculate multi-dimensional customer flow statistics indicators", covering "the behavior type corresponding to the personnel trajectory (entering the store, leaving the store, passing through the store)", "preset area (such as inside the store, left / right / front area outside the store)", "number of people entering the store (refer to 'INDOOR.in_degree_count' in the area status)", "number of people leaving the store (refer to 'INDOOR.out_degree_count' in the area status)", "number of people passing through the store (calculated as 'total number of people entering from all areas outside the store - number of people leaving the store', refer to 'count_out_degree_sum-INDOOR.out_degree_count', the result is 0 if negative)", "number of people re-entering the store (detected by the ReID (pedestrian re-identification) module, refer to 'INDOOR')".The text includes phrases such as "re_in_degree_count", detailing the calculation logic of each statistical indicator; followed by "encapsulating the passenger flow statistics results into a standard data format", including "passenger flow ID", "personnel attribute information (age, gender)", "behavior type (entering / exiting / passing through the store)", "trajectory key information (timestamp, core location coordinates)", "statistical indicators", "alarm body", "JSON data format", and examples such as `{"passenger flow ID":"001_20260204_0001","age":"26-35 years old","gender":"female","behavior type":"entering the store","trajectory timestamp":"2026-02-0410:30:00","core coordinates":"(250,320)","current number of people entering the store":120,"current number of people passing through the store":85}`, explaining the content and format of the encapsulated results; finally, "outputting the statistical results to the client for user viewing", involving "application framework" and "PC (Personal)". The text clearly states the display channels and content of the results, including phrases such as "Computer (Personal Computer) Front-end," "APP (Application, Mobile Application) Mobile Terminal," "Client Terminal," "Accurate statistical results after deduplication of passenger flow (real-time passenger flow, proportion of each behavior type, distribution of customer group attributes)," and "Data visualization display (such as digital panels, trend curves)." It concludes with "Persistent storage of statistical data, supporting historical traceability," and includes phrases such as "standard format statistical data," "related passenger flow IDs, attribute information, and trajectory data," "MySQL (Relational Database Management System)," "Data persistence," "Passenger flow feature library and regional status data in Redis (such as the number of people entering / exiting each region, and a list of personnel IDs)," "Subsequent re-identification matching and statistical analysis," and "Passenger flow trend backtracking and periodic report generation," explaining the data storage method and subsequent application value.
[0094] To better illustrate the passenger flow statistics method provided in this application, a specific application example is also provided to facilitate understanding of the method. The specific example is as follows: A chain women's clothing store deployed the customer flow statistics system described in this application to accurately count the number of customers entering the store and analyze customer profiles. High-definition cameras were installed at the store entrance, and the system parameters were configured as follows: video stream frame rate 10FPS, ideal detection box size 256×128 pixels, aspect ratio threshold 1.5, IOU threshold 0.85, static point jitter pixel threshold 5 pixels, static point duration threshold 10 frames (1 second), static point merging coordinate difference threshold 10 pixels, static human shape area generation duration threshold 30 frames (3 seconds), quality score selection of the top 12 frames, feature vector dimension 2048 dimensions, "entering the store" behavior similarity threshold 0.75, and a certain scale of customer flow data was stored in the Redis feature library.
[0095] Trajectory acquisition: The camera collects video data from the store entrance area, and the built-in tracking algorithm associates the trajectories of people in the video to generate personnel trajectory data. The trajectory of a female customer includes multiple consecutive frames of detection results. Each frame of detection results contains a timestamp and (x,y) coordinate information, with a timestamp interval of 0.1 seconds.
[0096] Preliminary screening: The system filters detection frames with an aspect ratio less than 1.5 according to geometric rules. Some detection results of this customer were not up to standard due to the obstruction of the window pillar, so they were judged as abnormal size frames and removed. Then the IOU value of adjacent frames is calculated. Some frames with an IOU value less than the threshold of 0.85 are judged as static frames and filtered. Finally, the initial screening results with normal size and obvious position changes are retained.
[0097] Quality scoring and optimization: The system calculates the quality score of the initial screening results according to the formula height*(1 / (1+abs(height / width-2.5))). In this case, the parameters of a detection box frame are height=200 pixels, width=80 pixels, height / width=2.5, abs(2.5-2.5)=0, correction coefficient=1, and the quality score is 200×1=200, which is the highest score for this trajectory. The system sorts the results in descending order of the scores and selects the detection results that meet the quantity requirements as the target detection results.
[0098] Static human figure filtering: The system simultaneously identifies the detection box of the mannequin in the store window. If the center point moves less than the jitter threshold for multiple consecutive frames, it meets the static point candidate condition. The system stores the static point in Redis. Since there are no other adjacent static points, a static human figure region is directly generated. The center point of the target detection result of the female customer does not fall into the static human figure region, and all of them are retained as images of the person to be identified.
[0099] Feature extraction and behavior determination: The system uses a deep learning model to extract 2048-dimensional feature vectors from the image to be identified, selects the image with the highest score as input to the attribute recognition model, and outputs attribute information "age 26-35 years old, gender female"; by analyzing the interaction between the trajectory coordinates and the camera door frame line, the system determines that the customer's behavior type is "entering the store".
[0100] Re-identification, matching, and statistics: The system enters the "entry" behavior feature matching space, calculates the cosine similarity between the feature vector and the historical vector in the Redis feature library, and if the calculation result is less than the threshold of 0.75, it is determined to be a new customer; the system generates a new customer flow ID, inserts the feature vector and attribute information into the Redis feature library; then combines the customer flow ID, attributes, behavior, time and other information into a JSON format alarm body and pushes it to the store's PC front end.
[0101] Final results: After running the system for a period of time, the store's customer flow statistics accuracy was significantly improved compared to traditional systems. Inaccurate statistics due to static interference such as mannequins were completely avoided, and the system's storage resource consumption was effectively reduced. At the same time, accurate customer profile data was obtained, and the proportion of core customer groups was clearly presented. Based on this, the store adjusted the product display positions, and the product conversion effect was optimized.
[0102] Example 2 See Figure 10 As shown, Figure 10 This illustration shows a schematic diagram of a passenger flow counting device according to Embodiment 2 of this application, wherein the device includes: The personnel trajectory data acquisition module 1001 is used to acquire personnel trajectory data containing multiple frame detection results of the same target; The initial screening result determination module 1002 is used to perform preliminary screening of the multi-frame detection results based on preset geometric conditions and the spatiotemporal relationship between adjacent detection results to obtain the initial screening result. The target detection result determination module 1003 is used to calculate the quality score and sort the initial screening detection results, and select a predetermined number of target detection results based on the sorting results; The image determination module 1004 for identifying persons is used to accumulate detection results of continuous stillness in different trajectories to form a static human shape region, and to filter the target detection results according to the static human shape region to obtain the image of the person to be identified. The re-identification and matching module 1005 is used to extract the feature vector of the image of the person to be identified, and perform re-identification and matching on the feature vector in the corresponding feature matching space according to the behavior type of the person's trajectory. The passenger flow statistics generation module 1006 is used to generate passenger flow statistics based on the re-identification matching results and personnel attribute information.
[0103] In an optional implementation, the preliminary screening of the multi-frame detection results based on preset geometric conditions and the spatiotemporal relationship between adjacent detection results to obtain preliminary screening results includes: Based on the preset aspect ratio threshold of the detection frame, detection results with abnormal size are rejected. Calculate the intersection-union ratio (CUP) between adjacent detection boxes; The intersection-union ratio is compared with a preset threshold to determine whether adjacent detection boxes are relatively stationary. The test results that are determined to be relatively static are filtered to obtain the initial screening test results.
[0104] In an optional implementation, the step of calculating a quality score and ranking the initial screening test results, and selecting a predetermined number of target test results based on the ranking results, includes: Based on the height and width of the detection frame in each initial screening test result, the quality score is calculated according to the preset formula. All initial screening results were sorted in descending order based on the aforementioned quality score; The predetermined number of results with the highest ranking are selected from the sorted results and used as the target detection results.
[0105] In an optional implementation, the static human-shaped region is formed by accumulating the detection results based on continuous stillness in different trajectories, including: Identify detection results whose spatial position remains unchanged across multiple consecutive frames and record their center points as static point candidates; Static point candidates from different trajectories are accumulated according to their spatial coordinates, and spatially adjacent static points are merged. When the duration of the merged static point exceeds a preset threshold, a rectangular area is generated centered on it, which serves as the static human-shaped area.
[0106] In an optional implementation, filtering the target detection results based on the static human-shaped region to obtain the image of the person to be identified includes: Determine whether the center point of each target detection result is located within the static humanoid area; If the center point is located within the area, the detection result for that target is discarded. The cropped image of the person corresponding to the retained target detection result is used as the image of the person to be identified.
[0107] In an optional implementation, the step of re-identifying and matching the feature vector in the corresponding feature matching space based on the behavior type of the personnel trajectory includes: Determine the type of behavior based on the personnel's trajectory; Within the feature matching space corresponding to the behavior type, calculate the similarity between the feature vector and the historical feature vector; The identity verification is performed based on the similarity, and the verification result is output as the matching result.
[0108] In an optional implementation, generating passenger flow statistics based on the re-identification matching results and personnel attribute information includes: Based on the re-identification and matching results, personnel are assigned or associated with identity identifiers; Personnel attribute information is obtained through attribute recognition models; By combining the identity identifier with the personnel attribute information, a passenger flow statistics result is generated.
[0109] Example 3 Based on the same application concept, see [link / reference] Figure 11 As shown, Figure 11 This illustration shows a structural schematic diagram of a computer device provided in Embodiment 3 of this application, wherein, as shown... Figure 11 As shown, the computer device 1100 provided in Embodiment 3 of this application includes: The computer device 1100 includes a processor 1101, a memory 1102, and a bus 1103. The memory 1102 stores machine-readable instructions that can be executed by the processor 1101. When the computer device 1100 is running, the processor 1101 and the memory 1102 communicate through the bus 1103. The machine-readable instructions are executed by the processor 1101 to perform the steps of the passenger flow statistics method shown in Embodiment 1 above.
[0110] Example 4 Based on the same concept, this application also provides a computer-readable storage medium storing a computer program, which, when run by a processor, performs the steps of the passenger flow statistics method described in any of the above embodiments.
[0111] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system and apparatus described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0112] The computer program product for passenger flow statistics provided in this application includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments. For specific implementation details, please refer to the method embodiments, which will not be repeated here.
[0113] The passenger flow counting device provided in this application embodiment can be specific hardware on the device or software or firmware installed on the device. The implementation principle and technical effects of the device provided in this application embodiment are the same as those in the foregoing method embodiments. For the sake of brevity, any parts not mentioned in the device embodiment can be referred to the corresponding content in the foregoing method embodiments. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can all be referred to the corresponding processes in the above method embodiments, and will not be repeated here.
[0114] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.
[0115] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0116] In addition, the functional units in the embodiments provided in this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0117] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion 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 a computer 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 this application. 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.
[0118] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0119] Finally, it should be noted that the above-described embodiments are merely specific implementations of this application, used to illustrate the technical solutions of this application, and not to limit them. The protection scope of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this application; and these modifications, changes, 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 this application. All should be covered within the protection scope of this application. Therefore, the protection scope of this application should be determined by the protection scope of the claims.
Claims
1. A passenger flow counting method characterized by, The method includes: Acquire personnel trajectory data containing multiple frames of detection results for the same target; The multi-frame detection results are initially screened based on preset geometric conditions and the spatiotemporal relationship between adjacent detection results to obtain preliminary screening results; The quality score of the initial screening test results is calculated and sorted, and a predetermined number of target test results are selected based on the sorting results; Static human figure regions are formed by accumulating the detection results of continuously stationary objects in different trajectories. The target detection results are then filtered based on these static human figure regions to obtain an image of the person to be identified. Extract the feature vector of the image of the person to be identified, and re-identify and match the feature vector in the corresponding feature matching space according to the behavior type of the person's trajectory; Based on the re-identification and matching results and personnel attribute information, passenger flow statistics are generated; The static human-shaped region is formed by accumulating the detection results based on continuous stillness in different trajectories, including: Identify detection results whose spatial position remains unchanged across multiple consecutive frames and record their center points as static point candidates; Static point candidates from different trajectories are accumulated according to their spatial coordinates, and spatially adjacent static points are merged. When the duration of the merged static point exceeds a preset threshold, a rectangular area is generated centered on it, which serves as the static human-shaped area.
2. The method according to claim 1, characterized in that, The preliminary screening of the multi-frame detection results is performed based on preset geometric conditions and the spatiotemporal relationship between adjacent detection results to obtain preliminary screening results, including: Based on the preset aspect ratio threshold of the detection frame, detection results with abnormal size are rejected. Calculate the intersection-union ratio (CUP) between adjacent detection boxes; The intersection-union ratio is compared with a preset threshold to determine whether adjacent detection boxes are relatively stationary. The test results that are determined to be relatively static are filtered to obtain the initial screening test results.
3. The method according to claim 1, characterized in that, The process of calculating and sorting the quality scores of the initial screening test results, and selecting a predetermined number of target test results based on the sorting results, includes: Based on the height and width of the detection frame in each initial screening test result, the quality score is calculated according to the preset formula. All initial screening results were sorted in descending order based on the aforementioned quality score; The predetermined number of results with the highest ranking are selected from the sorted results and used as the target detection results.
4. The method according to claim 1, characterized in that, The step of filtering the target detection results based on the static human-shaped region to obtain the image of the person to be identified includes: Determine whether the center point of each target detection result is located within the static humanoid area; If the center point is located within the area, the detection result for that target is discarded. The cropped image of the person corresponding to the retained target detection result is used as the image of the person to be identified.
5. The method according to claim 1, characterized in that, The step of re-identifying and matching the feature vector in the corresponding feature matching space based on the behavior type of the personnel trajectory includes: Determine the type of behavior based on the personnel's trajectory; Within the feature matching space corresponding to the behavior type, calculate the similarity between the feature vector and the historical feature vector; The identity verification is performed based on the similarity, and the verification result is output as the matching result.
6. The method according to claim 1, characterized in that, The process of generating passenger flow statistics based on the re-identification matching results and personnel attribute information includes: Based on the re-identification and matching results, personnel are assigned or associated with identity identifiers; Personnel attribute information is obtained through attribute recognition models; By combining the identity identifier with the personnel attribute information, a passenger flow statistics result is generated.
7. A passenger flow counting device, characterized in that, The device includes: The personnel trajectory data acquisition module is used to acquire personnel trajectory data containing multiple frames of detection results for the same target; The initial screening result determination module is used to perform preliminary screening of the multi-frame detection results based on preset geometric conditions and the spatiotemporal relationship between adjacent detection results to obtain the initial screening result. The target detection result determination module is used to calculate the quality score and sort the initial screening detection results, and select a predetermined number of target detection results based on the sorting results; The image determination module for the person to be identified is used to accumulate the detection results of continuously stationary objects in different trajectories to form a static human shape region, and to filter the target detection results according to the static human shape region to obtain the image of the person to be identified; The re-identification and matching module is used to extract the feature vector of the image of the person to be identified, and perform re-identification and matching on the feature vector in the corresponding feature matching space according to the behavior type of the person's trajectory. The passenger flow statistics generation module is used to generate passenger flow statistics based on the re-identification matching results and personnel attribute information; The static human-shaped region is formed by accumulating the detection results based on continuous stillness in different trajectories, including: Identify detection results whose spatial position remains unchanged across multiple consecutive frames and record their center points as static point candidates; Static point candidates from different trajectories are accumulated according to their spatial coordinates, and spatially adjacent static points are merged. When the duration of the merged static point exceeds a preset threshold, a rectangular area is generated centered on it, which serves as the static human-shaped area.
8. A computer device, characterized in that, include: The computer device includes a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the computer device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, they perform the steps of the passenger flow statistics method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the passenger flow statistics method as described in any one of claims 1 to 6.