Decoupled Textual Embeddings for Customized Image Generation

Yufei Cai, Yuxiang Wei, Zhilong Ji, Jinfeng Bai, Hu Han, Wangmeng Zuo

Introduction

Customized text-to-image generation aims to synthesize a specific concept—such as a personal pet or a unique toy—using a minimal set of reference images (typically 3–5). Despite the success of methods like DreamBooth and Custom Diffusion, these models often suffer from entanglement. Because the training data is extremely sparse, the model frequently fails to distinguish the subject from its background or pose. For instance, if a dog is always photographed on grass, the model may incorrectly associate "grass" with the dog's identity, making it impossible to generate the dog in a different setting, like the moon or a beach. This lack of "editability" limits the creative potential of personalized AI models.

Methodology: The DETEX Framework

To address this, we present DETEX (Decoupled Textual Embeddings). Unlike traditional methods that represent a concept with a single word embedding, DETEX decomposes each training image into a set of decoupled components:

  1. Image-Shared Subject Embedding ($v$): A global token capturing the core identity of the subject across all training samples.
  2. Image-Specific Unrelated Embeddings ($v^p_i$ and $v^b_i$): Local tokens that represent the Pose and Background of each individual training image.

Architectural Innovations

DETEX employs Attribute Mappers—small Multi-Layer Perceptrons (MLPs) of approximately 6.7 MB—to project features from a pretrained CLIP image encoder into the pose and background embedding spaces. This allows the model to "offload" image-specific details into these auxiliary tokens rather than polluting the main subject embedding.

DETEX enables complex attribute editing, such as placing a learned subject in a firefighter outfit while maintaining identity.

Furthermore, the framework utilizes a Cross-Attention Loss ($L_{CA}$). By leveraging subject masks during training, the model is forced to align the background token's attention map with the area outside the mask, while the subject and pose tokens focus on the interior. A random background filtering mechanism further encourages the subject embedding to remain independent of its surroundings. During inference, users can use the subject embedding for new scenes or selectively "plug in" a pose or background embedding from training to retain specific attributes.

Experimental Evaluation

The performance of DETEX was evaluated on DreamBench, a standard benchmark comprising 30 subjects across categories like animals, toys, and wearable items. The evaluation involved 25 editing prompts per subject, totaling 6,000 generated images.

Quantitative Results

DETEX demonstrates superior performance across key metrics compared to baselines such as Textual Inversion, DreamBooth, and Custom Diffusion:

  • Text Alignment: DETEX achieved a CLIP-T score of 0.3249, indicating significantly better responsiveness to complex prompts.
  • Subject Fidelity: On the foreground-specific metric (CLIP-I FG), DETEX scored 0.7688, outperforming Custom Diffusion (0.7553).
Successful background disentanglement: placing a specific subject (backpack) in a snowy environment.

Qualitative and User Study

Visual analysis confirms that DETEX excels at following prompts that require significant scene changes. In human preference studies, DETEX was favored for image alignment over 79% of the time against ViCo and 75% of the time against SVDiff. The model is notably better at following complex prompts, such as "a dog jumping out of a window," without bringing along the original training background.

Conclusion and Future Work

DETEX effectively solves the entanglement problem by treating training images as a composite of decoupled attributes. While the method currently relies on subject masks (which can be automated via tools like Segment Anything), it provides a robust mechanism for selective attribute retention. Future research will explore finer granularity in decoupling, such as isolating facial expressions or specific lighting conditions, to further enhance the creative control of personalized AI models.

Summary updated

BibTeX
@inproceedings{cai2024decoupled,
  author = {Yufei Cai and Yuxiang Wei and Zhilong Ji and Jinfeng Bai and Hu Han and Wangmeng Zuo},
  title = {{Decoupled Textual Embeddings for Customized Image Generation}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  doi = {10.1609/aaai.v38i2.27850},
}
Figure