Image detection method and device, readable medium and electronic equipment
By acquiring color and noise features of target images through an object detection model for authenticity detection, this technology solves the problem of low accuracy in face forgery detection in existing technologies, achieving higher detection accuracy and interpretability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING ZITIAO NETWORK TECH CO LTD
- Filing Date
- 2022-08-26
- Publication Date
- 2026-06-09
AI Technical Summary
Existing face spoofing detection technologies have low accuracy when facing new face spoofing methods, and their ability to cope with complex post-processing and video compression issues is limited.
The target color features and target noise features of the target image are obtained by the target detection model, and the authenticity is detected by combining these features. The detection accuracy is improved by using a color encoder, a noise extractor, a noise encoder and a feature classifier.
It improves the accuracy of image authenticity detection and generates fake regions in the detection results, thereby enhancing the model's credibility and interpretability.
Smart Images

Figure CN115346278B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of image processing technology, and more specifically, to an image detection method, apparatus, readable medium, and electronic device. Background Technology
[0002] With the advancement of computer technology, deepfake face synthesis techniques have emerged in large numbers, leading to a surge of forged images and videos, particularly those created using deepfake faces, flooding the internet and attracting widespread public attention. Therefore, face forgery detection technology is crucial, and this field has become an important research direction in digital image forensics in recent years. Especially in recent years, with the technological updates and iterations of face forgery techniques, the realism, resolution, and ability to resist forgery detection of synthesized forged faces have significantly improved. However, related image authentication techniques still suffer from low accuracy. Summary of the Invention
[0003] This summary section is provided to briefly introduce the concepts, which will be described in detail in the detailed description section below. This summary section is not intended to identify key or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0004] According to a first aspect of the present disclosure, an image detection method is provided, the method comprising:
[0005] Acquire the target image to be detected;
[0006] The target image is input into a pre-generated target detection model to obtain the target authenticity detection result corresponding to the target image;
[0007] The target detection model is used to acquire the target color features and target noise features corresponding to the target image, and to perform authenticity detection on the target image based on the target color features and the target noise features to obtain the authenticity detection result of the target.
[0008] According to a second aspect of the present disclosure, an image detection apparatus is provided, the apparatus comprising:
[0009] The acquisition module is used to acquire the target image to be detected;
[0010] The detection module is used to input the target image into a pre-generated target detection model to obtain the target authenticity detection result corresponding to the target image; wherein, the target detection model is used to acquire the target color features and target noise features corresponding to the target image, and perform authenticity detection on the target image based on the target color features and the target noise features to obtain the target authenticity detection result.
[0011] According to a third aspect of the present disclosure, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processing device, implements the steps of the method described in the first aspect of the present disclosure.
[0012] According to a fourth aspect of the present disclosure, an electronic device is provided, comprising:
[0013] A storage device on which computer programs are stored;
[0014] A processing device for executing the computer program in the storage device to implement the steps of the method described in the first aspect of this disclosure.
[0015] The above technical solution involves acquiring a target image to be detected, inputting the target image into a pre-generated target detection model, and obtaining the target authenticity detection result. This target detection model can be used to acquire the target color features and target noise features corresponding to the target image, and then perform authenticity detection on the target image based on these features to obtain the target authenticity detection result. Thus, by combining the advantages of both target color features and target noise features for authenticity detection, the accuracy of image authenticity detection can be improved.
[0016] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0017] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale. In the drawings:
[0018] Figure 1 This is a flowchart illustrating an image detection method according to an exemplary embodiment.
[0019] Figure 2 This is a schematic diagram illustrating a target detection model according to an exemplary embodiment.
[0020] Figure 3 This is a flowchart illustrating another image detection method according to an exemplary embodiment.
[0021] Figure 4 This is a schematic diagram illustrating another target detection model according to an exemplary embodiment.
[0022] Figure 5 This is a flowchart illustrating another image detection method according to an exemplary embodiment.
[0023] Figure 6 This is a flowchart illustrating a method for pre-generating a target detection model according to an exemplary embodiment.
[0024] Figure 7 This is a block diagram illustrating an image detection apparatus according to an exemplary embodiment.
[0025] Figure 8 This is a block diagram illustrating another image detection apparatus according to an exemplary embodiment.
[0026] Figure 9 This is a block diagram illustrating an electronic device according to an exemplary embodiment. Detailed Implementation
[0027] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0028] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0029] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.
[0030] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0031] It should be noted that the terms "one" and "multiple" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that they should be understood as "one or more" unless explicitly stated in the context. In the description of this disclosure, unless otherwise stated, "multiple" means two or more, and other quantifiers are similar; "at least one," "one or more," or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one 'a' can represent any number of 'a's; as another example, one or more of a, b, and c can represent: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple; "and / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone, where A and B can be singular or plural.
[0032] Although operations or steps are described in a specific order in the accompanying drawings in the embodiments of this disclosure, it should not be construed as requiring these operations or steps to be performed in the specific order or serial order shown, or requiring all of the shown operations or steps to be performed to obtain the desired result. In the embodiments of this disclosure, these operations or steps may be performed serially; they may be performed in parallel; or a portion of these operations or steps may be performed.
[0033] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0034] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.
[0035] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the software or hardware, such as the electronic device, application, server, or storage medium performing the operations of this disclosed technical solution, based on the prompt message.
[0036] As an optional but non-limiting implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0037] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.
[0038] Meanwhile, it is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and related provisions.
[0039] First, the application scenarios of this disclosure will be explained. This disclosure can be applied to image detection scenarios, especially image authenticity detection scenarios, such as face authenticity detection.
[0040] With the continuous advancements in face spoofing technology, the realism, resolution, and anti-spoofing capabilities of synthesized fake faces have significantly improved. However, most face authentication techniques in these technologies only possess a certain ability to identify learned face spoofing methods, and their ability to handle complex post-processing, image or video compression issues in real-world applications is very limited. Furthermore, the accuracy of these methods drops significantly when faced with unknown, novel face spoofing techniques.
[0041] To address the aforementioned issues, this disclosure provides an image detection method, apparatus, readable medium, and electronic device. The method acquires target color features and target noise features corresponding to a target image through a target detection model, and performs authenticity detection on the target image based on these features to obtain the target authenticity detection result, thereby improving the accuracy of image authenticity detection.
[0042] The present disclosure will now be described in conjunction with specific embodiments.
[0043] Figure 1 This is a flowchart illustrating an image detection method according to an exemplary embodiment. The method can be applied to electronic devices, which may include terminal devices such as smartphones, smart wearable devices, smart speakers, smart tablets, PDAs (Personal Digital Assistants), CPEs (Customer Premise Equipment), personal computers, in-vehicle terminals, etc.; the electronic device may also include a server, such as a local server or a cloud server. Figure 1 As shown, the method may include:
[0044] S101. Obtain the target image to be detected.
[0045] In this step, the target image can be acquired in real time, a pre-stored target image can be obtained, or the target image sent by other devices can be received. This disclosure does not limit the method of acquiring the target image. The target image can be a picture or a video, and this disclosure does not limit the type of target image.
[0046] S102. Input the target image into the pre-generated target detection model to obtain the target authenticity detection result corresponding to the target image.
[0047] The target detection model can be used to obtain the target color features and target noise features corresponding to the target image, and perform authenticity detection on the target image based on the target color features and target noise features to obtain the target authenticity detection result.
[0048] In some embodiments, the target image can be any image, and the target authenticity detection result can be used to characterize whether the target image has been tampered with. If the target image has been tampered with, the target authenticity detection result is "fake"; otherwise, the target authenticity detection result is "real".
[0049] In other embodiments, the target image may be an image including a face, and the target authenticity detection result can be used to characterize whether the face has been tampered with. For example, a target authenticity detection result of "fake" can characterize that the face has been tampered with, while a target authenticity detection result of "real" can characterize that the face has not been tampered with.
[0050] In other embodiments, the target image may be an image including the target object, and the target authenticity detection result may be used to characterize whether the target object has been tampered with.
[0051] Using the above method, a target image to be detected is acquired, and the target image is input into a pre-generated target detection model to obtain the target image's authenticity detection result. This target detection model can be used to acquire the target color features and target noise features corresponding to the target image, and then perform authenticity detection on the target image based on these features to obtain the authenticity detection result. In this way, by combining the advantages of both target color features and target noise features (i.e., the advantages of each color mode and noise mode) for authenticity detection, the accuracy of image authenticity detection can be improved.
[0052] Figure 2 This is a schematic diagram illustrating an object detection model according to an exemplary embodiment. For example... Figure 2As shown, the target detection model 200 may include a color encoder 211, a noise extractor 221, a noise encoder 231, and a feature classifier 241.
[0053] Specifically, the color encoder can output target color features to the feature classifier and intermediate layer feature maps to the noise extractor based on the input target image; the noise extractor can output a pending image corresponding to the target image to the noise encoder based on the input target image and a first pending feature map corresponding to the intermediate layer feature map based on the input intermediate layer feature map; the noise encoder can output target noise features to the feature classifier based on the input pending image and the first pending feature map; the feature classifier can be used to output the target authenticity detection result corresponding to the target image based on the input target color features and target noise features.
[0054] In this way, by including a color encoder, a noise extractor, a noise encoder, and a feature classifier in the target detection model, the advantages of both target color features and target noise features can be combined to perform authenticity detection, thereby improving the accuracy of image authenticity detection.
[0055] In some embodiments, the structures of the color encoder and noise extractor described above can both be convolutional neural networks, such as CNN (Convolutional Neural Networks), RNN (Recurrent Neural Network), MLP (Multilayer Perceptron), or Transformer.
[0056] In some embodiments, the number of convolution kernels contained in the color encoder and noise extractor described above may be equal.
[0057] Furthermore, the convolution kernel of the aforementioned noise extractor can be a convolution kernel operator from related technologies, or a more complex edge extraction operator such as Sobel, Prewitt, Roberts operator, etc.
[0058] Figure 3 This is a flowchart illustrating another image detection method according to an exemplary embodiment. Figure 3 As shown, the method may include:
[0059] S301. Obtain the target image to be detected.
[0060] S302. Input the target image into the color encoder to obtain the target color features and at least one intermediate layer feature map corresponding to the target image.
[0061] For example, the color encoder may include multiple first convolutional kernels, each of which outputs an intermediate layer feature map. After the target image is processed by multiple first convolutional kernels, the target color features corresponding to the target image are finally obtained.
[0062] S303. The noise extractor extracts noise from the target image according to the preset feature extraction strategy to obtain the image to be determined corresponding to the target image; and the noise extractor extracts noise from the intermediate layer feature map according to the preset feature extraction strategy to obtain the first image to be determined corresponding to the intermediate layer feature map.
[0063] In this step, the aforementioned preset feature extraction strategy may include the following steps:
[0064] First, horizontal convolution is performed on the image to be extracted to obtain a horizontal noise feature map.
[0065] For example, the horizontal noise information of the image to be extracted can be extracted by performing a convolution operation of the horizontal [-1, 1] operator on the image to be extracted, and the horizontal noise feature map can be obtained.
[0066] Secondly, vertical convolution is performed on the image to be extracted to obtain a vertical noise feature map.
[0067] For example, the vertical noise information of the image to be extracted can be extracted by performing a convolution operation of the vertical direction [-1, 1] operator on the image to be extracted, and the vertical noise feature map can be obtained.
[0068] Finally, based on the horizontal and vertical noise feature maps, the noise feature map to be determined is obtained.
[0069] In some embodiments, the horizontal noise feature map and the vertical noise feature map can be superimposed to obtain a superimposed noise feature map; the superimposed noise feature map is used as the aforementioned undetermined image.
[0070] In other embodiments, the horizontal noise feature map and the vertical noise feature map can be superimposed to obtain a superimposed noise feature map; and the superimposed noise feature map can be normalized to obtain a noise feature map to be determined.
[0071] It should be noted that the above normalization process can process the data according to a preset algorithm, limiting the processed data to a certain preset range. Through normalization, the statistical distribution of the samples can be summarized and unified. Normalization between 0 and 1 represents a statistical probability distribution, while normalization within a certain interval represents a statistical coordinate distribution. In some embodiments, the superimposed residual image can be normalized to a pixel value range of 0-255 to ensure a uniform distribution.
[0072] The image to be extracted can be either the intermediate layer feature map or an image obtained by grayscale processing of the target image. For example, if the image to be extracted is an intermediate layer feature map, the undetermined noise feature map may include a first undetermined feature map; if the image to be extracted is an image obtained by grayscale processing of the target image, the undetermined noise feature map may include the undetermined image corresponding to the target image.
[0073] In this way, the noise extractor can help extract some high-frequency information from the image to be extracted, highlight image noise, and ignore some color and scene information to assist in feature extraction.
[0074] It should be noted that grayscale processing of a target image can include any of the following methods: component method, maximum value method, average value method, and weighted average method.
[0075] S304. Input the image to be determined and the first feature map to be determined into the noise encoder to obtain the target noise features corresponding to the target image.
[0076] S305. Input the target color features and target noise features into the feature classifier to obtain the target authenticity detection result.
[0077] In this way, by obtaining the target color features and target noise features corresponding to the target image through the color encoder and noise encoder respectively, and combining the target color features and target noise features for classification and detection, the accuracy of authenticity detection can be improved.
[0078] Figure 4 This is a schematic diagram illustrating another target detection model according to an exemplary embodiment. Figure 4 As shown, the target detection model 200 may further include a noise decoder 232. Wherein:
[0079] The noise encoder described above can also be used to output a second undetermined feature map to the noise decoder based on the first undetermined feature map.
[0080] This noise decoder can obtain the predicted forgery region corresponding to the target image based on the target noise features input from the noise encoder and a second undetermined feature map. This noise decoder can be implemented using deconvolution or upsampling.
[0081] For example, the predicted fake region can be obtained in the following way:
[0082] The second undetermined feature map, output by the noise encoder based on the first undetermined feature map, is obtained, and the target noise features and the second undetermined feature map are input into the noise decoder to obtain the predicted forgery region corresponding to the target image.
[0083] Figure 5This is a flowchart illustrating another image detection method according to an exemplary embodiment. For example... Figure 5 As shown, the method may include:
[0084] S501. Obtain the target image to be detected.
[0085] S502. Input the target image into the color encoder to obtain the target color features and at least one intermediate layer feature map corresponding to the target image.
[0086] For example, the color encoder may include multiple first convolutional kernels, each of which outputs an intermediate layer feature map. After the target image is processed by multiple first convolutional kernels, the target color features corresponding to the target image are finally obtained.
[0087] S503. The noise extractor extracts noise from the target image according to the preset feature extraction strategy to obtain the image to be determined corresponding to the target image; and the noise extractor extracts noise from the intermediate layer feature map according to the preset feature extraction strategy to obtain the first image to be determined corresponding to the intermediate layer feature map.
[0088] S504. Input the image to be determined and the first feature map to be determined into the noise encoder to obtain the target noise feature and the second feature map corresponding to the target image.
[0089] S505. Input the target color features and target noise features into the feature classifier to obtain the target authenticity detection result.
[0090] S506. Input the target noise features and the second undetermined feature map into the noise decoder to obtain the predicted forgery region corresponding to the target image.
[0091] In some embodiments, the predicted forgery region can be displayed using a black and white image of the same size as the target image. For example, the white areas in the black and white image can represent the areas of the target image that have been tampered with or forged, and the black areas in the black and white image can also represent the areas of the target image that have been tampered with or forged. This disclosure does not limit this.
[0092] In this way, while generating the results of target authenticity detection, it is also possible to generate predicted forgery regions, pointing out the forgery regions in the form of images, thereby enhancing the credibility and interpretability of the model.
[0093] In some embodiments, the above-mentioned target authenticity detection result may include two types of results: "real" and "fake". The S506 step may be executed if the above-mentioned target authenticity detection result is "fake", and may not be executed if the above-mentioned target authenticity detection result is "real".
[0094] In other embodiments, step S506 can be performed regardless of the target authenticity detection result. The predicted forgery region obtained through step S506 can help determine the accuracy of the target authenticity detection result obtained in step S505. Furthermore, the target authenticity detection result can be corrected based on the predicted forgery region obtained through step S506.
[0095] In one implementation, for the same target image, if the number of pixels in the predicted forgery region is greater than a preset pixel threshold, and the target authenticity detection result is "real," then it can be determined that the target authenticity detection result is erroneous, and the target authenticity detection result can be corrected to "forged." The preset pixel threshold can be any value greater than or equal to 0.
[0096] In another implementation, for the same target image, if the ratio of the number of pixels in the predicted forgery region to the total number of pixels in the target image is greater than or equal to a preset ratio threshold, and the target authenticity detection result is "real," then it can be determined that the target authenticity detection result is erroneous, and the target authenticity detection result can be corrected to "forged." The preset ratio threshold can be any value greater than 0 and less than 1.
[0097] Figure 6 This is a flowchart illustrating a method for pre-generating an object detection model according to an exemplary embodiment. Figure 6 As shown, the method may include:
[0098] S601. Obtain at least one real sample image.
[0099] There can be multiple real sample images, which can be obtained from an existing database or manually obtained from the internet.
[0100] S602. Perform color reconstruction on the real sample image to obtain a color-forged sample image.
[0101] S603. Determine the image sample set based on the real sample image and the color-forged sample image.
[0102] S604. Train the target neural network model based on the image sample set, and determine the target detection model based on the trained target neural network model.
[0103] In this way, there is no need to manually construct color forgery sample images. Instead, color forgery sample images can be automatically obtained through color reconstruction. This color reconstruction method can be self-supervised color reconstruction. This automatic generation of color forgery sample images can avoid the tedious workload of manually collecting forgery samples and improve the efficiency of sample acquisition.
[0104] In some embodiments, the network structure of the target neural network model can be the same as that of the target detection model.
[0105] For example, the target neural network model could also be as follows: Figure 2 The network structure shown indicates that the target neural network model may include a color encoder, a noise extractor, a noise encoder, and a feature classifier. The functions and connections of the color encoder, noise extractor, noise encoder, and feature classifier can be found in the description of the foregoing embodiments of this disclosure, and will not be repeated here.
[0106] For example, the target neural network model could also be as follows: Figure 4 The network structure shown includes a color encoder, a noise extractor, a noise encoder, a feature classifier, and a noise decoder. The noise decoder can be used to predict the forged region corresponding to the sample image based on the target noise features output by the noise encoder and a second undetermined feature map.
[0107] In other embodiments, the network structure of the target neural network model may differ from that of the target detection model. For example, in addition to including the target detection model, the target neural network model may also include... Figure 4 The color decoder 212 shown.
[0108] This color decoder can be used to output color forgery sample images based on the color features of the input samples. The color decoder can be in the form of deconvolution or upsampling.
[0109] In one implementation, step S602 above may include the following sub-steps:
[0110] First, the real sample image is input into the color encoder to obtain the sample color features corresponding to the real sample image.
[0111] Then, the color features of the sample are input into the color decoder to obtain the color forgery sample image.
[0112] For example, color features of a real sample image can be extracted using a color encoder. These color features are then input into a color decoder for image reconstruction, resulting in a depth-generated color-forged sample image. The color encoder can employ a convolutional neural network (e.g., CNN, RNN, MLP, or Transformer), and the color decoder can employ an image generation model to reconstruct the image using feature vectors. The color-forged sample image generated by the color decoder can be a forged image with fake textures.
[0113] It should be noted that in the above-mentioned method steps for pre-generating the target detection model, the color decoder can be trained based on the generated color forgery sample images in order to improve the performance of the color decoder in generating color forgery sample images. Furthermore, during the training phase, the color decoder can also be used to enhance the feature extraction capability of the color encoder.
[0114] In step S603 above, the method for determining the image sample set based on the real sample image and the color-forged sample image may include any of the following methods:
[0115] Method 1: An image sample set can be generated based on real sample images and color-forged sample images.
[0116] For example, real sample images can be labeled "real" and color-forged sample images can be labeled "forged" to obtain an image sample set.
[0117] Method 2: After performing region forgery processing on the real sample image and / or color forgery sample image based on the target region mask, an image sample set is obtained.
[0118] For example, a region forgery process can be performed on a target sample image based on a target region mask to obtain a region forged sample image; an image sample set is determined based on the real sample image, the color forged sample image, and the region forged sample image. The target sample image may include the real sample image and / or the color forged sample image, and the target region mask is a randomly generated region mask.
[0119] In some implementations, the real sample images can be labeled as "real," while the color-forged sample images and the region-forged sample images can both be labeled as "forged," thus obtaining the image sample set.
[0120] The target region mask described above can be used to determine the first region to be forged. For example, the target region mask can be a pre-set mask. Alternatively, the target region mask can be a randomly generated region mask.
[0121] In some embodiments, the target region mask can be used to perform region forgery processing on the target sample image to obtain a region forged sample image.
[0122] In other embodiments, the forged sample image can also be processed by region forgery based on the target region mask to obtain a region forged sample image.
[0123] In other embodiments, region forgery processing can be performed on both the target sample image and the forged sample image according to the target region mask to obtain more region forged sample images.
[0124] The forgery processing in this area may include one or more of the following target processing types: image compression, Gaussian blur, Gaussian noise, sharpening, color jitter, and elastic transformation.
[0125] In some embodiments, the target weight corresponding to each target processing type can be determined first; then, based on the target mask and the target weight, at least one type of region forgery processing can be performed on the given sample image to obtain a region forged sample image. The target weight can be randomly determined. This target weight can also be referred to as the trigger probability.
[0126] In other embodiments, random parameters and trigger probabilities corresponding to each target processing type can be determined first, and a region forgery processing of at least one target processing type can be performed on the target sample image to obtain an overall forged image based on the random parameters and trigger probabilities; or the target region can be determined based on the target mask; and then a region forged sample image can be obtained based on the target sample image, the target region, and the overall forged image.
[0127] In other embodiments, the method of performing region forgery processing on a target sample image based on a target region mask to obtain a region-forged sample image may include the following steps:
[0128] First, a global mask is preset. After randomly transforming the global mask, the target region mask M and the second region mask 1-M are obtained. The second region image is obtained based on the target image and the second region mask (1-M).
[0129] The second region image can be the image content of the second region corresponding to the second region mask in the target image.
[0130] It should be noted that, in order to accelerate the mask generation speed, a global mask is pre-set in this embodiment. At the same time, in order to ensure the complexity and diversity of the mask, the global mask is randomly transformed. This random transformation includes random dilation, erosion and elastic transformation, which can make the target area mask have richer shapes and sizes.
[0131] Secondly, determine the random parameters and trigger probability corresponding to each target processing type, and perform one or more target processing types of region forgery processing on the given sample image according to the random parameters and trigger probability to obtain the overall forged image.
[0132] The target processing type may include one or more of the following: image compression, Gaussian blur, Gaussian noise, sharpening, color jitter, and elastic transformation.
[0133] It should be noted that the above steps can be executed sequentially or in parallel in any order, and this disclosure does not limit them in this regard.
[0134] Finally, the second region image and the overall forged image are overlaid to obtain the region forged sample image.
[0135] For example, a first region can be determined based on the target region mask M, and the first region image corresponding to the first region in the overall forged image can be merged with the second region image to obtain a region forged sample image.
[0136] It should be noted that the target region mask mentioned above can be one or more, so that one or more regions of forged sample images can be obtained through the above method.
[0137] In step S604 above, the methods for determining the target detection model based on the trained target neural network model can include various approaches, for example:
[0138] In some embodiments, the trained target neural network model can be used as the target detection model described above.
[0139] In other embodiments, the color decoder in the trained target neural network model can be removed to obtain the target detection model described above.
[0140] In step S604 above, the target neural network model can be trained in a supervised manner based on the image sample set and the target loss function, and the trained target neural network model can be used as the target detection model.
[0141] The target loss function mentioned above can include one or more loss functions, and different encoders or decoders in the target neural network model can use different loss functions.
[0142] In some embodiments, the target loss function may include a cross-entropy loss function, which can be used to determine the binary classification label information constraints of the aforementioned color-forged sample images and real sample images. For example, during the training phase, the labels corresponding to the real sample images and color-forged sample images in the image sample set can be used as constraints, and backpropagation can be performed according to the cross-entropy loss function to update the model parameters of the target neural network model. This cross-entropy loss function can be used to constrain the feature classifier, color encoder, and noise encoder of the target neural network model, thereby updating the relevant parameters of the feature classifier, color encoder, and noise encoder.
[0143] Furthermore, the cross-entropy loss function can be one or multiple. For example, the feature classifier, color encoder, and noise encoder mentioned above can each correspond to different cross-entropy loss functions.
[0144] In other embodiments, the target loss function may include a first reconstruction loss function, which can be used to determine pixel-level constraints between the aforementioned color-forged sample images and real sample images. For example, during the training phase, the pixel-level differences between the aforementioned color-forged sample images and real sample images can be used as constraints, and backpropagation can be performed according to the first reconstruction loss function to update the model parameters of the target neural network model. The first reconstruction loss function can be used to constrain the color encoder and color decoder of the target neural network model, thereby updating the relevant parameters of the color encoder and color decoder.
[0145] In other embodiments, the target loss function may include a perceptual loss function, which can be used to determine feature-level constraints between the aforementioned color-forged sample images and real sample images. For example, during the training phase, the feature-level differences between the aforementioned color-forged sample images and real sample images can be used as constraints, and backpropagation can be performed according to the perceptual loss function to update the model parameters of the target neural network model. This perceptual loss function can be used to constrain the color encoder and color decoder of the target neural network model, thereby updating the relevant parameters of the color encoder and color decoder.
[0146] In some embodiments, the target loss function may include an adversarial loss function, which can use an adversarial generative network to introduce discriminant constraints on image discrimination, thereby improving the quality of the generated color-forged sample images. For example, during the training phase, an adversarial generative network is used to introduce discriminant constraints on image discrimination, updating the model parameters of the target neural network model, thereby improving the quality of the generated color-forged sample images. This adversarial loss function can be used to constrain the color encoder and color decoder of the target neural network model, thereby updating the relevant parameters of the color encoder and color decoder.
[0147] In some embodiments, the target loss function may include a second reconstruction loss function, which can be used to determine pixel-level constraints between the predicted forgery region and the target region mask used to generate the forgery region. For example, during the training phase, the pixel-level difference between the predicted forgery region and the target region mask used to generate the forgery region can be used as a constraint, and backpropagation can be performed according to the second reconstruction loss function to update the model parameters of the target neural network model. This second reconstruction loss function can be used to constrain the noise encoder and noise decoder of the target neural network model, thereby updating the relevant parameters of the noise encoder and noise decoder.
[0148] In this way, one or more of the above-mentioned target loss functions can be used to train the target neural network model, update the model parameters of the target neural network model, and optimize the authenticity detection performance of the target neural network model.
[0149] Figure 7 This is a block diagram illustrating an image detection apparatus 700 according to an exemplary embodiment, such as... Figure 7 As shown, the device 700 may include:
[0150] The acquisition module 701 is used to acquire the target image to be detected;
[0151] The detection module 702 is used to input the target image into a pre-generated target detection model to obtain the target authenticity detection result corresponding to the target image; wherein, the target detection model is used to acquire the target color features and target noise features corresponding to the target image, and perform authenticity detection on the target image based on the target color features and the target noise features to obtain the target authenticity detection result.
[0152] In some embodiments, the target detection model includes a color encoder, a noise extractor, a noise encoder, and a feature classifier; the detection module 702 is configured to:
[0153] The target image is input into the color encoder to obtain the target color features and at least one intermediate layer feature map corresponding to the target image;
[0154] The noise extractor extracts noise from the target image according to a preset feature extraction strategy to obtain a pending image corresponding to the target image. The noise extractor also extracts noise from the intermediate layer feature map according to the preset feature extraction strategy to obtain a first pending feature map corresponding to the intermediate layer feature map.
[0155] The image to be determined and the first feature map to be determined are input into the noise encoder to obtain the target noise features corresponding to the target image;
[0156] The target color features and the target noise features are input into the feature classifier to obtain the target authenticity detection result.
[0157] In some embodiments, the detection module 702 is configured to perform a preset feature extraction strategy through the following steps:
[0158] Perform horizontal convolution on the image to be extracted to obtain a horizontal noise feature map;
[0159] Perform vertical convolution on the image to be extracted to obtain a vertical noise feature map;
[0160] Based on the horizontal noise feature map and the vertical noise feature map, a noise feature map to be determined is obtained; wherein, the image to be extracted is the intermediate layer feature map or an image obtained by grayscale processing of the target image; when the image to be extracted is the intermediate layer feature map, the noise feature map to be determined includes the first noise feature map to be determined; when the image to be extracted is an image obtained by grayscale processing of the target image, the noise feature map to be determined includes the image to be determined corresponding to the target image.
[0161] In some embodiments, the detection module 702 is used to superimpose the horizontal noise feature map and the vertical noise feature map to obtain a superimposed noise feature map; and to normalize the superimposed noise feature map to obtain the noise feature map to be determined.
[0162] In some embodiments, the target detection model further includes a noise decoder; the detection module 702 is further configured to acquire a second undetermined feature map output by the noise encoder based on the first undetermined feature map; input the target noise features and the second undetermined feature map into the noise decoder to obtain the predicted forgery region corresponding to the target image.
[0163] Figure 8 This is a block diagram illustrating another image detection apparatus according to an exemplary embodiment, such as... Figure 8 As shown, the device 700 may further include:
[0164] Generation module 703 is used to pre-generate the target detection model in the following manner:
[0165] Obtain at least one real sample image;
[0166] Color reconstruction is performed on the real sample image to obtain a color-forged sample image;
[0167] Based on the real sample images and the color-forged sample images, an image sample set is determined;
[0168] The target neural network model is trained based on the image sample set, and the target detection model is determined based on the trained target neural network model.
[0169] In some embodiments, the target neural network model further includes a color decoder; the generation module is used to input the real sample image into the color encoder to obtain sample color features corresponding to the real sample image; and input the sample color features into the color decoder to obtain the color forgery sample image.
[0170] In some embodiments, the generation module is used to use the trained target neural network model as the target detection model; or, the target detection model is obtained by removing the color decoder from the trained target neural network model.
[0171] In some embodiments, the target neural network model further includes a noise decoder; the noise decoder is used to predict the predicted forgery region corresponding to the sample image based on the target noise features and the second undetermined feature map output by the noise encoder.
[0172] In some embodiments, the generation module is used to perform region forgery processing on a target sample image based on a target region mask to obtain a region forged sample image; wherein, the target sample image includes the real sample image and / or the color forged sample image, and the target region mask is a randomly generated region mask; and the image sample set is determined based on the real sample image, the color forged sample image, and the region forged sample image.
[0173] In some embodiments, the target image is an image including a human face, and the target authenticity detection result is used to characterize whether the human face has been tampered with.
[0174] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0175] The following is for reference. Figure 9 This document illustrates a structural diagram of an electronic device 2000 (e.g., a terminal device or a server) suitable for implementing embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), and in-vehicle terminals (e.g., in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. The server in the embodiments of the present disclosure may include, but is not limited to, local servers, cloud servers, single servers, and distributed servers. Figure 9 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0176] like Figure 9As shown, electronic device 2000 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 2001, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 2002 or a program loaded from storage device 2008 into random access memory (RAM) 2003. RAM 2003 also stores various programs and data required for the operation of electronic device 2000. Processing device 2001, ROM 2002, and RAM 2003 are interconnected via bus 2004. Input / output (I / O) interface 2005 is also connected to bus 2004.
[0177] Typically, the following devices can be connected to the input / output interface 2005: input devices 2006 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 2007 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 2008 including, for example, magnetic tapes, hard disks, etc.; and communication devices 2009. Communication device 2009 allows electronic device 2000 to communicate wirelessly or wiredly with other devices to exchange data. Although... Figure 9 An electronic device 2000 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0178] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 2009, or installed from storage device 2008, or installed from ROM 2002. When the computer program is executed by processing device 2001, it performs the functions defined in the methods of embodiments of this disclosure.
[0179] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0180] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol, such as HTTP (Hypertext Transfer Protocol), and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0181] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0182] The aforementioned computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to: acquire a target image to be detected; input the target image into a pre-generated target detection model to obtain a target authenticity detection result corresponding to the target image; wherein the target detection model is used to acquire target color features and target noise features corresponding to the target image, and perform authenticity detection on the target image based on the target color features and the target noise features to obtain the target authenticity detection result.
[0183] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0184] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0185] The modules described in the embodiments of this disclosure can be implemented in software or in hardware. The names of the modules are not necessarily limiting in certain circumstances; for example, an acquisition module can also be described as "a module for acquiring an image of a target to be detected."
[0186] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0187] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0188] According to one or more embodiments of this disclosure, an image detection method is provided, the method comprising:
[0189] Acquire the target image to be detected;
[0190] The target image is input into a pre-generated target detection model to obtain the target authenticity detection result corresponding to the target image;
[0191] The target detection model is used to acquire the target color features and target noise features corresponding to the target image, and to perform authenticity detection on the target image based on the target color features and the target noise features to obtain the authenticity detection result of the target.
[0192] According to one or more embodiments of this disclosure, the target detection model includes a color encoder, a noise extractor, a noise encoder, and a feature classifier; the step of inputting the target image into the pre-generated target detection model to obtain the target image's corresponding target authenticity detection result includes:
[0193] The target image is input into the color encoder to obtain the target color features and at least one intermediate layer feature map corresponding to the target image;
[0194] The noise extractor extracts noise from the target image according to a preset feature extraction strategy to obtain a pending image corresponding to the target image. The noise extractor also extracts noise from the intermediate layer feature map according to the preset feature extraction strategy to obtain a first pending feature map corresponding to the intermediate layer feature map.
[0195] The image to be determined and the first feature map to be determined are input into the noise encoder to obtain the target noise features corresponding to the target image;
[0196] The target color features and the target noise features are input into the feature classifier to obtain the target authenticity detection result.
[0197] According to one or more embodiments of this disclosure, the preset feature extraction strategy includes:
[0198] Perform horizontal convolution on the image to be extracted to obtain a horizontal noise feature map;
[0199] Perform vertical convolution on the image to be extracted to obtain a vertical noise feature map;
[0200] Based on the horizontal noise feature map and the vertical noise feature map, a noise feature map to be determined is obtained; wherein, the image to be extracted is the intermediate layer feature map or an image obtained by grayscale processing of the target image; when the image to be extracted is the intermediate layer feature map, the noise feature map to be determined includes the first noise feature map to be determined; when the image to be extracted is an image obtained by grayscale processing of the target image, the noise feature map to be determined includes the image to be determined corresponding to the target image.
[0201] According to one or more embodiments of this disclosure, obtaining the noise feature map to be determined based on the horizontal noise feature map and the vertical noise feature map includes:
[0202] The horizontal noise feature map and the vertical noise feature map are superimposed to obtain the superimposed noise feature map;
[0203] The superimposed noise feature map is normalized to obtain the noise feature map to be determined.
[0204] According to one or more embodiments of this disclosure, the target detection model further includes a noise decoder; the method further includes:
[0205] Obtain the second undetermined feature map output by the noise encoder based on the first undetermined feature map;
[0206] The target noise features and the second undetermined feature map are input into the noise decoder to obtain the predicted forgery region corresponding to the target image.
[0207] According to one or more embodiments of this disclosure, the target detection model is pre-generated in the following manner:
[0208] Obtain at least one real sample image;
[0209] Color reconstruction is performed on the real sample image to obtain a color-forged sample image;
[0210] Based on the real sample images and the color-forged sample images, an image sample set is determined;
[0211] The target neural network model is trained based on the image sample set, and the target detection model is determined based on the trained target neural network model.
[0212] According to one or more embodiments of this disclosure, the target neural network model further includes a color decoder; the step of color reconstruction of the real sample image to obtain a color-forged sample image includes:
[0213] The real sample image is input into the color encoder to obtain the sample color features corresponding to the real sample image;
[0214] The sample color features are input into the color decoder to obtain the color forgery sample image.
[0215] According to one or more embodiments of this disclosure, determining the target detection model based on the trained target neural network model includes:
[0216] The trained target neural network model is used as the target detection model; or...
[0217] The target detection model is obtained by removing the color decoder from the trained target neural network model.
[0218] According to one or more embodiments of this disclosure, the target neural network model further includes a noise decoder; the noise decoder is used to predict the predicted forgery region corresponding to the sample image based on the target noise features and the second undetermined feature map output by the noise encoder.
[0219] According to one or more embodiments of this disclosure, determining the image sample set based on the real sample image and the color-forged sample image includes:
[0220] Based on the target region mask, a region forgery processing is performed on the target sample image to obtain a region forged sample image; wherein, the target sample image includes the real sample image and / or the color forged sample image, and the target region mask is a randomly generated region mask;
[0221] The image sample set is determined based on the real sample image, the color-forged sample image, and the region-forged sample image.
[0222] According to one or more embodiments of this disclosure, the target image is an image including a human face, and the target authenticity detection result is used to characterize whether the human face has been tampered with.
[0223] According to one or more embodiments of this disclosure, an image detection apparatus is provided, the apparatus comprising:
[0224] The acquisition module is used to acquire the target image to be detected;
[0225] The detection module is used to input the target image into a pre-generated target detection model to obtain the target authenticity detection result corresponding to the target image; wherein, the target detection model is used to acquire the target color features and target noise features corresponding to the target image, and perform authenticity detection on the target image based on the target color features and the target noise features to obtain the target authenticity detection result.
[0226] According to one or more embodiments of this disclosure, the target detection model includes a color encoder, a noise extractor, a noise encoder, and a feature classifier; the detection module is used for:
[0227] The target image is input into the color encoder to obtain the target color features and at least one intermediate layer feature map corresponding to the target image;
[0228] The noise extractor extracts noise from the target image according to a preset feature extraction strategy to obtain a pending image corresponding to the target image. The noise extractor also extracts noise from the intermediate layer feature map according to the preset feature extraction strategy to obtain a first pending feature map corresponding to the intermediate layer feature map.
[0229] The image to be determined and the first feature map to be determined are input into the noise encoder to obtain the target noise features corresponding to the target image;
[0230] The target color features and the target noise features are input into the feature classifier to obtain the target authenticity detection result.
[0231] According to one or more embodiments of this disclosure, the detection module is configured to perform a preset feature extraction strategy through the following steps:
[0232] Perform horizontal convolution on the image to be extracted to obtain a horizontal noise feature map;
[0233] Perform vertical convolution on the image to be extracted to obtain a vertical noise feature map;
[0234] Based on the horizontal noise feature map and the vertical noise feature map, a noise feature map to be determined is obtained; wherein, the image to be extracted is the intermediate layer feature map or an image obtained by grayscale processing of the target image; when the image to be extracted is the intermediate layer feature map, the noise feature map to be determined includes the first noise feature map to be determined; when the image to be extracted is an image obtained by grayscale processing of the target image, the noise feature map to be determined includes the image to be determined corresponding to the target image.
[0235] According to one or more embodiments of this disclosure, the detection module is configured to superimpose the horizontal noise feature map and the vertical noise feature map to obtain a superimposed noise feature map; and to normalize the superimposed noise feature map to obtain the noise feature map to be determined.
[0236] According to one or more embodiments of this disclosure, the target detection model further includes a noise decoder; the detection module is further configured to acquire a second undetermined feature map output by the noise encoder based on the first undetermined feature map; input the target noise features and the second undetermined feature map into the noise decoder to obtain the predicted forgery region corresponding to the target image.
[0237] According to one or more embodiments of this disclosure, the apparatus further includes a generation module, the generation module being configured to pre-generate the target detection model in the following manner:
[0238] Obtain at least one real sample image;
[0239] Color reconstruction is performed on the real sample image to obtain a color-forged sample image;
[0240] Based on the real sample images and the color-forged sample images, an image sample set is determined;
[0241] The target neural network model is trained based on the image sample set, and the target detection model is determined based on the trained target neural network model.
[0242] According to one or more embodiments of this disclosure, the target neural network model further includes a color decoder; the generation module is configured to input the real sample image into the color encoder to obtain sample color features corresponding to the real sample image; and input the sample color features into the color decoder to obtain the color forgery sample image.
[0243] According to one or more embodiments of this disclosure, the generation module is used to use the trained target neural network model as the target detection model; or, the target detection model is obtained by removing the color decoder from the trained target neural network model.
[0244] According to one or more embodiments of this disclosure, the target neural network model further includes a noise decoder; the noise decoder is used to predict the predicted forgery region corresponding to the sample image based on the target noise features and the second undetermined feature map output by the noise encoder.
[0245] According to one or more embodiments of this disclosure, the generation module is used to perform region forgery processing on a target sample image based on a target region mask to obtain a region forged sample image; wherein, the target sample image includes the real sample image and / or the color forged sample image, and the target region mask is a randomly generated region mask; and the image sample set is determined based on the real sample image, the color forged sample image, and the region forged sample image.
[0246] According to one or more embodiments of this disclosure, the target image is an image including a human face, and the target authenticity detection result is used to characterize whether the human face has been tampered with.
[0247] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0248] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0249] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative forms of implementing the claims. Regarding the apparatus in the above embodiments, the specific manner in which the various modules perform their operations has been described in detail in the embodiments relating to the method, and will not be elaborated upon here.
Claims
1. An image detection method, characterized in that, The method includes: Acquire the target image to be detected; The target image is input into a pre-generated target detection model to obtain the target authenticity detection result corresponding to the target image; The target detection model is used to acquire the target color features and target noise features corresponding to the target image, and to perform authenticity detection on the target image based on the target color features and the target noise features to obtain the authenticity detection result of the target; The target detection model includes a color encoder, a noise extractor, a noise encoder, a feature classifier, and a noise decoder; the step of inputting the target image into the pre-generated target detection model to obtain the target authenticity detection result corresponding to the target image includes: The target image is input into the color encoder to obtain the target color features and at least one intermediate layer feature map corresponding to the target image; The noise extractor extracts noise from the target image according to a preset feature extraction strategy to obtain a pending image corresponding to the target image. The noise extractor also extracts noise from the intermediate layer feature map according to the preset feature extraction strategy to obtain a first pending feature map corresponding to the intermediate layer feature map. The image to be determined and the first feature map to be determined are input into the noise encoder to obtain the target noise features corresponding to the target image; The target color features and the target noise features are input into the feature classifier to obtain the target authenticity detection result; The method further includes: Obtain the second undetermined feature map output by the noise encoder based on the first undetermined feature map; The target noise features and the second undetermined feature map are input into the noise decoder to obtain the predicted forgery region corresponding to the target image.
2. The method according to claim 1, characterized in that, The preset feature extraction strategy includes: Perform horizontal convolution on the image to be extracted to obtain a horizontal noise feature map; Perform vertical convolution on the image to be extracted to obtain a vertical noise feature map; Based on the horizontal noise feature map and the vertical noise feature map, a noise feature map to be determined is obtained; wherein, the image to be extracted is the intermediate layer feature map or an image obtained by grayscale processing of the target image; when the image to be extracted is the intermediate layer feature map, the noise feature map to be determined includes the first noise feature map to be determined; when the image to be extracted is an image obtained by grayscale processing of the target image, the noise feature map to be determined includes the image to be determined corresponding to the target image.
3. The method according to claim 2, characterized in that, The step of obtaining the noise feature map to be determined based on the horizontal noise feature map and the vertical noise feature map includes: The horizontal noise feature map and the vertical noise feature map are superimposed to obtain the superimposed noise feature map; The superimposed noise feature map is normalized to obtain the noise feature map to be determined.
4. The method according to claim 1, characterized in that, The target detection model is pre-generated in the following manner: Obtain at least one real sample image; Color reconstruction is performed on the real sample image to obtain a color-forged sample image; Based on the real sample images and the color-forged sample images, an image sample set is determined; The target neural network model is trained based on the image sample set, and the target detection model is determined based on the trained target neural network model.
5. The method according to claim 4, characterized in that, The target neural network model further includes a color decoder; the step of color reconstruction of the real sample image to obtain the color-forged sample image includes: The real sample image is input into the color encoder to obtain the sample color features corresponding to the real sample image; The sample color features are input into the color decoder to obtain the color forgery sample image.
6. The method according to claim 5, characterized in that, Determining the target detection model based on the trained target neural network model includes: The trained target neural network model is used as the target detection model; or... The target detection model is obtained by removing the color decoder from the trained target neural network model.
7. The method according to claim 4, characterized in that, The target neural network model further includes a noise decoder; the noise decoder is used to predict the predicted forgery region corresponding to the sample image based on the target noise features and the second undetermined feature map output by the noise encoder.
8. The method according to claim 4, characterized in that, The step of determining the image sample set based on the real sample image and the color-forged sample image includes: Based on the target region mask, a region forgery processing is performed on the target sample image to obtain a region forged sample image; wherein, the target sample image includes the real sample image and / or the color forged sample image, and the target region mask is a randomly generated region mask; The image sample set is determined based on the real sample image, the color-forged sample image, and the region-forged sample image.
9. The method according to any one of claims 1 to 8, characterized in that, The target image is an image including a human face, and the target authenticity detection result is used to characterize whether the human face has been tampered with.
10. An image detection device, characterized in that, The device includes: The acquisition module is used to acquire the target image to be detected; The detection module is used to input the target image into a pre-generated target detection model to obtain the target authenticity detection result corresponding to the target image; wherein, the target detection model is used to acquire the target color features and target noise features corresponding to the target image, and perform authenticity detection on the target image based on the target color features and the target noise features to obtain the target authenticity detection result; The target detection model includes a color encoder, a noise extractor, a noise encoder, a feature classifier, and a noise decoder; The detection module is also used for: The target image is input into the color encoder to obtain the target color features and at least one intermediate layer feature map corresponding to the target image; The noise extractor extracts noise from the target image according to a preset feature extraction strategy to obtain a pending image corresponding to the target image. The noise extractor also extracts noise from the intermediate layer feature map according to the preset feature extraction strategy to obtain a first pending feature map corresponding to the intermediate layer feature map. The image to be determined and the first feature map to be determined are input into the noise encoder to obtain the target noise features corresponding to the target image; The target color features and the target noise features are input into the feature classifier to obtain the target authenticity detection result; The detection module is further configured to acquire a second undetermined feature map output by the noise encoder based on the first undetermined feature map; input the target noise features and the second undetermined feature map into the noise decoder to obtain the predicted forgery region corresponding to the target image.
11. A computer-readable medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processing device, it implements the steps of the method according to any one of claims 1 to 9.
12. An electronic device, characterized in that, include: A storage device on which computer programs are stored; A processing apparatus for executing the computer program in the storage device to implement the steps of the method according to any one of claims 1 to 9.