Gender-based pedestrian counting method and system with overlapping dual cameras

Through the improved YOLOX-Tiny model and ByteTrack algorithm, combined with collision area counting and ray method, the deficiency of detailed classification of pedestrian attributes and overlapping domain counting in the pedestrian counting method with overlapping domains of dual cameras is solved, and the two-way accurate counting of pedestrians with overlapping domains of dual cameras is achieved.

CN119418271BActive Publication Date: 2025-04-11BEIJING UNIV OF CIVIL ENG & ARCHITECTURE
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411452495.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-17
Publication Date
2025-04-11
Estimated Expiration
2044-10-17

AI Technical Summary

Technical Problem

The existing pedestrian counting methods with overlapping domains lack a detailed classification of pedestrian attributes (such as gender) and are inadequate in overlapping domain acquisition and bidirectional motion pedestrian counting.

Method used

The improved YOLOX-Tiny model was used for pedestrian gender detection, and the gender entry and exit counting was carried out in and out of gender was combined with a combination of ByteTrack and collision area counting. The overlapping area of ​​the dual camera is obtained through the overlapping domain acquisition algorithm, and the ray method is used to judge the inlet and exit count of pedestrians in the overlapping domain, and finally the repeated counting is avoided through the joint counting method.

Benefits of technology

Two-way accurate counting of gender pedestrians with overlapping domains is realized with dual cameras, which improves the accuracy and robustness of counting, and can effectively avoid repeated counting of pedestrians in overlapping domains.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119418271B_ABST
    Figure CN119418271B_ABST
Patent Text Reader

Abstract

The present invention provides a method and system for counting pedestrians by gender with overlapping domains of dual cameras, which belongs to the field of computer vision technology. The overlapping area of ​​the first frame image of camera A and camera B is acquired through an overlapping domain acquisition algorithm; the gender of pedestrians is detected in the video frames under the two cameras respectively using an improved YOLOX‑Tiny model; the method combining ByteTrack and collision area counting is used to count the entry and exit of each video frame under the two cameras respectively by gender; on the basis of the entry and exit counting of pedestrians by gender, the ray method is introduced to judge each video frame to obtain the entry and exit count of pedestrians of different genders in the acquired overlapping domain; the corresponding frame counting results under the two cameras are calculated using a formula to obtain a joint counting result. The present invention realizes the bidirectional dynamic counting of pedestrians by gender with overlapping domains of dual cameras; through the joint counting method, the repeated counting part of the overlapping domain is removed to realize the accurate bidirectional counting of pedestrians by gender.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer vision technology, and in particular to a method and system for counting pedestrians by gender using dual cameras with overlapping domains at building entrances and exits. Background Art

[0002] The multi-camera gender-based pedestrian counting method mainly uses computer vision technology to detect the gender of pedestrians in videos shot by multiple cameras, and to track and count pedestrians appearing and moving in multiple fields of view in a bidirectional manner by gender, while also ensuring that pedestrians in the fields of view covered by multiple cameras are not counted repeatedly.

[0003] At present, domestic and foreign researchers have proposed some methods for people counting, which can be divided into the following categories:

[0004] The first method is to count people based on gates. Since this method is easily affected by the spatiotemporal constraints of gates and the interrelationships between gates, it is not widely used. For example, Xiang Ting et al. proposed to use AFC (Automatic Fare Collection System) card reader data to analyze the spatiotemporal characteristics of subway passenger flow, and based on the short-term passenger flow prediction model GA-LSTM, realize subway passenger flow prediction with a granularity of 10 minutes.

[0005] The second method is to count people based on infrared. This method is difficult to distinguish between human and non-human targets, so the false detection rate of the counted people will be high. In order to improve the detection rate of this method, Nie Qinqin used a dual-channel multi-beam active infrared intrusion detector to perceive the entry and exit behavior of people, and then completed the learning of the entry and exit behavior data through the LSTM neural network. The LSTM-based model for identifying the entry and exit behavior of people was obtained to solve the indoor counting of people in two-way traffic scenarios. Finally, the headcount was completed based on the identification results, which improved the detection rate.

[0006] The third method is to count people based on WIFI signals. Based on the mapping relationship between wireless signals and the number of people in the detection environment, Yuan Ruihe proposed a device-free people counting framework based on channel state information in WiFi signals. By extracting features and introducing machine learning algorithms, the complex population counting problem is transformed into a classification problem, and the detection and counting of people in indoor areas is achieved more accurately. However, the hardware equipment cost of this method is high and has limitations.

[0007] The fourth is to estimate the number of people based on passive radio frequency identification (RFID) tags. Han Ding et al. proposed an R# system to estimate the number of people. The system includes an RFID reader and some passive tags. The RFID reader periodically transmits radio frequency signals to identify all tags, and the tags simply respond to their IDs through the EPCglobal 1st generation 2 protocol. This method also has the problem of hardware cost and the problem of inaccurate results of people counting.

[0008] The fifth is the method of detecting and counting people based on computer vision counting. This method is based on the widespread installation and deployment of target cameras, and the accuracy of detection depends on the vision-based detection algorithm, which has good application prospects. For example, Wahyu Rahmaniar et al. proposed an improved real-time bidirectional people counting method for RGB-D cameras, which detects foreground pedestrians by removing the background, annotates the region of interest (ROI) according to the position of the detected person, tracks the detected person based on channel and spatial reliability, and counts the people who cross the line of interest (LOI) and the displacement distance is greater than 2m.

[0009] With the rapid development of computer vision and deep learning, methods for detecting and counting people based on computer vision counting have become a current research hotspot. In addition, as people pay more and more attention to public safety, video surveillance products are increasingly appearing in various public buildings and gradually entering people's lives. Due to the limited field of view of a single camera, the video surveillance of building entrances and exits is no longer a single camera. Two or more cameras are often installed at the entrances and exits of larger buildings to ensure more comprehensive coverage of every corner of the building. According to the camera's shooting field of view, multi-camera multi-pedestrian detection can be divided into two categories: non-overlapping and overlapping fields of view. Multi-camera multi-pedestrian detection counting based on non-overlapping fields of view does not need to consider the problem of counting people in the overlapping domain, which is relatively simple. The problem of pedestrian detection with overlapping fields of view is more complicated, and it is necessary to solve the problem of obtaining the overlapping domain and counting people in the overlapping domain.

