{'fraction_non_alphanumeric': 0.035913589126714454, 'fraction_numerical': 0.009251221508469952, 'mean_word_length': 4.424458495896677, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Unsupervised High-Resolution Portrait Gaze Correction and Animation

This paper proposes a gaze correction and animation method for high-resolution, unconstrained portrait images, which can be trained without the gaze angle and the head pose annotations. Common gaze-correction methods usually require annotating training data with precise gaze, and head pose information. Solving this problem using an unsupervised method remains an open problem, especially for high-resolution face images in the wild, which are not easy to annotate with gaze and head pose labels. To address this issue, we first create two new portrait datasets: CelebGaze and high-resolution CelebHQGaze. Second, we formulate the gaze correction task as an image inpainting problem, addressed using a Gaze Correction Module (GCM) and a Gaze Animation Module (GAM). Moreover, we propose an unsupervised training strategy, i.e., Synthesis-As-Training, to learn the correlation between the eye region features and the gaze angle. As a result, we can use the learned latent space for gaze animation with semantic interpolation in this space. Moreover, to alleviate both the memory and the computational costs in the training and the inference stage, we propose a Coarse-to-Fine Module (CFM) integrated with GCM and GAM. Extensive experiments validate the effectiveness of our method for both the gaze correction and the gaze animation tasks in both low and high-resolution face datasets in the wild and demonstrate the superiority of our method with respect to the state of the arts. Code is available at https://github.com/zhangqianhui/GazeAnimationV2


I. INTRODUCTION
The goal of the gaze correction task is to manipulate the gaze direction of a face image with respect to a specific target direction. The main application of this task is altering the eye appearance so that the person's gaze is directed into the camera. For example, shooting a good portrait is challenging as the subjects may be too nervous to stare at the camera. Another scenario is videoconferencing, where eye contact is very important. The gaze can express attributes such as attentiveness and confidence. Unfortunately, eye contact is frequently lost during a video conference, as the participants look Jichao   at the monitors and not directly into the camera. Moreover, some works use gaze redirection to improve few-shot gaze estimation task [1], [2].
Early works in gaze correction relied on special hardware, such as stereo cameras [3], [4], Kinect sensors [5] or transparent mirrors [6], [7]. Recently, a few methods based on machine learning showed a good quality synthetic for gaze correction. For instance, Kononenko and Lempitsky [8] propose to solve the problem of monocular gaze correction using decision forests. DeepWarp [9] uses a deep network to directly predict an image-warping flow field with a coarse-tofine learning process. However, this method fails in generating photo-realistic images when the gaze redirection involves large angles. Moreover, it produces unnatural eye shapes because of the L1 loss, which is used to learn the flow field without any geometric-based regularization. To solve this problem, PRGAN [10] proposes to exploit adversarial learning with a cycle-consistent loss to generate more plausible gaze redirection results. However, these methods [8]- [10] fail in obtaining high-quality gaze redirection results in the wild when there are large variations in the head pose and the gaze angles. Recently, Marcel et al. [11] proposed a content-consistent model for realistic eye generation. However, their approach is based on semantic segmentation masks, which implies a great annotation effort. Another category of works is based on 3D models without training data, such as GazeDirector [12]. The main idea of GazeDirector is to model the eye region in 3D instead of predicting a flow field directly from an input image. However, modeling in 3D has strong assumptions that do not hold in non-laboratory scenarios. The unsupervised method can avoid expensive annotations. Moreover, it has essential significance for image representation and semantic disentanglement. Thus, we recently proposed a novel gaze-correction method, GazeGAN [13], which is extended in this paper. In [13], we collected the CelebGaze dataset, which consists of two image domains: X, with eyes staring at the camera, and Y , with eyes looking somewhere else (see Fig. 1, left). Note that the CelebGaze images do not annotate the gaze angle or the head pose. Moreover, in [13] we propose an unsupervised learning method for gaze correction and animation, which consists of two main modules: the Gaze Correction Module (GCM) and the Gaze Animation Module (GAM). GCM is an inpainting model, trained on a domain X, which learns how to fill in the missing eye regions with a new content representing the gaze-corrected eyes. GAM is another inpainting model used for gaze animation, and it is trained on a domain Y . To generalize the gaze redirection to various angle directions (i.e., in "animations"), we propose a training method (Synthesis-As-Training) that uses synthetic data to train GAM and encourages the encoded features of the eye region to be correlated with the gaze angle. Then, gaze animation can be achieved by interpolating these features in the latent space.
In this paper, we extend GazeGAN [13] to work also with higher resolution portrait images. Specifically, we first create a new dataset, CelebHQGaze, containing 512 × 512 high-resolution portrait images, as shown in Fig. 1 (right). Second, we propose a novel GCM and GAM integrated with a coarse-to-fine module (CFM). In more detail, CFM first allows the inpainting model to be trained using low-resolution images for coarse-grained image generation. Then it uses a global nonparametric model, Laplacian Reconstruction, and a local parametric model, Local-Refinement Autoencoder, to compensate for the high-frequency information loss and to remove possible artifacts for the eye region. Utilizing this new architecture, we can avoid training each module using high-resolution images. CFM speeds up both the training and the inference process while obtaining high-quality results, comparable with directly training with high-resolution images.
Similar to GazeGAN [13], an autoencoder is pretrained using self-supervised mirror learning (PAM), where the bottleneck features are used as an extra input to the dual inpainting model to preserve the identity of the corrected results. Moreover, global and local discriminators are used to improve the visual quality of the generated samples. Finally, our qualitative and quantitative evaluations show that our method generates higher-quality results with respect to the state-of-the-arts in both the gaze correction and the gaze animation tasks.
We summarize below our main contributions: 1) We introduce an unsupervised inpainting architecture for high-resolution gaze correction and animation. 2) We propose a novel CFM module that can alleviate both the memory and the computational costs in the training and the inference stage while achieving high-quality results comparable with training with high-resolution facial images. 3) We propose a gaze animation module and a Synthesis-As-Training method to generate gaze-correction results with variable angles. 4) We make publicly available the CelebHQGaze dataset for the research community interested in gaze correction and animation: https://github.com/zhangqianhui/ GazeAnimationV2.
Image Inpainting. Image Inpainting is an important task in computer vision and computer graphics, and it aims to fill in the missed/masked pixels of an image utilizing plausible synthesized content. Most of the previous methods can be split into two classes. The first is based on diffusion or patch-based approaches, which rely on handcrafted low-level features. For example, PatchMatch [39] is a fast nearestneighbor field algorithm, which can perform real-time image inpainting. Generally speaking, this class of methods is based on low-level features. They are usually ineffective in filling in the missing part of an image when the underlying semantic structure is not trivial and cannot generate novel objects that which consists of one laplacian reconstruction and one local-refinement module. CFM first allows the inpainting network G x trained using low-resolution images to attain coarse-grained inpainted results, then attains high-resolution results by the global nonparametric Laplacian reconstruction, and finally exploits a parametric local-refinement module (LRM) to compensate for high-frequency information and remove artifacts for the eye region. We use 2× scales for downsampling and upsampling.
cannot be found in other non-masked parts of the source image. The second class of methods is based on learning approaches. Recently, CNN-based and GAN-based methods have shown promising performance on image inpainting [40]- [43]. For instance, inpainting can be used for facial attributes manipulation such as hair, mouth, and eyes [44]- [46]. We also adopt an inpainting approach, differently from previous work, our method does not require the data to be labeled with additional information, such as semantic labels, sketches, or reference images. Gaze Correction. Previous work for gaze correction can be split into three main classes: 1) hardware-driven, 2) rendering and synthesis, 3) learning-based.
The hardware support was indispensable in early research. Kollarits et al. [6] use half-silvered mirrors to place the camera on the optical path of the display. Yang et al. [4] address the eye contact problem with a view synthesis, and they use a pair of calibrated stereo cameras jointly with a face model to track the head pose in 3D. Generally speaking, these hardware-based methods are expensive.
The second class of approaches typically renders the eye region based on a 3D fitting model, which replaces the original eyes with synthetic eyeballs. Banf et al. [47] use an example-based approach for deforming the eyelids and sliding the iris across the model surface with a texture-coordinate interpolation. To fix the limitations caused by the use of a mesh, where the face and eyes are mixed, GazeDirector [12] separately deals with the face and eyeballs, synthesizing more high-quality images, especially for large redirection angles. These methods usually struggle in realistically rendering the corrected eyes. Additionally, modeling methods have strong assumptions that usually do not hold in practice.
Concerning the third class of methods, the core idea for most of the learning-based approaches is to use a large paired training dataset to train a statistical model [1], [8], [48]- [50]. Some methods [8], [48] learn to generate the flow field, which is then used to relocate the eye pixels in the original image. For instance, Ganin et al. [9] use a CNN to learn the flow field, which warps the input image and redirects the gaze to the target angle. However, [9] fails to generate photo-realistic and natural shapes because it uses only pixel-wise differences between the input and the ground truth as the training loss. To address this problem, He et al. [10] use adversarial learning, jointly with a cycle-consistent loss, which can improve the visual quality and the redirection precision. However, these methods can hardly generate plausible results in the wild, i.e., in a scenario with large variations in the head pose, the gaze angle, or the illumination conditions. In contrast, we propose to use dual inpainting modules (GCM and GAM) to correct the gaze angle and achieve high-resolution and high-quality gaze redirection in the wild.
III. METHOD The overview of our method is shown in Fig. 2 and our model consists of two main modules: Gaze Correction Module and Gaze Animation Module. Specifically, Fig. 3 illustrates Gaze Correction Module (GCM), integrating with Coarse-to-Fine Module (CFM), which is trained using the sample x from domain X. Fig. 4 illustrates Gaze Animation module (GAM), integrating with CFM, which are trained using the sample y from domain Y , and GAM exploits the corrected samples for training to make the eye feature correlate with the gaze angle (Synthesis-as-Training method). Additionally, Fig. 5 shows the pretrained autoencoder (PAM), which extracts the angle-invariant content feature as the additional input of GCM and GAM. We here clarify the adopted notations. In the left, G y uses the sample y ∈ Y for training. Compared to G x , the decoder of G y has an extra input r which is provided by the encoder E r . In the right, we use GCM to generate the gaze-corrected image y hx , which is then used for training G y (Synthesis-as-Training). With the paired samples y h and y hx for training G y , the feature from E r would be correlated with gaze angle, and gaze animation can be achieved by interpolating the feature.
• x ∈ R m×n×3 is an image instance, where m and n are the image height and width, and 3 is the number of RGB channels.
• The training set is split into two domains: X, containing images with a gaze staring at the camera, and Y , containing images with a gaze staring somewhere else. X h and Y h correspond to the higher-resolution sets of X and Y , respectively.
• M ∈ R m×n×3 denotes a binary mask function of the eye region and M defines the operation of extracting a rectangular sub-image (the eye region).
• P x and P y denote the data distributions in X and Y , respectively. P m indicates the distribution of the masked data M (x), where the eye region is removed from x. If x ∈ X and y ∈ Y , both M (x) and M (y) have the same distribution, because the only difference between x and y is in the eye region. Thus, M (x) ∼ P m and M (y) ∼ P m .
• r ∈ R 128 and c ∈ R 256 denote the angle, the content features (being the latter angle invariant), respectively and different encoders extract them.
• F denotes the image horizontal flipping operation (mirroring).
We first introduce the details of our coarse-to-fine module (CFM).

