File size: 2,652 Bytes
2e4a064
 
 
 
1618793
2e4a064
 
 
 
 
 
 
 
1618793
2e4a064
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
---
license: apache-2.0
library_name: diffusers
tags:
  - image-to-image
  - stable-diffusion
  - remote-sensing
  - semantic-segmentation
  - diffusion-models
  - few-shot
  - sat-imagery
  - StableDiffusionInpaintPipeline
inference: true
pipeline_tag: image-to-image
model-index:
  - name: RS-Painter-Diffusers
    results: []
---
# RS-Painter-Diffusers


# RS-Painter-Diffusers

**Tackling Few-Shot Segmentation in Remote Sensing via Inpainting Diffusion Model**

[![Paper](https://img.shields.io/badge/arXiv-PDF-b31b1b)](https://arxiv.org/abs/2503.03785)
[![License](https://img.shields.io/badge/License-Apache--2.0-929292)](https://www.apache.org/licenses/LICENSE-2.0)

**ICLR Machine Learning for Remote Sensing Workshop, 2025 (Best Paper Award)**

- Original Paper: [arXiv:2503.03785](https://arxiv.org/abs/2503.03785)
- Project Website: [https://steveimmanuel.github.io/rs-paint](https://steveimmanuel.github.io/rs-paint)
- Original Repository: [https://huggingface.co/SteveImmanuel/RSPaint](https://huggingface.co/SteveImmanuel/RSPaint)

## Model Description

RS-Painter is an image-conditioned diffusion-based approach for creating diverse sets of novel-class samples for semantic segmentation in few-shot settings in the remote sensing domain. By ensuring semantic consistency using cosine similarity between the generated samples and the conditioning image, and using the Segment Anything Model (SAM) to obtain precise segmentation, this method can train off-the-shelf segmentation models with high-quality synthetic data, significantly improving performance in low-data scenarios.

This model is compatible with the Hugging Face `diffusers` library and can be used with `StableDiffusionInpaintPipeline`.

## Quick Start


```python
from diffusers import StableDiffusionInpaintPipeline
from PIL import Image

# Load pipeline
pipeline = StableDiffusionInpaintPipeline.from_pretrained(
    "BiliSakura/RS-Painter-Diffusers",
    safety_checker=None,
    requires_safety_checker=False,
)

# Load image and mask
image = Image.open("input_image.png").convert("RGB")
mask = Image.open("mask.png").convert("L")

# Generate
result = pipeline(
    prompt="a beautiful landscape",
    image=image,
    mask_image=mask,
    num_inference_steps=50,
)

# Save result
result.images[0].save("output.png")
```

## Citation

If you use this model in your research, please cite:

```bibtex
@article{2025rspaint,
  title={Tackling Few-Shot Segmentation in Remote Sensing via Inpainting Diffusion Model},
  author={Immanuel, Steve Andreas and Cho, Woojin and Heo, Junhyuk and Kwon, Darongsae},
  journal={arXiv preprint arXiv:2503.03785},
  year={2025}
}
```