Home

Awesome

<div align="center"> <h1>High Fidelity Scene Text Synthesis</h1>

Yibin Wang*, Weizhong Zhang*, Changhai Zhou, Cheng Jinโ€ 

(*equal contribution, โ€ corresponding author)

[Fudan University]

<a href="https://arxiv.org/pdf/2405.14701"> <img src='https://img.shields.io/badge/arxiv-DreamText-blue' alt='Paper PDF'></a> <a href="https://codegoat24.github.io/DreamText/"> <img src='https://img.shields.io/badge/Project-Website-orange' alt='Project Page'></a> </div>

๐Ÿ“– Abstract

Scene text synthesis involves rendering specified texts onto arbitrary images. Current methods typically formulate this task in an end-to-end manner but lack effective character-level guidance during training. Besides, their text encoders, pre-trained on a single font type, struggle to adapt to the diverse font styles encountered in practical applications. Consequently, these methods suffer from character distortion, repetition, and absence, particularly in polystylistic scenarios. To this end, this paper proposes DreamText for high-fidelity scene text synthesis. Our key idea is to reconstruct the diffusion training process, introducing more refined guidance tailored to this task, to expose and rectify the model's attention at the character level and strengthen its learning of text regions. This transformation poses a hybrid optimization challenge, involving both discrete and continuous variables. To effectively tackle this challenge, we employ a heuristic alternate optimization strategy. Meanwhile, we jointly train the text encoder and generator to comprehensively learn and utilize the diverse font present in the training dataset. This joint training is seamlessly integrated into the alternate optimization process, fostering a synergistic relationship between learning character embedding and re-estimating character attention. Specifically, in each step, we first encode potential character-generated position information from cross-attention maps into latent character masks. These masks are then utilized to update the representation of specific characters in the current step, which, in turn, enables the generator to correct the character's attention in the subsequent steps. Both qualitative and quantitative results demonstrate the superiority of our method to the state of the art.

DreamText Teaser

๐Ÿš€ Gradio Demo

Setup

conda create -n dreamtext python=3.11
conda activate dreamtext
pip install -r requirements.txt

Download our Pre-trained Models

Download our available checkpoints and put them in the corresponding directories in ./checkpoints.

Run

You can run the demo locally by

python run_gradio.py

<img src=demo/gradio.png style="zoom:30%" />

๐Ÿ—“๏ธ TODO

๐ŸŽซ License

For non-commercial academic use, this project is licensed under the 2-clause BSD License. For commercial use, please contact Cheng Jin.

๐Ÿ–Š๏ธ BibTeX

If you find this project useful in your research, please consider cite:

@article{DreamText,
      title={High Fidelity Scene Text Synthesis},
      author={Wang, Yibin and Zhang, Weizhong and Zhou, Changhai and Jin, Cheng},
      journal={arXiv preprint arXiv:2405.14701},
      year={2024}
    }

๐Ÿ“ง Contact

If you have any technical comments or questions, please open a new issue or feel free to contact Yibin Wang.

๐Ÿ™ Acknowledgements

Our work is based on Stable-Diffusion, thanks to all the contributors!