Introduction
Generative models like StyleGAN2 and Stable Diffusion have revolutionized image synthesis and inpainting. However, a persistent challenge in face inpainting is the loss of individual identity. While these models can create aesthetically pleasing faces, they often fail to preserve the specific facial details—such as eye shape, brow structure, and skin texture—that define a particular person. This paper introduces PATMAT (Person Aware Tuning of Mask-Aware Transformer), a novel method designed to bridge the gap between generic plausibility and subject-specific fidelity.
The Challenge of Identity Preservation
Current state-of-the-art inpainting models prioritize "plausibility." If a portion of a face is masked, the model fills it with features that look natural but may belong to a "generic" face rather than the subject. This "identity loss" limits the utility of inpainting for applications like high-quality photo restoration or removing obstructions (like sunglasses or headsets) where the subject's true likeness is paramount. Existing personalization techniques often require hundreds of reference images or struggle with the rigid latent spaces of GAN-based architectures.
Methodology: Person Aware Tuning (PAT)
PATMAT builds upon the Mask-Aware Transformer (MAT), adapting its style manipulation module for personalization. The core innovation is the use of "Style Anchors" to guide the fine-tuning process using as few as 40 reference images.
Style Anchoring and Clustering
The researchers proposed two variations of anchoring:
- PATMAT-S (Single): Assigns a unique anchor in the style space for every reference image.
- PATMAT-C (Cluster): Groups similar reference images (e.g., those with similar lighting or accessories) to share a single anchor.
Interestingly, PATMAT-C proved more effective. By clustering images, the model learns a more robust representation of the subject's identity across different conditions, preventing "feature leakage" where artifacts from one reference image (like a specific shadow) might bleed into unrelated inpainting tasks.
Regularization and Optimization
To prevent the model from overfitting to the small reference set, the authors employed a regularization strategy using random faces from the original training data. This ensures the model retains its general understanding of facial structure while learning the new identity. Furthermore, the final output is optimized using ArcFace, a pre-trained face recognition model, to maximize the cosine similarity between the generated pixels and the reference set.
Experimental Results
The authors curated a dataset of seven public figures to evaluate the model, including figures like Taylor Swift and Dwayne Johnson. PATMAT-C significantly outperformed baseline models in identity preservation.
Quantitative Performance
Using ArcFace cosine similarity (where 1.0 is a perfect identity match), PATMAT-C achieved a score of 0.66, more than doubling the performance of the base MAT model (0.35) and surpassing other competitors like RePaint (0.32). Crucially, this improvement in identity did not come at the cost of image quality; the model maintained a competitive Frechet Inception Distance (FID) of 23.7, nearly matching the base MAT's 22.9.
Human Perception Study
In a user study designed to test the realism of the inpainted images, participants were often unable to distinguish PATMAT-generated faces from real photographs. In some tests, the accuracy of identifying the "real" image was only 44%, suggesting the results are virtually indistinguishable to the human eye.
Conclusion and Future Directions
PATMAT demonstrates that high-fidelity, personalized face inpainting is possible with a relatively small number of reference images. By introducing style anchors into a transformer architecture, the method preserves the "person" in the image without sacrificing aesthetic quality. Future work will focus on automating the image clustering process and improving the model's performance on extreme poses not captured in the reference set.
Summary updated