[0010] As an indispensable basic information inside a building, the number, gender, and age of people significantly affect the safety and evacuation behavior of people in the building. Traditional pedestrian counting methods often only count the total number of people, without considering a more detailed attribute distinction of pedestrians. Due to the differences in motor ability, physiological cognition, and escape choice preferences brought about by pedestrian gender, different behaviors will occur in the three stages of an emergency, namely before, during, and after the occurrence of an emergency, and these behaviors have a certain impact on the efficiency and safety of emergency evacuation. Therefore, the counting of pedestrians by gender has more important practical significance for the formulation of emergency evacuation strategies and emergency guidance. At present, the widespread installation and deployment of video cameras has made people counting based on video images an important method. Larger buildings have wider entrances and exits, and two or more cameras are often installed to ensure more comprehensive coverage of every corner of the entrance and exit. Two or more cameras will result in overlapping camera fields of view, resulting in repeated detection of pedestrians. In order to avoid repeated counting of people, it is necessary to solve the problem of counting overlapping camera fields of view. There are few existing multi-camera pedestrian counting methods based on overlapping fields of view. Most of them do not count pedestrians by gender, and most of them are unidirectional detection, without combining the direction of movement to achieve bidirectional pedestrian counting.

[0011] At present, the research on pedestrian detection, single-camera pedestrian tracking and counting, and multi-camera pedestrian joint counting mainly focuses on pedestrians, ignoring the important impact of pedestrian attributes on emergency evacuation and other aspects, and lacks relevant research on detailed classification of pedestrian attributes such as gender. In addition, there is a lack of multi-category research on multi-cameras, and most of them consider a single category of pedestrians or vehicles.

[0012] The current pedestrian counting methods with overlapping domains of dual cameras have the following shortcomings: 1. The existing pedestrian counting methods with overlapping domains of dual cameras lack detailed classification of pedestrian attributes (such as gender), and the differences in movement ability and psychological tolerance brought about by pedestrian attributes are important factors that cannot be ignored in the study of emergency control such as evacuation. 2. The current research on pedestrian counting with overlapping domains of dual cameras is still insufficient in the overlapping domain acquisition method and the overlapping domain bidirectional motion pedestrian counting. Summary of the invention

[0013] The object of the present invention is to provide a method and system for counting pedestrians by gender using dual cameras with overlapping domains at building entrances and exits, so as to solve at least one technical problem existing in the above-mentioned background technology.

[0014] In order to achieve the above object, the present invention adopts the following technical solutions:

[0015] In a first aspect, the present invention provides a method for counting pedestrians by gender using dual cameras with overlapping domains, characterized in that it includes:

[0016] The overlapping area of ​​the first frame image of camera A and camera B is obtained by using the overlapping area acquisition algorithm;

[0017] The improved YOLOX-Tiny model is used to detect the gender of pedestrians in the video frames from the two cameras. The improved YOLOX-Tiny model introduces a lightweight attention mechanism CBAM in the output of BackBone and the upsampling and downsampling of Neck. The module consists of a channel attention module (CAM) and a spatial attention module (SAM). The channel attention module (CAM) is first used to compress the spatial dimension, giving a higher weight to the channel information that affects the final result in the feature map, that is, paying more attention to the "what" of the important information; the spatial attention module (SAM) is then used to compress the channel, giving a higher weight to the more important spatial position distribution information in the feature map, that is, paying more attention to the "where" of the important information. In this way, the filtering and refinement of feature extraction from the two dimensions of channel and space strengthens the ability to filter redundant information and obtain pedestrian gender feature information from it, while extracting feature information more effectively and concisely, thereby improving the ability to detect pedestrian gender when the posture or shooting angle changes;

[0018] The method combining ByteTrack and collision area counting is used to count the entry and exit of each video frame under the two cameras by gender. The ray method is introduced on the basis of the gender-based pedestrian entry and exit counting to judge each video frame and obtain the entry and exit count of pedestrians of different genders in the overlapped domain. The corresponding frame counting results under the two cameras are calculated using the following formula to obtain the joint counting result:

[0019]

[0020] Among them, C1 is the counting result of a certain category in the field of view of camera A, C2 is the counting result of a certain category in the field of view of camera B, and C A is the counting result of a category in the overlapping area of ​​camera A in camera B, C B is the counting result of a category in the overlapping area of ​​camera B in camera A. round() means The calculation result is rounded off.

[0021] Furthermore, the overlapping area of ​​the first frame images of camera A and camera B is acquired through the overlapping domain acquisition algorithm, including: using the first frame images of the two videos shot under the dual cameras as the input for acquiring the overlapping area, and extracting the feature points of the first frame image through the ORB algorithm; using the KNN algorithm to match the extracted feature points, and combining the RANSAC algorithm to filter out the wrongly matched feature point pairs; finally, based on the matched feature point pairs, the coordinate transformation is performed by solving the homography matrix to obtain the overlapping area.

[0022] Furthermore, the ORB (Oriented FAST and Rotated BRIEF) algorithm is used for feature extraction, which consists of the oFAST corner detection algorithm and the rBRIEF feature description method. First, the improved FAST algorithm, the oFAST corner detection algorithm, is used to extract feature points: a pixel point P in the image is selected, with point P as the center and 3 pixels as the radius, a circle is constructed, and the grayscale values ​​of the 16 adjacent pixels determined on the circumference are compared. If the grayscale values ​​of n consecutive pixels are greater or less than the grayscale value of point P, the center point P is considered to be a feature point, and this process is repeated until all feature points are detected. Then, the rBRIEF feature description algorithm is used to describe the feature point as a binary string, that is, n groups of pixel pairs p are selected in the neighborhood of a feature point. i and q i (i=1,2,…,n), compare the grayscale values ​​of each point pair; if I(p i )>I(q i ), a binary string of 1 is generated, otherwise 0; after all the point pairs are compared, a binary string descriptor of length n is generated.

[0023] Furthermore, the extracted feature points are matched using the KNN algorithm, that is, the Euclidean distance between a key point in image A1 and all key points in image A2 is calculated, and the two points with the smallest Euclidean distance are selected as a pair of successfully matched key point pairs; all key point pairs are obtained in turn, and finally filtered by a threshold.

[0024] Furthermore, the RANSAC algorithm is used to filter out incorrect matches, including: the RANSAC algorithm uses an iterative method to estimate the parameters of the mathematical model from a set of feature points containing erroneous data, that is, first randomly select k sampling points to estimate the model parameters, calculate the distance between the remaining points and the model, if the distance of a point is less than a threshold, the point is a non-noise point, and the most preserved non-noise points are obtained through iterative calculation, and finally the final estimated model parameters are obtained through the non-noise point set.

