Face Image Retrieval with Attribute Manipulation

Alireza Zaeemzadeh, Shabnam Ghadar, Baldo Faieta, Zhe Lin, Nazanin Rahnavard, Mubarak Shah, Ratheesh Kalarot

Abstract

Traditional face image retrieval systems often lack the flexibility to accommodate specific user intents, treating queries as rigid templates. This paper, presented at ICCV 2021, introduces a novel framework that leverages the latent space of StyleGAN to provide users with fine-grained control over facial attributes and their relative importance. By enforcing sparsity and orthogonality on learned attribute directions, the proposed method enables precise query manipulation and customized distance metrics, achieving state-of-the-art retrieval performance while preserving the subject's identity.

Introduction

Standard image retrieval systems typically operate on a "query-by-example" basis, which can be problematic when a user's intent is nuanced. For instance, a user might seek a face similar to a query image but with a specific modification, such as adding a beard or changing the hair color. Furthermore, existing systems often fail to distinguish which features the user deems most important, leading to results that may match irrelevant attributes like expression while missing the desired hairstyle.

This research addresses these limitations by introducing a retrieval framework that allows for both attribute adjustment and feature weighting. The system transforms the retrieval process from a black-box search into a customizable experience where users can "edit" their query and define a personalized distance metric.

Methodology: Disentangled Latent Space

The core of the approach is built upon the extended latent space $W^+$ of a pre-trained StyleGAN. The researchers hypothesize that facial attributes can be represented as specific directions within this high-dimensional space. The training process utilizes a hinge loss for classification and a Procrustes-based projection to maintain the orthogonality of these directions. To ensure these directions are effective for retrieval, two key constraints are applied:

  1. Sparsity: Attribute directions are forced to be sparse, meaning they only modify a small subset of the latent code. This minimizes "attribute leakage," ensuring that adding a trait like "baldness" does not inadvertently alter the subject's smile or eye color.
  2. Orthogonality: By maintaining orthogonality between different attribute directions, the total distance between two images can be mathematically decomposed into a sum of independent, attribute-wise distances.
Retrieval results demonstrating the system's ability to isolate and match specific facial attributes, such as glasses, across different subjects.

Preference and Adjustment Vectors

The framework introduces two primary mechanisms for user control:

  • Adjustment Vector ($a_q$): This allows users to shift the query image's latent representation along the learned attribute directions. For example, a user can "add a beard" to a query image before the search is executed.
  • Preference Vector ($p_q$): Leveraging the orthogonality of the basis, users can assign weights to specific attributes. This enables the system to prioritize certain features (e.g., "find someone with this hair color, regardless of their age").

Furthermore, the distance metric effectively partitions the latent space into "known attributes" and a "residual subspace." This residual space captures unique identity and fine details not covered by the predefined attribute list, ensuring that retrieved results maintain a strong visual resemblance to the query subject.

Experimental Setup and Results

The model was trained using StyleGAN on the FFHQ dataset, with attribute directions learned from 20,000 labeled samples in the CelebA dataset. Retrieval performance was evaluated against a gallery of 20,000 test images and a synthetic gallery of 100,000 faces.

Qualitative results showing successful retrieval of subjects with specific facial hair attributes while maintaining high identity similarity.

Quantitative Performance

The proposed method demonstrated superior accuracy compared to baselines such as TIRG and InterFaceGAN. In terms of Normalized Discounted Cumulative Gain (nDCG), the model achieved a score of 0.923, outperforming InterFaceGAN's 0.905. Crucially, the system maintained high identity similarity (measured via an Inception Resnet V1 model), proving that attribute manipulation does not degrade the recognizable features of the query subject. The authors also noted that increasing the sparsity constraint ($\lambda$) directly improved retrieval accuracy, confirming that isolated directions are superior for isolating specific traits.

Conclusion

This paper presents a significant advancement in controllable image retrieval. By mapping semantic attributes to sparse, orthogonal directions in the StyleGAN latent space, the researchers have created a system that is both highly accurate and intuitively customizable. While currently limited by the predefined set of attributes used during training, future work may involve expanding the system to handle non-binary attributes and incorporating interactive feedback loops to further refine the user's preference vector.

Summary updated

BibTeX
@inproceedings{zaeemzadeh2021face,
  author = {Alireza Zaeemzadeh and Shabnam Ghadar and Baldo Faieta and Zhe Lin and Nazanin Rahnavard and Mubarak Shah and Ratheesh Kalarot},
  title = {{Face Image Retrieval with Attribute Manipulation}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2021},
  doi = {10.1109/iccv48922.2021.01190},
}
Figure