Latent Space Manipulation

The goal was to edit different face features in this project, such as making the eyebrow thicker or making someone older. To tackle this problem, manipulating the latent space of GANs was used instead of image processing, so the generator’s output had the desired edit.

There were some issues:

  1. Latent space is famous for its entanglement. As a result, manipulating a single feature may result in unintended outcomes (e.g., making someone balder leads to a more masculine face). As a result, advanced techniques were needed to generate disentangled representations.
  2. GANs tend to generate artifacts, which is undesirable, and addressing this problem issue was needed.
  3. Because the utilized GANs took a noise vector as input, a mapping from the input image to the latent space was required. However, most mappings are computationally expensive or produce non-identity results, so an efficient identity-preserving encoding method was needed.

The models take two different sets of inputs:
1) Input image+manipulation: applies the manipulation on the input image
2) Input image + Reference image + manipulation: applies the manipulation on the input image according to the reference image
Here are some results for both:

Input imageOutput imageManipulation
Age
Gender
Beard
Smile
Eyeglass

Input imageReference imageOutput imageManipulation
Age
Age
Lighting
Gender
  • Tech Stack: Python, PyTorch, Tensorflow, OpenCV, Flask, FastAPI, PyTest, AWS(EC2)