A. Coarse-to-Fine Module
In order to alleviate the memory costs and reduce the number of overall training parameters while simultaneously being able to generate high-resolution facial images, we propose a CFM for GCM and GAM. This module consists of a global nonparametric Laplacian Reconstruction for the inpainting process and a local parametric Local Refinement Module (LRM) which will be introduced with details, taking GCM as an example.
1) Global Nonparametric Laplacian Reconstruction: As shown in Fig. 3, the high-resolution image x h is downsampled by a factor of 2, obtaining x, where the latter is as input to the inpainting networks of GCM. The generated image isx. Let u(.) be an upsampling operator which smooths and expands x to the original size (i.e., the resolution of x h ). The single-level Laplacian pyramid p can be obtained by: Then, the reconstruction process for the high-resolution imagex h is: where we use M to remove the eye region from p which is replaced by the zero. Then we introduce the local refinement process to improve the visual quality and remove the artifacts of the eye regions.
2) Local Parametric LRM: We use M (x h ) to extract the local eye regionx h l . Then, we utilize one autoencoder G h together with residual image learning, to refinex h l and get x h l . Finally, the high-resolution complete imagex h can be obtained by replacing the local eye regionx h l withx h l .

B. Gaze Correction Module
As shown in Fig. 3, we first downsample x h to attain the low-resolution x, and then take x as the input of inpainting network G x whose goal is to fill in the masked eye region of x m = M (x) by generating the missing eyes. This can be formulated as: where c x are the content (angle-invariant) features encoded using only the eye regions as input (M (x)) of the content encoder E c . E c is the encoder of G pre which will be introduced in Sec. III-D.
In principle, G x can learn the mapping from M (x) ∼ P m to x ∼ P x by training. Given one sample y ∼ P y , then, we remove the eye region to get M (y) ∼ P m , because x and y have different distributions only in the eye region. Thus G x can be used to map M (y) into the G x (M (y)) ∼ P x which is the intuitive basis of our correction module. This can be formulated as: The overview of pretrained autoencoder module with generator G pre (PAM). PAM is trained by a self-supervised learning strategy. In detail, we crop y to both left eye y l l and right eye y r l , then, flip y l l by F to attain the pairs F (y l l ) and y r l which have similar identity, but different gaze angle. Then, the pairs would be used to train G pre by reconstructing y r l .
where c y are the content (angle-invariant) features encoded using only the eye regions as input M (y) of the content encoder E c . We train the GCM using high-resolution face images based on the CFM module. At the inference time, for the corrected result y x , we get a high-resolution result y hx by compensating for the high-frequency details using the laplacian reconstruction and LRM. Note that the corrected result y hx is also used for training GAM. More details can be found below.

