Cross-city flow generation method based on geographic representation alignment and retrieval enhancement

By employing geographic representation alignment and retrieval enhancement methods, the problem of cross-city migration of deep learning traffic flow generation models was solved, achieving high-fidelity, zero-sample cross-city traffic flow generation and improving the model's generalization ability and the quality of generated data.

CN121638641APending Publication Date: 2026-03-10BEIHANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-18
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

Existing deep learning-based traffic flow generation methods are difficult to migrate across cities, mainly due to domain offset and lack of dynamic conditions, resulting in poor model generalization ability and inability to be effectively deployed in cities with insufficient traffic flow records.

Method used

A method based on geographic representation alignment and retrieval enhancement is adopted. High-order geographic representations are extracted through a graph Transformer model, and traffic flow alignment loss and cross-city alignment loss are jointly trained. The traffic flow sequence of the target city is generated by combining a conditional diffusion probability model, and the generation condition enhancement is performed by using the historical traffic dynamic patterns of similar areas in the source city.

Benefits of technology

It achieves high-fidelity, zero-sample cross-city traffic flow generation, reduces domain offset, improves the model's cross-city transferability, and the generated data outperforms existing methods in downstream tasks, approaching the effect of training directly in the target city.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121638641A_ABST
    Figure CN121638641A_ABST
Patent Text Reader

Abstract

The invention discloses a cross-city flow generation method based on geographic representation alignment and retrieval enhancement. The method comprises the following steps: firstly, constructing multi-source geographic features including points of interest, a road network and population; secondly, a graph Transform is adopted as a space encoder, pre-training is carried out through traffic flow alignment loss and cross-city alignment loss, and alignment of geographic representation among different cities is achieved; further, designing a condition enhancement mechanism generated based on retrieval enhancement, retrieving a historical flow sample similar to the target city area in periodic characteristics and geographic representation from the source city, and extracting a dynamic mode of the historical flow sample as a generation condition; and finally, by taking a conditional diffusion probability model as a backbone, fusing the aligned geographic representation, the time embedding and the dynamic flow representation obtained by retrieval, and generating high-fidelity cross-city traffic flow data. Experiments show that the method is obviously superior to the existing method on a plurality of real city data sets, and has good zero sample migration capability and downstream task availability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of spatiotemporal data generation and smart city technology, specifically to a cross-city traffic flow generation method that combines geographic representation alignment and retrieval enhancement technologies, applicable to scenarios such as smart city traffic management, urban planning, and public resource allocation. Background Technology

[0002] Traffic flow data, as a core element of smart city construction, is the cornerstone supporting key applications such as traffic management, urban planning, and public resource allocation. Today, deep learning technology, with its powerful feature extraction and pattern recognition capabilities, has become the mainstream paradigm for traffic flow analysis and modeling. Its superior performance and significant generalization ability heavily rely on large-scale, high-quality traffic flow data.

[0003] In mature fields such as computer vision (CV) and natural language processing (NLP), this invention allows for the easy acquisition of large-scale, high-quality datasets from publicly available sources. In contrast, traffic flow data collection faces a dual challenge: strict privacy restrictions and high collection costs. Currently, traffic flow data is primarily acquired through two methods: First, statistical analysis of individual travel data such as shared bicycle trip records and taxi GPS trajectories. However, this data contains sensitive privacy information such as user location and travel habits, requiring strict privacy regulations during data use, which limits the data's usability. Second, precise statistics are obtained by widely deploying geomagnetic sensors and high-definition cameras on urban roads. However, this method is not only costly in terms of initial equipment purchase and installation, but also requires significant resources for subsequent maintenance, data transmission, and storage. Furthermore, it struggles to achieve seamless coverage across the entire city, with areas like old urban areas and remote roads often becoming blind spots for data collection. Therefore, existing public traffic flow datasets, such as METR-LA and PEMS-BAY, generally suffer from small scale, limited data dimensions, and incomplete spatial coverage, making it difficult to support the analysis and modeling of traffic flow at the urban scale.

[0004] Against this backdrop, traffic flow generation technology has emerged as a key solution to overcome data bottlenecks. This technology aims to synthesize highly realistic traffic flow data by learning the conditional mapping relationship between static urban geographic environments (such as road network topology and land use types) and dynamic traffic flow distribution. Early studies mostly employed physics-driven models such as gravity models and radiation models. While these models can roughly estimate static average traffic flow based on population distribution, they neglect the dynamic variability of traffic flow. In recent years, deep generation methods centered on deep learning have gradually become dominant. Researchers use rich geographic environmental features such as urban POI distribution and traffic zone division as model inputs, and leverage advanced architectures such as variational autoencoders (VAEs), generative adversarial networks (GANs), and diffusion models to accurately model the conditional probability distribution of traffic flow data. Among these, diffusion models, with their powerful multimodal data processing capabilities and progressive generation mechanism, are particularly outstanding in terms of the realism and diversity of the generated data.

