Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

rayray9999/Genfocus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

28 Commits

Repository files navigation

Generative Refocusing: Flexible Defocus Control from a Single Image


⚑ Quick Start

Follow the steps below to set up the environment and run the inference demo.

1. Installation

Clone the repository:

git clone git@github.com:rayray9999/Genfocus.git
cd Genfocus

Environment setup:

conda create -n Genfocus python=3.12
conda activate Genfocus

Install requirements:

pip install -r requirements.txt

2. Download Weights

You can download the pre-trained models using the following commands. Ensure you are in the Genfocus root directory.

# 1. Download main models to the root directory
wget https://huggingface.co/nycu-cplab/Genfocus-Model/resolve/main/bokehNet.safetensors
wget https://huggingface.co/nycu-cplab/Genfocus-Model/resolve/main/deblurNet.safetensors
# 2. Setup checkpoints directory and download auxiliary model
mkdir -p checkpoints
cd checkpoints
wget https://huggingface.co/nycu-cplab/Genfocus-Model/resolve/main/checkpoints/depth_pro.pt
cd ..

3. Run Gradio Demo

Launch the interactive web interface locally:

Note: The project uses FLUX.1-dev. You must request access and authenticate locally before running the demo.

python demo.py

The demo will be accessible at http://127.0.0.1:7860 in your browser.


πŸ—ΊοΈ Roadmap & TODO

We are actively working on improving this project. Current progress:

  • Upload Model Weights
  • Release HF Demo & Gradio Code (with tiling tricks for high-res images)
  • Release Benchmark data
  • Release Inference Code (Support for adjustable parameters/settings)
  • Release Training Code and Data

πŸ”— Citation

If you find this project useful for your research, please consider citing:

@article{Genfocus2025,
 title={Generative Refocusing: Flexible Defocus Control from a Single Image},
 author={Tuan Mu, Chun-Wei and Huang, Jia-Bin and Liu, Yu-Lun},
 journal={arXiv preprint arXiv:2512.16923},
 year={2025}
}

πŸ“§ Contact

For any questions or suggestions, please open an issue or contact me at raytm9999.cs09@nycu.edu.tw.


Star 🌟 this repository if you like it!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /