File size: 3,660 Bytes
4f250a3
 
6df18f5
 
 
 
 
4f250a3
6df18f5
4f250a3
 
 
 
 
6df18f5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b86904d
6df18f5
 
 
 
b86904d
6df18f5
 
 
 
 
 
 
 
 
 
 
2986a37
6df18f5
 
2986a37
6df18f5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: Click2mask
license: other
license_name: MIT License with Commons Clause Restriction
emoji: 🔵
colorFrom: indigo
colorTo: yellow
sdk: gradio
sdk_version: 5.27.1
app_file: app.py
pinned: false
short_description: Official Demo for Click2Mask (AAAI 2025)
---

# [AAAI 2025] Click2Mask: Local Editing with Dynamic Mask Generation

Official Hugging Face demo for ["Click2Mask: Local Editing with Dynamic Mask Generation"](https://omeregev.github.io/click2mask/) (AAAI 2025)

**Paper by:** [Omer Regev](https://www.linkedin.com/in/omeregev/), [Omri Avrahami](https://omriavrahami.com/), [Dani Lischinski](https://www.cs.huji.ac.il/~danix/)

<a href="https://omeregev.github.io/click2mask/">
  <img src="https://img.shields.io/badge/Website-blue?style=flat&logo=github" alt="Website">
</a>
<a href="https://github.com/omeregev/click2mask">
  <img src="https://img.shields.io/badge/GitHub-Code-blue?style=flat&logo=github" alt="GitHub Code">
</a>
<a href="https://colab.research.google.com/github/omeregev/click2mask/blob/main/demo.ipynb">
  <img src="https://img.shields.io/badge/Colab-Demo-orange?style=flat&logo=googlecolab" alt="Colab">
</a>
<a href="https://arxiv.org/abs/2409.08272">
  <img src="https://img.shields.io/badge/arXiv-2409.08272-b31b1b?style=flat&logo=arxiv" alt="arXiv">
</a>
<a href="https://omeregev.github.io/click2mask/static/paper/Click2Mask.pdf">
  <img src="https://img.shields.io/badge/Paper-PDF-red?style=flat&logo=adobe" alt="Paper PDF">
</a>
<a href="https://youtu.be/A0ZEVTm9SLw?si=_coDIWRXa8Wo-2na">
  <img src="https://img.shields.io/badge/Video-YouTube-red?style=flat&logo=youtube" alt="YouTube Video">
</a>
<br><br>

<img src="https://raw.githubusercontent.com/omeregev/click2mask/main/imgs/teaser.gif" alt="Click2Mask Teaser"/>

Given an image, a <b>Click</b>, and a prompt for an added object, a **Mask** is generated dynamically, 
simultaneously with the object generation throughout the diffusion process.

Current methods rely on existing objects/segments, or user effort (masks/detailed text), 
to localize object additions. Our approach enables free-form editing, 
where the manipulated area is not well-defined, using just a <b>Click</b> for localization.

## How to Use This Demo

1. **Upload an image** or load example with the button below
2. **Click on the image** where you want to add an object
3. **Enter a text prompt** describing what you want to add
4. **Click Generate** to see your edited image with the dynamically generated mask

> **Note:** This Space provides a simplified demo interface. For full functionality including batch processing and CLI tools (plus this Gradio interface), use the [Colab notebook](https://colab.research.google.com/github/omeregev/click2mask/blob/main/demo.ipynb) or [GitHub](https://github.com/omeregev/click2mask).
## Examples

<img src="https://raw.githubusercontent.com/omeregev/click2mask/main/imgs/results.jpg" alt="Click2Mask Results" width=900/>

## Comparison with SOTA Methods
<img src="https://raw.githubusercontent.com/omeregev/click2mask/main/imgs/compare.png" alt="Comparison" width=900/>

## Citation

```bibtex
@misc{regev2024click2masklocaleditingdynamic,
      title={Click2Mask: Local Editing with Dynamic Mask Generation}, 
      author={Omer Regev and Omri Avrahami and Dani Lischinski},
      year={2024},
      eprint={2409.08272},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2409.08272}, 
}
```

## Acknowledgements

This code is based on [Blended Latent Diffusion](https://github.com/omriav/blended-latent-diffusion/tree/master) and [Stable Diffusion](https://github.com/CompVis/stable-diffusion).