Abstract
Generating high-fidelity human portraits with precise spatial and semantic control remains a significant challenge in computer vision. While text-to-image models offer semantic flexibility and mask-to-image models provide spatial structure, combining these modalities efficiently is difficult. This paper introduces MM2Latent, a framework that fuses multimodal inputs—including text, masks, sketches, and 3D models—into the StyleGAN2 latent space. By utilizing a specialized MappingNetwork and a Pseudo Text Embedding Generation (PTEG) module, MM2Latent achieves state-of-the-art performance in attribute consistency and spatial accuracy. Notably, the system operates at speeds up to 1,300x faster than contemporary diffusion-based models, making it ideal for real-time interactive editing.
1. Introduction
The synthesis of human faces requires a delicate balance between high-level semantic attributes (e.g., age, expression) and low-level spatial constraints (e.g., the specific shape of a jawline or the placement of eyes). Existing unimodal approaches often force a trade-off: text-based prompts excel at describing abstract qualities but lack localized precision, while spatial inputs like segmentation masks or sketches define structure but remain agnostic to semantic details like color or texture.
MM2Latent addresses these limitations by providing a unified framework for multimodal face generation. By leveraging the well-structured latent space of StyleGAN2, the model enables users to provide simultaneous inputs, ensuring that the resulting image respects both the "what" (text) and the "where" (spatial layout) of the desired output.
2. Methodology
2.1 Architecture Overview
MM2Latent is built upon a pre-trained StyleGAN2 backbone, specifically targeting the disentangled $W$ latent space. The architecture is composed of three primary stages: multimodal encoding, feature fusion, and latent projection.
- Multimodal Encoders: To process diverse inputs, the framework employs specialized encoders. FaRL (a vision-language model) is used for text and image features, while custom-trained autoencoders handle masks and sketches. For 3D structural control, the system integrates DECA to extract 3D Morphable Model (3DMM) parameters.
- The MappingNetwork: The core of the framework is a multi-layer perceptron (MLP) stack that learns to fuse these disparate feature vectors. This network projects the combined multimodal representation directly into the StyleGAN2 latent code, allowing for high-fidelity image generation in a single forward pass.
2.2 Pseudo Text Embedding Generation (PTEG)
A common failure mode in multimodal training is the model's over-reliance on perfectly paired text-mask data. To improve robustness, the authors introduced PTEG. During training, this module generates synthetic text embeddings by adding Gaussian noise to image features. This simulates the inherent variability and imprecision of natural language prompts, ensuring the model remains stable even when user descriptions do not perfectly align with the provided spatial masks.
2.3 Real Image Editing
Beyond generation from scratch, MM2Latent supports the editing of real-world photographs. By utilizing GAN inversion (specifically the e4e encoder), a real image is mapped to its latent representation. The model then calculates an "editing direction" based on new multimodal inputs, allowing for precise modifications—such as changing a hairstyle or adding glasses—while strictly preserving the subject's identity.
3. Experimental Results
3.1 Datasets and Metrics
The model was evaluated using the CelebAHQ-Mask dataset (30,000 images with 19-class masks) and CelebA-Dialog for natural language descriptions. General realism was benchmarked against the FFHQ dataset.
3.2 Performance Comparison
MM2Latent demonstrates superior performance across several key metrics compared to baselines like TediGAN and Collaborative Diffusion:
- Semantic Accuracy: Achieved a CLIP Score of 24.59%, indicating high alignment between the generated images and text prompts.
- Spatial Precision: Recorded a Mask Accuracy of 85.61%, a new state-of-the-art for multimodal facial synthesis.
- Image Quality: Obtained the lowest CMMD score (1.43), suggesting the generated distribution is statistically closer to real high-quality images than competing methods.
- Inference Speed: The model completes inference in approximately 41.78ms on a P100 GPU. This represents a speedup of 150x to 1,300x over diffusion-based alternatives, enabling seamless real-time applications.
4. Discussion and Conclusion
MM2Latent proves that GAN-based architectures remain highly relevant in the era of diffusion models, particularly for domain-specific tasks like facial synthesis where speed and precise control are paramount. The synergy between text and spatial masks is shown to be complementary rather than redundant.
Future work may involve scaling the MappingNetwork to further increase precision or extending the multimodal fusion logic to more complex, general-domain scenes beyond human faces. Currently, the system's primary constraint lies in the inherent capacity of the underlying StyleGAN2 generator, suggesting that integration with more advanced generative backbones could yield even higher fidelity results.
Summary updated