Image recognition method, device and storage medium

By using the generator and classifier of the generative adversarial network in the face-changing recognition model, and combining fast and slow adversarial noise for dual noise training, the problem of limited data and ignored noise diversity is solved, and the accuracy of face-changing recognition is improved. and recall rate, achieving efficient and rapid detection of the authenticity of faces in videos and images.

CN112149608BActive Publication Date: 2024-10-18TENCENT TECHNOLOGY (SHENZHEN) CO LTD

Patent Information

Application Number
CN202011070422.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-09
Publication Date
2024-10-18
Estimated Expiration
2040-10-09

AI Technical Summary

Technical Problem

Due to limited data, existing face-changing recognition models are prone to overfitting and have poor generalization performance. They only use one type of adversarial noise training, ignoring the diversity of adversarial noise, resulting in low accuracy and recall of the classification model.

Method used

By constructing the generator and classifier in the generative adversarial network, using fast and slow adversarial noise to add noise to the original image, construct a diversified training set, and conduct double noise training on the neural network to improve the recognition accuracy and accuracy of the model. Recall rate.

Benefits of technology

It effectively reduces the risk of model overfitting, improves the accuracy and efficiency of face authenticity detection in videos and images, can better learn useful features in the original image, and achieves efficient and fast face-changing detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112149608B_ABST
    Figure CN112149608B_ABST
Patent Text Reader

Abstract

The present invention proposes an image recognition method, device and storage medium. An image recognition method includes: obtaining an image to be recognized; using a trained neural network to recognize the image and determine whether the image is a forged image; wherein the neural network includes a generator and a classifier constituting a generative adversarial network and is trained using the following steps: obtaining an original image group including multiple original images and a label of each original image, the original images including a real image and a forged image corresponding to the real image; for each original image, using a classifier to obtain a first type of noise for the original image to construct an associated first noisy image, and using a generative adversarial network to obtain a second type of noise for the original image to construct an associated second noisy image; establishing a training set based on the original image and its associated first noisy image and second noisy image; and training the neural network based on the training set to obtain parameters of the neural network.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image recognition processing based on artificial intelligence and computer vision, and in particular to a method, device and storage medium for image recognition, especially a method, device and storage medium for face-changing forged image recognition. Background Art

[0002] Face-swapping recognition is a technology based on image algorithms and visual artificial intelligence (AI). It detects and analyzes the authenticity of faces in videos and identifies whether faces in videos and pictures are fake faces generated by AI face-swapping algorithms. Existing face-swapping recognition models are usually conventional convolutional neural networks, which are usually pre-trained on natural images and then fine-tuned on a dataset consisting of face-swapping images and normal face images. However, since the data in face-swapping datasets is often limited, it is very easy to cause model overfitting, resulting in poor generalization performance. In addition, in existing learning models, only one type of adversarial noise is often used to train the model. This approach ignores the diversity of adversarial noise. It is not an efficient way to train classification models with high accuracy and high recall. Summary of the invention

[0003] The present disclosure provides a method, apparatus, computing device, and computer-readable storage medium for training image recognition networks and image recognition that can alleviate, mitigate, or even eliminate one or more of the above-mentioned problems.

[0004] According to one aspect of the present invention, an image recognition method is provided. The method comprises: obtaining an image to be recognized; using a trained neural network to recognize the image and determine whether the image is a forged image. The neural network comprises a generator and a classifier constituting a generative adversarial network and is trained using the following steps: obtaining an original image group including a plurality of original images and a label of each original image, wherein the original images include a real image and a forged image corresponding to the real image; for each original image, using a classifier to obtain a first type of noise for the original image to construct an associated first noisy image, and using a generative adversarial network to obtain a second type of noise for the original image to construct an associated second noisy image; establishing a training set based on the original image and its associated first noisy image and second noisy image; and training the neural network based on the training set to obtain the parameters of the neural network.

[0005] In some embodiments, obtaining the first type of noise for the original image using a classifier includes: inverting the label of the original image; inputting the original image with the inverted label into the classifier and calculating the gradient information using the classification loss function; and back-propagating the gradient information as the first type of noise.

[0006] In some embodiments, reversing the label of the original image includes: reversing the original image corresponding to the first label and the forged image corresponding to the second label to the real image corresponding to the second label and the forged image corresponding to the first label.

[0007] In some embodiments, obtaining a second type of noise for an original image using a generative adversarial network includes: randomly initializing a generator and the second type of noise; superimposing a real image with the second type of noise output by the generator to generate a noisy real image, and superimposing a forged image with the second type of noise output by the generator to generate a noisy forged image; training a classifier using a real image with a first label, a forged image with a second label, a noisy real image with a third label, and a noisy forged image with a fourth label as training images; inputting the noisy real image with the first label and the noisy forged image with the second label into the trained classifier and calculating gradient information using a corresponding classification loss function; back-propagating the gradient information to train the generator; and using the output of the trained generator as the second type of noise.

[0008] In some embodiments, obtaining a second type of noise for an original image using a generative adversarial network includes: randomly initializing a generator and a second type of noise; superimposing a real image with a first type of noise and a second type of noise output by the generator to generate a noisy real image, and superimposing a forged image with the first type of noise and the second type of noise output by the generator to generate a noisy forged image; training a classifier using a real image with a first label, a forged image with a second label, a noisy real image with a third label, and a noisy forged image with a fourth label as training images; inputting the noisy real image with the first label and the noisy forged image with the second label into the trained classifier and calculating gradient information using a corresponding classification loss function; back-propagating the gradient information to train the generator; and using the output of the trained generator as the second type of noise.

[0009] In some embodiments, the associated first noisy image and the second noisy image are constructed in the following manner: each original image is weightedly superimposed with the first type of noise using α and (1-α) as weights, respectively, to obtain the first noisy image; and each original image is weightedly superimposed with the second type of noise using β and (1-β) as weights, respectively, to obtain the second noisy image; wherein α and β are both random values ​​between 0 and 1.

[0010] In some embodiments, the forged image corresponding to the real image included in the original image is a forged image obtained by performing face replacement on the basis of the real image.