[0025] Furthermore, a method combining ByteTrack and collision area counting is used to count the entry and exit of each video frame under the two cameras by gender, including: the main idea of ​​collision area counting is to set two polygonal areas, entry and exit, as collision areas, and then determine whether the center point position of the detection frame in each frame is located in the set entry collision area or exit collision area; if the detection frame position of the current frame is in the entry collision area, and its id does not exist in the id list of the entry collision area, it will be stored in the id list of the entry collision area, and it will be determined whether it is in the id list of the exit collision area; then, the gender category of the target is determined, so that the target is determined to be entering, and the number of people entering the corresponding category is increased by one; similarly, the number of people leaving the corresponding category is obtained.

[0026] In a second aspect, the present invention provides a gender-based pedestrian counting system with dual cameras having overlapping domains, comprising:

[0027] An acquisition module, used for acquiring the overlapping area of ​​the first frame image of camera A and camera B by using an overlapping area acquisition algorithm;

[0028] The detection module is used to use the improved YOLOX-Tiny model to detect the gender of pedestrians in the video frames of the two cameras. The improved YOLOX-Tiny model introduces a lightweight attention mechanism CBAM in the output of BackBone and the upsampling and downsampling of Neck. The module consists of a channel attention module (CAM) and a spatial attention module (SAM). The channel attention module (CAM) is first used to perform average pooling and maximum pooling operations on the feature map in the spatial dimension, and then a shared multi-layer perceptron is used to perform dimensionality increase and dimensionality reduction operations. , add the results of the two parts to get the score of each channel, so that the model focuses more on the key information in the feature map, that is, "what it is"; then pass through the spatial attention module (SAM), that is, multiply each channel weight obtained by the channel attention module by the original feature map to get a new feature map as the input of the spatial attention module, perform global maximum pooling and global average pooling in the channel dimension, concatenate the results of global maximum pooling and global average pooling according to the channel, and obtain the spatial attention weight through 3x3 or 7x7 convolution operations, so that the model pays more attention to the spatial location of the key information, that is, "where it is". In this way, the filtering and refinement of feature extraction from the two dimensions of channel and space, while strengthening the ability to filter redundant information and obtain pedestrian gender feature information from it, more effectively and concisely extract feature information, thereby improving the ability to detect pedestrian gender when posture or shooting angle changes;

[0029] The counting module is used to count the entry and exit of each video frame under the two cameras by gender using a combination of ByteTrack and collision area counting. The ray method is introduced on the basis of the gender-based pedestrian entry and exit counting to judge each video frame and obtain the entry and exit count of pedestrians of different genders in the overlapped domain. The corresponding frame counting results under the two cameras are calculated using the following formula to obtain the joint counting result:

[0030]

[0031] Among them, C1 is the counting result of a certain category in the field of view of camera A, C2 is the counting result of a certain category in the field of view of camera B, and C A is the counting result of a category in the overlapping area of ​​camera A in camera B, C B is the counting result of a category in the overlapping area of ​​camera B in camera A. round() means The calculation result is rounded off.

[0032] In a third aspect, the present invention provides a non-transitory computer-readable storage medium, which is used to store computer instructions. When the computer instructions are executed by a processor, the method for counting pedestrians by gender using dual cameras with overlapping domains at the entrance and exit of a building as described in the first aspect is implemented.

[0033] In a fourth aspect, the present invention provides a computer device comprising a memory and a processor, wherein the processor and the memory communicate with each other, the memory stores program instructions executable by the processor, and the processor calls the program instructions to execute the method for counting pedestrians by gender using overlapping domains of dual cameras at building entrances and exits as described in the first aspect.

[0034] In a fifth aspect, the present invention provides an electronic device, comprising: a processor, a memory, and a computer program; wherein the processor is connected to the memory, and the computer program is stored in the memory. When the electronic device is running, the processor executes the computer program stored in the memory so that the electronic device executes instructions for implementing the method for counting gender-based pedestrians with overlapping domains of dual cameras at building entrances and exits as described in the first aspect.

[0035] Beneficial effects of the present invention: By using the pedestrian gender detection model and the tracking algorithm ByteTrack designed in the collision area, a method for counting pedestrians by gender is proposed to achieve dynamic bidirectional counting of pedestrians by gender. The overlapping area in the dual cameras is obtained, and the bidirectional dynamic counting of pedestrians by gender in the overlapping area is achieved by combining pedestrian gender detection, target tracking, and collision area counting. Through the joint counting method, the repeated counting part of the overlapping area is removed, and finally accurate bidirectional counting of pedestrians by gender at the entrance and exit of the building is achieved.

[0036] Additional advantages of the present invention will be more clearly given in the following description or learned through the practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.

[0038] Figure 1 This is a flowchart of the framework structure of the method for counting pedestrians by gender using dual cameras with overlapping domains according to an embodiment of the present invention.

[0039] Figure 2 This is a structural diagram of the improved YOLOX-Tiny pedestrian gender detection model described in an embodiment of the present invention.

[0040] Figure 3 This is a flow chart of the overlapping domain acquisition method according to an embodiment of the present invention.

[0041] Figure 4 Schematic diagram of the principle of dual-camera perspective transformation based on the homography matrix according to an embodiment of the present invention.

[0042] Figure 5 Schematic diagram of the principle of dual-camera perspective transformation based on the homography matrix according to an embodiment of the present invention.

[0043] Figure 6 This is a schematic diagram of determining the number of intersections between a pedestrian and a polygonal area using the ray method described in an embodiment of the present invention.

[0044] Figure 7 This is a schematic diagram of a video shot by two cameras placed in parallel according to an embodiment of the present invention. Figure 7 (a) is the picture taken by camera A; Figure 7 (b) is the picture taken by camera B. DETAILED DESCRIPTION

[0045] The embodiments of the present invention are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements with the same or similar functions. The embodiments described below by the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be interpreted as limiting the present invention.

[0046] It should be understood by those skilled in the art that unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by those skilled in the art to which this invention belongs.

[0047] It should also be understood that terms, such as those defined in commonly used dictionaries, should be understood to have a meaning consistent with that in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless as defined herein.

[0048] Those skilled in the art will appreciate that, unless otherwise stated, the singular forms "a", "an", "said" and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present invention refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements and / or groups thereof.

[0049] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. Different embodiments or examples described in this specification and features of different embodiments or examples may be combined and combined by those skilled in the art without contradiction.

[0050] To facilitate understanding of the present invention, the present invention is further explained below with reference to specific embodiments in conjunction with the accompanying drawings, and the specific embodiments do not constitute a limitation on the embodiments of the present invention.

