Image line of sight correction method, device, electronic device, and computer program

The image gaze correction method uses an eye movement flow field and contour mask to enhance accuracy and efficiency in gaze correction, addressing errors in existing methods by employing a neural network-based end-to-end processing for precise visual line correction in video conferencing and streaming.

JP7542740B2Active Publication Date: 2024-08-30TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
JP2023522883
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Priority Date
2021-01-22
Filing Date
2022-01-17
Publication Date
2024-08-30
Estimated Expiration
2042-01-17

AI Technical Summary

Technical Problem

Existing image gaze correction methods suffer from accumulated errors in parameter calculations, leading to decreased accuracy due to sequential estimation of multiple parameters, which affects the overall precision of visual line correction.

Method used

An image gaze correction method and model that utilizes an eye movement flow field and eye contour mask to directly generate a corrected eye image, employing a neural network-based approach for end-to-end processing, reducing errors and improving accuracy through bilinear affine transformation and eye contour mask adjustments.

Benefits of technology

The method enhances the accuracy and efficiency of gaze correction, enabling real-time correction of eye images in video conferencing, video calling, and live streaming, with improved realism and user experience by ensuring only the eye region is corrected accurately.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007542740000005
    Figure 0007542740000005
  • Figure 0007542740000011
    Figure 0007542740000011
  • Figure 0007542740000009
    Figure 0007542740000009
Patent Text Reader

Abstract

An image gaze correction method, device, electronic device, computer-readable storage medium, and computer program product related to the field of artificial intelligence technology, the image gaze correction method including the steps of obtaining an eye image to be corrected from an image to be corrected, generating an eye movement flow field and an eye contour mask based on the eye image to be corrected, wherein the eye movement flow field is used to adjust pixel positions in the eye image to be corrected, and the eye contour mask is used to indicate the probability that pixel positions in the eye image to be corrected belong to an eye region, performing gaze correction processing on the eye image to be corrected based on the eye movement flow field and the eye contour mask to obtain a corrected eye image, and generating a gaze-corrected image based on the corrected eye image.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] (CROSS-REFERENCE TO RELATED APPLICATIONS)

[0002] This application claims priority to a Chinese patent application bearing application number 202110089871.5, filed with the China Patent Office on January 22, 2021, the entire contents of which are incorporated herein by reference.

[0003] The present application relates to the field of artificial intelligence technology, and in particular to an image gaze correction method, device, electronic device, computer-readable storage medium, and computer program product. [Background technology]

[0004] Gaze correction for objects such as people and animals in an image is a typical application of artificial intelligence in graphic image processing, and has a variety of application scenarios.

[0005] In general, to achieve gaze correction, the head posture angle is first estimated to obtain the head offset direction, and then the required gaze correction degree is estimated based on the angle between the head offset direction and the line of sight looking directly at the camera, and the eye position is corrected based on this degree, thereby achieving gaze correction.

[0006] However, the flow for achieving the above vision correction involves sequential calculation of multiple parameters, and therefore there are errors in the parameter calculation at each step. If the entire vision correction flow is carried out, the errors will accumulate and be amplified, resulting in a decrease in the accuracy of vision correction. Summary of the Invention

[0007] The embodiments of the present application provide an image line of sight correction method, an apparatus, an electronic device, a computer-readable storage medium, and a computer program product that improve the accuracy of line of sight correction.

[0008] An embodiment of the present application provides an image line of sight correction method executed by an electronic device, the method comprising: obtaining a to-be-corrected eye image from the to-be-corrected image; generating an eye motion flow field and an eye contour mask based on the to-be-corrected eye image, where the eye motion flow field is used to adjust pixel locations in the to-be-corrected eye image, and the eye contour mask is used to indicate a probability that a pixel location in the to-be-corrected eye image belongs to an eye region; performing a gaze correction process on the eye image to be corrected based on the eye movement flow field and the eye contour mask to obtain a corrected eye image; and generating a gaze-corrected image based on the corrected eye image.

[0009] An embodiment of the present application provides a method for training a gaze correction model executed by an electronic device, the method including: obtaining training samples of a training target gaze correction model, the training samples including to-be-corrected eye image samples and target corrected eye images; processing the to-be-corrected eye image samples with the training target gaze correction model to obtain eye motion flow field samples and eye contour mask samples corresponding to the to-be-corrected eye image samples, the eye motion flow field samples being used to adjust pixel positions in the to-be-corrected eye image samples, and the eye contour mask samples being used to indicate a probability that a pixel position in the to-be-corrected eye image samples belongs to an eye region; performing a gaze correction process on the correction-ready eye image sample based on the eye movement flow field sample and the eye contour mask sample to obtain a corrected eye image sample; The method includes a step of determining a loss of the training target gaze correction model based on the corrected eye image sample and the target corrected eye image, and adjusting parameters of the training target gaze correction model based on the loss to obtain a gaze correction model.

[0010] An embodiment of the present application provides an image line of sight correction device, the device comprising: an eye image acquisition module configured to acquire a to-be-corrected eye image from the to-be-corrected image; a flow field mask generation module configured to generate an eye movement flow field and an eye contour mask based on the to-be-corrected eye image, the eye movement flow field being used to adjust pixel locations in the to-be-corrected eye image, and the eye contour mask being used to indicate a probability that a pixel location in the to-be-corrected eye image belongs to an eye region; a gaze correction processing module configured to perform a gaze correction process on the correction-to-be-corrected eye image based on the eye movement flow field and the eye contour mask to obtain a corrected eye image; and an eye image integrating module configured to generate a gaze-corrected image based on the corrected eye image.

[0011] An embodiment of the present application provides a training device for a gaze correction model, the device comprising: a sample acquisition module configured to acquire training samples of a training target gaze correction model, the training samples including to-be-corrected eye image samples and target corrected eye images; a model processing module configured to process the eye image samples to be corrected by the training target gaze correction model to obtain eye motion flow field samples and eye contour mask samples corresponding to the eye image samples to be corrected, the eye motion flow field samples being used to adjust pixel positions in the eye image samples to be corrected, and the eye contour mask samples being used to indicate a probability that a pixel position in the eye image samples to be corrected belongs to an eye region; a gaze correction module configured to perform a gaze correction process on the to-be-corrected eye image sample based on the eye movement flow field sample and the eye contour mask sample to obtain a corrected eye image sample; and a parameter adjustment module configured to determine a loss of the training target gaze correction model based on the corrected eye image sample and the target corrected eye image, and adjust parameters of the training target gaze correction model based on the loss to obtain a gaze correction model.

[0012] An embodiment of the present application provides an electronic device comprising a processor and a memory, wherein at least one instruction, at least one program, code set or instruction set is stored in the memory, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to realize an image gaze correction method or a gaze correction model training method provided by an embodiment of the present application.

[0013] An embodiment of the present application provides a computer-readable storage medium, in which at least one instruction, at least one program, code set or instruction set is stored, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to realize an image gaze correction method or a gaze correction model training method provided by an embodiment of the present application.

[0014] An embodiment of the present application provides a computer program product or a computer program, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium, a processor of an electronic device reading the computer instructions from the computer-readable storage medium, and the processor executing the computer instructions to cause the electronic device to perform the image gaze correction method or the gaze correction model training method provided by the present application. [Brief description of the drawings]

[0015] [Figure 1]1 is a schematic diagram of an implementation environment of a technical solution according to an embodiment of the present application; [Diagram 2] FIG. 2 is a schematic diagram showing the angle between a camera, a person's eye, and the gaze point of the person's eye in a video conference scene. [Diagram 3] 1 is a flowchart 1 of a method for correcting the line of sight of an image according to an embodiment of the present application. [Figure 4] 2 is a flowchart 2 of the image line of sight correction method according to an embodiment of the present application. [Diagram 5] 11A and 11B are comparison diagrams showing before and after line of sight correction according to an embodiment of the present application. [Figure 6] FIG. 2 is a schematic diagram of a gaze correction model according to an embodiment of the present application. [Figure 7] 1 is a flowchart of a method for training a gaze correction model according to an embodiment of the present application. [Figure 8] FIG. 2 is an architecture diagram of an overall technical solution according to an embodiment of the present application; [Figure 9] FIG. 1 is a block diagram of an image line of sight correction device according to an embodiment of the present application. [Figure 10] FIG. 1 is a block diagram of a training device for a gaze correction model according to an embodiment of the present application. [Figure 11] FIG. 1 is a schematic diagram showing the configuration of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0016] In order to more clearly describe the technical solutions of the embodiments of the present application, the drawings used in the description of the embodiments are briefly introduced above. Obviously, the above drawings are only some embodiments of the present application, and those skilled in the art can also obtain other related drawings based on these drawings without any creative efforts.

[0017] In order to more clearly describe the objectives, technical solutions and advantages of the present application, the following describes the embodiments of the present application in more detail with reference to the drawings. Before describing the embodiments of the present application in detail, nouns and terms related to the embodiments of the present application will be explained. The nouns and terms related to the embodiments of the present application will be explained as follows.

[0018] 1) Artificial intelligence is the theory, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use the knowledge to obtain optimal results. In other words, artificial intelligence is a comprehensive technology in computer science that seeks to understand the nature of intelligence and create new intelligent machines that can respond in a manner similar to human intelligence. Artificial intelligence is the study of the design principles and realization methods of various intelligent machines so that machines have the functions of perception, reasoning, and decision-making.

[0019] It should be explained that artificial intelligence technology is a comprehensive field that includes a wide range of fields, including both hardware technology and software technology. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, medical image processing technology, operation / interaction systems, mechatronics, etc. Artificial intelligence software technology mainly includes computer vision technology, voice processing technology, natural language processing technology, and machine learning / deep learning, etc.

[0020] 2) Computer Vision (CV) is the science that studies how to make machines "see" - that is, machine vision that uses cameras and computers instead of human eyes to identify, track, measure, etc., and also performs graphics processing to make the computer's processing results into images that are more suitable for human eyes to observe or for transmission to a device to detect. As a scientific field, computer vision studies related theories and technologies and attempts to build artificial intelligence systems that can obtain information from images or multi-dimensional data. Computer vision technologies typically include image processing, image recognition, image semantic understanding, image retrieval, optical character recognition (OCR), video processing, video semantic understanding, video content / action recognition, three-dimensional object reconstruction, three-dimensional (3D) technology, virtual reality, augmented reality, simultaneous localization and mapping (SLAM), and common biological feature recognition technologies such as face recognition and fingerprint recognition.

[0021] 3) Machine learning (ML) is a multi-disciplinary field related to various fields such as probability theory, statistics, approximation theory, convex analysis, and algorithmic complexity theory. Machine learning specializes in the study of how computers can simulate or realize human learning behavior to acquire new knowledge and skills and reorganize existing knowledge structures to continuously improve performance. Machine learning is the core of artificial intelligence and is the fundamental means of giving computers intelligence, and is applied to various fields of artificial intelligence. Machine learning and deep learning usually include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and learning from demonstration.

[0022] The image gaze correction method and gaze correction model training method provided by the embodiments of the present application relate to technologies such as machine learning and computer vision of artificial intelligence, and are described below.

[0023] Referring to Fig. 1, Fig. 1 is a schematic diagram of an implementation environment of the technical solution according to an embodiment of the present application. The implementation environment of the solution may be a video conference system. The implementation environment of the solution is for implementing a gaze correction system 100, and may include a server 10 and a number of terminals 20.

[0024] The terminal 20 may be an electronic device such as a mobile phone, a tablet, a personal computer (PC), a smart TV, a multimedia player, etc. A client running a video conferencing application is installed on the terminal 20, which can provide a video conferencing function to a user.

[0025] The server 10 may be a single server, a server cluster consisting of multiple servers, or an electronic device such as a cloud computing service center. The server 10 may be a background server of a video conferencing application, and is used to provide a background server to a client of the video conferencing application.

[0026] Communication between the terminal 20 and the server 10 can be via a network 30, and the gaze correction system 100 further comprises a database 40 for providing data support to the server 20, for example by providing training samples to the server 20 during model training.

[0027] During a video conference, the terminal 20 is used to transmit an image to be corrected to the server 10 via the network 30, receive an image after gaze correction transmitted from the server 10 via the network 30, and display the image after gaze correction.

[0028] The server 10 receives the image to be corrected transmitted from the terminal 20 via the network 30, obtains the eye image to be corrected from the image to be corrected, generates an eye movement flow field and an eye contour mask based on the eye image to be corrected, where the eye movement flow field is used to adjust pixel positions in the eye image to be corrected and the eye contour mask is used to indicate the probability that the pixel positions in the eye image to be corrected belong to the eye region, performs gaze correction processing on the eye image to be corrected based on the eye movement flow field and the eye contour mask, generates a corrected eye image, and is used to generate a gaze-corrected image based on the corrected eye image. Also, it is used to transmit the gaze-corrected image to the terminal 20 via the network 30.

[0029] As shown in FIG. 2, in a video conference scene, the user's line of sight is usually directed at the other person in the display 21, but the camera 22 is not located in the display 21 but is located at another position (above the display 21 shown in FIG. 2), so there is usually an angle (angle α shown by the dotted line in FIG. 2) between the camera 22, the person's eyes, and the position seen by the line of sight of the person's eyes. From the other user's perspective, the user's line of sight is not directed at the other person, but appears to be slightly downward, which affects the user's communication experience. In addition to the video conference scene, there is also a similar problem in scenes such as video calls and live video distribution. Therefore, in order to solve the problem of poor image display effect and improve the image display effect and the efficiency of line of sight correction, it is necessary to perform line of sight correction.

[0030] Based on this, an embodiment of the present application provides an image gaze correction method and a gaze correction model training method, which generates an image after gaze correction from end to end based on an input image to be corrected, reduces time consumption, improves correction accuracy, and makes the gaze correction function reach a practically usable level, which can be applied to scenes such as video conferencing, video calling, live video streaming, and image processing, where the image processing scene can be mentioned as a social software sharing scene, provides an editing function of changing the gaze, and helps a user correct the gaze of an object in an image or video, for example, an object in an image that originally looks at a will look at b after correction, thereby allowing the image or video to convey information different from the original image or video.

[0031] Referring to Fig. 3, Fig. 3 is a flowchart of an image line of sight correction method provided by an embodiment of the present application. An execution subject of the image line of sight correction method (which is an electronic device provided by an embodiment of the present application) may be a terminal device such as a mobile phone, a tablet, or a PC, or may be a server. The image line of sight correction method may include steps 310 to 340.

[0032] In step 310, a to-be-corrected eye image is obtained from the to-be-corrected image. In the embodiment of the present application, the image to be corrected refers to an image including a face, for example, an image including a face, and the image to be corrected may be a single photo or image, or a single video frame image in a video, and the embodiment of the present application is not limited thereto. The eye image to be corrected is an image that is cut out from the image to be corrected and includes an eye region that needs gaze correction.

