Instructions to use BiliSakura/Text2Earth-ControlNet-xBD with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use BiliSakura/Text2Earth-ControlNet-xBD with Diffusers:
pip install -U diffusers transformers accelerate
from diffusers import ControlNetModel, StableDiffusionControlNetPipeline controlnet = ControlNetModel.from_pretrained("BiliSakura/Text2Earth-ControlNet-xBD") pipe = StableDiffusionControlNetPipeline.from_pretrained( "lcybuaa/Text2Earth", controlnet=controlnet ) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
|
Download README.md from BiliSakura/Text2Earth-ControlNet-xBD: direct link, hf CLI and curl.
- Browser
- Download file 2.1 kB
-
https://huggingface.co/BiliSakura/Text2Earth-ControlNet-xBD/resolve/main/README.md
- Command line
-
hf download hf://BiliSakura/Text2Earth-ControlNet-xBD/README.md
-
curl -L -o README.md https://huggingface.co/BiliSakura/Text2Earth-ControlNet-xBD/resolve/main/README.md
2.1 kB
metadata
license: cc-by-nc-sa-4.0
library_name: diffusers
pipeline_tag: text-to-image
base_model: lcybuaa/Text2Earth
tags:
- controlnet
- remote-sensing
- xbd
- building-damage
Text2Earth ControlNet for xBD
ControlNet fine-tuned on xBD post-event imagery. It takes a building-damage mask and samples a matching satellite image from Text2Earth.
The ControlNet is the only trained module. Text2Earth (UNet, VAE, text encoder) stays frozen.
Conditioning
| Item | Value |
|---|---|
| Base model | lcybuaa/Text2Earth |
| Conditioning | 3-channel binary damage mask, RGB order, values in {0, 1} |
| Prompt | 18_GOOGLE_LEVEL_a high resolution satellite image |
| Scheduler | Euler discrete |
| Steps / guidance | 50 / 1.0 |
Binary channels follow the xBD hues: background black, no-damage green, minor blue, major yellow, destroy red, un-classified white.
Usage
import torch
from diffusers import (
ControlNetModel,
EulerDiscreteScheduler,
StableDiffusionControlNetPipeline,
)
from PIL import Image
repo = "BiliSakura/Text2Earth-ControlNet-xBD"
base = "lcybuaa/Text2Earth"
dtype = torch.float16
controlnet = ControlNetModel.from_pretrained(
repo, subfolder="controlnet", torch_dtype=dtype
)
pipe = StableDiffusionControlNetPipeline.from_pretrained(
base,
controlnet=controlnet,
scheduler=EulerDiscreteScheduler.from_pretrained(base, subfolder="scheduler"),
torch_dtype=dtype,
safety_checker=None,
).to("cuda")
image = pipe(
"18_GOOGLE_LEVEL_a high resolution satellite image",
image=Image.open("mask.png"),
num_inference_steps=50,
guidance_scale=1.0,
controlnet_conditioning_scale=1.0,
).images[0]
image.save("post_event.png")
Weights are under controlnet/.
License
CC BY-NC-SA 4.0, the license of the xBD dataset these weights were trained on.