Official implementation of "Only-Style: Stylistic Consistency in Image Generation without Content Leakage".
This repository provides instructions to replicate the Only-Style Conda environment. Follow the steps below to set up the environment on your local machine.
Ensure the following software is installed on your system:
-
Clone or Download the Repository
Download or clone the repository that contains the
environment.ymlfile. -
Create the Conda Environment
Run the following command to create the environment:
conda env create -f environment.yml
Use the following command to generate a stylistically aligned image pair without content leakage:
python Only_Style_CLI.py --seed <seed_value> --S_ref "<reference_sentence>" --ref_token "<reference_token>" --S_tgt "<target_sentence>" --tgt_token "<target_token>" --style "<style_description>" --precision <precision_value> --output_dir "<output_directory>"Below is a breakdown of the arguments:
| Argument | Description | Example Value |
|---|---|---|
--seed |
Random seed for reproducibility. | 42 |
--S_ref |
Description of the stylistic reference subject. | "A cat" |
--ref_token |
Token identifying the reference subject. | "cat" |
--S_tgt |
Description of the target subject. | "A train" |
--tgt_token |
Token identifying the target subject. | "train" |
--style |
Description of the desired style for the image. | "in 3D rendering style" |
--precision |
Precision of the binary search algorithm used to determine the optimal alpha (see manuscript). | 0.03 |
--output_dir |
Directory where the generated images and logs will be saved. | "./output" |
python Only_Style_CLI.py --seed 42 --S_ref "A cat" --ref_token "cat" --S_tgt "A train" --tgt_token "train" --style "in 3D rendering style" --precision 0.03 --output_dir "./output"The inference script produces the following outputs in the directory specified by --output_dir:
-
Reference Image (
Reference.png):- Image used as a stylistic reference.
-
Style-Aligned Target Image (
StyleAligned_Target.png):- Target image aligned stylistically via StyleAligned.
-
Content Leakage Heatmap (
StyleAligned_Leakage.png):- Visualization of content leakage, overlaid as a heatmap on the target image mentioned above.
-
Optimized Target Image (
Only_Style_Target.png):- Final image generated using controlled style alignment, avoiding content leakage.
-
Log File (
log.txt):- Contains details such as the number of leaky patches detected in every step of the binary search process for the optimal alpha.
- Inference code for Only-Style
- Support for multi-image and multi-subject cases
- Support for real stylistic references
- Support for Generalized Leakage Localization (input reference-target pair)
- Evaluation code
If you find this work useful, please cite:
@misc{aravanis2025onlystylestylisticconsistencyimage,
title={Only-Style: Stylistic Consistency in Image Generation without Content Leakage},
author={Tilemachos Aravanis and Panagiotis Filntisis and Petros Maragos and George Retsinas},
year={2025},
eprint={2506.09916},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2506.09916},
}
This work builds upon the Style-Aligned repository by Google Research. We thank the authors for making their code publicly available.