[0033] It should be noted that when an image to be corrected includes two eyes, for example, when a single face image includes a left and a right eye, two eye images to be corrected can be obtained from one image to be corrected, one eye image to be corrected corresponding to the eye image to be corrected of the left eye, and the other eye image to be corrected corresponding to the eye image to be corrected of the right eye.

[0034] In the embodiment of the present application, the electronic device performs face part detection on the image to be corrected. Here, an example is described in which the image to be corrected is a face image, and the face part detection is face detection. It determines whether or not the face image includes a face, and if a face is included, it determines the position of the face. In other words, if a face is included in the face image, it performs face key point detection. The embodiment of the present application is used for performing gaze correction and focuses on the eye area, so when performing face key point detection, the electronic device can only detect eye key points, and does not need to detect key points of other parts such as the mouth and nose.

[0035] In an embodiment of the present application, the electronic device determines a minimum circumscribing rectangle of the eye based on the eye contour keypoints, externally expands the minimum circumscribing rectangle of the eye by a specified factor to obtain an image cropping frame for the eye, and crops an eye image to be corrected from the image to be corrected based on the eye image cropping frame.

[0036] It should be noted that the minimum circumscribing rectangle of an eye refers to the minimum circumscribing rectangle frame that includes the eye. For example, the minimum circumscribing rectangle of a left eye refers to the minimum circumscribing rectangle frame that includes the left eye. The above specified multiple may be a predetermined value, such as 1.5 times, 2 times, or 3 times, and the embodiments of the present application are not limited thereto. In the process of externally expanding the minimum circumscribing rectangle of an eye to obtain an image cropping frame, the electronic device performs an equal proportion enlargement process on the minimum circumscribing rectangle with the center point of the minimum circumscribing rectangle as the center to obtain an image cropping frame, and the center point of the image cropping frame is the same as the center point of the minimum circumscribing rectangle. Finally, an image cropping technique is adopted to crop the image content within the image cropping frame of the eye from the image to be corrected, and obtain an eye image to be corrected.

[0037] As can be understood, by obtaining an eye image to be corrected from an image to be corrected and performing gaze correction processing on the eye image to be corrected, it is advantageous to reduce the amount of calculation in the subsequent gaze correction step and improve the efficiency of gaze correction.

[0038] In step 320, an eye motion flow field and an eye contour mask are generated based on the to-be-corrected eye image. It should be explained that the eye movement flow field is used to adjust the pixel position in the eye image to be corrected. Here, the pixel value of each pixel in the eye movement flow field includes a horizontal displacement amount and a vertical displacement amount, where the horizontal displacement amount of a pixel in the eye movement flow field represents the horizontal displacement amount of a pixel at the same position as the pixel in the eye image to be corrected, for example, the number of pixels displaced in the horizontal direction, and the vertical displacement amount of a pixel in the eye movement flow field represents the vertical displacement amount of a pixel at the same position as the pixel in the eye image to be corrected, for example, the number of pixels displaced in the vertical direction. Or, the eye movement flow field may include one two-dimensional image including a first-dimensional image and a second-dimensional image, where the first-dimensional image is used to store the horizontal displacement amount of each pixel, and the second-dimensional image is used to store the vertical displacement amount of each pixel. Also, the size (including height and width) of the first-dimensional image and the second-dimensional image is the same as the size of the eye image to be corrected.

[0039] The eye contour mask is used to indicate the probability that a pixel position in the eye image to be corrected belongs to an eye region. For example, the eye contour mask can be represented as a one-dimensional image, and the size (including height and width) of the one-dimensional image is the same as the size of the eye image to be corrected. The pixel value of a pixel in the eye contour mask can be a probability value, which represents the probability that a pixel at the same position in the eye image to be corrected belongs to an eye region. For example, the pixel value of a position with coordinates (i,j) in the eye contour mask can be a probability value in the range of [0,1], which represents the probability that a pixel at a position with coordinates (i,j) in the eye image to be corrected belongs to an eye region.

[0040] In an embodiment of the present application, the electronic device inputs the to-be-corrected eye image into a gaze correction model, and outputs an eye movement flow field and an eye contour mask through the gaze correction model. The gaze correction model can be a machine learning model obtained by pre-training a neural network.

[0041] As shown in FIG. 4, step 320 may include several sub-steps, such as:

[0042] In step 322, the to-be-corrected eye image is processed by the gaze correction model to obtain output data of the gaze correction model. It should be noted that the eye image to be corrected may include a three-channel image of red (R), green (G), and blue (B).

[0043] The gaze correction model may be a neural network model, for example, the gaze correction model may include an encoding network and a decoding network, where the encoding network is used to perform a downsampling process on input data (i.e., an eye image to be corrected) to extract and obtain feature information of the eye image to be corrected, and the decoding network is used to perform an upsampling process on the feature information of the eye image to be corrected to obtain output data.

[0044] For example, the downsampling unit of the gaze correction model (i.e., the above-mentioned encoding network) performs a downsampling process on the eye image to be corrected to generate a downsampled image, and the upsampling unit of the gaze correction model (i.e., the above-mentioned decoding network) performs an upsampling process on the downsampled image to obtain the output data of the gaze correction model. The core architecture of the gaze correction model proposed by the embodiment of the present application mainly includes two parts: a downsampling unit and an upsampling unit. The downsampling unit performs a focusing process on the image information, and performs a multi-stage convolution operation (also called a downsampling operation) on the input image to obtain the image texture information in the eye contour region, gradually reducing the size of the feature map and gradually increasing the number of channels. The upsampling unit generates a feature map of the same size as the input image resolution from the obtained image texture information, and performs convolution and interpolation operations (also called an upsampling operation) on the feature map to gradually increase the size of the feature map and gradually reduce the number of channels (the number of channels of the feature map is reduced to three in the final layer of the upsampling unit) to generate a subsequent corrected image.

[0045] It can be understood that in order to improve the stability of gaze correction by the gaze correction model, in the upsampling process, the feature map generated in the current upsampling step and the feature map of the same size generated in the downsampling process are cascaded and then used as the input image for the next upsampling step. In this way, the gradient explosion problem in the gaze correction process can be solved and the stability of the model can be improved. In addition, the gradient explosion problem in the gaze correction model training process can be solved and the stability of the gaze correction model training process can be improved.

[0046] In an embodiment of the present application, the step of generating an eye movement flow field and an eye contour mask based on the eye image to be corrected in step 320 includes a step in which the electronic device performs a downsampling process on the eye image to be corrected to generate a downsampled image, and a step in which the electronic device performs an upsampling process on the downsampled image to obtain an eye movement flow field and an eye contour mask, in which, during the upsampling process, a cascade connection process is performed on the feature map generated in the current upsampling step and a feature map of the same size generated in the downsampling process, and then the cascade connection process is used as the input image for the next upsampling step.

[0047] It should be noted that the downsampling and upsampling processes are performed by the gaze correction model, the eye movement flow field is the first and second channel data in the output data of the gaze correction model, and the eye contour mask is the third channel data in the output data.

[0048] In step 324, the first and second channel data are extracted from the output data to obtain an eye movement flow field.

[0049] In step 326, a third channel of data is extracted from the output data to obtain an eye contour mask.

