Pedestrian attribute recognition method and system based on GCN, medium and electronic equipment
By encoding pedestrian trajectory data to generate graph structure data and utilizing the GCN network model, the problem of visual algorithms being unable to identify pedestrian occupational attributes in different scenarios is solved, achieving accurate identification and versatility in different scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- WINNERYUN (SHANGHAI DATA SERVICE CO LTD
- Filing Date
- 2022-09-20
- Publication Date
- 2026-04-17
AI Technical Summary
In existing technologies, visual algorithms are difficult to generalize and apply in different scenarios, and cannot identify the occupational attributes of pedestrians who are not dressed in accordance with regulations, especially food delivery and courier workers.
By acquiring pedestrian trajectory data, a two-dimensional matrix is used to encode the stopping location, pedestrian trajectory, and stopping time to generate graph structure data, which is then input into a trained GCN network model for attribute recognition.
It achieves accurate identification of pedestrian occupational attributes in different scenarios, avoids the need for model retraining due to changes in clothing, and improves the universality and accuracy of recognition.
Smart Images

Figure CN115482584B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data analysis technology, and in particular to a pedestrian attribute recognition method, system, medium, and electronic device based on GCN. Background Technology
[0002] With the rapid economic development and advancements in artificial intelligence, offline businesses such as supermarkets, communities, venues, and parks are increasingly focusing on customer flow information to adapt to the demands of the times and pursue sustainable benefits. This customer flow information is then used to differentiate between customers and irrelevant foot traffic, such as cleaning staff, security guards, employees, and delivery / courier personnel, based on pedestrian attributes.
[0003] Common methods on the market primarily rely on visual information to identify attributes based on clothing and accessories. However, in real-world applications, two problems arise: First, uniformity in attire is difficult to achieve; clothing worn by individuals with the same attribute can vary significantly across different scenarios. This makes it difficult for image-based visual algorithms to generalize, requiring dedicated recognition models for different scenarios. Second, situations where uniforms are not worn are common. In real-world scenarios, individuals may not be dressed as required, such as delivery drivers not wearing designated uniforms, riders removing their helmets, or companies lacking dress codes. Visual algorithms are unable to identify these various situations. Summary of the Invention
[0004] In view of the shortcomings of the prior art described above, the purpose of this invention is to provide a pedestrian attribute recognition method, system, medium and electronic device based on GCN, to solve the problem that the prior art cannot identify the occupational attributes of pedestrians.
[0005] To achieve the above and other related objectives, this invention provides a pedestrian attribute recognition method based on a Geographic Network (GCN). The method includes: acquiring trajectory data of a target pedestrian, wherein the trajectory data includes at least a stopping location, a pedestrian trajectory, and a stopping time; encoding the trajectory data based on a preset encoding rule, wherein the encoding rule uses a preset two-dimensional matrix to encode the stopping location, the pedestrian trajectory, and the stopping time; representing the encoded trajectory data in a graphical form to obtain graph-structured data; and inputting the graph-structured data into a trained GCN network model for attribute recognition to obtain pedestrian attributes corresponding to the target pedestrian.
[0006] In one embodiment of the present invention, acquiring the trajectory data of the target pedestrian includes:
[0007] The locations and durations of stay for the target pedestrians are collected in chronological order.
[0008] Based on the location and duration of stay, and combined with the natural time sequence, the pedestrian trajectory corresponding to the target pedestrian is obtained;
[0009] The trajectory data is obtained based on the location of stay, the time of stay, and the pedestrian trajectory.
[0010] In one embodiment of the present invention, the location of stay is encoded using a two-dimensional matrix L, including:
[0011] The row vectors of the two-dimensional matrix L are obtained based on the preset location numbers;
[0012] The column vectors of the two-dimensional matrix L are obtained based on the location type and floor information.
[0013] In one embodiment of the present invention, encoding the pedestrian trajectory using a two-dimensional matrix T includes:
[0014] The first row of the two-dimensional matrix T is based on the location number corresponding to the starting point of the target pedestrian, and the second row of the two-dimensional matrix T is based on the location number corresponding to the arrival point of the target pedestrian.
[0015] The natural time sequence corresponding to each segment of the pedestrian trajectory is used as the column vector of the two-dimensional matrix T.
[0016] In one embodiment of the present invention, the dwell time is encoded using a two-dimensional matrix S, including:
[0017] The dwell time corresponding to the starting point of the pedestrian trajectory is used as the first row of the two-dimensional matrix S, and the dwell time corresponding to the arrival point of the pedestrian trajectory is used as the second row of the two-dimensional matrix S;
[0018] The number of trajectory segments based on the pedestrian trajectory is used as the column vector of the two-dimensional matrix S.
[0019] In one embodiment of the present invention, the step of expressing the encoded trajectory data in a graphical form to obtain graph structure data includes:
[0020] The graph structure data G is obtained based on the two-dimensional matrices L, T, and S, wherein...
[0021] The two-dimensional matrix L is used as a node of the graph structure data;
[0022] The two-dimensional matrix T is used as the edge of the graph structure data;
[0023] The two-dimensional matrix S is used as the edge attribute of the graph structure data.
[0024] In one embodiment of the present invention, the training steps of the GCN network model include:
[0025] Acquire training data and divide the training data into a training set and a test set based on a preset ratio;
[0026] The training set is randomly input into a preset GCN network in batches for iterative training, and the model accuracy of each batch of network models is tested using the test set.
[0027] Training stops when the number of iterations reaches a preset threshold, and the network model with the highest accuracy is selected as the trained GCN network model.
[0028] To achieve the above and other related objectives, the present invention provides the aforementioned pedestrian attribute recognition system based on GCN, the system comprising:
[0029] The acquisition module is used to acquire the trajectory data of the target pedestrian, wherein the trajectory data includes at least the stopping location, the pedestrian trajectory, and the stopping time;
[0030] An encoding module is used to encode the trajectory data based on a preset encoding rule, wherein the encoding rule is to encode the stopping location, the pedestrian trajectory, and the stopping time using a preset two-dimensional matrix;
[0031] The processing module is used to express the encoded trajectory data in a graphical form to obtain graph structure data;
[0032] The recognition module is used to input the graph structure data into the trained GCN network model for attribute recognition, and obtain the pedestrian attributes corresponding to the target pedestrian.
[0033] To achieve the above and other related objectives, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the GCN-based pedestrian attribute recognition method.
[0034] To achieve the above and other related objectives, the present invention provides the aforementioned electronic device, comprising: a processor and a memory; wherein the memory is used to store a computer program, and the processor is used to load and execute the computer program, so that the electronic device executes the GCN-based pedestrian attribute recognition method.
[0035] As described above, the pedestrian attribute recognition method, system, medium, and electronic device based on GCN of the present invention can identify pedestrian attributes based on trajectory, determine their identity, and refine passenger flow data. Compared with traditional methods based on visual judgment, when the target pedestrian is wearing obviously professional clothing, the visual method cannot be used to judge and identify them, but the method disclosed in this application can effectively identify this situation. Attached Figure Description
[0036] Figure 1 The diagram shows the method steps of the pedestrian attribute recognition method based on GCN in one embodiment of the present invention;
[0037] Figure 2 The diagram shows the method steps of the pedestrian attribute recognition method based on GCN in another embodiment of the present invention;
[0038] Figure 3 The diagram shows a trajectory in one embodiment of the pedestrian attribute recognition method based on GCN of the present invention.
[0039] Figure 4 The diagram shows a schematic of the GCN network structure in one embodiment of the pedestrian attribute recognition method based on GCN of the present invention.
[0040] Figure 5 The diagram shown is a structural schematic of a pedestrian attribute recognition system based on GCN according to an embodiment of the present invention.
[0041] Figure 6 The diagram shown is a structural schematic of an electronic device according to an embodiment of the present invention.
[0042] Component designation explanation
[0043] Steps S11 to S14
[0044] Steps S21 to S23
[0045] 50 Pedestrian Attribute Recognition System Based on GCN
[0046] 51 Acquisition Module
[0047] 52 Encoding Module
[0048] 53 Processing Module
[0049] 54 Recognition Module Detailed Implementation
[0050] The following specific examples 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. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that, unless otherwise specified, the following embodiments and features described therein can be combined with each other.
[0051] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Therefore, the drawings only show the components related to the present invention and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.
[0052] This application proposes using Graph Convolutional Networks (GCNs) to analyze pedestrian trajectories, which can effectively identify the occupational attributes of pedestrians. This method has important significance for passenger flow information analysis.
[0053] Please see Figure 1 In one embodiment of the invention, the pedestrian attribute recognition method based on GCN of the present invention includes the following steps:
[0054] Step S11: Obtain the trajectory data of the target pedestrian, wherein the trajectory data includes at least the stopping location, the pedestrian trajectory, and the stopping time;
[0055] Step S12: Encode the trajectory data based on a preset encoding rule, wherein the encoding rule is to use a preset two-dimensional matrix to encode the stopping location, the pedestrian trajectory, and the stopping time;
[0056] Step S13: Express the encoded trajectory data in a graphical form to obtain graph structure data;
[0057] Step S14: Input the graph structure data into the trained GCN network model for attribute recognition to obtain the pedestrian attributes corresponding to the target pedestrian.
[0058] It should be noted that, in this embodiment, the trajectory data is first acquired, wherein the trajectory data includes at least the stopping location, the pedestrian trajectory, and the stopping time, wherein, as... Figure 2 As shown, obtaining the trajectory data of the target pedestrian specifically includes the following steps:
[0059] Step S21: Collect the stopping locations and stopping times corresponding to the target pedestrians according to the natural time sequence;
[0060] Step S22: Based on the location of stay and the time of stay, and combined with the natural time sequence, obtain the pedestrian trajectory corresponding to the target pedestrian;
[0061] Step S23: Obtain the trajectory data based on the location of stay, the time of stay, and the pedestrian trajectory.
[0062] It should be noted that in practical applications, the trajectory data can be obtained through technologies such as visual REID, RFID, or WIFI. Since the above technologies are well known to those skilled in the art, they will not be described in detail in this embodiment. The full names of the English abbreviations will be explained below. Among them, REID stands for Person Re-identification (ReID), and RFID stands for Radio Frequency Identification.
[0063] Furthermore, in one embodiment of the invention, the trajectory data is encoded based on a preset encoding rule, specifically including encoding the stopping location, the pedestrian trajectory, and the stopping time. The specific encoding rule used is a preset two-dimensional matrix, including encoding the stopping location using a two-dimensional matrix L, encoding the pedestrian trajectory using a two-dimensional matrix T, and encoding the stopping time using a two-dimensional matrix S.
[0064] Specifically, the locations are encoded using a two-dimensional matrix L, including obtaining row vectors of the two-dimensional matrix L based on preset location numbers; and obtaining column vectors of the two-dimensional matrix L based on location type and floor information. Taking a shopping mall scenario as an example, refer to... Figure 3 The provided trajectory diagram in this embodiment structures the location information within the scene, i.e., the locations are numbered and their attributes are supplemented, as shown in Table 1. Table 1 includes location number, location name, location type, and floor information.
[0065] Table 1. Location Information Diagram
[0066] serial number 1 2 3 4 5 6 7 name Gate 1 Gate 2 Shop A Shop B C store Shop D Gate 3 type Entrance / Exit Entrance / Exit clothing store clothing store restaurants restaurants Entrance / Exit floor 1 1 1 2 3 3 1
[0067] Furthermore, the locations are encoded using a two-dimensional matrix L, where the row number represents the location ID, i.e., the index of each row vector in the two-dimensional matrix L represents the corresponding location ID, and the columns represent the location type and floor information. The type is represented by numbers; for example, "1" represents an entrance / exit, "2" represents a clothing store, and "3" represents a restaurant. Each column vector in the two-dimensional matrix L represents the location type and the floor information, respectively. After encoding the information in Table 1 above, the two-dimensional matrix L is obtained as follows:
[0068]
[0069] Furthermore, the pedestrian trajectory is encoded using a two-dimensional matrix T. The first row of the matrix represents the location number corresponding to the starting point of the trajectory segment, and the second row represents the location number of the arrival point. That is, the location number corresponding to the starting point of the target pedestrian is used as the first row of the two-dimensional matrix T, and the location number corresponding to the arrival point of the target pedestrian is used as the second row of the two-dimensional matrix T. The columns represent the temporal order; that is, the natural time sequence corresponding to each segment of the pedestrian trajectory is used as the column vector of the two-dimensional matrix T. The two-dimensional matrix T is obtained in this way, as follows:
[0070]
[0071] Furthermore, the dwell time is encoded using a two-dimensional matrix S. The first row of the matrix represents the dwell time at the starting point of the trajectory segment, and the second row represents the dwell time at the arrival point of the trajectory segment. That is, the dwell time corresponding to the starting point of the pedestrian trajectory is used as the first row of the two-dimensional matrix S, and the dwell time corresponding to the arrival point of the pedestrian trajectory is used as the second row of the two-dimensional matrix S. The number of columns in the matrix is consistent with the number of trajectory segments and corresponds to the column numbers of the two-dimensional matrix T. That is, the number of trajectory segments of the pedestrian trajectory is used as the column vector of the two-dimensional matrix S, thus obtaining the two-dimensional matrix S. The dwell time is calculated in seconds, as detailed below:
[0072]
[0073] Furthermore, in one embodiment of the invention, the encoded trajectory data is expressed in a graphical form to obtain graph structure data. Specifically, the graph structure data G is obtained based on the two-dimensional matrices L, T, and S, wherein the two-dimensional matrix L is used as the nodes of the graph structure data; the two-dimensional matrix T is used as the edges of the graph structure data; and the two-dimensional matrix S is used as the edge attributes of the graph structure data, thereby obtaining the input data for the GCN network model, i.e., the graph structure data G = (L, T, S).
[0074] It should be noted that this application uses a GCN network as the recognition model, wherein the network structure design is as follows: Figure 4As shown, the network is implemented using PyG software. All network layer operations originate from the TORCH_GEOMETRIC.NN module. Accordingly, the GCN network proposed in this application needs to be trained in advance. Trajectory data and pedestrian images can be collected using commercially available devices with REID capabilities. After collecting training samples, the trajectory data within the samples needs to be encoded to generate graph structured data, and the attribute labels of the trajectories are manually labeled, such as: 1) deliveryman; 2) courier; 3) cleaner; 4) security guard; 5) others. In the labeling, those whose attributes cannot be determined from the image are labeled as 5) others. The encoded structured trajectory data set and the attribute labels corresponding to each trajectory constitute the training data. The ratio of the number of training target trajectories is set as follows:
[0075] Delivery driver:Courier:Security guard:Cleaner:Other = 1:1:1:1:6;
[0076] The specific training process is as follows:
[0077] a) Divide the training samples into a training set and a test set, where the preset ratio of the training set to the test set is:
[0078] Training set data size : Test set data size = 9 : 1;
[0079] b) The network loss function is the standard Softmax function, and the training method chosen is the ADAM training method. The training parameters are as follows:
[0080] Learning rate = 0.01, β1 = 0.9, β2 = 0.999;
[0081] Where β1 and β2 are both training parameters of the ADAM training method;
[0082] c) The structure of the trained GCN network is as follows Figure 4 The network layers are all standard functions provided by pyG. The preset threshold corresponding to the number of iterations is set to 10000. The recommended batch size of data in a single iteration is "32, 64, 128, 256". In practical applications, the specific size is determined according to the GPU memory size used in training.
[0083] d) During the training process, the training dataset is randomly sent in according to the amount of data in each batch, and duplication is avoided. After all the training data has been sent in for training, the corresponding model is saved, and the accuracy of the model is tested using the test set.
[0084] e) Repeat step d) until the number of iterations is complete, then stop training.
[0085] f) Select the model with the highest accuracy on the test set as the optimal network model (i.e., the trained GCN network model) for use in implementation.
[0086] Furthermore, the graph structure data obtained by plotting the encoded trajectory data is input into the trained GCN network model for attribute recognition, which can obtain the pedestrian attributes corresponding to the target pedestrian. It should be noted that, compared with the visual judgment method, when the target is wearing obviously professional clothing, the visual solution cannot judge and identify it, but this method can effectively identify this situation. For example, when this solution is implemented, when the target's clothing changes in different scenarios, such as a cleaner in site A wearing white work clothes, and then changing to black work clothes three months later, for a vision-based solution, the recognition model needs to be retrained after the work clothes change, but this solution does not need to retrain the recognition model and can still identify the corresponding pedestrian as a cleaner.
[0087] Please see Figure 5 In one embodiment, this embodiment provides a pedestrian attribute recognition system 50 based on GCN, the system comprising:
[0088] The acquisition module 51 is used to acquire the trajectory data of the target pedestrian, wherein the trajectory data includes at least the stopping location, the pedestrian trajectory, and the stopping time;
[0089] The encoding module 52 is used to encode the trajectory data based on a preset encoding rule, wherein the encoding rule is to encode the stopping location, the pedestrian trajectory and the stopping time using a preset two-dimensional matrix;
[0090] Processing module 53 is used to express the encoded trajectory data in a graphical form to obtain graph structure data;
[0091] The identification module 54 is used to input the graph structure data into the trained GCN network model for attribute identification, and obtain the pedestrian attributes corresponding to the target pedestrian.
[0092] Since the specific implementation of this embodiment corresponds to the aforementioned method embodiment, the same details will not be repeated here, and those skilled in the art should also understand this. Figure 5 The division of the modules in the embodiments is only a logical functional division. In actual implementation, they can be fully or partially integrated into one or more physical entities. These modules can be fully implemented in software through processing element calls, fully implemented in hardware, or some modules can be implemented in software through processing element calls and some modules can be implemented in hardware.
[0093] In addition, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the GCN-based pedestrian attribute recognition methods described above.
[0094] See Figure 6 This embodiment provides an electronic device, which includes at least a memory and a processor connected via a bus. The memory stores a computer program, and the processor executes the computer program stored in the memory to perform all or part of the steps in the aforementioned method embodiment.
[0095] In summary, the present invention can identify pedestrian attributes based on their trajectory, determine their identity, and refine passenger flow data. Compared with traditional methods based on visual judgment, when the target pedestrian is dressed in obviously professional clothing, visual methods cannot identify or distinguish them, but the method disclosed in this application can effectively identify this situation.
[0096] 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 pedestrian attribute recognition method based on GCN, characterized in that, include: Acquiring trajectory data of a target pedestrian, wherein the trajectory data includes at least a stopping location, a pedestrian trajectory, and a stopping time, and the acquisition of the trajectory data of the target pedestrian includes: collecting the stopping location and the stopping time corresponding to the target pedestrian according to natural time sequence; obtaining the pedestrian trajectory corresponding to the target pedestrian based on the stopping location and the stopping time, combined with the natural time sequence; and obtaining the trajectory data based on the stopping location, the stopping time, and the pedestrian trajectory. The trajectory data is encoded based on a preset encoding rule, wherein the encoding rule uses a preset two-dimensional matrix to encode the stopping location, the pedestrian trajectory, and the stopping time. Encoding the locations of stay includes obtaining the two-dimensional matrix based on preset location numbers. The row vectors are used to obtain the two-dimensional matrix based on the location type and floor information. Column vectors; and using two-dimensional matrices Encoding the pedestrian trajectory includes using the location number corresponding to the starting point of the target pedestrian as the two-dimensional matrix. The first row is the two-dimensional matrix based on the location number corresponding to the destination of the target pedestrian. The second row; based on the natural time sequence corresponding to each segment of the pedestrian trajectory as the two-dimensional matrix. Column vectors; and using two-dimensional matrices Encoding the dwell time includes using the dwell time corresponding to the starting point of the pedestrian trajectory as the two-dimensional matrix. The first row is the two-dimensional matrix based on the dwell time corresponding to the arrival point of the pedestrian trajectory. The second row; the number of trajectory segments based on the pedestrian trajectory is used as the two-dimensional matrix. Column vectors; The encoded trajectory data is represented graphically to obtain graph-structured data, wherein the two-dimensional matrix is... As nodes of the graph structure data, the two-dimensional matrix As edges of the graph structure data, the two-dimensional matrix As an edge attribute of the graph structure data; The graph structure data is input into the trained GCN network model for attribute recognition to obtain the pedestrian attributes corresponding to the target pedestrian.
2. The pedestrian attribute recognition method based on GCN according to claim 1, characterized in that, The training steps for the GCN network model include: Acquire training data and divide the training data into a training set and a test set based on a preset ratio; The training set is randomly input into a preset GCN network in batches for iterative training, and the model accuracy of each batch of network models is tested using the test set. Training stops when the number of iterations reaches a preset threshold, and the network model with the highest accuracy is selected as the trained GCN network model.
3. A pedestrian attribute recognition system based on GCN, characterized in that, include: An acquisition module is used to acquire trajectory data of a target pedestrian, wherein the trajectory data includes at least a stopping location, a pedestrian trajectory, and a stopping time. Acquiring the trajectory data of the target pedestrian includes: collecting the stopping location and the stopping time corresponding to the target pedestrian according to natural time sequence; obtaining the pedestrian trajectory corresponding to the target pedestrian based on the stopping location and the stopping time, combined with the natural time sequence; and obtaining the trajectory data based on the stopping location, the stopping time, and the pedestrian trajectory. An encoding module is used to encode the trajectory data based on a preset encoding rule, wherein the encoding rule is to encode the stopping location, the pedestrian trajectory, and the stopping time using a preset two-dimensional matrix. Encoding the locations of stay includes obtaining the two-dimensional matrix based on preset location numbers. The row vectors are used to obtain the two-dimensional matrix based on the location type and floor information. Column vectors; and using two-dimensional matrices Encoding the pedestrian trajectory includes using the location number corresponding to the starting point of the target pedestrian as the two-dimensional matrix. The first row is the two-dimensional matrix based on the location number corresponding to the destination of the target pedestrian. The second row; based on the natural time sequence corresponding to each segment of the pedestrian trajectory as the two-dimensional matrix. Column vectors; and using two-dimensional matrices Encoding the dwell time includes using the dwell time corresponding to the starting point of the pedestrian trajectory as the two-dimensional matrix. The first row is the two-dimensional matrix based on the dwell time corresponding to the arrival point of the pedestrian trajectory. The second row; the number of trajectory segments based on the pedestrian trajectory is used as the two-dimensional matrix. Column vectors; The processing module is used to represent the encoded trajectory data in a graphical form to obtain graph-structured data, wherein the two-dimensional matrix is... As nodes of the graph structure data, the two-dimensional matrix As edges of the graph structure data, the two-dimensional matrix As an edge attribute of the graph structure data; The recognition module is used to input the graph structure data into the trained GCN network model for attribute recognition, and obtain the pedestrian attributes corresponding to the target pedestrian.
4. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the pedestrian attribute recognition method based on GCN as described in any one of claims 1 to 2.
5. An electronic device, characterized in that, The electronic device includes a processor and a memory; wherein the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory to enable the electronic device to perform the pedestrian attribute recognition method based on GCN as described in any one of claims 1 to 2.
Citation Information
Patent Citations
Video pedestrian recognition method based on deep neural network and graph convolution network
CN112183464A
Pedestrian trajectory prediction method based on aerial photography visual angle of unmanned aerial vehicle
CN112541449A
GCN-GRU-based strip mine truck staying area activity identification method
CN115062713A