WO2022037258A1 - 图像真伪检测方法、装置、计算机设备和存储介质 - Google Patents

图像真伪检测方法、装置、计算机设备和存储介质 Download PDF

Info

Publication number
WO2022037258A1
WO2022037258A1 PCT/CN2021/102723 CN2021102723W WO2022037258A1 WO 2022037258 A1 WO2022037258 A1 WO 2022037258A1 CN 2021102723 W CN2021102723 W CN 2021102723W WO 2022037258 A1 WO2022037258 A1 WO 2022037258A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
training
false
real
generator
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2021/102723
Other languages
English (en)
French (fr)
Inventor
姚太平
王鑫瑶
丁守鸿
李季檩
吴运声
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to EP21857354.1A priority Critical patent/EP4123503A4/en
Publication of WO2022037258A1 publication Critical patent/WO2022037258A1/zh
Priority to US18/076,021 priority patent/US12597278B2/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/95Pattern authentication; Markers therefor; Forgery detection
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/40Spoof detection, e.g. liveness detection
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/161Detection; Localisation; Normalisation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/26Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/74Image or video pattern matching; Proximity measures in feature spaces
    • G06V10/75Organisation of the matching processes, e.g. simultaneous or sequential comparisons of image or video features; Coarse-fine approaches, e.g. multi-scale approaches; using context analysis; Selection of dictionaries
    • G06V10/751Comparing pixel values or logical combinations thereof, or feature values having positional relevance, e.g. template matching
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/77Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
    • G06V10/774Generating sets of training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/82Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/40Scenes; Scene-specific elements in video content
    • G06V20/49Segmenting video sequences, i.e. computational techniques such as parsing or cutting the sequence, low-level clustering or determining units such as shots or scenes
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/168Feature extraction; Face representation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/172Classification, e.g. identification
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions

Definitions

  • the present application relates to the technical field of image processing, and in particular, to an image authenticity detection method, device, computer equipment and storage medium.
  • the way of authenticating an image in the traditional scheme is mainly to determine whether the image to be detected is a fake image by detecting some specific flaws in the image. For example, the authenticity of the image can be judged by detecting the matching degree of the global illumination and the local illumination in the image.
  • some specific flaws will no longer exist, resulting in low accuracy of image authenticity detection.
  • Embodiments of the present application provide an image authenticity detection method, apparatus, computer device, and storage medium.
  • the to-be-detected image is input into a generator of a generative adversarial network, and the generator outputs an artifact image corresponding to the to-be-detected image; the artifact image is used to characterize the to-be-detected image and the real image
  • the generative adversarial network further includes a discriminator; in the training phase, the generator is used to output a prediction artifact image corresponding to the sample image, and generate a prediction artifact image based on the prediction artifact image. a fitted image; the discriminator is used to perform authenticity discrimination on the fitted image, so as to assist the generator to learn the difference feature between the fake image and the real image; and
  • the authenticity detection result of the to-be-detected image is determined based on the artifact image.
  • An image authenticity detection device the device includes:
  • an image acquisition module for acquiring the image to be detected
  • An artifact image generation module configured to input the to-be-detected image into a generator of a generative adversarial network, and output an artifact image corresponding to the to-be-detected image through the generator; the artifact image is used to represent The difference between the image to be detected and the real image;
  • the generative adversarial network further includes a discriminator in the training phase; in the training phase, the generator is used to output a prediction artifact image corresponding to the sample image, and generating a fitted image based on the predicted artifact image; the discriminator is used for authenticating the fitted image to assist the generator to learn the difference feature between the fake image and the real image; and
  • a determination module configured to determine the authenticity detection result of the to-be-detected image based on the artifact image.
  • a computer device comprising a memory and one or more processors, the memory having computer-readable instructions stored therein, the computer-readable instructions, when executed by the processor, cause the one or more processors to execute The following steps:
  • the to-be-detected image is input into a generator of a generative adversarial network, and the generator outputs an artifact image corresponding to the to-be-detected image; the artifact image is used to characterize the to-be-detected image and the real image
  • the generative adversarial network further includes a discriminator; in the training phase, the generator is used to output a prediction artifact image corresponding to the sample image, and generate a fitting image based on the prediction artifact image. an image; the discriminator is used to perform authenticity discrimination on the fitted image, so as to assist the generator to learn the difference feature between the fake image and the real image; and
  • the authenticity detection result of the to-be-detected image is determined based on the artifact image.
  • One or more non-volatile readable storage media storing computer-readable instructions that, when executed by one or more processors, cause the one or more processors to perform the following steps:
  • the to-be-detected image is input into a generator of a generative adversarial network, and the generator outputs an artifact image corresponding to the to-be-detected image; the artifact image is used to characterize the to-be-detected image and the real image
  • the generative adversarial network further includes a discriminator; in the training phase, the generator is used to output a prediction artifact image corresponding to the sample image, and generate a fitting image based on the prediction artifact image. an image; the discriminator is used to perform authenticity discrimination on the fitted image, so as to assist the generator to learn the difference feature between the fake image and the real image; and
  • the authenticity detection result of the to-be-detected image is determined based on the artifact image.
  • sample images and image labels corresponding to each of the sample images include real sample images and false sample images;
  • the image labels include false area labels and image authenticity labels;
  • the sample image and the fitted image are respectively input into the discriminator to be trained in the generative confrontation network, and the first false region prediction result and the first visual real prediction result are output;
  • the to-be-trained The discriminator Based on the first difference between the first false area prediction result and the corresponding false area label, and the second difference between the first visual truth prediction result and the corresponding image authenticity label, the to-be-trained The discriminator performs the first training until it reaches the first training stop condition;
  • the first training and the second training are alternately performed, and the training is stopped until the iterative stop condition is reached, and a trained generative adversarial network is obtained; Fake detection.
  • An image authenticity detection device characterized in that the device comprises:
  • an acquisition module configured to acquire a sample image and an image label corresponding to each of the sample images;
  • the sample image includes a real sample image and a fake sample image;
  • the image label includes a fake area label and an image authenticity label;
  • a fitting image generation module configured to input each of the sample images to a generator to be trained in the generative adversarial network, and output a prediction artifact image corresponding to each of the sample images through the generator to be trained, and generating fitting images corresponding to the sample images according to each of the predicted artifact images;
  • a training module configured to input the sample image and the fitted image into the discriminator to be trained in the generative confrontation network respectively, and output the first false region prediction result and the first visual real prediction result;
  • the training module is further configured to be based on the first difference between the first false region prediction result and the corresponding false region label, and the first difference between the first visual real prediction result and the corresponding image authenticity label.
  • the second difference is to perform the first training on the discriminator to be trained, and stop when the first training stop condition is reached;
  • the training module is configured to input the fitted image into the discriminator obtained by the first training, and output the second false region prediction result and the second visual real prediction result of the fitted image;
  • the training module is further configured to be based on the third difference between the second false region prediction result and the false region label corresponding to the real sample image, and the second visual real prediction result and the real sample image.
  • the fourth difference between the corresponding image authenticity labels, the second training is performed on the to-be-trained generator until the second training stop condition is reached;
  • the training module is also used to alternately perform the first training and the second training, and stop the training until the iteration stop condition is reached to obtain a trained generative adversarial network;
  • the detector is used to perform image authenticity detection on the image to be detected.
  • a computer device comprising a memory and one or more processors, the memory having computer-readable instructions stored therein, the computer-readable instructions, when executed by the processor, cause the one or more processors to execute The following steps:
  • sample images and image labels corresponding to each of the sample images include real sample images and false sample images;
  • the image labels include false area labels and image authenticity labels;
  • the sample image and the fitted image are respectively input into the discriminator to be trained in the generative confrontation network, and the first false region prediction result and the first visual real prediction result are output;
  • the to-be-trained The discriminator Based on the first difference between the first false area prediction result and the corresponding false area label, and the second difference between the first visual truth prediction result and the corresponding image authenticity label, the to-be-trained The discriminator performs the first training until it reaches the first training stop condition;
  • the first training and the second training are alternately performed, and the training is stopped until the iterative stop condition is reached, and a trained generative adversarial network is obtained; Fake detection.
  • One or more non-volatile readable storage media storing computer-readable instructions that, when executed by one or more processors, cause the one or more processors to perform the following steps:
  • sample images and image labels corresponding to each of the sample images include real sample images and false sample images;
  • the image labels include false area labels and image authenticity labels;
  • the sample image and the fitted image are respectively input into the discriminator to be trained in the generative confrontation network, and the first false region prediction result and the first visual real prediction result are output;
  • the to-be-trained The discriminator Based on the first difference between the first false area prediction result and the corresponding false area label, and the second difference between the first visual truth prediction result and the corresponding image authenticity label, the to-be-trained The discriminator performs the first training until it reaches the first training stop condition;
  • the first training and the second training are alternately performed, and the training is stopped until the iterative stop condition is reached, and a trained generative adversarial network is obtained; Fake detection.
  • Fig. 1 is the application environment diagram of the image authenticity detection method in one embodiment
  • FIG. 2 is a schematic flowchart of a method for detecting authenticity of images in one embodiment
  • FIG. 3 is a schematic diagram of a network structure of a generator in an embodiment
  • Fig. 4 is a schematic diagram of face image extraction in one embodiment
  • 5 is a schematic diagram of a false area label in one embodiment
  • FIG. 6 is a schematic diagram of adversarial training based on a generator, a false region discriminator, and a visual truth in one embodiment
  • FIG. 7 is a schematic flowchart of an image authenticity detection method in a specific embodiment
  • FIG. 8 is a schematic flowchart of a method for detecting authenticity of an image in another specific embodiment
  • FIG. 10 is a schematic flowchart of an image authenticity detection method in another specific embodiment
  • FIG. 11 is a structural block diagram of an image authenticity detection method and apparatus in one embodiment
  • FIG. 12 is a structural block diagram of an image authenticity detection method device in another embodiment
  • FIG. 13 is a structural block diagram of an image authenticity detection method and apparatus in another embodiment
  • Figure 14 is a diagram of the internal structure of a computer device in one embodiment.
  • FIG. 1 is an application environment diagram of an image authenticity detection method in one embodiment.
  • the image authenticity detection method is applied to an image authenticity detection system.
  • the image authenticity detection system includes a terminal 102 and a server 104 .
  • the terminal 102 and the server 104 are connected through a network.
  • the terminal 102 may specifically be a desktop terminal or a mobile terminal, and the mobile terminal may specifically be at least one of a mobile phone, a tablet computer, a notebook computer, and the like.
  • the server 104 can be implemented by an independent server or a server cluster composed of multiple servers. Both the terminal 102 and the server 104 can be independently used to execute the image authenticity detection method provided in the embodiment of the present application.
  • the terminal 102 and the server 104 may also be used in cooperation to execute the image authenticity detection method provided in the embodiments of the present application.
  • the above server may be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud service, cloud database, cloud computing, cloud function, cloud storage, network Cloud servers for basic cloud computing services such as services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.
  • the terminal may be a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto.
  • the terminal and the server may be directly or indirectly connected through wired or wireless communication, which is not limited in this application.
  • Computer vision technology (Computer Vision, CV) refers to the use of cameras and computers instead of human eyes to detect, recognize, track and measure objects and other machine vision, and further do graphics processing to make computer processing more suitable for human eyes to observe or transmit to. Image of instrument detection.
  • an image authenticity detection method is provided, which is described by applying the method to a computer device, and the computer device may specifically be the terminal or server in FIG. 1 .
  • the image authenticity detection method includes the following steps:
  • Step S202 acquiring an image to be detected.
  • the user can directly upload the image to be detected to the computer device, so that the computer device can perform authenticity detection on the image to be detected.
  • the authenticity detection result of the image to be detected may include that the image to be detected is a false image and the detected image is a real image.
  • the to-be-detected image is a fake image, it means that part or all of the image content in the to-be-detected image has been edited; when the to-be-detected image is a real image, it means that the image content in the to-be-detected image has not been edited.
  • Step S204 the image to be detected is input into the generator of the generative adversarial network, and the generator outputs an artifact image corresponding to the image to be detected; the artifact image is used to represent the difference between the image to be detected and the real image.
  • the generative adversarial network also includes a discriminator in the training phase; in the training phase, the generator is used to output a prediction artifact image corresponding to the sample image, and generate a fitting image based on the prediction artifact image; Authenticity discrimination to assist the generator to learn the difference features between fake images and real images.
  • the generative adversarial network is a deep learning model including a generator (Generative Model) and a discriminator (Discriminative Model), which obtains credible output through mutual game learning between the generator and the discriminator in the framework.
  • the trained generator refers to a model with the ability to extract the artifact information in the image to be detected.
  • the sample image can be used as the training data, and it can be obtained by learning and training to separate the artifact information from the sample image.
  • the discriminator is a model capable of discriminating the reliability of the fitted image formed by the output artifact image of the generator.
  • the discriminator may be a model obtained by learning and training the fitted image as training data.
  • the generator in the use stage, it can be used to detect the authenticity of the image; in the training stage, it is used to learn the artifact information in the image, and generate a predicted artifact map according to the learned artifact information and fitted images.
  • the discriminator in the training phase, it can be used to discriminate the authenticity of the fitted image output by the generator based on the prediction artifact image, so that the generator can adjust the extracted artifact information according to the authenticity discrimination result.
  • the difference features between fake images and real images are learned.
  • the artifact image is image data representing the difference between the image to be detected and the real image, which can be used to locate the edited image content in the image to be detected at the pixel level.
  • the artifact information is the information included in the artifact image and used to represent the edited image content, which may specifically be the pixel value of each pixel in the artifact image.
  • the fitted image is a synthetic image, and specifically, an image that is close to the real image and is synthesized by the image to be detected and the artifact image.
  • the fitted image may be an image obtained by removing the corresponding artifact information in the artifact image from the to-be-detected image, that is, after the to-be-detected image is restored, the obtained image does not contain editing Image data for the content.
  • the computer equipment can input the image to be detected into the generator of the generative adversarial network, the generator extracts the image features in the image to be detected, and based on the image features, determines the edited image in the image to be detected.
  • the false area corresponding to the image content, and the difference between the edited image content and the real image content is predicted based on the image features.
  • the generator generates a corresponding artifact image according to the false area and the difference between the predicted edited image content and the real image content.
  • the image feature is the data that can reflect the true and false features of the image.
  • the image features may reflect one or more kinds of feature information, such as color value distribution, brightness value distribution, and correlation between pixel points of the image to be detected.
  • the false area refers to the image area corresponding to the edited image content in the image.
  • the user can beautify and adjust the face in the face image to obtain an edited image, and the image can be used as the image to be detected.
  • the generator can determine that the edited image content in the to-be-detected image is a face based on the image features extracted from the to-be-detected image, and accordingly, can determine that the false area corresponding to the edited image content is a face area. Further, the generator obtains a preset initial artifact image, and predicts the degree of beautification that the user performs beautification adjustment on the face according to the image features, and according to the degree of beautification, analyzes the target area corresponding to the false area in the initial artifact image.
  • the pixel value of each pixel is adjusted to obtain an artifact image corresponding to the image to be detected.
  • the computer device removes the artifact information in the artifact image from the image to be detected, the original face image without beautification adjustment can be obtained, that is, a fitted image corresponding to the image to be detected is obtained.
  • the initial artifact image may be a full black image with the same size as the image to be detected.
  • the computer equipment obtains the sample images, and inputs the sample images into the generator to be trained.
  • the generator to be trained determines the prediction artifact image corresponding to the sample image, and determines the corresponding image according to the sample image and the prediction artifact image. fitted image.
  • the computer device uses the fitted image as the input of the discriminator, and the discriminator discriminates the authenticity of the fitted image generated by the generator, and feeds back the authenticity discrimination result to the generator, so that the generator can receive The obtained authenticity discrimination result, adjust the model parameters accordingly until the discriminator discriminates the authenticity of the fitted image generated by the generator as true. In this way, the essential difference between fake images and real images is learned based on the discriminator-assisted generator.
  • the generation quality of the fitted image can be measured based on the discriminator's discrimination result, only when the generator learns the essential difference between the fake image and the real image, can the real and reliable artifact information be determined based on the essential difference, thereby According to the real and reliable artifact information, output a fitting image that is identified as real and reasonable by the discriminator, and then in the use stage, the artifact information output by the generator can well characterize the difference between the image to be detected and the real image. .
  • the generative adversarial network may be a GAN (Generative Adversarial Networks, generative adversarial network) network, or may be an improved generative adversarial network on this basis.
  • GAN Geneative Adversarial Networks, generative adversarial network
  • the generator and discriminator may include various types of machine learning models.
  • Machine learning models can include linear models and nonlinear models.
  • machine learning models may include regression models, support vector machines, decision tree-based models, Bayesian models, and/or neural networks (eg, deep neural networks).
  • neural networks may include feedforward neural networks, recurrent neural networks (eg, long short-term memory recurrent neural networks), convolutional neural networks, or other forms of neural networks.
  • the generator and discriminator are not necessarily limited to neural networks, and can also include other forms of machine learning models.
  • the generator includes an encoding network and a decoding network; the above-mentioned outputting an artifact image corresponding to the image to be detected by the generator includes: extracting image features in the image to be detected based on the encoding network; The image features are decoded to obtain an artifact image corresponding to the image to be detected.
  • the generator can be any Encoder-Decoder (encoding-decoding) network structure, wherein the encoding network in the generator is used to extract the image features in the image to be detected, and the decoding network uses According to the image features, an artifact image corresponding to the image to be detected is parsed, and the authenticity detection result of the image to be detected is determined according to the artifact image.
  • the image to be detected is a real image, it indicates that the image content in the image to be detected has not been replaced or edited; when the image to be detected is a false image, it indicates that the image content in the image to be detected has been replaced or edited.
  • FIG. 3 shows a schematic diagram of the network structure of the generator in one embodiment.
  • Step S206 determining the authenticity detection result of the image to be detected based on the artifact image.
  • authenticity detection is an image processing task oriented by machine learning models.
  • machine learning models are often used to identify more reliable differential features, so as to determine the authenticity of the image to be detected according to the differential features. .
  • the computer device determines the artifact information in the artifact image, and detects the authenticity of the image to be detected according to the artifact information. For example, the computer device determines the area size of the false area in the image to be detected according to the artifact information in the artifact image, and when the area size of the false area is greater than or equal to the preset area threshold, the image to be detected is determined as a false image; when When the area size of the false area is smaller than the preset area threshold, the image to be detected is determined as a real image.
  • the computer device determines whether there are editing traces in the image to be detected according to the artifact information in the artifact image, and if there is editing trace, the image to be detected is determined to be a false image; The image is judged to be a real image.
  • This embodiment is not limited herein.
  • determining the authenticity detection result of the image to be detected based on the artifact image includes: determining the pixel value of each pixel included in the artifact image; determining the pixel value corresponding to the artifact image based on the pixel value of each pixel When the average pixel value is greater than or equal to the pixel threshold, it is determined that the image to be detected is a false image; when the average pixel value is less than the pixel threshold, it is determined that the image to be detected is a real image.
  • the computer device counts the total number of pixels included in the artifact image, determines the pixel value of each pixel, and superimposes the pixel value of each pixel to obtain the total pixel value. Further, the computer equipment can divide the total pixel value by the total number of pixels to obtain an average pixel value corresponding to the artifact image, and when the average pixel value is greater than or equal to a preset pixel threshold, determine the image to be detected as a false image; when When the average pixel value is less than the preset pixel threshold, the image to be detected is determined as a real image.
  • the calculated average pixel value is zero, which is less than the preset pixel threshold , so that the computer device determines the image to be detected that the artifact image is completely black as a real image; when the artifact image output by the generator is not an all-black image, the average pixel value at this time is not zero, which is greater than the preset pixel value. value, so that the computer device determines the image to be detected whose artifact image is not completely black as a false image.
  • the preset pixel threshold may be customized as required, for example, the pixel threshold may be determined according to the accuracy of the artifact image, or the pixel threshold may be determined according to the accuracy requirements of image authenticity detection, etc., which are not limited in this embodiment of the present application.
  • the pixel value of each pixel point may be a value represented by three primary colors of RGB (red, green, and blue), or may be a value determined based on other color dimensions, etc., which is not done in this embodiment of the present application. limited.
  • the computer device may detect pixel values in the artifact image based on a preset pixel value detection algorithm, so as to determine the pixel value of each pixel.
  • the pixel value detection algorithm can be customized as needed. For example, the pixel value of each pixel in the artifact image can be read based on the imread function in matlab, or the pixel value in the artifact image can be read based on the at function in OpenCV. The pixel value of the point.
  • the above-mentioned image authenticity detection method when the to-be-detected image is obtained, by inputting the to-be-detected image into the generator in the adversarial network, a real and reasonable output based on the generator can be used to characterize the difference between the to-be-detected image and the real image In this way, the authenticity detection result of the image to be detected can be determined based on the artifact information in the artifact image.
  • the generator can learn the most essential distinguishing features between real images and fake images through adversarial training with the discriminator, compared with the traditional method of detecting some specific flaws in the image, the Authenticity detection, this application does not need to rely on specific defects, and when there is no specific defect in the image to be detected, the authenticity detection result of the image to be detected can still be determined by determining the distinguishing feature between the image to be detected and the real image, so , which greatly improves the generalization of image detection.
  • the trained generator can The essential difference features between the fake image and the real image are learned, so as to generate real and reasonable artifact information, and then accurately judge the image to be detected.
  • the image to be detected includes a face image to be detected
  • acquiring the image to be detected includes: acquiring a video to be detected including a human face; analyzing the video to be detected to obtain a corresponding video frame; Face detection, and based on the results of the face detection, the face image including the face area is cropped from the video frame.
  • the above-mentioned image authenticity detection method can be specifically used to perform authenticity detection on a face image.
  • the computer device may acquire the video to be detected including the human face, and analyze the video to be detected to obtain corresponding video frames.
  • the video to be detected may specifically be a monitoring video collected based on a monitoring device or a media video downloaded from the Internet, etc., which is not limited in this embodiment.
  • the computer device performs face detection on the video frame based on the face detection algorithm to obtain a face image.
  • the face image refers to a partial image of the region where the face is located in the video frame.
  • the area where the face is located is the position of the face in the video frame.
  • Computer equipment can identify face regions in video frames through face detection algorithms.
  • the face detection algorithm can be customized as needed, such as the OpenCV face detection algorithm, the system's own face detection algorithm, or the Youtu face detection algorithm, etc.
  • the face detection algorithm can return whether the video frame contains a face and a specific face area, such as identifying the position of the face by a rectangular frame.
  • the computer device can cut out the video frame along the face area to obtain the face image.
  • One or more face images can be captured from a single video frame.
  • the face image may only include images of the face region of the human face.
  • FIG. 4 shows a schematic diagram of face image extraction in one embodiment.
  • the monitoring device can detect whether there is a human face in the video, and if there is a human face, the video is sent to the computer device as the video to be detected, and the computer device obtains information including human faces. The video of the face to be detected.
  • video frames corresponding to multiple frames can be obtained, so that the computer device can perform authenticity detection on each video frame according to the above-mentioned image authenticity detection method, or only Authenticity detection is performed on some video frames.
  • This embodiment is not limited herein. Since the authenticity of the face image seriously affects the accuracy of security detection, by determining the face image in the video to be detected and detecting the authenticity of the face image, the security system can reduce the false determination of the fake face image as real by the security system. face images, and the probability of mistaking the criminals corresponding to the fake face images as legitimate citizens, thus greatly improving the security of the security system.
  • the corresponding video frame when the to-be-detected video frame is obtained, the corresponding video frame can be obtained by analyzing the to-be-detected video; by obtaining the corresponding video frame, a face image including a face area can be cut out from the video frame. , so that the computer device can only pay attention to the face image including the face area, without paying attention to the non-face area, thus improving the efficiency of image authenticity detection.
  • the above-mentioned image authenticity detection method further includes the step of adding label information to the false image, and the step specifically includes: when the authenticity detection result of the image to be detected indicates that the image to be detected is a false image, obtaining the corresponding Marking information; adding the marking information to the image to be detected; the marking information is used to characterize the image to be detected as a false image.
  • the computer device may acquire preset tag information for distinguishing the fake image from the real image, and add the tag information to the to-be-detected image in the image.
  • the marking information and the method of adding the marking information to the image to be detected can be customized as required.
  • the marking information can be set as the character "false image", so that the character "false image” can be added to the image to be detected. In the image name, or the character "false image” is added to the image to be detected in the form of a watermark.
  • the computer device may count the number of video frames added with tag information in the video to be detected, and determine whether it is necessary to add a video frame for distinguishing false information in the video to be detected according to the number of video frames obtained by statistics. Distinguishing information between video and real video. For example, when the number of video frames to be detected to which tag information is added is greater than or equal to a preset number threshold, it indicates that the video to be detected is a false video, so that the computer device can add distinguishing information to the video to be detected, so that the user can Based on the distinguishing information in the video, the authenticity of the video is determined. This increases the credibility of the video content.
  • the computer device when the computer device can determine that the image to be detected is a fake image, it can further analyze the source of the fake image, for example, the fake image is specifically edited by those image processing techniques, or the fake image is specifically obtained through Which software to edit get and so on. Furthermore, the computer device may acquire corresponding marker information based on the source information related to the fake image, and add the marker information to the image to be detected.
  • the image authenticity detection methods provided by the various embodiments of this application can help the platform to conduct video screening, and add significant marks to the detected fake videos, such as "made by A application", to ensure the credibility of the video content and ensure social security. credibility.
  • the image authenticity detection methods provided by the embodiments of the present application are helpful for the public security judicial evidence verification, and prevent criminal suspects from falsifying evidence by using face editing and other related technologies. It can be applied to products such as face verification, judicial verification tools, or image and video authenticity verification.
  • marking information for distinguishing between real images and fake images can be added to the images to be detected, so as to screen and mark fake images from massive image data. Moreover, the authenticity of the image can be quickly determined based on the label information in the future, which further improves the efficiency of image authenticity detection.
  • the above-mentioned image authenticity detection method further includes the step of training the generative adversarial network, and the step specifically includes: acquiring sample images and image labels corresponding to each sample image; inputting each of the sample images into To the generator to be trained in the generative adversarial network, the generator to be trained outputs a prediction artifact image corresponding to each sample image; according to the prediction artifact image, a fitting image corresponding to the sample image is generated; Image labels and fitted images perform iterative adversarial training on the generator and discriminator in the generative adversarial network until the iterative stop condition is reached.
  • the sample images are images used for training the generative adversarial network, and may specifically include real sample images and fake sample images.
  • the real sample image is image data without image editing
  • the fake sample image is image data obtained after image editing.
  • the traditional method mainly determines whether the image to be detected is a fake image by detecting some specific defects in the image. It is easy to find that this method does not generalize well.
  • the collected images to be inspected often do not have specific defects, which makes it difficult to detect the authenticity of the images to be inspected. , the detection result of image authenticity detection is distorted due to failure to detect specific defects.
  • the embodiments of this application construct a generator and a discriminator, and perform joint adversarial training on the generator and discriminator, so that the generator can learn real images and fake images.
  • the essential difference between images is used for image authenticity detection.
  • the computer device can use the trained discriminator to determine whether the face image is an edited fake image before making payment based on the face image, and when determining that the face image is a fake image , suspend face payment to improve the security of face payment.
  • computer equipment can use the trained discriminator to perform image authenticity detection on the video frames in the surveillance video stream in real time, and when the surveillance video stream is determined to be a fake video based on the image authenticity detection results, it can be detected in time. Issue a warning notice to security personnel.
  • the computer device can input the sample image to the generator in the generative adversarial network, and the generator to be trained encodes and decodes the sample image, thereby outputting prediction artifacts picture.
  • the generator can also generate a corresponding fitted image based on the predicted artifact image and the sample image.
  • the computer device performs iterative adversarial training on the generator and the discriminator in the generative adversarial network through the sample image, the image label, and the fitted image, and stops the training when the iteration stop condition is reached.
  • the training stop condition may be reaching the preset number of iterations, reaching the preset iteration time, or the model performance of the generator and the discriminator reaching the preset performance, etc.
  • developers can download a large number of images from the network and edit some of the images to obtain real sample images and fake sample images.
  • the computer device can choose to input real sample images and fake sample images to the generator to be trained in turn, or to input real sample images and dummy sample images are input in pairs.
  • both the generator and the discriminator to be trained may be models composed of artificial neural networks.
  • Artificial Neural Networks also referred to as Neural Networks (NNs) or Connection Models.
  • the artificial neural network can abstract the human brain neuron network from the perspective of information processing to establish a certain model and form different networks according to different connection methods. In engineering and academia, it is often simply referred to as neural network or neural-like network.
  • the neural network model may be a CNN (Convolutional Neural Network, Convolutional Neural Network) model, a DNN (Deep Neural Network, Deep Neural Network) model, an RNN (Recurrent Neural Network, Recurrent Neural Network) model, and the like.
  • the convolutional neural network includes a convolutional layer (Convolutional Layer) and a pooling layer (Pooling Layer).
  • a deep neural network includes an input layer, a hidden layer and an output layer, and the layers are fully connected.
  • a recurrent neural network is a neural network that models sequence data, that is, the current output of a sequence is also related to the previous output. The specific manifestation is that the network will memorize the previous information and apply it to the calculation of the current output, that is, the nodes between the hidden layers are no longer unconnected but connected, and the input of the hidden layer not only includes the output of the input layer Also includes the output of the hidden layer at the previous moment.
  • Recurrent neural network models such as LSTM (Long Short-Term Memory Neural Network) model, BiLSTM (Bi-directional Long Short-Term Memory, bidirectional long and short-term memory neural network) and so on.
  • the generator and the discriminator are trained against each other, so that the trained generator can learn the most essential difference between the real image and the fake image, so as to meet the requirements of the real scene. Defective image detection requirements.
  • generating a fitting image corresponding to the sample image according to the prediction artifact image includes: performing pixel matching on the sample image and the corresponding prediction artifact image, and determining that the sample image and the prediction artifact image correspond to the same The first pixel point and the second pixel point of the pixel position; the pixel value of the first pixel point is subtracted from the pixel value of the second pixel point at the same pixel position to obtain the fitted pixel value corresponding to the corresponding pixel position; The fitted pixel values corresponding to the pixel positions respectively determine the fitted image of the sample image.
  • the generator can perform pixel matching on the sample image and the corresponding predicted artifact image, so as to determine, according to the pixel matching result, that the sample image and the artifact image correspond to the same
  • the first pixel point and the second pixel point of the pixel position wherein, for the convenience of description, the pixel in the sample image is referred to as the first pixel, and the pixel in the prediction artifact image is referred to as the second pixel.
  • the generator traverses each pixel position, subtracts the pixel value of the first pixel point from the pixel value of the second pixel point with the same position, and obtains the fitted pixel value corresponding to the corresponding pixel position, and each pixel position corresponds to The fitted pixel value of , as the pixel value of each pixel in the fitted image corresponding to the sample image, so as to determine the fitted image of the sample image.
  • the pixel value of the first pixel point can also be added to the pixel value of the second pixel point corresponding to the same pixel position to obtain the fitted pixel value corresponding to the corresponding pixel position, and according to the pixel value based on each pixel
  • the fitted pixel values corresponding to the respective positions are used to determine the fitted image of the sample image; or the pixel value of the first pixel point is added/subtracted to the pixel value of the second pixel point corresponding to the same pixel position to obtain the corresponding pixel position.
  • the corresponding fitted pixel values are processed, for example, by inputting the fitted pixels into a preset fitted image processing network to obtain a fitted image of the sample image. This embodiment is not limited herein.
  • the generator only needs to subtract the pixel value of the first pixel point from the pixel value of the second pixel point at the same pixel position to obtain the corresponding fitted image. In this way, the quality of the fitted image is greatly improved. Generation efficiency.
  • iterative adversarial training is performed on the generator and the discriminator in the generative adversarial network based on sample images, image labels, and fitted images, and the training is stopped when an iterative stop condition is reached, including: based on sample images, images The label and the fitted image perform the first training on the discriminator to be trained in the generative adversarial network, and stop when the first training stop condition is reached; input the fitted image into the discriminator obtained through the first training, in order to improve the fit The authenticity of the image is identified, and the authenticity prediction result of the fitted image is output; the generator to be trained in the generative adversarial network is subjected to second training according to the authenticity prediction result of the fitted image, until the second training stop condition is reached; Return to the first training step of the discriminator to be trained in the generative adversarial network based on the sample image, the image label and the fitted image, and continue to perform the training until the iteration stop condition is reached, and the trained generative adversarial network is obtained.
  • the computer device may alternately train the generator and the discriminator until the iteration stop condition is reached to end the training.
  • the computer equipment can add a gradient inversion layer after the generator, and the gradient inversion layer connects the generator and the discriminator in series to form a generative adversarial network.
  • the computer equipment fixes the model parameters of one of the generator and discriminator models, sets the model with fixed model parameters to a fixed state, and sets the model without fixed model parameters to a non-fixed state , and correspondingly adjust the model parameters of the model in the non-fixed state.
  • the computer equipment When the model parameters of the model in the non-fixed state are adjusted, the computer equipment will set the model in the fixed state to the non-fixed state, and the model in the non-fixed state will be set to the fixed state, and return the corresponding adjustment model in the non-fixed state steps of the model parameters until the iteration stop condition is reached.
  • the computer device when the model parameters in the generator are fixed, the computer device correspondingly adjusts the model parameters of the discriminator based on the output of the generator until the first training stop condition is reached. Further, the computer device turns to fix the model parameters of the discriminator that reach the first training stop condition, and adjusts the model parameters of the generator correspondingly based on the output of the discriminator until the second training stop condition is reached. Repeat this until the iteration stop condition is reached.
  • the computer equipment inputs the sample image and the fitted image as input images to the discriminator to be trained, and the discriminator to be trained checks the authenticity of the input image. identify. Further, the discriminator to be trained determines the discriminator loss based on the discrimination result and the image label, determines the descending gradient through the discriminator loss function, and adjusts the model parameters correspondingly according to the descending gradient until the first training stop condition is reached.
  • the first training stop condition may be that the difference between the identification result and the image label reaches a preset minimum value, or the number of training iterations reaches a preset number of iterations, or the identification performance of the discriminator reaches a preset performance, or the like.
  • the computer equipment inputs the fitted image output by the generator into the discriminator obtained through the first training, and the discriminator obtained through the first training matches the fitting image.
  • the generator to be trained adjusts the model parameters according to the authenticity prediction result until the second training stop condition is reached.
  • the second training stop condition may be that the authenticity prediction result is true, or the number of training iterations reaches a preset number of iterations, or the performance of the generator reaches a preset performance, or the like.
  • the generator and discriminator in the generative adversarial network support flexible and independent selection, and each model alone can achieve the optimal configuration without compromising the performance of any one link.
  • the generator and the discriminator involved in this application are free to choose special models that are good at their respective fields.
  • the generative adversarial network is jointly trained based on the corresponding loss functions of the generator and the discriminator, so that both the generator and the discriminator in the generative adversarial network can achieve good performance.
  • the extracted artifact images have good reliability.
  • the sample image includes a real sample image and a fake sample image;
  • the image label includes a fake area label and an image authenticity label;
  • the discriminator includes a fake area discriminator and a visual real discriminator; based on the sample image, the image label and the The first training is performed on the discriminator to be trained in the generative adversarial network by fitting the image, and it stops when the first training stop condition is reached.
  • the sample image and the fitted image are respectively input to the visual reality discriminator as input images, and output the first visual reality prediction result corresponding to the input image; based on the first visual reality prediction result corresponding to the input image and the image authenticity label, determine the first A visual real loss; construct a discriminator loss function according to the first false area loss and the first visual real loss; perform the first training on the false area discriminator and the visual real discriminator through the discriminator loss function until the first training stop condition is reached stop.
  • the image labels include false area labels and image authenticity labels; false area labels refer to labels used to identify false areas in the sample image, for example, the false area labels can be a rectangular box used to frame the false areas Wait.
  • the image authenticity label refers to the information used to characterize the authenticity of the sample image. For example, when the sample image is a real image, the authenticity label of the sample image can be set to "1"; when the sample image is a fake image, The authenticity label of this sample image can be set to "0".
  • the embodiments of the present application construct a false region discriminator and a visual real discriminator.
  • the false region discriminator is used to identify the false regions in the fitted image.
  • the fitted image output by the generator should not contain false regions, so the false region discriminator determines the false regions in the fitted image. Is empty.
  • the visual real discriminator is used to discriminate the authenticity of the fitted image, that is, the visual real discriminator is used to discriminate whether the fitted image is a real image. Under ideal conditions, the fitted image output by the generator should be close to the real image, so that the visual real The discriminator judges the authenticity of the fitted image as true.
  • the developer sets an image authenticity label on the false sample image, determines an image editing area in the false sample image, and sets a false area label based on the image editing area.
  • the computer equipment inputs the real sample image and the fake sample image to the fake area discriminator, and the fake area in the real sample image and the fake sample image is respectively determined by the fake area discriminator, and based on the fake area
  • the region outputs the first false region prediction results corresponding to the real sample image and the false sample image respectively.
  • the false area discriminator determines the difference between the first false area prediction result and the corresponding false area label, and determines the first false area loss according to the difference between the first false area prediction result and the corresponding false area label.
  • the first false region loss may specifically be mean square error, absolute value error, Log-Cosh loss, quantile loss, ideal quantile loss, or cross-entropy loss.
  • the computer equipment inputs the real sample image and the fitted image as input images to the visual reality discriminator respectively, and discriminates the authenticity of the input image based on the visual reality discriminator to obtain the first visual reality prediction result.
  • the visual truth discriminator determines the difference between the first visual truth prediction result and the corresponding image authenticity label, and determines the first visual truth loss according to the difference between the first visual truth prediction result and the corresponding image authenticity label.
  • the first visual real loss as the cross entropy loss as an example
  • the visual real discriminator is DVisual
  • the first visual real prediction result is DVisual(x)
  • the image authenticity label is cls gt
  • the cross entropy loss is BCE
  • the computer equipment fuses the first false area loss and the first visual real loss through a variety of preset logical operations to obtain a discriminator loss function, and performs the false area discriminator and the visual real discriminator through the discriminator loss function.
  • the training is stopped until the first training stop condition is reached.
  • the preset logical operation includes, but is not limited to, four mixed operations, weighted summation, or machine learning algorithms, and the like.
  • the weighting factor can be a value set based on experience or experiments, such as 0.1.
  • the trained false area discriminator can discriminate the false area in the fitted image output by the generator, so as to facilitate the generator to learn more It is accurate artifact information; it enables the visual real discriminator to discriminate the authenticity of the fitted image output by the generator, so as to promote the generator to output a more realistic fitted image; the two complement each other, thereby improving the reliability of the generator. sex.
  • the false region discriminator is mainly to make the fitted image more realistic, so it can also be replaced by a two-class discriminator or a depth discriminator.
  • the step of generating the false area label includes: setting the pixel value of the first preset image to a first value to obtain the false area label of the real sample image; the size of the first preset image and the real sample image The same; determine the false area in the false sample image; set the pixel value of the target area corresponding to the false area in the second preset image to the second value, and set other areas in the second preset image except the target area
  • the pixel value of is set to the first value to obtain the false area label of the false sample image; wherein, the second preset image and the false sample image have the same size, and the second value is different from the first value.
  • the computer device acquires the first preset image, and sets the pixel value of each pixel in the first preset image to the first value. For example, referring to FIG. 5 , the computer device sets the pixel value of each pixel in the first preset image to (0) to represent black, thereby obtaining the false area label shown in FIG. 5 .
  • the computer device determines a fake area in the fake sample image, acquires a second preset image, and sets the pixel value of the target area corresponding to the fake area in the second preset image to the first A binary value, setting the pixel values of other regions except the target region in the second preset image as the first value.
  • the computer device sets the pixel value of the target area to (1) to indicate white, and sets the pixel value of the rest of the area except the target area to (0) to indicate black.
  • FIG. 5 shows a schematic diagram of false area labels in one embodiment.
  • first preset image and the second preset image have the same size as the sample image; the second value is different from the first value; the first preset image and the second preset image can be the same or different. .
  • the computer device detects the face contour in the fake sample image through a preset face detection algorithm, and determines the fake area according to the face contour , and generate corresponding false region labels according to false regions.
  • the authenticity prediction result includes a second false region prediction result and a second visual reality prediction result
  • the fitted image is input into the discriminator obtained through the first training, so as to perform authenticity analysis on the fitted image
  • Identifying and outputting the authenticity prediction result of the fitted image includes: inputting the fitted image into the false area discriminator obtained through the first training, and outputting a second false area prediction result corresponding to the fitted image;
  • the image is input into the visual reality discriminator obtained through the first training, and a second visual reality prediction result corresponding to the fitted image is output.
  • the computer equipment inputs the sample image to the generator, the generator outputs the fitting image corresponding to the sample image, and the fitting image is input to the generator through the A trained false region discriminator and a visually real discriminator.
  • the false area discriminator and the visual real discriminator discriminate the fitted image according to the above method, and output the second false area prediction result and the second visual real prediction result correspondingly according to the discriminant result.
  • the generator model parameters can be correspondingly adjusted according to the discriminant result, thereby obtaining a credible generator.
  • the second training is performed on the generator to be trained in the generative adversarial network according to the prediction result of the authenticity of the fitted image, until the second training stop condition is reached, and the second training is stopped, including: based on the prediction result corresponding to the fitted image The second false area prediction result and the false area label corresponding to the real sample image are used to determine the second false area loss; based on the second visual real prediction result corresponding to the fitted image and the image authenticity label corresponding to the real sample image, determine The second visual real loss; the generator loss function is constructed according to the second false region loss and the second visual real loss; the generator to be trained in the generative adversarial network is trained by the generator loss function until the second training stop condition is reached stop.
  • the generator determines the difference between the second false area prediction result and the corresponding real sample image, and determines the second false area loss according to the difference between the second false area prediction result and the corresponding real sample image.
  • zeromap can be a full black image with the same size as the real sample image.
  • the generator determines the difference between the second visual real prediction result and the image authenticity label corresponding to the real sample image, and determines the difference between the second visual real prediction result and the image authenticity label corresponding to the real sample image.
  • the computer device fuses the second false area loss and the second visual real loss through a variety of preset logical operations to obtain a generator loss function, and trains the generator through the generator loss function until the second training is achieved. stop on stop condition.
  • the generator can be constrained by the second false region loss and the second visual truth loss
  • the fitting output of the generator after joint training with the second false region loss and the second visual truth loss Not only can the image be infinitely close to the real image, but the false area it contains can be empty.
  • the above-mentioned image authenticity detection method further includes: determining a predicted artifact image corresponding to the real sample image; based on the difference between the predicted artifact image corresponding to the real sample image and the fake region label corresponding to the real sample image The difference is determined to determine the artifact loss; the generator loss function is constructed according to the second false region loss and the second visual real loss, including: constructing the generator loss function according to the artifact loss, the second false region loss and the second visual real loss.
  • the predicted artifact image output by the generator should be consistent with the fake region label corresponding to the real sample image. Therefore, it is possible to add a fake image to the real sample image.
  • the generator is trained based on the artifact loss, so that the predicted artifact image corresponding to the real sample image output by the trained generator can be consistent with the false region label corresponding to the real sample image.
  • the computer device determines the difference between the predicted artifact image corresponding to the real sample image and the false region label corresponding to the real sample image, and determines according to the difference Corresponding artifact loss.
  • the computer equipment fuses the artifact loss, the second false region loss and the second visual real loss through a variety of preset logical operations to obtain a generator loss function, and trains the generator through the generator loss function until Stop when the second training stop condition is reached.
  • FIG. 6 shows a schematic diagram of adversarial training based on the generator, the false region discriminator and the visual truth in one embodiment.
  • the generator when the generator is trained for the second time, real sample images and fake sample images can be input into the generator as sample images, and the image features in the sample images are extracted by the encoding network in the generator, and the The decoder in the generator decodes the extracted image features, thereby obtaining a prediction artifact image corresponding to the real sample image and a prediction artifact image corresponding to the fake sample image.
  • the generator subtracts the corresponding prediction artifact image from the real sample image, and subtracts the corresponding prediction artifact image from the fake sample image to obtain fitting images corresponding to the real sample image and the fake sample image respectively, and uses
  • the fitted image is input to the false area discriminator and the visual real discriminator, and the authenticity of the input fitted image is discriminated by the false area discriminator and the visual real discriminator, and the second false area prediction result and the second visual real prediction result are obtained.
  • the second false area prediction result and the second visual real prediction result are returned to the generator, so that the generator adjusts the model parameters correspondingly according to the returned second false area prediction result and the second visual real prediction result.
  • the computer equipment When training the false area discriminator and the visual real discriminator, the computer equipment inputs the sample image to the false area discriminator, the false area discriminator outputs the first false area prediction result corresponding to the sample image, and the real sample image And the fitted image is input to the visual real discriminator as the input image, and the corresponding first visual real prediction result is output by the visual real discriminator.
  • the computer device determines the first false region loss based on the first false region prediction result and the false region label corresponding to the sample image, and determines the first visual reality based on the first visual reality prediction result and the image authenticity label corresponding to the input image loss, and construct a discriminator loss function according to the first false area loss and the first visual real loss; perform the first training on the false area discriminator and the visual real discriminator through the discriminator loss function until the first training is reached stop on stop condition.
  • the computer device alternates the first training and the second training until the iteration stop condition is reached.
  • the trained generator can accurately distinguish between real images and fake images, thereby improving the accuracy of image authenticity detection.
  • the image authenticity detection method provided by the present application includes the following steps:
  • S702 Acquire a video to be detected including a human face, and parse the video to be detected to obtain a corresponding video frame.
  • S704 perform face detection on the video frame, and cut out a face image including a face region from the video frame based on the result of the face detection, to obtain an image to be detected.
  • the network also includes a discriminator in the training phase; in the training phase, the discriminator is used to identify the authenticity of the fitted image generated based on the predicted artifact image output by the generator, so as to assist the generator to learn the difference between the fake image and the real image. Differential characteristics.
  • S708 Determine the pixel value of each pixel included in the artifact image, and determine an average pixel value corresponding to the artifact image based on the pixel value of each pixel.
  • the above-mentioned image authenticity detection method when the to-be-detected image is obtained, by inputting the to-be-detected image into the generator in the adversarial network, a real and reasonable output based on the generator can be used to characterize the difference between the to-be-detected image and the real image In this way, the authenticity detection result of the image to be detected can be determined based on the artifact information in the artifact image.
  • the generator can learn the most essential distinguishing features between real images and fake images through adversarial training with the discriminator, compared with the traditional method of detecting some specific flaws in the image, the Authenticity detection, this application does not need to rely on specific defects, and when there is no specific defect in the image to be detected, the authenticity detection result of the image to be detected can still be determined by determining the distinguishing feature between the image to be detected and the real image, so , which greatly improves the generalization of image detection.
  • the trained generator can The essential difference features between the fake image and the real image are learned, so as to generate real and reasonable artifact information, and then accurately judge the image to be detected.
  • the image authenticity detection method provided by the present application includes the following steps:
  • S802 Obtain sample images and image labels corresponding to each sample image; the image labels include false area labels and image authenticity labels.
  • the sample images are respectively input to the false area discriminator, and the first false area prediction result corresponding to the sample image is output through the false area discriminator; based on the first false area prediction result and the false area label corresponding to the sample image, determine the first false area A false area loss.
  • the sample image includes a real sample image, the real sample image and the fitted image are respectively input to the visual reality discriminator as input images, and a first visual reality prediction result corresponding to the input image is output; based on the first visual reality corresponding to the input image
  • the real prediction results and image authenticity labels determine the first visual real loss.
  • S820 Determine the predicted artifact image corresponding to the real sample image; determine the artifact loss based on the difference between the predicted artifact image corresponding to the real sample image and the false region label corresponding to the real sample image.
  • the network also includes a discriminator in the training phase; in the training phase, the discriminator is used to identify the authenticity of the fitted image generated based on the predicted artifact image output by the generator, so as to assist the generator to learn the difference between the fake image and the real image. Differential characteristics.
  • the image authenticity detection method provided by the present application includes the following steps:
  • S908 Obtain sample images and false area labels and image authenticity labels corresponding to each sample image.
  • S910 Input each sample image to a generator to be trained in the generative confrontation network, and output a prediction artifact image corresponding to each sample image through the generator to be trained.
  • the network also includes a discriminator in the training phase; in the training phase, the discriminator is used to identify the authenticity of the fitted image generated based on the predicted artifact image output by the generator, so as to assist the generator to learn the difference between the fake image and the real image. Differential characteristics.
  • the present application also provides an image authenticity detection method, which is described by taking an application and a computer device as an example, and the computer device may specifically be a terminal or a server in FIG. 1 .
  • the image authenticity detection method includes:
  • S1002 obtain a sample image and an image label corresponding to each sample image; the sample image includes a real sample image and a fake sample image; and the image label includes a fake area label and an image authenticity label.
  • the sample image and the image label corresponding to the sample image can be input into the computer device.
  • the sample images include real sample images and fake sample images; the image labels include fake area labels and image authenticity labels.
  • the real sample image, the fake sample image and the fitted image are respectively input into the discriminator to be trained in the generative confrontation network, and the first false region prediction result and the first visual real prediction result are output.
  • S1008 based on the first difference between the first false area prediction result and the corresponding false area label, and the second difference between the first visual real prediction result and the corresponding image authenticity label, perform a first step on the discriminator to be trained. One training, stop until reaching the first training stop condition.
  • the computer equipment inputs each sample image into the generator to be trained in the generative adversarial network, the generator to be trained outputs a prediction artifact image corresponding to each sample image, and subtracts the corresponding Predict the artifact image, and obtain the fitting image corresponding to each sample image.
  • the computer equipment inputs the sample image and the fitted image into the discriminator to be trained in the generative adversarial network, and the discriminator to be trained outputs the first false region prediction result and the first visual real prediction result.
  • the computer device determines the first difference between the first false area prediction result and the corresponding false area label, and the second difference between the first visual real prediction result and the corresponding image authenticity label, and according to the first difference and the first difference
  • the loss function of the discriminator is constructed by the second difference, and the discriminator to be trained is first trained based on the loss function of the discriminator, until the first training stop condition is reached.
  • the discriminator includes a false area discriminator and a visual real discriminator; the first difference may be the first false area loss representation mentioned in the above embodiment, and the second difference may be the first difference mentioned in the above embodiment.
  • the visual truth loss representation; the determination methods of the first difference and the second difference can be calculated according to the above-mentioned calculation methods of the first false area loss and the first visual truth loss, respectively.
  • the sample image and the fitted image are respectively input into the discriminator to be trained in the generative confrontation network, and the first false area prediction result and the first visual real prediction result are output; based on the first false area prediction result and the corresponding false
  • the first difference between the regional labels and the second difference between the first visual real prediction result and the corresponding image authenticity label the discriminator to be trained is first trained until the first training stop condition is reached, including:
  • the sample images are respectively input to the false area discriminator, and the first false area prediction result corresponding to the sample image is output through the false area discriminator; based on the first false area prediction result and the false area label corresponding to the sample image, the first false area is determined.
  • Region loss input the real sample image and the fitted image as input images to the visual real discriminator, and output the first visual real prediction result corresponding to the input image; based on the first visual real prediction result corresponding to the input image and the image real Pseudo labels, determine the first visual real loss; construct the discriminator loss function according to the first fake area loss and the first visual real loss; perform the first training on the fake area discriminator and the visual real discriminator through the discriminator loss function until reaching Stop at the first training stop condition.
  • S1010 Input the fitted image into the discriminator obtained through the first training, and output the second false region prediction result and the second visual reality prediction result of the fitted image.
  • the computer device inputs the fitted image into the discriminator obtained by the first training, and the discriminator obtained by the first training outputs the second false region prediction result and the second visual real prediction result of the fitting image.
  • inputting the fitted image into the discriminator obtained through the first training, and outputting the second false region prediction result and the second visual real prediction result of the fitted image includes: inputting the fitted image into the discriminator obtained through the first training In the false region discriminator, output the second false region prediction result corresponding to the fitted image; input the fitted image into the visual reality discriminator obtained by the first training, and output the second visual reality corresponding to the fitted image forecast result.
  • the computer device determines the third difference between the second false area prediction result and the false area label corresponding to the real sample image, and determines the third difference between the second visual real prediction result and the image authenticity label corresponding to the real sample image
  • the loss function of the generator is constructed according to the third difference and the fourth difference
  • a second training is performed on the generator based on the loss function of the generator until the second training stop condition is reached.
  • the third difference can be specifically represented by the second false area loss in the above embodiment; the fourth difference can be represented by the second visual real loss in the above embodiment; the third difference and the fourth difference can be determined according to the above The calculation methods of the second false area loss and the second visual real loss of the embodiment are calculated.
  • the specific content of the second training performed by the computer device reference may be made to the relevant descriptions in the foregoing embodiments.
  • the training The generator performs second training until the second training stop condition is reached, including: determining the second false region loss based on the second false region prediction result corresponding to the fitted image and the false region label corresponding to the real sample image ; Determine the second visual real loss based on the second visual real prediction result corresponding to the fitted image and the image authenticity label corresponding to the real sample image; construct the generator loss function according to the second fake area loss and the second visual real loss ; Perform second training on the generator to be trained in the generative adversarial network through the generator loss function, and stop when the second training stop condition is reached.
  • the first training and the second training are alternately performed, and the training is stopped until the iteration stop condition is reached, and a trained generative adversarial network is obtained; the generator in the trained generative adversarial network is used for image authenticity detection of the image to be detected.
  • the computer equipment alternately performs the first training and the second training, and stops the training when the iteration stop condition is reached, obtains a trained generative adversarial network, and inputs the image to be detected into the generator in the trained generative adversarial network,
  • the trained generator outputs an artifact image corresponding to the image to be detected, and determines the authenticity detection result of the image to be detected based on the artifact image.
  • a fifth difference can also be determined, and a generator loss function is constructed according to the fifth difference, the fourth difference and the third difference.
  • the fifth difference can be specifically represented by the above-mentioned artifact loss.
  • the manner of determining the fifth difference includes: determining the predicted artifact image corresponding to the real sample image; and taking the difference between the predicted artifact image corresponding to the real sample image and the false region label corresponding to the real sample image as the fifth difference.
  • the generator and the discriminator are trained against each other.
  • the generator is used to learn the artifact image, and the fitting image is synthesized based on the artifact image; the discriminator learns real samples on the one hand.
  • the false area information corresponding to the image and the false sample image so as to have the ability to reconstruct the false area of the fitted image. the ability of authenticity.
  • both the generator and the discriminator in the trained generative adversarial network can achieve good performance, so that the artifact images extracted based on the trained generator have good credibility.
  • the present application also provides an application scenario where the above-mentioned image authenticity detection method is applied.
  • the application of the image authenticity detection method in this application scenario is as follows:
  • the account management application can collect the current user's face image by calling the image acquisition device, and send the current user's face image to the server, and the server can monitor the current user's face image.
  • the user's face image is used for face verification.
  • the server When the server receives the face image of the current user, the server inputs the face image of the current user to the generator in the generative adversarial network, and determines the artifact image corresponding to the image to be detected by the generator, and based on the image in the artifact image Artifact information, to determine the authenticity of the current user's face image, so that when the current user's face image is a fake image, the account management application refuses to freeze the user account; if the current user's face image is a real image , the account management application freezes the user account.
  • FIGS. 2 , 7 , 8 , 9 and 10 are shown in sequence as indicated by arrows, these steps are not necessarily executed sequentially in the sequence indicated by arrows. Unless explicitly stated herein, the execution of these steps is not strictly limited to the order, and these steps may be performed in other orders. Moreover, at least a part of the steps in FIGS. 2 , 7 , 8 , 9 and 10 may include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but may be performed at different times. The execution sequence of these steps or stages is not necessarily carried out sequentially, but may be executed in turn or alternately with other steps or at least a part of the steps or stages in the other steps.
  • an image authenticity detection apparatus 1100 is provided.
  • the apparatus may use software modules or hardware modules, or a combination of the two to become a part of computer equipment.
  • the apparatus specifically includes : image acquisition module 1102, artifact image generation module 1104 and determination module 1106, wherein:
  • the image acquisition module 1102 is used for acquiring the image to be detected.
  • the artifact image generation module 1104 is used to input the image to be detected into the generator of the generative adversarial network, and output the artifact image corresponding to the image to be detected through the generator; the artifact image is used to represent the difference between the image to be detected and the real image Among them, the generative adversarial network also includes a discriminator in the training phase; in the training phase, the generator is used to output a prediction artifact image corresponding to the sample image, and generate a fitting image based on the prediction artifact image; Combined images for authenticity identification to assist the generator to learn the difference between fake images and real images;
  • the determination module 1106 is configured to determine the authenticity detection result of the image to be detected based on the artifact image.
  • the image acquisition module 1102 also includes a video analysis module 1121, which is used to acquire a video to be detected including a human face; to parse the video to be detected to obtain a corresponding video frame; to analyze the video frame Perform face detection, and crop a face image including a face region from the video frame based on the result of the face detection.
  • a video analysis module 1121 which is used to acquire a video to be detected including a human face; to parse the video to be detected to obtain a corresponding video frame; to analyze the video frame Perform face detection, and crop a face image including a face region from the video frame based on the result of the face detection.
  • the determination module 1106 is further configured to determine the pixel value of each pixel included in the artifact image; determine the average pixel value corresponding to the artifact image based on the pixel value of each pixel; when the average pixel value is greater than When it is equal to the pixel threshold, it is determined that the image to be detected is a false image; when the average pixel value is less than the pixel threshold, it is determined that the image to be detected is a real image.
  • the image authenticity detection device 1100 is further configured to acquire corresponding marking information when the authenticity detection result of the image to be detected indicates that the image to be detected is a false image; add the marking information to the image to be detected; The label information is used to characterize the image to be detected as a fake image.
  • the image authenticity detection apparatus 1100 further includes a model training module 1108 for acquiring sample images and image labels corresponding to each sample image; inputting each sample image to the generator to be trained in the generative adversarial network
  • the generator to be trained outputs a prediction artifact image corresponding to each sample image respectively; according to the prediction artifact image, a fitting image corresponding to the sample image is generated; based on the sample image, image label and fitting image pair generation confrontation
  • the generator and discriminator in the network are trained iteratively against each other until the iterative stop condition is reached.
  • the model training module 1108 is further configured to perform pixel matching on the sample image and the corresponding prediction artifact map, and determine the first pixel and the second pixel at the same pixel position in the sample image and the prediction artifact map. point; the pixel value of the first pixel point is subtracted from the pixel value of the second pixel point at the same pixel position to obtain the fitted pixel value corresponding to the corresponding pixel position; based on the fitted pixel value corresponding to each pixel position, determine Fitted image of the sample image.
  • the model training module 1108 is further configured to perform the first training on the discriminator to be trained in the generative adversarial network based on the sample image, the image label and the fitted image, until the first training stop condition is reached;
  • the fitted image is input into the discriminator obtained through the first training, so as to discriminate the authenticity of the fitted image, and output the authenticity prediction result of the fitted image;
  • the trained generator performs the second training, and stops when the second training stop condition is reached; returns to the step of performing the first training on the discriminator to be trained in the generative adversarial network based on the sample image, the image label and the fitted image and continues to execute, The training is stopped when the iteration stop condition is reached, and the trained generative adversarial network is obtained.
  • the sample images include real sample images and fake sample images; the image labels include fake area labels and image authenticity labels; the discriminators include fake area discriminators and visual real discriminators; the model training module 1108 also includes discriminators
  • the device training module 1181 is used to input the real sample image and the fake sample image to the fake area discriminator respectively, and output the first fake area prediction result corresponding to the real sample image and the fake sample image through the fake area discriminator; based on the real sample image The first false region prediction result and false region label corresponding to the false sample image, respectively, to determine the first false region loss;
  • the real sample image and the fitted image are respectively input to the visual real discriminator as input images, and output through the visual real discriminator
  • the first visual real prediction result corresponding to the input image; the first visual real loss is determined based on the first visual real prediction result and the image authenticity label corresponding to the input image; constructed according to the first false area loss and the first visual real loss
  • the discriminator loss function the first training is performed on the false region discriminator and the visual real discriminator through the discrimin
  • the discriminator training module 1181 is further configured to set the pixel value of the first preset image to the first value to obtain the false region label of the real sample image; the size of the first preset image and the real sample image The same; determine the false area in the false sample image; set the pixel value of the target area corresponding to the false area in the second preset image to the second value, and set other areas in the second preset image except the target area The pixel value of is set to the first value to obtain the false area label of the false sample image; wherein, the size of the second preset image and the false sample image is the same, and the second value is different from the first value.
  • the reality prediction results include the second false region prediction results and the second visual reality prediction results;
  • the model training module 1108 further includes a generator training module 1182 for inputting the fitted image to the first training module In the obtained false area discriminator, output the second false area prediction result corresponding to the fitted image; input the fitted image into the visual real discriminator obtained by the first training, and output the second visual corresponding to the fitted image true predictions.
  • the generator training module 1182 is further configured to determine the second false region loss based on the second false region prediction result corresponding to the fitted image and the false region label corresponding to the real sample image;
  • the second visual real prediction result corresponding to the image and the image authenticity label corresponding to the real sample image are used to determine the second visual real loss;
  • the generator loss function is constructed according to the second false area loss and the second visual real loss; through the generator loss The function performs second training on the generator to be trained in the generative adversarial network, and stops when the second training stop condition is reached.
  • the generator training module 1182 is further configured to determine the predicted artifact image corresponding to the real sample image; based on the difference between the predicted artifact image corresponding to the real sample image and the false region label corresponding to the real sample image , determine the artifact loss; construct the generator loss function according to the second false area loss and the second visual real loss, including: constructing the generator loss function according to the artifact loss, the second false area loss and the second visual real loss.
  • an image authenticity detection apparatus 1300 is provided.
  • the apparatus can use software modules or hardware modules, or a combination of the two to become a part of computer equipment.
  • the apparatus specifically includes: an acquisition module 1302, a fitting module Image generation module 1304 and training module 1306, where:
  • the acquisition module 1302 is used to acquire sample images and image labels corresponding to each sample image; the sample images include real sample images and fake sample images; the image labels include fake area labels and image authenticity labels;
  • the fitting image generation module 1304 is used to input each real sample image and fake sample image to the generator to be trained in the generative adversarial network, and output the prediction corresponding to each real sample image and fake sample image respectively through the generator to be trained Artifact images, and generate fitting images corresponding to the real sample image and the fake sample image according to each predicted artifact image;
  • the training module 1306 is used to input the real sample image, the fake sample image and the fitted image respectively into the discriminator to be trained in the generative confrontation network, and output the first false region prediction result and the first visual real prediction result;
  • the training module 1306 is further configured to, based on the first difference between the first false area prediction result and the corresponding false area label and the second difference between the first visual real prediction result and the corresponding image authenticity label, to be trained.
  • the discriminator performs the first training until it reaches the first training stop condition;
  • a training module 1306, configured to input the fitted image into the discriminator obtained by the first training, and output the second false region prediction result and the second visual real prediction result of the fitted image;
  • the training module 1306 is further configured to be based on the third difference between the second false region prediction result and the false region label corresponding to the real sample image and the third difference between the second visual real prediction result and the image authenticity label corresponding to the real sample image. Four differences, the generator to be trained performs second training until it reaches the second training stop condition;
  • the training module 1306 is also used to alternately perform the first training and the second training, and stop the training until the iterative stop condition is reached, and obtain a trained generative adversarial network; the generator in the trained generative adversarial network is used to image the image to be detected. Authenticity detection.
  • Each module in the above-mentioned image authenticity detection device can be implemented in whole or in part by software, hardware and combinations thereof.
  • the above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
  • a computer device is provided, and the computer device can be a server, and its internal structure diagram can be as shown in FIG. 14 .
  • the computer device includes a processor, memory, and a model interface connected by a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities.
  • the memory of the computer device includes a non-volatile storage medium, an internal memory.
  • the nonvolatile storage medium stores an operating system, a computer program, and a database.
  • the internal memory provides an environment for the execution of the operating system and computer programs in the non-volatile storage medium.
  • the database of the computer device is used to store image authenticity detection data.
  • the model interface of the computer device is used to communicate with an external terminal through the model connection. When the computer program is executed by the processor, an image authenticity detection method is realized.
  • FIG. 14 is only a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer equipment to which the solution of the present application is applied. Include more or fewer components than shown in the figures, or combine certain components, or have a different arrangement of components.
  • a computer device comprising a memory and one or more processors, the memory having computer program readable instructions stored in the memory, the computer readable instructions when executed by the processors cause one or more Multiple processors execute the steps in each of the foregoing method embodiments.
  • a computer program product or computer program comprising computer instructions stored in a computer readable storage medium.
  • the processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in the foregoing method embodiments.
  • one or more non-volatile readable storage media are provided that store computer-readable instructions that, when executed by one or more processors, cause the one or more processors to Steps in the foregoing method embodiments are performed.
  • Non-volatile memory may include read-only memory (Read-Only Memory, ROM), magnetic tape, floppy disk, flash memory, or optical memory, and the like.
  • Volatile memory may include random access memory (RAM) or external cache memory.
  • the RAM may be in various forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Artificial Intelligence (AREA)
  • Oral & Maxillofacial Surgery (AREA)
  • Human Computer Interaction (AREA)
  • Computing Systems (AREA)
  • Medical Informatics (AREA)
  • Software Systems (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Evolutionary Biology (AREA)
  • General Engineering & Computer Science (AREA)
  • Image Analysis (AREA)
  • Collating Specific Patterns (AREA)

Abstract

一种图像真伪检测方法,由计算机设备执行。所述方法包括:获取待检测图像(S202);将待检测图像输入至生成对抗网络的生成器中,通过生成器输出与待检测图像对应的伪像图;伪像图用于表征待检测图像与真实图像间的差异;其中,生成对抗网络在训练阶段还包括鉴别器;在训练阶段,生成器用于输出与样本图像对应的预测伪像图,并基于预测伪像图生成拟合图像;鉴别器用于对拟合图像进行真实性鉴别,以辅助生成器学习到虚假图像与真实图像间的差异特征(S204);基于伪像图中的伪像信息,确定待检测图像的真伪检测结果(S206)。

Description

图像真伪检测方法、装置、计算机设备和存储介质
本申请要求于2020年08月18日提交中国专利局,申请号为202010829031.3、发明名称为“图像真伪检测方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及图像处理技术领域,特别是涉及一种图像真伪检测方法、装置、计算机设备和存储介质。
背景技术
目前随着图像编辑技术的发展,人们可以随意编辑图像中的内容,从而导致越来越多以假乱真的高质量虚假图像涌现出来,这将严重影响目前落地的图像识别系统的安全性。因此,在安防应用方面,检测输入图像是否经过了编辑,日趋成为网络安全中的重要环节。
传统方案中对图像进行真伪鉴别的方式主要是通过检测图像中的某些特定瑕疵,来判定待检测图像是否为虚假图像。比如,可以通过检测图像中的全局光照和局部光照的匹配程度,来对图像的真伪进行判断。但是随着图像编辑技术的不断发展,某些特定的瑕疵将会不复存在,从而导致图像真伪检测的准确性较低。
发明内容
本申请各实施例提供了一种图像真伪检测方法、装置、计算机设备和存储介质。
一种图像真伪检测方法,由计算机设备执行,所述方法包括:
获取待检测图像;
将所述待检测图像输入至生成对抗网络的生成器中,通过所述生成器输出与所述待检测图像对应的伪像图;所述伪像图用于表征所述待检测图像与真实图像间的差异;其中,所述生成对抗网络在训练阶段还包括鉴别器;在所述训练阶段,所述生成器用于输出与样本图像对应的预测伪像图,并基于所述预测伪像图生成拟合图像;所述鉴别器用于对所述拟合图像进行真实性鉴别,以辅助所述生成器学习到虚假图像与真实图像间的差异特征;及
基于所述伪像图确定所述待检测图像的真伪检测结果。
一种图像真伪检测装置,所述装置包括:
图像获取模块,用于获取待检测图像;
伪像图生成模块,用于将所述待检测图像输入至生成对抗网络的生成器中,通过所述生成器输出与所述待检测图像对应的伪像图;所述伪像图用于表征所述待检测图像与真实图像间的差异;其中,所述生成对抗网络在训练阶段还包括鉴别器;在所述训练阶段,所述生成器用于输出与样本图像对应的预测伪像图,并基于所述预测伪像图生成拟合图像;所述鉴别器用于对所述拟合图像进行真实性鉴别,以辅助所述生成器学习到虚假图像与真实图像间的差异特征;及
判定模块,用于基于所述伪像图确定所述待检测图像的真伪检测结果。
一种计算机设备,包括存储器和一个或多个处理器,所述存储器中存储有计算机可读指令,所述计算机可读指令被所述处理器执行时,使得所述一个或多个处理器执行以下步骤:
获取待检测图像;
将所述待检测图像输入至生成对抗网络的生成器中,通过所述生成器输出与所述待检测图像对应的伪像图;所述伪像图用于表征所述待检测图像与真实图像间的差异;其中,所述生成对抗网络在训练阶段还包括鉴别器;在所述训练阶段,生成器用于输出与样本图像对应的预测伪像图,并基于所述预测伪像图生成拟合图像;所述鉴别器用于对所述拟合图像进行真实性鉴别,以辅助所述生成器学习到虚假图像与真实图像间的差异特征;及
基于所述伪像图确定所述待检测图像的真伪检测结果。
一个或多个存储有计算机可读指令的非易失性可读存储介质,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器执行以下步骤:
获取待检测图像;
将所述待检测图像输入至生成对抗网络的生成器中,通过所述生成器输出与所述待检测图像对应的伪像图;所述伪像图用于表征所述待检测图像与真实图像间的差异;其中,所述生成对抗网络在训练阶段还包括鉴别器;在所述训练阶段,生成器用于输出与样本图像对应的预测伪像图,并基于所述预测伪像图生成拟合图像;所述鉴别器用于对所述拟合图像进行真实性鉴别,以辅助所述生成器学习到虚假图像与真实图像间的差异特征;及
基于所述伪像图确定所述待检测图像的真伪检测结果。
一种图像真伪检测方法,由计算机设备执行,所述方法包括:
获取样本图像、及各所述样本图像对应的图像标签;所述样本图像包括真实样本图像和虚假样本图像;所述图像标签包括虚假区域标签和图像真伪标签;
将各所述样本图像分别输入至生成对抗网络中待训练的生成器,通过所述待训练的生成器输出与各所述样本图像分别对应的预测伪像图,并根据各所述预测伪像图,生成与所述样本图像分别对应的拟合图像;
将所述样本图像和所述拟合图像分别输入至所述生成对抗网络中待训练的鉴别器中,输出第一虚假区域预测结果和第一视觉真实预测结果;
基于所述第一虚假区域预测结果与相对应的虚假区域标签间的第一差异、以及所述第一视觉真实预测结果与相对应的图像真伪标签间的第二差异,对所述待训练的鉴别器进行第一训练,直至达到第一训练停止条件时停止;
将所述拟合图像输入至通过所述第一训练得到的鉴别器中,输出所述拟合图像的第二虚假区域预测结果和第二视觉真实预测结果;
基于所述第二虚假区域预测结果与所述真实样本图像所对应的虚假区域标签间的第三差异、以及所述第二视觉真实预测结果与所述真实样本图像所对应的图像真伪标签间的第四差异,对所述待训练的生成器进行第二训练,直至达到第二训练停止条件时停止;及
交替进行所述第一训练和所述第二训练,直至达到迭代停止条件时停止训练,得到训练好的生成对抗网络;所述训练好的生成对抗网络中的生成器用于对待检测图像进行图像真伪检测。
一种图像真伪检测装置,其特征在于,所述装置包括:
获取模块,用于获取样本图像、及各所述样本图像对应的图像标签;所述样本图像包括真实样本图像和虚假样本图像;所述图像标签包括虚假区域标签和图像真伪标签;
拟合图像生成模块,用于将各所述样本图像分别输入至生成对抗网络中待训练的生成器,通过所述待训练的生成器输出与各所述样本图像分别对应的预测伪像图,并根据各所述预测伪像图,生成与所述样本图像分别对应的拟合图像;
训练模块,用于将所述样本图像和所述拟合图像分别输入至生成对抗网络中待训练的鉴别器中,输出第一虚假区域预测结果和第一视觉真实预测结果;
所述训练模块,还用于基于所述第一虚假区域预测结果与相对应的虚假区域标签间的第一差异、以及所述第一视觉真实预测结果与相对应的图像真伪标签间的第二差异,对所述待训练的鉴别器进行第一训练,直至达到第一训练停止条件时停止;
所述训练模块,用于将所述拟合图像输入至通过所述第一训练得到的鉴别器中,输出所述拟合图像的第二虚假区域预测结果和第二视觉真实预测结果;
所述训练模块,还用于基于所述第二虚假区域预测结果与所述真实样本图像所对应的虚假区域标签间的第三差异、以及所述第二视觉真实预测结果与所述真实样本图像所对应的图像真伪标签间的第四差异,对所述待训练的生成器进行第二训练,直至达到第二训练停止条件时停止;及
所述训练模块,还用于交替进行所述第一训练和所述第二训练,直至达到迭代停止条件 时停止训练,得到训练好的生成对抗网络;所述训练好的生成对抗网络中的生成器用于对待检测图像进行图像真伪检测。
一种计算机设备,包括存储器和一个或多个处理器,所述存储器中存储有计算机可读指令,所述计算机可读指令被所述处理器执行时,使得所述一个或多个处理器执行以下步骤:
获取样本图像、及各所述样本图像对应的图像标签;所述样本图像包括真实样本图像和虚假样本图像;所述图像标签包括虚假区域标签和图像真伪标签;
将各所述样本图像分别输入至生成对抗网络中待训练的生成器,通过所述待训练的生成器输出与各所述样本图像分别对应的预测伪像图,并根据各所述预测伪像图,生成与所述样本图像分别对应的拟合图像;
将所述样本图像和所述拟合图像分别输入至所述生成对抗网络中待训练的鉴别器中,输出第一虚假区域预测结果和第一视觉真实预测结果;
基于所述第一虚假区域预测结果与相对应的虚假区域标签间的第一差异、以及所述第一视觉真实预测结果与相对应的图像真伪标签间的第二差异,对所述待训练的鉴别器进行第一训练,直至达到第一训练停止条件时停止;
将所述拟合图像输入至通过所述第一训练得到的鉴别器中,输出所述拟合图像的第二虚假区域预测结果和第二视觉真实预测结果;
基于所述第二虚假区域预测结果与所述真实样本图像所对应的虚假区域标签间的第三差异、以及所述第二视觉真实预测结果与所述真实样本图像所对应的图像真伪标签间的第四差异,对所述待训练的生成器进行第二训练,直至达到第二训练停止条件时停止;及
交替进行所述第一训练和所述第二训练,直至达到迭代停止条件时停止训练,得到训练好的生成对抗网络;所述训练好的生成对抗网络中的生成器用于对待检测图像进行图像真伪检测。
一个或多个存储有计算机可读指令的非易失性可读存储介质,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器执行以下步骤:
获取样本图像、及各所述样本图像对应的图像标签;所述样本图像包括真实样本图像和虚假样本图像;所述图像标签包括虚假区域标签和图像真伪标签;
将各所述样本图像分别输入至生成对抗网络中待训练的生成器,通过所述待训练的生成器输出与各所述样本图像分别对应的预测伪像图,并根据各所述预测伪像图,生成与所述样本图像分别对应的拟合图像;
将所述样本图像和所述拟合图像分别输入至所述生成对抗网络中待训练的鉴别器中,输出第一虚假区域预测结果和第一视觉真实预测结果;
基于所述第一虚假区域预测结果与相对应的虚假区域标签间的第一差异、以及所述第一视觉真实预测结果与相对应的图像真伪标签间的第二差异,对所述待训练的鉴别器进行第一训练,直至达到第一训练停止条件时停止;
将所述拟合图像输入至通过所述第一训练得到的鉴别器中,输出所述拟合图像的第二虚假区域预测结果和第二视觉真实预测结果;
基于所述第二虚假区域预测结果与所述真实样本图像所对应的虚假区域标签间的第三差异、以及所述第二视觉真实预测结果与所述真实样本图像所对应的图像真伪标签间的第四差异,对所述待训练的生成器进行第二训练,直至达到第二训练停止条件时停止;及
交替进行所述第一训练和所述第二训练,直至达到迭代停止条件时停止训练,得到训练好的生成对抗网络;所述训练好的生成对抗网络中的生成器用于对待检测图像进行图像真伪检测。
附图说明
图1为一个实施例中图像真伪检测方法的应用环境图;
图2为一个实施例中图像真伪检测方法的流程示意图;
图3为一个实施例中生成器的网络结构示意图;
图4为一个实施例中人脸图像提取示意图;
图5为一个实施例中虚假区域标签的示意图;
图6为一个实施例中基于生成器、虚假区域鉴别器及视觉真进行对抗训练的示意图;
图7为一个具体实施例中图像真伪检测方法的流程示意图;
图8为另一个具体实施例中图像真伪检测方法的流程示意图;
图9为又一个具体实施例中图像真伪检测方法的流程示意图;
图10为再一个具体实施例中图像真伪检测方法的流程示意图;
图11为一个实施例中图像真伪检测方法装置的结构框图;
图12为另一个实施例中图像真伪检测方法装置的结构框图;
图13为又一个实施例中图像真伪检测方法装置的结构框图;
图14为一个实施例中计算机设备的内部结构图。
具体实施方式
图1为一个实施例中图像真伪检测方法的应用环境图。参照图1,该图像真伪检测方法应用于图像真伪检测系统。该图像真伪检测系统包括终端102和服务器104。终端102和服务器104 通过网络连接。终端102具体可以是台式终端或移动终端,移动终端具体可以手机、平板电脑、笔记本电脑等中的至少一种。服务器104可以用独立的服务器或者是多个服务器组成的服务器集群来实现。终端102和服务器104均可单独用于执行本申请实施例中提供的图像真伪检测方法。终端102和服务器104也可协同用于执行本申请实施例中提供的图像真伪检测方法。
需要说明的是,上述服务器可以是独立的物理服务器,也可以是多个物理服务器构成的服务器集群或者分布式系统,还可以是提供云服务、云数据库、云计算、云函数、云存储、网络服务、云通信、中间件服务、域名服务、安全服务、CDN、以及大数据和人工智能平台等基础云计算服务的云服务器。终端可以是智能手机、平板电脑、笔记本电脑、台式计算机、智能音箱、智能手表等,但并不局限于此。终端以及服务器可以通过有线或无线通信方式进行直接或间接地连接,本申请在此不做限制。
还需要说明的是,本申请具体涉及人工智能领域中的计算机视觉技术和机器学习技术(Machine Learning,ML)。计算机视觉技术(Computer Vision,CV)是指用摄影机和电脑代替人眼对目标进行检测、识别、跟踪和测量等机器视觉,并进一步做图形处理,使电脑处理成为更适合人眼观察或传送给仪器检测的图像。
本公开中使用的“第一”、“第二”以及类似的词语并不表示任何顺序、数量或者重要性,而只是用来区分不同的组成部分。除非上下文另外清楚地指出,否则单数形式“一个”、“一”或者“该”等类似词语也不表示数量限制,而是表示存在至少一个。
在其中一个实施例中,如图2所示,提供了一种图像真伪检测方法,以该方法应用于计算机设备进行说明,该计算机设备具体可以是图1中的终端或服务器。其中,该图像真伪检测方法包括以下步骤:
步骤S202,获取待检测图像。
具体地,当需要对图像的真伪进行检测时,用户可以直接上传待检测图像至计算机设备,以使计算机设备对待检测图像进行真伪检测。其中,待检测图像的真伪检测结果可以包括待检测图像为虚假图像、以及检测图像为真实图像。当待检测图像为虚假图像时,表示待检测图像中的部分或全部图像内容已被编辑;当待检测图像为真实图像时,表示待检测图像中的图像内容未被编辑。
步骤S204,将待检测图像输入至生成对抗网络的生成器中,通过生成器输出与待检测图像对应的伪像图;伪像图用于表征待检测图像与真实图像间的差异。其中,生成对抗网络在训练阶段还包括鉴别器;在训练阶段,生成器用于输出与样本图像对应的预测伪像图,并基于预测伪像图生成拟合图像;鉴别器用于对拟合图像进行真实性鉴别,以辅助生成器学习到虚假图像与真实图像间的差异特征。
其中,生成对抗网络是包括生成器(Generative Model)和鉴别器(Discriminative Model)的深度学习模型,其通过框架中的生成器和判别器之间的互相博弈学习,而得到可信的输出。其中,训练后的生成器是指具有提取出待检测图像中的伪像信息能力的模型,具体可以是以样本图像作为训练数据,进行学习训练得到的用于将伪像信息从样本图像中分离出来的模型;鉴别器是具有对由生成器输出伪像图所构成的拟合图像的可靠性进行鉴别的模型,其具体可 以是以拟合图像作为训练数据,进行学习训练得到的模型。
对于生成器而言,在使用阶段,可用于对图像的真伪进行检测;在训练阶段,其用于对图像中的伪像信息进行学习,并根据学习得到的伪像信息生成预测伪像图和拟合图像。对于鉴别器而言,在训练阶段,可用于对生成器输出的基于预测伪像图所生成的拟合图像进行真实性鉴别,以使生成器根据真实性鉴别结果调整提取出的伪像信息,从而学习到虚假图像与真实图像间的差异特征。
伪像图是表征待检测图像与真实图像间的差异的图像数据,其可以对待检测图像中被编辑的图像内容进行像素级别的定位。伪像信息是伪像图包含的用于表征被编辑的图像内容的信息,其具体可以为伪像图中的各像素点的像素值。拟合图像是合成图像,具体可以是通过待检测图像和伪像图合成的贴近真实图像的图像。在其中一个实施例中,拟合图像可以是从待检测图像中去对应除伪像图中的伪像信息后得到的图像,即将待检测图像进行还原处理后,得到的未包含有编辑的图像内容的图像数据。
具体地,在使用阶段,计算机设备可将待检测图像输入至生成对抗网络的生成器中,由生成器提取出待检测图像中的图像特征,并基于图像特征,确定待检测图像中被编辑的图像内容所对应的虚假区域,以及基于图像特征,预测被编辑的图像内容与真实的图像内容之间的差异。进一步地,生成器根据虚假区域以及预测得到的被编辑的图像内容与真实的图像内容之间的差异,生成对应的伪像图。其中,图像特征是可以反映出图像真伪特征的数据。图像特征可以反映出待检测图像像素点的颜色值分布、亮度值分布、及各像素点之间的关联关系等其中的一种或多种特征信息。其中,虚假区域是指图像中被编辑的图像内容所对应的图像区域。
比如,用户可对人脸图像中的面部进行美化调节得到经过编辑后的图像,该图像即可作为待检测图像。生成器可基于从待检测图像中提取出的图像特征,确定待检测图像中被编辑的图像内容为面部,那么相应地,可以确定与被编辑的图像内容对应的虚假区域为面部区域。进一步地,生成器获取预设的初始伪像图,并根据图像特征,预测用户对面部进行美化调节的美化程度,根据美化程度,对初始伪像图中的与虚假区域对应的目标区域中的各像素点的像素值进行调整,得到与待检测图像对应的伪像图。当计算机设备从待检测图像中去除伪像图中的伪像信息后,就可以得到未进行美化调节的原始人脸图像,即得到与待检测图像对应的拟合图像。其中,初始伪像图可以为一张与待检测图像尺寸相同的全黑图。
在训练阶段,计算机设备获取样本图像,并将样本图像输入待训练的生成器,由待训练的生成器确定与样本图像对应的预测伪像图,并根据样本图像以及预测伪像图,确定对应的拟合图像。进一步地,计算机设备将拟合图像作为鉴别器的输入,由鉴别器对生成器所生成的拟合图像的真实性进行鉴别,并将真实性鉴别结果反馈至生成器,以使生成器根据接收到的真实性鉴别结果,对应调整模型参数,直至鉴别器将生成器生成的拟合图像的真实性鉴别为真。如此,便实现了基于鉴别器辅助生成器学习到虚假图像与真实图像之间的本质区别。
由于可以基于鉴别器的鉴别结果衡量拟合图像的生成质量,因此,只有当生成器学习到虚假图像与真实图像之间的本质区别时,才能基于本质区别确定真实、可靠的伪像信息,从 而根据真实、可靠的伪像信息输出被鉴别器鉴别为真的合理的拟合图像,进而在使用阶段时,生成器输出的伪像信息就能很好的表征待检测图像与真实图像间的差异。
在其中一个实施例中,生成对抗网络可以为GAN(Generative Adversarial Networks,生成式对抗网络)网络,也可以为在此基础上改进的生成式对抗网络。
在其中一个实施例中,生成器和鉴别器可以包括各种类型的机器学习模型。机器学习模型可以包括线性模型和非线性模型。例如,机器学习模型可以包括回归模型、支持向量机、基于决策树的模型、贝叶斯模型和/或神经网络(例如,深度神经网络)。例如,神经网络可以包括前馈神经网络、递归神经网络(例如,长短期记忆递归神经网络)、卷积神经网络或其他形式的神经网络。需要说明,生成器和鉴别器不一定限于是神经网络,还可以包括其他形式的机器学习模型。
在其中一个实施例中,生成器包括编码网络和解码网络;上述通过生成器输出与待检测图像对应的伪像图包括:基于编码网络提取待检测图像中的图像特征;基于解码网络对提取出的图像特征进行解码,得到与待检测图像对应的伪像图。
参考图3,如图3所示,生成器可以为任意的Encoder-Decoder(编码-解码)网络结构,其中,生成器中的编码网络用于提取出待检测图像中的图像特征,解码网络用于根据图像特征,解析出与待检测图像对应的伪像图,并根据伪像图确定待检测图像的真伪检测结果。在待检测图像为真实图像时,表明待检测图像中的图像内容未经过替换或编辑;在待检测图像为虚假图像时,表明待检测图像中的图像内容经过替换或编辑。图3示出了一个实施例中生成器的网络结构示意图。
步骤S206,基于伪像图确定待检测图像的真伪检测结果。
其中,真伪检测是以机器学习模型为导向的图像处理任务。在图像检测的应用领域,例如在身份认证领域、人脸支付领域、或安防领域等,常采用机器学习模型识别更为可靠的差异特征,从而根据差异特征,确定待检测图像的真伪检测结果。
具体地,计算机设备确定伪像图中的伪像信息,并根据伪像信息对待检测图像的真伪进行检测。比如,计算机设备根据伪像图中的伪像信息确定待检测图像中的虚假区域的区域大小,当虚假区域的区域大小大于或等于预设区域阈值时,将待检测图像判定为虚假图像;当虚假区域的区域大小小于预设区域阈值时,将待检测图像判定为真实图像。又比如,计算机设备根据伪像图中的伪像信息,确定待检测图像中是否具有编辑痕迹,若具有编辑痕迹,则将待检测图像判定为虚假图像;若不具有编辑痕迹,则将待检测图像判定为真实图像。本实施例在此不作限定。
在其中一个实施例中,基于伪像图确定待检测图像的真伪检测结果,包括:确定伪像图所包括的各像素点的像素值;基于各像素点的像素值确定与伪像图对应的平均像素值;当平均像素值大于等于像素阈值时,确定待检测图像为虚假图像;当平均像素值小于所述像素阈值时,确定待检测图像为真实图像。
具体地,计算机设备对伪像图中所包含的像素总数进行统计,以及确定各像素的像素值,并对各像素的像素值进行叠加,得到总像素值。进一步地,计算机设备可将总像素值除以像 素总数,得到与伪像图对应的平均像素值,并在平均像素值大于或等于预设像素阈值时,将待检测图像判定为虚假图像;当平均像素值小于预设像素阈值时,将待检测图像判定为真实图像。比如,在上述举例中,当生成器输出的伪像图与初始伪像图一致,即该输出的伪像图为全黑图时,计算得到的平均像素值即为零,小于预设像素阈值,从而计算机设备将伪像图为全黑的待检测图像判定为真实图像;当生成器输出的伪像图不为全黑图时,此时的平均像素值不为零,大于预设的像素值,从而计算机设备将伪像图不为全黑的待检测图像判定为虚假图像。其中,预设的像素阈值可以根据需要自定义,如可根据伪像图的准确程度确定像素阈值,或根据图像真伪检测的精度要求确定像素阈值等,本申请实施例对此不作限定。
在其中一个实施例中,各像素点的像素值可以为以RGB(红、绿、蓝)三原色表示的数值,还可以是基于其他颜色维度所确定的数值等,本申请实施例对此不做限定。
在其中一个实施例中,计算机设备可以基于预设的像素值检测算法对伪像图中的像素值进行检测,从而确定各像素的像素值。其中,像素值检测算法可根据需要自定义,如可基于matlab中的imread函数读取伪像图中的各像素点的像素值,或基于OpenCV中的at函数读取伪像图中的各像素点的像素值。
上述图像真伪检测方法,当获取得到待检测图像时,通过将待检测图像输入对抗网络中的生成器,可以基于生成器输出真实且合理的,用于表征待检测图像与真实图像间的差异的伪像图,如此,便能基于伪像图中的伪像信息,确定待检测图像的真伪检测结果。由于生成器可以通过与鉴别器之间的对抗训练,学习到真实图像与虚假图像之间的最本质区别特征,因此,相比于传统的通过检测图像中的某些特定瑕疵,来对图像进行真伪检测,本申请无需依赖特定瑕疵,并在待检测图像不存在特定瑕疵时,依旧能够通过确定待检测图像与真实图像之间的区别特征,来确定待检测图像的真伪检测结果,如此,大大提升了图像检测的泛化性。
并且,由于生成器是通过与鉴别器进行对抗训练而得,而鉴别器可以用于对生成器输出的预测伪像图所生成的拟合图像进行真实性鉴别,因此,训练后的生成器可以学习到虚假图像与真实图像间的本质差异特征,从而生成真实且合理的伪像信息,进而对待检测图像进行准确判断。
在其中一个实施例中,待检测图像包括待检测的人脸图像,获取待检测图像,包括:获取包括有人脸的待检测视频;对待检测视频进行解析得到对应的视频帧;对视频帧进行人脸检测,并基于人脸检测的结果从视频帧中裁剪出包括有人脸区域的人脸图像。
具体地,上述图像真伪检测方法具体可用于对人脸图像进行真伪检测。当需要对人脸图像进行真伪检测时,计算机设备可获取包括人脸的待检测视频,并对待检测视频进行解析,得到对应的视频帧。其中,待检测视频具体可以为基于监控设备采集得到的监控视频或从互联网下载得到的媒体视频等,本实施例在此不作限定。
计算机设备基于人脸检测算法对视频帧进行人脸检测,得到人脸图像。其中,人脸图像是指视频帧中人脸所在区域的局部图像。参考图4,如图4所示,人脸所在区域是人脸在视频帧中的位置。计算机设备可通过人脸检测算法识别视频帧中的人脸区域。人脸检测算法可 根据需要自定义,如可为OpenCV人脸检测算法、系统自带的人脸检测算法或者优图人脸检测算法等。人脸检测算法可以返回视频帧中是否包含人脸以及具体的人脸区域,如通过矩形框标识人脸的位置。计算机设备在确定视频帧中的人脸区域后,可沿该人脸区域截取视频帧得到人脸图像。单帧视频帧可截取得到一个或多个人脸图像。在本实施例中,人脸图像可以仅包括人脸面部区域的图像。图4示出了一个实施例中人脸图像提取示意图。
在其中一个实施例中,监控设备在采集到视频后,可检测该视频中是否存在人脸,若存在人脸,则将该视频作为待检测视频发送至计算机设备,计算机设备从而获取到包括人脸的待检测视频。
在其中一个实施例中,对待检测视频进行解析后,可得到多帧对应的视频帧,从而计算机设备可以按照上述的图像真伪检测方法对每张视频帧均进行真伪检测,也可仅对部分视频帧进行真伪检测。本实施例在此不作限定。由于人脸图像的真伪严重影响安防检测的准确性,因此通过确定待检测视频中的人脸图像,并对人脸图像进行真伪检测,可以减少安防系统误将虚假人脸图像判定为真实人脸图像,并将虚假人脸图像所对应的不法分子误认为合法公民的概率,从而大大提升了安防系统的安全性。
上述实施例中,当获取得到待检测视频帧时,通过对待检测视频进行解析,可以得到对应的视频帧;通过得到对应的视频帧,可以从视频帧中剪裁出包括有人脸区域的人脸图像,从而计算机设备可以仅关注包括有人脸区域的人脸图像,而无需关注非人脸区域,如此,便提升了图像真伪检测的效率。
在其中一个实施例中,上述图像真伪检测方法还包括给虚假图像添加标记信息的步骤,该步骤具体包括:当待检测图像的真伪检测结果表示待检测图像为虚假图像时,获取对应的标记信息;将标记信息添加至待检测图像中;标记信息用于表征待检测图像为虚假图像。
具体地,当基于伪像图中的伪像信息确定待检测图像为虚假图像时,计算机设备可获取预设的用于区分虚假图像与真实图像的标记信息,并将此标记信息添加至待检测图像中。其中,标记信息以及将标记信息添加至待检测图像中的方式可以根据需要自定义,比如,可以将标记信息设置为字符“虚假图像”,从而可以将字符“虚假图像”添加至待检测图像的图像名称中,或者将字符“虚假图像”以水印的方式添加至待检测图像中。
在其中一个实施例中,计算机设备可以对待检测视频中,添加有标记信息的视频帧的数量进行统计,并根据统计得到的视频帧的数量,确定是否需要在待检测视频中添加用于区分虚假视频与真实视频的区分信息。比如,当添加有标记信息的待检测视频帧的数量值大于或等于预设的数量阈值时,表明此待检测视频为虚假视频,从而计算机设备可在待检测视频中添加区分信息,以使用户基于视频中的区分信息,确定视频的真伪。如此,便能提升视频内容的可信度。
在其中一个实施例中,当计算机设备可确定待检测图像为虚假图像时,可进一步分析该虚假图像的来源,比如该虚假图像具体是通过那些图像处理技术编辑得到,或者该虚假图像具体是通过哪些软件编辑得到等。进而,计算机设备可基于与该虚假图像相关的来源信息,获取对应的标记信息,将该标记信息添加至待检测图像中。
比如,在某些多媒体平台上,用户可随意上传经过编辑的换脸视频。换脸视频的广泛传播使得媒体的公信力不断下降,容易对用户产生误导。通过本申请各实施例提供的图像真伪检测方法可以帮助平台进行视频筛查,对检测出来的伪造视频加上显著标记,如“由A应用制作”,确保视频内容的可信度,保证社会公信力。本申请各实施例所提供的图像真伪检测方法,有助于公安司法证据验伪,防范犯罪嫌疑人利用人脸编辑等相关技术伪造证据。可应用于人脸核身、司法验证工具或图片视频鉴真等产品中。
上述实施例中,可以在待检测图像中添加用于区分真实图像以及虚假图像的标记信息,从而实现从海量的图像数据中筛选标记出虚假图像。并且,后续可以基于标记信息快速确定图像的真伪,进一步提升了图像真伪检测的效率。
在其中一个实施例中,上述图像真伪检测方法还包括对生成对抗网络进行训练的步骤,该步骤具体包括:获取样本图像、以及各样本图像所对应的图像标签;将各所述样本图像输入至生成对抗网络中待训练的生成器,通过待训练的生成器输出与各样本图像分别对应的预测伪像图;根据预测伪像图,生成与样本图像对应的拟合图像;基于样本图像、图像标签及拟合图像对生成对抗网络中的生成器和鉴别器进行迭代对抗训练,直至达到迭代停止条件时停止训练。
其中,样本图像是用于对生成对抗网络进行训练的图像,具体可以包括真实样本图像和虚假样本图像。真实样本图像是未经过图像编辑的图像数据,虚假样本图像是经过图像编辑后得到的图像数据。
如上文所述,传统方式主要是通过检测图像中的某些特定瑕疵,来判定待检测图像是否为虚假图像。容易发现,这种方式并没有很好泛化性。在身份识别、人脸支付、安防保护等实际应用场景中,由于现场环境的复杂性,常常会导致采集的待检测图像不具有特定的瑕疵,从而使得在对待检测图像进行真伪检测的过程中,因未能检测出特定瑕疵,而导致图像真伪检测的检测结果失真。
为了提升图像真伪检测的准确性和泛化性,本申请的实施例构建了生成器以及鉴别器,并通过对生成器以及鉴别器进行联合对抗训练,使得生成器能够学习到真实图像与虚假图像之间的本质区别,进而用于进行图像真伪检测。比如,在人脸支付场景中,计算机设备可在基于人脸图像进行支付之前,通过训练好的鉴别器判断该人脸图像是否为编辑的虚假图像,并在确定该人脸图像为虚假图像时,暂停人脸支付,以提升人脸支付的安全性。又比如,在安防保护领域,计算机设备可通过训练好的鉴别器实时对监控视频流中的视频帧进行图像真伪检测,并在基于图像真伪检测结果确定监控视频流为虚假视频时,及时向安保人员下发告警通知。
具体地,当获取得到样本图像以及对应的图像标签时,计算机设备可将样本图像输入至生成对抗网络中的生成器,由待训练的生成器对样本图像进行编码解码操作,从而输出预测伪像图。生成器还可根据预测伪像图和样本图像,生成对应的拟合图像。当获取得到拟合图像时,计算机设备通过样本图像、图像标签、以及拟合图像对生成对抗网络中的生成器和鉴别器进行迭代对抗训练,直至达到迭代停止条件时停止训练。其中,训练停止条件可以是到 达预设的迭代次数、达到预设迭代时间、或生成器以及鉴别器的模型性能打到预设性能等。
在其中一个实施例中,开发人员可以从网络中下载大量图像,并对部分图像进行编辑,从而得到真实样本图像以及虚假样本图像。
在其中一个实施例中,由于生成对抗网络的Batch Normalization(批标准化)影响,在训练阶段,计算机设备可以选择轮流将真实样本图像和虚假样本图像输入至待训练的生成器,或者将真实样本图像以及虚假样本图像成对输入。
在其中一个实施例中,待训练的生成器以及鉴别器均可以是由人工神经网络构成的模型。人工神经网络(Artificial Neural Networks,简写为ANNs),也简称为神经网络(NNs)或称作连接模型(Connection Model)。人工神经网络可从信息处理角度对人脑神经元网络进行抽象,以建立某种模型,按不同的连接方式组成不同的网络。在工程与学术界也常直接简称为神经网络或类神经网络。其中,神经网络模型可以为CNN(Convolutional Neural Network,卷积神经网络)模型、DNN(Deep Neural Network,深度神经网络)模型和RNN(Recurrent Neural Network,循环神经网络)模型等。
其中,卷积神经网络包括卷积层(Convolutional Layer)和池化层(Pooling Layer)。深度神经网络包括输入层、隐含层和输出层,层与层之间是全连接的关系。循环神经网络是一种对序列数据建模的神经网络,即一个序列当前的输出与前面的输出也有关。具体的表现形式为网络会对前面的信息进行记忆并应用于当前输出的计算中,即隐藏层之间的节点不再无连接而是有连接的,并且隐藏层的输入不仅包括输入层的输出还包括上一时刻隐藏层的输出。循环神经网络模型,比如LSTM(Long Short-Term Memory Neural Network,长短时记忆神经网络)模型,BiLSTM(Bi-directional Long Short-Term Memory,双向长短时记忆神经网络)等。
上述实施例中,通过将生成器以及鉴别器进行对抗训练,使得训练后的生成器可以学习到最本质的真实图像与虚假图像之间的差异特征,从而满足现实场景中,对未包含有特定瑕疵的图像的检测需求。
在其中一个实施例中,根据预测伪像图,生成与样本图像对应的拟合图像,包括:对样本图像和相应的预测伪像图进行像素匹配,确定样本图像和预测伪像图中对应相同像素位置的第一像素点和第二像素点;将第一像素点的像素值减去相同像素位置处的第二像素点的像素值,得到与相应像素位置对应的拟合像素值;基于各像素位置分别对应的拟合像素值,确定样本图像的拟合图像。
具体地,由于预测伪像图与样本图像的尺寸相同,因此,生成器可以对样本图像和相应的预测伪像图进行像素匹配,从而根据像素匹配结果,确定样本图像和伪像图像中对应相同像素位置的第一像素点和第二像素点。其中,为了描述方便,下述将样本图像中的像素点称作第一像素点,将预测伪像图中的像素点称作第二像素点。生成器对各像素位置进行遍历,将第一像素点的像素值减去具有相同位置的第二像素点的像素值,得到与相应像素位置对应的拟合像素值,并将各像素位置分别对应的拟合像素值,作为与样本图像对应的拟合图像中各像素点的像素值,从而确定样本图像的拟合图像。
在其中一个实施例中,还可以将第一像素点的像素值加上对应相同像素位置处的第二像素点的像素值,得到与相应像素位置对应的拟合像素值,并根据基于各像素位置分别对应的拟合像素值,确定样本图像的拟合图像;或将第一像素点的像素值加上/减去对应相同像素位置处的第二像素点的像素值,得到与相应像素位置对应的拟合像素值,并对拟合像素值进行处理,如将拟合像素输入预设的拟合图像处理网络中,得到样本图像的拟合图像。本实施例在此不作限定。
上述实施例中,生成器仅需将第一像素点的像素值减去相同像素位置处的第二像素点的像素值,即可得对应到拟合图像,如此,大大提升了拟合图像的生成效率。
在其中一个实施例中,基于样本图像、图像标签、及拟合图像对生成对抗网络中的生成器和鉴别器进行迭代对抗训练,直至达到迭代停止条件时停止训练,包括:基于样本图像、图像标签及拟合图像对生成对抗网络中待训练的鉴别器进行第一训练,直至达到第一训练停止条件时停止;将拟合图像输入至通过第一训练得到的鉴别器中,以对拟合图像进行真实性鉴别,输出拟合图像的真实性预测结果;根据拟合图像的真实性预测结果对生成对抗网络中待训练的生成器进行第二训练,直至达到第二训练停止条件时停止;返回基于样本图像、图像标签及拟合图像对生成对抗网络中待训练的鉴别器进行第一训练的步骤并继续执行,直至达到迭代停止条件时停止训练,得到训练好的生成对抗网络。
具体地,计算机设备可交替对生成器和鉴别器进行训练,直至达到迭代停止条件时结束训练。计算机设备可在生成器后添加梯度反转层,由梯度反转层将生成器与鉴别器串联,形成生成对抗网络。当需要对生成对抗网络进行训练时,计算机设备固定生成器、及鉴别器其中一个模型的模型参数,将固定了模型参数的模型置为固定状态,将未固定模型参数的模型置为非固定状态,并对应调整处于非固定状态的模型的模型参数。当处于非固定状态的模型的模型参数调整完毕时,计算机设备将处于固定状态的模型置为非固定状态,以及将处于非固定状态的模型置为固定状态,返回对应调整处于非固定状态的模型的模型参数的步骤,直至达到迭代停止条件。比如,当固定生成器中的模型参数时,计算机设备基于生成器的输出对应调整鉴别器的模型参数,直至达到第一训练停止条件。进一步地,计算机设备转为固定达到第一训练停止条件的鉴别器的模型参数,并基于鉴别器的输出对应调整生成器的模型参数,直至达到第二训练停止条件。如此反复,直至达到迭代停止条件时停止迭代。
当固定生成器的模型参数,对鉴别器进行第一训练时,计算机设备将样本图像以及拟合图像作为输入图像输入至待训练的鉴别器,由待训练的鉴别器对输入图像的真实性进行鉴别。进一步地,待训练的鉴别器基于鉴别结果和图像标签确定鉴别器损失,通过鉴别器损失函数确定下降梯度,并根据下降梯度对应调整模型参数,直至达到第一训练停止条件。其中,第一训练停止条件可以是鉴别结果与图像标签之间的差异达到预设的最小值,或训练迭代次数达到预设的迭代次数,亦或鉴别器的鉴别性能达到预设性能等。
当固定鉴别器的模型参数,对生成器进行第二训练时,计算机设备将生成器输出的拟合图像输入至通过第一训练得到的鉴别器中,由通过第一训练得到的鉴别器对拟合图像进行真实性鉴别,输出拟合图像的真实性预测结果,并将真实性预测结果通过梯度反转层输入至待 训练的生成器。待训练的生成器通过真实性预测结果对应调整模型参数,直至达到第二训练停止条件。其中,第二训练停止条件可以是真实性预测结果为真,或训练迭代次数达到预设的迭代次数,亦或生成器的性能达到预设性能等。
在其中一个实施例中,生成对抗网络中的生成器和鉴别器支持灵活独立选择,单独每个模型均可实现最优配置,而不需要妥协任意一个环节的性能。换言之,本申请所涉及的生成器和鉴别器分别可以自由选择擅长相应领域的专用模型。
本实施例中,基于生成器和鉴别器分别对应损失函数对生成对抗网络进行联合训练,使得生成对抗网络中的生成器和鉴别器均能达到良好的性能,从而基于训练后的生成器所提取出的伪像图具有良好的可信度。
在其中一个实施例中,样本图像包括真实样本图像和虚假样本图像;图像标签包括虚假区域标签和图像真伪标签;鉴别器包括虚假区域鉴别器和视觉真实鉴别器;基于样本图像、图像标签及拟合图像对生成对抗网络中待训练的鉴别器进行第一训练,直至达到第一训练停止条件时停止,包括:将真实样本图像和虚假样本图像分别输入至虚假区域鉴别器,通过虚假区域鉴别器输出真实样本图像和虚假样本图像分别对应的第一虚假区域预测结果;基于真实样本图像和虚假样本图像分别对应的第一虚假区域预测结果和虚假区域标签,确定第一虚假区域损失;将真实样本图像和拟合图像分别作为输入图像输入至视觉真实鉴别器,输出与输入图像对应的第一视觉真实预测结果;基于输入图像所对应的第一视觉真实预测结果和图像真伪标签,确定第一视觉真实损失;根据第一虚假区域损失和第一视觉真实损失构建鉴别器损失函数;通过鉴别器损失函数对虚假区域鉴别器和视觉真实鉴别器进行第一训练,直至达到第一训练停止条件时停止。
其中,图像标签包括虚假区域标签以及图像真伪标签;虚假区域标签是指用于标识样本图像中的虚假区域的标签,比如,该虚假区域标签可以为用以将虚假区域进行框选的矩形框等。图像真伪标签是指用于表征样本图像的真伪的信息,比如,当样本图像为真实图像时,可以将此样本图像的真伪标签设置为“1”;当样本图像为虚假图像时,可以将此样本图像的真伪标签设置为“0”。
为了对生成器输出的拟合图像的真实性进行准确鉴别,本申请的实施例构造有虚假区域鉴别器以及视觉真实鉴别器。其中,虚假区域鉴别器用于对拟合图像中的虚假区域进行鉴别,在理想状态下,生成器输出的拟合图像应不包含有虚假区域,从而虚假区域鉴别器判定拟合图像中的虚假区域为空。视觉真实鉴别器用于对拟合图像的真实性进行鉴别,即视觉真实鉴别器用于鉴别拟合图像是否为真实图像,在理想状态下,生成器输出的拟合图像应贴近真实图像,从而视觉真实鉴别器判定拟合图像的真实性为真。
具体地,当对采集得到的图像进行编辑,得到虚假样本图像时,开发人员对虚假样本图像设置图像真伪标签,以及确定虚假样本图像中的图像编辑区域,基于图像编辑区域设置虚假区域标签。
当需要对鉴别器进行第一训练时,计算机设备将真实样本图像和虚假样本图像输入至虚假区域鉴别器,通过虚假区域鉴别器分别确定真实样本图像和虚假样本图像中的虚假区域, 并基于虚假区域输出真实样本图像和虚假样本图像分别对应的第一虚假区域预测结果。虚假区域鉴别器确定第一虚假区域预测结果与对应的虚假区域标签之间的差异,根据第一虚假区域预测结果与对应的虚假区域标签之间的差异确定第一虚假区域损失。其中,第一虚假区域损失具体可以是均方误差、绝对值误差、Log-Cosh损失、分位数损失、理想分位数损失、或交叉熵损失等。以绝对值误差为例,当虚假区域鉴别器为DMask,第一虚假区域预测结果为DMask(input),虚假区域标签为mask gt时,第一虚假区域损失即为Loss DMask=|DMask(input)-mask gt|。
与此同时,计算机设备将真实样本图像和拟合图像分别作为输入图像输入至视觉真实鉴别器,基于视觉真实鉴别器对输入图像的真实性进行鉴别,得到第一视觉真实预测结果。视觉真实鉴别器确定第一视觉真实预测结果与对应的图像真伪标签之间的差异,根据第一视觉真实预测结果与对应的图像真伪标签之间的差异确定第一视觉真实损失。以第一视觉真实损失为交叉熵损失为例,当视觉真实鉴别器为DVisual,第一视觉真实预测结果为DVisual(x),图像真伪标签为cls gt,交叉熵损失为BCE时,第一视觉真实损失函数即为Loss DVisual=BCE(DVisual(x),cls gt)。
进一步地,计算机设备通过多种预设逻辑运算对第一虚假区域损失和第一视觉真实损失进行融合,得到鉴别器损失函数,并通过鉴别器损失函数对虚假区域鉴别器和视觉真实鉴别器进行训练,直至达到第一训练停止条件时停止。其中,预设逻辑运算包括但不限于四则混合运算、加权求和、或机器学习算法等。
以加权求和为例,在上述举例中,假设加权因子为r 1和r 2,则鉴别器损失函数为Loss D=r 1Loss Dmask+r 2Loss Dvisual。其中,加权因子可以是根据经验或实验设定的数值,如0.1。
本实施例中,通过对虚假区域鉴别器以及视觉真实鉴别器进行训练,使得训练后的虚假区域鉴别器可以对生成器输出的拟合图像中的虚假区域进行鉴别,以促进生成器学习到更为准确的伪像信息;使得视觉真实鉴别器可以对生成器输出的拟合图像的真实性进行鉴别,以促进生成器输出更为真实的拟合图像;两者相辅相成,从而提升生成器的可靠性。
在其中一个实施例中,该虚假区域鉴别器主要是为了使拟合图像更加真实,因而也可以用二分类鉴别器、或depth(深度)鉴别器等代替。
在其中一个实施例中,虚假区域标签的生成步骤包括:将第一预设图像的像素值设置为第一值,得到真实样本图像的虚假区域标签;第一预设图像与真实样本图像的尺寸相同;确定虚假样本图像中的虚假区域;将第二预设图像中与虚假区域对应的目标区域的像素值设置为第二值,并将第二预设图像中除目标区域之外的其他区域的像素值设置为第一值,得到虚假样本图像的虚假区域标签;其中,第二预设图像与虚假样本图像的尺寸相同,且第二值与第一值不同。
具体地,在当前样本图像为真实样本图像时,计算机设备获取第一预设图像,并将第一预设图像中各像素点的像素值设置为第一值。比如,参考图5,计算机设备将第一预设图像中各像素点的像素值置为用以表示黑色的(0),从而得到如图5所示的虚假区域标签。在当前样本图像为虚假样本图像时,计算机设备确定虚假样本图像中的虚假区域,以及获取第二 预设图像,并将第二预设图像中与虚假区域对应的目标区域的像素值设置为第二值,将第二预设图像中除目标区域之外的其他区域的像素值设置为第一值。比如,参考图6,计算机设备将目标区域的像素值置为用以标识白色的(1),将除目标区域之外的其余区域的像素值置为用以表示黑色的(0)。图5示出了一个实施例的虚假区域标签的示意图。
值的注意的是,第一预设图像以及第二预设图像与样本图像的尺寸相同;第二值与第一值不同;第一预设图像与第二预设图像可以相同,也可以不同。
在其中一个实施例中,当虚假样本图像为包含有人脸的人脸图像时,计算机设备通过预设的人脸检测算法,检测虚假样本图像中的人脸轮廓,并根据人脸轮廓确定虚假区域,根据虚假区域生成对应的虚假区域标签。
上述实施例中,通过将虚假区域标签进行二值化,不仅可以基于二值化后的虚假区域标签准确定位出虚假区域,而且可以简化鉴别器回归训练的复杂度,从而提升生成对抗网络训练的效率。
在其中一个实施例中,真实性预测结果包括第二虚假区域预测结果和第二视觉真实预测结果;将拟合图像输入至通过第一训练得到的鉴别器中,以对拟合图像进行真实性鉴别,输出拟合图像的真实性预测别结果,包括:将拟合图像输入至通过第一训练得到的虚假区域鉴别器中,输出与拟合图像对应的第二虚假区域预测结果;将拟合图像输入至通过第一训练得到的视觉真实鉴别器中,输出与拟合图像对应的第二视觉真实预测结果。
具体地,当固定鉴别器的模型参数,对生成器进行训练时,计算机设备将样本图像输入至生成器,由生成器输出与样本图像对应的拟合图像,并将拟合图像输入至通过第一训练得到的虚假区域鉴别器和视觉真实鉴别器中。虚假区域鉴别器和视觉真实鉴别器按照上述方法对拟合图像进行鉴别,并根据鉴别结果对应输出第二虚假区域预测结果和第二视觉真实预测结果。
本实施例中,由于可以基于虚假区域鉴别器以及视觉生成鉴别器对拟合图像进行鉴别,使得后续可以根据鉴别结果对应调整生成器模型参数,从而得到可信的生成器。
在其中一个实施例中,根据拟合图像的真实性预测结果对生成对抗网络中待训练的生成器进行第二训练,直至达到第二训练停止条件时停止,包括:基于与拟合图像对应的第二虚假区域预测结果以及与真实样本图像对应的虚假区域标签,确定第二虚假区域损失;基于与拟合图像对应的第二视觉真实预测结果以及与真实样本图像对应的图像真伪标签,确定第二视觉真实损失;根据第二虚假区域损失和第二视觉真实损失构建生成器损失函数;通过生成器损失函数对生成对抗网络中待训练的生成器进行训练,直至达到第二训练停止条件时停止。
具体地,生成器确定第二虚假区域预测结果与对应的真实样本图像之间的差异,并根据第二虚假区域预测结果与对应的真实样本图像之间的差异确定第二虚假区域损失。以第二虚假区域损失为绝对值误差为例,当虚假区域鉴别器为DMask,第二虚假区域预测结果为DMask(live),与真实样本图像对应的虚假区域标签为zeromap时,第二虚假区域损失即为Loss GMask=|(DMask(live)-zeromap|。其中,zeromap可以为一张与真实样本图像尺寸相同的全黑图。
与此同时,生成器确定第二视觉真实预测结果以及真实样本图像对应的图像真伪标签之间的差异,根据第二视觉真实预测结果以及真实样本图像对应的图像真伪标签之间的差异确定第二真实损失。以第二视觉真实损失为交叉熵损失为例,当视觉真实鉴别器为DVisual,第二视觉真实预测结果为DVisual(live),与真实样本图像对应的图像真伪标签为1,交叉熵损失为BCE时,第一视觉真实损失函数即为Loss GVisual=BCE(DVisual(live),1)。
进一步地,计算机设备通过多种预设逻辑运算对第二虚假区域损失和第二视觉真实损失进行融合,得到生成器损失函数,并通过生成器损失函数对生成器进行训练,直至达到第二训练停止条件时停止。
以加权求和为例,在上述举例中,假设加权因子为r 3和r 4,则对应的生成器损失函数为Loss G=r 3Loss Dmask+r 4Loss Gvisual
本实施例中,由于可以通过第二虚假区域损失以及第二视觉真实损失对生成器进行约束,因此,经第二虚假区域损失以及第二视觉真实损失联合训练后的生成器所输出的拟合图像不仅可以无限接近真实图像,而且所包含的虚假区域可以为空。
在其中一个实施例中,上述图像真伪检测方法还包括:确定与真实样本图像所对应的预测伪像图;基于真实样本图像对应的预测伪像图与真实样本图像对应的虚假区域标签间的差异,确定伪像损失;根据第二虚假区域损失和第二视觉真实损失构建生成器损失函数,包括:根据伪像损失、第二虚假区域损失及第二视觉真实损失,构建生成器损失函数。
具体地,由于在理想状态下,当输入的样本图像为真实样本图像时,生成器所输出的预测伪像图应该与真实样本图像对应的虚假区域标签一致,因此,可以对真实样本图像添加伪像损失,基于伪像损失对生成器进行训练,以使训练后的生成器输出的真实样本图像对应的预测伪像图,能够与真实样本图像对应的虚假区域标签一致。
当将真实样本图像输入生成器,并基于生成器输出预测伪像图时,计算机设备确定真实样本图像对应的预测伪像图与真实样本图像对应的虚假区域标签之间的差异,并根据差异确定对应的伪像损失。以伪像损失为绝对值误差为例,当与真实样本图像对应的预测伪像图为artifact A,与真实样本图像对应的虚假区域标签为zeromap时,伪像损失即为Loss Gartifact=|(artifact A-zeromap|。
进一步地,计算机设备通过多种预设逻辑运算对伪像损失、第二虚假区域损失以及第二视觉真实损失进行融合,得到生成器损失函数,并通过生成器损失函数对生成器进行训练,直至达到第二训练停止条件时停止。以加权求和为例,在上述举例中,假设加权因子为r 5、r 6及r 7,则生成器损失函数为Loss G=r 5Loss Gartifact+r 6Loss Gmask+r 7Loss Gvisual
在其中一个实施例中,参考图6,图6示出了一个实施例中基于生成器、虚假区域鉴别器以及视觉真进行对抗训练的示意图。如图6所示,当对生成器进行第二训练时,可以将真实样本图像以及虚假样本图像作为样本图像输入至生成器中,由生成器中的编码网络提取样本图像中的图像特征,由生成器中的解码器对提取出的图像特征进行解码,从而得到与真实样本图像对应的预测伪像图以及与虚假样本图像对应的预测伪像图。进一步地,生成器将真实样本图像减去对应的预测伪像图,以及将虚假样本图像减去对应的预测伪像图,得到与真 实样本图像以及虚假样本图像分别对应的拟合图像,并将拟合图像输入至虚假区域鉴别器、视觉真实鉴别器,由虚假区域鉴别器和视觉真实鉴别器对输入的拟合图像的真实性进行鉴别,得到第二虚假区域预测结果和第二视觉真实预测结果,并将第二虚假区域预测结果和第二视觉真实预测结果返回至生成器,以使生成器根据返回的第二虚假区域预测结果和第二视觉真实预测结果对应调整模型参数。
当对虚假区域鉴别器以及视觉真实鉴别器进行训练时,计算机设备将样本图像输入至虚假区域鉴别器,由虚假区域鉴别器输出与样本图像对应的第一虚假区域预测结果,以及将真实样本图像和拟合图像作为输入图像输入视觉真实鉴别器,由视觉真实鉴别器输出对应的第一视觉真实预测结果。计算机设备基于样本图像所对应的第一虚假区域预测结果和虚假区域标签,确定第一虚假区域损失,以及基于输入图像所对应的第一视觉真实预测结果和图像真伪标签,确定第一视觉真实损失,并根据第一虚假区域损失和第一视觉真实损失构建鉴别器损失函数;通过鉴别器损失函数对所述虚假区域鉴别器和所述视觉真实鉴别器进行第一训练,直至达到第一训练停止条件时停止。计算机设备交替进行第一训练和第二训练,直至达到迭代停止条件。
上述实施例中,通过对真实样本图像的预测伪像图设置约束,使得训练后的生成器可以准确区分真实图像和虚假图像,从而提升了图像真伪检测的准确性。
在一个具体实施例中,如图7所示,本申请提供的图像真伪检测方法包括以下步骤:
S702,获取包括有人脸的待检测视频,对待检测视频进行解析得到对应的视频帧。
S704,对视频帧进行人脸检测,并基于人脸检测的结果从视频帧中裁剪出包括有人脸区域的人脸图像,得到待检测图像。
S706,将待检测图像输入至生成对抗网络的生成器中,通过生成器输出与待检测图像对应的伪像图;伪像图用于表征待检测图像与真实图像间的差异;其中,生成对抗网络在训练阶段还包括鉴别器;在训练阶段,鉴别器用于对基于生成器输出的预测伪像图所生成的拟合图像进行真实性鉴别,以辅助生成器学习到虚假图像与真实图像间的差异特征。
S708,确定伪像图所包括的各像素点的像素值,基于各像素点的像素值确定与伪像图对应的平均像素值。
S710,当平均像素值大于等于像素阈值时,确定待检测图像为虚假图像;当平均像素值小于像素阈值时,确定待检测图像为真实图像;当待检测图像的真伪检测结果表示待检测图像为虚假图像时,获取对应的标记信息;将标记信息添加至待检测图像中;标记信息用于表征待检测图像为虚假图像。
上述图像真伪检测方法,当获取得到待检测图像时,通过将待检测图像输入对抗网络中的生成器,可以基于生成器输出真实且合理的,用于表征待检测图像与真实图像间的差异的伪像图,如此,便能基于伪像图中的伪像信息,确定待检测图像的真伪检测结果。由于生成器可以通过与鉴别器之间的对抗训练,学习到真实图像与虚假图像之间的最本质区别特征,因此,相比于传统的通过检测图像中的某些特定瑕疵,来对图像进行真伪检测,本申请无需依赖特定瑕疵,并在待检测图像不存在特定瑕疵时,依旧能够通过确定待检测图像与真实图 像之间的区别特征,来确定待检测图像的真伪检测结果,如此,大大提升了图像检测的泛化性。
并且,由于生成器是通过与鉴别器进行对抗训练而得,而鉴别器可以用于对生成器输出的预测伪像图所生成的拟合图像进行真实性鉴别,因此,训练后的生成器可以学习到虚假图像与真实图像间的本质差异特征,从而生成真实且合理的伪像信息,进而对待检测图像进行准确判断。
在另一个具体实施例中,如图8所示,本申请提供的图像真伪检测方法包括以下步骤:
S802,获取样本图像以及各样本图像所对应的图像标签;图像标签包括虚假区域标签和图像真伪标签。
S804,将各样本图像输入至生成对抗网络中待训练的生成器,通过待训练的生成器输出与各样本图像分别对应的预测伪像图;
S806,对样本图像和相应的预测伪像图进行像素匹配,确定样本图像和预测伪像图中对应相同像素位置的第一像素点和第二像素点。
S808,将第一像素点的像素值减去相同像素位置处的第二像素点的像素值,得到与相应像素位置对应的拟合像素值;基于各像素位置分别对应的拟合像素值,确定样本图像的拟合图像。
S810,将样本图像分别输入至虚假区域鉴别器,通过虚假区域鉴别器输出与样本图像对应的第一虚假区域预测结果;基于样本图像所对应的第一虚假区域预测结果和虚假区域标签,确定第一虚假区域损失。
S812,样本图像包括真实样本图像,将真实样本图像和拟合图像分别作为输入图像输入至视觉真实鉴别器,输出与输入图像对应的第一视觉真实预测结果;基于输入图像所对应的第一视觉真实预测结果和图像真伪标签,确定第一视觉真实损失。
S814,根据第一虚假区域损失和第一视觉真实损失构建鉴别器损失函数;通过鉴别器损失函数对虚假区域鉴别器和视觉真实鉴别器进行训练,直至达到第一训练停止条件时停止。
S816,将拟合图像输入至通过第一训练得到的虚假区域鉴别器中,输出与拟合图像对应的第二虚假区域预测结果;将拟合图像输入至通过第一训练得到的视觉真实鉴别器中,输出与拟合图像对应的第二视觉真实预测结果。
S818,基于与拟合图像对应的第二虚假区域预测结果及与真实样本图像对应的虚假区域标签,确定第二虚假区域损失;基于与拟合图像对应的第二视觉真实预测结果及与真实样本图像对应的图像真伪标签,确定第二视觉真实损失。
S820,确定与真实样本图像所对应的预测伪像图;基于真实样本图像对应的预测伪像图与真实样本图像对应的虚假区域标签间的差异,确定伪像损失。
S822,根据伪像损失、第二虚假区域损失及第二视觉真实损失,构建生成器损失函数;通过生成器损失函数对生成对抗网络中待训练的生成器进行训练,直至达到第二训练停止条件时停止。
S824,返回基于样本图像、图像标签、及拟合图像对生成对抗网络中待训练的鉴别器进行第一训练的步骤并继续执行,直至达到迭代停止条件时停止训练,得到训练好的生成对抗网络。
S826,获取待检测图像。
S828,将待检测图像输入至生成对抗网络的生成器中,通过生成器输出与待检测图像对应的伪像图;伪像图用于表征待检测图像与真实图像间的差异;其中,生成对抗网络在训练阶段还包括鉴别器;在训练阶段,鉴别器用于对基于生成器输出的预测伪像图所生成的拟合图像进行真实性鉴别,以辅助生成器学习到虚假图像与真实图像间的差异特征。
S830,基于伪像图确定待检测图像的真伪检测结果。
在另一个具体实施例中,如图9所示,本申请提供的图像真伪检测方法包括以下步骤:
S902,将第一预设图像的像素值设置为第一值,得到真实样本图像的虚假区域标签;第一预设图像与真实样本图像的尺寸相同。
S904,确定虚假样本图像中的虚假区域。
S906,将第二预设图像中与虚假区域对应的目标区域的像素值设置为第二值,并将第二预设图像中除目标区域之外的其他区域的像素值设置为第一值,得到虚假样本图像的虚假区域标签;其中,第二预设图像与虚假样本图像的尺寸相同,且第二值与第一值不同。
S908,获取样本图像以及各样本图像所对应的虚假区域标签和图像真伪标签。
S910,将各样本图像输入至生成对抗网络中待训练的生成器,通过待训练的生成器输出与各样本图像分别对应的预测伪像图。
S912,根据预测伪像图,生成与样本图像对应的拟合图像;基于样本图像、图像标签及拟合图像对生成对抗网络中的生成器和鉴别器进行迭代对抗训练,直至达到迭代停止条件时停止训练。
S914,获取待检测图像。
S916,将待检测图像输入至生成对抗网络的生成器中,通过生成器输出与待检测图像对应的伪像图;伪像图用于表征待检测图像与真实图像间的差异;其中,生成对抗网络在训练阶段还包括鉴别器;在训练阶段,鉴别器用于对基于生成器输出的预测伪像图所生成的拟合图像进行真实性鉴别,以辅助生成器学习到虚假图像与真实图像间的差异特征。
S918,基于伪像图确定待检测图像的真伪检测结果。
本申请还提供了一种图像真伪检测方法,以应用与计算机设备为例进行说明,该计算机设备具体可以是图1中的终端或服务器。其中,如图10所示,该图像真伪检测方法包括:
S1002,获取样本图像及各样本图像对应的图像标签;样本图像包括真实样本图像和虚假样本图像;图像标签包括虚假区域标签和图像真伪标签。
具体地,当需要对生成对抗网络进行训练时,可将样本图像以及样本图像对应的图像标签输入至计算机设备中。其中,样本图像包括真实样本图像以及虚假样本图像;图像标签包括虚假区域标签以及图像真伪标签。
S1004,将各真实样本图像和虚假样本图像分别输入至生成对抗网络中待训练的生成器, 通过待训练的生成器输出各真实样本图像和虚假样本图像分别对应的预测伪像图,并根据各预测伪像图,生成真实样本图像和虚假样本图像分别对应的拟合图像。
S1006,将真实样本图像、虚假样本图像和拟合图像分别输入至生成对抗网络中待训练的鉴别器中,输出第一虚假区域预测结果和第一视觉真实预测结果。
S1008,基于第一虚假区域预测结果与相对应的虚假区域标签间的第一差异、以及第一视觉真实预测结果与相对应的图像真伪标签间的第二差异,对待训练的鉴别器进行第一训练,直至达到第一训练停止条件时停止。
具体地,计算机设备将各样本图像输入至生成对抗网络中的待训练的生成器中,由待训练的生成器输出与各样本图像对应的预测伪像图,并将各样本图像减去对应的预测伪像图,得到与各样本图像分别对应的拟合图像。计算机设备将样本图像和拟合图像输入至生成对抗网络中的待训练的鉴别器中,由待训练的鉴别器输出第一虚假区域预测结果和第一视觉真实预测结果。计算机设备确定第一虚假区域预测结果与相应的虚假区域标签之间的第一差异、以及第一视觉真实预测结果与相应的图像真伪标签之间的第二差异,并根据第一差异以及第二差异构建鉴别器的损失函数,基于鉴别器的损失函数对待训练的鉴别器进行第一训练,直至达到第一训练停止条件时停止。
其中,鉴别器包括虚假区域鉴别器以及视觉真实鉴别器;第一差异具体可以是上述实施例中提及的第一虚假区域损失表示、第二差异具体可以是上述实施例中提及的第一视觉真实损失表示;第一差异以及第二差异的确定方式,可分别按照上述的第一虚假区域损失及第一视觉真实损失的计算方式计算得到。其中,计算机设备进行第一训练的具体内容可参考前述实施例中的相关描述。
其中,将样本图像和拟合图像分别输入至生成对抗网络中待训练的鉴别器中,输出第一虚假区域预测结果和第一视觉真实预测结果;基于第一虚假区域预测结果与相对应的虚假区域标签间的第一差异以及第一视觉真实预测结果与相对应的图像真伪标签间的第二差异,对待训练的鉴别器进行第一训练,直至达到第一训练停止条件时停止,包括:将样本图像分别输入至虚假区域鉴别器,通过虚假区域鉴别器输出与样本图像对应的第一虚假区域预测结果;基于样本图像所对应的第一虚假区域预测结果和虚假区域标签,确定第一虚假区域损失;将真实样本图像和拟合图像分别作为输入图像输入至视觉真实鉴别器,输出与输入图像对应的第一视觉真实预测结果;基于输入图像所对应的第一视觉真实预测结果和图像真伪标签,确定第一视觉真实损失;根据第一虚假区域损失和第一视觉真实损失构建鉴别器损失函数;通过鉴别器损失函数对虚假区域鉴别器和视觉真实鉴别器进行第一训练,直至达到第一训练停止条件时停止。
S1010,将拟合图像输入至通过第一训练得到的鉴别器中,输出拟合图像的第二虚假区域预测结果和第二视觉真实预测结果。
具体地,计算机设备将拟合图像输入至经第一训练得到的鉴别器中,由经第一训练的鉴别器输出拟合图像的第二虚假区域预测结果以及第二视觉真实预测结果。
其中,将拟合图像输入至通过第一训练得到的鉴别器中,输出拟合图像的第二虚假区域 预测结果和第二视觉真实预测结果,包括:将拟合图像输入至通过第一训练得到的虚假区域鉴别器中,输出与拟合图像对应的第二虚假区域预测结果;将拟合图像输入至通过第一训练得到的视觉真实鉴别器中,输出与拟合图像对应的第二视觉真实预测结果。
S1012,基于第二虚假区域预测结果与真实样本图像所对应的虚假区域标签间的第三差异以及第二视觉真实预测结果与真实样本图像所对应的图像真伪标签间的第四差异,对待训练的生成器进行第二训练,直至达到第二训练停止条件时停止。
具体地,计算机设备确定第二虚假区域预测结果与真实样本图像对应的虚假区域标签之间的第三差异,以及确定第二视觉真实预测结果与真实样本图像对应的图像真伪标签之间的第四差异,根据第三差异以及第四差异构建生成器的损失函数,基于生成器的损失函数对生成器进行第二训练,直至达到第二训练停止条件时停止。
其中,第三差异具体可通过上述实施例的第二虚假区域损失表示;第四差异可通过上述实施例的第二视觉真实损失表示;第三差异以及第四差异的确定方式,可分别按照上述实施例的第二虚假区域损失及第二视觉真实损失的计算方式计算得到。其中,计算机设备进行第二训练的具体内容可参考前述实施例中的相关描述。
其中,基于第二虚假区域预测结果与真实样本图像所对应的虚假区域标签间的第三差异以及第二视觉真实预测结果与真实样本图像所对应的图像真伪标签间的第四差异,对待训练的生成器进行第二训练,直至达到第二训练停止条件时停止,包括:基于与拟合图像对应的第二虚假区域预测结果以及与真实样本图像对应的虚假区域标签,确定第二虚假区域损失;基于与拟合图像对应的第二视觉真实预测结果以及与真实样本图像对应的图像真伪标签,确定第二视觉真实损失;根据第二虚假区域损失和第二视觉真实损失构建生成器损失函数;通过生成器损失函数对生成对抗网络中待训练的生成器进行第二训练,直至达到第二训练停止条件时停止。
S1014,交替进行第一训练和第二训练,直至达到迭代停止条件时停止训练,得到训练好的生成对抗网络;训练好的生成对抗网络中的生成器用于对待检测图像进行图像真伪检测。
具体地,计算机设备交替进行第一训练以及第二训练,直至达到迭代停止条件时停止训练,得到训练好的生成对抗网络,并将待检测图像输入至训练好的生成对抗网络中的生成器,由训练好的生成器输出待检测图像对应的伪像图,并基于伪像图确定待检测图像的真伪检测结果。
在其中一个实施例中,还可以确定第五差异,根据第五差异、第四差异及第三差异,构建生成器损失函数。其中,第五差异具体可通过上述的伪像损失表示。第五差异的确定方式包括:确定与真实样本图像对应的预测伪像图;将真实样本图像对应的预测伪像图与真实样本图像对应的虚假区域标签间的差异,作为第五差异。
上述图像真伪检测方法,通过对生成器和鉴别器进行对抗训练,在训练过程中,生成器用于学习伪像图,并基于伪像图合成拟合图像;鉴别器在一方面学习到真实样本图像和虚假样本图像所对应的虚假区域信息,以具备对拟合图像的虚假区域的重建能力,在另一方面,可以学习到真实样本图像和拟合图像间的区别,以具备鉴别拟合图像的真实性的能力。这样 迭代对抗训练后,可使得训练后的生成对抗网络中的生成器和鉴别器均能达到良好的性能,从而基于训练后的生成器所提取出的伪像图具有良好的可信度。
本申请还提供一种应用场景,该应用场景应用上述的图像真伪检测方法。具体地,该图像真伪检测方法在该应用场景的应用如下:
当基于账号管理应用对用户账号进行冻结之前,为了保证账号安全,账号管理应用可以通过调用图像采集装置采集当前用户的人脸图像,并将当前用户的人脸图像发送至服务器,由服务器对当前用户的人脸图像进行人脸验证。当服务器接收到当前用户的人脸图像,服务器将当前用户的人脸图像输入至生成对抗网络中的生成器,通过生成器确定与待检测图像对应的伪像图,并基于伪像图中的伪像信息,对当前用户的人脸图像的真伪进行判定,从而在当前用户的人脸图像为虚假图像时,账号管理应用拒绝对用户账号进行冻结;在当前用户的人脸图像为真实图像时,账号管理应用对用户账号进行冻结。
应该理解的是,虽然图2、图7、图8、图9和图10的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,图2、图7、图8、图9和图10中的至少一部分步骤可以包括多个步骤或者多个阶段,这些步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤中的步骤或者阶段的至少一部分轮流或者交替地执行。
在其中一个实施例中,如图11所示,提供了一种图像真伪检测装置1100,该装置可以采用软件模块或硬件模块,或者是二者的结合成为计算机设备的一部分,该装置具体包括:图像获取模块1102、伪像图生成模块1104和判定模块1106,其中:
图像获取模块1102,用于获取待检测图像。
伪像图生成模块1104,用于将待检测图像输入至生成对抗网络的生成器中,通过生成器输出与待检测图像对应的伪像图;伪像图用于表征待检测图像与真实图像间的差异;其中,生成对抗网络在训练阶段还包括鉴别器;在训练阶段,生成器用于输出与样本图像对应的预测伪像图,并基于预测伪像图生成拟合图像;鉴别器用于对拟合图像进行真实性鉴别,以辅助生成器学习到虚假图像与真实图像间的差异特征;
判定模块1106,用于基于伪像图确定待检测图像的真伪检测结果。
在其中一个实施例中,如图12所示,图像获取模块1102还用包括视频解析模块1121,用于获取包括有人脸的待检测视频;对待检测视频进行解析得到对应的视频帧;对视频帧进行人脸检测,并基于人脸检测的结果从视频帧中裁剪出包括有人脸区域的人脸图像。
在其中一个实施例中,判定模块1106还用于确定伪像图所包括的各像素点的像素值;基于各像素点的像素值确定与伪像图对应的平均像素值;当平均像素值大于等于像素阈值时,确定待检测图像为虚假图像;当平均像素值小于像素阈值时,确定待检测图像为真实图像。
在其中一个实施例中,图像真伪检测装置1100还用于当待检测图像的真伪检测结果表示待检测图像为虚假图像时,获取对应的标记信息;将标记信息添加至待检测图像中;标记信 息用于表征待检测图像为虚假图像。
在其中一个实施例中,图像真伪检测装置1100还包括模型训练模块1108,用于获取样本图像、以及各样本图像所对应的图像标签;将各样本图像输入至生成对抗网络中待训练的生成器,通过待训练的生成器输出与各样本图像分别对应的预测伪像图;根据预测伪像图,生成与样本图像对应的拟合图像;基于样本图像、图像标签及拟合图像对生成对抗网络中的生成器和鉴别器进行迭代对抗训练,直至达到迭代停止条件时停止训练。
在其中一个实施例中,模型训练模块1108还用于对样本图像和相应的预测伪像图进行像素匹配,确定样本图像和预测伪像图中相应相同像素位置的第一像素点和第二像素点;将第一像素点的像素值减去相同像素位置处的第二像素点的像素值,得到与相应像素位置对应的拟合像素值;基于各像素位置分别对应的拟合像素值,确定样本图像的拟合图像。
在其中一个实施例中,模型训练模块1108还用于基于样本图像、图像标签及拟合图像对生成对抗网络中待训练的鉴别器进行第一训练,直至达到第一训练停止条件时停止;将拟合图像输入至通过第一训练得到的鉴别器中,以对拟合图像进行真实性鉴别,输出拟合图像的真实性预测结果;根据拟合图像的真实性预测结果对生成对抗网络中待训练的生成器进行第二训练,直至达到第二训练停止条件时停止;返回基于样本图像、图像标签及拟合图像对生成对抗网络中待训练的鉴别器进行第一训练的步骤并继续执行,直至达到迭代停止条件时停止训练,得到训练好的生成对抗网络。
在其中一个实施例中,样本图像包括真实样本图像和虚假样本图像;图像标签包括虚假区域标签和图像真伪标签;鉴别器包括虚假区域鉴别器和视觉真实鉴别器;模型训练模块1108还包括鉴别器训练模块1181,用于将真实样本图像和虚假样本图像分别输入至虚假区域鉴别器,通过虚假区域鉴别器输出真实样本图像和虚假样本图像分别对应的第一虚假区域预测结果;基于真实样本图像和虚假样本图像分别对应的第一虚假区域预测结果和虚假区域标签,确定第一虚假区域损失;将真实样本图像和拟合图像分别作为输入图像输入至视觉真实鉴别器,通过视觉真实鉴别器输出与输入图像对应的第一视觉真实预测结果;基于输入图像所对应的第一视觉真实预测结果和图像真伪标签,确定第一视觉真实损失;根据第一虚假区域损失和第一视觉真实损失构建鉴别器损失函数;通过鉴别器损失函数对虚假区域鉴别器和视觉真实鉴别器进行第一训练,直至达到第一训练停止条件时停止。
在其中一个实施例中,鉴别器训练模块1181还用于将第一预设图像的像素值设置为第一值,得到真实样本图像的虚假区域标签;第一预设图像与真实样本图像的尺寸相同;确定虚假样本图像中的虚假区域;将第二预设图像中与虚假区域对应的目标区域的像素值设置为第二值,并将第二预设图像中除目标区域之外的其他区域的像素值设置为第一值,得到虚假样本图像的虚假区域标签;其中,第二预设图像与虚假样本图像的尺寸相同,且第二值与第一值不同。
在其中一个实施例中,真实性预测结果包括第二虚假区域预测结果和第二视觉真实预测结果;模型训练模块1108还包括生成器训练模块1182,用于将拟合图像输入至通过第一训练得到的虚假区域鉴别器中,输出与拟合图像对应的第二虚假区域预测结果;将拟合图像输 入至通过第一训练得到的视觉真实鉴别器中,输出与拟合图像对应的第二视觉真实预测结果。
在其中一个实施例中,生成器训练模块1182还用于基于与拟合图像对应的第二虚假区域预测结果以及与真实样本图像对应的虚假区域标签,确定第二虚假区域损失;基于与拟合图像对应的第二视觉真实预测结果以及与真实样本图像对应的图像真伪标签,确定第二视觉真实损失;根据第二虚假区域损失和第二视觉真实损失构建生成器损失函数;通过生成器损失函数对生成对抗网络中待训练的生成器进行第二训练,直至达到第二训练停止条件时停止。
在其中一个实施例中,生成器训练模块1182还用于确定与真实样本图像所对应的预测伪像图;基于真实样本图像对应的预测伪像图与真实样本图像对应的虚假区域标签间的差异,确定伪像损失;根据第二虚假区域损失和第二视觉真实损失构建生成器损失函数,包括:根据伪像损失、第二虚假区域损失及第二视觉真实损失,构建生成器损失函数。
如图13所示,提供了一种图像真伪检测装置1300,该装置可以采用软件模块或硬件模块,或者是二者的结合成为计算机设备的一部分,该装置具体包括:获取模块1302、拟合图像生成模块1304和训练模块1306,其中:
获取模块1302,用于获取样本图像及各样本图像对应的图像标签;样本图像包括真实样本图像和虚假样本图像;图像标签包括虚假区域标签和图像真伪标签;
拟合图像生成模块1304,用于将各真实样本图像和虚假样本图像分别输入至生成对抗网络中待训练的生成器,通过待训练的生成器输出各真实样本图像和虚假样本图像分别对应的预测伪像图,并根据各预测伪像图,生成真实样本图像和虚假样本图像分别对应的拟合图像;
训练模块1306,用于将真实样本图像、虚假样本图像和拟合图像分别输入至生成对抗网络中待训练的鉴别器中,输出第一虚假区域预测结果和第一视觉真实预测结果;
训练模块1306,还用于基于第一虚假区域预测结果与相对应的虚假区域标签间的第一差异以及第一视觉真实预测结果与相对应的图像真伪标签间的第二差异,对待训练的鉴别器进行第一训练,直至达到第一训练停止条件时停止;
训练模块1306,用于将拟合图像输入至通过第一训练得到的鉴别器中,输出拟合图像的第二虚假区域预测结果和第二视觉真实预测结果;
训练模块1306,还用于基于第二虚假区域预测结果与真实样本图像所对应的虚假区域标签间的第三差异以及第二视觉真实预测结果与真实样本图像所对应的图像真伪标签间的第四差异,对待训练的生成器进行第二训练,直至达到第二训练停止条件时停止;
训练模块1306,还用于交替进行第一训练和第二训练,直至达到迭代停止条件时停止训练,得到训练好的生成对抗网络;训练好的生成对抗网络中的生成器用于对待检测图像进行图像真伪检测。
关于图像真伪检测装置的具体限定可以参见上文中对于图像真伪检测方法的限定,在此不再赘述。上述图像真伪检测装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。
在其中一个实施例中,提供了一种计算机设备,该计算机设备可以是服务器,其内部结 构图可以如图14所示。该计算机设备包括通过系统总线连接的处理器、存储器和模型接口。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统、计算机程序和数据库。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的数据库用于存储图像真伪检测数据。该计算机设备的模型接口用于与外部的终端通过模型连接通信。该计算机程序被处理器执行时以实现一种图像真伪检测方法。
本领域技术人员可以理解,图14中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。
在其中一个实施例中,还提供了一种计算机设备,包括存储器和一个或多个处理器,存储器中存储有计算机程序可读指令,计算机可读指令被所述处理器执行时,使得一个或多个处理器执行执行上述各方法实施例中的步骤。
在其中一个实施例中,提供了一种计算机程序产品或计算机程序,该计算机程序产品或计算机程序包括计算机指令,该计算机指令存储在计算机可读存储介质中。计算机设备的处理器从计算机可读存储介质读取该计算机指令,处理器执行该计算机指令,使得该计算机设备执行上述各方法实施例中的步骤。
在其中一个实施例中,提供了一个或多个存储有计算机可读指令的非易失性可读存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行上述各方法实施例中的步骤。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和易失性存储器中的至少一种。非易失性存储器可包括只读存储器(Read-Only Memory,ROM)、磁带、软盘、闪存或光存储器等。易失性存储器可包括随机存取存储器(Random Access Memory,RAM)或外部高速缓冲存储器。作为说明而非局限,RAM可以是多种形式,比如静态随机存取存储器(Static Random Access Memory,SRAM)或动态随机存取存储器(Dynamic Random Access Memory,DRAM)等。

Claims (20)

  1. 一种图像真伪检测方法,由计算机设备执行,所述方法包括:
    获取待检测图像;
    将所述待检测图像输入至生成对抗网络的生成器中,通过所述生成器输出与所述待检测图像对应的伪像图;所述伪像图用于表征所述待检测图像与真实图像间的差异;其中,所述生成对抗网络在训练阶段还包括鉴别器;在所述训练阶段,所述生成器用于输出与样本图像对应的预测伪像图,并基于所述预测伪像图生成拟合图像;所述鉴别器用于对所述拟合图像进行真实性鉴别,以辅助所述生成器学习到虚假图像与真实图像间的差异特征;及
    基于所述伪像图确定所述待检测图像的真伪检测结果。
  2. 根据权利要求1所述的方法,其特征在于,所述待检测图像包括待检测的人脸图像,所述获取待检测图像,包括:
    获取包括有人脸的待检测视频;
    对所述待检测视频进行解析得到对应的视频帧;及
    对所述视频帧进行人脸检测,并基于人脸检测的结果从所述视频帧中裁剪出包括有人脸区域的人脸图像。
  3. 根据权利要求1所述的方法,其特征在于,所述基于所述伪像图确定所述待检测图像的真伪检测结果,包括:
    确定所述伪像图所包括的各像素点的像素值;
    基于各所述像素点的像素值确定与所述伪像图对应的平均像素值;
    当所述平均像素值大于等于像素阈值时,确定所述待检测图像为虚假图像;及
    当所述平均像素值小于所述像素阈值时,确定所述待检测图像为真实图像。
  4. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    当所述待检测图像的真伪检测结果表示所述待检测图像为虚假图像时,获取对应的标记信息;及
    将所述标记信息添加至所述待检测图像中;所述标记信息用于表征所述待检测图像为虚假图像。
  5. 根据权利要求1至4任一项所述的方法,其特征在于,所述方法还包括:
    获取样本图像以及各所述样本图像所对应的图像标签;
    将各所述样本图像输入至所述生成对抗网络中待训练的生成器,通过所述待训练的生成器输出与各所述样本图像分别对应的预测伪像图;
    根据所述预测伪像图,生成与所述样本图像对应的拟合图像;及
    基于所述样本图像、所述图像标签及所述拟合图像对所述生成对抗网络中的生成器和鉴别器进行迭代对抗训练,直至达到迭代停止条件时停止训练。
  6. 根据权利要求5所述的方法,其特征在于,所述根据所述预测伪像图,生成与所述样本图像对应的拟合图像,包括:
    对所述样本图像和相应的预测伪像图进行像素匹配,确定所述样本图像和所述预测伪像 图中对应相同像素位置的第一像素点和第二像素点;
    将所述第一像素点的像素值减去相同像素位置处的第二像素点的像素值,得到与相应像素位置对应的拟合像素值;及
    基于各像素位置分别对应的拟合像素值,确定所述样本图像的拟合图像。
  7. 根据权利要求5所述的方法,其特征在于,所述基于所述样本图像、所述图像标签及所述拟合图像对所述生成对抗网络中的生成器和鉴别器进行迭代对抗训练,直至达到迭代停止条件时停止训练,包括:
    基于所述样本图像、所述图像标签及所述拟合图像对所述生成对抗网络中待训练的鉴别器进行第一训练,直至达到第一训练停止条件时停止;
    将所述拟合图像输入至通过所述第一训练得到的鉴别器中,以对所述拟合图像进行真实性鉴别,输出所述拟合图像的真实性预测结果;
    根据所述拟合图像的真实性预测结果对所述生成对抗网络中待训练的生成器进行第二训练,直至达到第二训练停止条件时停止;及
    返回基于所述样本图像、所述图像标签及所述拟合图像对所述生成对抗网络中待训练的鉴别器进行第一训练的步骤并继续执行,直至达到迭代停止条件时停止训练,得到训练好的生成对抗网络。
  8. 根据权利要求7所述的方法,其特征在于,所述样本图像包括真实样本图像和虚假样本图像;所述图像标签包括虚假区域标签和图像真伪标签;所述鉴别器包括虚假区域鉴别器和视觉真实鉴别器;
    所述基于所述样本图像、所述图像标签及所述拟合图像对所述生成对抗网络中待训练的鉴别器进行第一训练,直至达到第一训练停止条件时停止包括:
    将所述真实样本图像和所述虚假样本图像分别输入至虚假区域鉴别器,通过所述虚假区域鉴别器输出所述真实样本图像和所述虚假样本图像分别对应的第一虚假区域预测结果;
    基于所述真实样本图像和所述虚假样本图像分别对应的第一虚假区域预测结果和虚假区域标签,确定第一虚假区域损失;
    将所述真实样本图像和所述拟合图像分别作为输入图像输入至视觉真实鉴别器,输出与所述输入图像对应的第一视觉真实预测结果;
    基于所述输入图像所对应的第一视觉真实预测结果和图像真伪标签,确定第一视觉真实损失;
    根据所述第一虚假区域损失和第一视觉真实损失构建鉴别器损失函数;及
    通过所述鉴别器损失函数对所述虚假区域鉴别器和所述视觉真实鉴别器进行第一训练,直至达到第一训练停止条件时停止。
  9. 根据权利要求8所述的方法,其特征在于,所述虚假区域标签的生成步骤包括:
    将第一预设图像的像素值设置为第一值,得到所述真实样本图像的虚假区域标签;所述第一预设图像与所述真实样本图像的尺寸相同;
    确定所述虚假样本图像中的虚假区域;及
    将第二预设图像中与所述虚假区域对应的目标区域的像素值设置为第二值,并将所述第二预设图像中除所述目标区域之外的其他区域的像素值设置为所述第一值,得到所述虚假样本图像的虚假区域标签;其中,所述第二预设图像与所述虚假样本图像的尺寸相同,且所述第二值与所述第一值不同。
  10. 根据权利要求7所述的方法,其特征在于,所述真实性预测结果包括第二虚假区域预测结果和第二视觉真实预测结果;所述将所述拟合图像输入至通过所述第一训练得到的鉴别器中,以对所述拟合图像进行真实性鉴别,输出所述拟合图像的真实性预测结果,包括:
    将所述拟合图像输入至通过所述第一训练得到的虚假区域鉴别器中,输出与所述拟合图像对应的第二虚假区域预测结果;及
    将所述拟合图像输入至通过所述第一训练得到的视觉真实鉴别器中,输出与所述拟合图像对应的第二视觉真实预测结果。
  11. 根据权利要求10所述的方法,其特征在于,所述根据所述拟合图像的真实性预测结果对所述生成对抗网络中待训练的生成器进行第二训练,直至达到第二训练停止条件时停止,包括:
    基于与所述拟合图像对应的第二虚假区域预测结果以及与真实样本图像对应的虚假区域标签,确定第二虚假区域损失;
    基于与所述拟合图像对应的第二视觉真实预测结果以及与真实样本图像对应的图像真伪标签,确定第二视觉真实损失;
    根据所述第二虚假区域损失和第二视觉真实损失构建生成器损失函数;及
    通过所述生成器损失函数对所述生成对抗网络中待训练的生成器进行第二训练,直至达到第二训练停止条件时停止。
  12. 根据权利要求11所述的方法,其特征在于,所述方法还包括:
    确定与所述真实样本图像对应的预测伪像图;及
    基于所述真实样本图像对应的预测伪像图与所述真实样本图像对应的虚假区域标签间的差异,确定伪像损失;
    所述根据所述第二虚假区域损失和第二视觉真实损失构建生成器损失函数,包括:
    根据所述伪像损失、所述第二虚假区域损失及所述第二视觉真实损失,构建生成器损失函数。
  13. 一种图像真伪检测方法,由计算机设备执行,所述方法包括:
    获取样本图像及各所述样本图像对应的图像标签;所述样本图像包括真实样本图像和虚假样本图像;所述图像标签包括虚假区域标签和图像真伪标签;
    将各真实样本图像和虚假样本图像分别输入至生成对抗网络中待训练的生成器,通过所述待训练的生成器输出各真实样本图像和虚假样本图像分别对应的预测伪像图,并根据各所述预测伪像图,生成真实样本图像和虚假样本图像分别对应的拟合图像;
    将所述真实样本图像、所述虚假样本图像和所述拟合图像分别输入至所述生成对抗网络 中待训练的鉴别器中,输出第一虚假区域预测结果和第一视觉真实预测结果;
    基于所述第一虚假区域预测结果与相对应的虚假区域标签间的第一差异以及所述第一视觉真实预测结果与相对应的图像真伪标签间的第二差异,对所述待训练的鉴别器进行第一训练,直至达到第一训练停止条件时停止;
    将所述拟合图像输入至通过所述第一训练得到的鉴别器中,输出所述拟合图像的第二虚假区域预测结果和第二视觉真实预测结果;
    基于所述第二虚假区域预测结果与所述真实样本图像所对应的虚假区域标签间的第三差异以及所述第二视觉真实预测结果与所述真实样本图像所对应的图像真伪标签间的第四差异,对所述待训练的生成器进行第二训练,直至达到第二训练停止条件时停止;及
    交替进行所述第一训练和所述第二训练,直至达到迭代停止条件时停止训练,得到训练好的生成对抗网络;所述训练好的生成对抗网络中的生成器用于对待检测图像进行图像真伪检测。
  14. 一种图像真伪检测装置,其特征在于,所述装置包括:
    图像获取模块,用于获取待检测图像;
    伪像图生成模块,用于将所述待检测图像输入至生成对抗网络的生成器中,通过所述生成器输出与所述待检测图像对应的伪像图;所述伪像图用于表征所述待检测图像与真实图像间的差异;其中,所述生成对抗网络在训练阶段还包括鉴别器;在所述训练阶段,所述生成器用于输出与样本图像对应的预测伪像图,并基于所述预测伪像图生成拟合图像;所述鉴别器用于对所述拟合图像进行真实性鉴别,以辅助所述生成器学习到虚假图像与真实图像间的差异特征;及
    判定模块,用于基于所述伪像图确定所述待检测图像的真伪检测结果。
  15. 根据权利要求14所述的装置,其特征在于,所述图像获取模块还包括视频解析模块,用于获取包括有人脸的待检测视频;对所述待检测视频进行解析得到对应的视频帧;及对所述视频帧进行人脸检测,并基于人脸检测的结果从所述视频帧中裁剪出包括有人脸区域的人脸图像。
  16. 根据权利要求14所述的装置,其特征在于,所述判定模块还用于确定所述伪像图所包括的各像素点的像素值;基于各所述像素点的像素值确定与所述伪像图对应的平均像素值;当所述平均像素值大于等于像素阈值时,确定所述待检测图像为虚假图像;及当所述平均像素值小于所述像素阈值时,确定所述待检测图像为真实图像。
  17. 根据权利要求14所述的装置,其特征在于,所述图像真伪检测装置还用于当所述待检测图像的真伪检测结果表示所述待检测图像为虚假图像时,获取对应的标记信息;及将所述标记信息添加至所述待检测图像中;所述标记信息用于表征所述待检测图像为虚假图像。
  18. 一种图像真伪检测装置,其特征在于,所述装置包括:
    获取模块,用于获取样本图像及各所述样本图像对应的图像标签;所述样本图像包括真 实样本图像和虚假样本图像;所述图像标签包括虚假区域标签和图像真伪标签;
    拟合图像生成模块,用于将各真实样本图像和虚假样本图像分别输入至生成对抗网络中待训练的生成器,通过所述待训练的生成器输出各真实样本图像和虚假样本图像分别对应的预测伪像图,并根据各所述预测伪像图,生成真实样本图像和虚假样本图像分别对应的拟合图像;
    训练模块,用于将所述真实样本图像、所述虚假样本图像和所述拟合图像分别输入至生成对抗网络中待训练的鉴别器中,输出第一虚假区域预测结果和第一视觉真实预测结果;
    所述训练模块,还用于基于所述第一虚假区域预测结果与相对应的虚假区域标签间的第一差异以及所述第一视觉真实预测结果与相对应的图像真伪标签间的第二差异,对所述待训练的鉴别器进行第一训练,直至达到第一训练停止条件时停止;
    所述训练模块,用于将所述拟合图像输入至通过所述第一训练得到的鉴别器中,输出所述拟合图像的第二虚假区域预测结果和第二视觉真实预测结果;
    所述训练模块,还用于基于所述第二虚假区域预测结果与所述真实样本图像所对应的虚假区域标签间的第三差异以及所述第二视觉真实预测结果与所述真实样本图像所对应的图像真伪标签间的第四差异,对所述待训练的生成器进行第二训练,直至达到第二训练停止条件时停止;及
    所述训练模块,还用于交替进行所述第一训练和所述第二训练,直至达到迭代停止条件时停止训练,得到训练好的生成对抗网络;所述训练好的生成对抗网络中的生成器用于对待检测图像进行图像真伪检测。
  19. 一个或多个存储有计算机可读指令的非易失性可读存储介质,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器执行如权利要求1至13中任一项所述方法的步骤。
  20. 一种计算机设备,包括存储器和一个或多个处理器,所述存储器存储有计算机可读指令,所述计算机可读指令被所述处理器执行时,使得所述方法的步骤。
PCT/CN2021/102723 2020-08-18 2021-06-28 图像真伪检测方法、装置、计算机设备和存储介质 Ceased WO2022037258A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP21857354.1A EP4123503A4 (en) 2020-08-18 2021-06-28 IMAGE AUTHENTICITY DETECTION METHOD AND APPARATUS, COMPUTER DEVICE AND STORAGE MEDIUM
US18/076,021 US12597278B2 (en) 2020-08-18 2022-12-06 Image authenticity detection method and device, computer device, and storage medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010829031.3 2020-08-18
CN202010829031.3A CN111709408B (zh) 2020-08-18 2020-08-18 图像真伪检测方法和装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US18/076,021 Continuation US12597278B2 (en) 2020-08-18 2022-12-06 Image authenticity detection method and device, computer device, and storage medium

Publications (1)

Publication Number Publication Date
WO2022037258A1 true WO2022037258A1 (zh) 2022-02-24

Family

ID=72547044

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/102723 Ceased WO2022037258A1 (zh) 2020-08-18 2021-06-28 图像真伪检测方法、装置、计算机设备和存储介质

Country Status (4)

Country Link
US (1) US12597278B2 (zh)
EP (1) EP4123503A4 (zh)
CN (1) CN111709408B (zh)
WO (1) WO2022037258A1 (zh)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115253303A (zh) * 2022-08-16 2022-11-01 北京字跳网络技术有限公司 美化虚拟对象的方法、装置、存储介质及电子设备
CN115311127A (zh) * 2022-02-25 2022-11-08 北京字跳网络技术有限公司 一种脸部处理方法、装置、计算机设备及存储介质
CN115426350A (zh) * 2022-09-23 2022-12-02 北京有竹居网络技术有限公司 图像上传方法、图像上传装置、电子设备和存储介质
CN116152593A (zh) * 2022-12-05 2023-05-23 马上消费金融股份有限公司 训练方法及图像检测方法、装置、电子设备、存储介质
CN116363463A (zh) * 2023-02-06 2023-06-30 天津大学 一种面向深度学习图像识别模型演化的模糊测试方法
CN117078524A (zh) * 2023-07-03 2023-11-17 中国银行股份有限公司 图像修复方法、装置、设备、介质和产品
CN117894083A (zh) * 2024-03-14 2024-04-16 中电科大数据研究院有限公司 一种基于深度学习的图像识别方法和系统
CN118840740A (zh) * 2024-09-23 2024-10-25 绍兴达伽马纺织有限公司 基于机器视觉的拉毛织物表面绒毛状态检测方法及系统

Families Citing this family (28)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111709408B (zh) 2020-08-18 2020-11-20 腾讯科技(深圳)有限公司 图像真伪检测方法和装置
CN114332969A (zh) * 2020-09-29 2022-04-12 湖南大学 一种新的基于手工特征提取的StyleGAN合成人脸检测方法
US12039705B2 (en) * 2020-11-13 2024-07-16 Chung Ang University Industry Academic Cooperation Foundation Method and apparatus for classifying fake images
CN112613494B (zh) * 2020-11-19 2024-08-13 北京国网富达科技发展有限责任公司 基于深度对抗网络的电力线路监控异常识别方法及系统
CN112488013B (zh) * 2020-12-04 2022-09-02 重庆邮电大学 基于时序不一致性的深度伪造视频检测方法及系统
CN113077265B (zh) * 2020-12-08 2021-11-30 鑫绪(上海)信息技术服务有限公司 直播客户信誉管理系统
CN112668462B (zh) * 2020-12-25 2024-05-07 平安科技(深圳)有限公司 车损检测模型训练、车损检测方法、装置、设备及介质
CN112991345B (zh) 2021-05-11 2021-08-10 腾讯科技(深圳)有限公司 图像真伪检测方法、装置、计算机设备和存储介质
CN113627233B (zh) * 2021-06-17 2024-08-13 中国科学院自动化研究所 基于视觉语义信息的人脸伪造检测方法和装置
CN113392835A (zh) * 2021-06-17 2021-09-14 中国工商银行股份有限公司 票据识别模型的训练方法、票据识别方法及装置
CN113449851A (zh) * 2021-07-15 2021-09-28 北京字跳网络技术有限公司 数据处理方法及设备
CN113469297B (zh) * 2021-09-03 2021-12-14 深圳市海邻科信息技术有限公司 图像篡改检测方法、装置、设备及计算机可读存储介质
CN113807281B (zh) * 2021-09-23 2024-03-29 深圳信息职业技术学院 图像检测模型的生成方法、检测方法、终端及存储介质
CN113627576B (zh) * 2021-10-08 2022-01-18 平安科技(深圳)有限公司 扫码信息检测方法、装置、设备及存储介质
CN115063868B (zh) * 2022-07-01 2026-01-30 公安部第三研究所 一种基于深度学习的人脸深度伪造鉴定方法及相关设备
CN114897901B (zh) * 2022-07-13 2022-11-01 东声(苏州)智能科技有限公司 基于样本扩充的电池质量检测方法、装置和电子设备
US20240029460A1 (en) * 2022-07-20 2024-01-25 Samsung Electronics Co., Ltd. Apparatus and method for performing image authentication
CN116542871A (zh) * 2023-04-10 2023-08-04 华南理工大学 一种基于频域特征学习的水表水雾去除的方法
CN116486464B (zh) * 2023-06-20 2023-09-01 齐鲁工业大学(山东省科学院) 一种基于注意力机制的卷积对抗网络的人脸伪造检测方法
CN116681790B (zh) * 2023-07-18 2024-03-22 脉得智能科技(无锡)有限公司 一种超声造影图像生成模型的训练方法及图像的生成方法
CN116978097B (zh) * 2023-07-25 2025-09-26 北京赛思信安技术股份有限公司 一种基于改进贝叶斯神经网络的伪造人脸视频检测方法
CN117253262B (zh) * 2023-11-15 2024-01-30 南京信息工程大学 一种基于共性特征学习的伪造指纹检测方法及装置
CN117496583B (zh) * 2023-12-29 2024-04-02 暨南大学 一种可学习局部差异的深度伪造人脸检测定位方法
CN118372238B (zh) * 2024-04-19 2025-05-09 山东科技大学 一种带两级扰动补偿的动态视觉伺服控制方法
CN118552789A (zh) * 2024-06-14 2024-08-27 湖南芒果融创科技有限公司 基于深度学习的视频伪造检测方法及系统
CN118691944B (zh) * 2024-07-05 2024-12-06 昆山康泰达智能科技有限公司 一种基于人工智能的虚拟图像检测方法
CN119445328B (zh) * 2024-10-24 2025-12-19 哈尔滨工程大学 一种跨生成器生成图像检测模型的构建方法和图像检测方法
CN119904702B (zh) * 2025-03-28 2025-06-20 深圳市梦作坊科技有限公司 基于图像识别技术的游戏界面错误检测平台

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190197358A1 (en) * 2017-12-21 2019-06-27 International Business Machines Corporation Generative Adversarial Network Medical Image Generation for Training of a Classifier
US20190236614A1 (en) * 2018-01-29 2019-08-01 Accenture Global Solutions Limited Artificial intelligence counterfeit detection
CN111179219A (zh) * 2019-12-09 2020-05-19 中国科学院深圳先进技术研究院 一种基于生成对抗网络的copy-move伪造检测方法
US20200160502A1 (en) * 2018-11-16 2020-05-21 Artificial Intelligence Foundation, Inc. Identification of Neural-Network-Generated Fake Images
CN111539483A (zh) * 2020-04-29 2020-08-14 上海融军科技有限公司 基于gan网络的虚假图像鉴别系统及构建方法
CN111709408A (zh) * 2020-08-18 2020-09-25 腾讯科技(深圳)有限公司 图像真伪检测方法和装置

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109086645B (zh) * 2017-06-13 2021-04-20 阿里巴巴集团控股有限公司 人脸识别方法、装置以及虚假用户的识别方法、装置
CN108334848B (zh) * 2018-02-06 2020-12-25 哈尔滨工业大学 一种基于生成对抗网络的微小人脸识别方法
CN108615073B (zh) * 2018-04-28 2020-11-03 京东数字科技控股有限公司 图像处理方法及装置、计算机可读存储介质、电子设备
CN108596141B (zh) * 2018-05-08 2022-05-17 深圳大学 一种深度网络生成人脸图像的检测方法及系统
GB2580629B (en) * 2019-01-17 2023-02-15 Smiths Heimann Sas Classifier using data generation
CN111429355A (zh) * 2020-03-30 2020-07-17 新疆大学 一种基于生成对抗网络的图像超分辨率重建方法
US12039705B2 (en) * 2020-11-13 2024-07-16 Chung Ang University Industry Academic Cooperation Foundation Method and apparatus for classifying fake images

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190197358A1 (en) * 2017-12-21 2019-06-27 International Business Machines Corporation Generative Adversarial Network Medical Image Generation for Training of a Classifier
US20190236614A1 (en) * 2018-01-29 2019-08-01 Accenture Global Solutions Limited Artificial intelligence counterfeit detection
US20200160502A1 (en) * 2018-11-16 2020-05-21 Artificial Intelligence Foundation, Inc. Identification of Neural-Network-Generated Fake Images
CN111179219A (zh) * 2019-12-09 2020-05-19 中国科学院深圳先进技术研究院 一种基于生成对抗网络的copy-move伪造检测方法
CN111539483A (zh) * 2020-04-29 2020-08-14 上海融军科技有限公司 基于gan网络的虚假图像鉴别系统及构建方法
CN111709408A (zh) * 2020-08-18 2020-09-25 腾讯科技(深圳)有限公司 图像真伪检测方法和装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP4123503A4

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115311127A (zh) * 2022-02-25 2022-11-08 北京字跳网络技术有限公司 一种脸部处理方法、装置、计算机设备及存储介质
CN115253303A (zh) * 2022-08-16 2022-11-01 北京字跳网络技术有限公司 美化虚拟对象的方法、装置、存储介质及电子设备
CN115426350A (zh) * 2022-09-23 2022-12-02 北京有竹居网络技术有限公司 图像上传方法、图像上传装置、电子设备和存储介质
CN116152593A (zh) * 2022-12-05 2023-05-23 马上消费金融股份有限公司 训练方法及图像检测方法、装置、电子设备、存储介质
CN116363463A (zh) * 2023-02-06 2023-06-30 天津大学 一种面向深度学习图像识别模型演化的模糊测试方法
CN117078524A (zh) * 2023-07-03 2023-11-17 中国银行股份有限公司 图像修复方法、装置、设备、介质和产品
CN117894083A (zh) * 2024-03-14 2024-04-16 中电科大数据研究院有限公司 一种基于深度学习的图像识别方法和系统
CN118840740A (zh) * 2024-09-23 2024-10-25 绍兴达伽马纺织有限公司 基于机器视觉的拉毛织物表面绒毛状态检测方法及系统

Also Published As

Publication number Publication date
EP4123503A1 (en) 2023-01-25
CN111709408A (zh) 2020-09-25
CN111709408B (zh) 2020-11-20
US20230116801A1 (en) 2023-04-13
US12597278B2 (en) 2026-04-07
EP4123503A4 (en) 2023-09-06

Similar Documents

Publication Publication Date Title
CN111709408B (zh) 图像真伪检测方法和装置
CN111160313B (zh) 一种基于lbp-vae异常检测模型的人脸表示攻击检测方法
CN112651333B (zh) 静默活体检测方法、装置、终端设备和存储介质
CN112749686A (zh) 图像检测方法、装置、计算机设备及存储介质
Zheng et al. Deep Learning‐Driven Gaussian Modeling and Improved Motion Detection Algorithm of the Three‐Frame Difference Method
Ren et al. Frame duplication forgery detection and localization algorithm based on the improved Levenshtein distance
Bansal et al. Deepfake detection using CNN and DCGANS to drop-out fake multimedia content: a hybrid approach
CN115984740B (zh) 一种基于面部肌肉运动的压缩深度伪造视频检测方法
CN117011743A (zh) 数据处理方法及相关设备
CN118172713B (zh) 视频标签的识别方法、装置、计算机设备和存储介质
Nejadbougar et al. A new deep learning framework for intelligent aerial monitoring of power transmission line insulators
You et al. Tampering detection and localization base on sample guidance and individual camera device convolutional neural network features
Zhao et al. Face quality assessment via semi-supervised learning
Dremin et al. Machine vision-aware quality metrics for compressed image and video assessment
CN119273953A (zh) 基于改进YOLOv5的火灾图像检测方法及装置
Lian et al. A novel forgery classification method based on multi‐scale feature capsule network in mobile edge computing
Chang et al. On the predictability in reversible steganography
HK40028569B (zh) 图像真伪检测方法和装置
HK40028569A (zh) 图像真伪检测方法和装置
Kingsley et al. Deep Fake Detection using Advance ConvNets2D
Liu et al. Integrated multiscale appearance features and motion information prediction network for anomaly detection
Viknesh et al. DeepFakeGuard: Real-Time Deepfake Video Detection Leveraging Celeb-DF Dataset and CNN-LSTM Framework
CN117274861B (zh) 深度伪造视频检测方法、装置、电子设备及存储介质
US20250322507A1 (en) Method, device, and product for detecting circuit board
Rendi et al. Enhancing low-light pedestrian detection: convolutional neural network and YOLOv8 integration with automated dataset

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21857354

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2021857354

Country of ref document: EP

Effective date: 20221020

NENP Non-entry into the national phase

Ref country code: DE