Upload 9 files
Browse files- .gitattributes +4 -0
- FM.png +3 -0
- PM.png +3 -0
- PredM.png +3 -0
- README.md +156 -0
- RM.png +3 -0
- fusion_model.pth +3 -0
- perception_model.pth +3 -0
- prediction_model.pth +3 -0
- representation_model.pth +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
FM.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
PM.png filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
PredM.png filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
RM.png filter=lfs diff=lfs merge=lfs -text
|
FM.png
ADDED
|
Git LFS Details
|
PM.png
ADDED
|
Git LFS Details
|
PredM.png
ADDED
|
Git LFS Details
|
README.md
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Urban Mobility Integrated Neural Dynamics (U-MIND)
|
| 2 |
+
|
| 3 |
+
## 📖 Model Summary
|
| 4 |
+
|
| 5 |
+
**Urban Mobility Integrated Neural Dynamics (U-MIND)** constitutes the specialized algorithmic core (Layer 2) of the "Traffic Large Model" architecture. Unlike monolithic Large Language Models (LLMs), **U-MIND** is engineered as a **collaborative cluster of four parallel micro-models**, specifically optimized for the physical constraints of urban transportation. It functions as the high-precision reasoning engine that grounds the L1 model's intent understanding into accurate, mathematically rigorous mobility forecasts by fusing static road semantics with dynamic sensor streams.
|
| 6 |
+
|
| 7 |
+
The **U-MIND** cluster integrates four specialized engines:
|
| 8 |
+
|
| 9 |
+
1. **PM (Perception Engine):** Captures high-frequency dynamics and implicit couplings.
|
| 10 |
+
2. **RM (Representation Engine):** Encodes static topology and semantic patterns.
|
| 11 |
+
3. **FM (Fusion Engine):** Aligns heterogeneous multimodal data.
|
| 12 |
+
4. **PredM (Evolution Engine):** Forecasts future spatio-temporal states.
|
| 13 |
+
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
## 🏗️ Model Architecture
|
| 17 |
+
|
| 18 |
+
The cluster adopts a **Parallel Collaborative Architecture**, where each model specializes in a specific domain of the urban traffic system.
|
| 19 |
+
|
| 20 |
+
### 1. PM: Perception Model
|
| 21 |
+
* **Role:** **Dynamic State Extractor**
|
| 22 |
+
* **Core Function:** Processes raw, noisy sensor data (Flow, Speed, Occupancy). It utilizes 1D convolution and adaptive pooling to extract short-term trends and denoise signal fluctuations caused by random events.
|
| 23 |
+
* **Key Capability:** Identifies traffic anomalies (e.g., sudden congestion) and compresses high-dimensional time-series into a compact context fingerprint.
|
| 24 |
+
|
| 25 |
+

|
| 26 |
+
|
| 27 |
+
### 2. RM: Representation Model
|
| 28 |
+
* **Role:** **Semantic Pattern Encoder**
|
| 29 |
+
* **Core Function:** Focuses on the static and semi-static attributes of the road network (POI distribution, road geometry). It learns a low-dimensional manifold representation of diverse traffic patterns (e.g., "Residential Area" vs. "Business District").
|
| 30 |
+
* **Key Capability:** Distinguishes between different functional zones based on their daily peak-hour signatures (morning/evening rush).
|
| 31 |
+
|
| 32 |
+

|
| 33 |
+
|
| 34 |
+
### 3. FM: Fusion Model
|
| 35 |
+
* **Role:** **Cross-Modal Aligner**
|
| 36 |
+
* **Core Function:** Acts as the bridge between ground traffic, rail transit, and environmental factors. It employs Multi-Head Attention to dynamically weigh different data sources based on real-time contexts (e.g., increasing rail weight during rainy days).
|
| 37 |
+
* **Key Capability:** Resolves the heterogeneity between static embeddings and dynamic flows, outputting a unified multimodal context vector.
|
| 38 |
+
|
| 39 |
+

|
| 40 |
+
|
| 41 |
+
### 4. PredM: Prediction Model
|
| 42 |
+
* **Role:** **Future State Estimator**
|
| 43 |
+
* **Core Function:** A specialized graph-based predictor that models the propagation of traffic waves. It combines dilated convolutions for long-range temporal reception with graph structures for spatial dependency.
|
| 44 |
+
* **Key Capability:** Provides high-precision forecasts for both urban ground and rail mobility demands, serving as the calculation engine for the upper-layer applications.
|
| 45 |
+
|
| 46 |
+

