MXNet implementation of [Convolutional Sketch Inversion](https://arxiv.org/abs/1606.03073)
In this paper, we use deep neural networks for inverting face sketches to synthesize photorealistic face images. We first construct a semi-simulated dataset containing a very large number of computer-generated face sketches with different styles and corresponding face images by expanding existing unconstrained face data sets. We then train models achieving state-of-the-art results on both computer-generated sketches and hand-drawn sketches by leveraging recent advances in deep learning such as batch normalization, deep residual learning, perceptual losses and stochastic optimization in combination with our new dataset. We finally demonstrate potential applications of our models in fine arts and forensic arts. In contrast to existing patch-based approaches, our deep-neural-network-based approach can be used for synthesizing photorealistic face images by inverting face sketches in the wild.READ FULL TEXT VIEW PDF
Synthesis of face images from visual attributes is an important problem ...
This work explores the biases in learning processes based on deep neural...
With the powerfulness of convolution neural networks (CNN), CNN based fa...
In this paper, we explore the task of generating photo-realistic face im...
Recent deep image-to-image translation techniques allow fast generation ...
We propose a two-stream network for face tampering detection. We train
The task of detecting morphed face images has become highly relevant in
MXNet implementation of [Convolutional Sketch Inversion](https://arxiv.org/abs/1606.03073)
Portrait and self-portrait sketches have an important role in art. From an art historical perspective, self-portraits serve as historical records of what the artists looked like. From the perspective of an artist, self-portraits can be seen as a way to practice and improve one’s skills without the need for a model to pose. Portraits of others further serve as memorabilia and a record of the person in the portrait. Artists most often are able to easily capture recognizable features of a person in their sketches. Therefore, hand-drawn sketches of people have further applications in law enforcement. Sketches of suspects drawn based on eye-witness accounts are used to identify suspects, either in person or from catalogues of mugshots.
Prior work related to face sketches in computer vision has been mostly limited to synthesis of highly controlled (i.e. having neutral expression, frontal pose, with normal lighting and without any occlusions) sketches from photographs[1, 2, 3, 4, 5] (sketch synthesis) and photographs from sketches [6, 7, 8, 3, 4]
(sketch inversion). Sketch inversion studies with controlled inputs utilized patch-based approaches and used Bayesian tensor inference
, an embedded hidden Markov model, a multiscale Markov random field model , sparse representations  and transductive learning with a probabilistic graph model .
Few studies developed methods of sketch synthesis to handle more variation in one or more variables at a time, such as lighting , and lighting and pose . In a recent study, Zhang et al.  showed that sketch synthesis by transferring the style of a single sketch could be used also in uncontrolled conditions. In 
, first an initial sketch by a sparse representation-based greedy search strategy was estimated, then candidate patches were selected from a template style sketch and the estimated initial sketch. Finally, the candidate patches were refined by a multi-feature-based optimization model and the patches were assembled to produce the final synthesized sketch.
Recently, the use of deep convolutional neural networks (DNNs) in image transformation tasks, in which one type of image is transformed into another, has gained tremendous traction. In the context of sketch analysis, DNNs were used to tackle the problems of sketch synthesis and sketch simplification. For example, has used a DNN to convert photographs to sketches. They developed a DNN with six convolutional layers and a discriminative regularization term for enhancing the discriminability of the generated sketch against other sketches. Furthermore,  has used a DNN to simplify rough sketches. They have shown that users prefer sketches simplified by the DNN more than they do those by other applications 97% of the time.
Some other notable image transformation problems include colorization, style transfer and super-resolution. In colorization, the task is to transform a grayscale image to a color image that accurately captures the color information. In style transfer, the task is to transform one image to another image that captures the style of a third image. In super-resolution, the task is to transform a low-resolution image to a high-resolution image with maximum quality. DNNs have been used to tackle all of these problems with state-of-the art results[13, 14, 15, 16, 17, 18].
However, a challenging task that remains is photorealistic face image synthesis from face sketches in uncontrolled conditions. That is, at present, there exist no sketch inversion models that are able to perform in realistic conditions. These conditions are characterized by changes in expression, pose, lighting condition and image quality, as well as the presence of varying amounts of background clutter and occlusions.
Here, we use DNNs to tackle the problem of inverting face sketches to synthesize photorealistic face images from different sketch styles in uncontrolled conditions. We developed three different models to handle three different types of sketch styles by training DNNs on datasets that we constructed by extending a well-known large-scale face dataset, obtained in uncontrolled conditions . We test the models on another similar large-scale dataset , a hand-drawn sketch database  as well as on self-portrait sketches of famous Dutch artists. We show that our approach, which we refer to as Convolutional Sketch Inversion (CSI) can be used to achieve state-of-the-art results and discuss possible applications in fine arts, art history and forensics.
For training and testing our CSI model, we made use of the following datasets:
Large-scale CelebFaces Attributes (CelebA) dataset . The CelebA dataset contains 202,599 celebrity face images and 10,177 identities. The images were obtained from the internet and vary extensively in terms of pose, expression, lighting, image quality, background clutter and occlusion. Each image in the dataset has five landmark positions and 40 attributes. These images were used for training the networks.
Labeled Faces in the Wild (LFW) dataset . The LFW dataset contains 13,233 face images and 5749 identities. Similar to the CelebA dataset, images were obtained from the internet and vary extensively in terms of pose, expression, lighting, image quality, background clutter and occlusion. A subset of these images (11,990) were used for testing the networks.
CUHK Face Sketch (CUFS) database . The CUFS database contains photographs and their corresponding hand-drawn sketches of 606 individuals. The dataset was formed by combining face photographs from three other databases and producing hand-drawn sketches of these photographs. Concretely, it consists of 188 face photographs from the Chinese University of Hong Kong (CUHK) student database  and their corresponding sketches, 123 face photographs from the AR Face Database  and their corresponding sketches, and 295 face photographs from the XM2VTS database  and their corresponding sketches. Only 18 of the sketches (six from each sub-database) were used in the current study. These images were used for testing the networks.
Sketches of famous Dutch artists. We also used the following sketches: i) Self-Portrait with Beret, Wide-Eyed by Rembrandt, 1630, etching, ii) Two Self-portraits and Several Details by Vincent van Gogh, 1886, pencil on paper and iii) Self-Portrait by M.C. Escher, 1929, lithograph on gray paper. These images were used for testing the networks.
Similar to , each image was cropped and resized to 96 pixels 96 pixels such that:
The distance between the top of the image and the vertical center of the eyes was 38 pixels.
The distance between the vertical center of the eyes and the vertical center of the mouth was 32 pixels.
The distance between the vertical center of the mouth and the bottom of the image was 26 pixels.
The horizontal center of the eyes and the mouth was at the horizontal center of the image.
Each image in the CelebA and LFW datasets was automatically transformed to a line sketch, a grayscale sketch and a color sketch. Sketches in the CUFS database and those by the famous Dutch artists were further transformed to line sketches by using the same procedure.
Color and grayscale sketch types are produced by the same stylization algorithm . To obtain the sketch images, the input image is first filtered by an edge-aware filter. This filtered image is then blended with the magnitude of the gradient of the filtered image. Then, each pixel is scaled by a normalization factor resulting in the final sketch-like image.
Line sketches which resemble pencil sketches were generated based on . Line sketch conversion works by first converting the color image to grayscale. This is followed by inverting the grayscale image to obtain a negative image. Next, a Gaussian blur is applied. Finally, using color dodge, the resulting image is blended with the grayscale version of the original image.
It should be noted that synthesizing face images from color or grayscale sketches is a more difficult problem than doing so from line sketches since many details of the faces are preserved by line sketches while they are lost for other sketch types.
We developed one DNN for each of the three sketch styles based on the style transfer architecture in . Each of the three DNNs was based on the same architecture except for the first layer where the number of input channels were either one or three depending on the number of color channels of the sketches. The architecture comprised four convolutional layers, five residual blocks , two deconvolutional layers and another convolutional layer. Each of the five residual blocks comprised two convolutional layers. All of the layers except for the last layer were followed by batch normalization 
and rectified linear units. The last layer was followed by batch normalization and hyperbolic tangent units. All models were implemented in the Chainer framework. Table 1 shows the details of the architecture.
|1||con.||1 or 3||32||9||1||4||BN||ReLU|
, ReLU; rectified linear unit, con.; convolution, dec.; deconvolution, res.; residual block, tanh; hyperbolic tangent unit. Outputs of the hyperbolic tangent units are scaled to [0, 255]. x/y indicates the parameters of the first and second layers of a residual block. +x indicates that the input and output of a block are summed and no activation function is used.
For model optimization we used Adam  with parameters , , ,
and mini-batch size = 4. We trained the models by iteratively minimizing the loss function for 200,000 iterations. The loss function comprised three components. The first component is the standard Euclidean loss for the targets and the predictions (pixel loss;). The second component is the Euclidean loss for the feature-transformed targets and the feature-transformed predictions (feature loss) :
where is the total number of features, is a feature of the targets and is a feature of the predictions. Similar to , we used the outputs of the fourth layer of a 16-layer DNN (relu_2_2 outputs of the VGG-16 pretrained model)  to feature transform the targets and the predictions. The third component is the total variation loss for the predictions:
where is a pixel of the predictions. A weighted combination of these components resulted in the following loss function:
where we set and .
The use of the feature loss to train models for image transformation tasks was recently proposed by . In the context of super-resolution,  found that replacing pixel loss with feature loss gives visually pleasing results at the expanse of image quality because of the artefacts introduced by the feature loss.
In the context of sketch inversion, our preliminary experiments showed that combining feature loss and pixel loss increases image quality while maintaining visual pleasantness. Furthermore, we observed that a small amount of total variation loss further removes the artefacts that are introduced by the feature loss. Therefore, we used the combination of the three losses in the final experiments. The quantitative results of the preliminary experiments in which the models were trained by using only the feature loss are provided in the Appendix.
First, we qualitatively tested the models by visual inspection of the synthesized face images (Figure 2). Synthesized face images matched the ground truth photographs closely and persons in the images were easily recognizable in most cases. Among the three styles of sketch models, the line sketch model (Figure 2, first column) captured the highest level of detail in terms of the face structure, whereas the synthesized inverse sketches of the color sketch model (Figure 2, third column) had less structural detail but was able to better reproduce the color information in the ground truth images compared to the inverted sketches of the line sketch model. Sketches synthesized by the grayscale model (Figure 2, second column) were less detailed than those synthesized by the line sketch model. Furthermore, the color content was less accurate in sketches synthesized by the grayscale model than those synthesized by both the color sketch and the line sketch models. We found that the line model performed impressively in terms of matching the hair and skin color of the individuals even when the line sketches did not contain any color information. This may indicate that along with taking advantage of the luminance differences in the sketches to infer coloring, the model was able to learn color properties often associated with high-level face features of different ethnicities.
Then, we quantitatively tested the models by comparison of the peak signal to noise ratio (PSNR), structural similarity (SSIM) and standard Pearson product-moment correlation coefficient R of the synthesized face images (Table 2). PSNR measures the physical quality of an image. It is defined as the ratio between the peak power of the image and the power of the noise in the image (Euclidean distance between the image and the reference image):
where is the dynamic range, and is the total number of pixels in each of the three color channels. SSIM measures the perceptual quality of an image. It is defined as the multiplicative combination of the similarities between the image and the reference image in terms of contrast, luminance and structure:
where , , , and
are means, standard deviations and cross-covariances of windows centered aroundand . Furthermore, and . Quality of a dataset is defined as the mean quality over the images in the dataset.
The inversion of the line sketches resulted in the highest quality face images for all three measures (20.12 for PSNR, 0.86 for SSIM and 0.93 for R). In contrast the inversion of the grayscale sketches resulted in the lowest quality face images for all measures (17.65 for PSNR, 0.65 for SSIM and 0.75 for R). This shows that both the physical and the perceptual quality of the inverted sketch images produced by the line sketch network was superior than those by the other sketch styles.
|Line||20.1158 0.0231||0.8583 0.0003||0.9298 0.0005|
|Grayscale||17.6567 0.0263||0.6529 0.0008||0.7458 0.0020|
|Color||19.2029 0.0293||0.7154 0.0008||0.8087 0.0017|
the bootstrap estimate of the standard error of the mean.
Finally, we tested how well the line sketch inversion model can be transferred to the task of synthesizing face images from sketches that are hand-drawn and not generated using the same methods that were used to train the model. We considered only the line sketch model since the contents of the hand-drawn sketch database that we used  were most similar to the line sketches.
We found that the line sketch inversion model can solve this inductive transfer task almost as good as it can solve the task that it was trained on (Figure 3). Once again, the model synthesized photorealistic face images. While color was not always synthesized accurately, other elements such as form, shape, line, space and texture were often synthesized well. Furthermore hair texture and style, which posed a problem in most previous studies, was very well handled by our CSI model. We observed that the dark-edged pencil strokes in the hand-drawn sketches that were not accompanied by shading resulted in less realistic inversions (compare e.g nose areas of sketches in the first and second rows with those in the third row in Figure 3). This can be explained by the lack of such features in the training data of the line sketch model, and can be easily overcome by including training examples more closely resembling the drawing style of the sketch artists.
|CUHK (6)||15.0675 0.3958||0.5658 0.0099||0.8264 0.0269|
|AR (6)||13.8687 0.7009||0.5684 0.0277||0.7667 0.0314|
|XM2GTS (6)||11.3293 1.2156||0.4231 0.0272||0.4138 0.1130|
|All (18)||13.4218 0.6123||0.5191 0.0207||0.6690 0.0591|
For all the samples from the CUFS database, the PSNR, the SSIM index and the R of the synthesized face images were 13.42, 0.52, and 0.67, respectively (Table 3). Among the three sub-databases of the CUFS database, the quality of the synthesized images from the CUHK dataset was the highest in terms of the PSNR (15.07) and R (0.83). While the PSNR and R values for the AR dataset was lower than those of the CUHK dataset, SSIM did not differ between the two datasets. The lowest quality inverted sketches were produced from the sample sketches of the XM2GTS database (with 13.42 for PSNR, 0.42 for SSIM and 0.41 for R).
In many cases self-portrait studies allow us a glimpse of what famous artists looked like through the artists’ own perspective. Since there are no photographic records of many artists (in particular of those who lived before the 19th century during which the photography was invented and became widespread) self-portrait sketches and paintings are the only visual records that we have of many artists. Converting the sketches of the artists into photographs using a DNN that was trained on tens of thousands of face sketch-photograph pairs results in very interesting end-products.
Here we used our DNN-based approach to synthesize photographs of famous Dutch artists Rembrandt, Vincent van Gogh and M. C. Escher from their self-portrait sketches111For simplicity, although different methods were used to produce these artworks, we refer to them as sketches. (Figure 4). To the best of our knowledge, the synthesized photorealistic images of these artists are the first of their kind.
Our qualitative assesment revealed that, the inverted sketch of Rembrandt synthesized from his 1630 sketch indeed resembles himself in his paintings (particulary his self-portrait painting from 1630), and Escher’s to his photographs. We found that the inverted sketch of van Gogh synthesized from his 1886 sketch was the most realistic synthesized photograph among those of the three artists, albeit not closely matching his self-portrait paintings of a distinct post-impressionist style.
Although we do not have a quantitative way to measure the accuracy of the results in this case, results demonstrate that the artistic style of the input sketches influence the quality of the produced photorealistic images. Generating new training sketch data to match more closely to the sketch style of a specific artist of interest (e.g. by using the method proposed by ), and training the network with these sketches would overcome this limitation.
Sketching is one of the most important training methods that artist use to develop their skills. Converting sketches into photorealistic images would allow the artists in training to see and evaluate the accuracy of their sketches clearly and easily which can in turn become an efficient training tool. Furthermore, sketching is often much faster than producing a painting. When for example the sketch is based on imagination rather than a photograph, deep sketch inversion can provide a photorealistic guideline (or even an end-product, if digital art is being produced) and can speed up the production process of artists. Figure 3, which shows the inverted sketches by contemporary artists that produced the sketches in the CUFS database, further demonstrates this type of application. The current method can be developed into a smartphone/tablet or computer application for common use.
In cases where no other representation of a suspect exists, sketches drawn by forensic artists based on eye-witness accounts are frequently used by the law enforcement. However, direct use of sketches for automatically identifying suspects from databases containing photographs does not work well because these two face representations are too different to allow a direct comparison . Inverting a sketch to a photograph makes this task much easier by reducing the difference between these two alternative representations, enabling a direct automatized comparison .
To evaluate the potential use of our system for forensic applications, we performed an identification analysis (Figure 5). In this analysis, we evaluated the accuracy of identifying a target face image in a very large set of candidate face images (LFW dataset containing over 11,000 images) from an (inverse) face sketch. The identification accuracies for the synthesized faces were always significantly higher than those for the corresponding sketched faces (, binomial test). While the identification accuracies for the color and grayscale sketches were very low (2.38% and 1.42%, respectively), those for the synthesized color and grayscale inverse sketches were relatively high (82.29% and 73.81%, respectively). On the other hand, identification accuracy of line sketches was already high, at 81.14% before inversion. Synthesizing inverse sketches from line sketches raised the identification accuracy to an almost perfect level (99.79%).
In this study we developed sketch datasets, complementing well known unconstrained benchmarking datasets [19, 20], developed DNN models that can synthesize face images from sketches with state-of-the-art performance and proposed applications of our CSI model in fine arts, art history and forensics. We foresee further computer vision applications of the developed methods for non-face images and various other sketch-like representations, as well as cognitive neuroscience applications for the study of cognitive phenomena such as perceptual filling in [33, 34] and the neural representation of complex stimuli [35, 36].
Conference on Computer Vision and Pattern Recognition, Institute of Electrical & Electronics Engineers (IEEE), 2005.
International Joint Conference on Artificial Intelligence, 2007.
Workshop on Machine Learning Systems at Neural Information Processing Systems, 2015.
|Line||14.8956 0.0207||0.5931 0.0006||0.6023 0.0017|
|Grayscale||17.1654 0.0277||0.6301 0.0008||0.7175 0.0022|
|Color||18.9884 0.0296||0.7072 0.0008||0.7976 0.0019|
|CUHK (6)||14.6213 0.4061||0.5358 0.0216||0.8295 0.0200|
|AR (6)||14.1721 0.4127||0.5608 0.0232||0.7811 0.0217|
|XM2GTS (6)||11.7158 1.3050||0.4096 0.0258||0.3817 0.1341|
|All (18)||13.5030 0.5639||0.5021 0.0205||0.6641 0.0658|