Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +61 -0
- .gitignore +7 -0
- LICENSE +21 -0
- README.md +153 -0
- design_app.py +58 -0
- docs/cross.jpg +3 -0
- docs/decoration.jpg +0 -0
- docs/multi.jpg +3 -0
- docs/page01.png +0 -0
- docs/page02.png +0 -0
- docs/page03.png +0 -0
- docs/page04.png +0 -0
- docs/pan+zoom.jpg +0 -0
- docs/pan.jpg +0 -0
- docs/refine.jpg +0 -0
- docs/removal.jpg +0 -0
- docs/retype.jpg +0 -0
- docs/teaser.jpg +3 -0
- docs/zoom.jpg +0 -0
- examples/layer/01_horse/00.jpg +0 -0
- examples/layer/01_horse/mask0.jpg +0 -0
- examples/layer/02_baby/00.jpg +0 -0
- examples/layer/02_baby/mask0.jpg +0 -0
- examples/layer/02_baby/mask1.jpg +0 -0
- examples/layer/02_baby/mask2.jpg +0 -0
- examples/layer/03_text/00.jpg +0 -0
- examples/layer/03_text/01.jpg +0 -0
- examples/layer/03_text/mask0.jpg +0 -0
- examples/layer/03_text/mask1.jpg +0 -0
- examples/layer/04_cross/0.jpg +0 -0
- examples/layer/04_cross/1.jpg +0 -0
- examples/layer/04_cross/2.jpg +0 -0
- examples/layer/04_cross/3.jpg +0 -0
- examples/layer/04_cross/mask0.jpg +0 -0
- examples/layer/04_cross/mask1.jpg +0 -0
- examples/layer/04_cross/mask2.jpg +0 -0
- examples/layer/04_cross/mask3.jpg +0 -0
- examples/moving/01_ball/0.jpg +0 -0
- examples/moving/01_ball/mask0.jpg +0 -0
- examples/moving/02_bell/0.jpg +0 -0
- examples/moving/02_bell/mask0.jpg +0 -0
- examples/pan/01.jpg +0 -0
- examples/pan/02.jpg +0 -0
- examples/pan/03.jpg +0 -0
- examples/pan/04.jpg +0 -0
- examples/pan/05.jpg +0 -0
- examples/pan/06.jpg +0 -0
- examples/remove/01_moto/0.jpg +0 -0
- examples/remove/01_moto/mask0.jpg +0 -0
- examples/remove/01_moto/mask1.jpg +0 -0
.gitattributes
CHANGED
@@ -33,3 +33,64 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
docs/cross.jpg filter=lfs diff=lfs merge=lfs -text
|
37 |
+
docs/multi.jpg filter=lfs diff=lfs merge=lfs -text
|
38 |
+
docs/teaser.jpg filter=lfs diff=lfs merge=lfs -text
|
39 |
+
final_inpaint_image/1f407e4d-dbfb-43e8-946b-d0630f120e79.png filter=lfs diff=lfs merge=lfs -text
|
40 |
+
final_inpaint_image/1f407e4d-dbfb-43e8-946b-d0630f120e79_bg.png filter=lfs diff=lfs merge=lfs -text
|
41 |
+
final_inpaint_image/5a713428-fabc-4320-bfb4-109c850f6769.png filter=lfs diff=lfs merge=lfs -text
|
42 |
+
final_inpaint_image/5a713428-fabc-4320-bfb4-109c850f6769_bg.png filter=lfs diff=lfs merge=lfs -text
|
43 |
+
final_inpaint_image/9e2e4b04-42e0-4777-a73f-db12f975e23c.png filter=lfs diff=lfs merge=lfs -text
|
44 |
+
final_inpaint_image/9e2e4b04-42e0-4777-a73f-db12f975e23c_bg.png filter=lfs diff=lfs merge=lfs -text
|
45 |
+
final_inpaint_image/e399a548-3bdd-4a6f-ae34-bc378b490cbb.png filter=lfs diff=lfs merge=lfs -text
|
46 |
+
final_inpaint_image/e399a548-3bdd-4a6f-ae34-bc378b490cbb_bg.png filter=lfs diff=lfs merge=lfs -text
|
47 |
+
final_inpaint_image[[:space:]]copy/0832f92b-fbb2-4aa8-8e28-2b2bbb6a23a9.png filter=lfs diff=lfs merge=lfs -text
|
48 |
+
final_inpaint_image[[:space:]]copy/0832f92b-fbb2-4aa8-8e28-2b2bbb6a23a9_bg.png filter=lfs diff=lfs merge=lfs -text
|
49 |
+
final_inpaint_image[[:space:]]copy/1efd7b86-ee88-4d85-97b7-b91fa7b49dac.png filter=lfs diff=lfs merge=lfs -text
|
50 |
+
final_inpaint_image[[:space:]]copy/1efd7b86-ee88-4d85-97b7-b91fa7b49dac_bg.png filter=lfs diff=lfs merge=lfs -text
|
51 |
+
final_inpaint_image[[:space:]]copy/25318929-72d9-40df-a82a-49a20750580e_bg.png filter=lfs diff=lfs merge=lfs -text
|
52 |
+
final_inpaint_image[[:space:]]copy/25c3c6a6-2cf5-4e08-a9ae-21b82f361a54_bg.png filter=lfs diff=lfs merge=lfs -text
|
53 |
+
final_inpaint_image[[:space:]]copy/267895bd-73a3-491e-a708-6d0d874bff36_bg.png filter=lfs diff=lfs merge=lfs -text
|
54 |
+
final_inpaint_image[[:space:]]copy/2f67ba42-8d64-4476-b17b-7fa75572e18b.png filter=lfs diff=lfs merge=lfs -text
|
55 |
+
final_inpaint_image[[:space:]]copy/2f67ba42-8d64-4476-b17b-7fa75572e18b_bg.png filter=lfs diff=lfs merge=lfs -text
|
56 |
+
final_inpaint_image[[:space:]]copy/30/ab0d6288-3a72-4c4a-a559-8716432d4afe.png filter=lfs diff=lfs merge=lfs -text
|
57 |
+
final_inpaint_image[[:space:]]copy/30/ab0d6288-3a72-4c4a-a559-8716432d4afe_bg.png filter=lfs diff=lfs merge=lfs -text
|
58 |
+
final_inpaint_image[[:space:]]copy/37d9a651-972d-4cda-a2ad-ea51e7a18a52.png filter=lfs diff=lfs merge=lfs -text
|
59 |
+
final_inpaint_image[[:space:]]copy/37d9a651-972d-4cda-a2ad-ea51e7a18a52_bg.png filter=lfs diff=lfs merge=lfs -text
|
60 |
+
final_inpaint_image[[:space:]]copy/3efefc4f-dbbb-44d4-bf97-fbda39022138.png filter=lfs diff=lfs merge=lfs -text
|
61 |
+
final_inpaint_image[[:space:]]copy/3efefc4f-dbbb-44d4-bf97-fbda39022138_bg.png filter=lfs diff=lfs merge=lfs -text
|
62 |
+
final_inpaint_image[[:space:]]copy/50/a1908026-c3c1-415d-b8cb-3d2c337fcfb4.png filter=lfs diff=lfs merge=lfs -text
|
63 |
+
final_inpaint_image[[:space:]]copy/50/a1908026-c3c1-415d-b8cb-3d2c337fcfb4_bg.png filter=lfs diff=lfs merge=lfs -text
|
64 |
+
final_inpaint_image[[:space:]]copy/676ce1f3-53d9-4368-95e1-4ca246040b61.png filter=lfs diff=lfs merge=lfs -text
|
65 |
+
final_inpaint_image[[:space:]]copy/676ce1f3-53d9-4368-95e1-4ca246040b61_bg.png filter=lfs diff=lfs merge=lfs -text
|
66 |
+
final_inpaint_image[[:space:]]copy/6d5f3e97-651c-4e45-b018-834a965159bf.png filter=lfs diff=lfs merge=lfs -text
|
67 |
+
final_inpaint_image[[:space:]]copy/6d5f3e97-651c-4e45-b018-834a965159bf_bg.png filter=lfs diff=lfs merge=lfs -text
|
68 |
+
final_inpaint_image[[:space:]]copy/7609e4dd-74ac-45b1-8f2f-898b03496917.png filter=lfs diff=lfs merge=lfs -text
|
69 |
+
final_inpaint_image[[:space:]]copy/7609e4dd-74ac-45b1-8f2f-898b03496917_bg.png filter=lfs diff=lfs merge=lfs -text
|
70 |
+
final_inpaint_image[[:space:]]copy/7a76fc14-76df-4428-af1d-c99e2432f0a5.png filter=lfs diff=lfs merge=lfs -text
|
71 |
+
final_inpaint_image[[:space:]]copy/7a76fc14-76df-4428-af1d-c99e2432f0a5_bg.png filter=lfs diff=lfs merge=lfs -text
|
72 |
+
final_inpaint_image[[:space:]]copy/8afe0d15-05bc-462c-bee5-620878a71193.png filter=lfs diff=lfs merge=lfs -text
|
73 |
+
final_inpaint_image[[:space:]]copy/8afe0d15-05bc-462c-bee5-620878a71193_bg.png filter=lfs diff=lfs merge=lfs -text
|
74 |
+
final_inpaint_image[[:space:]]copy/90f45cd9-decb-4db6-8858-76844d486e74_bg.png filter=lfs diff=lfs merge=lfs -text
|
75 |
+
final_inpaint_image[[:space:]]copy/9d90fc27-3373-4d2a-ad60-0271337ec569.png filter=lfs diff=lfs merge=lfs -text
|
76 |
+
final_inpaint_image[[:space:]]copy/9d90fc27-3373-4d2a-ad60-0271337ec569_bg.png filter=lfs diff=lfs merge=lfs -text
|
77 |
+
final_inpaint_image[[:space:]]copy/b06a2cee-2b57-470f-98f0-ab9b1f536fda.png filter=lfs diff=lfs merge=lfs -text
|
78 |
+
final_inpaint_image[[:space:]]copy/b06a2cee-2b57-470f-98f0-ab9b1f536fda_bg.png filter=lfs diff=lfs merge=lfs -text
|
79 |
+
final_inpaint_image[[:space:]]copy/b414a38b-ce20-4958-871e-79e5cd92f172.png filter=lfs diff=lfs merge=lfs -text
|
80 |
+
final_inpaint_image[[:space:]]copy/b414a38b-ce20-4958-871e-79e5cd92f172_bg.png filter=lfs diff=lfs merge=lfs -text
|
81 |
+
final_inpaint_image[[:space:]]copy/d215ee16-0300-4005-b7b8-49ec03043361.png filter=lfs diff=lfs merge=lfs -text
|
82 |
+
final_inpaint_image[[:space:]]copy/d215ee16-0300-4005-b7b8-49ec03043361_bg.png filter=lfs diff=lfs merge=lfs -text
|
83 |
+
final_inpaint_image[[:space:]]copy/d63e9d77-e707-480f-86d0-3c339a0be3f8.png filter=lfs diff=lfs merge=lfs -text
|
84 |
+
final_inpaint_image[[:space:]]copy/d63e9d77-e707-480f-86d0-3c339a0be3f8_bg.png filter=lfs diff=lfs merge=lfs -text
|
85 |
+
final_inpaint_image[[:space:]]copy/dcbd4735-ce89-46bb-9253-977d7133ef1e.png filter=lfs diff=lfs merge=lfs -text
|
86 |
+
final_inpaint_image[[:space:]]copy/dcbd4735-ce89-46bb-9253-977d7133ef1e_bg.png filter=lfs diff=lfs merge=lfs -text
|
87 |
+
final_inpaint_image[[:space:]]copy/e03faee6-871e-4452-8a7b-af844b98dae2.png filter=lfs diff=lfs merge=lfs -text
|
88 |
+
final_inpaint_image[[:space:]]copy/e03faee6-871e-4452-8a7b-af844b98dae2_bg.png filter=lfs diff=lfs merge=lfs -text
|
89 |
+
final_inpaint_image[[:space:]]copy/eb6464dc-e3e0-4c56-ac37-110952e835d1.png filter=lfs diff=lfs merge=lfs -text
|
90 |
+
final_inpaint_image[[:space:]]copy/eb6464dc-e3e0-4c56-ac37-110952e835d1_bg.png filter=lfs diff=lfs merge=lfs -text
|
91 |
+
final_inpaint_image[[:space:]]copy/ed4f0743-6f09-4cf8-ac31-f169ad06ba2a.png filter=lfs diff=lfs merge=lfs -text
|
92 |
+
final_inpaint_image[[:space:]]copy/ed4f0743-6f09-4cf8-ac31-f169ad06ba2a_bg.png filter=lfs diff=lfs merge=lfs -text
|
93 |
+
final_inpaint_image[[:space:]]copy/f4b8813e-f024-4654-a3a6-4dc316d2ce4f.png filter=lfs diff=lfs merge=lfs -text
|
94 |
+
final_inpaint_image[[:space:]]copy/f4b8813e-f024-4654-a3a6-4dc316d2ce4f_bg.png filter=lfs diff=lfs merge=lfs -text
|
95 |
+
final_inpaint_image[[:space:]]copy/f6a03c0e-3df8-4dbf-bdee-9d4401d780a4.png filter=lfs diff=lfs merge=lfs -text
|
96 |
+
final_inpaint_image[[:space:]]copy/f6a03c0e-3df8-4dbf-bdee-9d4401d780a4_bg.png filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
img/
|
2 |
+
logfile/
|
3 |
+
__pycache__/
|
4 |
+
*/__pycache__/
|
5 |
+
models/
|
6 |
+
plt/
|
7 |
+
exp/
|
LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
MIT License
|
2 |
+
|
3 |
+
Copyright (c) 2024 design-edit
|
4 |
+
|
5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
+
of this software and associated documentation files (the "Software"), to deal
|
7 |
+
in the Software without restriction, including without limitation the rights
|
8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
+
copies of the Software, and to permit persons to whom the Software is
|
10 |
+
furnished to do so, subject to the following conditions:
|
11 |
+
|
12 |
+
The above copyright notice and this permission notice shall be included in all
|
13 |
+
copies or substantial portions of the Software.
|
14 |
+
|
15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21 |
+
SOFTWARE.
|
README.md
ADDED
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# DesignEdit: Multi-Layered Latent Decomposition and Fusion for Unified & Accurate Image Editing
|
2 |
+
> *Stable Diffusion XL 1.0* Implementation
|
3 |
+
|
4 |
+

