Add comprehensive model card with metadata, links, and usage
Browse filesThis PR enhances the model card for 'Generative Refocusing: Flexible Defocus Control from a Single Image' by adding:
- The `pipeline_tag: image-to-image` for improved discoverability.
- Links to the paper ([Generative Refocusing: Flexible Defocus Control from a Single Image](https://huggingface.co/papers/2512.16923)), project page ([https://generative-refocusing.github.io/](https://generative-refocusing.github.io/)), GitHub repository ([https://github.com/rayray9999/Genfocus](https://github.com/rayray9999/Genfocus)), Hugging Face Demo, and YouTube tutorial.
- A concise description of the model's functionality.
- A detailed 'Quick Start' section from the GitHub README, providing installation and Gradio demo instructions.
- The official citation information.
Please review and merge if everything looks good.
|
@@ -1,3 +1,87 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
pipeline_tag: image-to-image
|
| 4 |
+
---
|
| 5 |
+
|
| 6 |
+
# Generative Refocusing: Flexible Defocus Control from a Single Image
|
| 7 |
+
|
| 8 |
+
This model, **Generative Refocusing**, presented in the paper [Generative Refocusing: Flexible Defocus Control from a Single Image](https://huggingface.co/papers/2512.16923), offers a novel two-step process for depth-of-field control from a single image. It uses DeblurNet to recover all-in-focus images from various inputs and BokehNet for creating controllable bokeh. The method leverages semi-supervised training, combining synthetic paired data with unpaired real bokeh images, and achieves state-of-the-art performance in defocus deblurring, bokeh synthesis, and refocusing benchmarks, allowing text-guided adjustments and custom aperture shapes.
|
| 9 |
+
|
| 10 |
+
- [Paper (Hugging Face)](https://huggingface.co/papers/2512.16923)
|
| 11 |
+
- [Project Page](https://generative-refocusing.github.io/)
|
| 12 |
+
- [GitHub Repository](https://github.com/rayray9999/Genfocus)
|
| 13 |
+
- [Hugging Face Demo](https://huggingface.co/spaces/nycu-cplab/Genfocus-Demo)
|
| 14 |
+
- [YouTube Tutorial](https://youtu.be/CMh_jGDl-RE)
|
| 15 |
+
|
| 16 |
+
<div align="center">
|
| 17 |
+
<img src="https://generative-refocusing.github.io/assets/demo_vid.gif" width="50%" alt="Demo Video">
|
| 18 |
+
</div>
|
| 19 |
+
|
| 20 |
+
---
|
| 21 |
+
|
| 22 |
+
## ⚡ Quick Start
|
| 23 |
+
|
| 24 |
+
Follow the steps below to set up the environment and run the inference demo.
|
| 25 |
+
|
| 26 |
+
### 1. Installation
|
| 27 |
+
|
| 28 |
+
Clone the repository:
|
| 29 |
+
|
| 30 |
+
```bash
|
| 31 |
+
git clone git@github.com:rayray9999/Genfocus.git
|
| 32 |
+
cd Genfocus
|
| 33 |
+
````
|
| 34 |
+
|
| 35 |
+
Environment setup:
|
| 36 |
+
|
| 37 |
+
```bash
|
| 38 |
+
conda create -n Genfocus python=3.12
|
| 39 |
+
conda activate Genfocus
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
Install requirements:
|
| 43 |
+
|
| 44 |
+
```bash
|
| 45 |
+
pip install -r requirements.txt
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
### 2. Download Weights
|
| 49 |
+
|
| 50 |
+
You can download the pre-trained models using the following commands. Ensure you are in the `Genfocus` root directory.
|
| 51 |
+
|
| 52 |
+
```bash
|
| 53 |
+
# 1. Download main models to the root directory
|
| 54 |
+
wget https://huggingface.co/nycu-cplab/Genfocus-Model/resolve/main/bokehNet.safetensors
|
| 55 |
+
wget https://huggingface.co/nycu-cplab/Genfocus-Model/resolve/main/deblurNet.safetensors
|
| 56 |
+
|
| 57 |
+
# 2. Setup checkpoints directory and download auxiliary model
|
| 58 |
+
mkdir -p checkpoints
|
| 59 |
+
cd checkpoints
|
| 60 |
+
wget https://huggingface.co/nycu-cplab/Genfocus-Model/resolve/main/checkpoints/depth_pro.pt
|
| 61 |
+
cd ..
|
| 62 |
+
```
|
| 63 |
+
### 3. Run Gradio Demo
|
| 64 |
+
|
| 65 |
+
Launch the interactive web interface locally:
|
| 66 |
+
> **Note:** The project uses [FLUX.1-dev](https://huggingface.co/black-forest-labs/FLUX.1-dev). You must request access and authenticate locally before running the demo.
|
| 67 |
+
|
| 68 |
+
```bash
|
| 69 |
+
python demo.py
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
The demo will be accessible at `http://127.0.0.1:7860` in your browser.
|
| 73 |
+
|
| 74 |
+
-----
|
| 75 |
+
|
| 76 |
+
## Citation
|
| 77 |
+
|
| 78 |
+
If you find this project useful for your research, please consider citing:
|
| 79 |
+
|
| 80 |
+
```bibtex
|
| 81 |
+
@article{Genfocus2025,
|
| 82 |
+
title={Generative Refocusing: Flexible Defocus Control from a Single Image},
|
| 83 |
+
author={Tuan Mu, Chun-Wei and Huang, Jia-Bin and Liu, Yu-Lun},
|
| 84 |
+
journal={arXiv preprint arXiv:2512.16923},
|
| 85 |
+
year={2025}
|
| 86 |
+
}
|
| 87 |
+
```
|