Image Tampering Detection Method Based on Shallow Feature Enhancement and Attention Mechanism

By constructing an image tamper detection method based on shallow feature enhancement and attention mechanism, combined with improved ResNet-50 and DANet, the problems of generalized detection effects and poor generalization performance in the prior art are solved, pixel-level tamper detection and positioning are realized, and the detection effect and generalization ability of the model are improved.

CN115357944BActive Publication Date: 2025-08-01HENAN UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210980922.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-16
Publication Date
2025-08-01
Estimated Expiration
2042-08-16

AI Technical Summary

Technical Problem

The existing deep learning-based image tamper detection method has average effect and poor generalization performance, making it difficult to effectively capture tamper traces and realize pixel-level tampering area positioning.

Method used

A image tamper detection method based on shallow feature enhancement and attention mechanism is constructed, and an improved ResNet-50 backbone network and improved DANet are used to realize feature fusion and screening through the combination of feature extraction, feature enhancement and attention modules, and a specific loss function is used for training.

Benefits of technology

The pixel-level tamper detection and positioning are realized, the problem of loss of local details in the existing methods is improved, and the detection effect and generalization ability of the model are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115357944B_ABST
    Figure CN115357944B_ABST
Patent Text Reader

Abstract

The present invention provides an image forgery detection method based on shallow feature enhancement and attention mechanism. The method includes: Step 1: Construct a forgery image dataset and divide it into a training set and a test set; Step 2: Set a loss function, and based on the loss function, use the training set to train the constructed image forgery detection network to obtain an optimal image forgery detection network model; Step 3: Use the optimal image forgery detection network model to detect the forgery images in the test set; wherein, the image forgery detection network includes: a feature extractor, a feature enhancement module, and an attention module; the shallow features and deep features of the input image are extracted by the feature extractor, the extracted shallow features are reconstructed by the feature enhancement module, and the reconstructed features are fused with the deep features, and the fused features are screened by the attention module. The present invention has a network structure that can effectively capture forgery traces and realizes pixel-level forgery area positioning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image tampering detection in computer vision, and in particular to an image tampering detection method based on shallow feature enhancement and attention mechanism. Background Art

[0002] With the rapid development of information technology and the widespread use of digital products, multimedia, represented by images and videos, has become an important medium for information exchange in our daily lives. However, with the widespread use of image editing tools, it has become increasingly easy to create manipulated images that are difficult for the human eye to detect. These images are not only used for entertainment but are also increasingly appearing in false news, academic papers, and criminal cases. The authenticity of digital images is increasingly uncertain, which will seriously affect public perceptions and pose a significant threat to people's daily lives, social security, and even national security.

[0003] Image tampering methods are generally divided into three categories: splicing, copying and pasting, and deletion. Splicing is pasting part of the content of one image onto another, copying and pasting is pasting part of the content of the original image onto another area, and deletion is removing part of the content of an image and then completing the image with surrounding pixels. The basic principle of digital image forensics is that during the process of digital image generation, factors such as the actual scene content and the characteristics of camera software and hardware processing will leave certain inherent features in the image. When the image is tampered with, the inherent features of the original image will be damaged or changed to varying degrees. By extracting and detecting the inherent features in the image, related image forensics problems can be solved.

[0004] With the success of deep learning in various computer vision tasks such as object detection and semantic segmentation, many deep learning-based methods have been developed for image tampering localization. Leveraging deep learning's powerful ability to represent complex data, effective image tampering features can be automatically extracted from images through deep networks, thus, to a certain extent, breaking away from the traditional methods' reliance on hand-crafted features. Using a suitable deep network architecture, an end-to-end image tampering localization model can be constructed, directly outputting tampering localization results. However, most existing deep learning-based tampering detection methods still have flaws, such as poorly modeling the overall relationship between pixels and the tendency for local image details to be lost in convolutional networks.