[0051] Those skilled in the art should understand that the drawings are merely schematic diagrams of embodiments, and the components in the drawings are not necessarily necessary for implementing the present invention.

[0052] In order to realize accurate counting of pedestrians by gender in overlapping domains of dual cameras at building entrances and exits, the present invention proposes a method combining pedestrian gender detection, pedestrian tracking counting and joint counting of pedestrians in overlapping domains. Firstly, based on pedestrian gender detection, pedestrian tracking algorithm and collision area counting design method, dynamic bidirectional counting of pedestrians by gender at building entrances and exits is realized, then the overlapping visual field is acquired and the dynamic bidirectional counting of pedestrians by gender in the area is performed, and then the joint counting method is used to finally obtain the accurate bidirectional number of pedestrians by gender. The present invention provides a new method and technology for counting pedestrians by gender in overlapping domains of dual cameras at building entrances and exits. Aiming at the overlapping visual field situation, the present invention combines pedestrian gender detection, pedestrian tracking, collision area counting and joint counting of pedestrians in overlapping areas of dual cameras, takes pedestrians entering and exiting building entrances and exits as research objects, and proposes a method for counting pedestrians by gender in overlapping domains of dual cameras at building entrances and exits, which solves the problems of incomplete counting of single camera and repeated counting of overlapping domains of multiple cameras.

[0053] Example 1

[0054] In this embodiment 1, a gender-based pedestrian counting system with overlapping domains is first provided, including:

[0055] An acquisition module is used to acquire the overlapping area of ​​the first frame image of camera A and camera B by using an overlapping area acquisition algorithm;

[0056] The detection module is used to use the improved YOLOX-Tiny model to detect the gender of pedestrians in the video frames of the two cameras. The improved YOLOX-Tiny model introduces a lightweight attention mechanism CBAM in the output of BackBone and the upsampling and downsampling of Neck. The module consists of a channel attention module (CAM) and a spatial attention module (SAM). The channel attention module (CAM) is first used to perform average pooling and maximum pooling operations on the feature map in the spatial dimension, and then a shared multi-layer perceptron is used to perform dimensionality increase and dimensionality reduction operations. The results of the two parts are added together to get the score of each channel, so that the model can focus more on the key information in the feature map, that is, "what it is"; then it passes through the spatial attention module (SAM), that is, the new feature map obtained by multiplying the weight of each channel obtained by the channel attention module with the original feature map is used as the input of the spatial attention module, and global maximum pooling and global average pooling are performed in the channel dimension respectively. The results of global maximum pooling and global average pooling are concatenated according to the channel, and the spatial attention weight is obtained through 3×3 or 7×7 convolution operations, so that the model pays more attention to the spatial location of the key information, that is, "where it is". In this way, the filtering and refinement of feature extraction from the two dimensions of channel and space, while strengthening the ability to filter redundant information and obtain pedestrian gender feature information from it, more effectively and concisely extract feature information, thereby improving the ability to detect pedestrian gender when posture or shooting angle changes;

[0057] The counting module is used to count the entry and exit of each video frame under the two cameras by gender using a combination of ByteTrack and collision area counting; on the basis of the gender-based pedestrian entry and exit counting, the ray method is introduced to judge each video frame to obtain the entry and exit count of pedestrians of different genders in the overlapping domain; the corresponding frame counting results under the two cameras are combined for calculation to obtain the joint counting result.

[0058] In this embodiment, the above-mentioned system is used to implement a method for counting pedestrians by gender in overlapping domains. The method combines an improved pedestrian gender detection algorithm, a pedestrian collision area counting method, an overlapping domain acquisition method, and a pedestrian determination method in an overlapping domain, thereby achieving accurate bidirectional counting of pedestrians by gender in overlapping domains using dual cameras. The overall logical framework of the invention is as follows: Figure 1As shown. The framework mainly consists of three parts: the first part is the bidirectional dynamic counting of pedestrians entering and exiting by gender. This part will be realized by combining the ByteTrack tracking algorithm with the collision area counting method based on the improved YOLOX-Tiny pedestrian gender detection model. The second part is the bidirectional dynamic counting of pedestrians entering and exiting by gender in the overlapping area of ​​dual cameras. Based on the bidirectional dynamic counting method of pedestrians entering and exiting by gender, this part mainly completes the acquisition of overlapping domains and the determination of pedestrians in the overlapping domain, thereby realizing the bidirectional counting of pedestrians entering and exiting by gender in the overlapping area. The third part is to obtain the accurate number of bidirectional pedestrians through joint counting. This part finally realizes the dynamic counting of pedestrians by gender in the overlapping domain of dual cameras by performing mathematical operations on the bidirectional dynamic counting results of pedestrians by gender under the two cameras and the bidirectional dynamic counting results of pedestrians by gender in the overlapping domain.

[0059] The method comprises the following steps:

[0060] 1) Acquire the overlapping area of ​​the first frame image of camera A and camera B through the overlapping area acquisition algorithm;

[0061] 2) Use the improved YOLOX-Tiny model to detect the gender of pedestrians in the video frames from the two cameras;

[0062] 3) A method combining ByteTrack and collision area counting is used to count the entry and exit of each video frame under the two cameras by gender;

[0063] 4) Based on the pedestrian entry and exit counts by gender, the ray method is introduced to judge each video frame to obtain the pedestrian entry and exit counts of different genders in the obtained overlapping domain;

[0064] 5) Calculate the corresponding frame counting results under the two cameras using the formula to obtain the joint counting result.

[0065] The steps of this method can be specifically described as follows: the overlapping area of ​​the first frame image of camera A and camera B is obtained by using the overlapping domain acquisition algorithm; the gender of pedestrians is detected in the video frames of the two cameras using the improved YOLOX-Tiny model; the method combining ByteTrack and collision area counting is used to count the entry and exit of each video frame of the two cameras by gender; on the basis of the gender-based pedestrian entry and exit counting, the ray method is introduced to judge each video frame to obtain the entry and exit count of pedestrians of different genders in the obtained overlapping domain; the corresponding frame counting results of the two cameras are calculated using formula (8) to obtain the joint counting result.