[0011] In some embodiments, training a neural network based on a training set to obtain parameters of the neural network also includes: inputting the training set into a classifier, calculating corresponding first classification loss function, second classification loss function, and third classification loss function; combining the first classification loss function, the second classification loss function, and the third classification loss function, and using the combined classification loss function to train the neural network to obtain parameters of the neural network.

[0012] In some embodiments, acquiring an image includes: selecting an image with a human face from a video as an image to be recognized.

[0013] In some embodiments, the method further includes: presenting a recognition result of whether the image to be recognized is a forged image.

[0014] According to one aspect of the present invention, a method for training a neural network for image recognition is provided, wherein the neural network includes a generator and a classifier constituting a generative adversarial network. The method includes: obtaining an original image group including a plurality of original images and a label of each original image, wherein the original images include a real image and a forged image corresponding to the real image; for each original image, using a classifier to obtain a first type of noise for the original image to construct an associated first noisy image, and using a generative adversarial network to obtain a second type of noise for the original image to construct an associated second noisy image; establishing a training set based on the original image and its associated first noisy image and second noisy image; and training the neural network based on the training set to obtain parameters of the neural network.

[0015] According to another aspect of the present invention, an image recognition device is provided. The device includes: an acquisition module and a recognition module. The acquisition module is configured to acquire an image to be recognized. The recognition module is configured to use a trained neural network to recognize the image and determine whether the image is a forged image. The neural network includes a generator and a classifier that constitute a generative adversarial network and is trained using the following steps: obtaining an original image group including multiple original images and a label of each original image, the original image including a real image and a forged image corresponding to the real image; for each original image, using a classifier to obtain a first type of noise for the original image to construct an associated first noisy image, and using a generative adversarial network to obtain a second type of noise for the original image to construct an associated second noisy image; establishing a training set based on the original image and its associated first noisy image and second noisy image; and training the neural network based on the training set to obtain the parameters of the neural network.

[0016] According to another aspect of the present invention, a computing device is provided, comprising a memory and a processor, wherein the memory is configured to store computer executable instructions thereon, and the computer executable instructions, when executed on the processor, perform any one of the methods of the above aspects.

[0017] According to another aspect of the present invention, a computer-readable storage medium is provided, on which computer-readable instructions are stored, and the computer-readable instructions are implemented by any one of the methods described above.

[0018] Through the embodiments of the present invention, methods, devices and storage media for training image recognition networks and for image recognition are provided. A neural network recognition model is trained by constructing a first type of noise and a second type of noise, and superimposing an original image with the first type of noise and the second type of noise to construct a training set, thereby improving the accuracy and recall rate of the neural network recognition model. The risk of overfitting of the neural network recognition model due to the limited training data set is reduced. The neural network model is adversarially trained by using the first type and the second type of noise, so that the classifier included in the generative adversarial network can better learn the useful features in the original image. This realizes efficient and rapid detection and analysis of the authenticity of human faces in videos and images, and identifies whether there are fake faces generated by face swapping in videos and images. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In the following description of exemplary embodiments in conjunction with the accompanying drawings, more details, features and advantages of the present invention are disclosed. The accompanying drawings are only used for the purpose of illustrating the implementation mode and are not considered to be limiting of the present disclosure. Moreover, the same reference numerals are used throughout the accompanying drawings to represent the same or similar elements. In the accompanying drawings:

[0020] Figure 1a Schematically shows a user interface according to an embodiment of the present invention;

[0021] Figure 1b Schematically shows a user interface according to another embodiment of the present invention;

[0022] Figure 2 Schematically illustrates example scenarios in which some embodiments according to the present invention may be applied;

[0023] Figure 3 The structure of the method for training an image recognition network according to one embodiment of the present invention is schematically shown;

[0024] Figure 4 A method for generating fast anti-noise according to an embodiment of the present invention is schematically shown;

[0025] Figure 5 A method for generating slow anti-noise according to an embodiment of the present invention is schematically shown;

[0026] Figure 6 A flowchart of a method for training an image recognition network according to an embodiment of the present invention is schematically shown;

[0027] Figure 7 A flowchart of a method for image recognition according to an embodiment of the present invention is schematically shown;

[0028] Figure 8 A schematic block diagram of an apparatus for training an image recognition network according to an embodiment of the present invention is schematically shown; and

[0029] Fig. 9 A schematic block diagram of a computing system capable of implementing a method for training an image recognition network according to some embodiments of the present invention is schematically shown. DETAILED DESCRIPTION

[0030] Several embodiments of the present invention will be described in more detail below with reference to the accompanying drawings so that those skilled in the art can understand and implement the present invention. However, the present invention can be specifically implemented in many different forms and should not be interpreted as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided herein to make the present invention comprehensive and complete, and will fully convey the scope of the present invention to those skilled in the art. These embodiments are used to illustrate rather than to limit the present invention.

[0031] It will be understood that, although the terms first, second, third, etc. may be used to describe various elements, steps and / or parts in this article, these elements, steps and / or parts should not be limited by these terms. These terms are only used to distinguish an element, step or part from another element, step or part. Therefore, the first element, step or part discussed below may be referred to as the second element, step or part without departing from the teaching of the present invention.

[0032] The terms used herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used herein, the singular forms "one", "an" and "the" are intended to also include plural forms, unless the context clearly indicates otherwise. It will be further understood that the terms "include" and / or "comprise" specify the presence of features, integral bodies, steps, operations, elements and / or parts when used in this specification, but do not exclude the presence of one or more other features, integral bodies, steps, operations, elements, parts and / or their groups. As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.

[0033] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by those of ordinary skill in the art to which the present invention belongs. It will be further understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the relevant art and / or the context of this specification, and will not be interpreted in an idealized or overly formal sense unless explicitly defined as such herein.

[0034] It should be noted that, under the premise of no conflict, features in different embodiments may be used in any combination.

[0035] Before describing the embodiments of the present invention in detail, some related concepts are first explained:

