Giter VIP home page Giter VIP logo

mimicbrush's Introduction

Zero-shot Image Editing with Reference Imitation

Xi Chen · Yutong Feng · Mengting Chen · Yiyang Wang · Shilong Zhang · Yu Liu · Yujun Shen · Hengshuang Zhao

Paper PDF Project Page
The University of Hong Kong   |   Alibaba Group |   Ant Group

News

  • [2024.06.12] Release inference code, local gradio demo, online demo.
  • [Todo] Release our benchmark.

Community Contributions

ComfyUI version by @AIFSH

Installation

Install with conda:

conda env create -f environment.yaml
conda activate mimicbrush

or pip:

#Python==3.8.5
pip install -r requirements.txt

Download Checkpoints

Download SD-1.5 and SD-1.5-inpainting checkpoint:

Download MimicBrush checkpoint, along with a VAE, a CLIP encoder, and a depth model

  • Download the weights on ModelScope xichen/MimicBrush
  • The model is big because it contains two U-Nets.

You could use the following code to download them from modelscope

from modelscope.hub.snapshot_download import snapshot_download as ms_snapshot_download

sd_dir = ms_snapshot_download('xichen/cleansd', cache_dir='./modelscope')
print('=== Pretrained SD weights downloaded ===')
model_dir = ms_snapshot_download('xichen/MimicBrush', cache_dir='./modelscope')
print('=== MimicBrush weights downloaded ===')

or from Huggingface

from huggingface_hub import snapshot_download
snapshot_download(repo_id="xichenhku/cleansd", local_dir="./cleansd")
print('=== Pretrained SD weights downloaded ===')
snapshot_download(repo_id="xichenhku/MimicBrush", local_dir="./MimicBrush")
print('=== MimicBrush weights downloaded ===')

Gradio Demo

First, modify ./configs/inference.yaml to set the path of model weight. Afterwards, run the script:

python run_gradio3_demo.py

The gradio demo would look like the UI shown below.

*Please do not forget to click ''keep the original shape'' if you want condut texture transfer like the third case.

A biref tutorial:

  • Upload/select a source image to edit.
  • Draw the to-edit regionon the source image.
  • Upload/select a reference image.
  • Run.

Inference

  1. Dowload our evaluation benchmark at Google Drive:

    • URL: [to be released]
  2. Set the path to each dataset and checkpoints in ./config/inference.yaml :

  3. Run inference with

    python run_inference_benchmark.py

Acknowledgements

This project is developped on the codebase of IP-Adapter and MagicAnimate . We appreciate this great work!

Citation

If you find this codebase useful for your research, please use the following entry.

@article{chen2024mimicbrush,
  title={Zero-shot Image Editing with Reference Imitation},
  author={Chen, Xi and Feng, Yutong and Chen, Mengting and Wang, Yiyang, and Zhang, Shilong and Yu, Liu and Shen, Yujun and Zhao, Hengshuang},
  journal={arXiv preprint arXiv:2406.07547},
  year={2024}
}

Star History

Star History Chart

mimicbrush's People

Contributors

xavierchen34 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.