[0066] In this embodiment, considering that the changes in shooting angles under different cameras at the entrances and exits of buildings and the changes in pedestrian postures may lead to inaccurate pedestrian gender detection, an improved model based on YOLOX-Tiny is proposed as a detector. This model introduces a lightweight attention mechanism CBAM in the output of BackBone and the upsampling and downsampling of Neck. This module is composed of CAM and SAM, which first passes through CAM and then SAM. While strengthening the ability to filter redundant information and obtain pedestrian gender feature information from it, it can more effectively and concisely extract feature information, thereby improving the ability to detect pedestrian gender when posture or shooting angle changes. The structure of the improved YOLOX-Tiny pedestrian gender detection model is as follows: Figure 2 As shown in the figure, the input image is first unified into a size of 416*416 and input into the Foucus structure, and the channel is expanded through slicing operations and interval pixel extraction to increase the calculation speed; then, the feature is extracted in the backbone network composed of a series of CBS structures (convolution, normalization and activation) and CSP structures; then the extracted three scale features are input into the neck for fusion, and the CBAM attention mechanism is introduced in the feature fusion learning stage, so that the model focuses more on the effective information about pedestrians and improves the accuracy of the model; finally, the classification and regression tasks are realized through the YOLO Head detection head structure to obtain the final prediction result.

[0067] In this embodiment, the overlapping area of ​​the first frame image of camera A and camera B is obtained by an overlapping domain acquisition algorithm, including: using the first frame image of the two videos shot under the dual cameras as the input for obtaining the overlapping area, extracting the feature points of the first frame image by the ORB algorithm; using the KNN algorithm to match the extracted feature points, combining with the RANSAC algorithm to filter out the wrongly matched feature point pairs; finally, based on the matched feature point pairs, coordinate transformation is performed by solving the homography matrix to obtain the overlapping area. Specifically, with the reduction of the cost of monitoring equipment and the improvement of people's safety awareness, considering that in real life, most of the dual cameras installed at the entrances and exits of larger buildings such as schools and shopping malls have a certain overlapping field of view, if the results of the two single camera counts are simply added, it is bound to lead to repeated counting of pedestrians entering and leaving. Therefore, the present invention obtains the overlapping area under the dual cameras, so as to perform a more accurate dual camera pedestrian entry and exit joint counting later. This embodiment proposes an overlapping domain acquisition method that integrates feature point extraction, matching, screening and coordinate transformation. Considering that the dual cameras at the entrances and exits of buildings are usually fixedly installed, the captured video background is static, and the overlapping fields of view under the dual cameras will not change, the first frame of the two videos taken by the dual cameras is used as the input for obtaining the overlapping area in this embodiment. The feature points are extracted by the ORB algorithm, and the KNN algorithm and the RANSAC algorithm are combined to filter out false matches and improve the accuracy of feature point matching. Finally, the overlapping area is obtained by solving the homography matrix, which improves the recognition accuracy of feature points and the accuracy of matching, thereby obtaining a more accurate overlapping area. The framework diagram of the method is shown below: Figure 3 shown.

[0068] ORB (Oriented FAST and Rotated BRIEF) feature extraction consists of the oFAST corner detection algorithm and the rBRIEF feature description method. First, the improved FAST algorithm, the oFAST corner detection algorithm, is used to extract feature points. That is, a pixel point P in the image is selected, with P as the center and 3 pixels as the radius, a circle is constructed, and the grayscale values ​​of the 16 adjacent pixels on the circumference are compared. If there are n (n is generally set to 12) consecutive pixels with grayscale values ​​greater or less than the grayscale value of P, the center point P is considered to be a feature point. Repeat this process until all feature points are detected. The centroid and direction calculation formulas of feature points are shown in equations (1) and (2), respectively.

[0069]

[0070]

[0071] The calculation formula of the moment is shown in formula (3).

[0072] m jk =∑ jk∈γ x j y k I(x,y) (3)

[0073] Then, the extracted feature points are described as a binary string using the rBRIEF feature description algorithm, that is, n groups of pixel pairs p are selected in the neighborhood of a feature point. i and q i (i=1,2,…,n), compare the grayscale values ​​of each point pair; if I(p i )>I(q i ), a binary string of 1 is generated if the point pair is equal to 0, otherwise 0 is generated; after all the point pairs are compared, a binary string descriptor of length n is generated. In addition, the noise resistance and rotation invariance of the feature descriptor are also increased.

[0074] Next, the KNN (K-Nearest Neighbor) algorithm, which has a simple and intuitive matching principle, is used to match the feature points extracted by the ORB algorithm, that is, the Euclidean distance between a key point in image A1 and all key points in image A2 is calculated, and the two points with the smallest Euclidean distance are selected as a pair of key point pairs that are successfully matched. All key point pairs are obtained in sequence, and finally filtered by a threshold. Considering that there may be a part of wrong matches in the feature point pairs that are successfully matched by the KNN method, the RANSAC (Random Sample Consensus) algorithm is used to filter out wrong matches. The RANSAC algorithm estimates the parameters of the mathematical model from a set of feature points containing erroneous data in an iterative manner, that is, first randomly select k sampling points to estimate the model parameters, calculate the distance between the remaining points and the model, if the distance of a point is less than the threshold, the point is a non-noise point, and the most non-noise points are obtained by iterative calculation, and finally the final estimated model parameters are obtained through the non-noise point set.

[0075] Finally, the homography matrix is ​​used for coordinate transformation between the two cameras. The principle of dual camera perspective transformation based on the homography matrix H is as follows: Figure 4 shown.

[0076] The coordinates of the same target in the images taken from two perspectives are (x i ,y i ,1) and (x' i ,y' i ,1), the homography matrix H is a 3*3 orthogonal matrix, then:

[0077]

[0078] Among them, h 33is the normalization factor, which is generally set to 1. By using formula (4), we can get x' i and y' i :

[0079]

[0080] The linear equations can be obtained by calculating the coordinates of n pairs of feature points in the dual cameras through equations (5) and (6):

[0081]

[0082] By using the singular value decomposition method to decompose the matrix A in equation (7), the homography matrix H can be obtained. After obtaining the homography matrix H, the overlapping domain areas of the video frame images under the perspectives of the two cameras can be obtained through projection transformation.