[0036] 1. Generative Adversarial Networks (GAN): Generative adversarial networks learn by making two neural networks compete with each other. It consists of a generative network and a discriminative network. The generative network randomly samples from the latent space as input, and its output needs to imitate the real samples in the training set as much as possible. The input of the discriminative network is the real sample or the output of the generative network. Its purpose is to distinguish the output of the generative network from the real sample as much as possible, while the generative network needs to deceive the discriminative network as much as possible. The two networks compete with each other and constantly adjust parameters. The ultimate goal is to make it impossible for the discriminative network to determine whether the output of the generative network is real.

[0037] 2. Fast adversarial noise: One way to generate adversarial noise is to input the original image (e.g., real image) into the discriminant network, change the label of the original image, and then back-propagate the gradient information calculated based on the classification loss function to the original image. Here, the gradient information obtained by the real image is used as adversarial noise. Since this adversarial noise can be obtained through only one back propagation, it is called fast adversarial noise (also called first type noise in this article).

[0038] 3. Slow adversarial noise: Generate adversarial noise of the original image using a generative adversarial network. A typical generative adversarial network consists of two networks: a generative network and a discriminative network. The discriminative network is a binary classification network (referred to as a classifier in this article), which is responsible for determining whether the input image is a real image or a generated image, and minimizing the classification loss function of the discriminative network. Given an input, the generative network generates a picture and maximizes the classification loss function of the discriminator. Since the generative network continuously receives supervisory information from the discriminative network to optimize its own parameters, a longer training process is required, which is called slow adversarial noise (also referred to as the second type of noise in this article).

[0039] The existing face-changing recognition model is based on a conventional classification model and is trained on face-changing data. However, since face-changing data is often limited, it is easy to cause model overfitting, resulting in poor generalization performance. In the existing adversarial learning model, only one of the adversarial noises, fast adversarial noise or slow adversarial noise, is often used to train the model. This method ignores the diversity of adversarial noise. It is not an efficient way to train classification models with high accuracy and high recall. The present invention is a general adversarial network training method suitable for improving face-changing recognition. By constructing fast adversarial noise and slow adversarial noise for the classifier, the classifier can obtain richer training samples, thereby improving the performance of the classifier. A general classifier training method based on fast and slow adversarial noise learning is provided. This method can be suitable for most deep classification model products that need to be trained to improve the accuracy and recall of the model on online data.

[0040] Face-swapping detection can be used in at least the following scenarios: (1) Combating pornography and other industries. In recent years, the number of deep fake videos on the Internet has increased dramatically, and the vast majority of them are pornographic. These fake videos have a huge number of views. Face-swapping detection can identify such fake videos, thereby reducing the spread of pornographic content with fake faces. (2) Combating the spread of fake videos on the Internet. In the era of widespread deep fakes, fake videos, fake news and social networks have exacerbated the spread of online rumors, making it difficult to distinguish between truth and falsehood. People may be forced to bear false charges, and their real words and deeds may become false. Face-swapping detection can identify fake faces in online videos, eliminate fraud, and restore the truth. (3) Combating online fraud. The popularity of some entertainment-oriented face-swapping applications has also made people begin to worry about the security of personal information such as faces. When the old fraud methods are combined with AI face-swapping, the number of victims has increased exponentially. Face-swapping detection can identify fake videos in online business processing and reduce online fraud.

[0041] Figure 1a and Figure 1b Schematically shows a user interface according to an embodiment of the present invention. Figure 1a In the face swap detection user interface shown in , users can upload images to be detected, and the images to be detected are detected by the computing device at the user terminal or by the computing device at the server end using the trained neural network. Here, the uploaded images to be detected can be a separate image or an image with a human face selected from a video to be detected. After detection and analysis, Figure 1b The results are displayed in the interface shown in (for example, Figure 1b The detection results shown in the figure are real images).

[0042] In addition, as those skilled in the art understand, the face-swap detection result can also be provided in the form of an application program interface (API). The user calls the face-swap detection API to upload the image to be detected (which can be an image from a video) through a command line. After the image is calculated at the server or user terminal, the detection result is presented in the form of a command line. For example, a return result of 1 indicates that the face is real. A return result of 0 indicates that the face is a synthetic fake face.

[0043] Figure 2 A block diagram of an example computing system 200 is depicted, in accordance with an example embodiment of the present invention. System 200 includes a user computing device 202, a server computing system 230, and a training computing system 250 communicatively coupled via a network 280.

[0044] The user computing device 202 may be any type of computing device, such as, for example, a personal computing device (e.g., a laptop or desktop), a mobile computing device (e.g., a smartphone or tablet), a game console or controller, a wearable computing device, an embedded computing device, or any other type of computing device.

[0045] The user computing device 202 includes one or more processors 212 and memory 214. The one or more processors 212 can be any suitable processing device (e.g., a processor core, a microprocessor, an ASIC, an FPGA, a controller, a microcontroller, etc.), and can be one processor or multiple processors that are operably connected. The memory 214 can include one or more non-transitory computer-readable storage media, such as RAM, ROM, EEPROM, EPROM, flash memory devices, disks, etc., and combinations thereof. The memory 214 can store data 216 and instructions 218 executed by the processor 212 to cause the user computing device 202 to perform operations.

[0046] The user computing device 202 may store or include one or more image recognition models 220. For example, the image recognition model 220 may be or may otherwise include various machine learning models, such as a neural network (e.g., a deep neural network) or other multi-layer nonlinear model. The neural network may include a recursive neural network (e.g., a long short-term memory recursive neural network), a feedforward neural network, a convolutional neural network, or other forms of neural networks. Alternatively or additionally, the image recognition model 220 may include other forms of machine learning models.

[0047] In some implementations, one or more image recognition models 220 may be received from server computing system 230 via network 280, stored in user computing device memory 214, and then used or otherwise implemented by one or more processors 212. In some implementations, user computing device 202 may implement multiple parallel instances of image recognition model 220 (e.g., to perform multiple parallel instances of image recognition).

