A training method and device of a still image retake detection model and related equipment
By calculating the loss values of the predicted depth map and Fourier spectrogram, the depth and high-frequency information lost during model training is compensated for, solving the problem of low prediction accuracy in silent image re-photographing detection and improving the user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-07
- Publication Date
- 2026-04-10
AI Technical Summary
In existing silent image re-photographing detection technologies, high-frequency and depth information is lost during model training due to the single RGB channel image information, resulting in low model prediction accuracy.
The difference between the predicted depth map and the pseudo depth map, and between the predicted Fourier spectrum map and the real Fourier spectrum map, is calculated by using a loss function to make up for the depth and high-frequency information lost during model training. The pre-trained network model learns this information to improve detection accuracy.
It improves the prediction performance of the silent image re-photographing detection model and enhances the user experience.
Smart Images

Figure CN116264019B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, and in particular, to a training method and device of a silent image reprint detection model and related equipment. BACKGROUND
[0002] With the rapid development of science and technology, the existing silent image reprint detection can determine whether the face appearing in the given picture is a real person or a reprinted photo without the cooperation of a series of actions such as blinking and opening the mouth. In short, the silent image reprint detection can directly perform image reprint verification without the user's awareness, and has good user experience.
[0003] However, in the existing silent image reprint detection technology, the single RGB channel image information has the problem of loss of high frequency and depth information in the model training process, which leads to low prediction accuracy of the model and reduces the user experience. Therefore, how to make up for the loss of high frequency and depth information of single RGB channel image information in the model training process has become one of the technical problems to be solved. SUMMARY
[0004] The embodiments of the present application provide a training method and device of a silent image reprint detection model and related equipment. The terminal device can make up for the loss of depth information and high frequency information of single RGB channel image information in the model training process, improve the prediction effect (or prediction accuracy) of the silent image reprint detection model, and improve the user experience.
[0005] In a first aspect, the embodiments of the present application provide a training method of a silent image reprint detection model. The method comprises: inputting a sample face image into a pre-training network model. The pre-training network model is used to obtain a predicted depth map and a predicted Fourier spectrum map of the sample face image according to the sample face image. A pseudo depth map and a real Fourier spectrum map of the sample face image are obtained. The predicted depth map and the pseudo depth map are processed according to a first loss function of the pre-training network model to obtain a first loss value. The predicted Fourier spectrum map and the real Fourier spectrum map are processed according to the first loss function to obtain a second loss value. A third loss value corresponding to a second loss function of the pre-training network model is obtained. The pre-training network model is trained by using the first loss value, the second loss value and the third loss value to obtain the silent image reprint detection model.
[0006] In the embodiments of the present application, the terminal device can obtain a corresponding loss value by processing the predicted depth map and the pseudo depth map of the sample face image and the predicted Fourier spectrum and the real Fourier spectrum according to a loss function, so that the pre-trained network model can learn the lost depth information and high-frequency information according to the loss value to obtain the silent image flipping detection model. By using the above method, the terminal device solves the problem of loss of depth information and high-frequency information in the learning process of the pre-trained network model based on single RGB channel image information, thereby improving the prediction effect (or prediction accuracy) of the silent image flipping detection model and enhancing the user experience.
[0007] In a possible implementation manner of the first aspect, the processing of the predicted depth map and the bit depth map according to the first loss function of the pre-trained network model to obtain a first loss value includes: performing the following loss value determination operation on any corresponding pixel point in the predicted depth map and the pseudo depth map: obtaining a first predicted pixel value of the any corresponding pixel point in the predicted depth map. Obtaining a first real pixel value of the any corresponding pixel point in the pseudo depth map. Substituting the first predicted pixel value and the first real pixel value into the first loss function of the pre-trained network model to obtain a loss value of the any corresponding pixel point. Determining the first loss value of the predicted depth map and the pseudo depth map according to the result of performing the loss value determination operation on each corresponding pixel point in the predicted depth map and the pseudo depth map.
[0008] In a possible implementation manner of the first aspect, the processing of the predicted Fourier spectrum and the real Fourier spectrum according to the first loss function to obtain a second loss value includes: performing the following loss value determination operation on any corresponding pixel point in the predicted Fourier spectrum and the real Fourier spectrum: obtaining a second predicted pixel value of the any corresponding pixel point in the predicted Fourier spectrum. Obtaining a second real pixel value of the any corresponding pixel point in the real Fourier spectrum. Substituting the second predicted pixel value and the second real pixel value into the first loss function to obtain a loss value of the any corresponding pixel point. Determining the second loss value of the predicted Fourier spectrum and the real Fourier spectrum according to the result of performing the loss value determination operation on each corresponding pixel point in the predicted Fourier spectrum and the real Fourier spectrum.
[0009] In a possible implementation manner of the first aspect, the first loss function of the pre-trained network model satisfies the following formula:
[0010] wherein, is a real pixel value of a corresponding pixel point, a predicted pixel value corresponding to a pixel point.
[0011] With reference to the first aspect, in a possible implementation manner, the obtaining the pseudo depth map of the sample face image comprises: predicting a pixel value corresponding to each pixel point in the sample face image by using a preset algorithm; and obtaining the pseudo depth map of the sample face image according to the pixel value corresponding to each pixel point in the sample face image.
[0012] With reference to the first aspect, in a possible implementation manner, the obtaining the real Fourier spectrum map of the sample face image comprises: performing Fourier transform on the sample face image to obtain the real Fourier spectrum map of the sample face image.
[0013] With reference to the first aspect, in a possible implementation manner, the obtaining the third loss value corresponding to the second loss function of the pre-training network model comprises: obtaining a retouched probability and a non-retouched probability of the sample face image; and determining the third loss value corresponding to the second loss function of the pre-training network model according to the retouched probability and the non-retouched probability.
[0014] With reference to the first aspect, in a possible implementation manner, the method further comprises: inputting a to-be-detected face image into the silent image retouched detection model; and determining whether the to-be-detected face image is a retouched image according to an output result of the silent image retouched detection model.
[0015] In a second aspect, an embodiment of the present application provides a training device of a silent image retouched detection model. The device comprises: an input unit configured to input a sample face image into a pre-training network model; an obtaining unit configured to obtain, by using the pre-training network model, a predicted depth map and a predicted Fourier spectrum map of the sample face image according to the sample face image; the obtaining unit is configured to obtain a pseudo depth map and a real Fourier spectrum map of the sample face image; a processing unit configured to process the predicted depth map and the pseudo depth map according to a first loss function of the pre-training network model to obtain a first loss value; the processing unit is configured to process the predicted Fourier spectrum map and the real Fourier spectrum map according to the first loss function to obtain a second loss value; the obtaining unit is configured to obtain a third loss value corresponding to a second loss function of the pre-training network model; and the processing unit is configured to train the pre-training network model by using the first loss value, the second loss value and the third loss value to obtain the silent image retouched detection model.
[0016] With reference to the second aspect, in a possible implementation of the second aspect, the apparatus further includes a determining unit. The processing unit is configured to perform the following loss value determination operation on any corresponding pixel point in the predicted depth map and the pseudo depth map. The obtaining unit is configured to obtain a first predicted pixel value of the any corresponding pixel point in the predicted depth map. The obtaining unit is configured to obtain a first real pixel value of the any corresponding pixel point in the pseudo depth map. The processing unit is configured to substitute the first predicted pixel value and the first real pixel value into the first loss function of the pre-trained network model to obtain a loss value of the any corresponding pixel point. The determining unit is configured to determine a first loss value of the predicted depth map and the pseudo depth map according to a result of performing the loss value determination operation on each corresponding pixel point in the predicted depth map and the pseudo depth map.
[0017] With reference to the second aspect, in a possible implementation of the second aspect, the processing unit is configured to perform the following loss value determination operation on any corresponding pixel point in the predicted Fourier spectrum map and the real Fourier spectrum map. The obtaining unit is configured to obtain a second predicted pixel value of the any corresponding pixel point in the predicted Fourier spectrum map. The obtaining unit is configured to obtain a second real pixel value of the any corresponding pixel point in the real Fourier spectrum map. The processing unit is configured to substitute the second predicted pixel value and the second real pixel value into the first loss function to obtain a loss value of the any corresponding pixel point. The determining unit is configured to determine a second loss value of the predicted Fourier spectrum map and the real Fourier spectrum map according to a result of performing the loss value determination operation on each corresponding pixel point in the predicted Fourier spectrum map and the real Fourier spectrum map.
[0018] With reference to the second aspect, in a possible implementation of the second aspect, the first loss function of the pre-trained network model satisfies the following formula:
[0019] wherein, is a real pixel value of the corresponding pixel point, is a predicted pixel value of the corresponding pixel point.
[0020] With reference to the second aspect, in a possible implementation of the second aspect, the processing unit is configured to predict, by using a preset algorithm, a pixel value corresponding to each pixel point in the sample face image. The obtaining unit is configured to obtain a pseudo depth map of the sample face image according to the pixel value corresponding to each pixel point in the sample face image.
[0021] With reference to the second aspect, in a possible implementation manner, the processing unit is configured to perform Fourier transform on the face image to obtain a real Fourier spectrum of the face image.
[0022] With reference to the second aspect, in a possible implementation manner, the obtaining unit is configured to obtain a retouched probability and a non-retouched probability of the sample face image, and the determining unit is configured to determine a third loss value corresponding to a second loss function in the pre-training network model according to the retouched probability and the non-retouched probability.
[0023] With reference to the second aspect, in a possible implementation manner, the input unit is configured to input the face image to be detected into the silent image retouched detection model, and the determining unit is configured to determine whether the face image to be detected is a retouched image according to an output result of the silent image retouched detection model.
[0024] In a third aspect, an embodiment of the present application provides a computer readable storage medium for storing a computer program, when the computer program runs on a computer, the computer program causes the computer to execute the training method of the silent image retouched detection model provided in any one of the possible implementation manners of the first aspect, and the beneficial effects of the training method of the silent image retouched detection model provided in the first aspect can also be achieved.
[0025] In a fourth aspect, an embodiment of the present application provides an electronic device, which can include a processor and a memory, and the processor and the memory are connected to each other. The memory is configured to store a computer program, and the processor is configured to execute the computer program to implement the training method of the silent image retouched detection model provided in the first aspect, and the beneficial effects of the training method of the silent image retouched detection model provided in the first aspect can also be achieved.
[0026] Through implementation of the embodiments of the present application, the terminal device can obtain the corresponding loss value by processing the predicted depth map and the pseudo depth map of the sample face image and the predicted Fourier spectrum and the real Fourier spectrum, so that the pre-training network model can learn the lost depth information and high-frequency information according to the loss value to obtain the silent image retouched detection model. Through the above method, the terminal device compensates for the loss of depth information and high-frequency information of the single RGB channel image information in the learning process of the pre-training network model by calculating the corresponding loss value of the pseudo depth map and the Fourier spectrum, thereby improving the prediction effect (or prediction accuracy) of the silent image retouched detection model and improving the user experience. BRIEF DESCRIPTION OF DRAWINGS
[0027] In order to make the technical solution of the embodiments of the present application or the prior art clearer, the drawings needed in the embodiments or prior art description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and those skilled in the art can obtain other drawings according to these drawings without creative labor.
[0028] Figure 1 is a flowchart of a training method of a silent image copy detection model provided by an embodiment of the present application;
[0029] Figure 2 is another flowchart of a training method of a silent image copy detection model provided by an embodiment of the present application;
[0030] Figure 3 is a structural diagram of a training device of a silent image copy detection model provided by an embodiment of the present application;
[0031] Figure 4 is another structural diagram of a training device of a silent image copy detection model provided by an embodiment of the present application;
[0032] Figure 5 is a structural diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0033] In order to make the technical solution of the embodiments of the present application or the prior art clearer, the drawings needed in the embodiments or prior art description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and those skilled in the art can obtain other drawings according to these drawings without creative labor.
[0034] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish different objects, and are not used to describe a specific order. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps is not limited to the listed steps, but can optionally include steps not listed or can optionally include other steps inherent to the process, method, product or device.
[0035] Reference to“an embodiment” herein means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase“in one embodiment” in various places in the specification are not necessarily referring to the same embodiment, nor are they necessarily mutually exclusive of one another. It is expressly understood that any of the embodiments described herein can be combined with any of the other embodiments unless specifically noted otherwise.
[0036] In the existing still image screen capture detection technology, the single RGB channel image information has the problem of loss of high frequency information and depth information in the model training process, thereby causing poor prediction effect of the model. Therefore, the technical problem to be solved by the present application is: how to make up for the loss of high frequency information and depth information of the single RGB channel image information in the model training process.
[0037] In the embodiment of the present application, the sample face image is input into the pre-trained network model, and a predicted depth map can be output. The predicted depth map contains a first predicted pixel value for each corresponding pixel point in the sample face image. Through algorithm calculation, a first real pixel value of each corresponding pixel point in the sample face image can be predicted, and a pseudo-depth map of the sample face image can be obtained according to the predicted pixel value of each pixel point in the sample face image.
[0038] It should be noted here that the predicted depth map and the pseudo-depth map are both depth images. Each pixel value in the depth image represents the distance of a pixel point in the scene from the camera, and each pixel value represents the depth measurement range of the depth camera, so that the terminal device can obtain the depth information of the face image from the predicted depth map and the pseudo-depth map.
[0039] Further, the difference between the first predicted pixel value and the first real pixel value can be calculated by a loss function, and the difference is used in the pre-training network model training process, so that the model can learn some depth information lost in the model training process.
[0040] In the embodiment of the present application, the sample face image is input into the pre-trained network model, and a predicted Fourier spectrum map can be output. The predicted Fourier spectrum map contains a second predicted pixel value for each corresponding pixel point in the sample face image. Through mathematical operation, a real Fourier spectrum map of the sample face image can be obtained, which contains a second real pixel value for each corresponding pixel point.
[0041] It should be noted that the predicted Fourier spectrum and the real Fourier spectrum are both Fourier spectrum images. It should be understood that the high-frequency components in the Fourier spectrum image correspond to the edges, texture features, i.e., the detailed information in the image, and the low-frequency components correspond to the large area with gentle brightness or color change in the image, so that the terminal device can obtain the high-frequency information of the sample face image from the predicted Fourier spectrum and the real Fourier spectrum. It should be understood that the high-frequency information of the flipped face image and the non-flipped face image is different.
[0042] Further, the difference between the second predicted pixel value and the second real pixel value can be calculated by the loss function, and the difference is used in the pre-training network model training process, so that the model can learn some high-frequency information lost in the model training process.
[0043] In the embodiments of the present application, the loss function is essentially a function that calculates the difference between the predicted pixel value and the real pixel value, so that the model can learn some useful information that may be lost in the model training process. It should be understood that the predicted pixel value is a value calculated according to the training results of a large amount of data set according to a certain machine learning model, which is only an estimated value and has hypothetical and approximate nature, and cannot be completely consistent with the real value. The real pixel value is the value of the physical world, which has no error.
[0044] The sample face image can be an RGB three-channel image, also known as a full-color image, which has three channels: R (red), G (green), and B (blue). The pixel value is a value assigned by the computer when the original image is numerically valued, and the pixel value ranges from 0 to 255, which represents the average brightness information of a small block of the original image, or the average reflection (transmission) density information of the small block.
[0045] It should be noted that the training method of the silent image flipping detection model in the embodiments of the present application needs to input a large number of sample face images into the pre-training network model for training. For the convenience of description, only one sample face image is input into the pre-training network model in the embodiments of the present application.
[0046] Please refer to Figure 1 , Figure 1 is a flowchart of a training method of a silent image flipping detection model provided by the embodiments of the present application. The training method of the silent image flipping detection model can be specifically executed by a terminal device. In the embodiments of the present application, the terminal device can be any form of device capable of model training, such as a smart phone, a portable notebook computer, a desktop computer, a self-service terminal, etc. For example, Figure 1As shown, the method can specifically include the following steps:
[0047] S101, input the sample face image into the pre-trained network model.
[0048] In some possible implementations, the terminal device can input the sample face image into the pre-trained network model. It should be noted that the sample face image input into the pre-trained network model can be a sample face image obtained from a network resource, a cloud, or an existing public data set such as a VOC data set.
[0049] The pre-trained network model can be trained by a pre-trained network, which is a saved convolutional neural network previously trained on a large data set. Common pre-trained networks include ResNet (Residual Network), AlexNet, VGGNet, GoogLeNet, etc. It should be noted that the structure of the pre-trained network is not specifically limited in the embodiments of the present application.
[0050] S102, obtaining a predicted depth map and a predicted Fourier spectrum map of the sample face image from the sample face image by using the pre-trained network model.
[0051] In some possible implementations, the terminal device can obtain a predicted depth map and a predicted Fourier spectrum map of the sample face image from the sample face image by using the pre-trained network model.
[0052] In a specific implementation, after the terminal device inputs the sample face image into the pre-trained network model, the pre-trained network model can output a predicted depth map and a predicted Fourier spectrum map of the sample face image. Further, the terminal device can obtain the predicted depth map and the predicted Fourier spectrum map of the sample face image.
[0053] S103, obtaining a pseudo depth map and a real Fourier spectrum map of the sample face image.
[0054] In some possible implementations, the terminal device can obtain a pseudo depth map and a real Fourier spectrum map of the sample face image.
[0055] Optionally, the terminal device can predict a pixel value corresponding to each pixel point in the sample face image by using a preset algorithm. Further, the terminal device can obtain a pseudo depth map of the sample face image according to the pixel value corresponding to each pixel point in the sample face image.
[0056] In a specific implementation, the terminal device can obtain a pseudo depth map of the sample face image by using a 3ddfa (3D Dense Face Alignment, dense face alignment) network (such as a pseudo depth map prediction network).
[0057] It should be noted that the prediction algorithm for obtaining the pseudo-depth map is not specifically limited in the embodiments of the present application.
[0058] Optionally, the terminal device can perform Fourier transform on the sample face image, and the real Fourier spectrum graph of the sample face image can be obtained by performing Fourier spectrum calculation.
[0059] In S104, the first loss value is obtained by processing the predicted depth map and the pseudo-depth map according to the first loss function of the pre-trained network model.
[0060] In some possible embodiments, the terminal device can obtain the first loss value by processing the predicted depth map and the pseudo-depth map according to the first loss function of the pre-trained network model.
[0061] In an optional embodiment, since the size and the pixels of the predicted depth map and the pseudo-depth map are equal, and the number of pixel points in the predicted depth map and the pseudo-depth map is equal, there must be a corresponding pixel point in the same position in the pseudo-depth map for a pixel point in a certain position in the predicted depth map. The terminal device can perform loss value determination operation on any corresponding pixel points in the predicted depth map and the pseudo-depth map. Because the terminal device calculates the loss value of each corresponding pixel point in the two graphs in the same way, here any corresponding pixel point is taken as an example for description and illustration. In a specific implementation, the terminal device can obtain the first predicted pixel value of any corresponding pixel point in the predicted depth map. Then, the terminal device can obtain the first real pixel value of any corresponding pixel point in the pseudo-depth map. Further, the terminal device can substitute the first predicted pixel value and the first real pixel value into the first loss function of the pre-trained network model to obtain the loss value of any corresponding pixel point.
[0062] Optionally, the first loss function of the pre-trained network model can be a mean square error (MSE) function, which satisfies the following formula: (1)
[0063] wherein, represents the real pixel value of the corresponding pixel point, represents the predicted pixel value of the corresponding pixel point.
[0064] For example, it is assumed that the first real pixel value of any corresponding pixel point in the pseudo-depth map is 25, and the first predicted pixel value of the corresponding pixel point in the predicted depth map is 15. The loss value of any corresponding pixel point can be obtained by substituting the first real pixel value 25 and the first predicted pixel value 15 into the mean square error (MSE) function. Further, the terminal device can determine the loss value of any corresponding pixel point as 100.
[0065] Further, the terminal device can determine the first loss value of the predicted depth map and the pseudo depth map according to a result of performing the loss value determination operation on each corresponding pixel point in the predicted depth map and the pseudo depth map. Specifically, after obtaining the pixel value of each corresponding pixel point in the predicted depth map and the pseudo depth map obtained by the terminal device, the terminal device can obtain the loss value corresponding to each corresponding pixel point. Further, the terminal device can form a matrix pixel according to the pixel value of each corresponding pixel point, so as to determine the first loss value of the predicted depth map and the pseudo depth map.
[0066] It should be noted that the terminal device can calculate the first loss value of the predicted depth map and the pseudo depth map of the sample face image by using the mean square loss function (MSE) formula. It should be understood that the first loss value calculated by the terminal device through the loss function can provide input data for back propagation in the pre-trained network model, so that the pre-trained network model can learn the depth information of the sample face image that may be lost due to the poor prediction effect of the pre-trained network model, thereby solving the problem of loss of depth information of the sample face image (i.e., a single RGB channel image) in the model learning process.
[0067] S105, obtaining a second loss value by processing the predicted Fourier spectrum and the real Fourier spectrum according to the first loss function.
[0068] In some possible implementations, the terminal device can obtain the second loss value by processing the predicted Fourier spectrum and the real Fourier spectrum according to the first loss function.
[0069] In an optional implementation, since the size and the pixel of the predicted Fourier spectrum and the real Fourier spectrum are equal, there is a corresponding pixel point in the same position in the real Fourier spectrum for a pixel point in a certain position in the predicted Fourier spectrum. The terminal device can perform a loss value determination operation on any corresponding pixel point in the predicted Fourier spectrum and the real Fourier spectrum. Since the terminal device calculates the loss value of each corresponding pixel point in the two graphs in the same way, here any corresponding pixel point is taken as an example for description and illustration. In a specific implementation, the terminal device can obtain a second predicted pixel value of any corresponding pixel point in the predicted Fourier spectrum. Then, the terminal device can obtain a second real pixel value of any corresponding pixel point in the real Fourier spectrum. Further, the terminal device can substitute the second predicted pixel value and the second real pixel value into the first loss function of the pre-trained network to obtain the loss value of any corresponding pixel point.
[0070] Further, the terminal device can determine a second loss value of the predicted Fourier spectrum and the real Fourier spectrum according to a result of performing the above loss value determination operation on each corresponding pixel point in the predicted Fourier spectrum and the real Fourier spectrum. Specifically, after obtaining the pixel value of each corresponding pixel point in the predicted Fourier spectrum and the real Fourier spectrum, the terminal device can obtain the loss value corresponding to each corresponding pixel point. Further, the terminal device can form a matrix pixel point according to each corresponding pixel point, so as to determine the second loss value of the predicted Fourier spectrum and the real Fourier spectrum.
[0071] It should be noted that the terminal device can calculate the second loss value of the predicted Fourier spectrum and the real Fourier spectrum of the sample face image through the mean square loss function (MSE) formula. It should be understood that the second loss value calculated by the terminal device through the loss function can provide input data for back propagation in the pre-trained network model, so that the pre-trained network model can learn the high-frequency information of the sample face image that may be lost due to the poor prediction effect of the pre-trained network model, and solve the problem of loss of high-frequency information of the sample face image (i.e. single RGB channel image information) in the model learning process.
[0072] S106, obtaining a third loss value corresponding to a second loss function of the pre-trained network model.
[0073] In some possible implementation manners, the terminal device can obtain the third loss value corresponding to the second loss function of the pre-trained network model.
[0074] In a specific implementation, the terminal device can obtain the flipping probability and the non-flipping probability of the sample face image according to the sample face image through the pre-trained network model. Further, the terminal device can determine the third loss value corresponding to the second loss function of the pre-trained network model according to the flipping probability and the non-flipping probability of the sample face image through the second loss function of the pre-trained network model.
[0075] It should be noted that the second loss function of the pre-trained network model can be a cross-entropy loss function, satisfying the following formula:
[0076] (2)
[0077] Wherein, P represents the probability of predicting as flipping, and 1-P represents the probability of predicting as non-flipping. y represents the result label of output, and is determined to be 0 or 1 according to whether the prediction is a flipping image. For example, if the sample face image input into the pre-trained network model is a flipping image, 0 can be output as the result label. If the sample face image input into the pre-trained network model is a non-flipping image, 1 can be output as the result label.
[0078] S107, training the pre-training network model by the first loss value, the second loss value and the third loss value to obtain the silent image flipping detection model.
[0079] In some possible implementation manners, the terminal device can train the pre-training network model by the first loss value, the second loss value and the third loss value to obtain the silent image flipping detection model. It should be understood that the first loss value, the second loss value and the third loss value can provide input data for back propagation in the pre-training network model, so that the pre-training network model can learn the depth information and the high-frequency information of the sample face image that can be lost due to poor prediction effect of the pre-training network model. The pre-training network model can continuously learn the depth information and the high-frequency information that can be lost through the first loss value, the second loss value and the third loss value, so that the prediction value obtained by the pre-training network model can be infinitely close to the true value, thereby the pre-training network model can converge to obtain the silent image flipping detection model, and the prediction effect (or prediction accuracy) of the silent image flipping detection model is improved.
[0080] In the implementation described above, the terminal device can obtain the corresponding loss value by processing the predicted depth map and the pseudo depth map of the sample face image and the predicted Fourier spectrum map and the true Fourier spectrum map through the loss function, so that the pre-training network model can learn the lost depth information and high-frequency information according to the loss value to obtain the silent image flipping detection model, thereby solving the problem of loss of depth information and high-frequency information of the single RGB channel image information in the learning process of the pre-training network model, and improving the prediction effect (or prediction accuracy) of the silent image flipping detection model and the user experience.
[0081] Please refer to Figure 2 , Figure 2 is another flowchart of a method for training a silent image flipping detection model provided by the embodiments of the present application. As shown in Figure 2 , the method for training a silent image flipping detection model can further include the following steps:
[0082] S108, inputting the face image to be detected into the silent image flipping detection model.
[0083] In some possible implementation manners, the terminal device can input the face image to be detected into the silent image flipping detection model. It should be noted that the face image to be detected refers to an image to be detected by the model to determine whether it is a flipping image.
[0084] In a specific implementation, the terminal device can first obtain the face image to be detected. Further, the terminal device can input the face image to be detected into the trained silent image flipping detection model to determine whether the face image to be detected is a flipping image.
[0085] S109, determining whether the to-be-detected face image is a flipped image according to an output result of the silent image flipping detection model.
[0086] In some possible implementation manners, the terminal device can determine whether the to-be-detected face image is a flipped image according to an output result of the silent image flipping detection model.
[0087] In a specific implementation, after inputting the to-be-detected face image into the silent image flipping detection model, the silent image flipping detection model can output a result image with label information. Further, the terminal device can determine whether the to-be-detected face image is a flipped image according to the output result image.
[0088] In the implementation described above, the terminal device can determine whether the to-be-detected face image is a flipped image according to the to-be-detected face image through the silent image flipping detection model. By using the method described above, the machine learning model can be used to detect whether an image is a flipped image, so that the detection efficiency and the detection accuracy can be improved, and the user experience can be improved.
[0089] Please refer to Figure 3 , Figure 3 is a structure schematic diagram of a training apparatus of a silent image flipping detection model provided by an embodiment of the present application. As shown in Figure 3 , the training apparatus of the silent image flipping detection model can include an input unit 31, an acquisition unit 32, and a processing unit 33.
[0090] In a specific implementation, the input unit 31 is configured to input a sample face image into a pre-training network model. The acquisition unit 32 is configured to acquire a predicted depth map and a predicted Fourier spectrum map of the sample face image according to the sample face image through the pre-training network model. The acquisition unit 32 is configured to acquire a pseudo depth map and a real Fourier spectrum map of the sample face image. The processing unit 33 is configured to process the predicted depth map and the pseudo depth map to obtain a first loss value according to a first loss function of the pre-training network model. The processing unit 33 is configured to process the predicted Fourier spectrum map and the real Fourier spectrum map to obtain a second loss value according to the first loss function. The acquisition unit 32 is configured to acquire a third loss value corresponding to a second loss function of the pre-training network model. The processing unit 33 is configured to train the pre-training network model through the first loss value, the second loss value, and the third loss value to obtain the silent image flipping detection model.
[0091] In an alternative implementation, please refer to Figure 4 , Figure 4 is still another structure schematic diagram of a training apparatus of a silent image flipping detection model provided by an embodiment of the present application. As shown in Figure 4As shown, the training apparatus of the silent image retake detection model can further include a determination unit 34. The processing unit 33 is configured to perform the following loss value determination operation on any corresponding pixel point in the predicted depth map and the pseudo depth map. Specifically, the obtaining unit 32 is configured to obtain a first predicted pixel value of any corresponding pixel point in the predicted depth map. The obtaining unit 32 is configured to obtain a first real pixel value of any corresponding pixel point in the pseudo depth map. The processing unit 33 is configured to substitute the first predicted pixel value and the first real pixel value into the first loss function of the pre-trained network model to obtain a loss value of any corresponding pixel point. The determination unit 34 is configured to determine a first loss value of the predicted depth map and the pseudo depth map according to the result of performing the loss value determination operation on each corresponding pixel point in the predicted depth map and the pseudo depth map.
[0092] In an optional implementation, the processing unit 33 is configured to perform the following loss value determination operation on any corresponding pixel point in the predicted Fourier spectrum map and the real Fourier spectrum map. The obtaining unit 32 is configured to obtain a second predicted pixel value of any corresponding pixel point in the predicted Fourier spectrum map. The obtaining unit 32 is configured to obtain a second real pixel value of any corresponding pixel point in the real Fourier spectrum map. The processing unit 33 is configured to substitute the second predicted pixel value and the second real pixel value into the first loss function to obtain a loss value of any corresponding pixel point. The determination unit 34 is configured to determine a second loss value of the predicted Fourier spectrum map and the real Fourier spectrum map according to the result of performing the loss value determination operation on each corresponding pixel point in the predicted Fourier spectrum map and the real Fourier spectrum map.
[0093] In an optional implementation, the first loss function of the pre-trained network model satisfies the following formula: ⑴
[0094] wherein, is a real pixel value of the corresponding pixel point, is a predicted pixel value of the corresponding pixel point.
[0095] In an optional implementation, the processing unit 33 is configured to predict the pixel value corresponding to each pixel point in the sample face image by a pre-set algorithm. The obtaining unit 32 is configured to obtain the pseudo depth map of the sample face image according to the pixel value corresponding to each pixel point in the sample face image.
[0096] In an optional implementation, the processing unit 33 is configured to perform Fourier transform on the face image to obtain the real Fourier spectrum map of the face image.
[0097] In an optional implementation, the acquisition unit 32 is configured to acquire the flipping probability and the non-flipping probability of the sample face image. The determination unit 34 is configured to determine the third loss value corresponding to the second loss function in the pre-training network model according to the flipping probability and the non-flipping probability.
[0098] In an optional implementation, the input unit 31 is configured to input the face image to be detected into the silent image flipping detection model. The determination unit 34 is configured to determine whether the face image to be detected is a flipped image according to the output result of the silent image flipping detection model.
[0099] Please refer to Figure 5 , Figure 5 is a structural schematic diagram of an electronic device provided in the embodiments of the present application. The electronic device can be the terminal device in the above embodiments, and can be used to implement the steps of the training method of the silent image flipping detection model executed by the terminal device described in the above embodiments. The electronic device can include a processor 51, a memory 52 and a bus system 53.
[0100] The memory 52 includes, but is not limited to, RAM, ROM, EPROM or CD-ROM, and is configured to store relevant instructions and data. The memory 52 stores the following elements, executable modules or data structures, or a subset thereof, or an extended set thereof:
[0101] Operation instructions: include various operation instructions for implementing various operations.
[0102] Operating system: includes various system programs for implementing various basic services and processing hardware-based tasks.
[0103] Figure 5 Only one memory is shown in the figure, and of course, the memory can also be set to multiple according to needs.
[0104] As Figure 5 shown, the electronic device can further include an input / output device 54, which can be a communication module, a transceiver circuit. In the embodiments of the present application, the input / output device 54 is configured to perform the transceiving process of the first loss value, the second loss value, the third loss value and the like data or signaling involved in the embodiments.
[0105] The processor 51 can be a controller, a CPU, a general-purpose processor, a DSP, an ASIC, an FPGA or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It can implement or execute various exemplary logical blocks, modules and circuits described in combination with the disclosure of the embodiments of the present application. The processor 51 can also be a combination of computing functions, such as a combination of one or more microprocessors, a combination of DSP and microprocessor, etc.
[0106] In a particular application, various components of the electronic device are coupled together by a bus system 53, which can include a data bus, a power bus, a control bus, and a state signal bus, among others. For the sake of brevity, the various buses will be referred to generally as the bus system 53 throughout most of this disclosure. While several buses are present in the bus system 53, it should be understood that the bus system 53 can include more than one of each type of bus. Figure 5 For the sake of clarity, the various buses are shown in Figure 5 FIG. 1 as separate lines because the actual bus lines will include various information over time. Thus, the use of multiple separate buses is merely for illustrative purposes and the true implementation is a matter of design choice.
[0107] It should be noted that in actual implementation, the processor in the embodiments of the present application can be an integrated circuit chip with a signal processing capability. In the implementation process, each step of the method embodiments can be completed by an integrated logic circuit or an instruction in the form of software in the processor. The processor can be a general purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. Each method, step and logic block diagram disclosed in the embodiments of the present application can be implemented or executed.
[0108] It is to be appreciated that the memory in the embodiments of the application can be volatile or nonvolatile memory, or can include both volatile and nonvolatile memory. In one embodiment, a non-volatile memory can be a read-only memory (ROM), programmable ROM (PROM), erasable PROM (EPROM), electrically EPROM (EEPROM), or flash memory. A volatile memory can be a random access memory (RAM), which is used as external cache. By way of example, and not limitation, many forms of RAM are available, for example, static RAM (SRAM), dynamic RAM (DRAM), synchronous dynamic RAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), and direct Rambus RAM (DR RAM). It is to be appreciated that the memory described herein is intended to include, without being limited to, these and any other suitable types of memory.
[0109] The embodiment of the application further provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a computer to implement the method or steps executed by the terminal device in the above embodiment.
[0110] The embodiment of the application further provides a computer program product, which is executed by a computer to implement the method or steps executed by the terminal device in the above embodiment.
[0111] It should be noted that for the training method of any of the above-mentioned still image photographing detection models, in order to simply describe, they are all expressed as a series of action combinations, but those skilled in the art should know that the application is not limited by the action sequence described, because according to the application, some steps can be performed in other order or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions involved are not necessarily necessary for the application.
[0112] Although the present application is described in conjunction with the preferred embodiments thereof, numerous modifications and alterations thereof will become apparent to others skilled in the art in view of the foregoing description. It is intended that all such modifications and alterations be considered as falling within the spirit and scope of the present application. The word "comprising" does not exclude other components or steps not mentioned. The word "a" or "an" does not exclude a plurality. The conjunction "or" is not intended to be exclusive, unless it explicitly says so. The use of any of the following terms in the claims (and / or the specification) is not intended as an admission that one or more of the claimed embodiments is / are not entitled to priority under 35 U.S.C. § 120, 121, or both, to the corresponding application(s) entitled to priority under 35 U.S.C. § 119(a)-(d) (pre-AIA 35 U.S.C. § 120, 121, and 365(c)), or both. The use of any of the following terms in the claims (and / or the specification) is not intended as an admission that one or more of the claimed embodiments is / are not entitled to priority under 35 U.S.C. § 119(e) (pre-AIA 35 U.S.C. § 120, 121, and 365(a)), or both. The use of any of the following terms in the claims (and / or the specification) is not intended as an admission that one or more of the claimed embodiments is / are not entitled to priority under 35 U.S.C. § 120, 121, or both, to the corresponding application(s) entitled to priority under 35 U.S.C. § 119(a)-(d) (pre-AIA 35 U.S.C. § 120, 121, and 365(c)), or both. The use of any of the following terms in the claims (and / or the specification) is not intended as an admission that one or more of the claimed embodiments is / are not entitled to priority under 35 U.S.C. § 119(e) (pre-AIA 35 U.S.C. § 120, 121, and 365(a)), or both.
[0113] Those skilled in the art can understand that all or part of the steps in the various method embodiments of the training method of the silent image photographing detection model described above can be completed by instructing relevant hardware through a program, and the program can be stored in a computer readable memory, which can include a flash disk, a read-only memory (English: Read-Only Memory, for short: ROM), a random access memory (English: Random Access Memory, for short: RAM), a magnetic disk or an optical disk, etc.
[0114] The above describes the embodiments of the present application in detail, and the principles and implementation manners of the training method of the silent image photographing detection model, the device and the related equipment are described by applying specific examples in this paper. The above description of the embodiments is used to help understand the method and core idea of the present application. Meanwhile, for those skilled in the art, according to the idea of the training method of the silent image photographing detection model, the device and the related equipment, the specific implementation manner and application range will be changed. In summary, the content of the specification should not be understood as a limitation of the present application.
[0115] Those skilled in the art should realize that in one or more examples described above, the functions described in the present application can be realized by hardware, software, firmware or any combination thereof. When realized by software, these functions can be stored in a computer readable medium or transmitted as one or more instructions or codes on a computer readable medium. The computer readable medium includes a computer storage medium and a communication medium, wherein the communication medium includes any medium that facilitates the transmission of computer programs from one place to another. The storage medium can be any available medium that can be accessed by a general or special purpose computer.
[0116] The above specific implementation manner further describes the purpose, technical solutions and beneficial effects of the present application, and it should be understood that the above is only a specific implementation manner of the present application, and is not used to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made on the basis of the technical solutions of the present application should be included in the protection scope of the present application.
Claims
1. A training method for a silent image re-photographing detection model, characterized in that, include: Input the sample face images into the pre-trained network model; The pre-trained network model is used to obtain the predicted depth map and predicted Fourier spectrogram of the sample face image based on the sample face image. Obtain the pseudo-depth map and the real Fourier spectrogram of the sample face image; The predicted depth map and the pseudo depth map are processed according to the first loss function of the pre-trained network model to obtain the first loss value; The predicted Fourier spectrum and the true Fourier spectrum are processed according to the first loss function to obtain a second loss value; Obtain the third loss value corresponding to the second loss function of the pre-trained network model; The pre-trained network model is trained using the first loss value, the second loss value, and the third loss value to obtain the silent image re-photographing detection model; Wherein, obtaining the third loss value corresponding to the second loss function in the pre-trained network model includes: Obtain the probability of re-enacting and non-re-enacting the sample face images; The third loss value corresponding to the second loss function in the pre-trained network model is determined based on the re-production probability and the non-re-production probability.
2. The method according to claim 1, characterized in that, The step of processing the predicted depth map and the pseudo depth map according to the first loss function of the pre-trained network model to obtain the first loss value includes: For any corresponding pixel in the predicted depth map and the pseudo depth map, the following loss value determination operation is performed: Obtain the first predicted pixel value of any corresponding pixel in the predicted depth map; Obtain the first real pixel value of any corresponding pixel in the pseudo-depth map; Substitute the first predicted pixel value and the first real pixel value into the first loss function of the pre-trained network model to obtain the loss value of any corresponding pixel point; The first loss value of the predicted depth map and the pseudo depth map is determined based on the result of the loss value determination operation performed on each corresponding pixel in the predicted depth map and the pseudo depth map.
3. The method according to claim 1, characterized in that, The step of processing the predicted Fourier spectrum and the true Fourier spectrum according to the first loss function to obtain the second loss value includes: For any corresponding pixel in the predicted Fourier spectrum and the true Fourier spectrum, the following loss value determination operation is performed: Obtain the second predicted pixel value of any corresponding pixel in the predicted Fourier spectrum; Obtain the second true pixel value of any corresponding pixel in the true Fourier spectrogram; Substitute the second predicted pixel value and the second true pixel value into the first loss function to obtain the loss value of any corresponding pixel point; The second loss value of the predicted Fourier spectrum and the true Fourier spectrum is determined based on the result of performing the loss value determination operation on each corresponding pixel in the predicted Fourier spectrum and the true Fourier spectrum.
4. The method according to claim 2 or 3, characterized in that, The first loss function of the pre-trained network model satisfies the following formula: in, This represents the actual pixel value of the corresponding pixel. This represents the predicted pixel value for the corresponding pixel.
5. The method according to claim 1 or 2, characterized in that, The step of obtaining the pseudo-depth map of the sample face image includes: The pixel value corresponding to each pixel in the sample face image is predicted by a preset algorithm; A pseudo-depth map of the sample face image is obtained based on the pixel value corresponding to each pixel in the sample face image.
6. The method according to any one of claims 1-3, characterized in that, The method further includes: The image of the face to be detected is input into the silent image re-photographing detection model; The detection model determines whether the face image to be detected is a copied image based on its output.
7. A training device for a silent image re-photographing detection model, characterized in that, The device includes: The input unit is used to input sample face images into the pre-trained network model; The acquisition unit is used to acquire the predicted depth map and predicted Fourier spectrum map of the sample face image based on the sample face image using the pre-trained network model. The acquisition unit is used to acquire the pseudo-depth map and the real Fourier spectrum map of the sample face image; The processing unit is configured to process the predicted depth map and the pseudo depth map according to the first loss function of the pre-trained network model to obtain a first loss value; The processing unit is used to process the predicted Fourier spectrum and the real Fourier spectrum according to the first loss function to obtain a second loss value; The acquisition unit is used to acquire the third loss value corresponding to the second loss function of the pre-trained network model; The processing unit is used to train the pre-trained network model using the first loss, the second loss value, and the third loss value to obtain the silent image re-photographing detection model; Wherein, obtaining the third loss value corresponding to the second loss function in the pre-trained network model includes: Obtain the probability of re-enacting and non-re-enacting the sample face images; The third loss value corresponding to the second loss function in the pre-trained network model is determined based on the re-production probability and the non-re-production probability.
8. A computer-readable storage medium, characterized in that, Used to store a computer program, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 6.
9. An electronic device, characterized in that, It includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Copied image recognition method and device, equipment and medium
CN111191568A
Depth prediction model training method and device, medium and electronic equipment
CN113610879A