[0050] It should be noted that the output data may include a three-channel image (or referred to as data), where a first channel and a second channel of data are extracted from the output data to obtain an eye movement flow field, and a third channel of data is extracted from the output data to obtain an eye contour mask. For example, the first channel of data is used to store the horizontal displacement of each pixel as a first dimensional image, and the second channel of data is used to store the vertical displacement of each pixel as a second dimensional image.

[0051] For example, the height of the eye image to be corrected is H, and the width is W, where H and W can represent the number of pixels in the height direction and the number of pixels in the width direction, respectively.Then, the eye image to be corrected is a three-channel image of H×W×3, which is used as input data of the gaze correction model.The output data of the gaze correction model includes a three-channel image of H×W×3, and two-channel data H×W×2 is extracted as the eye movement flow field, and the remaining one-channel data H×W×1 is used as the eye contour mask.

[0052] In step 330, a gaze correction process is performed on the to-be-corrected eye image based on the eye movement flow field and the eye contour mask to obtain a corrected eye image.

[0053] In the embodiment of the present application, after the gaze correction model outputs the eye movement flow field and the eye contour mask, the electronic device uses the eye movement flow field to perform bilinear affine transformation on the eye image to be corrected, and performs shifting and warping on each pixel to obtain an eye image after initial correction, where, in order to improve the stability of the eye image after initial correction and reduce the minor transformation of the area outside the eye contour, the gaze correction model is further used to obtain an eye contour mask, where, the electronic device performs a classification process on the eye contour mask (for example, performs a sigmoid operation) to normalize the probability relative of each pixel point in the eye contour mask to a probability value of 0 to 1, and then, based on the eye contour eye after the classification process, the eye image to be corrected and the eye image after initial correction are merged according to the attention mechanism to obtain a corrected eye image, which not only improves the stability of the corrected eye image, but also ensures that only the image in the eye contour area is corrected, and can improve the accuracy of gaze correction.

[0054] Continuing to refer to FIG. 4, as shown in FIG. 4, step 330 may include several steps, such as: In step 332, the eye motion flow field is employed to perform a transformation process on the to-be-corrected eye image to obtain a pre-corrected eye image.

[0055] In an embodiment of the present application, the electronic device targets any pixel of the eye image waiting to be corrected, obtains the horizontal and vertical displacement amounts of that pixel from the eye movement flow field, and then performs a displacement process on that pixel based on the horizontal and vertical displacement amounts to obtain an eye image after initial correction.

[0056] For example, for any pixel of the eye image waiting to be corrected, the horizontal and vertical displacement amounts of that pixel are obtained from the eye movement flow field, and then a displacement process is performed on that pixel based on the horizontal and vertical displacement amounts to obtain an eye image after initial correction.

[0057] For example, let the eye image to be corrected be x, the eye image after initial correction be y, and the eye movement flow field be f. For any position in the image whose coordinates are (i, j), y(i, j) is calculated by y(i, j)=x(i+f(i, j)[0], j+f(i, j)[1]). Since i+f(i, j)[0] and j+f(i, j)[1] are floating-point numbers, the electronic device employs bilinear interpolation.

[0058] In step 334, the eye contour mask is adopted to perform an adjustment process on the initially corrected eye image to obtain a re-corrected eye image, and the re-corrected eye image is determined as the corrected eye image.

[0059] In an embodiment of the present application, step 334 may include several steps, such as: In step 3341, the eye contour mask is fused (eg, multiplied) with pixel values ​​at corresponding positions in the eye image after initial correction to obtain a first intermediate image.

[0060] In step 3342, the mapping image corresponding to the eye contour mask is fused (eg, multiplied) with pixel values ​​at corresponding locations in the to-be-corrected eye image to obtain a second intermediate image. In step 3343, pixel values ​​at corresponding positions in the first and second intermediate images are integrated (eg, added) to obtain a corrected eye image.

[0061] In the embodiment of the present application, the pixel value at each position in the eye contour mask is a probability value in the range of [0,1], and the pixel value at any position in the mapping image corresponding to the eye contour mask is a value obtained by subtracting the pixel value (i.e., the probability value) at the same position in the eye contour mask from 1. For example, if the pixel value (i.e., the probability value) at a position with coordinates (i,j) in the eye contour mask is 0.2, the pixel value at a position with coordinates (i,j) in the mapping image corresponding to the eye contour mask is 1-0.2=0.8.

[0062] In an embodiment of the present application, the corrected eye image generated by the electronic device can be expressed by the following formula: corrected eye image = eye contour mask x eye image after initial correction + (1 - eye contour mask) x eye image waiting for correction.

[0063] In step 340, a gaze-corrected image is generated based on the corrected eye image. In an embodiment of the present application, the electronic device integrates the corrected eye image with the original image to be corrected, and adopts the corrected eye image to overwrite or replace the eye image to be corrected in the image to be corrected to obtain an image after gaze correction.

[0064] In an embodiment of the present application, the electronic device integrates the corrected eye image into the image to-be-corrected image at the image clipping frame position of the eye image to-be-corrected to obtain an integrated image, and performs image harmonization processing on the image clipping frame position in the integrated image to obtain an image after line of sight correction, where the image harmonization processing is used to remove boundary traces at the image clipping frame position. In the embodiment of the present application, the electronic device does not limit the method adopted for image matching processing, such as Gaussian blur, shrink-and-dim, and image matching methods based on deep learning. In an embodiment of the present application, the electronic device performs image harmony processing on the image cropping frame position in the integrated image in the following steps to obtain an image after line of sight correction.

[0065] First, the electronic device generates an initialization mask image of the same size as the image to be corrected, and the pixel value of the image cutout frame position of the initialization mask image is 1 (called the first designated value), and the pixel value of the remaining positions is 0 (called the second designated value). For example, the size of the original image to be corrected is C×H×W, where C is the number of channels (e.g., including three channels of R, G, and B), H is the height (e.g., the number of pixels included in the height direction), and W is the width (e.g., the number of pixels included in the width direction). When the image cutout frame is a rectangular frame whose size of the target position in the image to be corrected is h×w, and h is the height (e.g., the number of pixels included in the height direction) and w is the width (e.g., the number of pixels included in the width direction), the size of the eye image to be corrected and the eye image after correction are both c×h×w, and c is the number of channels (e.g., including three channels of R, G, and B).

[0066] It should be noted that the electronic device generates an initialization mask image of size C×H×W, and for each single channel image H×W in the C channels, sets the pixel value in the h×w image cropping frame at the target position to 1, and sets the pixel values ​​in other areas excluding the image cropping frame to 0, thereby generating an initialization mask image. Next, the electronic device performs noise processing (eg, erosion and Gaussian blurring) on ​​the initialization mask image to obtain a processed mask image.

[0067] It should be noted that the erosion process is used to remove boundary points between objects, for example, an ellipse template can be adopted to perform the erosion process on the initial mask image to obtain a eroded mask image. The Gaussian blur process, also called Gaussian smoothing process, is used to reduce image noise and reduce the level of detail. After obtaining the eroded mask image, the electronic device can perform the Gaussian blur process on the eroded mask image to obtain a processed mask image. The processed mask image is still an image with a size of C×H×W, and the value of each pixel is in the range of [0,1], and for pixels that are originally at the boundary position between 0 and 1, after the erosion operation and Gaussian blur process, the value is between 0 and 1, which allows for a smooth transition.

[0068] The electronics then blend (eg, multiply) the processed mask image with pixel values ​​at corresponding locations in the combined image to obtain a first resultant image. The electronics then blends (eg, multiplies) the mapping image corresponding to the processed mask image with pixel values ​​at corresponding locations in the face image to obtain a second resultant image. Finally, the electronic device adds together pixel values ​​at corresponding positions in the first derived image and the second derived image to obtain an image after line of sight correction.