[0048] Additionally or alternatively, one or more image recognition models 240 may be included in a server computing system 230 that communicates with the user computing device 202 according to a client-server relationship, or otherwise stored and implemented by the server computing system 230. For example, the image recognition model 240 may be implemented by the server computing system 230 as part of a network service (e.g., an image feature search service). Thus, one or more image recognition models 220 may be stored and implemented at the user computing device 202, and / or one or more image recognition models 240 may be stored and implemented at the server computing system 230.

[0049] The user computing device 202 may also include one or more user input components 222 that receive user input. For example, the user input component 222 may be a touch-sensitive component (e.g., a touch-sensitive display screen or a touchpad) that is sensitive to the touch of a user input object (e.g., a finger or a stylus). The touch-sensitive component may be used to implement a virtual keyboard. Other example user input components include a microphone, a traditional keyboard, a traditional mouse, a camera, a microphone, or other components through which a user may provide user input.

[0050] The server computing system 230 includes one or more processors 232 and memory 234. The one or more processors 232 may be any suitable processing device (e.g., a processor core, a microprocessor, an ASIC, an FPGA, a controller, a microcontroller, etc.), and may be one processor or a plurality of processors operably connected. The memory 234 may include one or more non-transitory computer-readable storage media, such as RAM, ROM, EEPROM, EPROM, flash memory devices, disks, etc., and combinations thereof. The memory 234 may store data 236 and instructions 238 executed by the processor 232 to cause the server computing system 230 to perform operations.

[0051] In some implementations, server computing system 230 includes or is otherwise implemented by one or more server computing devices. Where server computing system 230 includes multiple server computing devices, such server computing devices may operate according to a sequential computing architecture, a parallel computing architecture, or some combination thereof.

[0052] As described above, the server computing system 230 may store or otherwise include one or more machine-learned image recognition models 240. For example, the image recognition model 240 may be or may otherwise include various machine-learned models, such as a neural network (e.g., a deep neural network) or other multi-layer nonlinear model. The neural network may include a recursive neural network (e.g., a long short-term memory recursive neural network), a feedforward neural network, a convolutional neural network, or other forms of neural networks. Alternatively or additionally, the image recognition model 240 may include other forms of machine-learned models.

[0053] Server computing system 230 may train image recognition model 240 via interaction with training computing system 250 that is communicatively coupled via network 280. Training computing system 250 may be separate from server computing system 230, or may be a part of server computing system 230.

[0054] The training computing system 250 includes one or more processors 252 and a memory 254. The one or more processors 252 may be any suitable processing device (e.g., a processor core, a microprocessor, an ASIC, an FPGA, a controller, a microcontroller, etc.), and may be one processor or multiple processors operably connected. The memory 254 may include one or more non-transitory computer-readable storage media, such as RAM, ROM, EEPROM, EPROM, flash memory devices, disks, etc., and combinations thereof. The memory 254 may store data 256 and instructions 258 executed by the processor 252 to cause the training computing system 250 to perform operations. In some embodiments, the training computing system 250 includes one or more server computing devices or is otherwise implemented by one or more server computing devices.

[0055] The training computing system 250 may include a model trainer 260 that trains the machine learning model 220 / 240 using various training or learning techniques such as, for example, back propagation of errors. The model trainer 260 may perform a variety of generalization techniques (e.g., weight decay, dropout, etc.) to improve the generalization ability of the trained model.

[0056] Specifically, the model trainer 260 can train the image recognition model 220 / 240 based on a set of training data 262.

[0057] The model trainer 260 includes computer logic for providing the desired functionality. The model trainer 260 can be implemented in hardware, firmware, and / or software that controls a general purpose processor. For example, in some embodiments, the model trainer 260 includes a program file stored on a storage device, loaded into a memory, and executed by one or more processors. In other embodiments, the model trainer 260 includes one or more sets of computer executable instructions stored in a tangible computer readable storage medium, such as a RAM hard disk or an optical or magnetic medium.

[0058] The network 280 may be any type of communication network, such as a local area network (e.g., an intranet), a wide area network (e.g., the Internet), or some combination thereof, and may include any number of wired or wireless links. In general, communications on the network 280 may be conducted via any type of wired and / or wireless connection, using a variety of communication protocols (e.g., TCP / IP, HTTP, SMTP, FTP), encodings or formats (e.g., HTML, XML), and / or protection schemes (e.g., VPN, secure HTTP, SSL).

[0059] Figure 2 An example computing system that can be used to implement the present invention is shown. Other computing systems may also be used. For example, in some embodiments, the user computing device 202 may include a model trainer 260 and a training data set 262. In such embodiments, the image recognition model 220 may be trained and used locally at the user computing device 202. In some of such embodiments, the user computing device 202 may implement the model trainer 260 to personalize the image recognition model 220 based on user-specific data.

[0060] Figure 3The architecture 300 of the method for training an image recognition network according to an embodiment of the present invention is schematically shown. Given a set of real faces 301 and face-swapped face images 302 (also called fake images), we can generate two other sets of face-swapped images, one set is the original image superimposed with fast anti-noise images (303, 304), and the other set is the original image superimposed with slow anti-noise images (305, 306). So far, there are three sets of images, and all three sets of images are input into the classifier 307. For the first two sets of images, it is expected that the classifier 307 will classify the pictures of real faces 301 / real faces superimposed with fast anti-noise 303 into category 0, and classify the face-swapped faces 302 / face-swapped faces superimposed with fast anti-noise images 304 into category 1, see labels 308 and 309. For the third group of images, it is hoped that the classifier 307 will classify the real image 301 superimposed with the slow anti-noise image 305 into category 2, and the face-swapped image 302 superimposed with the slow anti-noise image 306 into category 3, see label 310. The specific generation process of fast anti-noise and slow anti-noise will be described later. Figure 4 and Figure 5 Described in detail in.

