Spaces:
Sleeping
Sleeping
second
Browse files
README.md
CHANGED
@@ -1,196 +1,5 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
[](https://replicate.com/mv-lab/instructir)
|
7 |
-
[](https://huggingface.co/papers/2401.16468)
|
8 |
-
|
9 |
-
|
10 |
-
[Marcos V. Conde](https://mv-lab.github.io/), [Gregor Geigle](https://scholar.google.com/citations?user=uIlyqRwAAAAJ&hl=en), [Radu Timofte](https://scholar.google.com/citations?user=u3MwH5kAAAAJ&hl=en)
|
11 |
-
|
12 |
-
Computer Vision Lab, University of Wuerzburg | Sony PlayStation, FTG
|
13 |
-
|
14 |
-
|
15 |
-
<a href="https://mv-lab.github.io/InstructIR/"><img src="images/instructir.gif" alt="InstructIR" width=100%></a>
|
16 |
-
|
17 |
-
Video courtesy of Gradio ([see their post about InstructIR](https://twitter.com/Gradio/status/1752776176811041049)). Also shoutout to AK -- [see his tweet](https://twitter.com/_akhaliq/status/1752551364566126798).
|
18 |
-
|
19 |
-
|
20 |
-
### TL;DR: quickstart
|
21 |
-
InstructIR takes as input an image and a human-written instruction for how to improve that image. The neural model performs all-in-one image restoration. InstructIR achieves state-of-the-art results on several restoration tasks including image denoising, deraining, deblurring, dehazing, and (low-light) image enhancement.
|
22 |
-
|
23 |
-
**π You can start with the [demo tutorial](demo.ipynb)**
|
24 |
-
|
25 |
-
<details>
|
26 |
-
<summary> <b> Abstract</b> (click me to read)</summary>
|
27 |
-
<p>
|
28 |
-
Image restoration is a fundamental problem that involves recovering a high-quality clean image from its degraded observation. All-In-One image restoration models can effectively restore images from various types and levels of degradation using degradation-specific information as prompts to guide the restoration model. In this work, we present the first approach that uses human-written instructions to guide the image restoration model. Given natural language prompts, our model can recover high-quality images from their degraded counterparts, considering multiple degradation types. Our method, InstructIR, achieves state-of-the-art results on several restoration tasks including image denoising, deraining, deblurring, dehazing, and (low-light) image enhancement. InstructIR improves +1dB over previous all-in-one restoration methods. Moreover, our dataset and results represent a novel benchmark for new research on text-guided image restoration and enhancement.
|
29 |
-
</p>
|
30 |
-
</details>
|
31 |
-
|
32 |
-
|
33 |
-
### TODO / News π₯
|
34 |
-
|
35 |
-
- [ ] Upload Model weights and results for other InstructIR variants (3D, 5D).
|
36 |
-
|
37 |
-
- [x] [download all the test datasets](https://drive.google.com/file/d/11wGsKOMDVrBlsle4xtzORPLZAsGhel8c/view?usp=sharing) for all-in-one restoration.
|
38 |
-
|
39 |
-
- [x] check the instructions below to run `eval_instructir.py` and get all the metrics and results for all-in-one restoration.
|
40 |
-
|
41 |
-
- [x] You can download all the qualitative results here [instructir_results.zip](https://github.com/mv-lab/InstructIR/releases/download/instructir-results/instructir_results.zip)
|
42 |
-
|
43 |
-
- [x] Upload models to HF π€ [(download the models here)](https://huggingface.co/marcosv/InstructIR)
|
44 |
-
|
45 |
-
- [x] π€ [Hugging Face Demo](https://huggingface.co/spaces/marcosv/InstructIR) try it now
|
46 |
-
|
47 |
-
- [x] [Google Colab Tutorial](https://colab.research.google.com/drive/1OrTvS-i6uLM2Y8kIkq8ZZRwEQxQFchfq?usp=sharing) (check [demo.ipynb](demo.ipynb))
|
48 |
-
|
49 |
-
### Try it / Tutorial
|
50 |
-
|
51 |
-
[Try it]((https://huggingface.co/spaces/marcosv/InstructIR)) directly on π€ Hugging Face at no cost, no code.
|
52 |
-
|
53 |
-
|
54 |
-
π You can start with the [demo tutorial](demo.ipynb). We also host the same tutorial on [google colab](https://colab.research.google.com/drive/1OrTvS-i6uLM2Y8kIkq8ZZRwEQxQFchfq?usp=sharing) so you can run it using free GPUs!.
|
55 |
-
|
56 |
-
|
57 |
-
<a href="https://mv-lab.github.io/InstructIR/"><img src="images/instructir_teaser.png" alt="InstructIR" width=100%></a>
|
58 |
-
|
59 |
-
## Results
|
60 |
-
|
61 |
-
Check `test.py` and `eval_instructir.py`. The following command provides all the metric for all the benchmarks using the pre-trained models in `models/`. The results from InstructIR are saved in the indicated folder `results/`
|
62 |
-
|
63 |
-
```
|
64 |
-
python eval_instructir.py --model models/im_instructir-7d.pt --lm models/lm_instructir-7d.pt --device 0 --config configs/eval5d.yml --save results/
|
65 |
-
```
|
66 |
-
|
67 |
-
An example of the output log is:
|
68 |
-
|
69 |
-
```
|
70 |
-
>>> Eval on CBSD68_15 noise 0
|
71 |
-
CBSD68_15_base 24.84328738380881
|
72 |
-
CBSD68_15_psnr 33.98722295200123 68
|
73 |
-
CBSD68_15_ssim 0.9315137801801457
|
74 |
-
|
75 |
-
....
|
76 |
-
```
|
77 |
-
|
78 |
-
You can **[download all the test datasets](https://drive.google.com/file/d/11wGsKOMDVrBlsle4xtzORPLZAsGhel8c/view?usp=sharing)**, and locate them in `test-data/`. Make sure the paths are updated in the config file `configs/eval5d.yml`.
|
79 |
-
|
80 |
-
-------
|
81 |
-
|
82 |
-
You can **[download all the paper results](https://github.com/mv-lab/InstructIR/releases/download/instructir-results/instructir_results.zip)** -check releases-. We test InstructIR in the following benchmarks:
|
83 |
-
|
84 |
-
| Dataset | Task | Test Results |
|
85 |
-
| :---------------- | :------ | ----: |
|
86 |
-
| BSD68 | Denoising | [Download](https://github.com/mv-lab/InstructIR/releases/download/instructir-results/instructir_results.zip) |
|
87 |
-
| Urban100 | Denoising | [Download](https://github.com/mv-lab/InstructIR/releases/download/instructir-results/instructir_results.zip) |
|
88 |
-
| Rain100 | Deraining | [Download](https://github.com/mv-lab/InstructIR/releases/download/instructir-results/instructir_results.zip) |
|
89 |
-
| [GoPro](https://seungjunnah.github.io/Datasets/gopro) | Deblurring | [Download](https://github.com/mv-lab/InstructIR/releases/download/instructir-results/instructir_results.zip) |
|
90 |
-
| [LOL](https://daooshee.github.io/BMVC2018website/) | Lol Image Enhancement | [Download](https://github.com/mv-lab/InstructIR/releases/download/instructir-results/instructir_results.zip) |
|
91 |
-
| [MIT5K](https://data.csail.mit.edu/graphics/fivek/) | Image Enhancement | [Download](https://github.com/mv-lab/InstructIR/releases/download/instructir-results/instructir_results.zip) |
|
92 |
-
|
93 |
-
In releases or clicking the link above you can download [instructir_results.zip](https://github.com/mv-lab/InstructIR/releases/download/instructir-results/instructir_results.zip) which includes all the qualitative results for those datasets [1.9 Gbs].
|
94 |
-
|
95 |
-
|
96 |
-
<img src="static/tables/table1.png" width=100%>
|
97 |
-
|
98 |
-
<br>
|
99 |
-
|
100 |
-
<details>
|
101 |
-
<summary> <b> Multi-task Results on Dehazing, Deraining, Denoising </b> </summary>
|
102 |
-
<img src="static/tables/table-3d.png" width=100%>
|
103 |
-
</details>
|
104 |
-
|
105 |
-
<details>
|
106 |
-
<summary> <b> Denoising Results (click to read) </b> </summary>
|
107 |
-
<img src="static/tables/table-dn.png" width=100%>
|
108 |
-
</details>
|
109 |
-
|
110 |
-
<details>
|
111 |
-
<summary> <b> Low-light Image Enhancement (LOL) Results (click to read) </b> </summary>
|
112 |
-
<img src="static/tables/table-lol.png" width=100%>
|
113 |
-
</details>
|
114 |
-
|
115 |
-
<details>
|
116 |
-
<summary> <b> Color Image Enhancement (MIT5K) Results (click to read) </b> </summary>
|
117 |
-
<img src="static/tables/table-mit5k.png" width=100%>
|
118 |
-
</details>
|
119 |
-
|
120 |
-
<br>
|
121 |
-
|
122 |
-
--------
|
123 |
-
|
124 |
-
### Control and Interact
|
125 |
-
|
126 |
-
Sometimes the blur, rain, or film grain noise are pleasant effects and part of the **"aesthetics"**. Here we show a simple example on how to interact with InstructIR.
|
127 |
-
|
128 |
-
| Input |(1) I love this photo, could you remove the raindrops? please keep the content intact | (2) Can you make it look stunning? like a professional photo |
|
129 |
-
| --- | :---- | :--- |
|
130 |
-
| <img src="images/rain-020.png" width=100%> | <img src="images/results/result1.png" width=95%> | <img src="images/results/result2.png" width=100%> |
|
131 |
-
| Input |(1) my image is too dark, I cannot see anything, can you fix it? | (2) Great it looks nice! can you apply tone mapping? |
|
132 |
-
| <img src="images/lol_748.png" width=100%> | <img src="images/results/resultlol1.png" width=95%> | <img src="images/results/resultlol2.png" width=100%> |
|
133 |
-
| Input |(1) can you remove the tiny dots in the image? it is very unpleasant | (2) now please inprove the quality and resolution of the picture |
|
134 |
-
| <img src="images/frog.png" width=100%> | <img src="images/results/resultns1.png" width=95%> | <img src="images/results/resultns2.png" width=100%> |
|
135 |
-
|
136 |
-
|
137 |
-
As you can see our model accepts diverse humman-written prompts, from ambiguous to precise instructions. *How does it work?* Imagine we have the following image as input:
|
138 |
-
|
139 |
-
<img src="images/rain-020.png" width=50%>
|
140 |
-
|
141 |
-
Now we can use InstructIR. with the following prompt (1):
|
142 |
-
> I love this photo, could you remove the raindrops? please keep the content intact
|
143 |
-
|
144 |
-
<img src="images/results/result1.png" width=50%>
|
145 |
-
|
146 |
-
Now, let's enhance the image a bit further (2).
|
147 |
-
> Can you make it look stunning? like a professional photo
|
148 |
-
|
149 |
-
<img src="images/results/result2.png" width=50%>
|
150 |
-
|
151 |
-
The final result looks indeed stunning π€ You can do it yourself in the [demo tutorial]().
|
152 |
-
|
153 |
-
### FAQS
|
154 |
-
|
155 |
-
> Disclaimer: please remember this is not a product, thus, you will notice some limitations. As most all-in-one restoration methods, it struggles to generalize on real-world images -- we are working on improving it.
|
156 |
-
|
157 |
-
- ***How should I start?*** Check our [demo Tutorial](demo.ipynb) and also our [google collab](https://colab.research.google.com/drive/1OrTvS-i6uLM2Y8kIkq8ZZRwEQxQFchfq?usp=sharing) notebook.
|
158 |
-
|
159 |
-
- ***How can I compare with your method?*** You can download the results for several benchmarks above on [Results](###Results).
|
160 |
-
|
161 |
-
- ***How can I test the model? I just want to play with it***: Visit our π€ [Hugging Face demo](https://huggingface.co/spaces/marcosv/InstructIR) and test ir for free,
|
162 |
-
|
163 |
-
- ***Why aren't you using diffusion-based models?*** (1) We want to keep the solution simple and efficient. (2) Our priority is high-fidelity --as in many industry scenarios realted to computational photography--.
|
164 |
-
|
165 |
-
### Gradio Demo <a href='https://github.com/gradio-app/gradio'><img src='https://img.shields.io/github/stars/gradio-app/gradio'></a>
|
166 |
-
We made a simple [Gradio demo](app.py) you can run (locally) on your machine [here](app.py). You need Python>=3.9 and [these requirements](requirements_gradio.txt) for it: `pip install -r requirements_gradio.txt`
|
167 |
-
|
168 |
-
```
|
169 |
-
python app.py
|
170 |
-
```
|
171 |
-
|
172 |
-
<br>
|
173 |
-
<a href="https://huggingface.co/spaces/marcosv/InstructIR">
|
174 |
-
<img src="images/gradio.png" alt="InstructIR Gradio">
|
175 |
-
</a>
|
176 |
-
|
177 |
-
|
178 |
-
### Acknowledgments
|
179 |
-
This work was partly supported by the The Humboldt Foundation (AvH). Marcos Conde is also supported by Sony Interactive Entertainment, FTG.
|
180 |
-
|
181 |
-
This work is inspired in [InstructPix2Pix](https://arxiv.org/abs/2211.09800).
|
182 |
-
|
183 |
-
### Contacts
|
184 |
-
For any inquiries contact Marcos V. Conde: <a href="mailto:[email protected]">marcos.conde [at] uni-wuerzburg.de</a>
|
185 |
-
|
186 |
-
|
187 |
-
### Citation BibTeX
|
188 |
-
|
189 |
-
```
|
190 |
-
@inproceedings{conde2024high,
|
191 |
-
title={InstructIR: High-Quality Image Restoration Following Human Instructions},
|
192 |
-
author={Conde, Marcos V and Geigle, Gregor and Timofte, Radu},
|
193 |
-
booktitle = {Proceedings of the European Conference on Computer Vision (ECCV)},
|
194 |
-
year={2024}
|
195 |
-
}
|
196 |
-
```
|
|
|
1 |
+
title: swiftlens
|
2 |
+
emoji: π
|
3 |
+
sdk: Gradio
|
4 |
+
app_file: app.py
|
5 |
+
pinned: false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|