Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ViewDelta: Text-Conditioned Scene Change Detection
|
| 2 |
+
|
| 3 |
+
ViewDelta is a generalized framework for Scene Change Detection (SCD) that uses natural language prompts to define what changes are relevant. Unlike traditional change detection methods that implicitly learn what constitutes a "relevant" change from dataset labels, ViewDelta allows users to explicitly specify at runtime what types of changes they care about through text prompts.
|
| 4 |
+
|
| 5 |
+
## Overview
|
| 6 |
+
|
| 7 |
+
Given two images captured at different times and a text prompt describing the type of change to detect (e.g., "vehicle", "driveway", or "all changes"), ViewDelta produces a binary segmentation mask highlighting the relevant changes. The model is trained jointly on multiple datasets (CSeg, PSCD, SYSU-CD, VL-CMU-CD) and can:
|
| 8 |
+
|
| 9 |
+
- Detect user-specified changes via natural language prompts
|
| 10 |
+
- Handle unaligned image pairs with viewpoint variations
|
| 11 |
+
- Generalize across diverse domains (street-view, satellite, indoor/outdoor scenes)
|
| 12 |
+
- Detect all changes or specific semantic categories
|
| 13 |
+
|
| 14 |
+
For more details, see the paper: [ViewDelta: Scaling Scene Change Detection through Text-Conditioning](https://arxiv.org/abs/2412.07612)
|
| 15 |
+
|
| 16 |
+
## Installation
|
| 17 |
+
|
| 18 |
+
### Prerequisites
|
| 19 |
+
|
| 20 |
+
**Note:** ViewDelta has only been tested on Linux with the following specific versions:
|
| 21 |
+
|
| 22 |
+
- Python 3.10
|
| 23 |
+
- CUDA 12.1 (for GPU acceleration)
|
| 24 |
+
- NVIDIA GPU (tested on RTX 4090, L40S, and A100 - other GPUs may work)
|
| 25 |
+
- [Pixi package manager](https://pixi.sh/latest/)
|
| 26 |
+
|
| 27 |
+
### Install Pixi
|
| 28 |
+
|
| 29 |
+
First, install the Pixi package manager:
|
| 30 |
+
|
| 31 |
+
```bash
|
| 32 |
+
# On Linux
|
| 33 |
+
curl -fsSL https://pixi.sh/install.sh | bash
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
For more installation options, visit: https://pixi.sh/latest/installation/
|
| 37 |
+
|
| 38 |
+
### Install ViewDelta Dependencies
|
| 39 |
+
|
| 40 |
+
Once Pixi is installed, clone the repository and install dependencies:
|
| 41 |
+
|
| 42 |
+
```bash
|
| 43 |
+
pixi install
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
This will automatically set up the environment with all required dependencies including PyTorch, transformers, and other libraries.
|
| 47 |
+
|
| 48 |
+
## Running the Model
|
| 49 |
+
|
| 50 |
+
### Basic Usage
|
| 51 |
+
|
| 52 |
+
The repository includes an [inference.py](inference.py) script for running the model on image pairs. Here's how to use it:
|
| 53 |
+
|
| 54 |
+
1. **Prepare your images**: Place two images you want to compare in the repository directory.
|
| 55 |
+
|
| 56 |
+
2. **Download a pre-trained checkpoint**: You'll need a model checkpoint file (e.g., `model.pth`).
|
| 57 |
+
|
| 58 |
+
3. **Edit the inference script**: Modify [inference.py](inference.py) to specify your images and text prompt:
|
| 59 |
+
|
| 60 |
+
```python
|
| 61 |
+
image_a_list = ["before_image.jpg"]
|
| 62 |
+
image_b_list = ["after_image.jpg"]
|
| 63 |
+
text_list = ["vehicle"] # or "all" for all changes, or specific objects like "building", "tree", etc.
|
| 64 |
+
|
| 65 |
+
# Path to your checkpoint
|
| 66 |
+
PATH_TO_CHECKPOINT = "path/to/checkpoint.pth"
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
4. **Run inference**:
|
| 70 |
+
|
| 71 |
+
```bash
|
| 72 |
+
pixi run python inference.py
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
### Output
|
| 76 |
+
|
| 77 |
+
The script generates several outputs:
|
| 78 |
+
- `{image_name}_mask_{text}.png`: The binary segmentation mask
|
| 79 |
+
- `{image_name}_image_a_overlay.png`: First image with changes highlighted
|
| 80 |
+
|
| 81 |
+
### Text Prompt Examples
|
| 82 |
+
|
| 83 |
+
ViewDelta supports various types of text prompts:
|
| 84 |
+
|
| 85 |
+
- **Detect all changes**: `"What are the differences?"`, `"Find any differences"`
|
| 86 |
+
- **Specific objects**: `"vehicle"`, `"building"`, `"tree"`, `"person"`
|
| 87 |
+
- **Multiple objects**: `"vehicle, sign, barrier"`, `"cars and pedestrians"`
|
| 88 |
+
- **Natural language**: `"Has any construction equipment been added?"`, `"What buildings have changed?"`
|
| 89 |
+
|
| 90 |
+
### Model Configuration
|
| 91 |
+
|
| 92 |
+
The model uses:
|
| 93 |
+
- **Text embeddings**: SigLip (superior vision-language alignment)
|
| 94 |
+
- **Image embeddings**: DINOv2 (frozen pretrained features)
|
| 95 |
+
- **Architecture**: Vision Transformer (ViT) with 12 layers
|
| 96 |
+
- **Input resolution**: Images are automatically resized to 256×256
|
| 97 |
+
|
| 98 |
+
## Citation
|
| 99 |
+
|
| 100 |
+
```bibtex
|
| 101 |
+
@inproceedings{Varghese2024ViewDeltaSS,
|
| 102 |
+
title={ViewDelta: Scaling Scene Change Detection through Text-Conditioning},
|
| 103 |
+
author={Subin Varghese and Joshua Gao and Vedhus Hoskere},
|
| 104 |
+
year={2024},
|
| 105 |
+
url={https://api.semanticscholar.org/CorpusID:280642249}
|
| 106 |
+
}
|
| 107 |
+
```
|