Lifeng Chen1
Jiner Wang1
Zihao Pan1
Beier Zhu1, 2
Xiaofeng Yang1, 2
Chi Zhang1✉
1AGI Lab, Westlake University,
2Nanyang Technological University
This paper introduces a novel method for addressing semantic binding in text-to-image (T2I) generation. Our approach employs a progressive injection mechanism to accurately assign attributes within the correct subject regions. Notably, the proposed method not only mitigates semantic overflow but also overcomes the challenge of style blending —issues that existing techniques fail to resolve. The core idea involves initially removing all attributes and then reintroducing them sequentially within a unified self-attention framework.
For technical details, please refer to our paper.
-
Environment Setup
Clone the code and prepare the environment:
git clone git@github.com:clf28/Detail-plus-plus.git cd Detail-plus-plus pip install -r requirements.txtAdditionally, download the SpaCy model for syntax parsing:
python -m spacy download en_core_web_sm
-
Configure Parameters
Modify the
config.pyfile to adjust runtime parameters as needed. Our framework is highly flexible, enabling adjustments to parameters such as prompt text, mask threshold, and attention map substitution percentage, which in turn yield a diverse range of interesting results. The key parameters are outlined as follows:prompt: Text prompt for guiding image generation.use_nlp: Whether to decompose the string inpromptautomatically using SpaCy.sps: A list of sub-prompts. You can design diverse sub-prompts freely like color, object accessory, and style to achieve different effects. Worked whenuse_nlpis set toFalse.nps: A list of noun pharses. Means the corresponding subject of current adding attributes.Nonehere means the influence region will be the whole image. Worked whenuse_nlpis set toFalse.lb_t: The threshold for masking out the image regions. Varing from -1 to 1, where -1 means no masking.
-
Run the Example
Execute the main script
run.py:python run.py
The generated images will be saved in the
runs-SDXL/style-testdirectory.
To run a local demo of the project, run the following:
pyton app.pyIf everything is set up correctly, ColorConfig and StyleConfig class in config.py should produce images like the left and right below, respectively:
- Custom Configurations: Please refer to the
config.pyfile for customizing the runtime parameters. - Parameter Sensitivity: This method retains the sensitivity characteristic of inference-based optimization techniques, meaning that the generated results are significantly influenced by the choice of hyperparameters. Careful tuning may be necessary to achieve optimal performance.
- NLP Models: When using NLP models like SpaCy for token parsing, ensure the correct language model is installed. Here, we provide a simple adjective phrase parser that may not be accurate in all cases.
This project builds upon valuable work and resources from the following repositories:
We extend our sincere thanks to the creators of these projects for their contributions to the field and for making their code available. 🙌