[0005] However, current deep learning-based traffic flow generation methods still have shortcomings. Although deep learning models can incorporate stronger geographical prior information, these priors are often city-specific, thus limiting the model's generalization ability. Such priors are essentially dependencies between local geographic structures and their corresponding traffic patterns, which typically require training based on historical traffic data specific to a particular city. This dependency hinders the deployment of models in cities with insufficient traffic flow records. Therefore, existing deep learning-based traffic flow generation methods often struggle to be transferred across cities.

[0006] This invention considers restricting the model from learning from common geographical features shared between cities, thereby avoiding learning inherent patterns associated with specific cities. Specifically, common geographical features between cities include points of interest (POIs), roads, and population. However, utilizing these geographical features for inter-city migration faces two main difficulties: (1) Domain offset: Within a single city, regions with similar geographical features typically exhibit similar traffic flow patterns. However, in cross-city environments, domain offset in geographic representation disrupts this correspondence. Therefore, regions in different cities, even if their geographical features are close in the representation space, may exhibit significantly different traffic flow behaviors.

[0007] (2) Insufficient dynamic conditions: Static geographic environment alone cannot support accurate cross-city traffic generation. Regions with similar spatial characteristics may have similar periodicity and trends, but their random attributes may differ significantly (e.g., mean and variance). These dynamics are provided by historical traffic records, but they do not exist in cross-city scenarios. Summary of the Invention

[0008] The purpose of this invention is to solve the problem that traffic flow data generation models based on deep learning are difficult to migrate across cities, and to provide a method for generating high-quality dynamic traffic flow sequences without requiring historical traffic flow data of the target city.

[0009] To achieve the above objectives, the technical solution adopted by the present invention is as follows: In a first aspect, the present invention provides a method for generating cross-city traffic based on geographic representation alignment and retrieval enhancement, the method comprising the following steps: Step 1: Obtain the geographic feature data of the source city and the target city, and divide the urban space into rectangular grids, with each grid as a geographic region, and extract the original geographic features of each region; Step 2: Construct a graph structure based on regional adjacency relationships, use the graph Transformer model as a spatial encoder to process urban regional maps with original geographical features, extract high-order geographical representations, and jointly train the encoder using traffic flow alignment loss and cross-city alignment loss to achieve cross-city geographical representation alignment. Step 3: For any region in the target city, retrieve regions with similar conditions from the source city, and encode the historical flow dynamic patterns of similar regions in the source city, adding them to the generation conditions of the conditional diffusion probability model; the generation conditions integrate the following three types of information: aligned geographical representation, the start time representation of the flow to be generated, and the dynamic flow representation of the source city obtained by retrieval. Step 4: Input the geographical representation, temporal characteristics and random noise of the target city into the conditional diffusion probability model, and generate the traffic flow sequence of the target city based on the generation conditions.

[0010] Furthermore, in step 1, the extracted original geographic features include POI features, road network features, and population features; wherein, the POI features are extracted using the term frequency-inverse document frequency algorithm.

[0011] Furthermore, in step 2, the traffic flow alignment loss is expressed as follows:

[0012] in, This indicates the traffic flow alignment loss. This represents the total number of regions across all source cities. Indicates the area and Geographical representation differences This indicates the degree of difference in average traffic flow between the two. The expression for the cross-city alignment loss is as follows:

[0013] in, Indicates cross-city alignment loss. This represents the cost matrix between the source city and the target city. This represents the transmission matrix.

[0014] Furthermore, in step 3, traffic flow data for each area of ​​the source city is divided into fixed-length sequence samples according to a pre-set time length; source city data samples under similar conditions are retrieved based on preset rules, which include: Consistency of periodic characteristics: The periodic characteristics of the starting time of the selected source city data samples are consistent with those of the samples to be generated in the current target city; Similarity of regional geographic representations: For samples that meet the consistency of periodic characteristics, calculate the Euclidean distance between the geographic representation of the target city region and the geographic representation of the source city region, and select the source city region whose Euclidean distance meets the requirements.

[0015] Furthermore, in step 3, a self-attention network is used to extract dynamic traffic representations of similar areas in the source city.

[0016] Furthermore, in step 4, the conditional diffusion probability model uses U-Net to estimate the noise level.

[0017] Furthermore, the conditional diffusion probability model is trained using the mean squared error loss function.

[0018] Secondly, the present invention also provides a cross-city traffic generation system based on geographic representation alignment and retrieval enhancement. The system includes: a geographic representation alignment module, a retrieval-based generation condition enhancement module, and a conditional diffusion probability model. When applied, the above-mentioned cross-city traffic generation method based on geographic representation alignment and retrieval enhancement is executed to generate cross-city traffic data.

[0019] Thirdly, embodiments of the present invention also provide an electronic device, including a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the above-described method for generating cross-city traffic based on geographic representation alignment and retrieval enhancement.

[0020] Compared with the prior art, the present invention has at least the following beneficial technical effects: 1. This invention can solve the problem of poor cross-city generalization ability of existing deep generation models due to domain offset and lack of dynamic conditions, and can achieve high-fidelity, zero-sample cross-city traffic flow generation.

[0021] 2. This invention uses two geographic representation alignment methods, TFA and CCA, to reduce domain offset between different cities and achieve transferable geographic representation.

[0022] 3. This invention designs a retrieval enhancement generation method that provides stronger cross-city condition generation information. It retrieves data samples with similar conditions to the target city from data-rich source cities and uses the traffic flow patterns of similar samples to guide the traffic flow generation of the target city.

[0023] Other features and advantages of the invention will be set forth in the following description, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in the written description and the accompanying drawings.

[0024] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description

[0025] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0026] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used together with the embodiments of the invention to explain the invention and do not constitute a limitation thereof.

[0027] Figure 1 The diagram illustrates the neural network model structure and training-inference method provided in the embodiments of the present invention, and describes the technical details of the three main stages.

[0028] Figure 2 Heatmaps of generated and actual traffic in Chicago provided for embodiments of the present invention.

[0029] Figure 3 This is a schematic diagram of the electronic device structure provided in an embodiment of the present invention. Detailed Implementation

[0030] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are some embodiments of the present invention, but not all embodiments.

[0031] In the description of this invention, it should be noted that some processes described in this application specification and drawings include multiple operations that appear in a specific order. However, it should be clearly understood that these operations may be performed in any order or in parallel. Furthermore, various numbers are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0032] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.

[0033] Example 1: This invention provides a cross-city traffic flow generation method based on geographic representation alignment and retrieval enhancement. The invention uses a conditional diffusion probability model (i.e., a denoised diffusion probability model) as the backbone model to model the conditional probability distribution of traffic flow with respect to geographic representation. To reduce domain offset between different cities, this invention designs a spatial feature encoder and a representation alignment loss function. To provide stronger cross-city conditional generation information, this invention designs a retrieval enhancement generation method, which retrieves data samples with similar conditions to the target city from data-rich source cities, and uses the traffic flow patterns of similar samples to guide traffic flow generation in the target city. The method mainly includes the following steps: Step 1: Preparation of raw data: The following data is required to generate traffic flow data using this invention: (1) Geographic feature data of source cities (one or more) and target cities, including POI, road network and population data. POI and road network data can be obtained from the open map platform OpenStreetMap, and population data can be obtained from the global open population statistics platform WorldPop.

[0034] (2) Traffic flow data of the source city: can be obtained from publicly available traffic flow or trajectory datasets.

[0035] Step 2, Data Preprocessing: The urban space is divided into rectangular grids (grid size is customizable), with each grid representing a geographic region. The TF-IDF algorithm is used to extract POI features: each POI category is treated as a word, all POIs within the region are considered a document, and the entire city is defined as a corpus. The TF-IDF score for each region is calculated. Road network features are calculated: the total mileage of each type of road within the region is calculated to form a road network feature vector. Population features are calculated: the population size and population density within the region are calculated.

[0036] If traffic flow data sampling is unbalanced or noisy, linear interpolation is used to fill in missing values. Moving averages are used for sequence smoothing.

[0037] Step 3, Model Training: (1) Representation Alignment Training: Establish the graph structure of the urban region based on the adjacency relationship, using the technical solution mentioned in the technical solution. and The loss function is used to train the Graph Transformer model to obtain the geographical representations of the source city and the target city.

[0038] (2) Diffusion model training: Using the aligned geographic representation and source city traffic flow data as input, other samples similar to the source city are retrieved. The conditions of the diffusion model are composed of geographic representation, retrieved samples and time features. The conditional diffusion model is trained according to the forward noise addition and backward noise reduction formulas.