[0005] To enhance these imperceptible semantic-agnostic features, Rao et al. (Rao Y, Ni J. A deep learning approach to detection of splicing and copy-move forgeries in images. 2016 IEEE International Workshop on Information Forensics and Security (WIFS). IEEE, 2016: 1-6.) set the convolutional kernels of the first layer of the convolutional neural network as the high-pass filters of the spatial rich model (SRM) in steganalysis for extracting the residual information of images. Li et al. (Li H, Huang J. Localization of deep inpainting using high-pass fully convolutional network. Proceedings of the IEEE / CVF International Conference on Computer Vision. 2019: 8301-8310.) designed a high-pass filtering layer for detecting deletion operations according to the characteristics of image inpainting. Although using these high-pass filters retains the high-frequency information that is easily exposed to tampering, the tampering features in the low-frequency information are filtered at the same time, resulting in a deteriorated detection effect. Therefore, Zhou et al. (Zhou P, Han X, Morariu V I, et al. Learning rich features for image manipulation detection. Proceedings of the IEEE conference on computer vision and pattern recognition. 2018: 1053-1061.) adopted a two-stream complementary method to extract features in both the color space and the noise space simultaneously. This method undoubtedly increases the number of parameters and makes the network complex; at the same time, the model generalization ability of the above method still needs to be improved. Summary of the Invention

[0006] Aiming at the problem that the detection effects of most current tampering detection models are average and the generalization performance is poor, the present invention provides an image tampering detection method based on shallow feature enhancement and attention mechanism. This method has a network structure that can effectively capture tampering traces and realizes pixel-level tampering area localization to solve the above problems.

[0007] The present invention provides an image tampering detection method based on shallow feature enhancement and attention mechanism, including:

[0008] Step 1: Construct a tampered image dataset and divide it into a training set and a test set;

[0009] Step 2: Set a loss function and train the constructed image tampering detection network based on the loss function using the training set to obtain an optimal image tampering detection network model;

[0010] Step 3: Detect the tampered images in the test set using the optimal image tampering detection network model;

[0011] Among them, the image tampering detection network includes: a feature extractor, a feature enhancement module, and an attention module; the feature extractor is used to extract shallow features and deep features of the input image, the feature enhancement module is used to reconstruct the extracted shallow features, and fuse the reconstructed features with the deep features, and the attention module is used to screen the fused features.

[0012] Furthermore, the feature extractor adopts an improved ResNet-50 backbone network; the improved ResNet-50 backbone network means replacing the convolution in the fourth module of the original ResNet-50 backbone network with dilated convolutions with dilation rates of 1, 2, and 4; and reducing the number of convolution groups in the first module from the original three to two.

[0013] Furthermore, the use of the feature enhancement module to reconstruct the extracted shallow features and fuse the reconstructed features with the deep features specifically includes:

[0014] First, downsample the features output by the first module in the improved ResNet-50 backbone network, then fuse the downsampled features with the features output by the second module, the feature enhancement module enhances the fused features, and finally fuse the enhanced feature map with the upsampled features of the fourth module in the improved ResNet-50 backbone network.

[0015] Furthermore, the attention module adopts an improved DANet, and the improved DANet means replacing the softmax activation function in the original DANet with a sigmoid activation function and replacing some 1×1 convolutions with 3×3 and 5×5 convolutions.

[0016] Furthermore, use formula (1) as the total loss function:

[0017] L = L BCE + L Dice (1)

[0018] Among them,

[0019]

[0020] Among them, L BCE represents the cross-entropy loss of an image with a resolution of H×W; L Dice represents the Dice loss of an image with a resolution of H×W; I g (i,j)∈{0,1}, represents the label at pixel (i,j); I o (i,j) represents the probability that the pixel at (i,j) is a tampered pixel.

[0021] Furthermore, the feature enhancement module enhances the fused features, and the specific enhancement process includes:

[0022] Step A1: For the shallow feature F∈R C×H×W Firstly, the global average feature G∈R C×1×1 is obtained through global average pooling. For each spatial position F i,j , i∈[1,W], j∈[1,H], the cosine similarity between F and G is calculated to obtain S∈R 1×H×W ; C represents the number of channels, H represents the height of the feature map, and W represents the width of the feature map;

[0023] Step A2: Scale S to R 1×HW , and then S is equally divided and quantized statistically into N blocks of L = [L1, L2,..., L N , N∈[***, ***], and then for each S i , i∈[1,HW], it is quantized into a quantization coding vector E i ∈R N , i∈[1,HW], and S is finally quantized into a quantization coding matrix E∈R N×HW ; Among them, S i is quantized by N functions {f1, f2,..., f N}, and the S n quantized by the function f i is represented by E i,n :

[0024]

[0025] Step A3: Given the quantization coding matrix E∈R N×HW , generate a quantization count map C∈R N×2 , where the first dimension represents each quantization level, and the second dimension represents the corresponding normalized count. C is denoted as:

[0026]

[0027] where Cat represents concatenation; Note: There are some tags with incomplete or incorrect content in the original text (such as

[0019] etc. which seem to be incomplete tags, and 1×HW etc. with incorrect number format in the description). The translation is done based on the existing text as accurately as possible. Also, the two "***" in the range "N∈[***, ***]" in the original text are left untranslated as they seem to be incorrect or incomplete information.

[0028] Step A4: Encode the global average feature G into C to generate the statistical feature D, specifically: Upsample G to R N×C , and D is obtained by formula (4):

[0029] D = Cat(MLP(C), G) (4)

[0030] where MLP represents a multi-layer perceptron for increasing the dimension of C;

[0031] Step A5: Calculate the similarity of the statistical feature D according to formula (5):

[0032] X = softmax(φ1(D) T ·φ2(D)) (5)

[0033] where φ1 and φ2 represent two different 1×1 convolutions, and the softmax performed on the first dimension serves as a non-linear normalization function;

[0034] Step A6: Update each node by fusing the features of other nodes to obtain the reconstructed quantization matrix L' ∈ R C ×N , assign the reconstructed L' to each pixel, and use the quantization encoding matrix E ∈ R N×HW to obtain the final output M:

[0035] L' = φ3(D)·X (6)

[0036] where φ3 represents a 1×1 convolution;

[0037] M = L'·E (7).

[0038] Furthermore, the use of the attention module to screen the fused features specifically includes the following screening process:

[0039] Step B1: Use channel attention to obtain the channel feature map CAF:

[0040] CAF = α(sigmoid(F T ×F R )×F R ) + F (8)

[0041] where F ∈ R C×H×W , represents the input feature, C represents the number of channels, H represents the height of the feature map, and W represents the width of the feature map; F T ∈R C×HW and F R ∈R HW×C are obtained by transposing and reshaping the input feature, and α is a learnable scale factor;

[0042] Step B2: Obtain the position feature map SAF using spatial attention:

[0043] SAF = β(sigmoid(F1 T ×F2)×F3)+F (9)

[0044] where the input feature F respectively obtains F1, F2, and F3 after 1×1, 3×3, and 5×5 convolutions; F1 is obtained by transposing and reconstructing to get F1 T ∈R C×HW ; F2 and F3 belong to R after reconstruction HW×C ; β is a learnable scaling factor;

[0045] Step B3: Add the channel feature map CAF and the position feature map SAF to obtain the final output.

[0046] Advantages of the present invention:

[0047] (1) Different from the method of using high-pass filter preprocessing in the prior art to enhance the difference between real images and tampered images, the method of the present invention detects and locates by capturing the shallow feature texture information in the deep learning network. The method of the present invention can achieve pixel-level tampering detection and localization, and improves the defect that the local detail information of the image in the existing deep learning method is easily lost in the convolutional network;

[0048] (2) The method of the present invention constructs a feature enhancement module to fuse shallow features and deep features, effectively filters content information and highlights tampering features, and enhances the texture details of shallow features through shallow feature quantization statistics and reconstruction quantization, so as to realize the detection of various tampering methods and improve the network generalization ability;

[0049] (3) The method of the present invention constructs an attention enhancement module, uses the combination of position attention and channel attention to screen the fused features, suppresses the interference of other irrelevant regions, and guides the network to extract more internal features related to boundary artifacts without being affected by specific operations;

[0050] In summary, the present invention realizes improving the detection effect of the tampering detection model and enhancing the generalization ability of the model. Brief Description of the Drawings

[0051] Figure 1 is a schematic flowchart of an image tampering detection method based on shallow feature enhancement and attention mechanism provided by an embodiment of the present invention;

[0052] Figure 2 is the overall framework diagram of the image tampering detection network model provided by an embodiment of the present invention;

[0053] Figure 3Schematic diagram of shallow feature quantization statistics of the feature enhancement module provided by an embodiment of the present invention;

[0054] Figure 4 Schematic diagram of the attention module provided by an embodiment of the present invention;

[0055] Figure 5 Visualization results of each model provided by an embodiment of the present invention on the CASIA1.0, NIST, and Columbia datasets. Detailed implementation manners

[0056] To make the objectives, technical solutions, and advantages of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly described below with reference to the accompanying drawings in the embodiments of the present invention. Apparently, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0057] Embodiment 1