[0083] In this embodiment, a method combining ByteTrack and collision area counting is used to count the entry and exit of each video frame under the two cameras by gender, including: the main idea of ​​collision area counting is to set two polygonal areas of entry and exit as collision areas, and then determine whether the center point position of the detection frame in each frame is located in the set entry collision area or exit collision area; if the detection frame position of the current frame is in the entry collision area, and its id does not exist in the id list of the entry collision area, then it is stored in the id list of the entry collision area, and it is determined whether it is in the id list of the exit collision area; then, the gender category to which the target belongs is determined, so that the target is determined to be an entry, and the number of people entering the corresponding category is increased by one; similarly, the number of people leaving the corresponding category is obtained. Specifically, in order to realize the bidirectional dynamic counting of pedestrians entering and exiting the building entrance and exit by gender, this embodiment proposes a collision area counting method based on the ByteTrack algorithm, and the pseudo code of the process is shown in Table 1. The main idea of ​​collision area counting is to set two polygonal areas, entry and exit, as collision areas, and then determine whether the center point of the detection frame in each frame is located in the set entry collision area or exit collision area; if the detection frame position of the current frame is in the entry collision area, and its id does not exist in the id list of the entry collision area, it will be stored in the id list of the entry collision area, and it will be determined whether it is in the id list of the exit collision area. After that, the gender category of the target is determined, so that the target is determined to be an entry, and the number of people entering the corresponding category is increased by one. Similarly, the number of people going out of the corresponding category can be obtained. In particular, this embodiment takes into account the false detection or missed detection of a certain frame in the pedestrian detection algorithm and the erroneous tracking in the tracking algorithm, which will lead to incorrect or no counting of pedestrians when passing through the entry and exit lines. In the code implementation, a narrower polygonal area is used instead of the line segment of the entry and exit lines, which can greatly improve the accuracy of the two-way counting of pedestrians by gender.

[0084] Table 1 Pseudo code of the collision area counting part in ByteTrack

[0085]

[0086]

[0087] Based on obtaining the overlapping area, there are two methods to solve the problem of joint counting of pedestrians by gender for building entrances and exits with overlapping domains of dual cameras. One is to add the pedestrian counting result of camera A to the pedestrian counting result of camera B, and subtract the pedestrian counting result of camera A in the overlapping area of ​​camera B; the other is to add the pedestrian counting result of camera A to the pedestrian counting result of camera B, and subtract the pedestrian counting result of camera B in the overlapping area of ​​camera A.

[0088] In this embodiment, considering the false detection and wrong counting caused by the change of pedestrian posture due to the change of camera angle under dual cameras, the counting result of the overlapping area of ​​camera A in camera B and the counting result of the overlapping area of ​​camera B in camera A may not be exactly the same. Therefore, the present invention uses the mean of the counting results of the two overlapping areas as the minuend to reduce the error caused by the wrong counting. Figure 5 As shown, the field of view of camera A under dual cameras is area R1, the overlapping area of ​​camera A in camera B is area O1, the field of view of camera B is area R2, and the overlapping area of ​​camera B in camera A is area O2. Therefore, the counting result of a certain category under dual cameras is shown in formula (8).

[0089]

[0090] Among them, C1 is the counting result of a certain category in the field of view R1 of camera A, C2 is the counting result of a certain category in the field of view R2 of camera B, and C A is the counting result of a certain category in the O1 area, C B is the counting result of a category in the O2 area, and round() means The calculation result is rounded off.

[0091] The present invention implements the counting of each category within the field of view of camera A or camera B by combining ByteTrack in Section 4.3.2 with collision area counting. Therefore, the focus of the joint counting of pedestrians by gender with overlapping domains of dual cameras is the counting of each category within the overlapping area. Therefore, the present invention introduces the ray method to determine whether the pedestrian is within the overlapping area. The principle is as follows Figure 6As shown, a ray is drawn from the center point of the pedestrian detection frame to the overlapping area. If the ray has an odd number of intersections with the boundary of the overlapping area, the pedestrian is located in the overlapping area. If it is an even number of intersections, the pedestrian is located outside the overlapping area.

[0092] In this embodiment, in order to study the feasibility and effectiveness of the above-mentioned method, dual cameras are placed in parallel at the entrance of the campus cafeteria to shoot videos for verification and compare and evaluate their performance. Figure 7 As shown. The training data for pedestrian gender detection is a self-made dataset, and the pedestrian tracking algorithm is ByteTrack. The accuracy (P) is used to measure the accuracy of the gender-based pedestrian counting method with overlapping dual cameras. The calculation formula is shown in formula (9):

[0093]

[0094] Among them, N pre is the sum of the counting results of each category obtained using the joint counting method proposed in the present invention, N true It is the sum of the actual count results of each category in the video.

[0095] Since a narrower polygonal area is used instead of a line design, in order to explore the impact of different area widths on the gender-based pedestrian counting of dual cameras with overlapping domains, the pedestrian gender detection model used in this embodiment is the improved YOLOX-Tiny, the tracking algorithm is ByteTrack, and the calculation of the joint counting result uses formula (8). When the polygonal area positions are set to be the same, different pixel value widths are set, and multiple groups of comparative experiments are conducted, and the results are shown in Table 2. Through experiments, it is not difficult to find that: when the pixel value is 10, its joint counting result is more accurate, and the ability to deal with inaccurate counting problems caused by missed detection or false detection is better, so the width of the impact area in subsequent experiments is 10 pixels. At the same time, by comparing areas with different pixel widths, it can be found that setting the impact area too narrow will result in the inability to deal with problems such as missed detection; setting the impact area too wide will cause pedestrians to always be in the entry line area or the exit line area, and it is impossible to determine the entry and exit direction, resulting in incorrect counting results.

[0096] Table 2 Performance comparison of dual-camera joint counting under different impact area widths

[0097] Different impact area widths (unit: pixel) Female-out Famle-in Male-out Male-in P True 16 12 51 17 - 1 1 1 6 3 10.19% 5 16 2 24 21 65.63% 10 18 11 45 24 97.9% 40 14 9 51 37 97.2% 50 27 15 49 27 77%

[0098] In order to further demonstrate the superiority of the model proposed in this study in the counting performance of building entrances and exits. In this embodiment, two different models, YOLOX-Tiny+ByteTrack+collision area+overlapping domain counting and YOLOX-Tiny-CBAM+ByteTrack+collision area+overlapping domain counting, are used to discuss the counting results of the captured video. Compared with the original YOLOX-Tiny gender detection model + ByteTrack+collision area + overlapping domain algorithm, the YOLOX-Tiny-CBAM+ByteTrack+collision area+overlapping domain model proposed in this paper has higher counting performance. It is proved that the counting model proposed in this study not only has excellent performance, but also has good robustness, which alleviates the phenomenon of false detection and missed detection.

[0099] Table 3 Performance comparison of dual-camera joint counting under different models

[0100]

[0101] In summary, in this embodiment, the improved YOLOX-Tiny pedestrian gender detection method, pedestrian tracking algorithm and collision area counting are combined to achieve gender-based bidirectional dynamic counting of pedestrians entering and exiting; the dual-camera overlapping domain acquisition method and the pedestrian determination method in the overlapping domain are introduced to achieve gender-based bidirectional dynamic counting of pedestrians entering and exiting in the overlapping domain of the dual cameras. Through mathematical operations on the bidirectional counting results of the corresponding video frames of the two cameras and the bidirectional counting results of pedestrians in the overlapping domain, repeated counting of pedestrians in the overlapping domain of the dual cameras is avoided.