C. Gaze Animation Module
Besides correcting the gaze to stare at the camera, a more general task is gaze animation, where the gaze direction should be modified. As shown in Fig. 4, another generator G y is used to in-paint the face image without the eye region by performing the reconstruction learning. Moreover, we extend a new eye encoder E r for the eye region to extract the angle-specific feature, guiding the gaze redirection generation of the G y . To achieve the disentanglement of the features, we propose a Synthesis-As-Training method, in which we use the gazecorrected generated images as training data for training GAM. In detail, our GAM is split into two stages. In the first stage (Left of Fig. 4), we downsample y h to get y, and train the generator G y to fill-in the missing eye regions of an image (y m = M (y)) and produceỹ. G y encodes the eye region with the latent code r y ∈ R 128 by means of the encoder E r . Moreover, r y is used as an extra input for the decoder in G y . In this way, we can condition G y using the gaze-dependent feature r y .
In the second stage (Right of Fig. 4), we use GCM to correct the gaze of y h , and it produces the synthetic sample y hx . Then, y hx is downsampled to y x which is used for training G y , just like y does. With the paired samples (y, y x ), which have the same masked region M (y) but different eye regions, we train GAM to ensure that the encoded feature from E r has a high correlation with the gaze angle: Then, we can attain high-resolution resultsŷ h andŷ hx by compensating for the high-frequency details using the laplacian reconstruction and LRM.