[0061] The specific training steps are as follows: (1) Input the original image group into the classifier to obtain the classification loss L1. Here, the classification loss function L1 can be selected as the cross entropy function. (2) Exchange the corresponding labels of the original image group, back-propagate the gradient, and obtain fast adversarial noise. (3) Superimpose the fast adversarial noise with the original image, with the superposition weight α, α is a random value between 0-1, and input it into the classifier, use the label corresponding to the original image to construct the classification loss function L2. Here, the classification loss function L2 can be selected as the cross entropy function. (4) Input the original image into the slow adversarial noise generator to obtain slow adversarial noise. Superimpose it with the original image, with the superposition weight β, β is a random value between 0-1, and then input it into the classifier. At this time, the label uses 2 / 3 to construct the classification loss function L3. The classification loss function L3 can be a cross entropy function. (5) Sum L1, L2, and L3 as the total classification loss function for training the classifier. (6) Change the label in step (4) to 0 / 1 and back-propagate the gradient to train the slow adversarial noise generator.

[0062] Figure 4 A fast anti-noise generation method 400 according to an embodiment of the present invention is schematically shown. Given any original image 401 (in one embodiment, a real image in the original image can be selected), it is input into a classifier 402, and the label of the original image is reversed, that is, 1 is replaced by 0, and 0 is replaced by 1. Figure 4 403 in the figure indicates the prediction using the initial label, which is a correct prediction. Figure 4404 in indicates that the prediction after the label of the original image is inverted is an incorrect prediction. The classification loss function is constructed using the inverted label, and the gradient is back-propagated to the original image to obtain the fast adversarial noise. Here, the fast adversarial noise constructed based on the back-propagated gradient information has a smaller amplitude, so the category of the noisy image obtained after combining the original image with the fast adversarial noise remains unchanged. For example, the real image in the original image group has a first category label, and the forged image in the original image group has a second category label. Then the real noisy image obtained by superimposing the real image and the fast adversarial noise also has the first category label, and the forged noisy image obtained by superimposing the forged image and the fast adversarial noise has the second category label.

[0063] Figure 5 The schematic diagram shows a method 500 for generating slow adversarial noise according to an embodiment of the present invention. The process includes a generating network 504 responsible for generating slow adversarial noise 505. The training method of the 504 network is divided into two steps. In the first step, the slow adversarial noise 505 is superimposed on the original image 503, and then input into the classifier 506 together with the real image 501 and the forged image 502 in the original image. At this time, the labels of these samples are 2 / 3 (i.e., correct prediction 507), and the classifier 506 is trained after constructing the classification loss function. In the second step, the slow adversarial noise 505 is superimposed on the original image 503, and then input into the classifier 506. At this time, the labels of these samples are changed to 0 / 1 (i.e., wrong prediction 508). After constructing the classification loss function, the gradient is back-propagated to train the generating network 504.

[0064] Figure 6 A schematic diagram 600 of a method for training a neural network for image recognition according to an embodiment of the present invention is schematically shown. The neural network includes a generator and a classifier (i.e., a discriminant network in a traditional generative adversarial network) constituting a generative adversarial network, wherein the generator may adopt an encoder-decoder structure, and the classifier may adopt a DNN, CNN structure, etc. As understood by those skilled in the art, the structures of the generator and the classifier are not limited to the above examples, and may also include any other commonly used neural network structures applicable to the method. The method may be executed by a computing device at a user terminal or by a computing device at a server end. First, in step 601, an original image group including a plurality of original images and a label of each original image is obtained, and the original image includes a real image and a forged image corresponding to the real image. For example, the real image is an image with the face of person A, and the forged image replaces the face of person A in the real image with a forged image of person B. In one example, there may be 80,000 original images, i.e., 40,000 pairs of real images and forged images.

[0065] In step 602, for each original image, a classifier is used to obtain a first type of noise for the original image to construct an associated first noisy image, and a generative adversarial network is used to obtain a second type of noise for the original image to construct an associated second noisy image.

[0066] In one embodiment, obtaining the first type of noise for the original image using a classifier includes: inverting the label of the original image; inputting the original image with the inverted label into the classifier and calculating the gradient information using the classification loss function; and back-propagating the gradient information as the first type of noise. Because the first type of noise here can be obtained by only one back-propagation, it can also be called fast adversarial noise.

[0067] In one embodiment, reversing the label of the original image includes: reversing the correspondence between the real image and the first label and the forged image and the second label in the original image into the correspondence between the real image and the second label and the forged image and the first label. As understood by those skilled in the art, the role of reversing the label is to obtain noise information that is counteracted with the original image.

[0068] In one embodiment, obtaining the second type of noise for the original image using a generative adversarial network includes: first training the generator through the following steps: superimposing the real image with the noise output by the generator to generate a noisy real image, and superimposing the forged image with the noise output by the generator to generate a noisy forged image. Using a real image with a first label, a forged image with a second label, a noisy real image with a third label, and a noisy forged image with a fourth label as training images to train the classifier. Inputting the noisy real image with the first label and the noisy forged image with the second label into the trained classifier and calculating the gradient information using the corresponding classification loss function; back-propagating the gradient information to train the generator. After the generator training is completed, the output of the trained generator is used as the second type of noise. Since the generative network continuously receives supervisory information from the discriminative network to optimize its own parameters, a relatively long training process is required, and the second type of noise is also called slow adversarial noise.

[0069] In another embodiment, the second type of noise can be generated by inputting in another way. This implementation method utilizes the fact that the amplitude of the first type of noise (i.e., fast adversarial noise) is small, so the image type of the superimposed image obtained after the original image is superimposed with the first type of noise is consistent with the original image. Using the generative adversarial network to obtain the second type of noise for the original image includes: randomly initializing the generator and the second type of noise. Superimposing the real image with the first type of noise and the second type of noise output by the generator to generate a noisy real image, and superimposing the forged image with the first type of noise and the second type of noise output by the generator to generate a noisy forged image. Using the real image with the first label, the forged image with the second label, the noisy real image with the third label, and the noisy forged image with the fourth label as training images to train the classifier. Input the noisy real image with the first label and the noisy forged image with the second label into the trained classifier and calculate the gradient information using the corresponding classification loss function. Back propagate the gradient information to train the generator. After the generator training is completed, the output of the trained generator is used as the second type of noise.

[0070] In one embodiment, the associated first noisy image and the second noisy image are constructed in the following manner: each original image and the first type of noise are weighted superimposed with α and (1-α) as weights to obtain the first noisy image; and / or each original image and the second type of noise are weighted superimposed with β and (1-β) as weights to obtain the second noisy image. Here, α and β are both random values ​​between 0 and 1.