[0102] Example 2

[0103] This embodiment 2 provides a non-transitory computer-readable storage medium, which is used to store computer instructions. When the computer instructions are executed by a processor, the method for counting pedestrians by gender with overlapping domains of dual cameras at building entrances and exits as described above is implemented. The method includes:

[0104] The overlapping area of ​​the first frame image of camera A and camera B is acquired through the overlapping domain acquisition algorithm; the improved YOLOX-Tiny model is used to detect the gender of pedestrians in the video frames of the two cameras respectively; the method combining ByteTrack and collision area counting is used to count the entry and exit of pedestrians by gender in each video frame of the two cameras respectively; on the basis of the gender-based pedestrian entry and exit counting, the ray method is introduced to judge each video frame to obtain the entry and exit count of pedestrians of different genders in the acquired overlapping domain; the corresponding frame counting results of the two cameras are calculated using the formula to obtain the joint counting result.

[0105] Example 3

[0106] This embodiment 3 provides a computer device, including a memory and a processor, the processor and the memory communicate with each other, the memory stores program instructions that can be executed by the processor, the processor calls the program instructions to execute the above-mentioned method for counting pedestrians by gender with overlapping domains of dual cameras at building entrances and exits, the method comprising:

[0107] The overlapping area of ​​the first frame image of camera A and camera B is acquired through the overlapping domain acquisition algorithm; the improved YOLOX-Tiny model is used to detect the gender of pedestrians in the video frames of the two cameras respectively; the method combining ByteTrack and collision area counting is used to count the entry and exit of pedestrians by gender in each video frame of the two cameras respectively; on the basis of the gender-based pedestrian entry and exit counting, the ray method is introduced to judge each video frame to obtain the entry and exit count of pedestrians of different genders in the acquired overlapping domain; the corresponding frame counting results of the two cameras are calculated using the formula to obtain the joint counting result.

[0108] Example 4

[0109] This embodiment 4 provides an electronic device, including: a processor, a memory, and a computer program; wherein the processor is connected to the memory, the computer program is stored in the memory, and when the electronic device is running, the processor executes the computer program stored in the memory, so that the electronic device executes instructions for implementing the above-mentioned method for counting pedestrians by gender with overlapping domains of dual cameras at building entrances and exits, the method comprising:

[0110] The overlapping area of ​​the first frame image of camera A and camera B is acquired through the overlapping domain acquisition algorithm; the improved YOLOX-Tiny model is used to detect the gender of pedestrians in the video frames of the two cameras respectively; the method combining ByteTrack and collision area counting is used to count the entry and exit of pedestrians by gender in each video frame of the two cameras respectively; on the basis of the gender-based pedestrian entry and exit counting, the ray method is introduced to judge each video frame to obtain the entry and exit count of pedestrians of different genders in the acquired overlapping domain; the corresponding frame counting results of the two cameras are calculated using the formula to obtain the joint counting result.

[0111] In summary, the gender-based pedestrian counting method with overlapping domains described in the embodiment of the present invention realizes gender-based bidirectional dynamic counting of pedestrians entering and exiting by combining the improved YOLOX-Tiny pedestrian gender detection method, pedestrian tracking algorithm and collision area counting; introduces a dual-camera overlapping domain acquisition method and a pedestrian determination method in the overlapping domain to realize gender-based bidirectional dynamic counting of pedestrians entering and exiting in the overlapping domain of the dual cameras. Through mathematical operations on the bidirectional counting results of the corresponding video frames of the two cameras and the bidirectional counting results of pedestrians in the overlapping domain, repeated counting of pedestrians in the overlapping domains of the dual cameras is avoided.

[0112] The present invention takes into account the important impact of the differences in athletic ability and psychological differences caused by the gender of pedestrians on the behavior of pedestrians in emergency situations, and proposes a scientific and effective method for counting pedestrians by gender using dual cameras with overlapping domains at the entrances and exits of buildings. The method combines pedestrian gender detection, overlapping domain acquisition, and collision area counting methods to improve the accuracy of gender-based pedestrian counting using dual cameras with overlapping domains, while reducing the difficulty of implementing the gender-based pedestrian counting method using dual cameras with overlapping domains, providing an effective method for counting the number of pedestrians entering and exiting buildings by gender, and providing a scientific data basis for resource planning and the formulation of emergency strategies related to pedestrians. Different from the existing research on tracking and counting a single category in a video with multiple cameras or performing joint counting of a single category on images taken by two cameras, the present invention takes into account the gender of pedestrians and the two-way direction of pedestrian entry and exit, thereby realizing the bidirectional counting of gender-based pedestrian entry and exit using dual cameras with overlapping domains. Different from the existing research that achieves cross-camera detection or tracking of pedestrians through re-identification and other technologies, the present invention takes into account the background invariance under fixed cameras and adopts a method of jointly counting the counting results in the overlapping domain and the counting results in the non-overlapping domain, which more simply and accurately solves the problem of gender-based pedestrian counting in overlapping domains of dual cameras.

[0113] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0114] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0115] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0116] These computer program instructions can also be loaded onto a computer or other programmable data processing device, and a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0117] Although the above describes the specific implementation mode of the present invention in conjunction with the accompanying drawings, it is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art without creative work on the basis of the technical solution disclosed in the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for counting pedestrians by gender using dual cameras with overlapping domains, characterized in that: include: The overlapping area of ​​the first frame image of camera A and camera B is obtained by using the overlapping area acquisition algorithm; The improved YOLOX-Tiny model is used to detect the gender of pedestrians in the video frames of the two cameras. The improved YOLOX-Tiny model introduces a lightweight attention mechanism CBAM in the output of BackBone and the upsampling and downsampling of Neck. The lightweight attention mechanism CBAM consists of a channel attention module and a spatial attention module. The channel attention module is used to perform average pooling and maximum pooling operations on the obtained feature map in the spatial dimension, and then perform dimension upscaling and dimension downscaling operations through a shared multi-layer perceptron. The results of the two parts are added together to obtain the score of each channel, so that the model focuses more on the key information in the feature map. The spatial attention module is used to multiply the weight of each channel obtained by the channel attention module with the original feature map to obtain a new feature map as the input of the spatial attention module, perform global maximum pooling and global average pooling in the channel dimension, and splice the results of global maximum pooling and global average pooling according to the channel, and obtain the spatial attention weight through convolution operation, so that the model pays more attention to the spatial position of the key information. The method combining ByteTrack and collision area counting is used to count the entry and exit of each video frame under the two cameras by gender. The ray method is introduced on the basis of the gender-based pedestrian entry and exit counting to judge each video frame and obtain the entry and exit count of pedestrians of different genders in the overlapped domain. The corresponding frame counting results under the two cameras are calculated using the following formula to obtain the joint counting result: Among them, C1 is the counting result of a certain category in the field of view of camera A, C2 is the counting result of a certain category in the field of view of camera B, and C A is the counting result of a category in the overlapping area of ​​camera A in camera B, C B is the counting result of a category in the overlapping area of ​​camera B in camera A. round() means The calculation result is rounded off.