D. Pretraining using Self-Supervised Learning
Preserving the consistency of the person's identity (e.g., the iris color, the eye shape) is difficult with the inpainting-based method described. To mitigate this problem, we propose to use the third generator G pre , which is trained (PAM) to learn a latent representation of the content features (c), conditioning both G x and G y to preserve the identity information of the generated results consistent with the input.
G pre is pre-trained using a self-supervised learning framework. Although our training dataset is collected from the Internet, most images have a roughly frontal pose. As shown in Fig. 5, we can easily collect paired eye-region images: The right eye y r l is paired with the mirrored version F (y l l ) of the left eye y l l . Note that y r l and F (y l l ) have different gaze angles, but they have a similar eye shape and iris color. Because they belong to the same person. The same holds for y l l and F (y r l ). Note that the only information we need to collect these pairs is the eye region position (i.e., M (x)). At the same time, the mirroring operation (F (·)) is a data augmentation technique commonly used in other self-supervised learning approaches. We use these paired samples to pretrain G pre using the following objective function: After training, the bottleneck features c of G pre are almost angle-invariant, representing only the content information (e.g., iris color, eye shape). Thus, we use the encoder network E c of G pre to provide extra input to G x and G y by means of its content features (see Sec. III-B and III-C). Conditioning the generation process of G x and G y using these content features, the inpainted results are more consistent with respect to the input identity information.

