Remote Sensing Image Generation Scaling to 8K Resolution
RSGen-8k applies tuning-free progressive upscaling techniques to remote sensing diffusion models, enabling text-to-image generation of satellite imagery at up to 8192 × 8192 (8K) resolution. Text prompts are sourced from the XLRS-Bench ultra-high-resolution remote sensing caption dataset.
| Model | HuggingFace ID | Architecture |
|---|---|---|
| Text2Earth | lcybuaa/Text2Earth | SD 1.5 |
| DiffusionSat-Single-512 | BiliSakura/DiffusionSat-Single-512 | SD 1.5 |
| GeoSynth | MVRL/GeoSynth | SD 1.5 |
| DDPM-CD Pretrained 256 | BiliSakura/ddpm-cd-pretrained-256 | DDPM-SR3 (unconditional) |
| Technique | Paper | Source |
|---|---|---|
| MegaFusion | Wu et al., WACV 2025 | Multi-stage progressive denoising with noise rescheduling |
| ElasticDiffusion | Haji Ali et al., CVPR 2024 | Global-local content separation for arbitrary-size generation |
| MultiDiffusion | Bar-Tal et al., ICML 2023 | Sliding-window view fusion with consensus voting |
| FreeScale | Qiu et al., arXiv 2024 | Cosine-scheduled scale fusion via attention modification |
| DemoFusion | Du et al., CVPR 2024 | Progressive upscaling with dilated sampling and skip-residuals |
| FouriScale | Huang et al., ECCV 2024 | Frequency-domain low-pass filtering for structural consistency |
RSGen-8k/
├── app.py # Gradio web demo
├── configs/ # YAML configuration files
│ └── default.yaml # Default generation config (512 → 8K)
├── ckpt/ # Local model checkpoints (HuggingFace repo_id layout)
│ └── lcybuaa/Text2Earth/ # Example: place model files here
├── src/rsgen8k/ # Main Python package
│ ├── models/ # Model components & registry
│ │ ├── model_registry.py # Supported base model definitions + local path resolution
│ │ ├── scheduler.py # DDIM scheduler with noise rescheduling
│ │ └── pipeline.py # SD pipeline with stage-based timesteps
│ ├── techniques/ # Upscaling technique implementations
│ │ ├── registry.py # Technique registry & metadata
│ │ ├── megafusion.py # MegaFusion (Wu et al., WACV 2025)
│ │ ├── elastic_diffusion.py # ElasticDiffusion (Haji Ali et al., CVPR 2024)
│ │ ├── multi_diffusion.py # MultiDiffusion (Bar-Tal et al., ICML 2023)
│ │ ├── freescale.py # FreeScale (Qiu et al., 2024)
│ │ ├── demofusion.py # DemoFusion (Du et al., CVPR 2024)
│ │ └── fouriscale.py # FouriScale (Huang et al., ECCV 2024)
│ ├── data/ # Dataset loading utilities
│ │ └── xlrs_bench.py # XLRS-Bench prompt loader
│ ├── metrics.py # Image quality (FID, KID, CMMD, DINO sim, CLIP-Score, LPIPS, PSNR, SSIM)
│ └── generate.py # Multi-stage generation engine & CLI
├── scripts/ # Standalone scripts
│ ├── generate.py # Generation script with dataset support
│ ├── download_prompts.py # Preview/download XLRS-Bench prompts
│ ├── benchmark_single.sh # Single model+technique benchmark
│ ├── benchmark_case_study.sh # Multi-resolution case study with metrics
│ ├── benchmark_all.sh # Grid benchmark (all models × techniques)
│ ├── benchmark_seeds.sh # Multi-seed reproducibility benchmark
│ ├── generate_dataset.sh # Batch generation from XLRS-Bench
│ └── evaluate.sh # Image quality evaluation (FID, CLIP-Score, etc.)
├── tests/ # Unit tests (86 tests)
├── manuscript/ # Paper / manuscript materials
└── outputs/ # Generated images (gitignored contents)
Recommended environment with PyTorch 2.8.0 (CUDA 12.6):
conda create -n rsgen python=3.12
conda activate rsgen
# PyTorch 2.8.0 + CUDA 12.6 from https://download.pytorch.org/whl/cu126
# Other versions generally work — follow https://pytorch.org/get-started/previous-versions/
pip install torch==2.8.0+cu126 torchaudio==2.8.0+cu126 torchvision==0.23.0+cu126 --index-url https://download.pytorch.org/whl/cu126
# Install other packages
pip install -r requirements.txt
pip install swanlab
Or use the setup script:
bash scripts/setup_env.sh
Optional (extra optimizers):
# pip install muon-optimizer # Uncomment if needed
For faster inference and lower VRAM usage at high resolutions, install one of:
xformers (recommended, easiest):
pip install xformers
# Or with editable install:
pip install -e ".[dev,xformers]"
xformers works with most PyTorch/CUDA combos. If you hit compatibility issues, check xformers releases for your PyTorch version.
flash-attn (often faster, stricter requirements):
# Option A: Prebuilt wheels (recommended) — visit https://flashattn.dev/
# Select your PyTorch, CUDA, and Python versions, then run the generated pip command.
# Option B: From source (requires CUDA toolkit + ninja)
pip install flash-attn --no-build-isolation
# On low RAM: MAX_JOBS=4 pip install flash-attn --no-build-isolation
flash-attn supports PyTorch 2.3–2.9 and CUDA 11.8, 12.1–12.8. Prebuilt wheels skip ~30 min compile time.
RSGen-8k auto-enables xformers when available. Disable with --no_xformers if needed.
pip install -e ".[dev]"
For memory-efficient attention (recommended for high-resolution generation):
pip install -e ".[dev,xformers]" # xformers (easiest)
# pip install -e ".[dev,flash-attn]" # flash-attn — see Post-install section
For the Gradio web demo:
pip install -e ".[dev,demo]"
python scripts/generate.py \
--prompt "A high-resolution satellite image of a coastal city with harbors and ships" \
--output_dir ./outputs \
--seed 42
# DiffusionSat
python scripts/generate.py \
--model_name diffusionsat \
--prompt "Aerial view of agricultural fields"
# GeoSynth
python scripts/generate.py \
--model_name geosynth \
--prompt "Satellite image of a mountain range"
# MultiDiffusion (sliding-window consensus)
python scripts/generate.py \
--technique multidiffusion \
--prompt "Dense urban area"
# FouriScale (frequency-domain filtering)
python scripts/generate.py \
--technique fouriscale \
--prompt "Industrial zone with factories"
python scripts/generate.py --list_models
python scripts/generate.py --list_techniques
python scripts/generate.py \
--from_dataset \
--num_prompts 5 \
--output_dir ./outputs
python scripts/generate.py \
--prompt "Dense urban area with skyscrapers and parks" \
--stage_resolutions 512 1024 2048 \
--stage_steps 40 5 5
python scripts/generate.py --config configs/default.yaml
Models are automatically loaded from the local ./models directory if available,
using the same {org}/{repo} layout as HuggingFace. If no local copy is found,
models are downloaded from the Hub.
# Directory layout (mirrors HuggingFace repo_id):
models/
├── lcybuaa/Text2Earth/
│ ├── model_index.json
│ ├── unet/
│ ├── vae/
│ ├── text_encoder/
│ ├── tokenizer/
│ └── scheduler/
├── BiliSakura/DiffusionSat-Single-512/
└── MVRL/GeoSynth/
# Use a custom checkpoint directory
python scripts/generate.py --ckpt_dir /data/models --prompt "Aerial view"
A self-contained demo is in hf_space/ — upload that folder to create a Space. Models load from Hugging Face Hub.
cd hf_space
# Create a new Space at huggingface.co/new-space, then:
# git clone your-space-url .
# Copy hf_space/* into the Space repo and push
Launch an interactive web interface for generation:
python app.py # Default: http://localhost:7860
python app.py --port 8080 --share # Public link via Gradio
python app.py --ckpt_dir /data/models # Custom checkpoint directory
Production-ready shell scripts with all parameters defaulted and overridable:
# Single model+technique benchmark
bash scripts/benchmark_single.sh
bash scripts/benchmark_single.sh --model_name diffusionsat --technique multidiffusion
# Full grid benchmark (3 models × 6 techniques = 18 combinations)
bash scripts/benchmark_all.sh
# Multi-seed reproducibility (default: 5 seeds)
bash scripts/benchmark_seeds.sh --model_name text2earth --technique megafusion
# Batch generation from XLRS-Bench dataset
bash scripts/generate_dataset.sh --num_prompts 50
# Image quality evaluation
bash scripts/evaluate.sh --generated_dir ./outputs/benchmark/text2earth_megafusion_seed42
# Resolution case study (1K → 2K → 4K → 8K) with metrics
bash scripts/benchmark_case_study.sh
bash scripts/benchmark_case_study.sh --quick # 1024 and 2048 only
bash scripts/benchmark_case_study.sh --reference_dir ./data/reference # FID, LPIPS, PSNR, SSIM
# Override via environment variables
MODEL_NAME=geosynth TECHNIQUE=fouriscale bash scripts/benchmark_single.sh
All techniques share a common multi-stage framework: generate at base resolution, then progressively upscale through intermediate resolutions to 8K. The per-step denoising behavior varies by technique:
Multi-stage progressive generation with noise rescheduling. At each stage: bicubic-upsample → VAE encode → add noise → denoise for a few steps.
At each denoising step, splits the latent canvas into overlapping sliding-window views, denoises each independently, and fuses via weighted-average consensus.
Combines a reduced-resolution global guidance pass with patch-wise local denoising, blending global structure with local detail.
Runs dual UNet passes (high-res and low-res) at each step, blending predictions via a cosine-annealed schedule.
Applies dilated sampling with skip-residual connections from previous resolution phases, smoothed by Gaussian filtering.
Applies low-pass Fourier filtering to noise predictions, suppressing high-frequency artifacts at out-of-distribution resolutions.
MegaFusion optionally applies resolution-dependent noise rescheduling that adjusts the noise schedule based on the upscale factor, preventing artifacts at high resolutions. Enable with --if_reschedule.
Diffusion is a stochastic process — different runs produce different outputs. RSGen-8k provides built-in controls for deterministic, reproducible generation:
All random number generators (random, numpy, torch) are seeded when a --seed is provided. A CPU torch.Generator is used for noise generation to ensure cross-platform consistency (GPU generators produce hardware-dependent results).
# Same seed → same output (within platform tolerance)
python scripts/generate.py --prompt "Coastal city" --seed 42
python scripts/generate.py --prompt "Coastal city" --seed 42 # identical output
Tip: The CPU generator is used automatically — you don't need to do anything special. Just provide
--seedfor reproducible results.
For bit-exact reproducibility (e.g. testing, benchmarking), enable --deterministic:
python scripts/generate.py --prompt "Coastal city" --seed 42 --deterministic
This enables:
torch.use_deterministic_algorithms(True) — forces deterministic CUDA kernelstorch.backends.cudnn.deterministic = True — disables non-deterministic cuDNN opstorch.backends.cudnn.benchmark = False — disables auto-tuningCUBLAS_WORKSPACE_CONFIG=:16:8 — single buffer size for cuBLASNote: Deterministic mode may reduce performance. See PyTorch's Reproducibility guide for details.
pytest tests/ -v
| Package | Purpose |
|---|---|
| diffusers | Diffusion model pipeline & components |
| transformers | Text encoder & tokenizer |
| accelerate | Mixed-precision inference |
| datasets | XLRS-Bench prompt loading |
| torch | Deep learning framework |
| einops | Tensor rearrangement |
This project is licensed under the Apache License 2.0 — see LICENSE for details.
Remote Sensing Image Generation Scaling to 8K Resolution
RSGen-8k applies tuning-free progressive upscaling techniques to remote sensing diffusion models, enabling text-to-image generation of satellite imagery at up to 8192 × 8192 (8K) resolution. Text prompts are sourced from the XLRS-Bench ultra-high-resolution remote sensing caption dataset.
| Model | HuggingFace ID | Architecture |
|---|---|---|
| Text2Earth | lcybuaa/Text2Earth | SD 1.5 |
| DiffusionSat-Single-512 | BiliSakura/DiffusionSat-Single-512 | SD 1.5 |
| GeoSynth | MVRL/GeoSynth | SD 1.5 |
| DDPM-CD Pretrained 256 | BiliSakura/ddpm-cd-pretrained-256 | DDPM-SR3 (unconditional) |
| Technique | Paper | Source |
|---|---|---|
| MegaFusion | Wu et al., WACV 2025 | Multi-stage progressive denoising with noise rescheduling |
| ElasticDiffusion | Haji Ali et al., CVPR 2024 | Global-local content separation for arbitrary-size generation |
| MultiDiffusion | Bar-Tal et al., ICML 2023 | Sliding-window view fusion with consensus voting |
| FreeScale | Qiu et al., arXiv 2024 | Cosine-scheduled scale fusion via attention modification |
| DemoFusion | Du et al., CVPR 2024 | Progressive upscaling with dilated sampling and skip-residuals |
| FouriScale | Huang et al., ECCV 2024 | Frequency-domain low-pass filtering for structural consistency |
RSGen-8k/
├── app.py # Gradio web demo
├── configs/ # YAML configuration files
│ └── default.yaml # Default generation config (512 → 8K)
├── ckpt/ # Local model checkpoints (HuggingFace repo_id layout)
│ └── lcybuaa/Text2Earth/ # Example: place model files here
├── src/rsgen8k/ # Main Python package
│ ├── models/ # Model components & registry
│ │ ├── model_registry.py # Supported base model definitions + local path resolution
│ │ ├── scheduler.py # DDIM scheduler with noise rescheduling
│ │ └── pipeline.py # SD pipeline with stage-based timesteps
│ ├── techniques/ # Upscaling technique implementations
│ │ ├── registry.py # Technique registry & metadata
│ │ ├── megafusion.py # MegaFusion (Wu et al., WACV 2025)
│ │ ├── elastic_diffusion.py # ElasticDiffusion (Haji Ali et al., CVPR 2024)
│ │ ├── multi_diffusion.py # MultiDiffusion (Bar-Tal et al., ICML 2023)
│ │ ├── freescale.py # FreeScale (Qiu et al., 2024)
│ │ ├── demofusion.py # DemoFusion (Du et al., CVPR 2024)
│ │ └── fouriscale.py # FouriScale (Huang et al., ECCV 2024)
│ ├── data/ # Dataset loading utilities
│ │ └── xlrs_bench.py # XLRS-Bench prompt loader
│ ├── metrics.py # Image quality (FID, KID, CMMD, DINO sim, CLIP-Score, LPIPS, PSNR, SSIM)
│ └── generate.py # Multi-stage generation engine & CLI
├── scripts/ # Standalone scripts
│ ├── generate.py # Generation script with dataset support
│ ├── download_prompts.py # Preview/download XLRS-Bench prompts
│ ├── benchmark_single.sh # Single model+technique benchmark
│ ├── benchmark_case_study.sh # Multi-resolution case study with metrics
│ ├── benchmark_all.sh # Grid benchmark (all models × techniques)
│ ├── benchmark_seeds.sh # Multi-seed reproducibility benchmark
│ ├── generate_dataset.sh # Batch generation from XLRS-Bench
│ └── evaluate.sh # Image quality evaluation (FID, CLIP-Score, etc.)
├── tests/ # Unit tests (86 tests)
├── manuscript/ # Paper / manuscript materials
└── outputs/ # Generated images (gitignored contents)
Recommended environment with PyTorch 2.8.0 (CUDA 12.6):
conda create -n rsgen python=3.12
conda activate rsgen
# PyTorch 2.8.0 + CUDA 12.6 from https://download.pytorch.org/whl/cu126
# Other versions generally work — follow https://pytorch.org/get-started/previous-versions/
pip install torch==2.8.0+cu126 torchaudio==2.8.0+cu126 torchvision==0.23.0+cu126 --index-url https://download.pytorch.org/whl/cu126
# Install other packages
pip install -r requirements.txt
pip install swanlab
Or use the setup script:
bash scripts/setup_env.sh
Optional (extra optimizers):
# pip install muon-optimizer # Uncomment if needed
For faster inference and lower VRAM usage at high resolutions, install one of:
xformers (recommended, easiest):
pip install xformers
# Or with editable install:
pip install -e ".[dev,xformers]"
xformers works with most PyTorch/CUDA combos. If you hit compatibility issues, check xformers releases for your PyTorch version.
flash-attn (often faster, stricter requirements):
# Option A: Prebuilt wheels (recommended) — visit https://flashattn.dev/
# Select your PyTorch, CUDA, and Python versions, then run the generated pip command.
# Option B: From source (requires CUDA toolkit + ninja)
pip install flash-attn --no-build-isolation
# On low RAM: MAX_JOBS=4 pip install flash-attn --no-build-isolation
flash-attn supports PyTorch 2.3–2.9 and CUDA 11.8, 12.1–12.8. Prebuilt wheels skip ~30 min compile time.
RSGen-8k auto-enables xformers when available. Disable with --no_xformers if needed.
pip install -e ".[dev]"
For memory-efficient attention (recommended for high-resolution generation):
pip install -e ".[dev,xformers]" # xformers (easiest)
# pip install -e ".[dev,flash-attn]" # flash-attn — see Post-install section
For the Gradio web demo:
pip install -e ".[dev,demo]"
python scripts/generate.py \
--prompt "A high-resolution satellite image of a coastal city with harbors and ships" \
--output_dir ./outputs \
--seed 42
# DiffusionSat
python scripts/generate.py \
--model_name diffusionsat \
--prompt "Aerial view of agricultural fields"
# GeoSynth
python scripts/generate.py \
--model_name geosynth \
--prompt "Satellite image of a mountain range"
# MultiDiffusion (sliding-window consensus)
python scripts/generate.py \
--technique multidiffusion \
--prompt "Dense urban area"
# FouriScale (frequency-domain filtering)
python scripts/generate.py \
--technique fouriscale \
--prompt "Industrial zone with factories"
python scripts/generate.py --list_models
python scripts/generate.py --list_techniques
python scripts/generate.py \
--from_dataset \
--num_prompts 5 \
--output_dir ./outputs
python scripts/generate.py \
--prompt "Dense urban area with skyscrapers and parks" \
--stage_resolutions 512 1024 2048 \
--stage_steps 40 5 5
python scripts/generate.py --config configs/default.yaml
Models are automatically loaded from the local ./models directory if available,
using the same {org}/{repo} layout as HuggingFace. If no local copy is found,
models are downloaded from the Hub.
# Directory layout (mirrors HuggingFace repo_id):
models/
├── lcybuaa/Text2Earth/
│ ├── model_index.json
│ ├── unet/
│ ├── vae/
│ ├── text_encoder/
│ ├── tokenizer/
│ └── scheduler/
├── BiliSakura/DiffusionSat-Single-512/
└── MVRL/GeoSynth/
# Use a custom checkpoint directory
python scripts/generate.py --ckpt_dir /data/models --prompt "Aerial view"
A self-contained demo is in hf_space/ — upload that folder to create a Space. Models load from Hugging Face Hub.
cd hf_space
# Create a new Space at huggingface.co/new-space, then:
# git clone your-space-url .
# Copy hf_space/* into the Space repo and push
Launch an interactive web interface for generation:
python app.py # Default: http://localhost:7860
python app.py --port 8080 --share # Public link via Gradio
python app.py --ckpt_dir /data/models # Custom checkpoint directory
Production-ready shell scripts with all parameters defaulted and overridable:
# Single model+technique benchmark
bash scripts/benchmark_single.sh
bash scripts/benchmark_single.sh --model_name diffusionsat --technique multidiffusion
# Full grid benchmark (3 models × 6 techniques = 18 combinations)
bash scripts/benchmark_all.sh
# Multi-seed reproducibility (default: 5 seeds)
bash scripts/benchmark_seeds.sh --model_name text2earth --technique megafusion
# Batch generation from XLRS-Bench dataset
bash scripts/generate_dataset.sh --num_prompts 50
# Image quality evaluation
bash scripts/evaluate.sh --generated_dir ./outputs/benchmark/text2earth_megafusion_seed42
# Resolution case study (1K → 2K → 4K → 8K) with metrics
bash scripts/benchmark_case_study.sh
bash scripts/benchmark_case_study.sh --quick # 1024 and 2048 only
bash scripts/benchmark_case_study.sh --reference_dir ./data/reference # FID, LPIPS, PSNR, SSIM
# Override via environment variables
MODEL_NAME=geosynth TECHNIQUE=fouriscale bash scripts/benchmark_single.sh
All techniques share a common multi-stage framework: generate at base resolution, then progressively upscale through intermediate resolutions to 8K. The per-step denoising behavior varies by technique:
Multi-stage progressive generation with noise rescheduling. At each stage: bicubic-upsample → VAE encode → add noise → denoise for a few steps.
At each denoising step, splits the latent canvas into overlapping sliding-window views, denoises each independently, and fuses via weighted-average consensus.
Combines a reduced-resolution global guidance pass with patch-wise local denoising, blending global structure with local detail.
Runs dual UNet passes (high-res and low-res) at each step, blending predictions via a cosine-annealed schedule.
Applies dilated sampling with skip-residual connections from previous resolution phases, smoothed by Gaussian filtering.
Applies low-pass Fourier filtering to noise predictions, suppressing high-frequency artifacts at out-of-distribution resolutions.
MegaFusion optionally applies resolution-dependent noise rescheduling that adjusts the noise schedule based on the upscale factor, preventing artifacts at high resolutions. Enable with --if_reschedule.
Diffusion is a stochastic process — different runs produce different outputs. RSGen-8k provides built-in controls for deterministic, reproducible generation:
All random number generators (random, numpy, torch) are seeded when a --seed is provided. A CPU torch.Generator is used for noise generation to ensure cross-platform consistency (GPU generators produce hardware-dependent results).
# Same seed → same output (within platform tolerance)
python scripts/generate.py --prompt "Coastal city" --seed 42
python scripts/generate.py --prompt "Coastal city" --seed 42 # identical output
Tip: The CPU generator is used automatically — you don't need to do anything special. Just provide
--seedfor reproducible results.
For bit-exact reproducibility (e.g. testing, benchmarking), enable --deterministic:
python scripts/generate.py --prompt "Coastal city" --seed 42 --deterministic
This enables:
torch.use_deterministic_algorithms(True) — forces deterministic CUDA kernelstorch.backends.cudnn.deterministic = True — disables non-deterministic cuDNN opstorch.backends.cudnn.benchmark = False — disables auto-tuningCUBLAS_WORKSPACE_CONFIG=:16:8 — single buffer size for cuBLASNote: Deterministic mode may reduce performance. See PyTorch's Reproducibility guide for details.
pytest tests/ -v
| Package | Purpose |
|---|---|
| diffusers | Diffusion model pipeline & components |
| transformers | Text encoder & tokenizer |
| accelerate | Mixed-precision inference |
| datasets | XLRS-Bench prompt loading |
| torch | Deep learning framework |
| einops | Tensor rearrangement |
This project is licensed under the Apache License 2.0 — see LICENSE for details.