[0069] It should be noted that the pixel value at each position in the processed mask image is a value in the range of [0,1], and the pixel value at any position in the mapping image corresponding to the processed mask image is a value obtained by subtracting the pixel value at the same position in the processed mask image from 1. For example, if the pixel value at a position with coordinates (i,j) in the processed mask image is 0.3, then the pixel value at a position with coordinates (i,j) in the mapping image corresponding to the processed mask image is 1-0.3=0.7.

[0070] In an embodiment of the present application, the step in which the electronic device generates an image after gaze correction can be expressed by the following formula: image after gaze correction = processed mask image x integrated image + (1 - processed mask image) x image waiting for correction.

[0071] It can be seen that the image harmonization process can remove boundary traces at the image cropping frame position in the integrated image, so that the final image after gaze correction has no noticeable stitching marks, thereby improving the gaze correction effect.

[0072] As shown in Fig. 5, Fig. 5 is a comparison diagram of before and after gaze correction by the image gaze correction method provided by the embodiment of the present application. As shown in Fig. 5, image 51 is an image waiting for correction, in which the gaze of the human eye is offset, and image 52 is an image after gaze correction, in which the gaze is concentrated directly ahead.

[0073] As shown in Figure 6, when an eye image 61 to be corrected is input into a gaze correction model 62, an eye movement flow field 63 and an eye contour mask 64 are output from the gaze correction model 62, and the eye movement flow field 63 is used to perform a conversion process on the eye image to be corrected 61 to generate an eye image after initial correction, and then the eye contour mask 64 is used to perform an image adjustment process on the eye image after initial correction to generate a final corrected eye image 65.

[0074] It can be understood that the image gaze correction method provided by the embodiment of the present application generates a corrected eye image end-to-end based on the eye image to be directly corrected, thereby shortening the time and improving the accuracy of gaze correction, thereby improving the consumption and effect of gaze correction, and can be applied to scenes such as video conferencing, video calling, and live video streaming. In addition, by adopting the image gaze correction method provided by the embodiment of the present application, the gaze in the image to be corrected can be corrected in real time, so that the corrected image includes the normal vision effect, improving the accuracy and realism, and effectively improving the communication experience of users in scenes such as video conferencing.

[0075] Furthermore, in the embodiment of the present application, an eye contour mask is used in the gaze correction process, and the eye image to be corrected is merged with the eye image after initial correction obtained by the eye movement flow field according to the attention mechanism, which not only improves the stability of the generated image, but also ensures that only the image content inside the eye contour is gaze corrected without performing gaze correction on the image content outside the eye contour, thereby improving the gaze correction effect of the final corrected eye image.

[0076] The training flow of the gaze correction model will be described below, but the content during use of the gaze correction model and the content during the training process are similar. Referring to FIG. 7, FIG. 7 is a flowchart of a method for training a gaze correction model according to an embodiment of the present application. The execution subject of the method for training a gaze correction model may be an electronic device such as a computer or a server. The method for training a gaze correction model may include steps 710 to 740.

[0077] In step 710, a training sample of a training target gaze correction model is obtained, where the training sample includes a to-be-corrected eye image sample and a target corrected eye image. It should be noted that the training target gaze correction model may be a neural network model, which is a model of a training target for gaze correction, or may be an original model or a pre-trained model, and the embodiments of the present application are not limited thereto.

[0078] In an embodiment of the present application, the input data of the trained gaze correction model includes eye image samples to be corrected, and the output data includes eye motion flow field samples and eye contour mask samples.

[0079] It should be noted that each training sample includes two images of different gazes taken by the same subject (e.g., a person) at the same head pose angle, one image can be an image with any gaze direction (e.g., a display area where the gaze is directed) used as a to-be-corrected eye image sample, and the other image is an image where the gaze is directed toward the camera, used as a target corrected eye image. By training a training target gaze correction model with such training samples, an end-to-end gaze correction model can be trained and obtained, and the gaze correction model outputs a corrected eye image with emmetropia effect (e.g., gaze is directed toward the camera) based on the input to-be-corrected eye image.

[0080] In addition, different training samples may be obtained based on different objects (e.g., different people) or different head pose angles, and the embodiments of the present application are not limited thereto. That is, the training sample set of the training object gaze correction model may include multiple training samples, and the multiple training samples may include training samples with different objects and training samples with different head pose angles, so that the trained gaze correction model can be adapted to different objects and different head pose angles, and the robustness of the gaze correction model can be improved.

[0081] In step 720, the to-be-corrected eye image samples are processed by the trained gaze correction model to obtain eye motion flow field samples and eye contour mask samples corresponding to the to-be-corrected eye image samples.

[0082] It should be noted that the eye motion flow field samples are used to adjust pixel locations in the eye image samples to be corrected, and the eye contour mask samples are used to indicate the probability that a pixel location in the eye image samples to be corrected belongs to an eye region. The eye motion flow field samples are similar to the description of the eye motion flow field, and the eye contour mask samples are similar to the description of the eye contour mask.

[0083] In step 730, a gaze correction process is performed on the to-be-corrected eye image sample based on the eye movement flow field sample and the eye contour mask sample to obtain a corrected eye image sample.

[0084] In the embodiment of the present application, the electronic device adopts the eye motion flow field sample to perform conversion processing on the eye image sample to be corrected, to generate an eye image sample after initial correction, and adopts the eye contour mask sample to perform adjustment processing on the eye image sample after initial correction, to generate an eye image sample after correction. The detailed description of this process is similar to the process of obtaining the eye image after correction.

[0085] In step 740, a loss of the gaze correction model is determined based on the corrected eye image samples and the target corrected eye image, and parameters of the trained gaze correction model are adjusted based on the loss to obtain the gaze correction model.

[0086] In the embodiment of the present application, the electronic device directly calculates the loss of the training target gaze correction model according to the pixel difference between the corrected eye image sample and the target corrected eye image, and obtains the gaze correction model by adjusting the parameters of the training target gaze correction model according to the loss, where the loss can be L1 loss, L2 loss, etc.

[0087] In the present embodiment, the loss of the training target gaze correction model includes a Learned Perceptual Image Patch Similarity (LPIPS) loss, which can accurately capture the visually perceived difference between two images.

[0088] It should be noted that the LPIPS loss can be calculated by a pre-trained and generated loss calculation model, where the electronic device inputs the corrected eye image sample and the target corrected eye image into the loss calculation model, and the loss calculation model outputs the LPIPS loss between the corrected eye image sample and the target corrected eye image, where the loss calculation model can be a pre-trained convolutional neural network model, such as a Visual Geometry Group (VGG) model.

[0089] In an embodiment of the present application, the electronic device employs software simulation technology to generate a plurality of simulated image pairs, each of which includes a set of corresponding ametropic eye simulation images and emmetropic eye simulation images, where the electronic device employs the above plurality of simulated image pairs to train a loss calculation model.

[0090] It should be noted that although the simulation image has differences from the appearance texture information of the actual eye, the relationship between the gaze direction and eyeball position of the simulation image is the same as the relationship between the gaze direction and eyeball position of the actual subject, and the gaze direction of the simulation image is determined at the time of data generation, thereby reducing a large amount of labeling costs and improving reference efficiency.