[0058] As Figure 1 shown, an embodiment of the present invention provides an image forgery detection method based on shallow feature enhancement and attention mechanism, including the following steps:

[0059] S101: Construct a forgery image dataset and divide it into a training set and a test set;

[0060] S102: Set a loss function, and train the constructed image forgery detection network using the training set based on the loss function to obtain an optimal image forgery detection network model;

[0061] S103: Use the optimal image forgery detection network model to detect forgery images in the test set;

[0062] Specifically, as Figure 2 shown in the structural schematic diagram of the constructed image forgery detection network, it includes: a feature extractor, a feature enhancement module, and an attention module; the feature extractor is used to extract shallow features and deep features of the input image, the feature enhancement module is used to reconstruct the extracted shallow features, and fuse the reconstructed features with the deep features, and the attention module is used to screen the fused features.

[0063] As an implementable manner, in the embodiments of the present invention, the feature extractor adopts an improved ResNet-50 backbone network; the improved ResNet-50 backbone network refers to replacing the convolution in the fourth module of the original ResNet-50 backbone network with dilated convolutions with dilation rates of 1, 2, and 4; and reducing the number of convolution groups in the first module from the original three to two.

[0064] Specifically, by using dilated convolutions to replace ordinary convolutions and reducing the number of convolutions in the first module of the original ResNet-50 backbone network, the network can pay more attention to local details, extract more texture features while suppressing high-level semantic features, so that the entire network pays more attention to subtle tampering traces.

[0065] As an implementable manner, the method of reconstructing the extracted shallow features by using the feature enhancement module and performing feature fusion between the reconstructed features and the deep features specifically includes:

[0066] First, downsample the features output by the first module in the improved ResNet-50 backbone network, then fuse the downsampled features with the features output by the second module, the feature enhancement module enhances the fused features, and finally fuse the enhanced feature map with the upsampled features of the fourth module in the improved ResNet-50 backbone network.

[0067] The image tampering detection method based on shallow feature enhancement and attention mechanism provided by the embodiments of the present invention can achieve pixel-level tampering detection and localization by constructing a feature enhancement module and an attention module, and improves the defect that local detail information of images in existing deep learning methods is easily lost in the convolutional network.

[0068] Embodiment 2

[0069] Based on the above Embodiment 1, in the embodiments of the present invention, an improved DANet is specifically adopted as the attention module. The improved DANet refers to replacing the softmax activation function in the original DANet with a sigmoid activation function and replacing some 1×1 convolutions with 3×3 and 5×5 convolutions.

[0070] Specifically, the original DANet was proposed in the literature "Fu J, Liu J, Tian H, et al. Dual attention network for scene segmentation. Proceedings of the IEEE / CVF conference on computer vision and pattern recognition. 2019: 3146-3154". For the tampering task, the embodiments of the present invention have improved it, specifically including: Since the output of the network is not the final output after the attention module, and softmax is usually used as the last activation function of the neural network, sigmoid is used to replace the softmax activation function in the original network. For spatial attention, the inventor believes that when calculating similar noise features, it is necessary to capture the surrounding information, and the attention is concentrated on the tampered traces rather than the prominent targets to adapt to the forgery localization task. Therefore, 3×3 and 5×5 convolutions are used to replace some of the original 1×1 convolutions.

[0071] Embodiment 3

[0072] Based on the above embodiments, the embodiments of the present invention provide a method for constructing a loss function for training. The loss function in the embodiments of the present invention consists of two parts, and specifically, formula (1) is used as the total loss function:

[0073] L = L BCE + L Dice (1)

[0074] Wherein,

[0075]

