Abstract
DeepFacePencil is a novel sketch-to-photo translation tool designed to generate high-quality face images from freehand sketches. Unlike existing models that rely on perfectly aligned edge maps, DeepFacePencil addresses the inherent distortions and inaccuracies in human sketching through a Spatial Attention Pooling (SAP) module and a dual-generator training strategy. This approach allows the model to maintain high realism while remaining robust to the "messiness" of real-world user input.
Introduction
Most image-to-image translation models, such as Pix2pix, are trained on "perfect" data—synthetic edge maps extracted directly from photos. These edges align perfectly with the underlying image. However, real-world freehand sketches are full of distortions, varying stroke widths, and anatomical errors. When a standard model encounters a "bad" sketch, it suffers from a strict alignment problem: it tries to force facial features to follow the exact lines of the sketch, resulting in warped, unrealistic faces. DeepFacePencil addresses this fundamental trade-off between realism (how much it looks like a real person) and conformance (how closely it follows the user's lines).
Methods
The authors propose two major innovations to handle the "messiness" of human sketching:
Spatial Attention Pooling (SAP)
Instead of treating a sketch line as a single-pixel constraint, SAP "relaxes" the strokes. It passes the sketch through multiple pooling branches with different kernel sizes, creating a set of "blurred" or widened stroke regions. A spatial attention map then adaptively decides which parts of the sketch should be followed strictly (high conformance) and which parts are likely mistakes that the model should "smooth over" to maintain realism.
Dual-Generator Framework
During training, the authors use two generators:
- Auxiliary Generator ($G_a$): Trained on clean, perfectly aligned edge maps.
- Main Generator ($G_m$): Trained on "deformed" sketches—synthetic sketches intentionally warped to mimic human error.
A Generator Feature Matching Loss ($L_{GFM}$) forces the main generator to produce internal features similar to the auxiliary generator, essentially teaching the model how to "rectify" a distorted sketch into a clean feature space before the final pixels are drawn.
Data and Evaluation
The model was trained using the CelebA-HQ dataset, consisting of 30,000 high-resolution face images. CelebAMask-HQ was used to extract semantic boundaries (e.g., the outline of the nose, eyes, and lips) to serve as the "ground truth" sketches. To evaluate generalization, the authors collected hand-drawn test sets, including 12 sketches from an expert artist and 200 freehand sketches from 20 non-experts using computer mice.
Key Results
DeepFacePencil outperformed baseline models like Pix2pix and Pix2pixHD on standard metrics. It achieved an Inception Score (IS) of 2.411 and a Fréchet Inception Distance (FID) of 242.1, indicating higher realism and better distribution matching. Qualitatively, in tests with non-expert sketches, baseline models produced blurry images with obvious artifacts around distorted lines. In contrast, DeepFacePencil maintained sharp textures and symmetric facial structures even when the input sketch was significantly warped.
Conclusion and Future Work
DeepFacePencil successfully bridges the gap between rough doodles and photorealistic face synthesis by balancing realism and conformance. While currently specialized for human faces, future work could extend this to general objects or incorporate additional user controls for texture and style, such as hair color or skin tone.
Summary updated