E. Loss Functions
Reconstruction Losses. We use a standard pixel-wise loss (L1) for training GCM. It is defined as: where x h l andx h l are the eye regions of x h andx h , respectively.
And, the reconstruction loss for GAM is defined as: The reconstruction loss of GAM for the synthesis-astraining method is defined as: We use L y re + L y x re as the objective function to train G y . Global and Local Discriminators for Adversarial Learning. Since the L1 loss tends to produce blurry results [20], we use three different discriminators D x , D y and D h , adversarially trained together with G x , G y and G h , respectively. Moreover, inspired by [41], our discriminators D x and D y are composed of a global part, taking the whole face as input, and a local part with taking only the local eye region as input. The global part is used to coherent the entire image as a whole, while the local part makes the local region more realistic and sharper. We concatenate the final fully-connected feature maps of both parts, which are fed to a sigmoid function to predict the probability of the image being real.
Different from D x and D y , D h consists of only a local discriminator, which uses the eye regionsx h l andŷ h l as fake inputs. In practice, we use crops slightly larger than the eye region as the input of the discriminator to alleviate the boundary mismatch problem. The objective function of D x and G x is defined as: The objective function of D y and G y is defined as: Finally, the objective function of D h and G h is:

F. Overall Objective Function
Inspired by [51], we use a latent-space reconstruction loss (l f p ) for the content features in the latent space to preserve further the identity information between the input image and the gaze-corrected result: We use − x adv , − y adv to train D x and D y , respectively. Concerning G x , its overall loss is defined as: For G y and E r , the overall loss is defined as: λ 1 , λ 2 , λ 3 , λ 4 and λ 5 are hyper-parameters controlling the contribution of each loss term.

G. Gaze Correction and Animation at Inference Time
At inference time, given an image sample y h , we first downsample it to attain y, then obtain the gaze-corrected result y x using G x , and finally output high-resolution results y hx by using CFM, which can compensate for high-frequency texture details. In the case of gaze animation, as shown in Fig. 4, we modify the angle representation r by interpolating between r y and r y x , where both features correspond to the encoded angle features of the eye region y l and the eye region y x l , respectively. The interpolated angle representation can be fed to G y to obtain an intermediate result. We can produce highresolution gaze animation results using CFM.

IV. EXPERIMENTS
This section introduces the details of our datasets, our network training, and baseline models. Then, we compare the proposed method with the state-of-the-art methods of gaze correction in the wild using both qualitative and quantitative evaluations. Next, we demonstrate the effectiveness of the proposed method on gaze animation with various outputs by interpolating and extrapolating in the latent space. Finally, we present detailed ablation studies to validate the effect of each component of our model, i.e., the Synthesis-As-Training method, the Pretrained Autoencoder (PAM) with selfsupervised mirror learning, the Latent Reconstruction Loss, and the Coarse-to-Fine Module (CFM). For brevity, we refer to the method presented in [13] as GazeGAN and the extended version introduced in this paper as GazeGANV2. Note that we do not use any post-processing step for GazeGAN and GazeGANV2.