[0071] In step 603, a training set is established based on the original image and its associated first noisy image and second noisy image. In step 604, a neural network is trained based on the training set to obtain parameters of the neural network.

[0072] In one embodiment, training the neural network based on the training set to obtain the parameters of the neural network further includes: inputting the training set into a classifier, calculating the corresponding first classification loss function, second classification loss function and third classification loss function, combining the first classification loss function, the second classification loss function and the third classification loss function, and using the combined classification loss function to train the neural network to obtain the parameters of the neural network.

[0073] Figure 7The flowchart of a method 700 for image recognition according to an embodiment of the present invention is schematically shown. The method for image recognition can be executed in a computing device on the user side or the server side. First, in step 701, an image to be recognized is obtained. The image obtained can be a single image. It can also be an image with a face selected from a video or a live stream by a predetermined algorithm. The predetermined algorithm can be, for example, selecting a key frame using frame spacing, or selecting a picture with a face using a trained network for judging whether a face exists. In step 702, the image is recognized using the trained neural network to determine whether the image is a forged image. In one embodiment, the determination result can be presented or output through a user interface. For example, if the input is a real face image, "real" is output; if the input is a forged face image, "forged" is output. When the user interface is presented in the form of an API, "0" can be output to represent a real face image, and "1" can be output to represent a forged face image.

[0074] Here, the neural network is pre-trained through the following steps: the neural network includes a generator and a classifier (i.e., a discriminant network in a traditional generative adversarial network) constituting a generative adversarial network, wherein the generator can adopt an encoder-decoder structure, and the classifier can adopt a DNN, CNN structure, etc. As understood by those skilled in the art, the structures of the grower and the classifier are not limited to the above examples, and may also include any other commonly used neural network structures applicable to the method. The method may be executed by a computing device at a user terminal or by a computing device at a server end. First, an original image group including a plurality of original images and a label of each original image is obtained, the original image including a real image and a forged image corresponding to the real image. For example, the real image is an image with the face of person A, and the forged image replaces the face of person A in the real image with a forged image of person B. In one example, there may be 80,000 original images, i.e., 40,000 pairs of real images and forged images.

[0075] For each original image, a classifier is used to obtain a first type of noise for the original image to construct an associated first noisy image, and a generative adversarial network is used to obtain a second type of noise for the original image to construct an associated second noisy image.

[0076] In one embodiment, obtaining the first type of noise for the original image using a classifier includes: inverting the label of the original image; inputting the original image with the inverted label into the classifier and calculating the gradient information using the classification loss function; and back-propagating the gradient information as the first type of noise. Because the first type of noise here can be obtained by only one back-propagation, it can also be called fast adversarial noise.

[0077] In one embodiment, reversing the label of the original image includes: reversing the correspondence between the real image and the first label and the forged image and the second label in the original image into the correspondence between the real image and the second label and the forged image and the first label. As understood by those skilled in the art, the role of reversing the label is to obtain noise information that is counteracted with the original image.

[0078] In one embodiment, obtaining the second type of noise for the original image using a generative adversarial network includes: first training the generator through the following steps: superimposing the real image with the noise output by the generator to generate a noisy real image, and superimposing the forged image with the noise output by the generator to generate a noisy forged image. Using a real image with a first label, a forged image with a second label, a noisy real image with a third label, and a noisy forged image with a fourth label as training images to train the classifier. Inputting the noisy real image with the first label and the noisy forged image with the second label into the trained classifier and calculating the gradient information using the corresponding classification loss function; back-propagating the gradient information to train the generator. After the generator training is completed, the output of the trained generator is used as the second type of noise. Since the generative network continuously receives supervisory information from the discriminative network to optimize its own parameters, a relatively long training process is required, and the second type of noise is also called slow adversarial noise.

[0079] In another embodiment, the second type of noise can be generated by inputting in another way. This implementation method utilizes the fact that the amplitude of the first type of noise (i.e., fast adversarial noise) is small, so the image type of the superimposed image obtained after the original image is superimposed with the first type of noise is consistent with the original image. Using the generative adversarial network to obtain the second type of noise for the original image includes: randomly initializing the generator and the second type of noise. Superimposing the real image with the first type of noise and the second type of noise output by the generator to generate a noisy real image, and superimposing the forged image with the first type of noise and the second type of noise output by the generator to generate a noisy forged image. Using the real image with the first label, the forged image with the second label, the noisy real image with the third label, and the noisy forged image with the fourth label as training images to train the classifier. Input the noisy real image with the first label and the noisy forged image with the second label into the trained classifier and calculate the gradient information using the corresponding classification loss function. Back propagate the gradient information to train the generator. After the generator training is completed, the output of the trained generator is used as the second type of noise.

[0080] In one embodiment, the associated first noisy image and the second noisy image are constructed in the following manner: each original image and the first type of noise are weighted superimposed with α and (1-α) as weights to obtain the first noisy image; and / or each original image and the second type of noise are weighted superimposed with β and (1-β) as weights to obtain the second noisy image. Here, α and β are both random values ​​between 0 and 1.

[0081] Finally, a training set is established based on the original image and its associated first noisy image and second noisy image, and a neural network is trained based on the training set to obtain parameters of the neural network.

[0082] The image recognition method trains the neural network recognition model by constructing a first type of noise and a second type of noise, and superimposing the original image with the first type of noise and the second type of noise to construct a training set, thereby improving the accuracy and recall rate of the neural network recognition model. The risk of the neural network recognition model being prone to overfitting due to the limited training data set is reduced. The neural network model is adversarially trained by using the first type and the second type of noise, so that the classifier included in the generative adversarial network can better learn the useful features in the original image. This realizes efficient and rapid detection and analysis of the authenticity of human faces in videos and images, and identifies whether there are fake faces generated by face swapping in videos and images.

[0083] The method for training an image recognition network trains a neural network recognition model by constructing a first type of noise and a second type of noise, and superimposing the original image with the first type of noise and the second type of noise to construct a training set, thereby improving the accuracy and recall rate of the neural network recognition model. The risk of the neural network recognition model being prone to overfitting due to the limited training data set is reduced. The neural network model is adversarially trained by using the first type and the second type of noise, so that the classifier included in the generative adversarial network can better learn the useful features in the original image. This realizes efficient and rapid detection and analysis of the authenticity of human faces in videos and images, and identifies whether there are fake faces generated by face swapping in videos and images.

[0084] Figure 8An image recognition device 800 according to an embodiment of the present invention is schematically shown. The device 800 includes: an acquisition module 801 and an identification module 802. The acquisition module 801 is configured to acquire an image to be recognized. The identification module 802 is configured to use a trained neural network to identify the image and determine whether the image is a forged image. The neural network includes a generator and a classifier that constitute a generative adversarial network and is trained using the following steps: obtaining an original image group including multiple original images and a label of each original image, the original image including a real image and a forged image corresponding to the real image; for each original image, using a classifier to obtain a first type of noise for the original image to construct an associated first noisy image, and using a generative adversarial network to obtain a second type of noise for the original image to construct an associated second noisy image; establishing a training set based on the original image and its associated first noisy image and second noisy image; and training the neural network based on the training set to obtain the parameters of the neural network.

[0085] The device for image recognition network trains the neural network recognition model by constructing a first type of noise and a second type of noise, and superimposing the original image with the first type of noise and the second type of noise to construct a training set, thereby improving the accuracy and recall rate of the neural network recognition model. The risk of the neural network recognition model being prone to overfitting due to the limited training data set is reduced. The neural network model is adversarially trained by using the first type and the second type of noise, so that the classifier included in the generative adversarial network can better learn the useful features in the original image. This realizes efficient and rapid detection and analysis of the authenticity of human faces in videos and images, and identifies whether there are fake faces generated by face swapping in videos and images.

[0086] Fig. 9 A schematic block diagram of a computing system 900 that can implement a method for training an image recognition network according to some embodiments of the present invention is schematically shown. In some embodiments, the computing system 900 represents Figure 2 The computing device 240 in the application scenario.

[0087] Computing system 900 may include a variety of different types of devices, such as a computing device computer, a client device, a system on a chip, and / or any other suitable computing system or computing systems.

[0088] The computing system 900 may include at least one processor 902, memory 904, communication interface(s) 906, a display device 908, other input / output (I / O) devices 910, and one or more mass storage devices 912 that can communicate with each other, such as via a system bus 914 or other appropriate connection.

[0089] The processor 902 may be a single processing unit or multiple processing units, all of which may include a single or multiple computing units or multiple cores. The processor 902 may be implemented as one or more microprocessors, microcomputers, microcontrollers, digital signal processors, central processing units, state machines, logic circuits, and / or any device that manipulates signals based on operating instructions. In addition to other capabilities, the processor 902 may be configured to obtain and execute computer-readable instructions stored in the memory 904, the mass storage device 912, or other computer-readable media, such as program codes of an operating system 916, program codes of an application program 918, program codes of other programs 920, etc., to implement the method for training a neural network for image recognition provided in an embodiment of the present invention.

[0090] The memory 904 and the mass storage device 912 are examples of computer storage media for storing instructions that are executed by the processor 902 to implement the various functions described above. For example, the memory 904 may generally include both volatile memory and non-volatile memory (e.g., RAM, ROM, etc.). In addition, the mass storage device 912 may generally include a hard drive, a solid-state drive, a removable medium, including external and removable drives, a memory card, a flash memory, a floppy disk, an optical disk (e.g., a CD, a DVD), a storage array, a network attached storage, a storage area network, etc. The memory 904 and the mass storage device 912 may all be collectively referred to herein as memory or computer storage media, and may be a non-transitory medium capable of storing computer-readable, processor-executable program instructions as computer program code, which may be executed by the processor 902 as a specific machine configured to implement the operations and functions described in the examples herein.

[0091] A plurality of program modules may be stored on the mass storage device 912. These programs include an operating system 916, one or more application programs 918, other programs 920, and program data 922, and they may be loaded into the memory 904 for execution. Examples of such application programs or program modules may include, for example, computer program logic (e.g., computer program code or instructions) for implementing the method for training a neural network for image recognition provided herein. Moreover, these program modules may be distributed in different physical locations to implement the corresponding functions. For example, the method described as being performed by the computing device 140 in FIG. 1 may be distributed on a plurality of computing devices to be completed.

[0092] The present invention also provides a computer-readable storage medium having computer-readable instructions stored thereon, which implement the above-mentioned method of training a neural network for image recognition when executed.

[0093] Although in Fig. 9 904 of the computing system 900, but modules 914, 918, 920, and 922, or portions thereof, may be implemented using any form of computer-readable media accessible by the computing system 900. As used herein, "computer-readable media" includes at least two types of computer-readable media, namely, computer storage media and communication media.

[0094] Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented by any method or technology for storage of information, such as computer readable instructions, data structures, program modules or other data. Computer storage media includes but is not limited to RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD), or other optical storage devices, magnetic cassettes, magnetic tapes, magnetic disk storage devices or other magnetic storage devices, or any other non-transmission media that can be used to store information for access by a computing system.

[0095] In contrast, communication media may embody computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism. Computer storage media as defined herein does not include communication media.

[0096] The computing system 900 may also include one or more communication interfaces 906 for exchanging data with other devices, such as through a network, direct connection, etc. The communication interface 906 may facilitate communication within a variety of network and protocol types, including wired networks (e.g., LAN, cable, etc.) and wireless networks (e.g., WLAN, cellular, satellite, etc.), the Internet, etc. The communication interface 906 may also provide for communication with external storage devices (not shown) such as in a storage array, network attached storage, storage area network, etc.

[0097] In some examples, a display device 908 may be included for displaying information and images. Other I / O devices 910 may be devices that receive various inputs from a user and provide various outputs to the user, and may include a touch input device, a gesture input device, a camera, a keyboard, a remote control, a mouse, a printer, an audio input / output device, and the like.