|
5 |
+
### [Project Page](https://design-edit.github.io/)   [Paper](https://arxiv.org/abs/2403.14487)   [Hugging Face Demo](https://huggingface.co/spaces/YuhuiYuan/DesignEdit)
|
6 |
+
|
7 |
+
## ✨ News ✨
|
8 |
+
|
9 |
+
- [2024/4/4] We have supported the Gradio Application on Hugging Face 🤗, encouraging you to design online without the need for local deployment.
|
10 |
+
- [2024/3/28] We release the code for DesignEdit! Let's design together! 😍
|
11 |
+
|
12 |
+
## Setup
|
13 |
+
|
14 |
+
The required Python version is 3.10.12. , and the [Pytorch](https://pytorch.org/) version is 2.0.1.
|
15 |
+
The code's framework is built on [Prompt-to-prompt](https://github.com/google/prompt-to-prompt/) and [Stable Diffusion](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0).
|
16 |
+
|
17 |
+
Additional required packages are listed in the requirements file.
|
18 |
+
```bash
|
19 |
+
conda create -n DesignEdit python=3.10.12
|
20 |
+
conda activate DesignEdit
|
21 |
+
pip install -r requirements.txt
|
22 |
+
```
|
23 |
+
Notice that our model is entirely **training-free**💪!!! The base model is the Stable Diffusion XL-1.0.
|
24 |
+
|
25 |
+
## Demo
|
26 |
+
We have created an interactive interface using Gradio, as shown below. You only need to simply run the following command in the environment we previously set up:
|
27 |
+
```bash
|
28 |
+
python design_app.py
|
29 |
+
```
|
30 |
+

|
31 |
+
|
32 |
+
### 🖱️Usage
|
33 |
+
|
34 |
+
- We have 5 function pages for different editing operations.
|
35 |
+
|
36 |
+
💡**Object Removal**
|
37 |
+
|
38 |
+
💡**Zooming Out**
|
39 |
+
|
40 |
+
💡**Camera Panning**
|
41 |
+
|
42 |
+
💡**Object Moving, Resizing and Flipping**
|
43 |
+
|
44 |
+
💡**Multi-Layered Editing**
|
45 |
+
|
46 |
+
- You can follow the "Usage" instructions within each page.
|
47 |
+
|
48 |
+

|
49 |
+
|
50 |
+
- For each page, we also provide some interesting examples for you to try.
|
51 |
+
|
52 |
+

|
53 |
+
|
54 |
+
- Notice that the **Multi-Layered Editing** page, which uses a multi-layered representation for multiple editing tasks, can achieve the same results as those of Object Removal and Object Moving, Resizing, and Flipping in a general representation.
|
55 |
+
|
56 |
+
- Moreover, we have added the "Mask Preparation" page for you to utilize SAM or sketching to combine several masks together. This may be useful when you are on the **Multi-Layered Editing** page.
|
57 |
+
|
58 |
+

|
59 |
+
|
60 |
+
## More Details
|
61 |
+
|
62 |
+
If you are interested in exploring more details about the model implementation, we recommend checking out [`model.py`](design_copy/src/demo/model.py). Pay special attention to the `register_attention_control()` function and the `LayerFusion` class.
|
63 |
+
|
64 |
+
|
65 |
+
## Applications
|
66 |
+
|
67 |
+
For more applications, we kindly invite you to explore our [project page](https://design-edit.github.io/) and refer to our [paper](https://arxiv.org/abs/2403.14487).
|
68 |
+
|
69 |
+
### 💡Object Removal
|
70 |
+
|
71 |
+
You can choose more than one object to remove on the **Object Removal** page, and it is also possible to mask irregular regions for removal.
|
72 |
+
|
73 |
+
<div align="center">
|
74 |
+
<img src="docs/removal.jpg" width="700"/>
|
75 |
+
</div>
|
76 |
+
|
77 |
+
### 💡Object Removal with <span style="color:red;">Refine Mask</span>
|
78 |
+
|
79 |
+
Using remove mask directly may cause artifacts, the refine mask indicates regions that may cause artifacts. You can turn to **Object Removal** page to explore.
|
80 |
+
|
81 |
+
<div align="center">
|
82 |
+
<img src="docs/refine.jpg" width="700"/>
|
83 |
+
</div>
|
84 |
+
|
85 |
+
### 💡Camera Panning and Zooming Out
|
86 |
+
|
87 |
+
You can use the **Camera Panning** and **Zooming Out** page to achieve editing with different scales and directions.
|
88 |
+
|
89 |
+
<div align="center">
|
90 |
+
<img src="docs/pan.jpg" width="700"/>
|
91 |
+
</div>
|
92 |
+
<div align="center">
|
93 |
+
<img src="docs/zoom.jpg" width="700"/>
|
94 |
+
</div>
|
95 |
+
|
96 |
+
The illustration of image adjustment and mask preparation is shown below.
|
97 |
+
|
98 |
+
<div align="center">
|
99 |
+
<img src="docs/pan+zoom.jpg" width="700"/>
|
100 |
+
</div>
|
101 |
+
|
102 |
+
### 💡Multi-Object Editing with Moving, Resizing, Flipping
|
103 |
+
|
104 |
+
You can achieve single object moving, resizing, flipping in **Object Moving, Resizing and Flipping** page,
|
105 |
+
for multi-object editing like swapping and addition, you can turn to **Multi-Layered Editing** page.
|
106 |
+
|
107 |
+
<div align="center">
|
108 |
+
<img src="docs/multi.jpg" width="700"/>
|
109 |
+
</div>
|
110 |
+
|
111 |
+
### 💡Cross-Image Composition
|
112 |
+
|
113 |
+
By choosing one image as the background and specifying the position, size, and placement order of the foreground images, we can achieve cross-image composition. You can try examples on the **Multi-Layered Editing** page.
|
114 |
+
|
115 |
+
<div align="center">
|
116 |
+
<img src="docs/cross.jpg" width="700"/>
|
117 |
+
</div>
|
118 |
+
|
119 |
+
### 💡Typography Retyping
|
120 |
+
|
121 |
+
Typography retyping refers to the specific use of design elements, which you can achieve on the **Multi-Layered Editing** page.
|
122 |
+
|
123 |
+
<div align="center">
|
124 |
+
<img src="docs/retype.jpg" width="700"/>
|
125 |
+
</div>
|
126 |
+
|
127 |
+
## Acknowledgements
|
128 |
+
|
129 |
+
Our project benefits from the contributions of several outstanding projects and techniques. We express our gratitude to:
|
130 |
+
|
131 |
+
- [**Prompt-to-Prompt**](https://github.com/google/prompt-to-prompt.git): For innovative approaches in prompt engineering.
|
132 |
+
|
133 |
+
- [**Proximal-Guidance**](https://github.com/phymhan/prompt-to-prompt.git): For their cutting-edge inversion technique, significantly improving our model's performance.
|
134 |
+
|
135 |
+
- [**DragonDiffusion**](https://github.com/MC-E/DragonDiffusion.git): For inspiration on Gradio interface and efficient SAM API integration.
|
136 |
+
|
137 |
+
Each of these projects has played a crucial role in the development of our work. We thank their contributors for sharing their expertise and resources with the community.
|
138 |
+
|
139 |
+
## BibTeX
|
140 |
+
|
141 |
+
```bibtex
|
142 |
+
@misc{jia2024designedit,
|
143 |
+
title={DesignEdit: Multi-Layered Latent Decomposition and Fusion for Unified & Accurate Image Editing},
|
144 |
+
author={Yueru Jia and Yuhui Yuan and Aosong Cheng and Chuke Wang and Ji Li and Huizhu Jia and Shanghang Zhang},
|
145 |
+
year={2024},
|
146 |
+
eprint={2403.14487},
|
147 |
+
archivePrefix={arXiv},
|
148 |
+
primaryClass={cs.CV}
|
149 |
+
}
|
150 |
+
```
|
151 |
+
|
152 |
+
|
153 |
+
|
design_app.py
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import subprocess
|
3 |
+
import shlex
|
4 |
+
from src.demo.model import DesignEdit
|
5 |
+
|
6 |
+
# os.makedirs('models', exist_ok=True)
|
7 |
+
# subprocess.run(shlex.split('wget https://huggingface.co/Adapter/DragonDiffusion/resolve/main/model/efficient_sam_vits.pt -O models/efficient_sam_vits.pt'))
|
8 |
+
|
9 |
+
from src.demo.demo import *
|
10 |
+
import shlex
|
11 |
+
|
12 |
+
import cv2
|
13 |
+
import gradio as gr
|
14 |
+
# pretrained_model_path = "SG161222/RealVisXL_V5.0_Lightning"#
|
15 |
+
pretrained_model_path = "stabilityai/stable-diffusion-xl-base-1.0"
|
16 |
+
model = DesignEdit(pretrained_model_path=pretrained_model_path)
|
17 |
+
DESCRIPTION_1 = """<div style="text-align: center; font-size: 80px;">
|
18 |
+
<strong class="title is-1">
|
19 |
+
<span style="color: green;">🌿D</span>
|
20 |
+
<span style="color: orange;">e</span>
|
21 |
+
<span style="color: rgb(63, 185, 63);">s</span>
|
22 |
+
<span style="color: green;">i</span>
|
23 |
+
<span style="color: rgb(200, 85, 23);">g</span>
|
24 |
+
<span style="color: green;">n</span>
|
25 |
+
<span style="color: orange;">E</span>
|
26 |
+
<span style="color: crimson;">d</span>
|
27 |
+
<span style="color: darkorange;">i</span>
|
28 |
+
<span style="color: green;">t🌿</span>
|
29 |
+
</strong>
|
30 |
+
</div>
|
31 |
+
"""
|
32 |
+
DESCRIPTION_2 = """ <div style="text-align: center;font-size: 24px;"> <h1> Multi-Layered Latent Decomposition and Fusion for Unified & Accurate Image Editing</h1></div>"""
|
33 |
+
DESCRIPTION_3 = """
|
34 |
+
<div style="text-align: center; font-size: 24px;">
|
35 |
+
<p> Gradio demo for <a href="https://design-edit.github.io/">DesignEdit</a></p>
|
36 |
+
</div>
|
37 |
+
"""
|
38 |
+
|
39 |
+
with gr.Blocks(css='style.css') as demo:
|
40 |
+
gr.Markdown(DESCRIPTION_1)
|
41 |
+
gr.Markdown(DESCRIPTION_2)
|
42 |
+
gr.Markdown(DESCRIPTION_3)
|
43 |
+
with gr.Tabs():
|
44 |
+
with gr.TabItem('1️⃣ Object Removal'):
|
45 |
+
create_demo_remove(model.run_remove)
|
46 |
+
with gr.TabItem('2️⃣ Zooming Out'):
|
47 |
+
create_demo_zooming(model.run_zooming)
|
48 |
+
with gr.TabItem('3️⃣ Camera Panning'):
|
49 |
+
create_demo_panning(model.run_panning)
|
50 |
+
with gr.TabItem('4️⃣ Object Moving, Resizing and Flipping'):
|
51 |
+
create_demo_moving(model.run_moving)
|
52 |
+
with gr.TabItem('5️⃣ 🚩 Multi-Layered Editing 🚩'):
|
53 |
+
create_demo_layer(model.run_layer)
|
54 |
+
with gr.TabItem('🔧 Mask Preparation: Draw or Sketch'):
|
55 |
+
create_demo_mask_box(model.run_mask)
|
56 |
+
demo.queue(concurrency_count=3, max_size=20)
|
57 |
+
demo.launch(server_name="0.0.0.0",share=True)
|
58 |
+
|
docs/cross.jpg
ADDED
![]() |
Git LFS Details
|
docs/decoration.jpg
ADDED
![]() |
docs/multi.jpg
ADDED
![]() |
Git LFS Details
|
docs/page01.png
ADDED
![]() |
docs/page02.png
ADDED
![]() |
docs/page03.png
ADDED
![]() |
docs/page04.png
ADDED
![]() |
docs/pan+zoom.jpg
ADDED
![]() |
docs/pan.jpg
ADDED
![]() |
docs/refine.jpg
ADDED
![]() |
docs/removal.jpg
ADDED
![]() |
docs/retype.jpg
ADDED
![]() |
docs/teaser.jpg
ADDED
![]() |
Git LFS Details
|
docs/zoom.jpg
ADDED
![]() |
examples/layer/01_horse/00.jpg
ADDED
![]() |
examples/layer/01_horse/mask0.jpg
ADDED
![]() |
examples/layer/02_baby/00.jpg
ADDED
![]() |
examples/layer/02_baby/mask0.jpg
ADDED
![]() |
examples/layer/02_baby/mask1.jpg
ADDED
![]() |
examples/layer/02_baby/mask2.jpg
ADDED
![]() |
examples/layer/03_text/00.jpg
ADDED
![]() |
examples/layer/03_text/01.jpg
ADDED
![]() |
examples/layer/03_text/mask0.jpg
ADDED
![]() |
examples/layer/03_text/mask1.jpg
ADDED
![]() |
examples/layer/04_cross/0.jpg
ADDED
![]() |
examples/layer/04_cross/1.jpg
ADDED
![]() |
examples/layer/04_cross/2.jpg
ADDED
![]() |
examples/layer/04_cross/3.jpg
ADDED
![]() |
examples/layer/04_cross/mask0.jpg
ADDED
![]() |
examples/layer/04_cross/mask1.jpg
ADDED
![]() |
examples/layer/04_cross/mask2.jpg
ADDED
![]() |
examples/layer/04_cross/mask3.jpg
ADDED
![]() |
examples/moving/01_ball/0.jpg
ADDED
![]() |
examples/moving/01_ball/mask0.jpg
ADDED
![]() |
examples/moving/02_bell/0.jpg
ADDED
![]() |
examples/moving/02_bell/mask0.jpg
ADDED
![]() |
examples/pan/01.jpg
ADDED
![]() |
examples/pan/02.jpg
ADDED
![]() |
examples/pan/03.jpg
ADDED
![]() |
examples/pan/04.jpg
ADDED
![]() |
examples/pan/05.jpg
ADDED
![]() |
examples/pan/06.jpg
ADDED
![]() |
examples/remove/01_moto/0.jpg
ADDED
![]() |
examples/remove/01_moto/mask0.jpg
ADDED
![]() |
examples/remove/01_moto/mask1.jpg
ADDED
![]() |