A. Datasets
Most of the existing benchmarks [53]- [56] do not contain enough image variability (e.g., a wide gaze-direction range, various head poses, and different illumination conditions) for our gaze correction task in the wild. Recently, [57] presented a large-scale gaze tracking dataset, called Gaze360, for robust 3D gaze estimation in unconstrained images. Although this dataset has been labeled with a 3D gaze direction with a wide range of angles and head poses, it still lacks highresolution images for face and eye regions. Moreover, this dataset does not provide annotations of the eye gaze staring at the camera, which is required in our domain set X. More recently, [58] proposed a large scale (over 1 million samples) of high-resolution images for gaze estimation. However, these images are collected in laboratory conditions and are not suitable for our gaze correction task in the wild. To remedy this problem, we propose collecting new datasets consisting of lots of high-resolution portraits without labelling head poses and gaze information. In detail, five volunteers are asked to divide the row data (face) into two domains according to whether the face eyes are staring at the camera. The gaze and head estimation model can automate 'Staring at the camera' annotation. However, the existing state-of-the-art methods [57], [  training data and test data. More details about our datasets can be found below.
CelebGaze. CelebGaze consists of 25,283 celebrity images, most of which have been collected from CelebA [60] and a minority from the Internet. Specifically, there are 21,832 face images with the eyes staring at the camera and 3,451 face images with the eyes looking somewhere else. We crop all the images to 256 × 256 and compute the eye mask region using Dlib [61]. Specifically, we use Dlib to extract 68 facial landmarks, and we compute the mean of 6 points near the eye region, which is the center point of the mask. The size of the mask is fixed to 30 × 50. We randomly select 300 samples from domain Y and 100 samples from domain X as their corresponding test sets, and we use the remaining images for the training set. Note that this dataset is unpaired and not labeled with the specific eye angle or the head pose information. We show some samples of the CelebGaze dataset in Fig. 1.
CelebHQGaze. CelebHQGaze consists of 29,255 highresolution celebrity images that are collected from CelebA-HQ [62]. It consists of 21,005 face images with the eyes staring at the camera and 8,250 face images with eyes looking somewhere else. Similarly to CelebGaze, we extract facial landmarks and generate the mask. All images are cropped to 512×512, and the mask size is fixed to 46×80. Similar to the CelebGaze dataset, also for the CelebHQGaze, we randomly select 300 samples from domain Y and 100 samples from domain X for the test set, and we use all the remaining images for the training set. We show two samples of the CelebHQGaze dataset in Fig. 1.

B. Training Details
We first train the PAM module. Then, the discriminators D x , D y and D h and the generators G x and G y and G h are jointly optimized. We use the Adam optimizer with β 1 = 0.5 and β 2 = 0.999. The batch size is 16 for CelebGaze and 8 for CelebHQGaze. The initial learning rate is 0.0005 for PAM, 0.0004 for G h , and 0.0001 for the three discriminators and the two generators in the first 20,000 iterations. The learning rate is linearly decayed to 0 over the remaining iterations. The loss coefficients λ 1 , λ 2 , λ 3 , λ 4 are all set to 1, while λ 5 is 0.1. To stabilize the network training in the adversarial learning, we use spectral normalization [63] for all the conv-layers of the three discriminators, but not for the generators. Our method is implemented in Tensorflow and trained with a single NVIDIA Titan X GPU.

C. Baseline Models
Gaze Correction. PRGAN [10] achieved state-of-the-art gaze redirection results on the Columbia gaze dataset [54] based on a single encoder-decoder network with adversarial learning, similarly to the StarGAN architecture [52]. The original PRGAN is trained on paired samples with labeled  angles. To train PRGAN on the proposed CelebGaze and CelebHQGaze datasets, we remove the VGG perceptual loss of PRGAN, and learn the gaze redirection task between domain X and Y . We train PRGAN only with the local eye region, the same way as the original paper.
Facial Attribute Manipulation. Gaze correction and animation can be regarded as a sub-task of facial attribute manipulation. Recently, StarGAN [52] achieved very high-quality results in facial attribute manipulation. We train StarGAN on the CelebGaze dataset to learn the translation mapping between domain X and domain Y .
Moreover, gaze correction can be considered as an image translation task. Thus, we adopt CycleGAN as another baseline for our experiments. Note that we do not compare GazeGAN with AttGAN [28], STGAN [30], RelGAN [64], CAFE-GAN [65], SSCGAN [32] as they have a performance very close to StarGAN in the facial attribute manipulation task. We use the public code of StarGAN 1 , CycleGAN 2 and PRGAN 3 .  I: Quantitative results on both the CelebGaze and the CelebHQGaze dataset. The higher is better for MSSSIM and the user study; the lower is better for LPIPS and FID. The columns Params and FPS report the corresponding network parameters and frame per second at test time, respectively. US: user studies.

D. Gaze Correction
This section qualitatively and quantitatively compares the proposed method with state-of-the-arts on both CelebGaze and CelebHQGaze datasets for the gaze correction task.
Qualitative Results. As shown in the last row of Fig. 6 and Fig. 7, GazeGANV2 can correct the eyes to look at the camera while preserving the identity information such as the eye shape and the iris color, validating the effectiveness of the proposed method. The 2nd row of the figure shows the results of StarGAN [52]. We note that StarGAN could not produce precise gazes staring at the camera, and it suffers from a low-quality generation with lots of artifacts (Zoom in for the best of view). The results of CycleGAN are shown in the 3th row. Although the results of CycleGAN are very realistic and with few artifacts in the eye region, this method does not produce a precise correction of the gaze direction (e.g., see the magnified eye regions of Fig. 6 and Fig. 7). We explain that both StarGAN and CycleGAN use the cycle-consistency loss, which requires that the mapping between X and Y be continuous and invertible. According to the invariance of the Domain Theorem 4 , the intrinsic dimensions of the two domains should be the same. However, the intrinsic dimension of Y is much larger than X, as Y has more variations for the gaze angle than X.
Moreover, we compare GazeGANV2 with PRGAN [10]. PRGAN is trained using only local eye regions (same as in the original paper), which may help focus on the translation of the eye region. The results of PRGAN are shown in the 4th row of Fig. 6. Compared with GazeGANV2, PRGAN does not produce precise and realistic correction results. Additionally, PRGAN suffers from the boundary mismatch problem between the local eye region and the global face (see the last column of Fig. 7).
Finally, as shown in the last rows of both Fig. 6 and Fig. 7, comparing GazeGANV2 with GazeGAN, we observe that both models can produce realistic and faithfully results. Additionally, we show more results of portraits with a diverse head pose. Fig. 8 shows that our model can achieve acceptable gaze-correction results for portraits with different head poses.
Quantitative Evaluation Protocol. The qualitative evaluation has validated the effectiveness and the superiority of our proposed GazeGANV2 in the gaze correction task. To further support the previous evaluation with quantitative results, we use the MSSSIM [66] and the LPIPS [67] metrics to measure the preservation ability of the irrelevant regions, i.e.,, the whole image except the eye region (M (y h )). Specifically, we compute the mean MSSSIM and LPIPS scores between M (y h ) and M (ŷ h ) across all the test data of Y h . Moreover, the Fréchet Inception Distance (FID) [68] has been shown to correlate well with the human judgment and has become a popular metric for GAN-based methods. We use it to evaluate the quality of the generated eye region for the gaze correction and the gaze animation tasks.
In addition to the aforementioned automatic metrics, we conduct a user study to compare the results of the gaze correction task of different models. In detail, given an input face image of the CelebGaze or CelebHQGaze test dataset (extracted from Y ), we show the gaze-corrected results produced by different models to 30 respondents, who were asked to select the best image based on the perceptual realism and the precision of the gaze correction. They also can select "Other", which means that the results of all the models are not satisfactory enough. This study is based on 50 questions (i.e., 50 randomly sampled images) for each respondent.
Quantitative Results. The first two columns of the left part (CelebGaze) and the right part (CelebHQGaze) of Table I show the MSSSIM and LPIPS scores evaluating the preservation ability of the corrected images using different methods.    Table I. Overall, the qualitative and quantitative evaluations demonstrate the effectiveness and superiority of the proposed approach.

E. Gaze Animation
The bottom of Fig. 9 and 10 show gaze animation results using input images with various gaze directions. The latentspace interpolation results are smooth and plausible in each row. Each column has a different gaze direction angle, but the identity information is overall preserved (e.g., the eye shape, the iris color, etc.).
The top rows of Fig. 9 and 10 show a gaze animation comparison between GazeGAN and GazeGANV2. Gaze-GANV2 can produce more realistic images with fewer artifacts   Table II. Finally, we show gaze animation results obtained by extrapolating the features r, in addition to using interpolation methods. With "extrapolation," we mean that we use values of r which lie in the line connecting r y with r y x , but they are outside these two points. As shown in Fig. 12, our method not only achieves high-quality interpolation results but is also able to produce plausible gaze animations when the gaze angles are outside the range between the input and the gaze-corrected output.

F. Ablation Study
In this section, we conduct extensive ablation studies to investigate the contribution of each of four critical components of our proposed GazeGANV2, i.e., the Pretrained Autoencoder for content feature extraction, the Synthesis-As-Training method, the Latent Reconstruction Loss L f p and the Coarseto-Fine Module. We refer to these components as A, B, C, and D, respectively.
Pretrained Autoencoder (PAM). Sec. III-D shows how self-supervised learning is used to pretrain a content encoder. This encoder produces identity-specific features which condition the generation process of G x and G y . Here we analyze this aspect of our method. Fig. 11 shows that our full-model (GazeGANV2) can better preserve identity information with respect to GazeGANV2 W/O A. To quantify this, we use G x to reconstruct test image samples x (x ∈ X), and we measure the difference between the input image and the gaze-corrected result in local eye regions employing both MSSSIM and LPIPS metrics. Table III shows that GazeGANV2 gets better scores than GazeGANV2 W/O A, confirming our design motivation.
A shown in Fig. 13, we visualize the outputs of autoencoder with taking y l l , y r l , F (y l l ) and y r l as inputs after training. We can observe that the model can attain the similar reconstruction results for y l l and F (y r l ) as inputs, and can also attain the Input Correction Extra Extra Intra The visualization for the results of PAM with taking y l l , y r l , F (y l l ) and F (y r l ) as inputs, respectively. The arrows point to the generated sample.

Input
Bilinear ESRGAN GazeGANV2 Fig. 14: Qualitative comparison between GazeGANV2 with Bilinear and super-resolution model ESRGAN [19]. Note that the input image would be downsampled 2× as input of the inpainting model. similar reconstruction results for y r l and F (y l l ) as inputs which validates the effectiveness of the objective loss.
Synthesis-As-Training Method. The gaze animation results in Fig. 9 and 10 show the effectiveness of our method in disentangling the angle representation. Fig. 16 (top) shows a t-SNE visualization of points interpolated in the latent space. In more detail, following the procedure explained in Sec. III-G, we uniformly interpolate the line connecting r y with r y x in the angle latent space using 5 interpolation points (I 1 , ...I 5 ) for each sample y. Fig. 16 (top) shows that for each specific sample y, these five interpolation points are different from Fig. 15: A qualitative comparison between the gaze-correction results produced by GazeGANV2 (3rd column) and Gaze-GANV2 W/O D (2nd column). The 1st column shows the input image, and the final column is a heatmap of the difference between the 3rd column and 2nd column. This residual image clearly shows semantic and texture information. each other but strongly clustered together, which illustrates the disentanglement of the angle latent space.
Latent Reconstruction Loss L f p . We use G y to fill in the eye region of test images y (y ∈ Y ), and we measure the difference between the input images and the generated results employing MSSSIM and LPIPS. In Table IV, GazeGANV2 obtains better scores than GazeGANV2 W/O C, which shows that L f p further improves the ability to preserve identity information. Moreover, we visualize the content features c y and cỹ extracted from real samples y and reconstructed samples y across all the Y test data. As shown in Fig. 16 (bottom), we observe that using our full model GazeGANV2, c y and cỹ usually lie closer to each other to what happens when using GazeGANV2 W/O C, and it shows that this loss helps to represent content information consistently.
Coarse-to-Fine Module (CFM). The previous experiments validate the effectiveness of CFM. As shown in the 2nd and the 4th row of Fig. 11, the gaze correction results of GazeGANV2 are more realistic than those produced by GazeGANV2 W/O D. In Table V, the quantitative comparison between GazeGAN  and GazeGAN W/O D confirms the effectiveness of CFM.
Then, Fig. 15 shows the differences in the gaze correction results obtained with GazeGAN and GazeGAN W/O D. The heatmap of the difference between the two generated images shows that CFM can compensate for the high-frequency information loss of the coarse output. Finally, we compare our CFM with some upsampling methods, such as Bilinear and super-resolution method, ESRGAN [19]. By taking all samples y h from domain Y h , we attain all low-resolution reconstructed resultsỹ. Then, three different methods are used for upsampling them to attain high-resolution results. Fig. 14 shows our method achieves better reconstruction with fewer artifacts, such as eye regions. Quantitative experiments of Table VI show our CFM achieves better MSSSIM and LPIPS scores and has higher FPS and fewer parameters than ESRGAN.

V. CONCLUSION
In this paper, we introduce a new high-resolution gaze dataset in the wild, CelebHQGaze, which is characterized by a large diversity in head poses and gaze angles. Moreover, we propose a novel unsupervised method, GazeGANV2, for gazedirection correction and animation. GazeGANV2 formulates the gaze correction problem as an inpainting task and uses a coarse-to-fine learning strategy to generate high-resolution images. Moreover, self-supervised learning and Synthesis-As-Training methods are used to disentangle the content and angle-specific features, which can condition the generation process. The qualitative and quantitative results demonstrate the method's effectiveness and its superiority to the state of the arts.