[0098] In the description of this specification, the description of the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments or examples described in this specification and the features of different embodiments or examples without contradiction.

[0099] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present invention includes alternative implementations in which functions may not be performed in the order shown or discussed (including in a substantially simultaneous manner or in reverse order depending on the functions involved), which should be understood by technicians in the technical field to which the embodiments of the present invention belong.

[0100] In addition, each functional unit in each embodiment of the present invention may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.

[0101] Variations to the disclosed embodiments will be understood and effected by those skilled in the art in practicing the claimed subject matter by studying the drawings, the disclosure and the appended claims. In the claims, the word "comprising" does not exclude other elements or steps, and the indefinite article "a" or "an" does not exclude a plurality. The mere fact that certain measures are recited in mutually different dependent claims does not indicate that a combination of these measures cannot be used to advantage.

Claims

1. An image recognition method, comprising: Obtain an image to be recognized; Using a trained neural network to identify the image to determine whether the image is a forged image; The neural network includes a generator and a classifier constituting a generative adversarial network and is trained using the following steps: Acquire an original image group including a plurality of original images and a label of each original image, wherein the original images include a real image and a forged image corresponding to the real image; For each original image, obtaining a first type of noise to construct an associated first noisy image, and obtaining a second type of noise to construct an associated second noisy image, wherein obtaining the first type of noise comprises: Inverting the label of the original image, inputting the original image with the inverted label into the classifier and calculating gradient information using a classification loss function, and back-propagating the gradient information as the first type of noise, and The obtaining of the second type of noise comprises: using a real image with a first label, a forged image with a second label, a noisy real image with a third label, and a noisy forged image with a fourth label as training images to train the classifier, inputting the noisy real image with the first label and the noisy forged image with the second label into the trained classifier and calculating gradient information using a corresponding classification loss function, back-propagating the gradient information to train the generator, and using the output of the trained generator as the second type of noise; Establishing a training set based on the original image and its associated first noisy image and second noisy image; and The neural network is trained based on the training set to obtain parameters of the neural network.

2. The method according to claim 1, wherein the reversing the label of the original image comprises: The original image in which the real image corresponds to the first label and the forged image corresponds to the second label is reversed to the original image in which the real image corresponds to the second label and the forged image corresponds to the first label.

3. The method according to claim 1, wherein the noisy real image and the noisy forged image are generated by: Randomly initializing the generator and the second type of noise; The real image is superimposed with the second type of noise output by the generator to generate a noisy real image, and the forged image is superimposed with the second type of noise output by the generator to generate a noisy forged image.

4. The method according to claim 1, wherein the noisy real image and the noisy forged image are generated by: Randomly initializing the generator and the second type of noise; A real image is superimposed with the first type of noise and the second type of noise output by the generator to generate a noisy real image, and a forged image is superimposed with the first type of noise and the second type of noise output by the generator to generate a noisy forged image.

5. The method according to claim 1, wherein the first noisy image and the second noisy image associated with each other are constructed by: Each original image and the first type of noise are weightedly superimposed using α and (1-α) as weights to obtain the first noisy image; and Each original image and the second type of noise are weightedly superimposed using β and (1-β) as weights to obtain the second noisy image; Among them, α and β are random values ​​between 0 and 1.

6. The method according to claim 1, wherein the forged image corresponding to the real image included in the original image is a forged image obtained by performing face replacement on the basis of the real image.

7. The method according to claim 1, wherein the step of training the neural network based on the training set to obtain parameters of the neural network further comprises: Input the training set into the classifier, and calculate the corresponding first classification loss function, second classification loss function and third classification loss function; The first classification loss function, the second classification loss function and the third classification loss function are combined, and the combined classification loss function is used to train the neural network to obtain parameters of the neural network.

8. The method according to claim 1, wherein acquiring an image comprises: An image with a human face is selected from the video as the image to be recognized.

9. The method according to claim 1, further comprising: A recognition result of whether the image to be recognized is a forged image is presented.

10. An image recognition device, comprising: An acquisition module is configured to acquire an image to be recognized; an identification module, configured to identify the image using a trained neural network to determine whether the image is a forged image; The neural network includes a generator and a classifier that constitute a generative adversarial network and is trained using the following steps: Acquire an original image group including a plurality of original images and a label of each original image, wherein the original images include a real image and a forged image corresponding to the real image; For each original image, obtaining a first type of noise to construct an associated first noisy image, and obtaining a second type of noise to construct an associated second noisy image, wherein obtaining the first type of noise comprises: Inverting the label of the original image, inputting the original image with the inverted label into the classifier and calculating gradient information using a classification loss function, and back-propagating the gradient information as the first type of noise, and The obtaining of the second type of noise comprises: using a real image with a first label, a forged image with a second label, a noisy real image with a third label, and a noisy forged image with a fourth label as training images to train the classifier, inputting the noisy real image with the first label and the noisy forged image with the second label into the trained classifier and calculating gradient information using a corresponding classification loss function, back-propagating the gradient information to train the generator, and using the output of the trained generator as the second type of noise; Establishing a training set based on the original image and its associated first noisy image and second noisy image; and The neural network is trained based on the training set to obtain parameters of the neural network.

11. A computing device comprising a memory and a processor, the memory being configured to store thereon computer executable instructions, the computer executable instructions performing the method of any one of claims 1-9 when executed on the processor.

12. A computer-readable storage medium having computer-executable instructions stored thereon, which when executed on a processor perform the method of any one of claims 1-9.

Citation Information

Patent Citations

  • Image set enhancement method for combating attacks

    CN110728629A

  • Face image data generation method, device and apparatus

    CN111414928A

  • Training method and device for sequence labeling model

    CN111737952A

  • Protecting Cognitive Systems from Gradient Based Attacks through the Use of Deceiving Gradients

    US20190130110A1

  • Gradient adversarial training of neural networks

    WO2019222401A3

Cited By

  • Deep forgery detection method based on self-mixing

    CN119672816A

  • A self-mixing based deepfake detection method

    CN119672816B

  • Image recognition method and apparatus, computing device and computer-readable storage medium

    WO2022073414A1