项目
在 GitHub 查看
pincanzhao/DiffAlloc
关于
Diffusion-Guided Bandwidth Allocation for V2X Cooperative Perception
其他项目可以做什么
- Diffusion-guided sampling: Learns structured allocation distributions via conditional DDPM/DDIM
- Reward ensemble guidance: Online selection and gradient-based refinement using a 5-head reward ensemble
- Test-time adaptation: Handles source failures, reward changes, and channel degradation without retraining
- Near-oracle performance: Achieves 97.4% of Oracle (CEM) AP with 51% compute time
实测星标增长
- 24小时
- +17
- 7天
- 正在收集历史
- 15天
- 正在收集历史
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文DiffAlloc: Diffusion-Guided Bandwidth Allocation for V2X Cooperative Perception
Overview
DiffAlloc is a diffusion model-based approach for real-time bandwidth allocation in Vehicle-to-Everything (V2X) cooperative perception systems. Unlike traditional deep reinforcement learning (DRL) methods that produce fixed policies, DiffAlloc enables test-time adaptation without retraining — adapting to source failures, changing objectives, and dynamic environments on the fly.
Key Features
- Diffusion-guided sampling: Learns structured allocation distributions via conditional DDPM/DDIM
- Reward ensemble guidance: Online selection and gradient-based refinement using a 5-head reward ensemble
- Test-time adaptation: Handles source failures, reward changes, and channel degradation without retraining
- Near-oracle performance: Achieves 97.4% of Oracle (CEM) AP with 51% compute time
- Set Transformer encoder: Permutation-invariant processing of variable CAV inputs
Architecture
Source Metadata (N×25) → Set Transformer Encoder → Context (128-dim)
↓
Conditional Diffusion Policy (DDPM train / DDIM infer)
↓
K allocation samples → Reward Selection → Best sample
↓
Gradient Refinement (50 steps)
↓
Final Bandwidth Allocation (N-dim simplex)
Installation
Requirements
- Python 3.8+
- PyTorch 1.12+ with CUDA support
- NVIDIA GPU with ≥8GB memory (tested on RTX 3080)
Setup
git clone https://github.com/YOUR_USERNAME/DiffAlloc.git
cd DiffAlloc
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
Dataset
We use the OPV2V dataset for evaluation.
Data Statistics
- 9 scene directories, 600 frames total
- CAV distribution: {2-CAV: 167, 3-CAV: 45, 5-CAV: 29, 7-CAV: 359}
- Model trained on 7-CAV scenes: 251 train / 53 val / 55 test
Usage
Training
# Step 1: Train the diffusion model + reward ensemble
python train.py --config configs/default.yaml
# Step 2: Improve reward model (optional, for better guidance)
python scripts/train_improved_reward.py
Evaluation
# Main comparison (9 methods at 15 MHz)
python scripts/eval_baselines.py
# Test-time adaptation experiments
python scripts/eval_tta.py
# Ablation studies
python scripts/eval_ablation.py
# Sampling efficiency (K sweep)
python scripts/eval_efficiency.py
# Multi-threshold evaluation
python scripts/eval_multi_threshold.py
# Error bars (3 seeds)
python scripts/eval_error_bars.py
# Scalability (multi-CAV, non-stationary, data efficiency)
python scripts/eval_scalability.py
Generate Figures
# Generate all 30 paper figures
python scripts/gen_figures_part1.py # Fig 1-15
python scripts/gen_figures_part2.py # Fig 16-30
Project Structure
DiffAlloc/
├── models/ # Model definitions
│ ├── diffall.py # Main DiffAlloc model
│ ├── baselines.py # SAC, PPO baseline actors
│ ├── encoder/ # Set Transformer encoder
│ ├── diffusion/ # DDPM/DDIM implementation
│ ├── reward/ # Reward ensemble
│ └── fusion/ # Channel model & perception
├── scripts/ # Experiment scripts
│ ├── eval_baselines.py # Main comparison (9 methods)
│ ├── eval_tta.py # Test-time adaptation
│ ├── eval_ablation.py # Component ablation
│ ├── eval_efficiency.py # Sampling efficiency (K sweep)
│ ├── eval_error_bars.py # Multi-seed evaluation
│ ├── eval_scalability.py # Multi-CAV, non-stationary
│ ├── eval_multi_threshold.py # Threshold robustness
│ ├── eval_visualization.py # Allocation visualization
│ ├── train_reward_model.py # Reward model training
│ ├── gen_figures_part1.py # Figure generation (1-15)
│ └── gen_figures_part2.py # Figure generation (16-30)
├── data/ # Dataset utilities
├── configs/ # Configuration files
├── results/ # Experiment results (JSON)
├── figures/ # Generated figures (PDF)
├── train.py # Main training script
├── eval.py # Main evaluation script
└── requirements.txt # Python dependencies
Model Checkpoints
Pre-trained checkpoints (not included in repo due to size):
| Checkpoint | Description | Size |
|---|---|---|
diffall_v4_improved.pt |
Full DiffAlloc (5-head, 256-dim reward) | 8.1 MB |
sac_opv2v_best.pt |
SAC-RL baseline | 853 KB |
ppo_bc_best.pt |
PPO-RL baseline | 1.1 MB |
Configuration
Key hyperparameters (in configs/default.yaml):
model:
num_sources: 7
context_dim: 128
hidden_dims: [256, 256, 256]
timesteps: 50
temperature: 15.0
ensemble_size: 5
reward_hidden_dim: 256
inference:
K: 128 # Number of samples
ddim_steps: 8 # DDIM inference steps
refine_steps: 50 # Gradient refinement steps
refine_lr: 0.05 # Refinement learning rate
training:
batch_size: 256
learning_rate: 0.001
epochs: 100
reward_samples: 238000
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
探索相关项目
加载中…