Image processing method, device and storage medium based on under-screen image
By setting up an under-screen camera in the terminal device and using AI pre-processing models and image processing models, the image quality is improved, the problem of screen openings limiting design flexibility is solved, and the accuracy of image recognition and the success rate of face unlocking are improved.
Patent Information
- Application Number
- CN202111645175.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-29
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2041-12-29
AI Technical Summary
When terminal devices implement functions such as face unlocking, they need to capture high-quality images, but the screen opening limits the flexibility of the shape design and affects the user's visual perception, and low-quality images affect recognition accuracy.
Using a processing method based on under-screen images, images are captured by a camera set under the screen, and pre-trained AI pre-processing models and image processing models are used to improve image quality and achieve efficient image recognition for terminal devices without openings.
It achieves high-quality image recognition without a hole in the screen, increases the flexibility of the terminal device's appearance design, and improves the recognition accuracy and success rate of functions such as face unlocking.
Smart Images

Figure CN116416656B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence (AI) technology, and in particular to an image processing method, device and storage medium based on under-screen images. Background Art
[0002] With the development of terminal technology, the functions of terminal devices are becoming more and more diversified. For example, terminal devices can have functions such as face unlocking, face payment, gesture unlocking, gesture payment, etc. When the terminal device implements the above functions, the terminal device usually needs to take images and implement the above functions through an AI model for processing images.
[0003] When the AI model implements the above functions, it is usually necessary to input images of good quality into the AI model. For example, images with good clarity and brightness are good. This is because when the AI model processes images, it is usually necessary to implement face recognition or gesture recognition based on the feature information of the image. The feature information in low-quality images is missing or unclear, which will affect the recognition accuracy of the AI model, and thus lead to low accuracy and poor effect when the terminal device implements the above functions.
[0004] Therefore, in a common implementation, a hole needs to be opened in the screen of the terminal device so that the camera sensor is not blocked by the screen when receiving the optical signal, thereby obtaining a relatively good quality image. However, the method of opening a hole in the screen of the terminal device limits the flexibility of the terminal device's appearance design, and may also affect the visual perception of some users who prefer a full screen. Summary of the invention
[0005] The embodiments of the present application provide an image processing method, device and storage medium based on under-screen images, which can obtain better image recognition effects based on images taken by a camera arranged under the screen. Therefore, it can be applicable to terminal devices without openings in the screen, so that the screen of the terminal device is not restricted in design due to the realization of the image recognition function.
[0006] In a first aspect, an embodiment of the present application provides an image processing method based on an under-screen image, the method comprising: acquiring an under-screen image. Inputting the under-screen image into a pre-trained artificial intelligence (AI) preprocessing model to obtain a processed image. Inputting the processed image into an image processing model to obtain a processing result. Wherein, when the image processing model is a model trained based on an image output by the AI preprocessing model, the AI preprocessing model is a model trained using a first training data set, the first training data set includes first test data and first sample data, the test image in the first test data corresponds to a sample image in the first sample data, and the image quality of the test image is worse than that of the sample image. The image processing model is trained using the output of the AI preprocessing model after inputting a second training data set into the AI preprocessing model, and the second training data set includes relevant data sets for realizing the functions required to be implemented by the image processing model.
[0007] In an embodiment of the present application, when the image processing model is a model obtained by training images based on the output of an AI preprocessing model, an AI preprocessing model for outputting better quality images using images of poor quality can be trained first. Thereafter, a data set for training an image processing model used in conjunction with the AI preprocessing model can be constructed using the output of the AI preprocessing model. After the image processing model is obtained by training the data set, the output of the AI preprocessing model can better meet the input requirements of the image processing model. Therefore, the under-screen image is input into the AI preprocessing model to obtain the processed image, and then the processed image is input into the image processing model pre-trained in the embodiment of the present application, which can obtain a better processing effect.
[0008] In a possible implementation, the image under the screen is an image captured by a camera disposed under the screen. In this way, the terminal device can achieve better image processing without punching holes in the screen, increasing the flexibility of the terminal device's appearance design.
[0009] In a possible implementation, the test image is an image captured by a camera set under the screen, or the test image is an image obtained by degrading sample data. In this way, when the test image is an image captured by a camera set under the screen, the test image has a high degree of similarity with the image actually captured by the terminal device, which is conducive to training a model with better recognition effect. In the implementation where the test image is an image obtained by degrading sample data, it is not necessary to use a specific device to obtain the test image, and a large number of test images can be easily obtained using sample data of better quality.
[0010] In one possible implementation, the camera includes a time-of-flight TOF camera.
[0011] In a possible implementation, the degradation processing includes one or more of the following: adding Newton rings, adding diffraction spots, reducing grayscale values, or increasing image blurring effects. In this way, the degradation processing can be used to obtain an under-screen image similar to that actually captured by using an under-screen camera, for example, to train a model with better recognition effect.
[0012] In one possible implementation, the image processing model includes one or more of the following: face recognition model, eye opening and closing model, eye gaze model or face anti-counterfeiting model. In this way, when the AI preprocessing model is combined with the image processing model to implement functions such as face unlocking, the image processing model can obtain better output accuracy. It is understandable that the image processing model, when applied to the face unlocking model, can also be called a face unlocking related model.
[0013] In one possible implementation, when the AI preprocessing model is a model obtained by training a joint image processing model, when training the AI preprocessing model, the parameters of the image processing model are not adjustable, the parameters of the AI preprocessing model are adjustable, and the AI preprocessing model completes training when the value calculated using the target loss function converges. Among them, the target loss function is related to the loss function of the AI preprocessing model and the loss function of the image processing model. In this way, when training an AI preprocessing model for outputting better quality using images of poor quality, the image processing model that will be used with the AI preprocessing model later can be combined, and the output of the image processing model can be used as a feedback factor for training the AI preprocessing model. The output of the trained AI preprocessing model can better meet the needs of the image processing model. Therefore, the under-screen image is input into the AI preprocessing model pre-trained in the embodiment of the present application, and after the processed image is obtained, the processed image is input into the image processing model, which can obtain a better processing effect.
[0014] In one possible implementation, there are multiple image processing models, and when calculating the target loss function, the weight difference between the loss function of the AI preprocessing model and the loss function of any image processing model is less than a preset value. This allows the weights of each image processing model to be similar when training the AI preprocessing model, and allows the AI preprocessing model to be used in conjunction with each image processing model.
[0015] In a possible implementation, when the image processing model includes a face recognition model, an eye opening and closing model, an eye gaze model, and a face anti-counterfeiting model, the target loss function satisfies the following formula:
[0016] L total =αL c +βL F +γL G +θL E +τL R
[0017] Among them, the loss function of the AI preprocessing model is L c , the loss function of the face recognition model is L F , the loss function of the human gaze recognition model is L G , the loss function of the open and closed eyes recognition model is L E , the loss function of the face anti-counterfeiting model is L R , α, β, γ, θ, τ are all preset constants. In this way, when the AI pre-processing model is combined with the image processing model to realize functions such as face unlocking, the image processing model can obtain better output accuracy. In addition, the embodiment of the present application can reuse conventional existing image processing models, and there is no need to adjust the parameters of the image processing model when it is subsequently trained or used in conjunction with the AI pre-processing model. In this way, the number of models that need to be trained can be reduced.
[0018] In a possible implementation, the number and type of image processing models are configurable. In this way, the terminal device can flexibly configure the number and type of image processing models based on environment recognition or user settings to meet diverse needs.
[0019] In a possible implementation, the method further includes: displaying a first interface, the first interface including multiple face unlock mode identifiers, each identifier corresponding to a control. When receiving a trigger of a target control corresponding to an identifier of a target face unlock mode among multiple face unlock modes, setting the image processing model to a model corresponding to the target face unlock mode. In this way, the user can flexibly select the desired face unlock mode to better meet the user's needs.
[0020] In one possible implementation, the multiple face unlocking modes include the following: standard mode, mask mode, strict mode or custom mode. The image processing model corresponding to the standard mode includes a face recognition model and a face anti-counterfeiting model. The image processing model corresponding to the mask mode includes an open and closed eyes recognition model, a human eye gaze recognition model and a face anti-counterfeiting model. The image processing model corresponding to the strict mode includes a face recognition model, an open and closed eyes recognition model, a human eye gaze recognition model and a face anti-counterfeiting model. The image processing model corresponding to the custom mode includes one or more of a face recognition model, an open and closed eyes recognition model, a human eye gaze recognition model or a face anti-counterfeiting model. In this way, users can choose a suitable mode for face unlocking according to their environment.
[0021] In a second aspect, an embodiment of the present application provides an image processing device, which may be a terminal device, or a chip or chip system in a terminal device. The image processing device may include a display unit and a processing unit. When the image processing device is a terminal device, the display unit may be a display screen. The display unit is used to perform the display step so that the terminal device implements the display-related method described in the first aspect or any possible implementation of the first aspect, and the processing unit is used to implement any method related to processing in the first aspect or any possible implementation of the first aspect. When the image processing device is a terminal device, the processing unit may be a processor. The image processing device may also include a storage unit, which may be a memory. The storage unit is used to store instructions, and the processing unit executes the instructions stored in the storage unit so that the terminal device implements a method described in the first aspect or any possible implementation of the first aspect. When the image processing device is a chip or chip system in a terminal device, the processing unit may be a processor. The processing unit executes the instructions stored in the storage unit so that the terminal device implements a method described in the first aspect or any possible implementation of the first aspect. The storage unit may be a storage unit within the chip (eg, a register, a cache, etc.), or a storage unit within the terminal device that is located outside the chip (eg, a read-only memory, a random access memory, etc.).
[0022] Exemplarily, the processing unit is used to obtain an under-screen image, input the under-screen image into a pre-trained artificial intelligence AI preprocessing model to obtain a processed image, and input the processed image into an image processing model to obtain a processing result. Wherein, when the image processing model is a model trained based on the image output by the AI preprocessing model, the AI preprocessing model is a model trained using a first training data set, the first training data set includes first test data and first sample data, the test image in the first test data corresponds to a sample image in the first sample data, and the image quality of the test image is worse than the image quality of the sample image. The image processing model is trained using the output of the AI preprocessing model after inputting the second training data set into the AI preprocessing model, and the second training data set includes relevant data sets for realizing the functions required to be realized by the image processing model.
[0023] In a possible implementation, the under-screen image is an image captured by a camera disposed under the screen, the test image is an image captured by a camera disposed under the screen, or the test image is an image obtained by performing degradation processing on sample data.
[0024] In one possible implementation, the camera includes a time-of-flight TOF camera, and the degradation processing includes one or more of the following: adding Newton rings, adding diffraction spots, reducing grayscale values, or increasing image blur effects.
[0025] In one possible implementation, the image processing model includes one or more of the following: face recognition model, eye opening and closing model, eye gaze model or face anti-counterfeiting model. In this way, when the AI preprocessing model is combined with the image processing model to implement functions such as face unlocking, the image processing model can obtain better output accuracy. It is understandable that the image processing model, when applied to the face unlocking model, can also be called a face unlocking related model.
[0026] In one possible implementation, when the AI preprocessing model is a model obtained by training a joint image processing model, when training the AI preprocessing model, the parameters of the image processing model are not adjustable, the parameters of the AI preprocessing model are adjustable, and the AI preprocessing model completes training when the value calculated using the target loss function converges. The target loss function is related to the loss function of the AI preprocessing model and the loss function of the image processing model.
[0027] In one possible implementation, there are multiple image processing models, and when calculating the target loss function, the weight difference between any two of the loss functions of the AI preprocessing model and any image processing model is less than a preset value.
[0028] In a possible implementation, when the image processing model includes a face recognition model, an eye opening and closing model, an eye gaze model, and a face anti-counterfeiting model, the target loss function satisfies the following formula:
[0029] L total =αL c +βL F +γL G +θL E +τL R
[0030] Among them, the loss function of the AI preprocessing model is L c , the loss function of the face recognition model is L F , the loss function of the human gaze recognition model is L G , the loss function of the open and closed eyes recognition model is L E , the loss function of the face anti-counterfeiting model is L R , α, β, γ, θ, and τ are all preset constants.
[0031] In one possible implementation, the number and types of image processing models are configurable.
[0032] In one possible implementation, the display unit is used to display a first interface, the first interface includes multiple face unlock mode identifiers, and each identifier corresponds to a control. When the display unit receives a trigger of a target control corresponding to an identifier of a target face unlock mode among the multiple face unlock modes, the processing unit is used to set the image processing model to a model corresponding to the target face unlock mode.
[0033] In one possible implementation, the multiple face unlocking modes include the following: standard mode, mask mode, strict mode or custom mode. The image processing model corresponding to the standard mode includes a face recognition model and a face anti-counterfeiting model. The image processing model corresponding to the mask mode includes an open and closed eyes recognition model, a human eye gaze recognition model and a face anti-counterfeiting model. The image processing model corresponding to the strict mode includes a face recognition model, an open and closed eyes recognition model, a human eye gaze recognition model and a face anti-counterfeiting model. The image processing model corresponding to the custom mode includes one or more of a face recognition model, an open and closed eyes recognition model, a human eye gaze recognition model or a face anti-counterfeiting model.
[0034] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory, wherein the memory is used to store code instructions, and the processor is used to run the code instructions to execute the method described in the first aspect or any possible implementation of the first aspect.
[0035] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program or instructions are stored. When the computer program or instructions are run on a computer, the computer executes the image processing method based on the under-screen image described in the first aspect or any possible implementation of the first aspect.
[0036] In a fifth aspect, an embodiment of the present application provides a computer program product comprising a computer program. When the computer program runs on a computer, the computer executes the image processing method based on the under-screen image described in the first aspect or any possible implementation of the first aspect.
[0037] In a sixth aspect, the present application provides a chip or a chip system, the chip or chip system comprising at least one processor and a communication interface, the communication interface and the at least one processor are interconnected by a line, and the at least one processor is used to run a computer program or instruction to execute the image processing method based on the under-screen image described in the first aspect or any possible implementation of the first aspect. The communication interface in the chip can be an input / output interface, a pin or a circuit, etc.
[0038] In a possible implementation, the chip or chip system described above in the present application further includes at least one memory, in which instructions are stored. The memory may be a storage unit inside the chip, such as a register, a cache, etc., or a storage unit of the chip (e.g., a read-only memory, a random access memory, etc.).
[0039] It should be understood that the second to sixth aspects of the present application correspond to the technical solutions of the first aspect of the present application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation methods are similar and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 A schematic diagram of a scenario applicable to an embodiment of the present application;
[0041] Figure 2 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0042] Figure 3 A schematic diagram of a software architecture of an electronic device provided in an embodiment of the present application;
[0043] Figure 4 A schematic diagram of a model training process provided in an embodiment of the present application;
[0044] Figure 5 A schematic diagram of a model training process provided in an embodiment of the present application;
[0045] Figure 6 A schematic diagram of a model training process provided in an embodiment of the present application;
[0046] Figure 7 A schematic flow chart of an image processing method based on an under-screen image provided in an embodiment of the present application;
[0047] Figure 8 A schematic diagram of a terminal device interface provided in an embodiment of the present application;
[0048] Fig. 9 A schematic diagram of the structure of a chip provided in an embodiment of the present application. DETAILED DESCRIPTION
[0049] In order to clearly describe the technical solutions of the embodiments of the present application, some terms and technologies involved in the embodiments of the present application are briefly introduced below:
[0050] 1) Under-screen image: It can be understood as an image captured by a camera covered under the screen. The camera may include a camera for capturing color images or a time of flight (TOF) camera. The terminal device can capture the original image raw image using the TOF camera, and analyze the raw image to obtain an infrared (IR) image and a three-dimensional image with depth.
[0051] 2) AI model: It can be understood as a model trained based on AI technology to achieve certain functions. For example, the relevant AI models in the embodiments of the present application may include one or more of the following: AI preprocessing model, face detection model, face recognition model, open and closed eye recognition model, human eye gaze recognition model, liveness detection model, three-dimensional anti-counterfeiting model, gesture recognition model, expression recognition model, etc.
[0052] Among them, the AI preprocessing model is used to process the off-screen image into an image with better quality. The face detection model is used to detect the position of the face in the image. The face recognition model is used to identify the identity (ID) corresponding to the face, and the identity may be, for example, the identity information, title, authority, etc. corresponding to the face. The open and closed eyes recognition model is used to identify whether the eyes in the image are open or closed. The eye gaze recognition model is used to identify whether the eyes are looking at the terminal device. The liveness detection model is used to detect whether there is a live body in front of the camera. The three-dimensional anti-counterfeiting model is used to identify whether there is a three-dimensional attack. The gesture recognition model is used to identify gesture categories, such as thumbs-up gestures, OK gestures, or fist gestures. The expression recognition model is used to identify expression categories, such as happiness, surprise, sadness, anger, disgust, or fear.
[0053] It can be understood that the above models can be independent or combined with each other. For example, a face detection model can be combined with a face recognition model to implement face detection and recognition, etc.
[0054] The above-mentioned models may also have other naming methods, such as being named the first model, the second model, the Nth model, the target model or the neural network model, etc. The embodiments of the present application only use the above-mentioned names as examples of model names, and the specific meaning of the model can refer to the specific role that the model can play.
[0055] 3) Face unlock related models: one or more models that can be used for face unlock. For example, face unlock related models may include one or more of the following: face recognition model, open and closed eye recognition model, eye gaze recognition model, face anti-counterfeiting model. The following will introduce in detail the possible training and use methods of several face unlock related models.
[0056] Face recognition model: During training, a face dataset including faces of different identities can be constructed. Based on the face dataset and a loss function with a high degree of discrimination for face feature vectors, the neural network model is trained to obtain a face recognition model.
[0057] Among them, the loss function with higher discrimination of facial feature vectors may include a cross entropy loss function or a variant of the cross entropy loss function. For example, the cross entropy loss function L c The following formula can be satisfied:
[0058]
[0059] N is the number of images in the face dataset (or the current batch); y ic is a sign function, which can take values of 0 or 1. For example, if the true category of sample i is equal to c, it takes 1, otherwise it takes 0; p ic is the predicted probability that image i belongs to category c, which is the predicted value of the model in the training phase.
[0060] After the training is completed, when using the face recognition model, different processes can be executed based on different scenarios. For example, when the face recognition model is used for identity recognition, the face recognition model is set in the electronic device, and the electronic device can first record a certain person's face template image, and the face template image includes, for example, face images corresponding to five angles of "up, down, left, right, and facing". Then the electronic device uses the trained face recognition model to extract the face feature vector, and finally saves the five feature vectors in the template library after taking the average. After that, for the face image of the unknown identity to be tested, the face recognition model is used to extract the face feature vector of the face image of the unknown identity and calculate the similarity with the face feature vector in the template library, and the identity corresponding to the feature vector in the template library whose similarity with the face feature vector of the face image of the unknown identity is greater than a preset threshold is assigned to the generation of test images to obtain the identity recognition result. For example, the preset threshold can be any value between 0.5 and 1.
[0061] Eyes open and closed recognition model: During training, a face dataset labeled with open or closed eyes can be constructed and input into the model to be trained. The model to be trained can first identify facial key points based on the face key point detection network, and then cut out the eye sub-image according to the coordinates of these key points, and further output the predicted confidence of eyes open or closed based on the eye sub-image. When the predicted value of the model to be trained converges with the corresponding labeled benchmark value based on the value calculated by the loss function, a trained eyes open and closed recognition model can be obtained.
[0062] The model structure of the model to be trained may be a classification model based on a convolutional neural network, and the pictures corresponding to the left eye and the right eye may have independent benchmark results during training. The loss function may use a binary cross entropy loss function or the like.
[0063] After the training is completed, when the eyes-opening and eyes-closing recognition model is used, the eyes-opening and eyes-closing recognition model is set in the electronic device, and the electronic device inputs the face image into the eyes-opening and eyes-closing recognition model to obtain an output of eyes-opening or eyes-closing.
[0064] Human eye gaze recognition model: During training, a face dataset labeled with gaze or non-gaze can be constructed and input into the model to be trained. The model to be trained can first identify the face key points based on the face key point detection network, and then cut out small blocks of left eye pictures and right eye pictures according to the coordinates of these key points, and further output the predicted gaze or non-gaze confidence based on the small blocks of left eye pictures and right eye pictures. When the predicted value of the model to be trained converges with the corresponding labeled benchmark value based on the numerical value calculated by the loss function, a trained human eye gaze recognition model can be obtained.
[0065] The model to be trained may be a convolutional neural network model, which may adopt a convolutional neural network structure, including a convolutional layer and a fully connected layer. The loss function may use a binary cross entropy loss function or the like.
[0066] After the training is completed, when the human eye gaze recognition model is used, the human eye gaze recognition model is set in the electronic device, and the electronic device inputs the face image into the human eye gaze recognition model to obtain a gaze or non-gaze output.
[0067] Face anti-counterfeiting model: It can include a two-dimensional anti-counterfeiting model (or called a liveness detection model) or a three-dimensional anti-counterfeiting model, which is used to determine whether it is a real face or a fake face. The model structure of the face anti-counterfeiting model can include a classification model based on a convolutional neural network, and the IR map and / or the depth map are used as the input of the face anti-counterfeiting model. The face anti-counterfeiting model can determine whether it is a real face or a fake face. The network loss function of the face anti-counterfeiting model can also use a binary cross entropy loss function.
[0068] 4) Other terms
[0069] In the embodiments of the present application, words such as "first" and "second" are used to distinguish the same or similar items with substantially the same functions and effects. For example, the first chip and the second chip are only used to distinguish different chips, and their order is not limited. Those skilled in the art can understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit them to be different.
[0070] It should be noted that in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0071] In the embodiments of the present application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, a--c, bc, or abc, where a, b, c can be single or multiple.
[0072] Face recognition or gesture recognition can be applied in the fields of terminal unlocking, security or electronic payment, so that when users use terminal devices, they can easily unlock, pass permissions or make payments based on face or gestures, and it can also improve the privacy and security of users when using terminal devices.
[0073] Whether it is face recognition or gesture recognition, the terminal device needs to use a camera to capture images and perform corresponding recognition based on the images. The images can be two-dimensional color images, IR images, three-dimensional images, etc.
[0074] Take face recognition applied to face unlocking of terminal devices as an example. Figure 1 FIG. 1 shows a schematic diagram of a face unlocking scenario. Figure 1 As shown in a, when the user faces the terminal device, the terminal device can obtain an image based on the TOF camera, and further the terminal device determines whether the unlocking condition is met based on the face unlocking related model. For example, if the face in the image matches the pre-set face, the terminal device can determine that the unlocking condition is met, unlock, and enter the Figure 1 The main interface shown in b.
[0075] If the camera of the terminal device is blocked by the display screen, the image captured by the camera will be seriously degraded. The factors of quality degradation include one or more of the following: image blur, Newton rings, diffraction spots, low brightness, low grayscale value, etc. Low-quality images will lose some feature information. Inputting low-quality images into face unlocking related models will affect the accuracy of subsequent face unlocking related models, thereby reducing the success rate of face unlocking.
[0076] Therefore, in one possible implementation, a small hole is left at the camera on the display screen of the terminal device to avoid the display screen blocking the camera, so as to obtain a better quality image through the camera. However, the method of opening a small hole in the display screen will limit the flexibility of the mobile phone appearance design and destroy the integrity of the display screen.
[0077] To maintain the integrity of the display screen, in another possible implementation, the display screen in the terminal device can cover the camera. After the terminal device uses the camera covered under the display screen to obtain a low-quality image, the low-quality image is enhanced, and then the quality-enhanced image is input into the face unlocking related model.
[0078] However, in this implementation, there is a situation where the image after quality improvement cannot be compatible with the face unlocking related model, or it is understood that the recognition effect of the processed image with improved quality in the face unlocking related model is still far from the situation without screen obstruction, resulting in the face unlocking rate is still low.
[0079] In view of this, an embodiment of the present application provides an image processing method based on under-screen images. When training an AI preprocessing model for improving image quality, this method can be trained in conjunction with an image processing model, so that the image processed by the AI preprocessing model can obtain better processing effects in the image processing model.
[0080] The image processing model may be any image processing related model, for example, the image processing model may include a gesture recognition model, an expression recognition model, a face unlocking related model or a face payment related model, etc., which is not specifically limited in the embodiments of the present application. It is understandable that, for ease of description, the embodiments of the present application will be described using the image processing model as a face unlocking related model as an example, and this example does not specifically limit the image processing model.
[0081] When the image processing model is a face unlock related model, the AI pre-processing model can be trained in conjunction with the face unlock related model, so that the image processed by the AI pre-processing model can obtain a better recognition accuracy in the face unlock related model. After obtaining the under-screen image, the terminal device can input the under-screen image into the AI pre-processing model, and the quality of the under-screen image can be improved by the AI pre-processing model. Then, the image with improved quality can be input into the face unlock related model to achieve face unlock accuracy.
[0082] It can be understood that because the AI preprocessing model in the embodiment of the present application is combined with the face unlocking related model during training, the image quality output by the AI preprocessing model can meet the requirements of the face unlocking related model and it is easy to obtain a better recognition effect. Therefore, when the method of the embodiment of the present application is used in the face unlocking scenario, the unlocking success rate can be improved.
[0083] It should be noted that the embodiments of the present application may include a training phase of the AI preprocessing model and a use phase of the AI preprocessing model. The training phase can be implemented by an electronic device with strong computing power. The specific training process will be described in detail in subsequent embodiments and will not be repeated here. In the use phase, the AI preprocessing model can be deployed in a terminal device that needs to use the AI preprocessing model to process the off-screen image through the AI preprocessing model to achieve better image recognition effect.
[0084] The terminal device of the embodiment of the present application may also be any form of electronic device. For example, the electronic device may include a handheld device with image processing function, a vehicle-mounted device, etc. For example, some electronic devices are: mobile phones, tablet computers, PDAs, laptop computers, mobile internet devices (MIDs), wearable devices, virtual reality (VR) devices, augmented reality (AR) devices, wireless terminals in industrial control, wireless terminals in self driving, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, cellular phones, cordless phones, session initiation protocol (SIP) phones, wireless local loop (WLL) stations, personal digital assistants (PDAs), handheld devices with wireless communication capabilities, computing devices or other processing devices connected to wireless modems, vehicle-mounted devices, wearable devices, terminal devices in 5G networks or future evolved public land mobile communication networks (public land mobile The embodiments of the present application do not limit this.
[0085] As an example but not limitation, in the embodiments of the present application, the electronic device may also be a wearable device. Wearable devices may also be referred to as wearable smart devices, which are a general term for wearable devices that are intelligently designed and developed using wearable technology for daily wear, such as glasses, gloves, watches, clothing, and shoes. A wearable device is a portable device that is worn directly on the body or integrated into the user's clothes or accessories. Wearable devices are not only hardware devices, but also powerful functions achieved through software support, data interaction, and cloud interaction. Broadly speaking, wearable smart devices include full-featured, large-sized, and fully or partially independent of smartphones, such as smart watches or smart glasses, as well as devices that only focus on a certain type of application function and need to be used in conjunction with other devices such as smartphones, such as various types of smart bracelets and smart jewelry for vital sign monitoring.
[0086] In addition, in the embodiments of the present application, the electronic device can also be a terminal device in the Internet of Things (IoT) system. IoT is an important part of the future development of information technology. Its main technical feature is to connect objects to the network through communication technology, thereby realizing an intelligent network that interconnects people and machines and things.
[0087] The electronic devices in the embodiments of the present application may also be referred to as: terminal equipment, user equipment (UE), mobile station (MS), mobile terminal (MT), access terminal, user unit, user station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication equipment, user agent or user device, etc.
[0088] In an embodiment of the present application, the electronic device or each network device includes a hardware layer, an operating system layer running on the hardware layer, and an application layer running on the operating system layer. The hardware layer includes hardware such as a central processing unit (CPU), a memory management unit (MMU), and a memory (also called main memory). The operating system can be any one or more computer operating systems that implement business processing through processes, such as Linux operating system, Unix operating system, Android operating system, iOS operating system, or Windows operating system. The application layer includes applications such as browsers, address books, word processing software, and instant messaging software.
[0089] For example, Figure 2 A schematic structural diagram of an electronic device 100 is shown.
[0090] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0091] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or separate some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0092] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0093] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.
[0094] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0095] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0096] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0097] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0098] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0099] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0100] ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.
[0101] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1. The types of the multiple cameras 193 may be different. For example, the camera 193 may include a camera for acquiring color images or a TOF camera, etc.
[0102] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0103] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0104] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.
[0105] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.
[0106] The internal memory 121 can be used to store computer executable program codes, and the executable program codes include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the internal memory 121, and / or instructions stored in a memory provided in the processor.
[0107] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture, etc. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software structure of the electronic device 100.
[0108] Figure 3 It is a software structure block diagram of the electronic device 100 according to an embodiment of the present application.
[0109] The layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system may include: application layer (applications), application framework layer (application framework), hardware abstract layer (HAL) and kernel layer (kernel), where the kernel layer may become a driver layer.
[0110] The application layer can include a series of application packages.
[0111] like Figure 3 As shown, the application package may include applications such as camera, gallery, phone, map, phone, music, settings, mailbox, video, social networking, etc. Optionally, the application package may also include an application for image recognition, and the image recognition application includes an algorithm or model for image recognition, etc. It is understandable that the image recognition application may exist independently or may be part of any application in the application layer, and the embodiments of the present application are not specifically limited.
[0112] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0113] like Figure 3 As shown, the application framework layer may include a window manager, a content provider, a resource manager, a view system, a notification manager, a camera access interface, and the like.
[0114] The window manager is used to manage window programs. The window manager can obtain the display size, determine whether there is a status bar, lock the screen, touch the screen, drag the screen, capture the screen, etc.
[0115] Content providers are used to store and retrieve data and make it accessible to applications. The data can include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
[0116] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.
[0117] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0118] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, the terminal device vibrates, the indicator light flashes, etc.
[0119] The camera access interface allows applications to manage the camera and access the camera device, such as managing the camera to capture images.
[0120] The hardware abstraction layer may include multiple library modules, such as a camera library module, an algorithm library module, etc. The Android system may load the corresponding library module for the device hardware, thereby achieving the purpose of the application framework layer accessing the device hardware. In the embodiment of the present application, the algorithm library may include an AI preprocessing model for processing images, any face unlocking related model for implementing face unlocking, etc.
[0121] The kernel layer is a layer between hardware and software. The kernel layer is used to drive the hardware to make the hardware work. The kernel layer may include camera device drivers, display drivers, audio drivers, etc., which are not limited in the embodiments of the present application. The hardware layer may include various types of sensors, such as TOF cameras, multi-spectral sensors, etc.
[0122] For example, a camera device driver can drive a camera-type sensor in the hardware layer to perform image capture, etc.
[0123] Combine the following Figure 3 The following describes possible implementations of the image processing method of the embodiment of the present application.
[0124] In a possible implementation, the algorithm model of the embodiment of the present application is set in the algorithm library of the hardware abstraction layer. For example, when performing face unlocking, the camera access interface can be called through the camera application, and the camera access interface manages the camera hardware abstraction layer to obtain the image through the camera driver. The obtained image is further calculated by the AI preprocessing model of the embodiment of the present application and the face unlocking algorithm in the algorithm library of the hardware abstraction layer, and then the terminal device unlocking process is executed.
[0125] In another possible implementation, the algorithm model of the embodiment of the present application is set in the image processing application of the application layer. For example, when performing face payment, the camera access interface can be called through the image processing application, and the camera access interface manages the camera hardware abstraction layer to obtain the image through the camera driver. The obtained image is further calculated by the AI preprocessing model and face unlocking algorithms of the embodiment of the present application in the algorithm library of the application layer, and then the payment process is executed.
[0126] The following specific embodiments are used to describe in detail the image processing method based on the under-screen image in the embodiment of the present application. The following embodiments can be combined with each other or implemented independently, and the same or similar concepts or processes may not be repeated in some embodiments.
[0127] When executing the image processing method based on the under-screen image of the embodiment of the present application, it is necessary to pre-train an AI pre-processing model for improving the under-screen image quality based on a joint training method. The joint training method can be understood as that when training the AI pre-processing model, the relevant models that will be used with the AI pre-processing model to implement face unlocking and other functions are trained together to obtain an AI pre-processing model that can be adapted to the face unlocking related model. When the AI pre-processing model is subsequently combined to implement face unlocking and other processes, it is beneficial for the face unlocking related model to be more accurately recognized.
[0128] In the embodiment of the present application, the implementation of joint training may include two methods. Figure 4 and Figure 5 Two examples are given to illustrate how to implement AI preprocessing model training using joint training.
[0129] like Figure 4In the first embodiment of the joint training of the AI preprocessing model shown, an AI preprocessing model for outputting better quality images using images of poor quality can be trained first, and then a data set for training a model used in conjunction with the AI preprocessing model can be constructed using the output of the AI preprocessing model. After the model used in conjunction with the AI preprocessing model is trained using the data set related to the AI preprocessing model, the output of the AI preprocessing model can better meet the needs of subsequent models using the output, so that subsequent models can achieve better processing effects. For example, when the AI preprocessing model is combined with a face unlocking-related model to implement functions such as face unlocking, the face unlocking-related model can obtain better output accuracy. Figure 4 As shown, the method includes:
[0130] S401: Obtain a first training data set.
[0131] In an embodiment of the present application, the first training data set may be a data set for training an AI preprocessing model. The first training data set may include first test data and first sample data. For example, the first test data may be an image of poor quality, and the first sample data may be an image of good quality corresponding to the image of poor quality. The image in the first test data may be in a one-to-one correspondence with the image in the first sample data, so that when the AI preprocessing model is subsequently trained, the image in the first sample data may be used as a reference image when the model to be trained trains a certain first test data.
[0132] In a possible implementation, the first test data may be an under-screen IR image obtained by a TOF camera. The first sample data may be a screenless IR image obtained by a TOF camera, or may be an IR image acquired when the TOF camera is not blocked by a screen.
[0133] In another possible implementation, the first sample data may be a screenless IR image obtained by a TOF camera, and the first test data may be an image synthesized from the first sample data, for example, the screenless IR image in the first sample data is degraded by adding a screen shielding effect, etc., to obtain first test data of poor quality. Adding a screen shielding effect may include, for example, one or more of the following: adding Newton rings, adding a diffraction spot, reducing a gray value, adding a blur effect to a picture, etc.
[0134] In order to cover as many different situations as possible so that the subsequently trained AI preprocessing model can better process images in different shooting scenes, the first training data set may include first test data and first sample data corresponding to different shooting distances (such as 30cm, 40cm, 50cm), shooting angles, exposure times (such as 1000us, 1500us), camera types and / or different shooting objects. When the shooting object is a person wearing glasses, the first training data set may also include images obtained when the object wears different types of glasses.
[0135] S402: Train the model to be trained based on the first training data set to obtain an AI preprocessing model.
[0136] The model to be trained can be set in the electronic device, and the model to be trained can be any type of neural network model, for example, it can include any of the following types of models: convolutional neural network (CNN), generative adversarial network (GAN), U-shaped convolutional neural network (Unet), transformer module, etc. Among them, Unet can include an encoder and a decoder. For example, the encoder can include 3-5 convolutional layers, in which the activation function can select leaky relu, and there is no normalization layer; the decoder can use an upsampling layer, the number of decoders can be one less than that of the encoder, and the activation function can also select leaky relu, and there is no normalization layer; feature fusion can be performed between the encoder and the decoder.
[0137] The initialization parameters of the model to be trained are not specifically limited in the embodiments of this application. Exemplarily, the Kaiming initialization method can be used to initialize the parameters in the model to be trained. For example, the hyperparameter settings include: batch size is 32 during model training, the learning rate is set to 0.0002, the optimizer selects Adam, Adam's parameters β1=0.9, β2=0.99, and the iteration epoch is 200.
[0138] During training, the test data can be input into the model to be trained, and the loss calculation can be performed between the predicted image output by the model to be trained and the corresponding reference image in the sample data. Then, the parameters of the model to be trained can be updated based on the result of the loss calculation. This process is repeated until the predetermined maximum number of iterations is reached, or the loss converges, or the loss value is less than a certain value. The model training can be considered to be completed and the AI preprocessing model is obtained.
[0139] Exemplarily, when the AI pre-processing model improves the image quality of the under-screen IR image, the effects that can be achieved include but are not limited to one or more of the following: making blurred images clear, removing Newton rings in the image, eliminating diffraction spots in the image, and increasing the grayscale value of images taken at a long distance.
[0140] After obtaining the trained AI preprocessing model, the AI preprocessing model can be jointly trained with the face unlocking related model to be trained to obtain the face unlocking related model that can be adapted to the AI preprocessing model. For details, please refer to the records of S403 and S404.
[0141] S403: Acquire a second training data set.
[0142] In the embodiment of the present application, the second training data set may be a data set for training a face unlocking related model. It is understandable that the face unlocking related model may be flexibly selected based on specific needs, and the number of face unlocking related models may be one or more.
[0143] When there are multiple face unlocking related models, the training steps of S403 and S404 may be performed for each model respectively. Figure 4 As shown, when the face unlocking related models include face recognition model, eyes open and closed model, eye gaze model and face anti-counterfeiting model, face recognition dataset, eyes open and closed dataset, eye gaze dataset and face anti-counterfeiting dataset can be constructed respectively, and each dataset can be input into the AI preprocessing model respectively. By combining the output of the AI preprocessing model, each face unlocking related model can be obtained respectively.
[0144] S404: Input the second training data set into the AI preprocessing model, and use the output training of the AI preprocessing model to obtain a face unlocking related model.
[0145] In the embodiment of the present application, the second data set used to train the face unlocking related model is first input into the AI preprocessing model, and then the image processed by the AI preprocessing model is used as the input for training the face unlocking related model. The trained face unlocking related model can better recognize the image processed by the AI preprocessing model. In this way, in the face unlocking scenario, the terminal device can obtain a better unlocking rate based on the under-screen image.
[0146] It should be noted that, unlike the training method in the terminology introduction part, the training data set of the model in the training method of the embodiment of the present application is an image processed by the AI preprocessing model. The specific training principle of the training method in the embodiment of the present application is similar to that in the terminology introduction part, and will not be repeated here.
[0147] It is understandable that in the embodiment of the present application, because the AI pre-processing model is trained first, the AI pre-processing model only needs a small amount of training data in its own training stage, which can improve the problem that data construction takes a long time due to a large amount of image collection. And the subsequent face unlocking related models are trained separately, so the training difficulty is small.
[0148] like Figure 5 In the second embodiment of the joint training of the AI preprocessing model shown, when training an AI preprocessing model for outputting better quality images using images of poor quality, a model that needs to be used with the AI preprocessing model in the future can be combined with the model, and the output of the model that needs to be used with the AI preprocessing model can be used as a feedback factor for training the AI preprocessing model. The output of the trained AI preprocessing model can better meet the needs of the subsequent model that uses the output, so that the subsequent model can obtain better processing effects. For example, when the AI preprocessing model is combined with a face unlocking related model to implement functions such as face unlocking, the face unlocking related model can obtain better output accuracy. Figure 5 As shown, the method includes:
[0149] S501: Obtain a third training data set.
[0150] In an embodiment of the present application, the third training data set may be a data set used to train an AI preprocessing model. The content in the third training data set may refer to the relevant description of the first training data set, and will not be elaborated again.
[0151] S502: Obtain a preset model to be jointly trained with the AI preprocessing model.
[0152] In an embodiment of the present application, the preset model may be a trained model to be used in conjunction with an AI preprocessing model. The number of preset models may be one or more. The embodiment of the present application does not specifically limit the preset model.
[0153] For ease of explanation, the present application will take the preset models including: face recognition model, eye gaze recognition model, open and closed eye recognition model and face anti-counterfeiting model as examples for illustration. It should be understood that the preset model can also be any one or more of the above models.
[0154] It should be noted that the face unlocking related models mentioned in the embodiments of the present application can be conventional models obtained by training based on screenless images. Or it can be understood that the embodiments of the present application can reuse conventional existing models, and there is no need to adjust the parameters of the preset models when they are subsequently trained or used in conjunction with the AI preprocessing model. In this way, the number of models that need to be trained can be reduced.
[0155] S503: According to the third training data set, the model to be trained, the preset model and the target loss function, an AI preprocessing model is trained.
[0156] In the embodiment of the present application, the third training data set can be used as the input of the model to be trained, the output of the model to be trained can be used as the input of the preset model, the output of the preset model can act on the target loss function, and the parameters of the model to be trained can be adjusted according to the target loss function until the target loss function converges, or the target loss function is less than a certain value, or the training reaches the maximum number of training times, and the AI preprocessing model is obtained. In the training process, the model parameters of the preset model do not need to be adjusted during training.
[0157] For example, Figure 6 As shown in the figure, taking the preset models including: face recognition model, eye gaze recognition model, open and closed eye recognition model and face anti-counterfeiting model as an example, AI preprocessing model C θ The loss function is defined as L c , face recognition model F θ The loss function is defined as L F , human gaze recognition model G θ The loss function is defined as L G , open and closed eyes recognition model E θ The loss function is defined as L E , face anti-counterfeiting model R θ The loss function is defined as L R .
[0158] Objective loss function L total Can be used with L c , L F , L G , L E and L R related.
[0159] Exemplarily, the batch size (batch-size) during training of the third data set is 1, the IR image used as the test data is x, and the reference image corresponding to x is y.
[0160] AI Preprocessing Model C θ The output prediction value is: y′=C θ (x).
[0161] Lc can be the loss value obtained between y′ and y, which can reflect the difference between the pixels of y′ and y. Lc can be any of the following types of loss functions: L1 loss function, L2 loss function, smoothL1 loss function, etc. For example, L c Can be abs(y′-y), or (y′-y) 2, or the following piecewise function:
[0162] 0.5(y′-y), |y′-y|<1
[0163] |y′-y|-0.5,(y′-y)<-1 or(y′-y)>1
[0164] For the face recognition model F θ , y′ is F θ Input, y is the reference image of y′. y′ and y are connected through F θ A one-dimensional vector can be obtained.
[0165] L F Can be used to reflect F θ (y′),F θ (y) similarity. When calculating similarity, any of the following algorithms can be used: cosine similarity, Euclidean distance, Manhattan distance, etc. Taking cosine similarity calculation as an example, L F The following formula can be satisfied:
[0166] L F =1-cos_sim(F θ (y′),F θ (y))
[0167] Because y′=C θ (x), then L F The formula can be transformed into:
[0168] L F =1-cos_sim(F θ (C θ (x)),F θ (y))
[0169] Human eye gaze recognition model G θ , Eyes open and closed recognition model E θ And the face anti-counterfeiting model R θ , can all be binary classification models, such as CNN, transformer, multi-layer perceptron (MLP), etc.
[0170] Human eye gaze recognition model G θ , Eyes open and closed recognition model E θ And the face anti-counterfeiting model R θ The input of can all be y′, the output can all be the result of binary classification, and the loss function can all be calculated using binary cross entropy (BCE). For example, L G , L Eand L R The following formulas can be satisfied respectively:
[0171] L G =BCE(G θ (y′),G θ (y)) = BCE(G θ (C θ (x)),G θ (y))
[0172] L E =BCE(E θ (y′),E θ (y)) = BCE(E θ (C θ (x)),E θ (y))
[0173] L R =BCE(R θ (y′),R θ (y)) = BCE(R θ (C θ (x)),R θ (y))
[0174] Objective loss function L total With L c , L F , L G , L E and L R For example, L total The following formula can be satisfied:
[0175] L total =αL c +βL F +γL G +θL E +τL R
[0176] Among them, α, β, γ, θ, and τ can be preset constants.
[0177] For example, in a possible implementation, α, β, γ, θ, τ can be set so that L c , L F , L G , L E and L R Each to L total The magnitude of the influence is similar. For example, αL c , βL F ,γL G ,θL E and τLR They are all in a certain data range, or the values between any two are less than 10 times, etc. This can make the weights of each face unlocking related model similar when training the AI preprocessing model, so that the AI preprocessing model can be better used in conjunction with each face unlocking related model.
[0178] In another possible implementation, α+β+γ+θ+τ=1 can also be set, or, in a single iteration of model training, αL can be basically satisfied. c Approximately equal to βL F Approximately equal to γL G Approximately equal to θL E Approximately equal to τL R , etc., are not specifically limited in the embodiments of the present application.
[0179] It should be noted that in the embodiment of the present application, the face recognition model F θ , Human Eye Gaze Recognition Model G θ , Eyes open and closed recognition model E θ And the face anti-counterfeiting model R θ One or more types can be omitted according to the specific scenario. When training the AI preprocessing model, the data related to the omitted model can be removed. The training method is similar and will not be described in detail here. The types of neural network models that may be used by the AI preprocessing model of the embodiment of the present application, as well as the specific improvement effects that can be achieved on the image, can be referred to Figure 4 The description of the corresponding embodiments will not be repeated here.
[0180] The embodiments of the present application can reuse existing models when jointly training AI preprocessing models, thereby reducing the types of training models.
[0181] In adopting Figure 4 or Figure 5 When a relevant model is obtained through training, the trained model can be deployed in a terminal device that needs to use the relevant model, and the terminal device can use the relevant model to implement the corresponding function.
[0182] Taking the implementation of face unlocking by a terminal device as an example, the method of the embodiment of the present application is described. When implementing face unlocking, one or more of an AI preprocessing model, a face recognition model, an open and closed eye recognition model, a human eye gaze recognition model, and a face anti-counterfeiting model may be used.
[0183] Among them, the face recognition model can be used to identify whether the image processed by the AI preprocessing model is consistent with the pre-stored face used to unlock the terminal device. If they are consistent, it can be determined that the face in the off-screen image has unlocking authority. If they are inconsistent, it may be that someone who does not have authority has the intention to invade the terminal device, and the unlocking can be terminated.
[0184] The eyes-open and eyes-closed recognition model can be used to identify whether the eyes of a person in an image processed by an AI preprocessing model are open. If the eyes are open, it can be confirmed that the user intends to unlock the terminal. If the eyes are closed, it may be that someone else is using the user's face to try to unlock the terminal while the user is sleeping or in other scenarios with their eyes closed, and the unlocking can be terminated.
[0185] The human eye gaze recognition model can be used to identify whether the human eyes in the image processed by the AI preprocessing model are looking at the screen of the terminal device. Looking can confirm that the user intends to unlock the device. Not looking may mean that the user is performing other activities in front of the terminal device and has no intention of unlocking the device, so the unlocking can be terminated.
[0186] The face anti-counterfeiting model can be used to identify whether the image processed by the AI pre-processing model is based on a real person. If it is a real person, it can be confirmed that the user has the intention to unlock the phone. If it is not a real person, it may be that someone else is trying to invade the terminal device by using the user's photos or models, and the unlocking can be terminated.
[0187] It is understandable that when implementing face unlocking, the more face unlocking related models are used, the higher the security and user experience quality of face unlocking may be. The fewer face unlocking related models are used, the lower the amount of calculation during face unlocking may be, which is conducive to reducing the power consumption of the terminal device. In specific use, the terminal device can use one or more models related to face unlocking based on user-defined settings or default settings, etc., which is not specifically limited in the embodiments of this application.
[0188] For example, Figure 7 A schematic diagram of a face unlocking process is shown. Figure 7 As shown, the method may include:
[0189] S701: The terminal device obtains the off-screen image.
[0190] For example, when the screen is locked, the terminal device can use the TOF camera under the screen to capture a raw image, and further analyze the raw image to obtain an IR under-screen image.
[0191] S702: The terminal device inputs the under-screen image into the AI preprocessing model to obtain a processed image.
[0192] The AI preprocessing model of the embodiment of the present application can be Figure 4 The AI preprocessing model in the corresponding embodiment, the face unlocking related model in the subsequent S703 can be Figure 4 The face unlocking related model trained in the corresponding embodiment.
[0193] The AI preprocessing model of the embodiment of the present application can also be Figure 5Corresponding to the AI preprocessing model in the embodiment, the face unlocking related model in the subsequent S703 can be any model obtained by training based on screenless images.
[0194] The terminal device inputs the under-screen image into the AI preprocessing model to obtain a processed image with better quality.
[0195] S703: The terminal device uses the processed image as input to a face unlocking related model, and executes an unlocking process based on the face unlocking related model.
[0196] Exemplarily, the terminal device may use the processed image as input to a face recognition model, an eye open / closed recognition model, an eye gaze recognition model, and a face anti-counterfeiting model, respectively.
[0197] If any of the following situations occurs, the terminal device can exit the unlocking process and the unlocking fails: the face recognition model recognizes that the face in the processed image does not match the preset face, the open and closed eyes recognition model recognizes that the eyes in the processed image are closed, the eye gaze recognition model recognizes that the eyes in the processed image are not gazed, and the face anti-counterfeiting model recognizes that the person in the processed image is not a real person.
[0198] If the face recognition model recognizes that the face in the processed image matches the preset face, the eyes open and closed recognition model recognizes that the eyes in the processed image are open, the eye gaze recognition model recognizes that the eyes in the processed image are gazed, and the face anti-counterfeiting model recognizes that the person in the processed image is a real person, the terminal device can achieve face-based unlocking without user perception.
[0199] It can be understood that the face recognition model, the open and closed eyes recognition model, the eye gaze recognition model and the face anti-counterfeiting model can be recognized simultaneously, or they can be arranged in sequence in any form and recognized in order according to the arrangement. The embodiments of the present application do not make specific limitations.
[0200] In an embodiment of the present application, when the terminal device implements face unlocking, the collected image is processed by an AI preprocessing model jointly trained with a face unlocking related model to obtain an image that can be accurately recognized by the face unlocking related model, thereby improving the accuracy and success rate of face unlocking.
[0201] Optionally, the terminal device can select which face unlock-related models to use to perform face unlock based on user settings.
[0202] For example, Figure 8 FIG. 1 shows a possible interface diagram for a user to set a face unlocking related model. Figure 8 As shown, multiple face unlock modes can be displayed in the interface.
[0203] For example, the standard mode may include face ID recognition and face authenticity. When the user selects the standard mode, the terminal device can use the AI preprocessing model in conjunction with the face recognition model and the face anti-counterfeiting model to execute the face unlocking process.
[0204] The mask mode can include eye opening and closing recognition, eye gaze recognition, and face authenticity. When the user selects the mask mode, the terminal device can use the AI preprocessing model to combine the eye opening and closing recognition model, eye gaze recognition model, and face anti-counterfeiting model to perform the face unlocking process. In this implementation, it is convenient for users to realize non-perception face unlocking when wearing a mask.
[0205] Strict mode can include face ID recognition, eye open and closed recognition, eye gaze recognition and face authenticity. When the user selects strict mode, the terminal device can use the AI pre-processing model in conjunction with the face recognition model, eye open and closed recognition model, eye gaze recognition model and face anti-counterfeiting model to perform the face unlocking process. In this implementation, the privacy security and user experience of face unlocking can be improved.
[0206] In custom mode, users can select one or more of face ID recognition, open and closed eyes recognition, eye gaze recognition or face authenticity. The terminal device can then select the corresponding model based on the user's selection to execute the face unlocking process.
[0207] Understandably, Figure 8 The user interface is only an example description, and the various face unlocking modes are also only examples. In specific applications, the name of each mode and the corresponding functions can be modified according to needs, and each mode can also be deleted or added to adapt. The embodiments of this application are not specifically limited.
[0208] It should be noted that if the terminal device adopts Figure 4 The trained AI pre-processing model and the face unlocking related model in the embodiment perform face unlocking because Figure 4 In the embodiment of the present invention, each face unlocking related model is independent, so the terminal device can independently store the Figure 4 The face unlocking related models trained by the method of the embodiment can be called separately after determining the model to be used.
[0209] If the terminal equipment adopts Figure 5 The trained AI pre-processing model and the face unlocking related model in the embodiment perform face unlocking because Figure 5 In the embodiment of the present invention, the AI pre-processing model is trained by combining various face unlocking related models. Figure 5Any unlocking mode corresponds to a set of AI preprocessing models and corresponding face unlocking related models. After determining the unlocking mode to be used, the terminal device can call a set of AI preprocessing models and corresponding face unlocking related models corresponding to the unlocking mode to execute the corresponding unlocking process.
[0210] It can be understood that the embodiment of the present application is explained by taking the terminal device performing face unlocking as an example. The method of the embodiment of the present application can also be applied to scenarios such as face payment, which will not be elaborated here.
[0211] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of the method. In order to achieve the above functions, it includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily appreciate that, in combination with the method steps of each example described in the embodiment disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.
[0212] The embodiment of the present application can divide the functional modules of the device for implementing the image processing method based on the under-screen image according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical functional division. There may be other division methods in actual implementation.
[0213] like Fig. 9 FIG. 9 is a schematic diagram of a chip structure provided by an embodiment of the present application. The chip 90 includes one or more (including two) processors 901 , a communication line 902 , a communication interface 903 and a memory 904 .
[0214] In some implementations, the memory 904 stores the following elements: executable modules or data structures, or a subset thereof, or an extended set thereof.
[0215] The method described in the above embodiment of the present application can be applied to the processor 901, or implemented by the processor 901. The processor 901 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor 901 or an instruction in the form of software. The above-mentioned processor 901 can be a general-purpose processor (for example, a microprocessor or a conventional processor), a digital signal processor (digital signal processing, DSP), an application specific integrated circuit (application specific integrated circuit, ASIC), a field-programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gates, transistor logic devices or discrete hardware components. The processor 901 can implement or execute the methods, steps and logic block diagrams related to each processing disclosed in the embodiment of the present application.
[0216] The steps of the method disclosed in the embodiment of the present application can be directly embodied as being executed by a hardware decoding processor, or being executed by a combination of hardware and software modules in the decoding processor. Among them, the software module can be located in a mature storage medium in the field such as a random access memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable read only memory (EEPROM). The storage medium is located in the memory 904, and the processor 901 reads the information in the memory 904 and completes the steps of the above method in combination with its hardware.
[0217] The processor 901 , the memory 904 , and the communication interface 903 may communicate with each other via the communication line 902 .
[0218] In the above embodiments, the instructions stored in the memory for execution by the processor may be implemented in the form of a computer program product, wherein the computer program product may be pre-written in the memory, or may be downloaded and installed in the memory in the form of software.
[0219] The present application embodiment also provides a computer program product including one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that includes one or more available media integrated. For example, the available medium may include a magnetic medium (e.g., a floppy disk, a hard disk or a tape), an optical medium (e.g., a digital versatile disc (DVD)), or a semiconductor medium (e.g., a solid state disk (SSD)), etc.
[0220] The present application also provides a computer-readable storage medium. The methods described in the above embodiments can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. Computer-readable media may include computer storage media and communication media, and may also include any medium that can transfer a computer program from one place to another. The storage medium may be any target medium that can be accessed by a computer.
[0221] As a possible design, the computer readable medium may include a compact disc read-only memory (CD-ROM), RAM, ROM, EEPROM or other optical disc storage; the computer readable medium may include a magnetic disk storage or other magnetic disk storage device. Moreover, any connection line may also be appropriately referred to as a computer readable medium. For example, if the software is transmitted from a website, server or other remote source using a coaxial cable, fiber optic cable, twisted pair, DSL or wireless technology (such as infrared, radio and microwave), the coaxial cable, fiber optic cable, twisted pair, DSL or wireless technology such as infrared, radio and microwave are included in the definition of medium. Disk and disc as used herein include compact disc (CD), laser disc, optical disc, digital versatile disc (DVD), floppy disk and Blu-ray disc, where disks usually reproduce data magnetically, while optical discs reproduce data optically using lasers.
[0222] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processing unit of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0223] The above specific implementation methods further illustrate the purpose, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above are only specific implementation methods of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solutions of the present invention should be included in the scope of protection of the present invention.
Claims
1. An image processing method based on an under-screen image, It is characterized in that The method comprises: Get the off-screen image; Inputting the under-screen image into a pre-trained artificial intelligence (AI) preprocessing model to obtain a processed image; Inputting the processed image into an image processing model to obtain a processing result; Wherein, when the image processing model is a model trained based on the image output by the AI preprocessing model, the AI preprocessing model is a model trained using a first training data set, the first training data set includes first test data and first sample data, the test image in the first test data corresponds to a sample image in the first sample data, and the image quality of the test image is worse than the image quality of the sample image; the image processing model is trained by inputting a second training data set into the AI preprocessing model and then using the image output by the AI preprocessing model as input, and the second training data set includes relevant data sets for realizing the functions required to be realized by the image processing model; When the AI preprocessing model is a model obtained by joint training with the image processing model, the parameters of the image processing model are not adjusted during the joint training of the AI preprocessing model and the image processing model; the AI preprocessing model completes training when the value calculated using the target loss function converges; wherein the target loss function is related to the loss function of the AI preprocessing model and the loss function of the image processing model.
2. The method according to claim 1, It is characterized in that The under-screen image is an image captured by a camera disposed under the screen.
3. The method according to claim 2, It is characterized in that The camera includes a time-of-flight TOF camera.
4. The method according to any one of claims 1 to 3, It is characterized in that The image processing model includes one or more of the following: a face recognition model, an open and closed eyes model, a human eye gaze model or a face anti-counterfeiting model.
5. The method according to claim 1, It is characterized in that There are multiple image processing models, and when calculating the target loss function, the weight difference between the loss function of the AI preprocessing model and the loss function of any one of the image processing models is less than a preset value.
6. The method according to claim 5, It is characterized in that When the image processing model includes a face recognition model, an eye opening and closing model, an eye gaze model, and a face anti-counterfeiting model, the target loss function satisfies the following formula: L total =αL c +βL F +γL G +θL E +τL R Among them, the loss function of the AI preprocessing model is L c , the loss function of the face recognition model is L F , the loss function of the human eye gaze recognition model is L G , the loss function of the open and closed eyes recognition model is L E , the loss function of the face anti-counterfeiting model is L R , α, β, γ, θ, and τ are all preset constants.
7. The method according to any one of claims 1 to 6, It is characterized in that The number and types of the image processing models are configurable; alternatively, the test image is an image obtained by performing degradation processing on the sample data, and the degradation processing includes one or more of the following: adding Newton rings, adding diffraction spots, reducing grayscale values, or increasing image blurring effects.
8. The method according to claim 7, It is characterized in that The method further comprises: Displaying a first interface, the first interface including multiple face unlock mode identifiers, each of the identifiers corresponding to a control; When a trigger of a target control corresponding to an identifier of a target face unlock mode among the multiple face unlock modes is received, the image processing model is set to a model corresponding to the target face unlock mode.
9. The method according to claim 8, It is characterized in that The multiple face unlock modes include the following: standard mode, mask mode, strict mode or custom mode; The image processing models corresponding to the standard mode include a face recognition model and a face anti-counterfeiting model; The image processing model corresponding to the mask mode includes an open and closed eye recognition model, a human eye gaze recognition model and a face anti-counterfeiting model; The image processing models corresponding to the strict mode include a face recognition model, an open and closed eye recognition model, a human eye gaze recognition model and a face anti-counterfeiting model; The image processing model corresponding to the custom mode includes one or more of a face recognition model, an open and closed eyes recognition model, a human eye gaze recognition model or a face anti-counterfeiting model.
10. An electronic device, It is characterized in that include: A memory and a processor, wherein the memory is used to store a computer program, and the processor is used to execute the computer program to perform the image processing method based on the under-screen image as described in any one of claims 1 to 9.
11. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed, the computer executes the image processing method based on the under-screen image as described in any one of claims 1 to 9.
12. A computer program product, It is characterized in that It comprises computer instructions, which, when executed, enable the computer to execute the image processing method based on the under-screen image as described in any one of claims 1 to 9.