[0076] Wherein, L BCE represents the cross-entropy loss of an image with a resolution of H×W; L Dice represents the Dice loss of an image with a resolution of H×W; I g (i, j) ∈ {0, 1} represents the label at pixel (i, j); I o (i, j) represents the probability that the pixel (i, j) is a tampered pixel.

[0077] Specifically, binary cross-entropy (BCE) loss is used to supervise the training. At the same time, considering that the area of tampered pixels in the entire image is small, the cross-entropy loss will cause the problem of sample imbalance. This imbalance will lead to a serious problem, that is, the trained model is more likely to classify the samples as original samples. To solve this problem, Dice loss is introduced.

[0078] Embodiment 4

[0079] Based on the above embodiments, the embodiments of the present invention provide the feature enhancement process of the feature enhancement module, which mainly consists of shallow feature quantization statistics ( Figure 3 the process of shallow feature quantization statistics is given) and re-quantization; specifically including:

[0080] Step A1: Shallow feature F ∈ R C×H×W First, the global average feature G ∈ R is obtained through global average pooling C×1×1 , for each spatial position F i,j , i ∈ [1, W], j ∈ [1, H], calculate the cosine similarity between F and G to obtain S ∈ R 1×H×W ; C represents the number of channels, H represents the height of the feature map, and W represents the width of the feature map;