[0091] It can be understood that in the embodiments of the present application, the loss calculation model pre-trained by the simulation image can be directly used to calculate the LPIPS loss in model training corresponding to the real eye data, and the visual sensing information represented in the LPIPS loss obtained by the loss calculation model is the gaze direction, thus improving the training effect and efficiency of the model.

[0092] It can be further understood that the image gaze correction method and the method for training the gaze correction model provided by the embodiment of the present application train the gaze correction model and generate a corrected eye image end-to-end based on the input eye image to be corrected, thereby greatly reducing time consumption, improving correction accuracy, and making the gaze correction function to a practically usable level, which can be applied to scenes such as video conferencing, video calling, and live video distribution. In addition, by adopting the image gaze correction method provided by the embodiment of the present application, the gaze of the eyes in the image to be corrected can be corrected in real time, so that the image after gaze correction becomes a normal view image (for example, looks like looking directly at the camera), which combines accuracy and realism, and can effectively improve the communication experience of users in scenes such as video conferencing.

[0093] Referring to FIG. 8, FIG. 8 is an architecture diagram of the overall technical solution of the embodiment of the present application. As shown in FIG. 8, in the model training process, the training sample of the gaze correction model 81 (referred to as the gaze correction model to be trained) includes an image 821 (referred to as the eye image sample to be corrected) and an image 822 (referred to as the target corrected eye image). The image 821 is input to the gaze correction model 81 to output an eye movement flow field 831 and an eye contour mask 832 (referred to as the eye movement flow field sample and the eye contour mask sample) corresponding to the image 821, and then a corrected eye image 84 (referred to as the corrected eye image sample) is generated according to the image 821 and the corresponding eye movement flow field 831 and the eye contour mask 832. According to the corrected eye image 84 and the image 822, a LPIPS loss 86 of the gaze correction model 81 is determined by a pre-trained loss calculation model 85, and the parameters of the gaze correction model 81 are adjusted according to the LPIPS loss 86. Here, a loss computation model 85 is trained with simulated image pairs 87.

[0094] When the model is used online, a video frame image is extracted as an image to be corrected 88 from a video stream of a real-time video scene such as a video conference, face detection registration is performed on the image to be corrected 88, an image 821 (called an eye image to be corrected) is cut out from the image to be corrected 88, the image 821 is input to a trained gaze correction model 81, and the gaze correction model 81 outputs an eye movement flow field 831 and an eye contour mask 832 (called an eye movement flow field and an eye contour mask) corresponding to the image 821. Next, a corrected eye image 84 is generated based on the image 821 and the corresponding eye movement flow field 831 and eye contour mask 832. Finally, the corrected eye image 84 and the original image to be corrected 88 are integrated to generate an image 89 after gaze correction.

[0095] Referring to FIG. 9, FIG. 9 is a block diagram of an image gaze correction device according to an embodiment of the present application. The image gaze correction device includes a function for implementing the image gaze correction method provided by the embodiment of the present application, and the function may be implemented by hardware, or may be implemented by executing corresponding software on hardware. The device may be an electronic device such as a computer device, or may be provided in an electronic device such as a computer device. The image gaze correction device 900 may include an eye image acquisition module 910, a flow field mask generation module 920, a gaze correction processing module 930, and an eye image integration module 940. The eye image acquisition module 910 is configured to acquire a to-be-corrected eye image from the to-be-corrected image.

[0096] The flow field mask generation module 920 is configured to generate an eye movement flow field and an eye contour mask based on the eye image to be corrected, where the eye movement flow field is used to adjust pixel positions in the eye image to be corrected and the eye contour mask is used to indicate the probability that pixel positions in the eye image to be corrected belong to an eye region.

[0097] The gaze correction processing module 930 is configured to perform gaze correction processing on the to-be-corrected eye image based on the eye movement flow field and the eye contour mask, and obtain a corrected eye image. The eye image merging module 940 is configured to generate a gaze-corrected image based on the corrected eye image.

[0098] In an embodiment of the present application, the gaze correction processing module 930 is further configured to employ the eye movement flow field to perform a transformation process on the eye image to be corrected, to obtain an eye image after initial correction, employ the eye contour mask to perform an adjustment process on the eye image after initial correction, to obtain a re-corrected eye image, and determine the re-corrected eye image as the corrected eye image, where the gaze correction processing includes the transformation process and the adjustment process.

[0099] In an embodiment of the present application, the gaze correction processing module 930 is further configured to fuse the eye contour mask with pixel values ​​at corresponding positions in the eye image after the initial correction to obtain a first intermediate image, fuse a mapping image corresponding to the eye contour mask with pixel values ​​at corresponding positions in the eye image to be corrected to obtain a second intermediate image, and integrate pixel values ​​at corresponding positions in the first intermediate image and the second intermediate image to obtain the eye image after re-correction.

[0100] In an embodiment of the present application, the flow field mask generation module 920 is further configured to perform a downsampling process on the to-be-corrected eye image to generate a downsampled image, and perform an upsampling process on the downsampled image to obtain the eye movement flow field and the eye contour mask, where in the upsampling process, a cascade connection process is performed on the feature map generated in the current upsampling step and the feature map of the same size generated in the downsampling process, and then the cascade connection process is used as the input image for the next upsampling step.

[0101] In an embodiment of the present application, the downsampling process and the upsampling process are realized by a gaze correction model, the eye movement flow field is the first and second channel data in the output data of the gaze correction model, and the eye contour mask is the third channel data in the output data.

[0102] In an embodiment of the present application, the eye image acquisition module 910 is further configured to identify eye contour keypoints from the image to be corrected, determine a minimum bounding rectangle based on the contour keypoints, externally expand the minimum bounding rectangle by a specified factor to obtain an image cropping frame, and crop the eye image to be corrected from the image to be corrected based on the image cropping frame.

[0103] In an embodiment of the present application, the eye image integration module 940 is further configured to perform a step of integrating the corrected eye image at an image extraction frame position of the image to be corrected to obtain an integrated image, the image extraction frame position being the position of the eye image to be corrected in the image to be corrected, and a step of performing an image harmony process on the image extraction frame position in the integrated image to obtain the gaze-corrected image, the image harmony process being used to remove boundary traces at the image extraction frame position.

[0104] In an embodiment of the present application, the eye image integration module 940 is further configured to perform the steps of: generating an initialization mask image of the same size as the image to be corrected, wherein a pixel value at the image cut-out frame position of the initialization mask image is a first specified value, and pixel values ​​at the remaining positions are positions in the initialization mask image excluding the image cut-out frame position; performing noise processing on the initialization mask image to obtain a processed mask image; fusing the processed mask image with pixel values ​​at corresponding positions in the integrated image to obtain a first generated image; fusing a mapping image corresponding to the processed mask image with pixel values ​​at corresponding positions in the image to be corrected to obtain a second generated image; and integrating the first generated image with pixel values ​​at corresponding positions in the second generated image to obtain the image after gaze correction.

[0105] Referring to FIG. 10, FIG. 10 is a block diagram of a training device for a gaze correction model according to an embodiment of the present application. The training device for the gaze correction model includes a function for realizing the training method for the gaze correction model provided by the embodiment of the present application, and the function may be realized by hardware, or may be realized by executing corresponding software on hardware. The training device for the gaze correction model may be an electronic device such as a computer device, or may be provided in an electronic device such as a computer device. The training device for the gaze correction model 1000 may include a sample acquisition module 1010, a model processing module 1020, a gaze correction module 1030, and a parameter adjustment module 1040.

[0106] The sample acquisition module 1010 is configured to acquire training samples of a training target gaze correction model, where the training samples include to-be-corrected eye image samples and target corrected eye images.

