Skip to content
 
 

Repository files navigation

StyleShot

This is a fork of the official StyleShot Implementation, used to support my other project where I compare the results of the unofficial StyleDrop implementation to the results of StyleShot.

Difference to the project this is forked from

This project was tested to run under a v100 and L4 GPU using CUDA Version: 13.0

  • The requirements have been updated
  • some more logging was added to the text driven inference demo code

Please check out the results in my StyleDrop Project if you are interested.

Start

# install styleshot
git clone https://github.com/pinkfloat/StyleShot
cd StyleShot

# create env
python3 -m venv venv_styleshot
source venv_styleshot/bin/activate
pip install -r requirements.txt

# download the models
git lfs install
git clone https://huggingface.co/Gaojunyao/StyleShot
git clone https://huggingface.co/Gaojunyao/StyleShot_lineart

Models

you can download the pretrained weight from here. To run the demo, you should also download the following models:

Inference

For inference, you should download the pretrained weight and prepare your own reference style image or content image.

# run text-driven style transfer demo
python styleshot_text_driven_demo.py --style "{style_image_path}" --prompt "{prompt}" --output "{save_path}"

# run image-driven style transfer demo
python styleshot_image_driven_demo.py --style "{style_image_path}"  --content "{content_image_path}" --preprocessor "Contour" --prompt "{prompt}" --output "{save_path}"

# integrate styleshot with controlnet and t2i-adapter
python styleshot_t2i-adapter_demo.py --style "{style_image_path}"  --condition "{condtion_image_path}" --prompt "{prompt}" --output "{save_path}"
python styleshot_controlnet_demo.py --style "{style_image_path}"  --condition "{condtion_image_path}" --prompt "{prompt}" --output "{save_path}"

Text-driven style transfer visualization

Image style transfer visualization

StyleBench

To address the lack of a benchmark in reference-based stylized generation, the StyleShot authors established a style evaluation benchmark containing 40 content images and 73 distinct styles across 490 reference images.

Citation

If you find StyleShot useful for your research and applications, please cite using this BibTeX:

@article{gao2024styleshot,
  title={Styleshot: A snapshot on any style},
  author={Gao, Junyao and Liu, Yanchen and Sun, Yanan and Tang, Yinhao and Zeng, Yanhong and Chen, Kai and Zhao, Cairong},
  journal={arXiv preprint arXiv:2407.01414},
  year={2024}
}

Acknowledgements

The StyleShot code is built upon IP-Adapter.

About

StyleShot: A SnapShot on Any Style

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages