Abstract
FaceShop is a deep learning-based image editing system designed to bridge the gap between automated image completion and user-driven image-to-image translation. By unifying these tasks into a single conditional Generative Adversarial Network (GAN) framework, FaceShop enables users to modify facial features, hair, and makeup through intuitive sketches and color strokes. The system is specifically engineered to handle the "messy" nature of human-drawn inputs while maintaining high-resolution (512x512) output and real-time performance.
Introduction
While global image adjustments, such as filters and color grading, have become accessible to non-experts, local semantic editing remains a significant challenge. Modifying specific facial features—such as the shape of a nose, the contour of a jawline, or the placement of individual hair strands—traditionally requires professional expertise in digital retouching.
Existing deep learning approaches generally address this through two distinct paradigms: image completion (inpainting) and image-to-image translation. Image completion fills missing regions based on surrounding context but offers the user little control over the specific geometry of the result. Conversely, image-to-image translation (e.g., pix2pix) allows for sketch-based control but often requires a complete sketch of the entire image and struggles with the imprecise lines typical of human drawing. FaceShop introduces a "conditional completion" framework that allows users to provide the "what" (via sketch and color) while the system handles the "how" (photorealistic rendering), ensuring the edit remains semantically consistent with the original photograph.
Methodology
Unified Conditional Framework
The core of FaceShop is a Conditional Convolutional Neural Network trained within a GAN framework. The model processes five distinct inputs to generate a single edited output:
- Original Image: The source photo with the target edit area masked out.
- Binary Mask: Defines the specific region to be modified.
- Edge Sketch: User-provided lines defining the geometry of the new feature.
- Color Strokes: Rough color indications for the edited area.
- Noise Layer: Provides stochastic variation to aid in texture generation.
The "Sketch Domain"
A primary innovation of FaceShop is its robustness to human sketching styles. To achieve this, the authors developed a novel training data generation pipeline. Rather than training on perfect edge maps, they extracted edges using Holistically-Nested Edge Detection (HED), fitted them to splines, and applied smoothing. This process introduces a "useful ambiguity," teaching the model to interpret user strokes as rough geometric guides rather than absolute pixel boundaries. This allows the system to produce realistic results even when the user's input is shaky or imprecise.
Color and Texture Constraints
To simplify color manipulation, the system utilizes bilateral filtering and semantic median colors. By calculating the average color of specific features (e.g., lips or hair) during training, the model learns to map rough brushstrokes to realistic gradients and textures. This enables users to change lip color or apply eye shadow with minimal effort.
Architecture and Loss Functions
The generator employs an encoder-decoder structure with skip connections and Local Response Normalization (LRN) to maintain training stability. To ensure both global consistency and local detail, the system uses two discriminators:
- Global Discriminator: Evaluates the entire face to ensure the edit fits the overall lighting and anatomy.
- Local Discriminator: Focuses specifically on the edited patch to ensure fine-grained texture and seamless blending.
Training is guided by a combination of $L_1$ reconstruction loss and a Wasserstein GAN with Gradient Penalty (WGAN-GP) loss, which mitigates common GAN training instabilities and improves texture quality.
Implementation and Datasets
The model was trained using the CelebA (Celebrity Attributes) dataset. The authors filtered the dataset for high-quality images, resulting in a training set of 20,000 images aligned and cropped to a 512x512 resolution. An additional 1,000 images were reserved for testing. This high-resolution training allows FaceShop to produce much crisper results than contemporary models typically limited to 128x128 or 256x256 pixels.
Key Results
FaceShop demonstrates significant advancements in interactive image editing:
- Real-time Interaction: A single edit is processed in approximately 0.06 seconds on a modern GPU, allowing for a fluid, interactive sketching experience.
- Versatility: The system successfully handles a wide range of edits, including changing facial expressions, adding accessories like glasses, modifying complex hairstyles, and applying makeup.
- Contextual Awareness: Because the model views the unmasked portions of the face during the editing process, it automatically matches the skin tone, lighting, and texture of the original subject.
- Feature Transfer: The "sketch domain" approach allows for a "smart copy-paste" functionality. Users can extract the geometry and color of a feature from one person and apply it to another; the system re-renders the feature to fit the target face's context rather than simply pasting pixels.
Discussion and Limitations
Despite its capabilities, FaceShop has limitations regarding semantic "sanity." The model lacks an inherent understanding of human anatomy; if a user draws an eye on a forehead, the model will attempt to render it there, resulting in unrealistic "monster" images because such layouts were absent from the training data. Additionally, while the system excels at 512x512 resolution, it struggles to maintain structural integrity at much higher scales (e.g., 1000x1000) without further training.
Future work may involve extending this framework to video editing, where the primary challenge will be maintaining temporal consistency to prevent flickering between frames. Nevertheless, FaceShop represents a significant step forward in making sophisticated, localized image manipulation accessible to non-professional users.
Summary updated