Image authenticity detection method and device, electronic equipment and storage medium
By using global context modeling and nonlinear feature extension transformation, combined with stacked multi-layer residual networks and data augmentation strategies, the problem of insufficient capture of subtle differences and anti-interference ability in image authenticity detection in existing technologies is solved, and high-precision image authenticity identification is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HEFEI IFLY DIGITAL TECH CO LTD
- Filing Date
- 2026-01-28
- Publication Date
- 2026-05-29
AI Technical Summary
Existing image authenticity detection methods rely on frozen CLIP models, which are difficult to effectively capture subtle statistical differences in images and have weak anti-interference capabilities. This leads to decreased detection performance and stability in complex scenes, making it difficult to identify highly realistic generated images.
By performing global context modeling on the image to be detected, global semantic features are extracted, and nonlinear feature extension transformation is used to deeply mine the hidden true and false related details. Combined with a stacked multi-layer residual network structure and data augmentation strategy, the features are optimized for classification decision.
It significantly improves the detection capability of highly realistic forged images, avoids missed detections and false alarms, achieves high-precision image authenticity identification, and enhances the robustness and stability of the model in complex scenarios.
Smart Images

Figure CN122116100A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image detection technology, and in particular to a method, apparatus, electronic device, and storage medium for detecting the authenticity of images. Background Technology
[0002] Artificial Intelligence Generated Content (AIGC) technology can synthesize realistic images, but it also presents challenges to content trust, necessitating robust detection algorithms.
[0003] Currently, frozen Contrastive Language–Image Pre-training (CLIP) models are often used to extract features for image authenticity detection. However, CLIP models mainly focus on semantic content, easily ignoring subtle statistical differences that are crucial for authentication. Furthermore, they rely on a static feature space, making them less resistant to interference. When faced with post-processing such as image compression and noise addition, or adversarial scenarios, their detection stability and accuracy decrease significantly. Summary of the Invention
[0004] This invention provides an image authenticity detection method, apparatus, electronic device, and storage medium to address the deficiencies in the prior art.
[0005] This invention provides a method for detecting the authenticity of images, comprising the following steps: Global context modeling is performed on the image to be detected, and global semantic features of the image to be detected are extracted; The global semantic features are subjected to nonlinear feature expansion transformation, and during the nonlinear feature expansion transformation process, the hidden details related to the authenticity of the image in the global semantic features are mined to obtain the target features characterizing the authenticity of the image. Based on the target features, a classification decision is made to obtain the authenticity detection result of the image to be detected.
[0006] According to the image authenticity detection method provided by the present invention, the nonlinear feature expansion transformation of the global semantic features includes: The global semantic features are input into the feature expansion module, and the stacked multi-layer residual network structure in the feature expansion module is used to perform multi-level nonlinear convolution operations and residual fusion processing on the global semantic features.
[0007] According to the image authenticity detection method provided by the present invention, the stacked multi-layer residual network structure includes multiple cascaded residual units. Each residual unit includes a nonlinear branch consisting of a first convolutional layer, a batch normalization layer, an activation layer and a second convolutional layer connected in sequence, and a residual connection branch consisting of a third convolutional layer, a batch normalization layer and an activation layer connected in sequence. The nonlinear branch is used to perform nonlinear transformation on the input features, the residual connection branch is used to transform the input features, and the output feature of each residual unit is obtained by fusing the output features of the corresponding nonlinear branch and the output features of the corresponding residual connection branch.
[0008] According to the image authenticity detection method provided by the present invention, before performing global context modeling on the image to be detected, the method further includes: Obtain the original image of the image to be detected, and perform basic geometric transformations on the original image; Randomly select at least two basic enhancement categories from a set of preset basic enhancement categories; According to the priority of the extracted basic enhancement categories, the image processing algorithms corresponding to each basic enhancement category are used sequentially to process the original image after basic geometric transformation to obtain the image to be detected.
[0009] According to the image authenticity detection method provided by the present invention, the step of processing the original image after basic geometric transformation by sequentially using the image processing algorithm corresponding to each basic enhancement category according to the priority of the extracted basic enhancement categories includes: If the noise class is included in the extracted base enhancement category, the noise class is set to the lowest priority.
[0010] According to the present invention, an image authenticity detection method includes: performing global context modeling on the image to be detected to extract global semantic features; performing nonlinear feature expansion transformation on the global semantic features, and mining implicit details related to image authenticity in the global semantic features during the nonlinear feature expansion transformation process to obtain target features characterizing the authenticity attribute of the image; and performing classification decision based on the target features to obtain the authenticity detection result of the image to be detected, including: Using a authenticity detection model, global context modeling is performed on the image to be detected, global semantic features of the image to be detected are extracted, nonlinear feature expansion transformation is performed on the global semantic features, and in the process of nonlinear feature expansion transformation, the hidden details related to the authenticity of the image are mined in the global semantic features. After obtaining the target features that characterize the authenticity of the image, a classification decision is made based on the target features to obtain the authenticity detection result of the image to be detected. The authenticity detection model is constructed based on a pre-trained visual representation model. It is obtained by freezing the network parameters of the visual representation model except for the first fully connected layer of the multilayer perceptron unit of the encoder module, and only fine-tuning the parameters of the first fully connected layer and the network module parameters used to perform the nonlinear feature expansion transformation and the classification decision.
[0011] According to the image authenticity detection method provided by the present invention, the step of determining the training loss of the authenticity detection model includes: Obtain the predicted probability distribution of the authenticity detection model output for the training samples; The original labels of the training samples are converted into a target probability distribution, wherein the probability value corresponding to the target category to which the training sample belongs is set to a preset value less than 1, and the probability value corresponding to the non-target category is set to a preset value greater than 0. Determine the proportion of the target category to which the training sample belongs in all training samples, and determine the loss weight of the training sample based on the proportion. The training loss is calculated based on the predicted probability distribution, the target probability distribution, and the loss weights.
[0012] According to the image authenticity detection method provided by the present invention, the fine-tuning training process further includes: In the first phase, where the number of training rounds is less than the number of warm-up rounds, the learning rate is controlled to increase linearly from the initial value to the preset initial learning rate value. In the second stage, where the number of training rounds is greater than or equal to the number of warm-up rounds, the learning rate is controlled to decrease according to the cosine function law starting from the initial learning rate value as the number of training rounds increases.
[0013] According to the image authenticity detection method provided by the present invention, the visual representation model includes stacked encoder modules, each encoder module being composed of a multi-head attention unit and a multilayer perceptron unit connected in sequence.
[0014] According to the image authenticity detection method provided by the present invention, the step of performing a classification decision based on the target features to obtain the authenticity detection result of the image to be detected includes: The target features are mapped to an intermediate dimension space to obtain intermediate dimension features; The intermediate dimension features are mapped to a binary classification space to obtain classification prediction features; The normalized exponential function is used to calculate the classification prediction features to obtain the authenticity detection result of the image to be detected.
[0015] The present invention also provides an image authenticity detection device, comprising the following modules: The extraction module is used to perform global context modeling on the image to be detected and extract the global semantic features of the image to be detected; The transformation module is used to perform nonlinear feature expansion transformation on the global semantic features, and to mine the hidden details related to the authenticity of the image in the global semantic features during the nonlinear feature expansion transformation process, so as to obtain the target features that characterize the authenticity of the image. The detection module is used to make classification decisions based on the target features to obtain the authenticity detection result of the image to be detected.
[0016] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the image authenticity detection method as described above.
[0017] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the image authenticity detection method as described above.
[0018] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the image authenticity detection method as described above.
[0019] The image authenticity detection method, apparatus, electronic device, and storage medium provided by this invention extract global semantic features by performing global context modeling on the image to be detected, and deeply mines the implicit details of authenticity information using nonlinear feature expansion transformation. Finally, classification decisions are made based on the optimized target features, achieving high-precision identification of generative images. Because of the introduction of the nonlinear feature expansion transformation process, the defect of general visual encoders that focus too much on semantics and ignore forgery traces can be effectively overcome, thus significantly improving the detection capability of highly realistic forged images in complex scenes and avoiding the problems of missed detections or false alarms caused by insufficient feature representation in traditional methods. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0021] Figure 1 This is a flowchart illustrating the image authenticity detection method provided by the present invention.
[0022] Figure 2This is a schematic diagram of the authenticity detection model provided by the present invention.
[0023] Figure 3 This is a flowchart illustrating the training method for the authenticity detection model provided by this invention.
[0024] Figure 4 This is a flowchart illustrating the training method for the authenticity detection model provided by this invention.
[0025] Figure 5 This is a schematic diagram of the image authenticity detection device provided by the present invention.
[0026] Figure 6 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0027] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0028] With the rapid development of AIGC algorithms such as Generative Adversarial Networks (GANs) and Diffusion Models (DMs), the realism of synthesized images has reached a level that is visually indistinguishable from genuine images, and they are widely used in creative design and other fields. However, this has also brought the risk of rampant fake content, seriously threatening information security. Therefore, AIGC image authenticity detection has become a key technology for ensuring the credibility of digital content. The current detection challenge has evolved from early identification of local texture defects to deep discrimination of global semantic consistency and the rationality of physical laws. Currently, the main approach is to use frozen CLIP models to extract general visual features and perform fake detection through linear classifiers, achieving some progress in cross-model generalization.
[0029] However, the above methods rely entirely on pre-trained CLIP features, while CLIP models mainly focus on the alignment of image semantic content with text, naturally ignoring subtle statistical differences or anomalous patterns that are crucial for distinguishing between true and false images, thus limiting the detection upper limit. Secondly, the above methods rely on static feature spaces, which have weak anti-interference capabilities. When faced with complex post-processing operations such as image compression and noise addition, or adversarial scenarios, the detection performance and stability will significantly decrease. In addition, relying solely on linear classifiers is insufficient to effectively uncover discriminative clues hidden in deep features, resulting in inadequate recognition capabilities for highly realistic generated images.
[0030] To address this, the present invention provides an image authenticity detection method. The method aims to extract global semantic features by performing global context modeling on the image to be detected, and then perform nonlinear feature expansion transformation on these features. In this process, the hidden details related to authenticity are deeply mined, thereby obtaining more discriminative target features for classification decision-making. This achieves high-precision and robust authenticity identification of AIGC-generated images, effectively meeting the detection needs in complex scenarios.
[0031] It should be noted that all actions involving the acquisition of signal information or data in this invention are carried out in compliance with the relevant data protection laws and regulations of the country where the invention is located, and with the authorization granted by the owner of the relevant device.
[0032] in, Figure 1 This is a flowchart illustrating the image authenticity detection method provided by the present invention, as shown below. Figure 1 As shown, the method includes steps 110, 120 and 130.
[0033] Step 110: Perform global context modeling on the image to be detected and extract the global semantic features of the image to be detected.
[0034] Here, the image to be detected typically refers to a digital image that needs to be authenticated. These images may originate from various channels such as the internet, social media, and digital art platforms. They may be real, naturally captured images or generative forgeries synthesized using AIGC algorithms. Due to the development of generative technology, forged images have become very realistic in low-level features such as local textures and edge structures, making it difficult to effectively identify them by relying solely on local features.
[0035] While the generated image may be flawless in local details, subtle inconsistencies may still exist in areas such as the consistency of lighting and shadows in the global structure and the physical interaction logic between objects. Considering that these global contradictions often span multiple local regions of the image and require the capture of long-distance dependencies, this embodiment performs global context modeling on the image to be detected, aiming to capture the long-distance dependencies and overall semantic structure between various regions in the image.
[0036] As an alternative implementation, global context modeling can be achieved through a pre-trained visual representation model. This visual representation model preferably employs an architecture based on a self-attention mechanism, such as the Vision Transformer (ViT). Specifically, the visual representation model can segment the image to be detected into multiple image patches, map these patches to sequential feature vectors, and use the self-attention mechanism to calculate the correlation strength between any two feature vectors in the sequence, thereby aggregating global information to obtain global semantic features.
[0037] In this process, the extracted global semantic features can be understood as a highly compressed and abstract representation of the overall content of the image. In a ViT-based architecture, a specific class token can be introduced to aggregate the global information of the entire image; the output vector corresponding to this class token can then serve as the global semantic feature. For example, if a pre-trained CLIP-ViT-L / 14 model is used as the visual encoder, its output global semantic feature can be a high-dimensional feature with dimensions of 1×1024. This feature not only contains the category semantic information of objects in the image but also implicitly contains the overall structural layout information of the image.
[0038] Step 120: Perform nonlinear feature expansion transformation on the global semantic features, and mine the hidden details related to the authenticity of the image in the global semantic features during the nonlinear feature expansion transformation process to obtain the target features that characterize the authenticity of the image.
[0039] Given that directly extracted global semantic features were originally trained for image-text alignment or image classification tasks, they primarily focus on the content of the image (e.g., "This is a cat"), tending to ignore image style or authenticity flaws, such as "whether there are statistical anomalies in the cat's fur texture." Therefore, directly using these features for classification may lead to limited detection accuracy due to the lack of key discriminative information.
[0040] Based on this, this embodiment performs a nonlinear feature augmentation transformation on the global semantic features, aiming to reconstruct and map the feature space, thereby amplifying those minute signals that are crucial for determining truth or falsehood and suppressing irrelevant semantic interference. The nonlinear feature augmentation transformation can be implemented by constructing a dedicated Feature Augmentation Module (FAM). This transformation process is not merely a change in dimensions; more importantly, it introduces nonlinear factors through a nonlinear activation function, enabling the model to learn more complex feature combinations and discrimination boundaries.
[0041] During the nonlinear feature expansion transformation, the model actively mines the implicit details related to image authenticity hidden in the global semantic features. These details may manifest as abnormal numerical distributions in certain dimensions of the feature vector, or inconsistencies between different semantic levels. For example, through multi-level nonlinear transformations, the model can infer potential physical inconsistencies or texture artifacts from highly abstract semantic features and explicitly express these hidden clues.
[0042] The final target features are the feature vectors generated after the above transformations and mining, specifically used to characterize the authenticity of an image. Compared to the original global semantic features, these target features have better separability in the feature space for authenticity discrimination. For example, after the transformation, the spatial distance between the target feature distribution of the real image and the target feature distribution of the fake image will be further increased.
[0043] Step 130: Make a classification decision based on the target features to obtain the authenticity detection result of the image to be detected.
[0044] After obtaining the target features representing the authenticity of an image, they need to be mapped to the probability space of the true and false categories to make the final judgment. The classification decision process usually involves dimensionality reduction and probability normalization of high-dimensional features.
[0045] As an alternative implementation, classification decisions can be made by constructing a linear classifier. This linear classifier can contain one or more fully connected layers. For example, firstly, a fully connected layer is used to map the high-dimensional target features to an intermediate-dimensional space for further feature integration; then, the output layer maps the features to a binary classification space corresponding to the two categories "true" and "false". Finally, an activation function (such as the Softmax or Sigmoid function) is used to convert the output values into probability values, obtaining the true / false detection result of the image to be detected.
[0046] The result of the authenticity detection can be represented as a confidence score or a probability distribution. For example, the result can be a value between 0 and 1, representing the probability that the image to be detected is a generatively generated fake image. If the probability is greater than a preset threshold (such as 0.5), the image is determined to be a fake image; otherwise, it is determined to be a real image.
[0047] The image authenticity detection method provided in this embodiment extracts global semantic features by performing global context modeling on the image to be detected, and uses nonlinear feature expansion transformation to deeply mine the implicit details of authenticity. Finally, classification decisions are made based on the optimized target features, achieving high-precision identification of generative images. By introducing a nonlinear feature expansion transformation process, the method effectively overcomes the defect of general visual encoders that focus too much on semantics and ignore forgery traces, thus significantly improving the detection capability of highly realistic forged images in complex scenes and avoiding the problems of missed detections or false alarms caused by insufficient feature representation in traditional methods.
[0048] While global semantic features capture the overall structure of an image macroscopically, they often lack crucial local statistical features and high-frequency texture information for authenticity verification at the microscopic level. Simple linear transformations alone are insufficient to effectively recover or reconstruct these discriminative details from highly compressed semantic information. Furthermore, training deep networks often faces problems such as vanishing gradients and feature degradation. Therefore, this embodiment employs a feature expansion module and a specially designed stacked multi-layer residual network structure when processing global semantic features. This structure utilizes multi-level nonlinear convolutional operations to progressively mine deep features, while the residual connection mechanism ensures the effectiveness of feature transfer, promoting the fusion of features from different levels and thus enhancing the model's ability to detect subtle forgery traces.
[0049] Specifically, nonlinear feature expansion transformation is performed on the global semantic features, including: The global semantic features are input into the feature expansion module, and the stacked multi-layer residual network structure in the feature expansion module is used to perform multi-level nonlinear convolution operations and residual fusion processing on the global semantic features.
[0050] Here, the feature extension module is located after the visual representation model and before the classification decision layer, playing a role in feature bridging and enhancement.
[0051] A stacked multilayer residual network structure refers to a network architecture composed of multiple residual units with identical or similar structures, cascaded sequentially. Each residual unit contains two paths: a main path for performing nonlinear transformations and a shortcut path for directly transmitting features. Stacking means that the output of the previous residual unit serves as the input of the next residual unit, progressing layer by layer.
[0052] As an optional embodiment, the feature expansion module can be composed of four stacked residual network units. This depth design enables the network to fit complex feature mapping relationships and transform the features of the semantic space into features of the anti-spoofing space.
[0053] Multi-level nonlinear convolution operations refer to processing input features using convolutional layers combined with nonlinear activation functions within the main path of each residual unit. Convolution operations possess the characteristics of local perception and parameter sharing, and are used to extract local patterns and texture details from features. The introduction of nonlinearity enables the network to learn non-smooth decision boundaries, thereby distinguishing the complex distribution of real images from fake images in the feature space.
[0054] Residual fusion refers to element-wise addition of the features obtained from the main path through nonlinear convolution operations with the features passed from the shortcut path. This mechanism allows the network to learn the residual mapping between input and output, focusing only on the parts of the features that need to be changed or enhanced, while retaining the effective information in the original features. This not only accelerates network convergence but also effectively alleviates the feature degradation problem in deep networks.
[0055] This embodiment employs a stacked multi-layer residual network structure in the feature expansion module to perform multi-level nonlinear convolution operations and residual fusion processing on global semantic features. This effectively extracts hidden forgery clues from highly abstract semantic features. This design leverages the advantages of convolutional networks in extracting local details and residual networks in feature preservation and gradient propagation, significantly improving the model's sensitivity to minor flaws and statistical anomalies, thereby achieving higher accuracy in authenticity verification.
[0056] Considering that traditional residual networks typically perform nonlinear transformations only on the main path, while shortcut paths are usually direct identity mappings, this may limit the flexibility of feature transformations in some cases, especially when the input feature dimension is inconsistent with the desired discriminative feature dimension, or when deeper feature reconstruction is required. To further enhance the expressive power of the feature extension module and enable it to capture more precise clues for true / false discrimination, this embodiment carefully designs the internal structure of the residual unit. It not only employs specific hierarchical combinations in the nonlinear branches but also introduces transformation operations in the residual connection branches, thereby constructing a dual-branch parallel feature processing mechanism.
[0057] Specifically, the stacked multilayer residual network structure includes multiple cascaded residual units. Each residual unit includes a nonlinear branch consisting of a first convolutional layer, a batch normalization layer, an activation layer, and a second convolutional layer connected in sequence, and a residual connection branch consisting of a third convolutional layer, a batch normalization layer, and an activation layer connected in sequence. The nonlinear branch is used to perform nonlinear transformation on the input features, the residual connection branch is used to transform the input features, and the output feature of each residual unit is obtained by fusing the output features of the corresponding nonlinear branch and the output features of the corresponding residual connection branch.
[0058] Here, the nonlinear branch is the core part of the residual unit responsible for feature mining and nonlinear mapping. The first and second convolutional layers typically employ one-dimensional or two-dimensional convolutional structures to extract local correlation information and adjust feature dimensions in the feature space. Batch normalization layers are used to standardize the outputs of the convolutional layers, mitigating internal covariate shift issues, accelerating network training convergence, and improving the model's generalization ability. Activation layers introduce nonlinear factors, enabling the network to fit complex functional relationships.
[0059] As an optional implementation, the nonlinear branch is constructed as follows: First, the input features undergo preliminary transformation through the first convolutional layer; then, they are normalized by the batch normalization layer; subsequently, nonlinear mapping is performed through the activation layer; finally, the features are integrated again through the second convolutional layer. This "convolution-normalization-activation-convolution" structural design can effectively increase the depth and nonlinearity of the network while maintaining the stability of feature propagation, thereby extracting more discriminative features.
[0060] The residual connection branch is a parallel path relative to the nonlinear branch. Unlike traditional direct addition, this embodiment also introduces convolution and normalization operations into the residual connection branch. This is mainly to appropriately transform and adapt the original feature information while preserving it, so as to better fuse it with the output of the nonlinear branch.
[0061] As an optional implementation, the residual connection branch is constructed as follows: the input features undergo a linear transformation through a third convolutional layer; subsequently, they are standardized through a batch normalization layer; and finally, nonlinear processing is performed through an activation layer. This design enables the residual connection branch itself to possess a certain feature extraction capability, no longer merely passively transmitting information, but actively participating in the feature reconstruction process.
[0062] Finally, the output features of each residual unit are obtained by fusing the output features of the corresponding nonlinear branch and the output features of the corresponding residual connection branch. This fusion is usually done by adding elements one by one. Through this dual-branch fusion mechanism, the model can simultaneously utilize the nonlinear features mined from deep layers and the adapted shallow features, thereby constructing a richer and more robust representation in the feature space.
[0063] This embodiment designs a residual unit with a dual-branch structure, employing specific combinations of convolution, normalization, and activation layers in both the nonlinear branch and the residual connection branch. This allows for more flexible and in-depth transformation and reconstruction of global semantic features. This structural design effectively enhances the nonlinear expressive power of the feature expansion module, enabling the model to capture hidden forgery traces that are difficult to detect with a single branch, thereby significantly improving the accuracy of image authenticity detection.
[0064] Considering that in real-world applications, images to be detected often experience various forms of transmission loss (such as compression and noise), training the model solely on clean, standard image data can lead to overfitting and insufficient robustness in complex scenarios. To improve the model's generalization ability and defense against adversarial attacks in open environments, this embodiment introduces a systematic data augmentation strategy before feature extraction, aiming to simulate various image distortion scenarios that may occur in the real world.
[0065] Specifically, before performing global context modeling on the image to be detected, the following steps are also included: Obtain the original image of the image to be detected, and perform basic geometric transformations on the original image; Randomly select at least two basic enhancement categories from a set of preset basic enhancement categories; Based on the priority of the extracted basic enhancement categories, the image processing algorithms corresponding to each basic enhancement category are used sequentially to process the original image after basic geometric transformation to obtain the image to be detected.
[0066] Specifically, the original image refers to a training sample image that has not undergone the specific enhancement processing described in this embodiment; it can be a real photographic image or a generated forged image. Basic geometric transformations refer to operations that alter the spatial distribution of the original image without changing its essential content. These operations force the model to learn spatially invariant features, reducing its dependence on specific locations or orientations within the image.
[0067] As an optional embodiment, the basic geometric transformation may include random cropping and scaling, horizontal flipping, and random rotation. For example, the original image of the image to be detected may be horizontally flipped with a certain probability (e.g., 0.5), or the image may be randomly rotated within a certain angle range (e.g., -30 degrees to 30 degrees).
[0068] The basic augmentation categories refer to the types of operations that can simulate image quality degradation or combat interference. Randomly selecting at least two basic augmentation categories means that the combination of image distortions seen by the model varies randomly each time it is trained. This high degree of diversity can effectively prevent the model from memorizing specific noise patterns and force it to learn the essential features of image authenticity.
[0069] The preset basic enhancement categories can include data enhancement, spatial geometry, image attribute, blur and compression, and noise. Spatial geometry includes random cropping and scaling, horizontal flipping, and random rotation. Image attribute includes brightness adjustment, sharpness adjustment, contrast adjustment, and color enhancement. Blur and compression includes motion blur, Gaussian blur, median filtering, mean filtering, JPEG compression, AVIF compression, and pixelation. Noise includes Gaussian noise and salt-and-pepper noise.
[0070] Processing based on the priority of the extracted base enhancement categories means that different types of transformation operations need to follow a specific order when superimposed to simulate realistic physical processes or maximize the enhancement effect. This is especially important considering that some operations may negate the effects of others; for example, blurring may eliminate artifact details added by noise processing. Therefore, a proper order is crucial.
[0071] As an optional implementation, the original image can first undergo basic geometric transformations; then, two categories are randomly selected from the aforementioned basic enhancement categories; next, a specific image processing algorithm is randomly selected from each selected category, such as Gaussian blur or JPEG compression in the blur and compression category; finally, the selected algorithms are applied to the image sequentially according to a preset priority. For example, if brightness adjustment (attribute category) and Gaussian noise (noise category) are selected, the brightness is adjusted first, then noise is added, ultimately obtaining the image to be detected for model input.
[0072] This embodiment introduces a data augmentation strategy that includes basic geometric transformations and randomly combined adversarial transformations, executed strictly in priority order, enabling the generation of highly diverse and challenging training samples. This strategy not only simulates various degradation phenomena of images during network transmission and storage but also constructs complex adversarial scenarios, thereby significantly improving the robustness and stability of the image authenticity detection model in the face of interference such as compression, blurring, and noise.
[0073] Considering the potential for interference or overlap between different image enhancement operations, especially blurring operations (such as Gaussian blur and mean filtering) which smooth high-frequency information in images, and noise reduction operations (such as Gaussian noise and salt-and-pepper noise) which primarily introduce high-frequency random perturbations into images, adding noise before blurring can easily smooth out or significantly weaken the newly added noise. This results in training samples that fail to accurately reflect the characteristics of noisy images, thus reducing the effectiveness of data augmentation. To ensure the model can fully learn discriminative features under various adverse conditions, a scientific enhancement sequence needs to be established.
[0074] Specifically, according to the priority of the extracted basic enhancement categories, the image processing algorithms corresponding to each basic enhancement category are used sequentially to process the original image after the basic geometric transformation, including: If the extracted base enhancement category includes a noise class, set the noise class to the lowest priority.
[0075] Specifically, the noise class simulates sensor thermal noise or transmission channel noise. Setting the noise class as the lowest priority means that regardless of which combination of enhancement categories is randomly selected, as long as it includes the noise class, the noise addition operation will always be executed last among all enhancement steps. For example, if the "blur and compression" class and the "noise" class are randomly selected, the blurring algorithm (such as Gaussian blur) will be forced to be executed first, and then the noise addition algorithm (such as Gaussian noise) will be executed.
[0076] As an alternative implementation, the image can first undergo spatial geometric transformation, followed by examining randomly selected category combinations. If the combination is "image attribute adjustment" and "noise," the image attributes are adjusted first, and then noise is added; if the combination is "blurring and compression" and "noise," blurring or compression is performed first, and then noise is added. This strategy ensures that noise features are preserved in the final input image, simulating real-world scenarios such as "various processing steps followed by superimposed transmission noise" or "noise superimposed on low-quality images."
[0077] This embodiment effectively avoids the unintended suppression of noise features by operations such as blurring by clearly defining the lowest priority of noise classes in the data augmentation process, and ensures the significance of noise components in the training samples. This allows the model to encounter truly challenging noisy samples during the training process, thereby significantly improving the model's detection robustness when facing noisy and low-quality images in the real world.
[0078] Training a high-performance deep learning model from scratch requires massive amounts of data and computing power, and is prone to getting stuck in local optima. While using pre-trained models (such as CLIP) for transfer learning is an effective way to address this issue, directly fine-tuning the entire pre-trained model can easily destroy the general visual knowledge learned on large-scale datasets, resulting in catastrophic forgetting. Conversely, completely freezing the pre-trained model and training only subsequent classifiers is limited by the inherent distribution of pre-trained features, making it difficult to adapt to the feature requirements of image forgery detection, a specific task. To find the optimal balance between preserving general capabilities and adapting to specific tasks, this embodiment proposes a refined fine-tuning strategy.
[0079] Specifically, global context modeling is performed on the image to be detected to extract global semantic features; nonlinear feature expansion transformation is applied to the global semantic features, and during the nonlinear feature expansion transformation process, hidden details related to the authenticity of the image are mined from the global semantic features to obtain target features characterizing the authenticity attribute of the image; classification decision is made based on the target features to obtain the authenticity detection result of the image to be detected, including: Using a authenticity detection model, global context modeling is performed on the image to be detected, global semantic features of the image to be detected are extracted, nonlinear feature expansion transformation is performed on the global semantic features, and in the process of nonlinear feature expansion transformation, the hidden details related to the authenticity of the image are mined in the global semantic features. After obtaining the target features that characterize the authenticity of the image, classification decision is made based on the target features to obtain the authenticity detection result of the image to be detected. The authenticity detection model is built on a pre-trained visual representation model. It is obtained by freezing the network parameters of the visual representation model except for the first fully connected layer of the multilayer perceptron unit of the encoder module, and only fine-tuning the parameters of the first fully connected layer and the network module parameters used to perform nonlinear feature expansion transformation and classification decision.
[0080] Specifically, the authenticity detection model is an end-to-end deep learning network constructed in this embodiment, the backbone of which is a pre-trained visual representation model. Freezing parameters means that during the backpropagation process of training, the weights of these parameters are not updated, and their initial state remains unchanged.
[0081] Visual representation models typically consist of multiple stacked encoder blocks. Each encoder block usually contains a multi-head self-attention (MSA) unit and a multi-layer perceptron (MLP) unit. The MLP unit typically consists of two fully connected layers and an intermediate activation function. The first fully connected layer is mainly responsible for projecting features into a higher-dimensional space, performing non-linear feature transformations and enhancements.
[0082] The core of the fine-tuning strategy in this embodiment lies in freezing the network parameters in the visual representation model, except for the first fully connected layer of the multilayer perceptron unit in the encoder module. These frozen parts preserve the model's basic cognitive ability regarding image edges, shapes, textures, and long-range semantic dependencies.
[0083] The reason for only fine-tuning the first fully connected layer is that this layer plays a crucial role in feature dimensionality enhancement and initial transformation in MLP. By adjusting the parameters of this layer, the mapping direction of the feature space can be subtly adjusted without changing the overall semantic understanding architecture of the model, making it more sensitive to statistical features related to true / false status, rather than just focusing on category semantics. Meanwhile, the network module parameters used to perform nonlinear feature expansion transformation and classification decisions are newly initialized. In order for them to accurately extract discriminative information from the extracted features and map it to the correct true / false class probabilities, they need to participate in training to learn the discrimination logic of the false-detection task.
[0084] As an alternative implementation, during training, the input image is data-augmented before being fed into the model. During forward propagation, the parameters of the frozen layer are used in the calculation, but the gradients are not backpropagated. Only the parameters of the first fully connected layer of the MLP, the feature expansion module for performing nonlinear feature expansion transformation, and the linear classifier for performing classification decisions are updated according to the gradient of the loss function. This strategy enables the model to converge quickly and achieve excellent performance even with relatively little training data.
[0085] This embodiment utilizes the powerful general visual representation capabilities of the pre-trained model through this specific fine-tuning strategy, while also endowing the model with specific perceptual capabilities for the anti-spoofing task by fine-tuning the key nonlinear transformation layer. This not only significantly reduces training costs but also effectively avoids overfitting and significantly improves the model's generalization performance in open scenarios.
[0086] Considering that image authenticity detection tasks often face two thorny issues: first, the number of positive and negative samples in the training data is often unbalanced, which causes the model to tend to predict the majority class, thus affecting the recognition accuracy of the minority class; second, the model often exhibits "overconfidence" in the later stages of training, that is, giving extremely high confidence scores (such as 0.999) to the prediction results, which weakens the model's generalization ability and makes it perform poorly when facing test data with unknown distributions. To solve these two problems, this embodiment introduces smoothed labeling and class weighting (Class strategy) when calculating the training loss.
[0087] Specifically, the steps for determining the training loss of the authenticity detection model include: Obtain the predicted probability distribution of the authenticity detection model output for the training samples; The original labels of the training samples are converted into a target probability distribution. The probability values of the training samples belonging to the target category are set to preset values less than 1, and the probability values of the training samples belonging to non-target categories are set to preset values greater than 0. Determine the proportion of the target class to which the training sample belongs among all training samples, and determine the loss weight of the training sample based on the proportion. The training loss is calculated based on the predicted probability distribution, the target probability distribution, and the loss weights.
[0088] Specifically, the predicted probability distribution is a vector output from the last layer of the model, representing the predicted probability that a sample belongs to each category. The original labels are usually hard labels, such as [1, 0] for true and [0, 1] for false.
[0089] The target probability distribution is a smoothed soft label. Setting the probability value of the target class corresponding to the training sample to a preset value less than 1 (e.g., 0.9), and the probability value of the non-target class to a preset value greater than 0 (e.g., 0.1), effectively tells the model, "Although this sample is a real image, don't be too absolute; leave a small possibility that it's fake." This strategy regularizes the model, preventing overfitting on the training data and thus improving its generalization ability on blurry or difficult samples.
[0090] Loss weights are designed to address class imbalance. The proportion of the target class to which a training sample belongs among all training samples is determined, and the loss weight for each training sample is determined based on this proportion. Typically, this weight is inversely proportional to the proportion. That is, if a certain class of samples (fewer samples) is represented, it is given a larger weight when calculating the loss, forcing the model to pay more attention to these less easily identified minority samples.
[0091] As an optional implementation, assume the predicted probability distribution output by the model is P=[p0, p1], where p0 represents the probability of predicting a real image and p1 represents the probability of predicting a fake image. If the original label of the current training sample is "true" (corresponding to category 0), and the smoothing parameter is set to 0.1, then the target probability distribution is transformed into Y=[0.9, 0.1].
[0092] Furthermore, assume that in all training samples, the proportion of real images is R, and the proportion of fake images is 1-R. To balance the influence of categories, a loss weight W can be assigned to the real image category, which is inversely proportional to R, such as W=1 / R.
[0093] In this way, during backpropagation, the model is subject to the dual constraints of the smoothed target probability Y and the class weights W, thereby learning a more robust and balanced feature representation. This embodiment combines smoothed labels and weighted loss calculation strategies. On the one hand, soft labels suppress the model's overconfidence and enhance generalization; on the other hand, inverse weights balance class contributions, ensuring that the model does not ignore minority class samples. This dual optimization strategy significantly improves the model's detection performance in real-world complex scenarios, especially when facing unevenly distributed and ambiguous samples.
[0094] As an optional implementation, the training loss can be calculated by weighted cross-entropy. Specifically, firstly, the product of the logarithm of the predicted probability of each class in the predicted probability distribution and the target probability of the corresponding class in the target probability distribution is calculated. Then, these products are added together to obtain the basic cross-entropy value, which reflects the difference between the predicted distribution and the target distribution. Finally, the basic cross-entropy value is weighted using predetermined loss weights to obtain the final training loss used to guide the update of model parameters.
[0095] Considering the high randomness of parameters in the early stages of deep learning model training, directly using a large learning rate for updates can easily lead to drastic gradient fluctuations, making it difficult for the model to converge or even diverge. In the mid-to-late stages of training, to ensure the model can approximate the optimal solution more precisely, the learning rate needs to be gradually reduced. To achieve a balance between training stability and convergence accuracy, this embodiment employs a preheating cosine annealing learning rate scheduling strategy during fine-tuning training.
[0096] Specifically, the fine-tuning training process also includes: In the first phase, where the number of training rounds is less than the number of warm-up rounds, the learning rate is controlled to increase linearly from the initial value to the preset initial learning rate value. In the second phase, where the number of training rounds is greater than or equal to the number of warm-up rounds, the learning rate is controlled to decrease according to the cosine function law starting from the initial learning rate value as the number of training rounds increases.
[0097] Specifically, the first stage can be understood as the learning rate warm-up stage. The preset initial learning rate value is a pre-set baseline learning rate, such as 3e-5. The warm-up rounds refer to the number of training rounds that continue during the warm-up stage, such as the first 5 training rounds.
[0098] In this stage, the learning rate is not set directly as a baseline value, but starts from a minimum value and increases linearly with the number of training steps. This strategy gives the model an adaptation period, allowing it to make gentle parameter adjustments when faced with entirely new data distributions (such as data-augmented fake images), avoiding the destruction of the good feature representations already present in the pre-trained model due to excessive gradients.
[0099] As an optional implementation, assume the initial value is 0, the initial learning rate is lr, and the warm-up epochs are 5. In the first training epoch, the learning rate may be set to 0.2×lr; in the second training epoch, it may be set to 0.4×lr, and so on, until lr is reached in the fifth training epoch.
[0100] The second stage can be understood as the cosine annealing stage. After the number of training epochs exceeds the number of warm-up epochs, the learning rate no longer remains constant or decreases in a stepwise manner, but instead decays smoothly following the curve of the cosine function. The characteristics of the cosine function cause the learning rate to decrease slowly in the early stages of decay, maintaining high learning efficiency; decrease more rapidly in the middle stages of decay; and slow down again in the later stages of decay, approaching a minimum value. This decay method allows the model to adjust parameters more finely in the later stages of training, helping the model escape local minima and converge to a flatter region of loss function troughs.
[0101] As an alternative implementation, assume a total of 20 training rounds and 5 warm-up rounds. Starting from the 6th training round, the learning rate will gradually decrease from lr according to a cosine curve until it approaches 0 at the end of the 20th training round.
[0102] This embodiment combines preheating and cosine annealing strategies to dynamically and finely control the learning rate during fine-tuning. Initially, a linear increase prevents training instability, while cosine decay ensures convergence accuracy in the later stages. This strategy significantly improves the stability of the true / false detection model during fine-tuning and helps the model ultimately achieve higher detection accuracy.
[0103] Considering that deep learning models, when extracting features, not only need to capture long-distance dependencies between different locations in an image, but also need to perform non-linear transformations and combinations on these features to obtain higher-level semantic representations, visual representation models adopt a standard Transformer-based architecture to meet this requirement. This architecture deepens the understanding of image content by stacking multiple fully functional encoder modules.
[0104] Specifically, the visual representation model contains stacked encoder modules, each of which consists of multi-head attention units and multi-layer perceptron units connected in sequence.
[0105] Here, stacked encoder modules mean that multiple modules with the same structure are connected in series, with the output of one module serving as the input of the next. For example, the CLIP-ViT-L / 14 model typically contains 24 encoder layers. This deep stacking structure allows the model to have a large parameter capacity and strong fitting ability.
[0106] The multi-head attention unit is the first core component in the encoder module. It uses a self-attention mechanism to calculate the association weights between each element in the input sequence and all other elements, thereby aggregating global information. "Multi-head" refers to the model running multiple attention mechanisms in parallel, each focusing on a different subspace of features—for example, one head focusing on shape, another on texture—and finally concatenating the results, enabling the model to capture global contextual information of the image from multiple dimensions.
[0107] The multilayer perceptron unit, located after the multi-head attention unit, is the second core component of the encoder module. It typically consists of two fully connected layers and an intermediate activation function. The role of the multilayer perceptron unit is to perform pointwise nonlinear transformations and feature enhancements on the features aggregated by the multi-head attention unit, thereby increasing the model's nonlinear expressive power.
[0108] The sequential connection structure means that within each encoder module, the data stream first passes through a multi-head attention unit to extract global dependencies; its output then passes through a multi-layer perceptron unit for feature transformation. Typically, layer normalization and residual connections are used before or after these two units to ensure training stability.
[0109] As an optional embodiment, the processing flow of each encoder module can be described as follows: the input features are first normalized by layers and then enter the multi-head attention unit; the output of the multi-head attention unit is added to the input features by residual addition; the result after addition is normalized by layers again and enters the multilayer perceptron unit; the output of the multilayer perceptron unit is added to the previous features by residual addition again, which is the final output of the encoder module.
[0110] This embodiment constructs a powerful visual representation model by employing a stacked encoder module composed of multi-head attention units and multi-layer perceptron units connected sequentially. The multi-head attention units are responsible for capturing global contextual relationships, solving the problem of limited receptive fields in traditional convolutional networks, while the multi-layer perceptron units are responsible for deep nonlinear feature mining. The combination of the two enables the model to generate feature representations rich in global semantics and high-level abstract information.
[0111] Figure 2 This is a schematic diagram of the authenticity detection model provided by the present invention, as shown below. Figure 2 As shown, the authenticity detection model includes a visual representation model, a feature expansion module, and a linear classifier. The workflow of the authenticity detection model is as follows: First, the image to be detected is input into a visual representation model, which includes a patch embedding layer to divide the image into fixed-size patches and map them to vectors. This is then processed by an encoder module consisting of n layers (e.g., 24 layers), each composed of a multi-head attention unit and a multi-layer perceptron unit connected sequentially. During this process, the model utilizes a self-attention mechanism to model the global context and extract highly compressed global semantic features. The patch embedding layer can be a convolutional structure with a kernel size of 14×14 and a stride of 14, primarily used to divide the image into 36×36 patch blocks.
[0112] Then, the extracted global semantic features are input into the feature expansion module. This module adopts a stacked multi-layer residual network structure, and performs non-linear feature expansion transformation on the global semantic features through multi-level non-linear convolution operations and residual fusion processing. This aims to suppress interference from irrelevant semantic information and deeply mine the discriminative details hidden in the features that are highly correlated with the authenticity of the image, thereby obtaining the enhanced target features.
[0113] Next, the obtained target features are fed into a linear classifier. This classifier consists of cascaded first fully connected layers and last fully connected layers. The target features are first mapped to an intermediate dimensional space through the first fully connected layer for feature integration, and then mapped to a binary classification space through the last fully connected layer.
[0114] Finally, the binary classification results are normalized using the Softmax activation function, and the probability of the detected image being "true" or "false" is output, which is the true / false detection result.
[0115] Considering that although the target features have been mined and enhanced by the feature expansion module and contain rich information for distinguishing between true and false, their dimensionality is usually high, and direct use for classification may result in feature redundancy or insufficient nonlinear expression. In order to smoothly and accurately map high-dimensional features to the probability space of binary classification, this embodiment designs a step-by-step mapping classification decision mechanism. By introducing an intermediate layer and normalization processing, features are gradually refined and confidence scores are output.
[0116] Specifically, classification decisions are made based on target features to obtain the authenticity detection results of the image to be detected, including: The target features are mapped to the intermediate dimension space to obtain the intermediate dimension features; The intermediate dimension features are mapped to the binary classification space to obtain the classification prediction features; The normalized exponential function is used to calculate the classification prediction features to obtain the authenticity detection results of the image to be detected.
[0117] Specifically, the intermediate-dimensional space is a transitional space between the high-dimensional feature space and the low-dimensional classification space. Mapping target features to the intermediate-dimensional space aims to reduce or reorganize the features, remove redundant information, and increase the expressive power of the model through possible non-linear activations.
[0118] As an alternative implementation, this can be achieved using the first fully connected layer in a linear classifier. Assuming the target feature dimension is 1024, the number of output nodes in the first fully connected layer can be set to 1280, meaning the intermediate dimension is 1280. The input target feature is multiplied by the weight matrix of this layer and a bias is added to obtain the intermediate dimension feature.
[0119] A binary classification space refers to a feature space with a dimension of 2, corresponding to the two categories "true" and "false" in image authentication tasks. Mapping intermediate-dimensional features to the binary classification space is a key step in classification decision-making, as it transforms abstract feature representations into category scores directly related to the final task.
[0120] As an alternative implementation, this can be achieved using the final fully connected layer in a linear classifier. The number of input nodes in this layer corresponds to the intermediate dimension (e.g., 1280), and the number of output nodes is strictly set to 2. The intermediate dimension features undergo a linear transformation by this layer, outputting a vector containing two values, which are the classification prediction features. These two values represent the model's original scores for whether the image belongs to the "true" or "false" class, and their values typically range from negative infinity to positive infinity.
[0121] The normalized exponential function calculation is a standard operation for converting raw scores into a probability distribution. The original classification prediction features have varying numerical values, making them difficult to use directly as confidence scores. The normalized exponential function maps these two values to the (0, 1) interval, ensuring that their sum is 1.
[0122] This embodiment constructs a cascaded structure containing an intermediate mapping layer and a final classification layer, and combines this with normalized exponential function calculations to progressively transform complex discriminative features into intuitive and interpretable probability outputs. The introduction of intermediate layers increases the depth of the classifier, enabling it to handle more complex feature relationships, while the normalized exponential function ensures that the output results conform to probability axioms, facilitating subsequent threshold setting for binary judgment, thereby achieving accurate and reliable image authenticity identification.
[0123] Figure 3 This is a flowchart illustrating the authenticity detection model training method provided by the present invention, as shown below. Figure 3 As shown, firstly, a training set is constructed, which collects sample data containing real images and AIGC-generated images, and assigns corresponding real and fake labels to each sample.
[0124] Then, a combined data augmentation strategy is applied to the training samples. This strategy generates diverse augmented samples by randomly combining spatial geometric transformations (such as flipping and rotating), image attribute adjustments, blurring and compression, and noise addition. In the case of noisy classes, they are set to the lowest priority to improve the robustness of the model to complex scenes.
[0125] Next, the enhanced samples are input into the CLIP-ViT visual representation model for feature extraction. During this process, most network parameters are frozen, and global semantic features are extracted using the model's inherent global context awareness capability, retaining only the basic visual information highly relevant to the anti-spoofing task.
[0126] Subsequently, the extracted global semantic features are input into the feature expansion module. Through nonlinear feature expansion transformation, implicit discriminative details are extracted from the global semantic features to obtain the target features. Next, a linear classifier is used to determine authenticity based on the template features, outputting a predicted probability distribution.
[0127] Next, the loss is calculated in conjunction with the sample labels. Smoothing labels are used to transform hard labels into a probability distribution, and weighted cross-entropy loss is calculated using weights inversely proportional to the sample proportion to address the issues of overconfidence and class imbalance.
[0128] Finally, the model is fine-tuned based on the calculated loss. A preheating cosine annealing strategy is used to adjust the learning rate, and backpropagation is used to update only the parameters of the first fully connected layer of the encoder module MLP unit, the feature expansion module, and the linear classifier in the visual representation model, achieving rapid model adaptation and optimization.
[0129] Figure 4 This is a flowchart illustrating the authenticity detection model training method provided by the present invention, as shown below. Figure 4 As shown, firstly, the test image to be detected is acquired. Then, basic data augmentation processing (such as simple resizing or normalization) is performed on the test image to adapt it to the model's input requirements. Next, the trained CLIP-ViT visual representation model is used to extract features from the test image to obtain global semantic features. Subsequently, the features are non-linearly expanded using a trained feature expansion module to uncover discriminative details and obtain the target features. Finally, a trained linear classifier is used to distinguish between true and false detections, outputting the final true / false detection result. This result is compared with the test image label to determine the model's accuracy, recall, F1 score, and other performance metrics to evaluate the model's generalization ability on unseen samples.
[0130] The image authenticity detection device provided by the present invention is described below. The image authenticity detection device described below can be referred to in correspondence with the image authenticity detection method described above.
[0131] Based on any of the above embodiments Figure 5 This is a schematic diagram of the image authenticity detection device provided by the present invention, as shown below. Figure 5 As shown, the device includes: The extraction module 510 is used to perform global context modeling on the image to be detected and extract the global semantic features of the image to be detected. The transformation module 520 is used to perform nonlinear feature expansion transformation on the global semantic features, and to mine the hidden details related to the authenticity of the image in the global semantic features during the nonlinear feature expansion transformation process, so as to obtain the target features that characterize the authenticity of the image. The detection module 530 is used to make classification decisions based on target features to obtain the authenticity detection results of the image to be detected.
[0132] Figure 6 This is a schematic diagram of the structure of the electronic device provided by the present invention, such as... Figure 6As shown, the electronic device may include a processor 610, a communications interface 620, a memory 630, and a communication bus 640. The processor 610, communications interface 620, and memory 630 communicate with each other via the communication bus 640. The processor 610 can call logical instructions from the memory 630 to execute an image authenticity detection method.
[0133] Furthermore, the logical instructions in the aforementioned memory 630 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0134] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer is able to execute the image authenticity detection methods provided by the above methods.
[0135] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the image authenticity detection methods provided by the methods described above.
[0136] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0137] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0138] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for detecting the authenticity of an image, characterized in that, include: Global context modeling is performed on the image to be detected, and global semantic features of the image to be detected are extracted; The global semantic features are subjected to nonlinear feature expansion transformation, and during the nonlinear feature expansion transformation process, the hidden details related to the authenticity of the image in the global semantic features are mined to obtain the target features characterizing the authenticity of the image. Based on the target features, a classification decision is made to obtain the authenticity detection result of the image to be detected.
2. The image authenticity detection method according to claim 1, characterized in that, The nonlinear feature expansion transformation of the global semantic features includes: The global semantic features are input into the feature expansion module, and the stacked multi-layer residual network structure in the feature expansion module is used to perform multi-level nonlinear convolution operations and residual fusion processing on the global semantic features.
3. The image authenticity detection method according to claim 2, characterized in that, The stacked multilayer residual network structure includes multiple cascaded residual units. Each residual unit includes a nonlinear branch consisting of a first convolutional layer, a batch normalization layer, an activation layer, and a second convolutional layer connected in sequence, and a residual connection branch consisting of a third convolutional layer, a batch normalization layer, and an activation layer connected in sequence. The nonlinear branch is used to perform nonlinear transformation on the input features, the residual connection branch is used to transform the input features, and the output feature of each residual unit is obtained by fusing the output features of the corresponding nonlinear branch and the output features of the corresponding residual connection branch.
4. The image authenticity detection method according to any one of claims 1 to 3, characterized in that, Before performing global context modeling on the image to be detected, the following is also included: Obtain the original image of the image to be detected, and perform basic geometric transformations on the original image; Randomly select at least two basic enhancement categories from a set of preset basic enhancement categories; According to the priority of the extracted basic enhancement categories, the image processing algorithms corresponding to each basic enhancement category are used sequentially to process the original image after basic geometric transformation to obtain the image to be detected.
5. The image authenticity detection method according to claim 4, characterized in that, The process involves sequentially processing the original image after basic geometric transformation using the image processing algorithms corresponding to each basic enhancement category, according to the priority of the extracted basic enhancement categories. This includes: If the noise class is included in the extracted base enhancement category, the noise class is set to the lowest priority.
6. The image authenticity detection method according to any one of claims 1 to 3, characterized in that, The process involves performing global context modeling on the image to be detected and extracting global semantic features from the image to be detected. The global semantic features are subjected to nonlinear feature expansion transformation, and during the nonlinear feature expansion transformation process, the hidden details related to the authenticity of the image in the global semantic features are mined to obtain the target features characterizing the authenticity of the image. Based on the target features, a classification decision is made to obtain the authenticity detection result of the image to be detected, including: Using a authenticity detection model, global context modeling is performed on the image to be detected, global semantic features of the image to be detected are extracted, nonlinear feature expansion transformation is performed on the global semantic features, and in the process of nonlinear feature expansion transformation, the hidden details related to the authenticity of the image are mined in the global semantic features. After obtaining the target features that characterize the authenticity of the image, a classification decision is made based on the target features to obtain the authenticity detection result of the image to be detected. The authenticity detection model is constructed based on a pre-trained visual representation model. It is obtained by freezing the network parameters of the visual representation model except for the first fully connected layer of the multilayer perceptron unit of the encoder module, and only fine-tuning the parameters of the first fully connected layer and the network module parameters used to perform the nonlinear feature expansion transformation and the classification decision.
7. The image authenticity detection method according to claim 6, characterized in that, The steps for determining the training loss of the authenticity detection model include: Obtain the predicted probability distribution of the authenticity detection model output for the training samples; The original labels of the training samples are converted into a target probability distribution, wherein the probability value corresponding to the target category to which the training sample belongs is set to a preset value less than 1, and the probability value corresponding to the non-target category is set to a preset value greater than 0. Determine the proportion of the target category to which the training sample belongs in all training samples, and determine the loss weight of the training sample based on the proportion. The training loss is calculated based on the predicted probability distribution, the target probability distribution, and the loss weights.
8. The image authenticity detection method according to claim 6, characterized in that, The fine-tuning training process also includes: In the first phase, where the number of training rounds is less than the number of warm-up rounds, the learning rate is controlled to increase linearly from the initial value to the preset initial learning rate value. In the second stage, where the number of training rounds is greater than or equal to the number of warm-up rounds, the learning rate is controlled to decrease according to the cosine function law starting from the initial learning rate value as the number of training rounds increases.
9. The image authenticity detection method according to claim 6, characterized in that, The visual representation model includes stacked encoder modules, each of which is composed of multi-head attention units and multi-layer perceptron units connected in sequence.
10. The image authenticity detection method according to any one of claims 1 to 3, characterized in that, The step of making a classification decision based on the target features to obtain the authenticity detection result of the image to be detected includes: The target features are mapped to an intermediate dimension space to obtain intermediate dimension features; The intermediate dimension features are mapped to a binary classification space to obtain classification prediction features; The normalized exponential function is used to calculate the classification prediction features to obtain the authenticity detection result of the image to be detected.
11. An image authenticity detection device, characterized in that, include: The extraction module is used to perform global context modeling on the image to be detected and extract the global semantic features of the image to be detected; The transformation module is used to perform nonlinear feature expansion transformation on the global semantic features, and to mine the hidden details related to the authenticity of the image in the global semantic features during the nonlinear feature expansion transformation process, so as to obtain the target features that characterize the authenticity of the image. The detection module is used to make classification decisions based on the target features to obtain the authenticity detection result of the image to be detected.
12. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the image authenticity detection method as described in any one of claims 1 to 10.
13. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the image authenticity detection method as described in any one of claims 1 to 10.