|
| 47 |
+
|
| 48 |
+
---
|
| 49 |
+
|
| 50 |
+
## 💻 Usage: Simulation & Loading
|
| 51 |
+
|
| 52 |
+
This section demonstrates how to generate physics-consistent simulated data and load the pre-trained model weights.
|
| 53 |
+
|
| 54 |
+
```python
|
| 55 |
+
import torch
|
| 56 |
+
import numpy as np
|
| 57 |
+
# Assuming model definitions (PM, RM, FM, PredM) are imported
|
| 58 |
+
from urban_mobility_models import PerceptionModel, RepresentationModel, FusionModel, SpatioTemporalPredictor
|
| 59 |
+
|
| 60 |
+
class DataSimulator:
|
| 61 |
+
"""
|
| 62 |
+
Used to generate synthetic data that reflects the characteristics of urban traffic, covering four tasks: perception, representation, fusion, and prediction.
|
| 63 |
+
"""
|
| 64 |
+
|
| 65 |
+
@staticmethod
|
| 66 |
+
def sim_perception_data(batch_size=32, seq_len=24, sensors=5):
|
| 67 |
+
"""1. [PM] Simulate Sensor Data: Adds Rush Hour & Random Noise"""
|
| 68 |
+
data = np.random.normal(50, 15, (batch_size, seq_len, sensors))
|
| 69 |
+
# Add rush hour patterns (Morning 8am / Evening 6pm)
|
| 70 |
+
t = np.arange(seq_len)
|
| 71 |
+
rush = 30 * (np.exp(-0.5*((t-8)/2)**2) + np.exp(-0.5*((t-18)/2)**2))
|
| 72 |
+
return torch.FloatTensor(data + rush[:, np.newaxis])
|
| 73 |
+
|
| 74 |
+
@staticmethod
|
| 75 |
+
def sim_representation_data(batch_size=32, feat_dim=32):
|
| 76 |
+
"""2. [RM] Simulate Static Patterns: Residential vs Commercial zones"""
|
| 77 |
+
data = np.zeros((batch_size, feat_dim))
|
| 78 |
+
for i in range(batch_size):
|
| 79 |
+
# Residential peaks at 8am/8pm; Commercial peaks at 1pm
|
| 80 |
+
if np.random.rand() > 0.5:
|
| 81 |
+
data[i, 8] += 2.0; data[i, 20] += 1.5 # Residential
|
| 82 |
+
else:
|
| 83 |
+
data[i, 13] += 2.0 # Commercial
|
| 84 |
+
return torch.FloatTensor(data + np.random.normal(0, 0.5, data.shape))
|
| 85 |
+
|
| 86 |
+
@staticmethod
|
| 87 |
+
def sim_fusion_data(batch_size=32):
|
| 88 |
+
"""3. [FM] Simulate Multimodal Data: Ground, Rail, Weather"""
|
| 89 |
+
ground = np.random.normal(0, 1, (batch_size, 32))
|
| 90 |
+
# Rail correlated with ground + random variance
|
| 91 |
+
rail = 0.6 * ground[:, :24] + 0.4 * np.random.normal(0, 1, (batch_size, 24))
|
| 92 |
+
# Weather (Environment)
|
| 93 |
+
env = np.random.normal(0, 1, (batch_size, 16))
|
| 94 |
+
return [torch.FloatTensor(d) for d in [ground, rail, env]]
|
| 95 |
+
|
| 96 |
+
@staticmethod
|
| 97 |
+
def sim_prediction_data(batch_size=32, nodes=20, time_steps=12):
|
| 98 |
+
"""4. [PredM] Simulate Graph Inputs: History Flow + Adjacency Matrix"""
|
| 99 |
+
# Historical flow sequence
|
| 100 |
+
history = torch.randn(batch_size, nodes, time_steps)
|
| 101 |
+
# Static Graph Adjacency Matrix (sparse connection)
|
| 102 |
+
adj = torch.eye(nodes) + (torch.rand(nodes, nodes) > 0.8).float()
|
| 103 |
+
return history, adj
|
| 104 |
+
|
| 105 |
+
def load_and_verify_cluster():
|
| 106 |
+
# 1. Initialize Models
|
| 107 |
+
pm = PerceptionModel(input_dim=5, hidden_dim=64, output_dim=32)
|
| 108 |
+
rm = RepresentationModel(input_dim=32, hidden_dim=64, representation_dim=16)
|
| 109 |
+
fm = FusionModel(input_dims=[32, 24, 16], hidden_dim=512, output_dim=48)
|
| 110 |
+
pred_m = SpatioTemporalPredictor(num_nodes=20, in_dim=12)
|
| 111 |
+
|
| 112 |
+
# 2. Load Pre-trained Weights
|
| 113 |
+
print("Loading L2 Cluster Weights...")
|
| 114 |
+
pm.load_state_dict(torch.load('perception_model.pth'))
|
| 115 |
+
rm.load_state_dict(torch.load('representation_model.pth'))
|
| 116 |
+
fm.load_state_dict(torch.load('fusion_model.pth'))
|
| 117 |
+
pred_m.load_state_dict(torch.load('prediction_model.pth')) # Hypothetical check
|
| 118 |
+
print(">>> All L2 Models Loaded Successfully.")
|
| 119 |
+
|
| 120 |
+
# 3. Generate & Forward Simulation Data
|
| 121 |
+
print("\nRunning Simulation Inference:")
|
| 122 |
+
|
| 123 |
+
# PM
|
| 124 |
+
pm_out = pm(DataSimulator.sim_perception_data())
|
| 125 |
+
print(f"PM (Perception) Output: {pm_out.shape} - Dynamic Context Extracted")
|
| 126 |
+
|
| 127 |
+
# RM
|
| 128 |
+
rm_out, _ = rm(DataSimulator.sim_representation_data())
|
| 129 |
+
print(f"RM (Representation) Output: {rm_out.shape} - Semantic Node Embeddings")
|
| 130 |
+
|
| 131 |
+
# FM
|
| 132 |
+
fm_out, attn = fm(DataSimulator.sim_fusion_data())
|
| 133 |
+
print(f"FM (Fusion) Output: {fm_out.shape} - Multimodal Aligned Context")
|
| 134 |
+
|
| 135 |
+
# PredM
|
| 136 |
+
hist, adj = DataSimulator.sim_prediction_data()
|
| 137 |
+
pred_out = pred_m(hist, adj)
|
| 138 |
+
print(f"PredM (Prediction) Output: {pred_out.shape} - Future Demand Forecast")
|
| 139 |
+
|
| 140 |
+
if __name__ == "__main__":
|
| 141 |
+
load_and_verify_cluster()
|
| 142 |
+
|
| 143 |
+
```
|
| 144 |
+
|
| 145 |
+
---
|
| 146 |
+
|
| 147 |
+
## ⚙️ Intended Use
|
| 148 |
+
|
| 149 |
+
* **Integrated Mobility Orchestration**
|
| 150 |
+
* Cooperative scheduling of buses and subways based on fused demand.
|
| 151 |
+
|
| 152 |
+
* **Resilient Traffic Management**
|
| 153 |
+
* Rapid response to anomalies (accidents, extreme weather) detected by the Perception engine.
|
| 154 |
+
|
| 155 |
+
* **Urban Planning Analytics**
|
| 156 |
+
* Utilizing Representation Model embeddings to analyze the functional evolution of city districts.
|
RM.png
ADDED
|
Git LFS Details
|
fusion_model.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d56d45eb2ba4d932678ea6665c03663f4ff25d5a77a20789eb02b3e86868d06b
|
| 3 |
+
size 4965348
|
perception_model.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f55f106bdc7e504f52404ceaf7d844bf1493efaab132685b624d833edcaee796
|
| 3 |
+
size 3268122
|
prediction_model.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:edc1a3d25097b5172972acf6d0dd8f84e368abb04f73e042cea10df8cab62500
|
| 3 |
+
size 1029562
|
representation_model.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7d7439669bd41e369b5803919cf88ddc1a043107bec7330d783f7289ee049107
|
| 3 |
+
size 1233076
|