[0107] The model processing module 1020 is configured to process the eye image samples to be corrected using the training target gaze correction model to obtain eye movement flow field samples and eye contour mask samples corresponding to the eye image samples to be corrected, where the eye movement flow field samples are used to adjust pixel positions in the eye image samples to be corrected and are used to indicate the probability that the pixel positions in the eye image samples to be corrected belong to an eye region.

[0108] The gaze correction module 1030 is configured to perform a gaze correction process on the to-be-corrected eye image sample based on the eye movement flow field sample and the eye contour mask sample to obtain a corrected eye image sample.

[0109] The parameter adjustment module 1040 is configured to determine a loss of the trained target gaze correction model based on the corrected eye image sample and the target corrected eye image, and adjust parameters of the trained target gaze correction model based on the loss to obtain a gaze correction model.

[0110] In an embodiment of the present application, the loss includes a perceptual image patch similarity (LPIPS) loss, and the parameter adjustment module 1040 is further configured to output an LPIPS loss between the corrected eye image sample and the target corrected eye image by a loss calculation model, and determine the LPIPS loss as the loss of the training target gaze correction model.

[0111] In an embodiment of the present application, the parameter adjustment module 1040 is further configured to generate a plurality of simulation image pairs, each of which includes a set of corresponding non-metaphoric eye simulation images and emmetropic eye simulation images, and employ the plurality of simulation image pairs to train the loss calculation model.

[0112] In an embodiment of the present application, the gaze correction model training apparatus 1000 further includes a loss model training module (not shown in FIG. 10), which adopts software simulation technology to generate a plurality of simulation image pairs, each simulation image pair including a set of corresponding ametropic eye simulation images and emmetropic eye simulation images, and is configured to employ a plurality of the simulation image pairs to train the loss calculation model.

[0113] It should be noted that in the image line of sight correction device and the training device for line of sight correction model provided by the embodiment of the present application, when realizing the corresponding function, only the division of each of the above-mentioned functional modules is described as an example, in actual application, the above-mentioned functions can be assigned to different functional modules to be completed as necessary, that is, the internal structure of the computer device can be divided into different functional modules to complete all or part of the above-mentioned functions.In addition, the image line of sight correction device and the training device for line of sight correction model provided by the embodiment of the present application belong to the same technical concept as the image line of sight correction and the training method for line of sight correction model provided by the embodiment of the present application.

[0114] Referring to Fig. 11, Fig. 11 is a schematic diagram showing the configuration of a computer device according to an embodiment of the present application. The computer device can be any electronic device with data calculation, processing and storage functions, such as a mobile phone, a tablet, a personal computer (PC) or a server. The computer device is used to realize the image gaze correction method or the gaze correction model training method provided by the embodiment of the present application.

[0115] It should be noted that the computer device 1100 includes a central processing unit (e.g., a central processing unit (CPU), a graphics processing unit (GPU), and a field programmable gate array (FPGA)) 1101, a random access memory (RAM) 1102, a system memory 1104 including a read-only memory (ROM) 1103, and a system bus 1105 connecting the system memory 1104 and the central processing unit 1101. The computer device 1100 further includes a basic input / output system (I / O system) 1106 that supports the transfer of information between each device in the server, and a mass storage device 1107 that stores an operating system 1113, an application 1114, and other program modules 1115.

[0116] The basic input / output system 1106 includes a display 1108 for displaying information and input devices 1109, such as a mouse or keyboard, for a user to input information. Here, the display 1108 and the input devices 1109 are both connected to the central processing unit 1101 through an input / output controller 1110, which is connected to the system bus 1105. The basic input / output system 1106 may further include an input / output controller 1110 for receiving and processing input from a number of other devices, such as a keyboard, mouse, or electronic stylus. In an embodiment of the present application, the input / output controller 1110 also provides output to a display, printer, or other type of output device.

[0117] The mass storage device 1107 is connected to the central processing unit 1101 through a mass storage controller (not shown) that is connected to the system bus 1105. The mass storage device 1107 and its associated computer-readable storage media provide non-volatile storage for the computing device 1100. That is, the mass storage device 1107 may include a computer-readable storage medium (not shown in FIG. 11) such as a hard disk or a Compact Disc Read-Only Memory (CD-ROM) drive.

[0118] In the embodiment of the present application, the computer-readable storage medium may include computer storage media and communication media. Computer storage media includes volatile and non-volatile, removable and non-removable media of any method or technological implementation for storing information such as computer-readable instructions, data structures, program modules, or other data. Computer-readable storage media includes RAM, ROM, erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other solid-state storage technology, CD-ROM, high density digital video disc (DVD) or other optical storage, tape cartridge, tape, disk storage, or other magnetic storage devices. Of course, those skilled in the art will appreciate that the computer-readable storage medium is not limited to the above. The above system memory 1104 and mass storage device 1107 may be collectively referred to as memory.

[0119] According to an embodiment of the present application, the computing device 1100 may also be implemented by connecting to a remote computer on a network, such as the Internet, via a network, i.e., the computing device 1100 may be connected to a network 1112 via a network interface unit 1111 connected to the system bus 1105, or may use the network interface unit 1111 to connect to another type of network or remote computer system (not shown in FIG. 11).

[0120] The memory further includes at least one instruction, at least one program, code set or instruction set, which, when stored in the memory and executed by one or more processors, realizes the image gaze correction method or gaze correction model training method provided by the embodiments of the present application.

[0121] An embodiment of the present application further provides a computer-readable storage medium, the computer-readable storage medium storing at least one instruction, at least one program, code set or instruction set, which, when executed by a processor of a computing device, realizes the image gaze correction method or the gaze correction model training method provided by the embodiment of the present application.

[0122] In the embodiment of the present application, the computer-readable storage medium may include a ROM, a RAM, a solid-state hard disk (SSD: Solid State Drives), an optical disk, etc. Here, the RAM may include a resistive random access memory (ReRAM: Resistance Random Access Memory) and a dynamic random access memory (DRAM: Dynamic Random Access Memory). In an embodiment of the present application, a computer program product or a computer program is further provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device (referred to as electronic equipment) reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the image gaze correction method or the gaze correction model training method provided by the embodiment of the present application. It should be explained that "multiple" in this specification refers to two or more than two. The term "and / or" describes only the associated relationship and indicates that three relationships may exist, for example, A and / or B can indicate three cases: A exists independently, both A and B exist, and B exists independently. In addition, the symbol " / " usually indicates that the relationship between associated objects is an "or" relationship. In addition, the numbering of the steps described in the embodiments of the present application is merely an illustrative example of one possible order of execution between steps, and the steps do not have to be executed in the order of the above step numbers. For example, two differently numbered steps may be executed simultaneously, or two differently numbered steps may be executed in the reverse order of the illustrated steps, and the embodiments of the present application are not limited thereto. The above are only illustrative examples of the present application, and are not intended to limit the present application, and any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims

1. A method for correcting a line of sight of an image, the method being performed by an electronic device, comprising: obtaining a to-be-corrected eye image from the to-be-corrected image; generating an eye motion flow field and an eye contour mask based on the to-be-corrected eye image, the eye motion flow field being used to adjust pixel locations in the to-be-corrected eye image, and the eye contour mask being used to indicate a probability that a pixel location in the to-be-corrected eye image belongs to an eye region; performing a gaze correction process on the eye image to be corrected based on the eye movement flow field and the eye contour mask to obtain a corrected eye image; generating a gaze-corrected image based on the corrected eye image.

