A method and system for personnel recognition and counting based on single-path vision
By employing a single-path vision-based personnel identification and counting method, utilizing a dimensionality correction algorithm and a deep learning detection model, combined with Kalman filtering and FastDTW algorithms, high-precision personnel identification and counting in accommodation scenarios were achieved. This solved the blind spots and lack of real-time counting issues in traditional security modes, provided real-time early warning capabilities, and reduced operation and maintenance costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HANGZHOU DECISION FOREST TECHNOLOGY CO LTD
- Filing Date
- 2026-01-23
- Publication Date
- 2026-06-05
AI Technical Summary
Traditional security systems in accommodation settings suffer from high labor costs, numerous blind spots, lack of real-time counting, and no proactive warnings, making it impossible to achieve high-precision personnel identification and counting, resulting in significant security risks.
A single-path vision-based method for personnel identification and counting is adopted. Through image acquisition and correction, feature extraction, personnel analysis and counting compensation, a latitude correction algorithm is used to eliminate edge distortion, a deep learning detection model is used for target detection, Kalman filtering and Hungarian algorithm are combined for cross-frame tracking, and FastDTW algorithm is used for trajectory matching and counting compensation.
It achieves high-precision counting in complex occlusion scenarios with a counting error rate of less than 6%, significantly reducing system deployment costs, improving the reliability and security of control, providing real-time early warning capabilities, eliminating monitoring blind spots, and reducing operation and maintenance costs.
Smart Images

