Only-Style: Stylistic Consistency in Image Generation without Content Leakage

June 18, 2025 ยท View on GitHub

Only-Style: Stylistic Consistency in Image Generation without Content Leakage

Official implementation of "Only-Style: Stylistic Consistency in Image Generation without Content Leakage".

arXiv

Installation


This repository provides instructions to replicate the Only-Style Conda environment. Follow the steps below to set up the environment on your local machine.

Prerequisites

Ensure the following software is installed on your system:


Steps to Install the Environment

  1. Clone or Download the Repository

    Download or clone the repository that contains the environment.yml file.

  2. Create the Conda Environment

    Run the following command to create the environment:

    conda env create -f environment.yml
    

Inference


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:

ArgumentDescriptionExample Value
--seedRandom seed for reproducibility.42
--S_refDescription of the stylistic reference subject."A cat"
--ref_tokenToken identifying the reference subject."cat"
--S_tgtDescription of the target subject."A train"
--tgt_tokenToken identifying the target subject."train"
--styleDescription of the desired style for the image."in 3D rendering style"
--precisionPrecision of the binary search algorithm used to determine the optimal alpha (see manuscript).0.03
--output_dirDirectory where the generated images and logs will be saved."./output"

Example

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"

Outputs

The inference script produces the following outputs in the directory specified by --output_dir:

  1. Reference Image (Reference.png):

    • Image used as a stylistic reference.
  2. Style-Aligned Target Image (StyleAligned_Target.png):

  3. Content Leakage Heatmap (StyleAligned_Leakage.png):

    • Visualization of content leakage, overlaid as a heatmap on the target image mentioned above.
  4. Optimized Target Image (Only_Style_Target.png):

    • Final image generated using controlled style alignment, avoiding content leakage.
  5. 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.

Code Development Status

  • 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

Citation

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}, 
}


Acknowledgements

This work builds upon the Style-Aligned repository by Google Research. We thank the authors for making their code publicly available.