2. The method for counting pedestrians by gender using dual cameras with overlapping domains according to claim 1, characterized in that: The overlapping area of ​​the first frame image of camera A and camera B is obtained by the overlapping domain acquisition algorithm, including: using the first frame image of the two videos shot by the dual cameras as the input for obtaining the overlapping area, extracting the feature points of the first frame image by the ORB algorithm; using the KNN algorithm to match the extracted feature points, combining the RANSAC algorithm to filter out the wrongly matched feature point pairs; finally, based on the matched feature point pairs, coordinate transformation is performed by solving the homography matrix to obtain the overlapping area.

3. The method for counting pedestrians by gender using dual cameras with overlapping domains according to claim 2, characterized in that: The improved FAST algorithm is used to extract feature points. First, a pixel point P in the image is selected, and a circle is constructed with point P as the center and 3 pixels as the radius. The grayscale values ​​of the 16 adjacent pixels on the circumference are compared. If the grayscale values ​​of n consecutive pixels are greater or less than the grayscale value of point P, the center point P is considered to be a feature point. This process is repeated until all feature points are detected.

4. The method for counting pedestrians by gender using dual cameras with overlapping domains according to claim 2, characterized in that: The rBRIEF feature description algorithm is used to describe the feature point as a binary string, that is, n groups of pixel pairs p are selected in the neighborhood of a feature point. i and q i , i = 1, 2, ..., n, compare the gray value of each point pair; if I (p i )>I(q i ), a binary string of 1 is generated, otherwise 0; after all the point pairs are compared, a binary string descriptor of length n is generated.

5. The method for counting pedestrians by gender using dual cameras with overlapping domains according to claim 2, characterized in that: The extracted feature points are matched using the KNN algorithm, that is, the Euclidean distance between a key point in image A1 and all key points in image A2 is calculated, and the two points with the smallest Euclidean distance are selected as a pair of key point pairs with successful matching; all key point pairs are obtained in turn, and finally filtered by the threshold.

6. The method for counting pedestrians by gender using dual cameras with overlapping domains according to claim 5, characterized in that: The RANSAC algorithm is used to filter out incorrect matches, including: the RANSAC algorithm uses an iterative method to estimate the parameters of the mathematical model from a set of feature points containing erroneous data, that is, first randomly select k sampling points to estimate the model parameters, calculate the distance between the remaining points and the model, and if the distance of a point is less than a threshold, the point is a non-noise point. The most non-noise points are obtained through iterative calculation, and finally the final estimated model parameters are obtained through the non-noise point set.

7. The method for counting pedestrians by gender using dual cameras with overlapping domains according to claim 1, characterized in that: The method combining ByteTrack and collision area counting is used to count the entry and exit of each video frame under the two cameras by gender, including: the main idea of ​​collision area counting is to set two polygonal areas, entry and exit, as collision areas, and then determine whether the center point of the detection frame in each frame is located in the set entry collision area or exit collision area; if the detection frame position of the current frame is in the entry collision area, and its id does not exist in the id list of the entry collision area, it will be stored in the id list of the entry collision area, and it will be determined whether it is in the id list of the exit collision area; then, the gender category of the target is determined, so that the target is determined to be an entry, and the number of people entering the corresponding category is increased by one; similarly, the number of people leaving the corresponding category is obtained.

8. A gender-based pedestrian counting system with dual cameras and overlapping fields, characterized in that: include: An acquisition module is used to acquire the overlapping area of ​​the first frame image of camera A and camera B by using an overlapping area acquisition algorithm; The detection module is used to use the improved YOLOX-Tiny model to detect the gender of pedestrians in the video frames of the two cameras respectively; wherein, the improved YOLOX-Tiny model introduces a lightweight attention mechanism CBAM in the output of BackBone and the upsampling and downsampling of Neck. The lightweight attention mechanism CBAM consists of a channel attention module and a spatial attention module. The channel attention module is used to perform average pooling and maximum pooling operations on the obtained feature map in the spatial dimension, and then perform dimension increase and dimension reduction operations through a shared multi-layer perceptron. The results of the two parts are added together to obtain the score of each channel, so that the model focuses more on the key information in the feature map; the spatial attention module is used to use the new feature map obtained by multiplying each channel weight obtained by the channel attention module with the original feature map as the input of the spatial attention module, perform global maximum pooling and global average pooling in the channel dimension, splice the results of global maximum pooling and global average pooling according to the channel, and obtain the spatial attention weight through convolution operation, so that the model pays more attention to the spatial position of the key information; The counting module is used to count the entry and exit of each video frame under the two cameras by gender using a combination of ByteTrack and collision area counting. The ray method is introduced on the basis of the gender-based pedestrian entry and exit counting to judge each video frame and obtain the entry and exit count of pedestrians of different genders in the overlapped domain. The corresponding frame counting results under the two cameras are calculated using the following formula to obtain the joint counting result: Among them, C1 is the counting result of a certain category in the field of view of camera A, C2 is the counting result of a certain category in the field of view of camera B, and C A is the counting result of a category in the overlapping area of ​​camera A in camera B, C B is the counting result of a category in the overlapping area of ​​camera B in camera A. round() means The calculation result is rounded off.

9. A computer device, characterized in that: It includes a memory and a processor, the processor and the memory communicate with each other, the memory stores program instructions that can be executed by the processor, and the processor calls the program instructions to execute the gender-based pedestrian counting method with overlapping domains of dual cameras as described in any one of claims 1-7.

10. An electronic device, characterized in that: include: A processor, a memory and a computer program; wherein the processor is connected to the memory, the computer program is stored in the memory, and when the electronic device is running, the processor executes the computer program stored in the memory so that the electronic device executes instructions for implementing the method for counting pedestrians by gender with overlapping domains of dual cameras as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Male and female customer flow statistical method

    CN106778637A

  • Pedestrian image search algorithm based on PTGAN regional difference and deep neural network

    CN110688512A