A public space behavior interaction pattern recognition method based on a heterogeneous graph
Patent Information
- Application Number
- CN202610731164.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-26
- Publication Date
- 2026-08-18
AI Technical Summary
[0004]然而,上述方法仍存在明显不足:一方面,多以整体空间单元为分析对象,难以刻画公共空间内部局部尺度下的空间–行为精细交互结构;另一方面,空间信息与行为信息通常分别建模,缺乏能够同时表达多类型空间要素、多维行为特征及其多种几何拓扑关系的统一结构框架
[0054] (1) Based on continuous pedestrian trajectory data, this invention constructs a multi-dimensional behavioral indicator system that includes movement status, degree of change, duration of time, activity intensity and behavioral diversity, so that behavioral characteristics can be quantitatively expressed in the form of structured data, providing complete behavioral dimension support for spatial-behavioral relationship modeling;
Smart Images

Figure CN122597864A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of urban design application transformation technology, and in particular relates to a method for recognizing public space behavioral interaction patterns based on heterogeneous graphs. Background Technology
[0002] With the advancement of urban renewal, the identification and analysis of crowd behavior in public spaces has gradually become an important foundation for optimizing built spaces. Public spaces such as streets, squares, and parks often contain complex spatial structures that influence the diverse distribution of crowd behaviors. Therefore, revealing the relationship between spatial structure and behavioral characteristics at a fine scale is a key issue in current public space research and application.
[0003] In recent years, the development of computer vision and video monitoring technologies has made it possible to obtain continuous pedestrian trajectories through target detection and multi-target tracking algorithms. Based on trajectory data, multi-dimensional behavioral indicators such as movement speed, direction change, dwell time, activity intensity, and behavioral diversity can be calculated, providing data support for behavioral quantitative analysis. In existing technologies, the analysis methods of spatial-behavioral relationships mainly include: (1) analysis methods based on visual heat maps or distribution maps, which superimpose behavioral frequency with spatial location and summarize spatial-behavioral relationships through visual observation; (2) methods based on statistical regression analysis, which take the quantity or attributes of spatial elements as independent variables and behavioral indicators as dependent variables, and perform linear regression or correlation analysis within a unified grid unit; (3) methods based on spatial syntax or network analysis, which explain the distribution pattern of pedestrian flow through topological indicators.
[0004] However, the aforementioned methods still have significant shortcomings: on the one hand, they mostly focus on overall spatial units as the analysis object, making it difficult to characterize the fine spatial-behavioral interaction structure at the local scale within public spaces; on the other hand, spatial and behavioral information are usually modeled separately, lacking a unified structural framework that can simultaneously express multiple types of spatial elements, multidimensional behavioral characteristics, and their various geometric and topological relationships. Furthermore, in the identification of typical spatial-behavioral patterns, existing methods largely rely on human experience or overall statistical analysis, lacking the extraction of local behavioral patterns that encompass fine-grained interaction relationships, making it difficult to identify representative local interaction patterns from complex data. Summary of the Invention
[0005] Purpose of the invention: The purpose of this invention is to provide a method for recognizing behavioral interaction patterns in public spaces based on heterogeneous graphs. This invention constructs a spatial-behavioral heterogeneous graph structure containing multiple types of nodes and various topological relationships by performing multi-dimensional quantitative modeling of spatial elements and pedestrian behavior trajectories in public spaces. Combined with graph neural networks and unsupervised clustering methods, it achieves automatic recognition and classification of typical spatial-behavioral interaction patterns.
[0006] Technical Solution: To achieve the above objectives, the present invention provides a public space behavior interaction pattern recognition method based on heterogeneous graphs, comprising the following steps:
[0007] Step 1: Collection of public space behavior data
[0008] Select public space samples, collect behavioral video image data and spatial image data covering the physical environment structure of the space; preprocess the video image data to obtain continuous frame sequences, georegister and crop the spatial image data to form a spatial base map consistent with the video coverage area, and construct an initial dataset of public space behavior containing the spatial base map and behavioral images;
[0009] Step 2: Spatial Information Recognition
[0010] Based on the spatial base map, the entity spatial elements in the public space are identified by the image semantic segmentation method. The spatial elements are classified according to their geometric shape and functional attributes. The identified spatial elements are converted into vector form and each spatial element is assigned a unique identifier and type attribute to form a spatial element dataset.
[0011] Step 3: Behavioral Information Recognition
[0012] Based on the behavioral images in the initial dataset of public space behavior, individual pedestrians in the public space are detected and continuously tracked to obtain the position sequence of each individual pedestrian in continuous time frames, forming an individual behavioral trajectory; the individual behavioral trajectory is then converted to a spatial baseline. Figure 1 In the unified geographic coordinate system, behavioral grid cells are divided, local features of individual behavioral trajectories are calculated, and the behavioral grid cells and the corresponding local features of individual behavioral trajectories are recorded as behavioral cell datasets.
[0013] Step 4: Construction of Spatial-Behavioral Heterogeneous Graph
[0014] Spatial relationship calculations are performed on the behavioral unit dataset and the spatial element dataset to determine the geometric relationship between spatial elements and behavioral units, generating node elements representing spatial elements and behavioral units, as well as edge elements expressing the geometric relationship between node elements; a spatial-behavioral heterogeneous graph containing multi-type nodes, multi-type relationships, and multi-dimensional attribute information is constructed based on the node elements and edge elements.
[0015] Step 5: Extraction of Spatial-Behavioral Interaction Patterns
[0016] Based on the spatial-behavioral heterogeneous graph, the spatial-behavioral heterogeneous graph is encoded, and node embedding and attention weight of nodes are calculated. Based on the attention weight of nodes, high-importance spatial-behavioral connections are selected, spatial-behavioral local interaction subgraphs are extracted, and unsupervised clustering analysis is performed on the subgraphs to obtain spatial-behavioral interaction patterns. Statistical analysis is performed on spatial node attributes and behavioral node attributes to determine the element association relationships of spatial-behavioral interaction patterns.
[0017] Step Six: Database Building and Visualization
[0018] A database of public space behavior interaction patterns will be constructed to visualize the spatial distribution and behavioral characteristics of different interaction patterns.
[0019] Optionally, step three, which involves detecting and continuously tracking individual pedestrians in public spaces, specifically includes the following steps:
[0020] A target detection model is used to identify and locate pedestrians in video frame images, and to obtain the pixel coordinate information of the pedestrian targets;
[0021] A target tracking algorithm is used to associate pedestrian targets between adjacent frames. A unique identifier (individual ID) is assigned to each pedestrian target, and a behavior trajectory dataset containing the unique identifier (individual ID), frame ID, and pixel coordinates is constructed by combining pixel coordinate information. ,in, Representing the A pedestrian's unique identifier, an individual ID. Representing the pedestrian in the The frame number corresponding to the frame. Representing the The first frame The coordinates of the bottom center point of the pedestrian recognition frame;
[0022] Step three describes converting individual behavioral trajectories to a spatial baseline. Figure 1 In the established geographic coordinate system, the specific steps include the following:
[0023] Based on the spatial element dataset described in step two, geographic reference points are selected to form a set of conversion target points containing geographic information of the geographic reference points. ,in Representing the Geographic coordinates of a geographic reference point This represents the number of geographic reference points; pixel reference points at corresponding locations are extracted from video frames to form an initial set of transformation points containing pixel coordinates. ,,in Representing the The pixel reference point coordinates corresponding to each geographic reference point The number of pixel reference points is the same as the number of geographic reference points. A projection transformation matrix is established based on the two sets of points, and the pixel coordinates of the behavior trajectory are mapped to a geographic coordinate system consistent with the spatial features using the projection transformation matrix.
[0024] Optionally, the calculation of local features of an individual's behavioral trajectory in step three specifically refers to first calculating the instantaneous velocity and direction of each trajectory point, and then calculating behavioral indicators related to five behavioral characteristics: mobility, variability, persistence, activity intensity, and diversity. Among these, the mobility behavioral indicators include indicators characterizing the consistency of pedestrian movement speed and direction; the variability behavioral indicators express the dispersion of speed and direction; the variability behavioral indicators include the average standard deviation of direction and the average velocity coefficient of variation; and the persistence behavioral indicators are expressed in time slices. To measure the evenness of the distribution of behavior and the concentration of people within a slice, the indicators for sustained behavior include trajectory time entropy and trajectory time dispersion. The indicators for activity intensity are characterized from two dimensions: the overall mean and the instantaneous peak value. The indicators for activity intensity include the number of trajectories and the peak occupancy. The indicators for behavior diversity include the diversity of trajectory morphology and spatial distribution. The indicators for behavior diversity include trajectory morphology diversity and spatial distribution diversity. All behavior indicators are normalized, and principal component analysis is used to reduce the dimensionality of the behavior indicators under each behavior characteristic to a single indicator.
[0025] Optionally, step four, which involves calculating the spatial relationship between the behavioral unit dataset and the spatial feature dataset, specifically includes the following steps:
[0026] First, a behavior node is generated at the center of each behavior grid cell. Then, connections are established between adjacent behavior nodes, and an auxiliary grid is formed based on the connections between adjacent behavior nodes.
[0027] Secondly, the geometric and topological relationships between spatial elements and auxiliary grids are identified, specifically:
[0028] (1) If the spatial feature intersects with the auxiliary grid, a spatial node is generated at the center of the auxiliary grid, and an edge is constructed between the generated spatial node and the relevant behavior node of the auxiliary grid. An intersection attribute is added to the constructed edge.
[0029] (2) If the spatial feature completely covers the auxiliary grid, then a spatial node is generated at the center of the auxiliary grid, and an edge is constructed between the generated spatial node and the relevant behavior node of the auxiliary grid, and a coverage attribute is attached to the constructed edge;
[0030] (3) If there are isolated behavioral corners on the edge of the auxiliary grid, a spatial node is generated at the spatial feature closest to the corner, and an edge is constructed between the generated spatial node and the relevant behavioral node of the auxiliary grid. The nearest neighbor attribute is attached to the constructed edge.
[0031] Finally, spatial nodes belonging to the same spatial element are connected in sequence to form auxiliary edges that express the complete structure of the spatial element.
[0032] Optionally, the step four, which involves constructing a spatial-behavioral heterogeneous graph containing multiple types of nodes, multiple types of relationships, and multi-dimensional attribute information based on node and edge elements, specifically refers to denoting the spatial-behavioral heterogeneous graph as... ,in, For a set of nodes, there is a set of spatial nodes. and set of behavior nodes Composition, that is ; This is a set of edges used to represent the connection relationships between nodes; This is a collection of node types, used to record the type labels of nodes. ,in Corresponding spatial node set , Corresponding behavior node set ; This is a set of relation types, representing the geometric topological relationships between spatial nodes and behavioral nodes, including three categories: intersection, overlap, and proximity, and the set of edges. The edges in the array are appended with their corresponding relation type identifiers, and the relation type belongs to a set. The multidimensional attribute information includes spatial node attributes and behavioral node attributes. Spatial node attributes include the spatial feature type to which it belongs, while behavioral node attributes contain the behavioral index values within the grid cell it represents.
[0033] Optionally, step five involves extracting the spatial-behavioral local interaction subgraph and performing unsupervised clustering analysis on the subgraph; specifically, it includes the following steps:
[0034] First, based on the multi-head attention of each edge, calculate the importance score of each edge using the following formula:
[0035]
[0036] in, Subgraph The set of nodes, It is a node The low-dimensional embedding vector, Subgraph Embedded representation;
[0037] Subsequently, the importance scores were selected from the top. The edges are taken as the set of critical edges, and the importance score is calculated using the following formula:
[0038]
[0039] in, From node To the node Importance score of directed edges It's about the number of heads to focus on. It is the index variable for summation. It is the first The node calculated by the attention head For nodes Attention weights;
[0040] For each critical edge A local subgraph is constructed using the first-order neighborhoods of its two endpoints as its range, which can be represented as follows: ,in, and This represents the two endpoints of a critical edge. Represents a node The set of neighboring nodes, that is, all nodes that are related to the node Directly connected nodes Represents a node The set of neighboring nodes, that is, all nodes that are related to the node Directly connected nodes;
[0041] The K-means method is used to cluster the subgraphs, classifying subgraphs with similar structures into the same category. The resulting subgraph clusters represent typical space-behavior interaction patterns.
[0042] The present invention discloses a public space behavior interaction pattern recognition system based on heterogeneous graphs, comprising:
[0043] The public space behavior data acquisition module is used to select public space samples, collect behavioral video image data and spatial image data covering the physical environment structure of the space; preprocess the video image data to obtain continuous frame sequences, perform georegistration and cropping on the spatial image data to form a spatial base map consistent with the video coverage area, and construct an initial dataset of public space behavior containing the spatial base map and behavioral images.
[0044] The spatial information recognition module is used to identify entity spatial elements in public space based on the spatial base map and through image semantic segmentation methods. It classifies spatial elements according to geometric shape and functional attributes, converts the identified spatial elements into vector form, and assigns a unique identifier and type attribute to each spatial element to form a spatial element dataset.
[0045] The behavior information recognition module is used to detect and continuously track individual pedestrians in the public space based on the behavior images in the initial dataset of public space behavior, obtain the position sequence of each individual pedestrian in continuous time frames, and form an individual behavior trajectory; and convert the individual behavior trajectory to a spatial baseline. Figure 1 In the unified geographic coordinate system, behavioral grid cells are divided, local features of individual behavioral trajectories are calculated, and the behavioral grid cells and the corresponding local features of individual behavioral trajectories are recorded as behavioral cell datasets.
[0046] The spatial-behavioral heterogeneous graph construction module is used to perform spatial relationship calculations on the behavioral unit dataset and the spatial element dataset, determine the geometric relationship between spatial elements and behavioral units, generate node elements representing spatial elements and behavioral units, and edge elements expressing the geometric relationship between node elements; and construct a spatial-behavioral heterogeneous graph containing multi-type nodes, multi-type relationships, and multi-dimensional attribute information based on the node elements and edge elements.
[0047] The spatial-behavioral interaction pattern extraction module is used to encode the spatial-behavioral heterogeneous graph based on the spatial-behavioral heterogeneous graph, and calculate the node embedding and attention weight of the nodes; based on the attention weight of the nodes, select the spatial-behavioral connections with high importance, extract the spatial-behavioral local interaction subgraphs, perform unsupervised clustering analysis on the subgraphs to obtain the spatial-behavioral interaction patterns, and perform statistical analysis on the spatial node attributes and behavioral node attributes to determine the element association relationships of the spatial-behavioral interaction patterns.
[0048] The database construction and visualization module is used to build a database of public space behavior interaction patterns and to visualize the spatial distribution and behavioral characteristics of different interaction patterns.
[0049] The computer system of the present invention includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the steps of a public space behavior interaction pattern recognition method based on heterogeneous graphs as described above.
[0050] The present invention discloses a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of a public space behavior interaction pattern recognition method based on heterogeneous graphs as described above.
[0051] The present invention provides a computer program product comprising a computer program that, when executed by a processor, implements the steps of a public space behavior interaction pattern recognition method based on heterogeneous graphs as described above.
[0052] Technical solution: To achieve the above objectives, the present invention...
[0053] Beneficial effects: Compared with the prior art, the present invention has the following significant advantages:
[0054] (1) Based on continuous pedestrian trajectory data, this invention constructs a multi-dimensional behavioral indicator system that includes movement status, degree of change, duration of time, activity intensity and behavioral diversity, so that behavioral characteristics can be quantitatively expressed in the form of structured data, providing complete behavioral dimension support for spatial-behavioral relationship modeling;
[0055] (2) By constructing a heterogeneous graph structure containing multiple types of spatial nodes, multiple types of behavioral nodes and multiple topological relationships, this invention realizes the unified expression of spatial information and behavioral information under the same computing framework, so that spatial structure, behavioral indicators and their correlation can be stored and calculated in a structured form.
[0056] (3) The present invention constructs a local subgraph based on the spatial-behavioral topological relationship and identifies key connections through the attention mechanism to realize the automatic extraction of micro-scale interactive structures inside the public space, which can reflect the differences in spatial structure and behavioral characteristics in different local areas;
[0057] (4) This invention uses graph neural network encoding and unsupervised clustering analysis to cluster and divide spatial-behavioral subgraphs with similar structures, forming representative spatial-behavioral interaction pattern categories, realizing automatic pattern recognition, and improving the objectivity and consistency of typical pattern extraction in complex spatial-behavioral structures;
[0058] (5) This invention performs statistical analysis on spatial elements and behavioral indicators in subgraphs to form calculable spatial-behavioral correlation results, thereby realizing the quantitative expression of the relationship between different spatial elements and behavioral characteristics, and providing a data foundation for public space analysis and optimization.
[0059] (6) This invention constructs a space-behavior interaction pattern database and visualizes it, so that the spatial distribution and structural characteristics of different interaction patterns can be presented intuitively, which can provide intuitive support for public space optimization decisions. Attached Figure Description
[0060] Figure 1 This is a flowchart of the method of the present invention;
[0061] Figure 2 This is a diagram illustrating the construction effect of the spatial-behavioral heterogeneous graph in this invention. Detailed Implementation
[0062] The technical solution of the present invention will be further described below with reference to the accompanying drawings.
[0063] Example 1: As Figure 1 As shown, the present invention provides a public space behavior interaction pattern recognition method based on heterogeneous graphs, comprising the following steps:
[0064] Step 1: Collection of public space behavior data
[0065] Public space samples were selected, and behavioral video image data from fixed camera positions and spatial image data covering the physical environment structure of the space were collected. The collected video image data was preprocessed to obtain a continuous frame sequence, and the spatial image data was geo-registered and cropped to form a spatial base map consistent with the video coverage area, thereby constructing an initial dataset of public space behavior that includes the spatial base map and behavioral images.
[0066] Step 2: Spatial Information Recognition
[0067] Based on the spatial base map in the initial dataset of public space behavior, the entity spatial elements in the public space are identified by the image semantic segmentation method. The spatial elements are classified according to their geometric shape and functional attributes. The geometric shape includes, but is not limited to, area elements, spatial boundary elements and independent elements. The functional attributes include, but are not limited to, transportation, commerce and life service categories. The identified spatial elements are converted into vector form and each spatial element is assigned a unique identifier and type attribute to form a spatial element dataset.
[0068] Step 3: Behavioral Information Recognition
[0069] Based on the behavioral images in the initial dataset of public space behavior, computer vision methods are used to detect and continuously track individual pedestrians in the public space, obtaining the position sequence of each individual pedestrian in continuous time frames, thereby forming individual behavioral trajectories; the individual behavioral trajectories are then converted to a spatial baseline. Figure 1 In the established geographic coordinate system, behavioral grid cells are divided, local features of individual behavioral trajectories are calculated, and the behavioral grid cells and the corresponding local features of individual behavioral trajectories are recorded as behavioral cell datasets.
[0070] Step three, which describes using computer vision methods to detect and continuously track individual pedestrians in public spaces, specifically includes the following steps:
[0071] A target detection model is used to identify and locate pedestrians in video frame images, and to obtain the pixel coordinate information of the pedestrian targets;
[0072] A target tracking algorithm is used to associate pedestrian targets between adjacent frames. A unique identifier (individual ID) is assigned to each pedestrian target, and a behavior trajectory dataset containing the unique identifier (individual ID), frame ID, and pixel coordinates is constructed by combining pixel coordinate information. ,in, Representing the A pedestrian's unique identifier, an individual ID. Representing the pedestrian in the The frame number corresponding to the frame. Representing the The first frame The coordinates of the bottom center point of the pedestrian recognition frame;
[0073] Step three describes converting individual behavioral trajectories to a spatial baseline. Figure 1 In the established geographic coordinate system, the specific steps include the following:
[0074] Based on the spatial element dataset described in step two, geographic reference points are selected to form a set of conversion target points containing geographic information of the geographic reference points. ,in Representing the Geographic coordinates of a geographic reference point This represents the number of geographic reference points; pixel reference points at corresponding locations are extracted from video frames to form an initial set of transformation points containing pixel coordinates. ,,in Representing the The pixel reference point coordinates corresponding to each geographic reference point The number of pixel reference points is the same as the number of geographic reference points. A projection transformation matrix is established based on the two sets of points, and the pixel coordinates of the behavior trajectory are mapped to a geographic coordinate system consistent with the spatial features using the projection transformation matrix.
[0075] Step three, which involves calculating the local characteristics of an individual's behavioral trajectory, specifically refers to first calculating the instantaneous velocity and direction of each trajectory point, and then calculating behavioral indicators related to five behavioral characteristics: mobility, variability, persistence, activity intensity, and diversity. Specifically, mobility indicators include those characterizing the consistency of pedestrian speed and direction, specifically pedestrian speed and direction consistency indicators; variability indicators express the dispersion of speed and direction, including the average standard deviation of direction and the average velocity coefficient of variation; persistence indicators measure the evenness of the distribution of behavior and the concentration of people within a slice, using time slices as units, including trajectory time entropy and trajectory time dispersion indicators; activity intensity indicators are characterized from two dimensions: overall mean and instantaneous peak value, including the number of trajectories and peak occupancy indicators; and behavior diversity indicators include the diversity of trajectory morphology and spatial distribution, including trajectory morphology diversity and spatial distribution diversity indicators. All behavioral indicators are normalized, and principal component analysis is used to reduce the dimensionality of the behavioral indicators for each behavioral characteristic to a single indicator.
[0076] The specific calculation formulas for the indicators are shown in the table below:
[0077] Pedestrian movement speed index The formula is:
[0078]
[0079] in behavioral trajectory exist Instantaneous velocity at a given moment; For behavior grid The number of trajectory points within; This represents the behavioral grid, i.e., the analysis cell; Indicates the trajectory number; Represents a video frame;
[0080] Directional Consistency Index The formula is:
[0081]
[0082] in pedestrian trajectory exist The direction of motion at any given moment, expressed in radians;
[0083] Mean directional standard deviation index The formula is:
[0084]
[0085]
[0086] in pedestrian trajectory Number of directional samples in the middle; pedestrian trajectory directional composite length; For grid The number of trajectories within;
[0087] Average velocity coefficient of variation index The formula is:
[0088]
[0089] in pedestrian trajectory The average speed; pedestrian trajectory The speed standard deviation;
[0090] Trajectory Time Entropy Index The formula is:
[0091]
[0092] in Number the time slices, for example, one time slice is every 300 frames; This represents the total number of time slices. For the first The proportion of the number of trajectories observed in a particular time slice to the total number of trajectories in all time slices;
[0093] Trajectory Time Dispersion Index The formula is:
[0094]
[0095] in For the first Appearing in the grid within a time slice The number of trajectories in the data; For grid The average number of trajectories in each time slice; This represents the total number of time slices.
[0096] Trajectory Quantity Indicators The formula is:
[0097]
[0098] Peak occupancy index The formula is:
[0099]
[0100] in In the time window Within 30 frames, the grid The number of trajectories existing simultaneously;
[0101] Trajectory morphology diversity index The formula is:
[0102]
[0103] in Assign cluster category numbers to trajectory morphology clusters; This represents the total number of cluster categories for trajectory morphology. For grid Belongs to the first The proportion of trajectory patterns; the trajectory pattern clustering category is obtained by the total turning angle and tortuosity. The total turning angle is used to characterize the degree of change in trajectory direction, and the tortuosity is used to characterize the degree of detour of the actual path relative to the straight distance between the start and end points.
[0104] Spatial distribution diversity index The formula is:
[0105]
[0106] in Number the subgrids, for example, divide each grid into 16 subgrids; This represents the total number of subgrids. For the first The proportion of trajectory points in each subgrid;
[0107] Step 4: Construction of Spatial-Behavioral Heterogeneous Graph
[0108] Spatial relationship calculations are performed on the behavioral unit dataset and the spatial element dataset to determine the geometric relationship between spatial elements and behavioral units. The geometric relationship includes, but is not limited to, intersection, overlap, and proximity. Node elements representing spatial elements and behavioral units, as well as edge elements expressing the geometric relationship between node elements, are generated. Based on the node elements and edge elements, a spatial-behavioral heterogeneous graph containing multi-type nodes, multi-type relationships, and multi-dimensional attribute information is constructed to express the local relationship between spatial structure and behavioral features in a public space.
[0109] Step four, which involves calculating the spatial relationship between the behavioral unit dataset and the spatial feature dataset, specifically includes the following steps:
[0110] First, a behavior node is generated at the center of each behavior grid cell. Then, connections are established between adjacent behavior nodes, and an auxiliary grid is formed based on the connections between adjacent behavior nodes.
[0111] Secondly, the geometric and topological relationships between spatial elements and auxiliary meshes are identified, specifically including:
[0112] (1) If the spatial feature intersects with the auxiliary grid, a spatial node is generated at the center of the auxiliary grid, and an edge is constructed between the generated spatial node and the relevant behavior node of the auxiliary grid. An intersection attribute is added to the constructed edge.
[0113] (2) If the spatial feature completely covers the auxiliary grid, then a spatial node is generated at the center of the auxiliary grid, and an edge is constructed between the generated spatial node and the relevant behavior node of the auxiliary grid, and a coverage attribute is attached to the constructed edge;
[0114] (3) If there are isolated behavioral corners on the edge of the auxiliary grid, a spatial node is generated at the spatial feature closest to the corner, and an edge is constructed between the generated spatial node and the relevant behavioral node of the auxiliary grid. The nearest neighbor attribute is attached to the constructed edge.
[0115] Finally, spatial nodes belonging to the same spatial element are connected in sequence to form auxiliary edges that express the complete structure of the spatial element.
[0116] Step four, which describes constructing a spatial-behavioral heterogeneous graph containing multiple types of nodes, multiple types of relationships, and multi-dimensional attribute information based on node and edge elements, specifically refers to denoting the spatial-behavioral heterogeneous graph as... ,in, For a set of nodes, there is a set of spatial nodes. and set of behavior nodes Composition, that is ; This is a set of edges used to represent the connection relationships between nodes; This is a collection of node types, used to record the type labels of nodes. ,in Corresponding spatial node set , Corresponding behavior node set ; This is a set of relation types, representing the geometric topological relationships between spatial nodes and behavioral nodes, including three categories: intersection, overlap, and proximity, and the set of edges. The edges in the array are appended with their corresponding relation type identifiers, and the relation type belongs to a set. The multidimensional attribute information includes spatial node attributes and behavioral node attributes. Spatial node attributes include the spatial feature type to which it belongs, while behavioral node attributes contain the behavioral index values within the grid cell it represents.
[0117] Step 5: Extraction of Spatial-Behavioral Interaction Patterns
[0118] Based on spatial-behavioral heterogeneous graphs, a graph autoencoder based on graph attention networks is used to encode the spatial-behavioral heterogeneous graphs and calculate node embeddings and attention weights. High-importance spatial-behavioral connections are selected based on the attention weights of the nodes, and local spatial-behavioral interaction subgraphs are extracted based on these selected connections. Unsupervised clustering analysis is performed on the local spatial-behavioral interaction subgraphs to obtain spatial-behavioral interaction patterns. Based on these spatial-behavioral interaction patterns, statistical analysis is conducted on spatial node attributes and behavioral node attributes to determine the element association relationships within the spatial-behavioral interaction patterns.
[0119] Step five describes the use of a graph autoencoder based on a graph attention network to encode the spatial-behavioral heterogeneous graph, and to calculate the low-dimensional embeddings of nodes and the attention weights of nodes. Specifically:
[0120] A graph autoencoder (GAE) based on a graph attention network (GAT) is an unsupervised learning model that combines graph neural networks and graph autoencoders to efficiently encode complex graph structures and compute low-dimensional embeddings of nodes. Specifically, the unsupervised learning model adaptively weights and aggregates the neighborhood relationships of nodes in each layer to generate low-dimensional embeddings. Further, it reconstructs the graph structure based on these low-dimensional embeddings, iteratively minimizing the reconstruction error to optimize the learnable model parameters. After training, the unsupervised learning model obtains the low-dimensional embeddings and attention weights of the nodes. The attention weights are used to identify important edges and extract subgraphs. Its neighboring nodes The attention weights between them are represented as follows:
[0121]
[0122] in, It is an exponential function. It is a linear rectified activation function with leakage. This is a learnable attention weight vector. yes transpose, The weight matrix is a learnable matrix. Represents a node In the node features of the current layer, Representing neighboring nodes In the node features of the current layer, This indicates traversing the neighborhood. The node currently being traversed eigenvectors, It is a summation index variable. Represents the neighborhood set The node currently being traversed; Represents a node The set of neighboring nodes, For nodes Its neighboring nodes Attention weights between nodes, i.e., the weights of attention between nodes In the update node The relative importance of time; node embedding characterizes the structural features of spatial-behavioral associations in spatial-behavioral heterogeneous graphs, nodes The low-dimensional embedding can be represented as:
[0123]
[0124] in, Represents a node The low-dimensional embedding representation, The weight matrix is a learnable matrix. Represents a node In the original feature vector of the current network layer Represents a node The set of neighboring nodes, It is a summation index variable. Represents a node neighborhood set Any neighboring node in the list;
[0125] Step five, which involves extracting the spatial-behavioral local interaction subgraph based on the filtered spatial-behavioral connections, specifically includes the following steps:
[0126] First, based on the multi-head attention of each edge, calculate the importance score of each edge using the following formula:
[0127]
[0128] in, Subgraph The set of nodes, It is a node The low-dimensional embedding vector, Subgraph Embedded representation;
[0129] Subsequently, the importance scores were selected from the top. The edges are taken as the set of critical edges, and the importance score is calculated using the following formula:
[0130]
[0131] in, From node To the node Importance score of directed edges It's about the number of heads to focus on. It is the index variable for summation. It is the first The node calculated by the attention head For nodes Attention weights;
[0132] For each critical edge A local subgraph is constructed using the first-order neighborhoods of its two endpoints as its range, which can be represented as follows: ,in, and This represents the two endpoints of a critical edge. Represents a node The set of neighboring nodes, that is, all nodes that are related to the node Directly connected nodes Represents a node The set of neighboring nodes, that is, all nodes that are related to the node Directly connected nodes.
[0133] Step five describes unsupervised clustering analysis of the spatial-behavioral local interaction subgraphs. Specifically, the K-means method is used to cluster the subgraphs, grouping structurally similar subgraphs into the same category; the number of clusters... The determination of the model comprehensively references two indicators: the elbow rule and the contour coefficient. The sub-graph clusters obtained after clustering represent typical space-behavior interaction patterns.
[0134] Step Six: Database Building and Visualization
[0135] A database of public space behavior interaction patterns is constructed based on the identified spatial-behavioral interaction patterns and element relationships; based on the database of public space behavior interaction patterns, the spatial distribution and behavioral characteristics of different interaction patterns are visualized.
[0136] Example 2: A public space behavior interaction pattern recognition system based on heterogeneous graphs according to the present invention includes:
[0137] The public space behavior data acquisition module is used to select public space samples, collect behavioral video image data and spatial image data covering the physical environment structure of the space; preprocess the video image data to obtain continuous frame sequences, perform georegistration and cropping on the spatial image data to form a spatial base map consistent with the video coverage area, and construct an initial dataset of public space behavior containing the spatial base map and behavioral images.
[0138] The spatial information recognition module is used to identify entity spatial elements in public space based on the spatial base map and through image semantic segmentation methods. It classifies spatial elements according to geometric shape and functional attributes, converts the identified spatial elements into vector form, and assigns a unique identifier and type attribute to each spatial element to form a spatial element dataset.
[0139] The behavior information recognition module is used to detect and continuously track individual pedestrians in the public space based on the behavior images in the initial dataset of public space behavior, obtain the position sequence of each individual pedestrian in continuous time frames, and form an individual behavior trajectory; and convert the individual behavior trajectory to a spatial baseline. Figure 1 In the unified geographic coordinate system, behavioral grid cells are divided, local features of individual behavioral trajectories are calculated, and the behavioral grid cells and the corresponding local features of individual behavioral trajectories are recorded as behavioral cell datasets.
[0140] The spatial-behavioral heterogeneous graph construction module is used to perform spatial relationship calculations on the behavioral unit dataset and the spatial element dataset, determine the geometric relationship between spatial elements and behavioral units, generate node elements representing spatial elements and behavioral units, and edge elements expressing the geometric relationship between node elements; and construct a spatial-behavioral heterogeneous graph containing multi-type nodes, multi-type relationships, and multi-dimensional attribute information based on the node elements and edge elements.
[0141] The spatial-behavioral interaction pattern extraction module is used to encode the spatial-behavioral heterogeneous graph based on the spatial-behavioral heterogeneous graph, and calculate the node embedding and attention weight of the nodes; based on the attention weight of the nodes, select the spatial-behavioral connections with high importance, extract the spatial-behavioral local interaction subgraphs, perform unsupervised clustering analysis on the subgraphs to obtain the spatial-behavioral interaction patterns, and perform statistical analysis on the spatial node attributes and behavioral node attributes to determine the element association relationships of the spatial-behavioral interaction patterns.
[0142] The database construction and visualization module is used to build a database of public space behavior interaction patterns and to visualize the spatial distribution and behavioral characteristics of different interaction patterns.
[0143] Example 3: A computer system according to the present invention includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the steps of a public space behavior interaction pattern recognition method based on heterogeneous graphs as described above.
[0144] Example 4: A computer-readable storage medium according to the present invention, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the steps of a public space behavior interaction pattern recognition method based on heterogeneous graphs as described above.
[0145] Example 5: A computer program product according to the present invention includes a computer program, which, when executed by a processor, implements the steps of a public space behavior interaction pattern recognition method based on heterogeneous graphs as described above.
Claims
1. A method for recognizing behavioral interaction patterns in public spaces based on heterogeneous graphs, characterized in that, Includes the following steps: Step 1: Collection of public space behavior data Select public space samples, collect behavioral video image data and spatial image data covering the physical environment structure of the space; preprocess the video image data to obtain continuous frame sequences, georegister and crop the spatial image data to form a spatial base map consistent with the video coverage area, and construct an initial dataset of public space behavior containing the spatial base map and behavioral images; Step 2: Spatial Information Recognition Based on the spatial base map, the entity spatial elements in the public space are identified by the image semantic segmentation method. The spatial elements are classified according to their geometric shape and functional attributes. The identified spatial elements are converted into vector form and each spatial element is assigned a unique identifier and type attribute to form a spatial element dataset. Step 3: Behavioral Information Recognition Based on the behavioral images in the initial dataset of public space behavior, individual pedestrians in the public space are detected and continuously tracked to obtain the position sequence of each individual pedestrian in continuous time frames, forming individual behavioral trajectories; the individual behavioral trajectories are converted to a geographic coordinate system consistent with the spatial base map, behavioral grid cells are divided, local features of individual behavioral trajectories are calculated, and the behavioral grid cells and the corresponding local features of individual behavioral trajectories are recorded as behavioral unit datasets. Step 4: Construction of Spatial-Behavioral Heterogeneous Graph Spatial relationship calculations are performed on the behavioral unit dataset and the spatial element dataset to determine the geometric relationship between spatial elements and behavioral units, generating node elements representing spatial elements and behavioral units, as well as edge elements expressing the geometric relationship between node elements; a spatial-behavioral heterogeneous graph containing multi-type nodes, multi-type relationships, and multi-dimensional attribute information is constructed based on the node elements and edge elements. Step 5: Extraction of Spatial-Behavioral Interaction Patterns Based on the spatial-behavioral heterogeneous graph, the spatial-behavioral heterogeneous graph is encoded, and node embedding and attention weight of nodes are calculated. Based on the attention weight of nodes, high-importance spatial-behavioral connections are selected, spatial-behavioral local interaction subgraphs are extracted, and unsupervised clustering analysis is performed on the subgraphs to obtain spatial-behavioral interaction patterns. Statistical analysis is performed on spatial node attributes and behavioral node attributes to determine the element association relationships of spatial-behavioral interaction patterns. Step Six: Database Building and Visualization A database of public space behavior interaction patterns will be constructed to visualize the spatial distribution and behavioral characteristics of different interaction patterns.
2. The method for recognizing public space behavioral interaction patterns based on heterogeneous graphs according to claim 1, characterized in that, Step three, which involves detecting and continuously tracking individual pedestrians in public spaces, specifically includes the following steps: A target detection model is used to identify and locate pedestrians in video frame images, and to obtain the pixel coordinate information of the pedestrian targets; A target tracking algorithm is used to associate pedestrian targets between adjacent frames. A unique identifier (individual ID) is assigned to each pedestrian target, and a behavior trajectory dataset containing the unique identifier (individual ID), frame ID, and pixel coordinates is constructed by combining pixel coordinate information. ,in, Representing the A pedestrian's unique identifier, an individual ID. Representing the pedestrian in the The frame number corresponding to the frame. Representing the The first frame The coordinates of the bottom center point of the pedestrian recognition frame; Step three, which involves converting individual behavioral trajectories to a geographic coordinate system consistent with the spatial base map, specifically includes the following steps: Based on the spatial element dataset described in step two, geographic reference points are selected to form a set of conversion target points containing geographic information of the geographic reference points. ,in Representing the Geographic coordinates of a geographic reference point This represents the number of geographic reference points; pixel reference points at corresponding locations are extracted from video frames to form an initial set of transformation points containing pixel coordinates. ,in Representing the The pixel reference point coordinates corresponding to each geographic reference point The number of pixel reference points is the same as the number of geographic reference points. A projection transformation matrix is established based on the two sets of points, and the pixel coordinates of the behavior trajectory are mapped to a geographic coordinate system consistent with the spatial features using the projection transformation matrix.
3. The method for recognizing public space behavioral interaction patterns based on heterogeneous graphs according to claim 1, characterized in that, Step three, which involves calculating the local characteristics of an individual's behavioral trajectory, specifically refers to first calculating the instantaneous velocity and direction of each trajectory point, and then calculating behavioral indicators related to five behavioral characteristics: mobility, variability, persistence, activity intensity, and diversity. Specifically, mobility indicators include those characterizing the consistency of pedestrian speed and direction, specifically pedestrian speed and direction consistency indicators; variability indicators express the dispersion of speed and direction, including the average standard deviation of direction and the average velocity coefficient of variation; persistence indicators measure the evenness of the distribution of behavior and the concentration of people within a slice, using time slices as units, including trajectory time entropy and trajectory time dispersion indicators; activity intensity indicators are characterized from two dimensions: overall mean and instantaneous peak value, including the number of trajectories and peak occupancy indicators; and behavior diversity indicators include the diversity of trajectory morphology and spatial distribution, including trajectory morphology diversity and spatial distribution diversity indicators. All behavioral indicators are normalized, and principal component analysis is used to reduce the dimensionality of the behavioral indicators for each behavioral characteristic to a single indicator.
4. The method for recognizing public space behavioral interaction patterns based on heterogeneous graphs according to claim 1, characterized in that, Step four, which involves calculating the spatial relationship between the behavioral unit dataset and the spatial feature dataset, specifically includes the following steps: First, a behavior node is generated at the center of each behavior grid cell. Then, connections are established between adjacent behavior nodes, and an auxiliary grid is formed based on the connections between adjacent behavior nodes. Secondly, the geometric and topological relationships between spatial elements and auxiliary grids are identified, specifically: (1) If the spatial feature intersects with the auxiliary grid, a spatial node is generated at the center of the auxiliary grid, and an edge is constructed between the generated spatial node and the relevant behavior node of the auxiliary grid. An intersection attribute is added to the constructed edge. (2) If the spatial feature completely covers the auxiliary grid, then a spatial node is generated at the center of the auxiliary grid, and an edge is constructed between the generated spatial node and the relevant behavior node of the auxiliary grid, and a coverage attribute is attached to the constructed edge; (3) If there are isolated behavioral corners on the edge of the auxiliary grid, a spatial node is generated at the spatial feature closest to the corner, and an edge is constructed between the generated spatial node and the relevant behavioral node of the auxiliary grid. The nearest neighbor attribute is attached to the constructed edge. Finally, spatial nodes belonging to the same spatial element are connected in sequence to form auxiliary edges that express the complete structure of the spatial element.
5. The method for recognizing public space behavioral interaction patterns based on heterogeneous graphs according to claim 1, characterized in that, Step four, which describes constructing a spatial-behavioral heterogeneous graph containing multiple types of nodes, multiple types of relationships, and multi-dimensional attribute information based on node and edge elements, specifically refers to denoting the spatial-behavioral heterogeneous graph as... ,in, For a set of nodes, there is a set of spatial nodes. and set of behavior nodes Composition, that is ; This is a set of edges used to represent the connection relationships between nodes; This is a collection of node types, used to record the type labels of nodes. ,in Corresponding spatial node set , Corresponding behavior node set ; This is a set of relation types, representing the geometric topological relationships between spatial nodes and behavioral nodes, including three categories: intersection, overlap, and proximity, and the set of edges. The edges in the array are appended with their corresponding relation type identifiers, and the relation type belongs to a set. The multidimensional attribute information includes spatial node attributes and behavioral node attributes. Spatial node attributes include the spatial feature type to which it belongs, while behavioral node attributes contain the behavioral index values within the grid cell it represents.
6. The method for recognizing public space behavioral interaction patterns based on heterogeneous graphs according to claim 1, characterized in that, Step five involves extracting the spatial-behavioral local interaction subgraph and performing unsupervised clustering analysis on the subgraph; specifically, it includes the following steps: First, based on the multi-head attention of each edge, calculate the importance score of each edge using the following formula: in, Subgraph The set of nodes, It is a node The low-dimensional embedding vector, Subgraph Embedded representation; Subsequently, the importance scores were selected from the top. The edges are taken as the set of critical edges, and the importance score is calculated using the following formula: in, From node To the node Importance score of directed edges It's about the number of heads to focus on. It is the index variable for summation. It is the first The node calculated by the attention head For nodes Attention weights; For each critical edge A local subgraph is constructed using the first-order neighborhoods of its two endpoints as its range, which can be represented as follows: ,in, and This represents the two endpoints of a critical edge. Represents a node The set of neighboring nodes, that is, all nodes that are related to the node Directly connected nodes Represents a node The set of neighboring nodes, that is, all nodes that are related to the node Directly connected nodes; The K-means method is used to cluster the subgraphs, classifying subgraphs with similar structures into the same category. The resulting subgraph clusters represent typical space-behavior interaction patterns.
7. A public space behavior interaction pattern recognition system based on heterogeneous graphs, characterized in that, include: The public space behavior data acquisition module is used to select public space samples and collect behavioral video image data as well as spatial image data covering the physical environment structure of the space. The video image data is preprocessed to obtain a continuous frame sequence. The spatial image data is georegistered and cropped to form a spatial base map consistent with the video coverage area. An initial public spatial behavior dataset containing the spatial base map and behavioral images is constructed. The spatial information recognition module is used to identify entity spatial elements in public space based on the spatial base map and through image semantic segmentation methods. It classifies spatial elements according to geometric shape and functional attributes, converts the identified spatial elements into vector form, and assigns a unique identifier and type attribute to each spatial element to form a spatial element dataset. The behavior information recognition module is used to detect and continuously track individual pedestrians in the public space based on the behavior images in the initial dataset of public space behavior, obtain the position sequence of each individual pedestrian in continuous time frames, and form an individual behavior trajectory; convert the individual behavior trajectory to a geographic coordinate system consistent with the spatial base map, divide it into behavior grid units, calculate the local features of the individual behavior trajectory, and record the behavior grid units and the corresponding local features of the individual behavior trajectory as a behavior unit dataset; The spatial-behavioral heterogeneous graph construction module is used to perform spatial relationship calculations on the behavioral unit dataset and the spatial element dataset, determine the geometric relationship between spatial elements and behavioral units, generate node elements representing spatial elements and behavioral units, and edge elements expressing the geometric relationship between node elements; and construct a spatial-behavioral heterogeneous graph containing multi-type nodes, multi-type relationships, and multi-dimensional attribute information based on the node elements and edge elements. The spatial-behavioral interaction pattern extraction module is used to encode the spatial-behavioral heterogeneous graph based on the spatial-behavioral heterogeneous graph, and calculate the node embedding and attention weight of the nodes; based on the attention weight of the nodes, select the spatial-behavioral connections with high importance, extract the spatial-behavioral local interaction subgraphs, perform unsupervised clustering analysis on the subgraphs to obtain the spatial-behavioral interaction patterns, and perform statistical analysis on the spatial node attributes and behavioral node attributes to determine the element association relationships of the spatial-behavioral interaction patterns. The database construction and visualization module is used to build a database of public space behavior interaction patterns and to visualize the spatial distribution and behavioral characteristics of different interaction patterns.
8. A computer system comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the computer program is executed by the processor, it implements the steps of the public space behavior interaction pattern recognition method based on heterogeneous graphs according to any one of claims 1-6.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the public space behavior interaction pattern recognition method based on heterogeneous graphs according to any one of claims 1-6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the public space behavior interaction pattern recognition method based on heterogeneous graphs according to any one of claims 1-6.