2. The step of performing a gaze correction process on the correction-ready eye image based on the eye movement flow field and the eye contour mask to obtain a corrected eye image includes: performing a conversion process on the eye image to be corrected by adopting the eye movement flow field to obtain an eye image after initial correction; performing an adjustment process on the eye image after the initial correction by adopting the eye contour mask to obtain a re-corrected eye image; and determining the re-corrected eye image as the corrected eye image, wherein the gaze correction process includes the conversion process and the adjustment process. The method for correcting the line of sight of an image according to claim 1 .

3. The step of performing an adjustment process on the eye image after the initial correction by using the eye contour mask to obtain a corrected eye image again includes: Fusing the eye contour mask with pixel values ​​at corresponding positions in the eye image after the initial correction to obtain a first intermediate image; Fusing a mapping image corresponding to the eye contour mask with pixel values ​​at corresponding positions in the to-be-corrected eye image to obtain a second intermediate image; and integrating pixel values ​​at corresponding positions in the first intermediate image and the second intermediate image to obtain the re-corrected eye image. The method for correcting the line of sight of an image according to claim 2.

4. generating an eye motion flow field and an eye contour mask based on the to-be-corrected eye image, performing a downsampling process on the corrected eye image to generate a downsampled image; performing an upsampling process on the downsampled image to obtain the eye movement flow field and the eye contour mask, in which in the upsampling process, a feature map generated in a current upsampling step and a feature map of the same size generated in the downsampling process are cascaded together and then used as an input image for a next upsampling step; The method for correcting the line of sight of an image according to any one of claims 1 to 3.

5. the downsampling process and the upsampling process are realized by a gaze correction model, the eye movement flow field is data of a first channel and a second channel in output data of the gaze correction model, and the eye contour mask is data of a third channel in the output data. The method for correcting the line of sight of an image according to claim 4.

6. The step of acquiring a correction-ready eye image from the correction-ready image includes: identifying eye contour key points from the to-be-corrected image; determining a minimum bounding rectangle based on the contour keypoints; a step of externally expanding the minimum bounding rectangle by a specified factor to obtain an image extraction frame; and cutting out the correction-to-be-corrected eye image from the correction-to-be-corrected image based on the image cutting frame. The method for correcting the line of sight of an image according to any one of claims 1 to 3.

7. The step of generating an image after gaze correction based on the corrected eye image includes: A step of integrating the corrected eye image into an image extraction frame position of the image to be corrected to obtain an integrated image, the image extraction frame position being a position of the eye image to be corrected in the image to be corrected; performing an image harmony process on the image cropping frame position in the integrated image to obtain the line-of-sight corrected image, the image harmony process being used to remove boundary traces at the image cropping frame position; The method for correcting the line of sight of an image according to any one of claims 1 to 3.

8. The step of performing image harmony processing on the image extraction frame position in the integrated image to obtain the line-of-sight corrected image includes: a step of generating an initialization mask image of the same size as the image to be corrected, wherein a pixel value at the image extraction frame position of the initialization mask image is a first designated value, pixel values ​​at remaining positions are a second designated value different from the first designated value, and the remaining positions are positions in the initialization mask image excluding the image extraction frame position; performing noise processing on the initialization mask image to obtain a processed mask image; fusing the processed mask image with pixel values ​​at corresponding positions in the integrated image to obtain a first resultant image; fusing a mapping image corresponding to the processed mask image with pixel values ​​at corresponding positions in the image to be corrected to obtain a second generated image; and integrating pixel values ​​of the first derived image and the second derived image at corresponding positions to obtain the line-of-sight corrected image. The method for correcting the line of sight of an image according to claim 7.

9. 1. A method for training a gaze correction model, executed by an electronic device, comprising: obtaining training samples of a training target gaze correction model, the training samples including to-be-corrected eye image samples and target corrected eye images; processing the to-be-corrected eye image samples with the training target gaze correction model to obtain eye motion flow field samples and eye contour mask samples corresponding to the to-be-corrected eye image samples, the eye motion flow field samples being used to adjust pixel positions in the to-be-corrected eye image samples, and the eye contour mask samples being used to indicate a probability that a pixel position in the to-be-corrected eye image samples belongs to an eye region; performing a gaze correction process on the correction-ready eye image sample based on the eye movement flow field sample and the eye contour mask sample to obtain a corrected eye image sample; A method for training a gaze correction model, comprising the steps of determining a loss of the training target gaze correction model based on the corrected eye image sample and the target corrected eye image, and adjusting parameters of the training target gaze correction model based on the loss to obtain a gaze correction model.

10. The loss includes a perceptual image patch similarity (LPIPS) loss, Determining a loss of the training target gaze correction model based on the corrected eye image samples and the target corrected eye image, outputting LPIPS losses between the corrected eye image sample and the target corrected eye image according to a loss calculation model; determining the LPIPS loss as the loss of the training subject gaze correction model; The method for training a gaze correction model according to claim 9.

11. The method for training the gaze correction model includes: generating a plurality of simulation image pairs, each of the simulation image pairs including a set of corresponding ametropic and emmetropic eye simulation images; and employing a plurality of said simulated image pairs to train said loss calculation model. The method for training a gaze correction model according to claim 10.

12. An image line of sight correction device, an eye image acquisition module configured to acquire a to-be-corrected eye image from the to-be-corrected image; a flow field mask generation module configured to generate an eye movement flow field and an eye contour mask based on the to-be-corrected eye image, the eye movement flow field being used to adjust pixel locations in the to-be-corrected eye image, and the eye contour mask being used to indicate a probability that a pixel location in the to-be-corrected eye image belongs to an eye region; a gaze correction processing module configured to perform a gaze correction process on the correction-to-be-corrected eye image based on the eye movement flow field and the eye contour mask to obtain a corrected eye image; An image gaze correction device comprising: an eye image integration module configured to generate a gaze-corrected image based on the corrected eye image.

13. A training device for a gaze correction model, a sample acquisition module configured to acquire training samples of a training target gaze correction model, the training samples including to-be-corrected eye image samples and target corrected eye images; a model processing module configured to process the eye image samples to be corrected by the training target gaze correction model to obtain eye motion flow field samples and eye contour mask samples corresponding to the eye image samples to be corrected, the eye motion flow field samples being used to adjust pixel positions in the eye image samples to be corrected, and the eye contour mask samples being used to indicate a probability that a pixel position in the eye image samples to be corrected belongs to an eye region; a gaze correction module configured to perform a gaze correction process on the correction-to-be-corrected eye image sample based on the eye movement flow field sample and the eye contour mask sample to obtain a corrected eye image sample; A parameter adjustment module configured to determine a loss of the training target gaze correction model based on the corrected eye image sample and the target corrected eye image, and adjust parameters of the training target gaze correction model based on the loss to obtain a gaze correction model.

14. An electronic device comprising: a processor; and a memory storing at least one instruction, at least one program, code set, or instruction set that is loaded by the processor and causes the processor to execute the image gaze correction method described in any one of claims 1 to 8, or the gaze correction model training method described in any one of claims 9 to 11.

15. A computer program causing a processor to execute the image gaze correction method according to any one of claims 1 to 8 or the gaze correction model training method according to any one of claims 9 to 11.

Citation Information

Patent Citations

  • Sight line conversion device, sight line conversion method, and program

    JP2015149016A

  • Eye contact correction in real time using neural network based machine learning

    US20170308734A1