Skip to content

juntaowang99/ddpm-localization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DDPM-Loc: Uncertainty-Aware Wireless Localization with Diffusion Models

Python 3.10 PyTorch 2.1 License: MIT

DDPM-Loc introduces a novel approach to wireless localization using Denoising Diffusion Probabilistic Models (DDPMs) for uncertainty-aware position estimation in challenging noise environments.

DDPM-Loc

🚀 Overview

Wireless localization is a critical technology for IoT systems, robotics, and mobile networks. Traditional methods often struggle with uncertainty quantification and performance degradation under high noise conditions. This project presents DDPM-Loc, a diffusion-based approach that leverages the generative capabilities of DDPMs to provide robust, uncertainty-aware localization.

Wireless Localization Scenario DDPM Architecture

🎯 Key Contributions

  • Novel DDPM Architecture: First application of denoising diffusion models to wireless localization problems
  • Uncertainty Quantification: Probabilistic localization with uncertainty estimates through multiple sampling
  • Robust Performance: Superior accuracy across various noise conditions compared to traditional methods
  • Comprehensive Evaluation: Extensive comparison with MLE, GCN, MLP, and U-Net baselines
  • Multiple Noise Models: Support for Gaussian, Rayleigh, and mixture noise distributions

🔬 Technical Innovation

DDPM-Loc treats localization as a generative problem, where the model learns to denoise position estimates conditioned on noisy distance measurements. The diffusion process allows for:

  • Iterative Refinement: Progressive denoising from random noise to accurate positions
  • Conditional Generation: Position estimation conditioned on measurement constraints
  • Uncertainty Modeling: Multiple sampling provides uncertainty estimates
  • Noise Robustness: Better handling of complex noise distributions

📊 Methods Compared

Method Description Key Features Strengths Limitations
DDPM Denoising Diffusion Probabilistic Model Generative approach, uncertainty quantification Robust to noise, provides uncertainty estimates Higher computational cost
GCN Graph Convolutional Network Exploits spatial relationships between nodes Good for structured networks Requires graph construction
MLP Multi-Layer Perceptron Direct regression approach Simple, fast inference Deterministic output only
U-Net U-Net Architecture The same U-Net component in DDPM Good feature extraction Deterministic output only
MLE Maximum Likelihood Estimation Classical optimization-based method Theoretically optimal Sensitive to noise, no uncertainty

📁 Project Structure

DDPM-Loc/
├── ddpm_loc/                 # Main package
│   ├── __init__.py
│   │
│   ├── methods/                # Localization methods
│   │   ├── __init__.py
│   │   ├── base.py              # Base localization method class
│   │   ├── ddpm_loc.py          # DDPM localization
│   │   │
│   │   └── baselines/           # Baseline methods
│   │       ├── __init__.py
│   │       ├── gcn_loc.py       # GCN localization
│   │       ├── mlp_loc.py       # MLP localization
│   │       ├── mle_loc.py       # MLE localization
│   │       └── unet_loc.py      # U-Net localization
│   │
│   ├── models/                 # Neural network architectures
│   │   ├── __init__.py
│   │   ├── ddpm.py              # DDPM model implementation
│   │   ├── gcn.py               # Graph Convolutional Network
│   │   ├── mlp.py               # Multi-Layer Perceptron
│   │   └── unet.py              # U-Net
│   │
│   └── utils/                  # Utility functions
│       ├── data_utils.py        # Data generation and processing
│       └── visualization.py     # Plotting and visualization
│
├── examples/                 # Example scripts
│   ├── evaluate_ddpm.py        # DDPM evaluation example
│   ├── evaluate_ddpm_prob.py   # DDPM probabilistic evaluation
│   ├── evaluate_gcn.py         # GCN evaluation example
│   ├── evaluate_mlp.py         # MLP evaluation example
│   ├── evaluate_mle.py         # MLE evaluation example
│   └── evaluate_unet.py        # U-Net evaluation example
│
├── plots/                    # Generated plots and visualizations
├── results/                  # Experimental results
├── evaluate.py               # Main evaluation script
├── run_comparison.py         # Comparison script
├── requirements.txt          # Dependencies
└── README.md                 # This file

📖 Usage

Prerequisites

  • Python 3.10 or higher
  • CUDA-compatible GPU (recommended for training)

Quick Install

# Clone the repository
git clone https://github.com/juntaowang99/ddpm-localization.git
cd ddpm-localization

# Create conda environment (recommended)
conda create -n ddpm-loc python=3.10
conda activate ddpm-loc

# Install dependencies
pip install -r requirements.txt

# Verify installation
python -c "import ddpm_loc; print('DDPM-Loc installed successfully')"

Quick Start

Standard Evaluation

Default configuration: 1000 agents, 50 anchors, Rayleigh noise ($\sigma=0.1$), 2000 training epochs, and learning rate of 1e-3. For complete parameter details, see evaluate.py or run python evaluate.py --help.

Evaluate any localization method by replacing METHOD_NAME with one of: ddpm, gcn, mle, mlp, or unet:

python evaluate.py --method METHOD_NAME

To plot and save figures (including dataset visualization, training curves, testing results, and sampling process for DDPM-Loc), run:

python evaluate.py --method METHOD_NAME --plot --save-plots

Custom Configuration

Example:

python evaluate.py \
    --method ddpm \
    --num-samples 5000 \
    --num-anchors 100 \
    --noise-level 0.5 \
    --noise-type mixture \
    --epochs 3000 \
    --learning-rate 5e-4

Probabilistic Localization

For probabilistic localization using DDPM-Loc, run:

python evaluate.py --method ddpm --prob-loc

To save the figure showing localization results with uncertainty ellipses, run:

python evaluate.py --method ddpm --prob-loc --plot --save-plots

Since the default configuration uses 1000 testing agents, the saved figure with uncertainty ellipses may appear dense. To create clearer visualizations, you can specify a custom number of testing agents (which is half the total number of samples):

# 50 testing agents
python evaluate.py --method ddpm --num-samples 100 --prob-loc --plot --save-plots

Comprehensive Comparison

To run comprehensive comparison experiments across all methods and different noise levels, specify your desired noise type by replacing NOISE_TYPE with normal, rayleigh, or mixture and run:

python run_comparison.py --noise-type NOISE_TYPE --num-runs 10

Note: This comprehensive comparison runs 10 trials by default (configurable via --num-runs) and may take a long time to complete (~50 minutes on NVIDIA V100).

📈 Results

Performance Comparison

The following table shows RMSE performance across different noise levels (averaged over 10 runs):

Comparison Results Table

Probabilistic Localization with Uncertainty

Probabilistic Localization with Uncertainty

📚 Citation

If you find this work useful in your research, please consider citing our work:

@misc{ddpm-loc,
  author       = {Wang, Juntao and Li, Mengyuan and Yin, Feng and Pu, Wenqiang},
  title        = {Uncertainty-Aware Wireless Localization with Diffusion Models},
  howpublished = {\url{https://github.com/juntaowang99/ddpm-localization/}},
  year         = {2025},
}

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


If you find this project helpful, please give it a star!

GitHub stars

About

DDPM-Loc: Uncertainty-Aware Wireless Localization with Diffusion Models

Topics

Resources

Stars

Watchers

Forks

Languages