[0081] Step A2: Scale S to R 1×HW , then equally divide and quantize S into N blocks of L = [L1, L2,..., L N , where N ∈ [1, 255], and N = 128 is taken according to the experimental results; furthermore, for each S i , i ∈ [1, HW], quantize it into a quantization coding vector E i ∈ R N , i ∈ [1, HW], and S is finally quantized into a quantization coding matrix E ∈ R N×HW ; where, S i is quantized by N functions {f1, f2,..., f N}, and the S quantized by the function f n is represented by E i : i,n

[0082]

[0083] Step A3: Given the quantization coding matrix E ∈ R N×HW , generate a quantization count map C ∈ R N×2 , where the first dimension represents each quantization level, and the second dimension represents the corresponding normalized count. The quantization count map C is denoted as:

[0084]

[0085] where Cat represents concatenation;

[0086] Step A4: Encode the global average feature G into the quantization count map C to generate a statistical feature D. Specifically: Upsample G to R N×C , and D is obtained from formula (4):

[0087] D = Cat(MLP(C), G) (4)

[0088] Among them, MLP represents a multi-layer perceptron, which is used to increase the dimension of the quantization count mapping C; it contains two layers, and a Leaky ReLU follows the first layer to enhance the non-linearity.

[0089] Step A5: Calculate the similarity for the statistical feature D according to formula (5):

[0090] X = softmax(φ1(D) T ·φ2(D)) (5)

[0091] Among them, φ1 and φ2 represent two different 1×1 convolutions, and the softmax performed on the first dimension serves as a non-linear normalization function;

[0092] Step A6: Update each node by fusing the features of other nodes to obtain the reconstructed quantization matrix L' ∈ R C ×N , assign the reconstructed L' to each pixel, and use the quantization coding matrix E ∈ R N×HW to obtain the final output M:

[0093] L' = φ3(D)·X (6)

[0094] Among them, φ3 represents a 1×1 convolution;

[0095] M = L'·E (7).

[0096] The image forgery detection method based on shallow feature enhancement and attention mechanism provided by the embodiments of the present invention constructs a feature enhancement module, fuses shallow features and deep features, effectively filters content information and highlights forgery features, and enhances the texture details of shallow features through shallow feature quantization statistics and reconstruction quantization, thereby realizing the detection of various forgery methods and improving the network generalization ability.

[0097] Embodiment 5

[0098] Based on the above embodiments, the embodiments of the present invention provide a process for the attention module to screen the fused features, as Figure 4 shown, which specifically includes:

[0099] Step B1: Obtain the channel feature map CAF using channel attention:

[0100] CAF = α(sigmoid(F T ×F R )×F R ) + F (8)

[0101] Among them, F ∈ R C×H×W, representing the input feature, C represents the number of channels, H represents the height of the feature map, and W represents the width of the feature map; F T ∈R C×HW and F R ∈R HW×C is obtained by transposing and reshaping the input feature, and α is a learnable scaling factor;

[0102] Step B2: Use spatial attention to obtain the position feature map SAF:

[0103] SAF = β(sigmoid(F1 T ×F2)×F3)+F (9)

[0104] where the input feature F is respectively obtained as F1, F2, and F3 after 1×1, 3×3, and 5×5 convolutions; F1 is obtained by transposing and reconstructing to get F1 T ∈R C×HW ; F2 and F3 belong to R after reconstruction HW×C ; β is a learnable scaling factor; it should be noted that in the embodiments of the present invention, the improved attention module replaces two of the three 1×1 convolutions in the original network with 3×3 and 5×5 convolutions respectively.

[0105] Step B3: Add the channel feature map CAF and the position feature map SAF to obtain the final output.

[0106] The image tampering detection method based on shallow feature enhancement and attention mechanism provided by the embodiments of the present invention constructs an attention enhancement module, uses a combination of spatial attention and channel attention to screen the fused features, suppresses the interference of other irrelevant regions, and guides the network to extract more intrinsic features related to boundary artifacts without being affected by specific operations.

[0107] In order to evaluate the advantages of the above method proposed by the present invention compared with existing mainstream methods, the present invention conducts model comparison experiments on the publicly available CAISA v1.0, Columbia, and NIST tampering datasets.

[0108] The main models compared in this experiment include MT-Net (Wu Y, AbdAlmageed W, Natarajan P. Mantra-net: Manipulation tracing network for detection and localization of image forgeries with anomalous features. Proceedings of the IEEE / CVF Conference on Computer Vision and Pattern Recognition. 2019:9543-9552.), MVSS-Net (Chen X, Dong C, Ji J, et al. Image Manipulation Detection by Multi-View Multi-Scale Supervision. Proceedings of the IEEE / CVF International Conference on Computer Vision. 2021:14185-14193.), and OSN-Net (Wu H, Zhou J, Tian J, et al. Robust Image Forgery Detection against Transmission over Online Social Networks. IEEE Transactions on Information Forensics and Security, 2022).

[0109] Among them, the MT-Net model is pre-trained on a private large-scale dataset, the OSN-Net constructs a tampering dataset based on the Dresden and MS-COCO datasets and trains it, and the model of the present invention and the MVSS-Net model are pre-trained on CASIA2.0. The comparison experiment results of each model are shown in Table 1. The method proposed in the present invention has obtained the highest values in the F1 index comparison of each model in the comparison experiment, which are 0.520, 0.387, and 0.779 respectively.

[0110] Table 1 F1 indices of different models on the CASIA1.0, NIST, and Columbia datasets

[0111]

[0112] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements 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. An image forgery detection method based on shallow feature enhancement and attention mechanism, characterized in that, Including: Step 1: Construct a dataset of tampered images and divide it into a training set and a test set; Step 2: Set a loss function and train the constructed image tampering detection network using the training set based on the loss function to obtain an optimal image tampering detection network model; Step 3: Use the optimal image tampering detection network model to detect tampered images in the test set; Among them, the image tampering detection network includes: a feature extractor, a feature enhancement module, and an attention module; the feature extractor is used to extract shallow features and deep features of the input image, the feature enhancement module is used to reconstruct the extracted shallow features, and fuse the reconstructed features with the deep features, and the attention module is used to screen the fused features; The feature enhancement module enhances the fused features, and the specific enhancement process includes: Step A1: Shallow feature F ∈ R C×H×W First, obtain the global average feature G ∈ R through global average pooling C×1×1 , for each spatial position F i,j , i ∈ [1, W], j ∈ [1, H], calculate the cosine similarity between F and G to obtain S ∈ R 1×H×W ; C represents the number of channels, H represents the height of the feature map, and W represents the width of the feature map; Step A2: Transform the scale of S to R 1×HW , then divide S into N equal parts and quantify them into L=[L1,L2,...,L N ] blocks, N∈[1,255], and then for each S i ,i∈[1,HW], quantize it into a quantized coding vector E i ∈R N ,i∈[1,HW], S is finally quantized into the quantization coding matrix E∈R N×HW ; Among them, S i By N functions {f1,f2,...,f N } quantized, will be used by the function f n Quantified S i Use E i,n express: Step A3: Given a quantization coding matrix E ∈ R N×HW , generate a quantization count map C ∈ R N×2 , where the first dimension represents each quantization level and the second dimension represents the corresponding normalized count. The quantization count map C is denoted as: Where Cat represents concatenation; Step A4: Encoding the global average feature G into the quantization count map C to generate the statistical feature D, specifically: Upsampling G to R N×C , D is obtained by formula (4): D = Cat(MLP(C), G)(4) Among them, MLP represents a multi-layer perceptron, which is used to increase the dimension of the quantization count map C; Step A5: Calculate the similarity of the statistical feature D according to formula (5): X = softmax(φ1(D) T ·φ2(D))(5) Among them, φ1 and φ2 represent two different 1×1 convolutions, and the softmax performed on the first dimension is used as a non-linear normalization function; Step A6: Update each node by fusing the features of other nodes to obtain a reconstructed quantization matrix \(L'\in\mathbb{R}\) C×N , assign the reconstructed \(L'\) to each pixel, and use the quantization coding matrix \(E\in\mathbb{R}\) N×HW to obtain the final output \(M\): L' = φ3(D)·X(6) Among them, φ3 represents a 1×1 convolution; M = L'·E(7).

2. The image forgery detection method based on shallow feature enhancement and attention mechanism according to claim 1, wherein The feature extractor adopts an improved ResNet-50 backbone network; the improved ResNet-50 backbone network means replacing the convolution in the fourth module of the original ResNet-50 backbone network with dilated convolutions with dilation rates of 1, 2, and 4; and reducing the number of convolution groups in the first module from the original three to two.

3. The method for detecting image forgery based on shallow feature enhancement and attention mechanism according to claim 2, wherein The process of reconstructing the extracted shallow features by the feature enhancement module and fusing the reconstructed features with the deep features specifically includes: First, downsample the features output by the first module in the improved ResNet-50 backbone network, then fuse the downsampled features with the features output by the second module, the feature enhancement module enhances the fused features, and finally fuse the enhanced feature map with the upsampled features of the fourth module in the improved ResNet-50 backbone network.

4. The image forgery detection method based on shallow feature enhancement and attention mechanism according to claim 1, wherein The attention module adopts an improved DANet, and the improved DANet means replacing the softmax activation function in the original DANet with a sigmoid activation function and replacing some 1×1 convolutions with 3×3 and 5×5 convolutions.

5. The image forgery detection method based on shallow feature enhancement and attention mechanism according to claim 1, characterized in that Use formula (1) as the total loss function: L = L BCE + L Dice (1) Among them, Among them, L BCE represents the cross-entropy loss of an image with a resolution of H×W; L Dice represents the Dice loss of an image with a resolution of H×W; I g (i,j) ∈ {0,1}, represents the label at pixel (i,j); I o (i,j) represents the probability that the pixel at pixel (i,j) is a tampered pixel.

6. The image forgery detection method based on shallow feature enhancement and attention mechanism according to claim 4, wherein The process of screening the fused features by the attention module specifically includes: Step B1: Obtain a channel feature map CAF using channel attention; CAF = α(sigmoid(F T ×F R )×F R ) + F(8) where \(F\in\mathbb{R}\) C×H×W , representing the input feature, \(C\) represents the number of channels, \(H\) represents the height of the feature map, and \(W\) represents the width of the feature map; \(F\) T \(\in\mathbb{R}\) C×HW and \(F\) R \(\in\mathbb{R}\) HW×C are obtained by transposing and reshaping the input feature, and \(\alpha\) is a learnable scale factor; Step B2: Obtain a position feature map SAF using spatial attention; SAF = β(sigmoid(F1 T ×F2)×F3)+F(9) Among them, the input feature F is respectively obtained as F1, F2, and F3 after 1×1, 3×3, and 5×5 convolutions; F1 is transposed and reconstructed to obtain F1 T ∈R C×HW ; F2 and F3 are reconstructed to belong to R HW×C ; β is a learnable scale factor; Step B3: Add the channel feature map CAF and the position feature map SAF to obtain the final output.

Citation Information

Patent Citations

  • Face forgery detection method based on multi-region attention mechanism

    CN113011332A

  • Attention mechanism-based spliced image tampering detection method and system

    CN114418988A