Figure CN122157083A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent security technology, and in particular to a method and system for personnel identification and counting based on single-channel vision. Background Technology
[0002] In traditional security management, accommodation settings, due to their dense population and high mobility, have strict requirements for controlling the number of people. Overcrowding often leads to a series of safety hazards such as fires, stampedes, and other security risks. Currently, personnel management and security in such accommodation settings mainly rely on a "human wave" approach, combining ordinary surveillance cameras with manual patrols. This involves security personnel conducting on-site inspections or manually reviewing video footage at a monitoring center.
[0003] However, this model has many unresolved problems, as follows:
[0004] High labor costs and low efficiency: The traditional model requires dedicated personnel to monitor the screen 24 hours a day to control the flow of people. This not only consumes a lot of manpower, but also makes it easy for people to get tired after long hours of duty, resulting in missed or incorrect views, and the continuity and reliability of control cannot be guaranteed.
[0005] Limited field of view and blind spots: Ordinary surveillance cameras have a small field of view. In public areas such as corridor intersections, activity rooms, and stairwells in accommodation settings, a large number of cameras need to be deployed to achieve full coverage. Otherwise, blind spots are likely to exist, further reducing the effectiveness of personnel management.
[0006] Lack of real-time analysis and counting capabilities: Ordinary surveillance cameras only have image acquisition and storage functions, but lack real-time data processing and analysis capabilities, and cannot perform real-time statistics on the number of people in the monitored area; if managers need to understand the situation of people in a specific time period, they need to review the video frame by frame, which is cumbersome, time-consuming and labor-intensive, and cannot achieve real-time control.
[0007] Lack of proactive early warning capabilities poses significant safety hazards: This is the core flaw of the traditional model. Because it cannot count occupancy in real time, the system cannot promptly detect and alert when violations such as overcrowding occur in accommodation settings, lacking proactive early warning functionality. Often, the situation can only be traced after an incident by reviewing video footage, failing to provide pre-incident warnings or real-time intervention, making it difficult to detect safety hazards early and posing a significant risk to the lives and property of guests.
[0008] Therefore, there is an urgent need for an intelligent security system that can achieve wide-area coverage without blind spots, high-precision personnel identification and counting, and real-time early warning capabilities. Summary of the Invention
[0009] In view of the shortcomings of the prior art described above, the purpose of this invention is to provide a method and system for personnel identification and counting based on single-channel vision, which can solve the problems of existing traditional security modes in the management of personnel in accommodation scenarios, such as reliance on manual labor, many blind spots in monitoring, lack of real-time counting, and lack of proactive early warning.
[0010] To achieve the above and other related objectives, the present invention provides a personnel identification and counting system based on single-path vision, comprising the following steps: S1, image acquisition and correction, acquiring the original field-of-view image acquired by the camera, establishing the mapping relationship between the hemispherical imaging model and the planar image using the latitude correction algorithm, and converting the original field-of-view image into an equidistant cylindrical projection correction image that eliminates edge distortion;
[0011] S2. Feature extraction and target detection: Construct an indoor scene dataset based on the actual situation, train a person detection model using the collected dataset, use the trained model to participate in the collection of the dataset, iterate the model and dataset repeatedly to obtain the final target model, and output the bounding box and feature information of the person target.
[0012] S3. Personnel analysis: Extract personnel features and use Kalman filtering and Hungarian algorithm to track detected personnel targets across frames. When a target is lost and the intersection-over-union ratio with existing targets is greater than a preset threshold, it is determined to be occluded. Parent-child relationship is established, and the position of the occluded child object is updated using the displacement vector of the parent object.
[0013] S4. Counting and Timing Compensation: Determine entry and exit events based on the spatial relationship between personnel trajectories and preset door areas; when a new trajectory is detected in the area outside the door, trigger trajectory matching logic based on fast dynamic time warping, calculate the shape similarity between the new trajectory and the recently disappeared or exited trajectory inside the door; if the similarity meets the preset conditions, determine that the new trajectory is an obscured exiting person, and compensate and correct the counting results.
[0014] By employing the above technical solutions, a latitude correction algorithm is used to perform equidistant cylindrical unfolding of wide-angle images from a single-channel vision system, eliminating edge human body distortion. A human detection model is trained using a dataset to adaptively enhance the feature response of occluded targets. A "parent-child association" state machine is established to maintain the virtual trajectory of occluded targets. A trajectory matching algorithm is used to perform temporal shape matching of trajectories inside and outside the door, accurately retrieving and compensating for exit targets lost due to occlusion. This invention achieves high-precision counting of complex occlusion behaviors such as side-by-side and close proximity, with a counting error rate of less than 6%, significantly reducing system deployment costs, all while using only a single-channel vision system and without requiring a depth sensor.
[0015] In one embodiment of the present invention, the specific implementation steps of the latitude correction algorithm in step S1 are as follows: A hemispherical imaging model is established, and the original distorted image acquired by the camera is regarded as an orthogonal projection of the hemisphere onto the image plane, wherein the radius of the hemisphere is... With the lens field of view and equivalent focal length Satisfying the relation: For any pixel p in the target corrected image , ), with the image principal point ( ) Calculate the normalized polar radius with the origin as the reference point. Thus, the latitude angle is obtained. ; Calculate longitude angle; spherical coordinates Mapped to three-dimensional coordinates of a unit sphere The image is then back-projected to the original image coordinate system using the principle of perspective projection, and the corrected pixel values are obtained through bilinear interpolation sampling to complete the equidistant cylindrical unfolding of the image.
[0016] In one embodiment of the present invention, the deep learning detection model in step S2 includes: a backbone network: employing a C3K2 structure for feature extraction, with C2PSA spatial attention modules inserted at intervals; a neck network: employing a PANet-Lite topology, where the standard convolutional layers are replaced with the dynamic convolutional modules; the dynamic convolutional modules include an SE sub-network, used to perform global average pooling and fully connected mapping on the input feature map to generate... Group dynamic weights, for The static convolutional kernels are used for weighted summation; the detection head adopts a decoupled head structure and introduces an EMA multi-scale attention layer at the input end.
[0017] In one embodiment of the present invention, the trajectory matching logic based on FastDTW in step S4 includes: coarse-grained matching: matching new trajectories outside the gate... Matching historical trajectory Downsampling is performed according to time windows to construct multi-resolution sequences; coarse alignment: the dynamic time warping (DTW) distance and optimal alignment path are calculated at the lowest resolution layer; fine-grained propagation: the optimal alignment path is mapped to the previous resolution layer to form a constraint window, and the DTW distance is calculated only within the constraint window; decision: the fine-grained propagation is repeated until the original resolution layer, and the normalized cumulative distance is calculated. ,like If the value is less than the set threshold, the trajectory is considered to be successfully matched.
[0018] In one embodiment of the present invention, step S4 further includes an entrance obstruction compensation strategy: when a parent object in the parent-child association state is detected to enter the door area, if its associated child object is in an obstructed state and is not independently detected in the door area, it is determined that the child object enters the door with the parent object, and the entrance count is incremented by 1.
[0019] A people identification and counting system based on single-path vision, comprising:
[0020] The image acquisition module is configured as a single-channel wide-angle or fisheye camera to acquire real-time video streams of the monitored area.
[0021] The correction processing module is used to receive the video stream, execute the latitude correction algorithm, and output the corrected video frames;
[0022] The intelligent analysis module is equipped with the deep learning detection model as described in claim 3, which is used to infer the corrected video frames and output the coordinates of the personnel target.
[0023] The logic operation module is used to perform trajectory tracking, state maintenance, and count compensation logic;
[0024] The logic operation module includes a backtracking matching unit for caching historical trajectory data and executing the FastDTW algorithm to identify accompanying exit behavior.
[0025] In one embodiment of the present invention, the logic operation module is further configured with an anti-jitter strategy: if the target trajectory moves back and forth at the boundary of the gate region, the counting state is only updated after the trajectory has completely left the gate region and the confidence level has recovered from the occlusion.
[0026] In one embodiment of the present invention, the system further includes a global density monitoring module: used to calculate the global congestion of the image in real time, and when the global congestion exceeds a preset threshold, automatically adjust the matching threshold of the FastDTW algorithm to adapt to trajectory deformation under high-density crowds.
[0027] As described above, the person identification and counting method and system based on single-path vision of the present invention have the following beneficial effects:
[0028] Significantly improved counting accuracy to meet the needs of complex scenarios: Addressing the core pain points of dense crowds and frequent occlusion, existing technologies generally have counting errors exceeding 15% in scenarios such as elevator entrances and corridors, making it difficult to support accurate crowd management decisions. This invention achieves accurate judgment of complex states such as overlap, back-facing, and partial occlusion through an adaptive occlusion recognition algorithm. In accommodation scenarios, the counting error of people entering and exiting is stably controlled within 2%, which can directly meet the high-precision requirements of commercial customer flow analysis and personnel number statistics in accommodation venues.
[0029] Significantly enhanced robustness and reduced operation and maintenance costs: Traditional multi-path collaborative solutions suffer from a high equipment failure rate (such as loose lines and abnormal module synchronization) of up to 12% per year due to the large number of devices and complex data interaction. Each fault diagnosis and repair takes 2-4 hours, and the annual operation and maintenance cost accounts for more than 25% of the equipment purchase cost. The single-device architecture of this invention greatly reduces the number of failure points, reducing the annual equipment failure rate to below 1.5%. At the same time, the algorithm has adaptive light adjustment capabilities, maintaining stable counting accuracy under complex lighting conditions such as low-light and strong light in commercial buildings at night and outdoor rainy weather. It does not require frequent manual parameter adjustment, and the annual operation and maintenance cost is only 10% of that of traditional solutions, significantly reducing long-term operating costs.
[0030] Real-time personnel counting, replacing manual duty: This invention uses technologies such as image acquisition, distortion correction, target detection and tracking to achieve real-time counting of the number of people in accommodation scenarios. It eliminates the need for continuous manual monitoring of the screen, significantly reducing labor costs. At the same time, it avoids the problem of fatigue and missed detection by manual duty, and improves the reliability of personnel management.
[0031] Full coverage without blind spots, enhancing the comprehensiveness of management and control: This invention uses a wide-angle camera as the image acquisition device. Its ultra-large field of view can enable a single device to cover a large area of public space, effectively eliminating the blind spots of traditional ordinary monitoring, improving the comprehensiveness of personnel management and control in accommodation scenarios, eliminating the need for a large number of cameras, and reducing system deployment costs.
[0032] Enhancing Data Value to Support Refined Management: Existing low-precision counting solutions only output data for rough reference, failing to meet the management needs of specific scenarios. The high-precision counting data output by this invention can trigger early warnings at the first sign of abnormal situations such as overcrowding, achieving "pre-event warning and in-event intervention." This completely solves the passive "post-event tracing" mode of traditional monitoring, helping managers to promptly handle violations, eliminate safety hazards early, and protect the lives and property of guests. Attached Figure Description
[0033] Figure 1 The diagram shows the overall module layout disclosed in this embodiment of the invention. Detailed Implementation
[0034] The following specific embodiments illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification.
[0035] Please see Figure 1It should be understood that the structures, proportions, sizes, etc., illustrated in the accompanying drawings are merely for illustrative purposes to aid those skilled in the art and to facilitate understanding and reading. They are not intended to limit the scope of the invention and therefore have no substantial technical significance. Any modifications to the structure, changes in proportions, or adjustments to size, without affecting the effectiveness and purpose of the invention, should still fall within the scope of the technical content disclosed in this invention. Furthermore, the terms such as "upper," "lower," "left," "right," "middle," and "one" used in this specification are merely for clarity and not intended to limit the scope of the invention. Changes or adjustments to their relative relationships, without substantially altering the technical content, should also be considered within the scope of the invention's implementation.
[0036] Example 1:
[0037] like Figure 1 As shown, this embodiment provides a method for people identification and counting based on single-path vision, including the following steps:
[0038] S1. Image Acquisition and Correction: Acquire the original field-of-view image acquired by a single-channel vision (Camera), establish the mapping relationship between the hemispherical imaging model and the planar image using the latitude correction algorithm, and convert the original field-of-view image into an equidistant cylindrical projection correction image to eliminate edge distortion.
[0039] S2. Feature extraction and target detection: Construct a personnel detection dataset and train a personnel detection model using this dataset. Input the corrected image into the detection model. The detection model introduces a dynamic convolution module (DynamicConv) into the neck network (Neck) to dynamically generate convolution kernel weights based on the features of the input image and output the bounding box and feature information of the personnel target.
[0040] S3. Personnel analysis: Kalman filtering and Hungarian algorithm are used to track detected personnel targets across frames. When a target is lost and the intersection-over-union ratio with the existing target is greater than a preset threshold, it is determined to be in an occluded state. Parent-child relationship is established, and the position of the occluded child object is updated using the displacement vector of the parent object.
[0041] S4. Counting and Timing Compensation: Determine entry and exit events based on the spatial relationship between personnel trajectories and preset door areas; when a new trajectory is detected in the area outside the door, trigger trajectory matching logic based on fast dynamic time warping, calculate the shape similarity between the new trajectory and the recently disappeared or exited trajectory inside the door; if the similarity meets the preset conditions, determine that the new trajectory is an obscured exiting person, and compensate and correct the counting results.
[0042] In step S1, the mapping matrices map_x and map_y required for the latitude correction method are constructed based on the map. Map_x and map_y store the mapping relationship between points before correction and points after correction in all images. After obtaining the mapping matrices map_x and map_y, the mapping matrices can be used to correct the real-time images acquired from the camera.
[0043] In step S1, the specific implementation steps of the latitude correction algorithm are as follows: Establish a hemispherical imaging model, treating the original distorted image captured by the camera as an orthogonal projection of the hemisphere onto the image plane, where the radius of the hemisphere is... With the lens field of view and equivalent focal length The following relation is satisfied:
[0044]
[0045] For any pixel p in the target corrected image , ), with the image principal point ( ) Calculate the normalized polar radius with the origin as the reference point. Thus, the latitude angle is obtained. ;
[0046] Calculate longitude angle:
[0047]
[0048] spherical coordinates Mapped to three-dimensional coordinates of a unit sphere The image is then back-projected to the original image coordinate system using the principle of perspective projection. The target corrected image size is set to W×H, and its corresponding spherical coordinates (X′,Y′,Z′) are calculated pixel by pixel.
[0049] The (X′,Y′,Z′) coordinates are inversely projected onto the original image coordinates, and the corrected image is obtained by bilinear interpolation sampling. All target image pixels are traversed to complete the distortion-free equidistant columnar unfolding, thereby realizing the correction preprocessing of the acquired image.
[0050] In step S2, the preliminary dataset and algorithm transformation includes:
[0051] First, a batch of image data captured by a camera is collected to understand the general situation of the target scene. This batch of data is then corrected using the latitude correction method, and the corrected image data is labeled. The first version of the data collection model is trained using the prepared data.
[0052] Then, a second data collection is conducted. During this data collection process, the first version of the data collection model is used to shift the focus of data collection from understanding the general situation of the scenario to making up for the shortcomings of the current model. After the second data collection is completed, the second version of the data collection model is trained using this batch of data.
[0053] Finally, a third data collection was conducted. The goal of this data collection was to identify and address any gaps in the second version of the data collection model and to compensate for any deficiencies in the actual scenario. The data collection process was the same as the second data collection process. After the data collection was completed, this batch of data was used to train the final personnel detection model.
[0054] In step S2, the detection model includes an input module, a backbone module, a neck module, and a head module, wherein:
[0055] Backbone module: It uses a C3K2 structure for feature extraction and intersperses C2PSA spatial attention modules at intervals; the backbone module sequentially stacks CBS structure, C3K2 structure and C2PSA structure;
[0056] The CBS structure consists of a Conv layer, a BatchNormalization layer, and a SiLU activation layer connected in series.
[0057] The C3K2 structure is a lightweight CSP unit, with each of the main branch and residual branch containing two sets of K×K grouped convolutions.
[0058] The C2PSA structure performs channel attention and spatial attention in parallel, and performs weighted correction on the 256×20×20 deep feature map.
[0059] Neck network (Neck module): adopts PANet-Lite topology, and replaces the standard convolutional layer (Conv) with the dynamic convolutional module (DynamicConv); the dynamic convolutional module includes an SE sub-network, which is used to perform global average pooling and fully connected mapping on the input feature map, generate k sets of dynamic weights, and perform weighted summation on k sets of static convolutional kernels. In this embodiment, k is 4.
[0060] The detection head (Head module) adopts a decoupled head structure, with the classification branch and the detection branch being independent. An EMA multi-scale attention layer is introduced at the input of both branches to enhance the consistency between the bounding box and the class confidence.
[0061] The SE subnetwork sequentially performs global average pooling, fully connected + ReLU, and fully connected + Softmax on the 256×20×20 feature map to generate dynamic weights w_i, which are used to weight the convolutional kernels of DynamicConv.
[0062] In step S3,
[0063] 1) Character Feature Extraction: After acquiring the i-th real-time frame_i from the camera, the dimensional expansion method in step S1 is used to correct frame_i, resulting in the corrected frame_i. The trained personnel detection model in S2 is used to extract n character position information from correct frame_i, where the i-th character position information is denoted as person_i, and i takes the values 1, 2, ..., n. The position information of person_i is represented as (x1_i, y1_i, x2_i, y2_i), where (x1_i, y1_i) are the coordinates of the upper left corner of the character's coordinate frame, and (x2_i, y2_i) are the coordinates of the lower right corner of the character's coordinate frame.
[0064] 2) Character Trajectory Tracking: After obtaining the current character's position information, a specific tracker is used to track the character's trajectory. The trajectory tracking process of the tracker is as follows: First, Kalman filtering is used to predict the character's position information obtained from the previous frame of the camera, resulting in q predicted character position information. These q predicted character position information are then matched one-to-one with the p character position information obtained from the previous frame using the Hungarian algorithm, resulting in n successfully matched tracking trajectory objects, q - n unmatched trajectory objects, and p - n existing trajectory objects that failed to match. The n successfully matched objects and the q - n unmatched objects are considered as real objects, while the p - n unmatched objects are temporarily defined as disappeared objects.
[0065] 3) Character Status Determination: Confirm whether all currently existing tracks are real, temporarily disappeared due to occlusion, or have already disappeared; match all real objects with temporarily disappeared objects one by one. If the Intersection over Union (IOU) of a pair of matching objects is greater than 0.25, the temporarily disappeared object is considered to be occluded, the status of the temporarily disappeared object is changed to occluded, and the real object occluding the temporarily disappeared object is defined as the parent object of the temporarily disappeared object. Temporarily disappeared objects that are not occluded by any real object are recorded as disappeared objects; if the continuous disappearance time of a disappeared object exceeds the maximum survival time (2 seconds), the disappeared object is removed from the tracker.
[0066] Step S4 includes the following steps:
[0067] (1) Normal counting: Based on the spatial relationship between the unknown person and the door area, record the entry or exit events according to the person's position and status;
[0068] (2) Entry obstruction compensation: When an object is obstructed and there is an entry action, the obstructed object is allowed to enter and the compensation information is recorded;
[0069] (3) Doorway Obstruction Compensation: When someone appears outside the door, check the movement trajectory of other characters in the screen. If the position is changed to...
[0070] (4) Global monitoring: If the number of compensations or the number of people at any given moment exceeds the set threshold within the same video segment, a rollback mechanism will be triggered to correct the overall compensation result in order to suppress overcompensation.
[0071] In step S4, the relationship between the person and the door is determined based on the person's movement trajectory, and the person's entry and exit information is obtained. When determining entry and exit, only real objects are considered. There are n doors in the picture, where the i-th door is denoted as door_i, and i takes the values 1, 2, ..., n in sequence.
[0072] The center point of the character's coordinate frame is taken as the character's location. Each door has a region, and the region of the i-th door is denoted as area_i. If the center point of the character's coordinate frame is located within area_i, the character is considered to be inside door_i; otherwise, the character is considered to be outside door_i.
[0073] When a character enters the outside of door_i from inside door_i, it is considered that the character has left the house; when a character enters the inside of door_i from outside the house, it is considered that the character has entered the house.
[0074] When a character enters a door, if the character's trajectory is obscured by another character's trajectory, and the obscured trajectory is not currently inside the door, then the obscured trajectory is considered to have entered the door with the character entering. After a character leaves the door for a period of time (3 seconds), if there is another real character's trajectory similar to the one leaving the door, then that character's trajectory is considered to have left the door with the one leaving the door.
[0075] The trajectory matching algorithm is implemented using the Fast Dynamic Time Alignment (FastDTW) algorithm;
[0076] The trajectory matching logic based on FastDTW mentioned in step S4 includes:
[0077] 1. Input two trajectory sequences: P = [p1, p2, ..., p m (The trajectory of people leaving the premises has been smoothed), Q = [q1,q2, ...,q] n [(Trajectory of fellow travelers to be determined), where pᵢ and qⱼ are the two-dimensional coordinates (x, y) of the corresponding frame.
[0078] 2. Coarsening: P and Q are averaged in segments over a time window Δt = 0.5 s to obtain downsampled sequences P' and Q', until the sequence length is ≤ 1 / 4 of the original length, forming a multi-layer pyramid representation.
[0079] 3. Lowest layer coarse alignment: In layers P' and Q', the minimum cumulative distance matrix D' is calculated using the classic DTW: D'(i,j) = ‖p'ᵢ - q'ⱼ‖2 + min{D'(i-1, j), D'(i, j-1), D'(i-1, j-1)}, with the initial condition D'(0,0) = 0, and the boundary is filled with infinity. The coarse alignment path R' is obtained by backtracking.
[0080] 4. Fine-grained projection: Map R' back to the finer sequence of the previous layer as the "constraint window" of the DTW of this layer: the window width w = 2 × the current layer sampling interval (pixels), only the cells within the window are calculated to form a sparse distance matrix D''.
[0081] 5. Layer-by-layer refinement: Repeat the process of "coarse alignment → projection → window constraint DTW" until returning to the original sequence P and Q to obtain the final alignment path R.
[0082] 6. Similarity determination: Calculate the normalized cumulative distance of path R: d = D(m, n) / (m + n). If d ≤ threshold τ (τ is 0.15 × the image diagonal pixels), then Q and P are determined to be "co-trajectory", triggering joint exit compensation; otherwise, no compensation is performed.
[0083] Example 2:
[0084] A person recognition and counting system based on single-path vision, comprising:
[0085] The image acquisition module is a single-channel wide-angle or fisheye camera used to acquire real-time video streams of the monitored area.
[0086] The correction processing module is used to receive the video stream, execute the latitude correction algorithm, and output the corrected video frames;
[0087] The intelligent analysis module deploys a learning and detection model to infer the corrected video frames and output the coordinates of the target personnel.
[0088] The logic operation module is used to perform trajectory tracking, state maintenance, and count compensation logic;
[0089] The logic operation module includes a backtracking matching unit for caching historical trajectory data and executing the FastDTW algorithm to identify accompanying exit behavior;
[0090] The logic operation module is also configured with an anti-jitter strategy: If the target trajectory moves back and forth at the boundary of the gate area, the counting state is only updated after the trajectory has completely left the gate area and the confidence level has recovered from the occlusion.
[0091] The system also includes a global density monitoring module: used to calculate the global congestion of the image in real time. When the global congestion exceeds a preset threshold, the matching threshold of the FastDTW algorithm is automatically adjusted to adapt to trajectory deformation under high-density crowds.
[0092] In summary, this invention utilizes a latitude correction algorithm to perform equidistant cylindrical unfolding on wide-angle images from a single-channel vision system, eliminating edge human body distortion; it trains a personnel detection model using a dataset to adaptively enhance the feature response of occluded targets; it maintains the virtual trajectory of occluded targets by establishing a "parent-child association" state machine; and it uses the FastDTW algorithm to perform temporal shape matching on trajectories inside and outside the gate, accurately retrieving and compensating for exit targets lost due to occlusion. This invention achieves high-precision counting of complex occlusion behaviors such as side-by-side and close proximity, with a counting error rate of less than 2%, significantly reducing system deployment costs, all while using only a single-channel vision system and without requiring a depth sensor.
[0093] Therefore, this invention effectively overcomes the various shortcomings of the prior art and has high industrial application value.
[0094] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in the present invention should still be covered by the claims of the present invention.
Claims
1. A method for people identification and counting based on single-path vision, characterized in that, Includes the following steps: S1. Image Acquisition and Correction: Acquire the original field-of-view image captured by the camera, establish the mapping relationship between the hemispherical imaging model and the planar image using the latitude correction algorithm, and convert the original field-of-view image into an equidistant cylindrical projection correction image to eliminate edge distortion. S2. Feature extraction and target detection: Construct an indoor scene dataset based on the actual situation, train a person detection model using the collected dataset, use the trained model to participate in the collection of the dataset, iterate the model and dataset repeatedly to obtain the final target model, and output the bounding box and feature information of the person target. S3. Personnel analysis: Extract personnel features and use Kalman filtering and Hungarian algorithm to track detected personnel targets across frames. When a target is lost and the intersection-over-union ratio with existing targets is greater than a preset threshold, it is determined to be occluded. Parent-child relationship is established, and the position of the occluded child object is updated using the displacement vector of the parent object. S4. Counting and Timing Compensation: Determine entry and exit events based on the spatial relationship between personnel trajectory and preset door area; when a new trajectory is detected in the area outside the door, trigger trajectory matching logic based on trajectory matching algorithm to calculate the shape similarity between the new trajectory and the trajectory that has recently disappeared or has left the door; if the similarity meets the preset conditions, determine that the new trajectory is an obscured exiting person, and compensate and correct the counting result.
2. The person recognition and counting method based on single-path vision according to claim 1, characterized in that: The specific implementation steps of the latitude correction algorithm in step S1 are as follows: Establish a hemispherical imaging model, treating the original distorted image captured by the camera as an orthogonal projection of the hemisphere onto the image plane, where the radius of the hemisphere is... With the lens field of view and equivalent focal length Satisfying the relation: ; For any pixel p in the target corrected image , ), with the image principal point ( ) Calculate the normalized polar radius with the origin as the reference point. Thus, the latitude angle is obtained. ; Calculate longitude angle; spherical coordinates Mapped to three-dimensional coordinates of a unit sphere The image is then back-projected to the original image coordinate system using the principle of perspective projection, and the corrected pixel values are obtained through bilinear interpolation sampling to complete the equidistant cylindrical unfolding of the image.
3. The person recognition and counting method based on single-path vision according to claim 1, characterized in that: The detection model in step S2 includes: Backbone network: Features are extracted using a C3K2 structure, with C2PSA spatial attention modules inserted at intervals; Neck network: Employs the PANet-Lite topology, replacing the standard convolutional layers with the dynamic convolutional modules; these dynamic convolutional modules include an SE sub-network for performing global average pooling and fully connected mapping on the input feature map, generating... Group dynamic weights, for Weighted summation is performed using static convolutional kernels; Detection head: A decoupled head structure is adopted, and an EMA multi-scale attention layer is introduced at the input end.
4. The person recognition and counting method based on single-path vision according to claim 1, characterized in that: The trajectory matching algorithm in step S4 is based on the trajectory matching logic of FastDTW, including: Coarse-grained: Reducing the new trajectory outside the door Matching historical trajectory Downsampling is performed according to time windows to construct multi-resolution sequences; Coarse alignment: Calculate the Dynamic Time Warping (DTW) distance and optimal alignment path at the lowest resolution layer; Fine-grained propagation: The optimal alignment path is mapped to the previous resolution layer to form a constraint window, and the DTW distance is calculated only within the constraint window; Decision: Repeat fine-grained propagation until the original resolution layer is reached, and calculate the normalized cumulative distance. ,like If the value is less than the set threshold, the trajectory is considered to be successfully matched.
5. The person recognition and counting method based on single-path vision according to claim 1, characterized in that: Step S4 also includes an entrance occlusion compensation strategy: when a parent object in the parent-child association state is detected to enter the door area, if its associated child object is in an occluded state and is not independently detected in the door area, it is determined that the child object enters the door with the parent object, and the entrance count is incremented by 1.
6. A personnel identification and counting system based on single-channel vision, characterized in that, include: The image acquisition module is a single-channel wide-angle or fisheye camera used to acquire real-time video streams of the monitored area. The correction processing module is used to receive the video stream, execute the latitude correction algorithm, and output the corrected video frames; The intelligent analysis module deploys a learning and detection model to infer the corrected video frames and output the coordinates of the target personnel. The logic operation module is used to perform trajectory tracking, state maintenance, and count compensation logic; The logic operation module includes a backtracking matching unit for caching historical trajectory data and executing the FastDTW algorithm to identify accompanying exit behavior.
7. The personnel recognition and counting system based on single-channel vision according to claim 6, characterized in that: The logic operation module is also configured with an anti-jitter strategy: if the target trajectory moves back and forth at the boundary of the gate area, the counting state is only updated after the trajectory has completely left the gate area and the confidence level has recovered from the occlusion.
8. The personnel identification and counting system based on single-channel vision according to claim 6, characterized in that: The system also includes a global density monitoring module: used to calculate the global congestion of the image in real time. When the global congestion exceeds a preset threshold, the matching threshold of the FastDTW algorithm is automatically adjusted to adapt to trajectory deformation under high-density crowds.