[0039] Step 4: Target City Data Generation Using the geographical representation, temporal characteristics, and random noise of the target city as input, similar samples from the source city are retrieved to construct the generation conditions of the target city. The generated samples are obtained through the reverse denoising process of the diffusion model.

[0040] I. The specific embodiments and working principle of the present invention will be described in detail below with reference to the accompanying drawings: This invention proposes a cross-city retrieval-enhanced traffic flow generation model, a simple yet effective model based on Denoising Diffusion Probabilistic Models (DDPM). To address the domain offset problem, this invention proposes a cross-city geographic representation alignment method; to address the insufficient conditions problem, this invention proposes a data retrieval-based enhancement method for generation conditions, which integrates traffic flow data from source cities to supplement temporal dynamic information. See also... Figure 1 As shown, the present invention mainly includes the following three stages.

[0041] 1. Geographic representation alignment: First, this invention selects common geographical features shared among cities and uses them to construct a basic representation for each region. Then, it employs a graph transformer as a spatial encoder, taking the regional map of each city as input to generate higher-level representations. Finally, the encoder is trained using Traffic Flow Alignment (TFA) and Cross City Alignment (CCA) to achieve transferable geographical representations.

[0042] This invention extracts the original geographical features of a city from the following three aspects.

[0043] (1) POI features (denoted as) ): Points of Interest (POIs) are highly correlated with the functions of urban areas and have a crucial impact on the generation of traffic flow patterns. This invention constructs the semantic features of POIs in a region by statistically analyzing the number of each POI category. However, there is a significant imbalance in the number of different POI categories; for example, the total number of commercial POIs is far greater than that of residential POIs. This imbalance can easily lead the model to ignore the influence of fewer POI categories. Therefore, this invention employs the Term Frequency-Inverse Document Frequency (TF-IDF) algorithm to extract POI features. Specifically, this invention treats each POI category as a word, all POIs in the region as a document, and the entire city as a corpus. When calculating the importance of a word to a document, the algorithm automatically combines the word's frequency of occurrence in the corpus for weighted analysis.

[0044] (2) Road network characteristics (denoted as) ): Road network characteristics reflect the traffic attributes of a region; for example, areas with a high density of main roads tend to generate larger traffic volumes. This invention statistically analyzes the total mileage of various types of roads within a region, constituting the region's original road network characteristics.

[0045] (3) Population characteristics (referred to as) The population size of a region has a direct impact on traffic flow; generally, the average traffic flow in densely populated areas is significantly greater than that in sparsely populated areas. This invention obtains estimated population size and population density values ​​for a region as inputs to the original features.

[0046] Next, this invention uses a Graph Transformer model as a spatial encoder to process urban region maps with original geographic features. Specifically, for an urban region... In this process, the three basic primitive features are concatenated and transformed into the latent space through a multilayer perceptron (MLP), as expressed by the formula:

[0047] Then, with As the initial representation of a node, it is input into a multi-layer Graph Transformer spatial encoder to obtain a city. Geographical representation of each region ( (This refers to the number of regions within a city), expressed as:

[0048] in, It is a graph composed of urban areas, with each area as a node and the adjacency relationship between areas as an edge (if two areas are spatially adjacent, there is an undirected edge between them).

[0049] Graph Transformer models the correlations between nodes by computing a weighted combination of node representations. Each node dynamically aggregates information from its neighbors by computing attention weights to other nodes. Compared to ordinary Graph Neural Networks (GNNs), Graph Transformer is better at capturing long-range dependencies between nodes and mitigating oversmoothing.

[0050] To obtain a spatial encoder that can migrate across cities and extract consistent geographic representations across cities, this invention designs two geographic representation alignment methods to pre-train the spatial encoder.

[0051] (1) Traffic Flow Alignment (TFA): Geographic representation of a region is a crucial part of traffic flow generation. Ideally, the differences in geographic representation across different regions should accurately reflect the differences in traffic flow. However, raw geographic representations often contain noise and components unrelated to traffic flow generation. To address this, this invention uses traffic flow data from the source city to supervise the training of a spatial encoder, aligning the geographic representation of a region with its traffic flow. Specifically, this invention first calculates the average traffic flow for each region within the source city. In terms of a given time length The average flow rate for the region is obtained by averaging the historical flow rates for each time slot. Considering that there may be multiple source cities, the regions and corresponding geographic representations of all source cities are denoted as follows:

[0052] in, Indicates all areas of the source city. Indicates the geographical representation of the source city, superscript Indicates the source city; superscript appears in the following text. Indicates the target city. This represents the total number of regions across all source cities.

[0053] Then, the correlation between regional geographic representation and regional traffic flow is measured using the following loss function:

[0054] in, Indicates the area and Geographical representation differences This represents the difference in average traffic flow between the two. To ensure that the representation and the traffic flow difference are on the same quantitative scale, this invention uses a max-min normalized Euclidean distance to calculate the two differences, expressed by the formula:

[0055]

[0056] Through training with the traffic flow alignment loss function described above, the spatial encoder can learn how to extract the features most relevant to traffic flow, bringing areas with similar flow closer together in the representation space and pushing areas with large flow differences further apart in the representation space.

[0057] (2) Cross City Alignment (CCA): Traffic flow alignment only uses the geographic representation and flow data of the source city. Considering the domain offset between the geographic representations of the target city and the source city, traffic flow alignment alone is insufficient to obtain consistent geographic representations across cities. This invention aims to ensure that semantically similar areas in the source and target cities are also close in the representation space. However, the target city lacks traffic flow information and therefore semantic labels. To address this, this invention models cross-city representation alignment as an Optimal Transport (OT) problem, aiming to find the minimum-cost mapping between the source and target city regions using Wasserstein distance. Similarly, the geographic representations of each region in the target city are denoted as:

[0058] in, The number of regions in the target city. Because... and Since these are all finite sets, this invention can directly use existing optimal transfer solvers to calculate... and The Wasserstein distance is calculated first. The transmission cost matrix between the source and target cities is then calculated. This invention uses the Euclidean distance, which represents the spatial dimension, as the cost metric, expressed by the formula:

[0059] in, Any area in the source city The representation, Any area within the target city The representation of the cost matrix. The OT solver calculates the transfer matrix based on the cost matrix:

[0060] This indicates that the transfer matrix is ​​obtained directly using existing OT problem solvers. Input matrix Output matrix .

[0061] The cross-city alignment loss is the dot product of the cost matrix and the transfer matrix, which is the Wasserstein distance:

[0062] in, This indicates the loss due to cross-city alignment.

[0063] 2. Enhanced generation conditions based on retrieval: Retrieval Augmented Generation (RAG) is widely used in large language models (LLMs) because it can dynamically integrate knowledge from external databases and improve generation accuracy. Recently, time series analysis has incorporated RAG to provide meaningful guidance. For example, similarity retrieval based on time series embeddings has been applied to improve the predictive accuracy of Time Series Foundation Models (TSFMs) and enhance their zero-shot capability. RAG helps enhance the model's ability to handle unseen scenarios. However, attempts to use RAG in the field of spatiotemporal data generation remain limited.

[0064] This invention models the traffic flow generation problem as a problem of fitting a conditional probability distribution. Based on the aligned geographic representation, the conditional probability distribution can be directly learned using deep generative models (such as DDPM). However, since geographic representation is static, while traffic flow exhibits complex dynamic patterns over time, using only static geographic representation as a condition can easily lead to insufficient information, making it difficult to model fine-grained traffic patterns and reducing the accuracy of cross-city traffic generation. To address this challenge, this invention proposes a retrieval-based enhancement method for generation conditions. For each region of the target city, this invention retrieves regions with similar conditions from the source cities, then encodes the historical dynamic patterns of these similar regions in the source cities and adds them to the generation conditions of DDPM to enhance DDPM's ability to model dynamic traffic.

[0065] For any region of the target city Specifically, the generation condition information introduced in this invention comprises three parts: (1) Region Aligned geographic representation ; (2) The start time representation of the traffic needs to be generated ; (3) Source city dynamic flow representation obtained by retrieval .

[0066] Among them, time representation It contains three pieces of information related to periodicity, including monthly information ( Date information (indicates the day of the week) and hour information ( These three types of discrete-time information are transformed into dense vector representations through their respective embedding layers, and then concatenated together to form a time representation, as follows:

[0067] The dynamic traffic information retrieval mechanism for source cities is designed as follows: This invention divides traffic flow data of various regions in the source city into fixed-length sequence samples according to a pre-set time length T. It retrieves source city data samples under similar conditions based on two rules: (1) Consistency of periodic characteristics: ensuring that the periodic characteristics of the starting time point of the selected source city data samples are consistent with those of the current target city's samples to be generated, i.e., they have the same... , and (2) Similarity of regional geographic representation: For samples that meet the consistency of periodic characteristics, the similarity of the target city region is calculated. The Euclidean distance between the geographic representations of the cities and the geographic representations of the source cities is calculated, and the K source city regions with the smallest Euclidean distances are selected. For the K retrieved source city regions, the average flow for each time slice is calculated, resulting in a set of average flow patterns for K similar regions. :

[0068] Next, this invention uses a self-attention network to extract dynamic traffic representations of similar areas in the source city, expressed by the formula:

[0069] Dynamic flow characterization It incorporates fine-grained features such as periodicity and trend in traffic flow sequence data to enhance the generation conditions of DDPM. As the amount of source city data increases, the accuracy of the retrieved dynamic information will gradually improve.

[0070] Finally, the conditional information from the three levels is concatenated and cross-fused through a multilayer perceptron (MLP) network to obtain the generation conditions of DDPM, as follows:

[0071] in, This represents the generation conditions (constraints) obtained by splicing and fusing condition information from three levels.

[0072] 3. Flow generation based on conditional diffusion model: This invention uses a Conditional Diffusion Probability Model (DDPM) to fit the distribution of traffic flow data. DDPM assumes that the data can be transformed from clean raw data to complete noise through a gradual process of adding noise, and then the original data can be gradually recovered from the noise by learning a reverse denoising process. This process is a Markov chain, in which the distribution of data depends only on the state of the previous step at each step.

[0073] Forward noise addition process. Assume samples are obtained from a real dataset. The forward process executes a total of The Markov noise addition process is as follows:

[0074] in, Represents the identity matrix. This is a hyperparameter, k∈[1~T]. As the forward process progresses, the noise in the data gradually increases, eventually forming samples that approximate a standard Gaussian distribution. The forward process does not involve the forward propagation of the neural network; through mathematical derivation, the k-step noise addition process can be simplified to a single step, calculated as follows:

[0075] in, The noise is sampled from a standard Gaussian distribution. The calculation formula is:

[0076] The reverse denoising process aims to use a neural network model to predict the magnitude of noise, gradually subtracting the noise from the noisy samples to ultimately recover the original data. The reverse denoising process also follows the Markov property and satisfies a Gaussian distribution, expressed by the formula:

[0077] in, Let represent the parameters of a trainable neural network model. The mean of this Gaussian distribution can be expressed as:

[0078] in, This is the noise level predicted by the neural network model. The model's input includes the samples after k steps of noise addition. Steps and constraints The variance of the Gaussian distribution is determined by the hyperparameter and is expressed as:

[0079] Through a T-step reverse denoising process, DDPM can restore Gaussian noise to data samples that conform to the true distribution. By training a neural network noise estimation model, DDPM gradually learns to map the standard Gaussian distribution to the complex distribution of the real data under constraints.

[0080] During the training phase, the model needs to learn to predict. k To determine the noise level after adding noise, this invention uses the Mean Squared Error (MSE) function for training. The loss function is as follows:

[0081] During the training phase, the number of noise addition steps k and standard Gaussian noise are randomly sampled, and the noise addition formula for one step is used to calculate... The noise prediction model of this invention uses a one-dimensional U-Net model. During the inference phase, for each region of the target city... DDPM samples a standard Gaussian noise distribution as a T-step noise-added sample. Then, starting from the Tth step, U-Net is used to predict the noise magnitude. Each reverse denoising process calls the noise prediction model once. After T-step denoising, a sample that conforms to the true distribution can be restored. The noise prediction model uses the enhanced conditional information as guidance.

[0082] II. Experimental Verification: To verify the advantages of this invention in cross-city traffic flow data generation, this invention used datasets from four cities (Chicago, Washington, Toronto, and New York) for model training and testing, selecting one city as the target city and the other three as source cities each time. The baseline methods for traffic flow data generation compared include two typical deep learning-based traffic flow generation models: (1) Static traffic flow generation model: Based on the geographical characteristics of the region, the average traffic flow is directly predicted, including the following models: GMEL: Two graph neural network models are used to extract geographic representations of urban areas from the perspectives of inflow and outflow, respectively, and a BiLinear prediction head is used to output inflow / outflow and OD flows. This paper uses the inflow / outflow results.

[0083] DFG: Uses Deep Cross Networks (DCNs) to extract POI representations inside and outside the region, and uses intent-aware traffic flow data for supervised training to predict the inbound and outbound traffic flow of the region.

[0084] (2) Dynamic traffic generation model: This type of model uses deep generative networks to fit the conditional probability distribution of real traffic data and learns the complex mapping relationship from random Gaussian noise to traffic data, including the following: KSTDiff: It uses urban knowledge graphs to extract representations of urban geographic entities and then constructs a knowledge-enhanced spatiotemporal diffusion model to generate regional inflows and outflows (situations).

[0085] CGAN: A conditional generative adversarial network. In experiments, this invention uses raw static geographic features and temporal embeddings as conditions to guide the generative adversarial network (GAN) in generating data.

[0086] Diffwave: A diffusion model suitable for generating time-series data, commonly used in speech synthesis. In this experiment, we use it to learn the distribution of traffic flow time-series data.

[0087] DiT: This is a diffusion probability model that uses a Transformer as a noise estimator.

[0088] DDPM: This is a diffusion probability model for image synthesis that uses U-Net as a noise estimator. To apply it to traffic flow data generation, this invention replaces two-dimensional convolution with one-dimensional convolution.

[0089] CVAE: This is a conditional variational autoencoder. Conditional information is added to both the encoder and decoder to guide it in learning the conditional probability distribution of the data. This invention uses the original static geographic features and temporal embeddings as conditions.

[0090] This invention uses three commonly used indicators in traffic flow generation research to evaluate the quality of the generated data: Common Part of Commuter (CPC), Normalized Mean Absolute Error (NMAE), and Normalized Root Mean Square Error (NRMSE). Because actual traffic flow values ​​vary significantly across different cities, the traffic flow data generated by the model in this invention is normalized to reflect the relative magnitude of traffic flow in different areas and at different times within the same city. All indicators are calculated based on the normalized data, and the calculation formulas are as follows:

[0091]

[0092]

[0093] in, To generate values, For the true value, This test dataset contains the number of values ​​for all samples. To improve the stability of the evaluation results, this paper groups the data according to the region ID, month, day of the week, and hour of the test samples in the target city, and calculates the differences between the group means.

[0094] ① Overall evaluation of the generated effect: Table 1 shows the zero-shot cross-city generation performance comparison between the proposed method and the selected baseline method. The experiment was divided into four groups. Each city was designated as the target city, and the other three cities were designated as source cities. The model was trained only on the source cities and evaluated on the unseen target cities with zero shots. For each target city, inflow and outflow data were generated.

[0095] Table 1 Overall Evaluation of Cross-City Traffic Flow Generation

[0096] The results show that the proposed method consistently outperforms existing methods across various settings, achieving state-of-the-art (SOTA) performance. Compared to the average of all baseline methods, the proposed method achieves a 59.7% improvement; compared to the second-best baseline method (GMEL), it achieves a 22.5% improvement. Compared to conventional DDPM, the proposed method achieves an average improvement of 61.5%. It is worth noting that due to the domain offset of the original geographic features of the source and target cities, directly using deep generation models can easily lead to a significant decrease in generalization, and its performance may be inferior to static traffic generation models (GMEL and DFG).

[0097] ② Usability evaluation of generated data: To further evaluate the quality of the generated traffic data, this paper conducts downstream task experiments on generated datasets from multiple target cities. Specifically, we train two basic traffic sequence prediction models using real datasets, datasets generated by CRAFT, and datasets generated by other baseline methods: a standard Long Short-Term Memory (LSTM) network and a Transformer. The downstream task settings are relatively basic: using a time length of... Using the flow sequence as input, predict the future Traffic flow. All traffic flow data remains normalized. The samples in each model-generated dataset and the real dataset are in one-to-one correspondence; the training set for downstream tasks is the generated data, and the test set is the real data.

[0098] The evaluation metrics for the prediction results of LSTM and Transformer are MSE and RMSE, and the results are shown in Tables 2 and 3.

[0099] Table 2 Performance of downstream tasks (using LSTM as the downstream task model)

[0100] Table 3. Performance of downstream tasks (using Transformer as the downstream task model)

[0101] As shown in Tables 2 and 3, the proposed model outperforms all baseline methods across various evaluation metrics. Compared to the average performance of all baseline methods, it achieves a 55.9% performance improvement; compared to the second-best baseline method (DDPM), it achieves a 14.9% improvement. Furthermore, the proposed model achieves performance closest to that of direct training on real traffic flow data. Specifically, its average performance decrease is only 10.4%, with a minimum decrease of 3.1% and a maximum decrease of 22.2%. These results highlight the model's strong ability to generate cross-city zero-sample traffic flow and demonstrate its feasibility in replacing real data in practical applications.

[0102] In this embodiment, the heatmaps of generated traffic and actual traffic in Chicago are as follows: Figure 2 As shown, part (10) is the traffic generated by the present invention (Cross-city Retrieval-Augmented trafficFlow generaTion model, CRAFT). Compared with other existing methods, the present invention has the best generation effect for cross-city migration.

[0103] Example 2: This invention also provides a cross-city traffic generation system based on geographic representation alignment and retrieval enhancement. The system includes a geographic representation alignment module, a retrieval-based generation condition enhancement module, and a conditional diffusion probability model. In application, the cross-city traffic generation method based on geographic representation alignment and retrieval enhancement described in Embodiment 1 above is used to generate cross-city traffic data.

[0104] The cross-city traffic generation system based on geographic representation alignment and retrieval enhancement provided in this embodiment of the invention has the same implementation principle and technical effects as the aforementioned method embodiment. For the sake of brevity, any parts not mentioned in this embodiment can be referred to the corresponding content in the aforementioned method embodiment, and will not be repeated here.

[0105] Example 3: Reference Figure 3 As shown, this embodiment of the invention also provides an electronic device for generating cross-city traffic data. The electronic device may include a processor 10, a memory 11, a communication bus 12 and a communication interface 13, and may also include a computer program stored in the memory 11 and capable of running on the processor 10.

[0106] In some embodiments, the processor 10 may be composed of integrated circuits, such as a single packaged integrated circuit or multiple integrated circuits packaged with the same or different functions, including combinations of one or more central processing units, microprocessors, digital processing chips, graphics processors, and various control chips. The processor 10 is the control core of the electronic device, connecting various components of the entire electronic device through various interfaces and lines. It executes programs or modules stored in the memory 11 and calls data stored in the memory 11 to perform various functions and process data within the electronic device.

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

[0108] It should be noted that the word "comprising" does not exclude the presence of components or steps not listed in the claims. The words "a" or "an" preceding a component do not exclude the presence of a plurality of such components. This invention can be implemented by means of hardware comprising several different components and by means of a suitably programmed computer.

[0109] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0110] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for cross-city traffic generation based on geo-representation alignment and retrieval enhancement, characterized in that, The method comprises the following steps: Step 1: Obtain the geographical feature data of the source city and the target city, divide the city space into rectangular grids, each grid as a geographical area, and extract the original geographical features of each area; Step 2: Construct a graph structure based on the adjacency relationship of the areas, process the city area graph with original geographical features through a graph Transformer model as a spatial encoder, extract high-order geographical representations, and jointly train the encoder using traffic flow alignment loss and cross-city alignment loss to achieve cross-city geographical representation alignment; Step 3: For any area of the target city, retrieve similar areas from the source city, and encode the historical flow dynamic pattern of the similar areas in the source city to add to the generation condition of the conditional diffusion probability model; the generation condition fuses the following three kinds of information: aligned geographical representation, start time representation of the traffic flow to be generated, and source city dynamic flow representation obtained by retrieval; Step 4: Input the geographical representation, time feature and random noise of the target city into the conditional diffusion probability model, and generate the traffic flow sequence of the target city based on the generation condition.

2. The method of claim 1, wherein, In step 1, the extracted original geographical features include POI features, road network features and population features; wherein the POI features are extracted using the term frequency-inverse document frequency algorithm.

3. The method of claim 1, wherein, In step 2, the traffic flow alignment loss has the following expression: wherein, denotes the traffic flow alignment loss, denotes the sum of the number of regions for all source cities, denotes the region and geographical representation difference, denotes the difference in average traffic flow for both; The cross-city alignment loss has the following expression: wherein, represents a cross-city alignment loss, represents a cost matrix between source cities and target cities, represents a transmission matrix.

4. The method of claim 1, wherein, In step 3, the traffic flow data of each area in the source city is divided into fixed-length sequence samples according to a pre-set time length; The source city data samples under similar conditions are retrieved based on a pre-set rule, which includes: Periodic feature consistency: the periodic feature of the start time point of the filtered source city data sample is consistent with the current target city sample to be generated; Area geographical representation similarity: for the sample that meets the periodic feature consistency, calculate the Euclidean distance between the geographical representation of the target city area and the geographical representation of the source city area, and select the source city area with the required Euclidean distance.

5. The method of claim 4, wherein, In step 3, a self-attention network is used to extract the dynamic flow representation of the similar areas in the source city.

6. The method of claim 1, wherein, In step 4, the conditional diffusion probability model uses a U-Net to estimate the noise size.

7. The method of claim 6, wherein, The conditional diffusion probability model is trained using a mean squared error loss function.

8. A cross-city traffic generation system based on geo-characterization alignment and retrieval enhancement, characterized in that, The system comprises a geographical representation alignment module, a retrieval-based generation condition enhancement module and a conditional diffusion probability model, and when applied, it performs the method of any one of claims 1-7 to generate cross-city flow data.

9. An electronic device, comprising: It comprises a processor and a memory, the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the method of any one of claims 1-7.