Image tampering detection method based on feature similarity and multi-scale edge attention

Through the detection method based on feature similarity and multi-scale edge attention, the problem of insufficient robustness to different tampering types and post-processing operations in the existing technology is solved, the effective positioning and identification of image tampering is achieved, and the detection efficiency is improved. accuracy and generalization ability.

CN118154906BActive Publication Date: 2024-08-30QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES) +3
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410564619.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-09
Publication Date
2024-08-30
Estimated Expiration
2044-05-09

AI Technical Summary

Technical Problem

Existing image tampering detection technologies are not robust enough to different tampering types and post-processing operations. In particular, their generalization capabilities are limited, making it difficult to effectively detect complex image tampering types such as splicing operations and JPEG compression.

Method used

A detection method based on feature similarity and multi-scale edge attention is adopted to extract multi-source features through the backbone network. It combines the multi-scale edge attention network and the Split-Transform-Merge structure to learn edge features, and calculates and multi-source features through feature similarity calculation and multi-scale edge attention. The loss function is jointly supervised to effectively locate image tampering.

Benefits of technology

It improves the robustness to various tampering types and post-processing methods, can clearly identify image tampering areas, enhances the generalization ability of the model, avoids edge blurring of prediction results, and improves the accuracy of image tampering detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118154906B
    Figure CN118154906B
Patent Text Reader

Abstract

The present invention relates to the field of image processing technology, and in particular to an image tampering detection method based on feature similarity and multi-scale edge attention, comprising the following steps: processing an image to be input, obtaining multi-source information of the image to be detected, inputting the multi-source information into a backbone network to extract features; a multi-scale edge attention network; feature similarity learning; multi-level feature fusion encoding; and multi-loss function joint supervision. The present invention uses multi-scale edge features to assist in the positioning of tampered areas, explores the general features of different tampering types through feature similarity, and fully explores the differences between tampered areas and real areas by effectively fusing features at different scales.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to an image tampering detection method based on feature similarity and multi-scale edge attention. Background Art

[0002] Modifying an image has never been as cheap and easy as it is now, and new powerful editing tools are appearing every day. One of the main reasons is that digital images have replaced traditional photography. The development of new image processing technologies has promoted the evolution of many new technologies in forensic research, but it has also provided tools for image tampering. Although these tools have stimulated people's creativity to a certain extent, the abuse of digital image manipulation methods will cause a crisis of trust, huge economic losses and even social security risks. So far, researchers have proposed many methods to detect whether an image has been tampered with, including active detection and passive detection. Active methods include adding digital signatures or digital watermarks. The characteristics are that information needs to be embedded in the image in advance. After the receiver receives the image, the watermark or digital signature is extracted, and the image is judged by judging the watermark or signature. However, in practical applications, due to various reasons, the image cannot be embedded with watermarks in time, which affects the use of the image. In addition, imaging devices that can automatically add watermarks are expensive, and most imaging devices used in life do not have the function of automatically adding watermarks. Therefore, active detection methods are not conducive to large-scale promotion. In contrast, passive detection relies only on the features of the image to be forensically obtained, which makes passive forensics technology more widely applicable and more practical. However, current passive detection technology has limited generalization capabilities for different types of tampering. For example, splicing operations will leave different types of noise distribution on the image, but copy-move operations will not. Therefore, the method of extracting local noise anomalies has the disadvantage of weak generalization capabilities for multiple types of tampering. At the same time, the current model is not robust enough for post-processing operations such as edge smoothing, local blurring, and JPEG compression, which can interfere with detection. Therefore, image tampering detection for different tampering types and different post-processing methods is a more challenging and urgent problem to be solved. Summary of the invention

[0003] In view of the shortcomings of the prior art, the present invention develops an image tampering detection method based on feature similarity and multi-scale edge attention, which can effectively locate in image forgery datasets.

[0004] The technical solution to the technical problem proposed by the present invention is a method for detecting image tampering based on feature similarity and multi-scale edge attention, comprising the following steps:

[0005] S1. Process the image to be input, obtain the multi-source information of the image to be detected, and input the multi-source information into the backbone network to extract features:

[0006] The original image is resized, and the RGB image and the noise view output by the restricted convolutional layer are used as the input of the backbone network at the same time. The image features are extracted from two information sources and four scales, and four features of different scales are generated. ;

[0007] S2. Multi-scale edge attention network:

[0008] The features of each stage are passed through the edge detector to generate edge features , generate edge attention maps based on the edge features of shallow features , and use the edge attention map to guide the edge features of the four stages, learn the edge features through the residual block of the Split-Transform-Merge structure, and integrate the edge features into the backbone network;

[0009] S3. Feature Similarity Learning:

[0010] The pixels in the tampered area of ​​GroundTruth are set as positive, and the pixels in the real area are set as negative. At the same time, GroundTruth is downsampled to the feature size of the first stage. The features output by the first stage are used to calculate the similarity measure between each pair of pixels using dot product similarity. The obtained similarity feature map is constrained by BinaryCrossEntropy loss with GroundTruth.

[0011] S4. Multi-level feature fusion encoding:

[0012] Cascade the features of four scales and complete the feature fusion through channel and spatial dual attention;

[0013] S5. Multiple loss functions jointly supervised:

[0014] Finally, the prediction image obtained by decoding is output and subjected to pixel-level loss supervision with the Ground Truth. The edge features and similarity feature maps of four sizes are subjected to pixel-level loss supervision with the corresponding down-sampled Ground Truth, and the three loss optimization networks are combined.

[0015] In a specific implementation manner, the features of image extraction are as follows:

[0016] The image is processed to obtain an RGB image of the same size as the network input. The input size is H×W, where W is the image width and H is the image height in pixels.

[0017] The input image is passed through a restricted convolutional layer to obtain a noisy view, which is then fed into the backbone network together with the RGB image to extract features from different sources while sharing parameters.

[0018] Four features of different scales are generated in the four extraction stages. .

[0019] In a specific implementation, the multi-scale edge attention network has the following specific steps:

[0020] The first stage feature F1 is detected by an edge detector composed of Sobel operator and Laplace operator to obtain edge features , and then Obtain edge attention maps at different scales through 1x1 convolution, reshaping, and multiplication operations The features of the remaining stages are obtained by a detector composed of a Soble operator and a Laplace operator. , edge features Expressed as:

[0021] ,

[0022] in , represent Sobel operator and Laplace operator respectively, represents 1x1 convolution, ; Edge attention map Expressed as:

[0023] ,

[0024] in Reshape function. represents 1x1 convolution, represents matrix multiplication, ;

[0025] The edge features of each stage are fused with the attention map, and the original features F1, F2, F3, and F4 are further fused through residual connections to obtain the intermediate features. The formula is:

[0026] ,

[0027] in represents element-wise multiplication, ;

[0028] The residual module of the Split-Transform-Merge structure is used to further mine fine-grained edge features, and finally the edge features of the four scales are integrated into the backbone network. The formula is:

[0029] ,

[0030] in represents element-by-element addition, Residual module representing the Split-Transform-Merge structure, .

[0031] In a specific implementation manner, the feature similarity learning is specifically as follows:

[0032] GroundTruth is downsampled to the same size as the F1 feature using the nearest neighbor method; the feature F1 is embedded in the channel dimension using two embedding heads implemented by MLP. and ;

[0033] Next, the feature map and the transposed feature map are dot-producted, and then each element is divided by the square root of the number of channels. The similarity measure between each pair of feature pixels is obtained through the Sigmoid function, and the size is: HW / 16, HW / 16. Similarity learning is implemented based on the similarity matrix. The specific implementation formula is as follows:

[0034] ,

[0035] S represents the similarity feature matrix, and They represent the two embedding layers implemented by MLP, represents the Sigmoid function, and Respectively represent the pixel features at positions i, j and h, k. If they are all authentic or tampered with, then s=1, otherwise s=0;

[0036] Using BinaryCrossEntropyLoss, the formula is as follows:

[0037] ,

[0038] in and They represent the i-th pixel of the GroundTruth and similarity matrices respectively, and N is the number of pixels.

[0039] In a specific implementation, the multi-level feature fusion decoding is as follows: among the four features F1, F2, F3, and F4, F2, F3, and F4 are bilinearly upsampled to the size of F1, and the features of the four scales are cascaded, and the features of the four scales are fused through channel attention and spatial attention. The channel attention links the channel features and selectively emphasizes the interdependent channel features. At the same time, the spatial attention performs weighted summation on the features at all positions, selectively updates the features at each position, adds the outputs of the channel and spatial attention, converts them into H / 16*W / 16 size through 1x1 convolution, and outputs the full-size prediction map through bilinear upsampling and Sigmoid function.

[0040] In a specific implementation, the objective function of the similarity and multi-scale edge attention network is constructed as follows:

[0041] Pixel segmentation loss Composed of Diceloss and WeightCrossEntropyLoss, pixel segmentation loss The calculation is as follows:

[0042] ,

[0043] in represents a hyperparameter, set to 0.3, represents Diceloss, Represents the WeightCrossEntropyLoss loss function, which is calculated as follows:

[0044] ,

[0045] in, , represents two different hyperparameter weights, , They represent the ground truth and the i-th pixel in the predicted image, respectively, and N is the number of pixels in the image;

[0046] Combining pixel segmentation loss, edge loss, and similarity loss, the total loss function is defined as follows:

[0047] ,

[0048] in, Represents BinaryCrossEntropyLoss loss, represents the DiceLoss loss, represents the pixel segmentation loss.

[0049] The effects provided in the content of the invention are only the effects of the embodiments, rather than all the effects of the invention. The above technical solution has the following advantages or beneficial effects:

[0050] Image tampering not only changes the visible content of the image, but also changes the underlying information and noise characteristics. Therefore, by jointly extracting the noise view from the restricted convolutional layer, we can mine tampering traces from different information sources and fully learn the underlying compression and noise artifacts;

[0051] The general characteristics of different tampering types are explored through feature similarity, and the similarity between a certain feature channel and other feature channels is calculated using dot product similarity, so as to learn the difference between the tampered area and the real area. At the same time, the matrix operation method is also conducive to improving the training efficiency of the model, and finally improving the robustness of the model to various tampering types and post-processing methods;

[0052] The edge of the tampered area is used to assist in guiding the positioning of the tampered area and to assist in guiding the prediction of the model at four scales, which can avoid the problem of blurred edges of the prediction results and ultimately obtain clear and sharp prediction edges. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention.

[0054] Figure 1 It is a structural diagram of the present invention.

[0055] Figure 2 The results of the present invention are shown as examples. DETAILED DESCRIPTION

[0056] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0057] An image tampering detection method based on feature similarity and multi-scale edge attention comprises the following steps:

[0058] S1. Process the image to be input, obtain the multi-source information of the image to be detected, and input the multi-source information into the backbone network to extract features:

[0059] The specific operation is as follows: the input image is padded or cropped to unify the size of the image as the input of the network. The input size is H×W, W is the image width, H is the image height, and the unit is pixel, before entering the backbone network; the center value is set to -1, and the remaining convolution kernel weights are normalized to make the sum equal to 1. The restricted convolution layer is used to obtain the noise view of the image, and the input image and the obtained noise view are input into the backbone network SegTransformer. The feature extraction is performed through the attention layer and the MLP layer. Different from the traditional convolution feature extraction method, global modeling can be achieved. In the process of image tampering positioning, global modeling is used to discover local inconsistent information. It is important to extract features at different stages and share parameters at the same time. Finally, four features of different scales F1, F2, F3, and F4 will be generated in the four extraction stages. Their sizes are (H / 4, W / 4), (H / 8, W / 8), (H / 16, W / 16), and (H / 32, W / 32).

[0060] S2. Multi-scale edge attention network:

[0061] The specific steps of the multi-scale edge attention network are as follows:

[0062] The first stage feature F1 is detected by an edge detector composed of Sobel operator and Laplace operator to obtain edge features , and then Obtain edge attention maps at different scales through 1x1 convolution, reshaping, and multiplication operations The features of the remaining stages are obtained by a detector composed of a Soble operator and a Laplace operator. , edge features Expressed as:

[0063] ,

[0064] in , represent Sobel operator and Laplace operator respectively, represents 1x1 convolution, ; Edge attention map Expressed as:

[0065] ,

[0066] in Reshape function. represents 1x1 convolution, represents matrix multiplication, ;

[0067] The edge features of each stage are fused with the attention map, and the original features F1, F2, F3, and F4 are further fused through residual connections to obtain the intermediate features. The formula is:

[0068] ,

[0069] in represents element-wise multiplication, ;

[0070] The residual module of the Split-Transform-Merge structure is used to further mine fine-grained edge features, and finally the edge features of the four scales are integrated into the backbone network. The formula is:

[0071] ,

[0072] in represents element-by-element addition, Residual module representing the Split-Transform-Merge structure, .

[0073] S3. Feature Similarity Learning:

[0074] The purpose of similarity learning is to bring feature vectors of the same category closer and feature vectors of different categories farther apart. In image tampering positioning, there are two categories of tampered pixels and real pixels. The general characteristics of the key information of the pixels of the forged image are found. Specifically, the pixels of the tampered area in GroundTruth are set as positive, and the pixels of the real area are set as negative. At the same time, GroundTruth is downsampled to the feature size of the first stage, and the features output by the first stage are used to calculate the similarity measure between each pair of pixels using dot product similarity. The obtained similarity feature map is constrained by BinaryCrossEntropy loss with GroundTruth.

[0075] S4. Multi-level feature fusion encoding:

[0076] Cascade the features of four scales and complete the feature fusion through channel and spatial dual attention;

[0077] S5. Multiple loss functions jointly supervised:

[0078] Finally, the prediction image obtained by decoding is output and subjected to pixel-level loss supervision with the Ground Truth. The edge features and similarity feature maps of four sizes are subjected to pixel-level loss supervision with the corresponding down-sampled Ground Truth, and the three loss optimization networks are combined.

[0079] In this embodiment, the feature similarity learning is specifically as follows:

[0080] GroundTruth is downsampled to the same size as the F1 feature using the nearest neighbor method; the feature F1 is embedded in the channel dimension using two embedding heads implemented by MLP. and ;

[0081] Next, the feature map and the transposed feature map are dot-producted, and then each element is divided by the square root of the number of channels. The similarity measure between each pair of feature pixels is obtained through the Sigmoid function, and the size is: HW / 16, HW / 16. Similarity learning is implemented based on the similarity matrix. The specific implementation formula is as follows:

[0082] ,

[0083] S represents the similarity feature matrix, and They represent the two embedding layers implemented by MLP, represents the Sigmoid function, and Respectively represent the pixel features at positions i, j and h, k. If they are all authentic or tampered with, then s=1, otherwise s=0;

[0084] Using BinaryCrossEntropyLoss, the formula is as follows:

[0085] ,

[0086] in and They represent the i-th pixel of the GroundTruth and similarity matrices respectively, and N is the number of pixels.

[0087] The multi-level feature fusion decoding is as follows: among the four features F1, F2, F3, F4, F2, F3, F4 are bilinearly upsampled to the size of F1, and the features of the four scales are cascaded, and the features of the four scales are fused through channel attention and spatial attention. Channel attention links the channel features and selectively emphasizes the interdependent channel features. At the same time, spatial attention performs weighted summation of the features at all positions, selectively updates the features at each position, adds the outputs of the channel and spatial attention, converts them into H / 16*W / 16 size through 1x1 convolution, and outputs the full-size prediction map through bilinear upsampling and Sigmoid function.

[0088] The objective function of similarity and multi-scale edge attention network is constructed as follows:

[0089] Pixel segmentation loss Composed of Diceloss and WeightCrossEntropyLoss, pixel segmentation loss The calculation is as follows:

[0090] ,

[0091] in represents a hyperparameter, set to 0.3, represents Diceloss, Represents the WeightCrossEntropyLoss loss function, which is calculated as follows:

[0092] ,

[0093] in, , represents two different hyperparameter weights, , They represent the ground truth and the i-th pixel in the predicted image, respectively, and N is the number of pixels in the image;

[0094] Combining pixel segmentation loss, edge loss, and similarity loss, the total loss function is defined as follows:

[0095] ,

[0096] in, Represents BinaryCrossEntropyLoss loss, represents the DiceLoss loss, represents the pixel segmentation loss.

[0097] The present invention uses a training set consisting of about 875,000 real and tampered images composed of datasets such as IMD and FantasticReality, and uses independent datasets as test data. It is evaluated on six image tampering datasets: CASIAv1+, Coverage, Columbia, NIST, DSO-1, and CocoGlide. In this work, the present invention only uses tampered images instead of real images during the test process. In order to perform quantitative evaluation, the present invention calculates the F1 score as an evaluation indicator based on the predicted mask M and the real mask according to previous related methods.

[0098] The experiment was set up for 1 epoch, the size of each batch was set to 8, the Adam optimization method was used, the initial learning rate was 2e-4, and the learning rate was halved every 20,000 batches; the hyperparameters of the loss function Set to 0.3, Set to 0.5, It is set to 2.5; in order to enhance the specificity of the model in dealing with real images and reduce the false alarm rate of the model, the training set includes about 50,000 real images. It can be seen from Table 1 that the method of the present invention has better results and more excellent performance.

[0099] Table 1 Classic image tampering localization and the proposed method on different datasets Performance comparison results

[0100] .

[0101] Example 2

[0102] Depend on Figure 2 The result display diagram obtained by the method of the present invention is shown in FIG. The input image is subjected to the method of the present invention to obtain the prediction result diagram. Figure 2 It can be seen that there is not much difference between the prediction result graph obtained by the present invention and the real image, which proves that the method in the present invention can achieve the expected effect.

[0103] Although the above describes the specific implementation mode of the invention in conjunction with the drawings, it is not intended to limit the scope of protection of the invention. Based on the technical solution of the present invention, various modifications or variations that can be made by those skilled in the art without creative work are still within the scope of protection of the present invention.

Claims

1. An image tampering detection method based on feature similarity and multi-scale edge attention, It is characterized in that The following steps are involved: S1. Process the image to be input, obtain the multi-source information of the image to be detected, and input the multi-source information into the backbone network to extract features: The original image is resized, and the RGB image and the noise view output by the restricted convolutional layer are used as the input of the backbone network at the same time. The image features are extracted from two information sources and four scales, and four features of different scales are generated. ; S2. Multi-scale edge attention network: The features of each stage are passed through the edge detector to generate edge features , generate edge attention maps based on the edge features of shallow features , and use the edge attention map to guide the edge features of the four stages, learn the edge features through the residual block of the Split-Transform-Merge structure, and integrate the edge features into the backbone network; S3. Feature Similarity Learning: The pixels in the tampered area of ​​GroundTruth are set as positive, and the pixels in the real area are set as negative. At the same time, GroundTruth is downsampled to the feature size of the first stage. The features output by the first stage are used to calculate the similarity measure between each pair of pixels using dot product similarity. The obtained similarity feature map is constrained by BinaryCrossEntropy loss with GroundTruth. S4. Multi-level feature fusion decoding: Cascade the features of four scales and complete the feature fusion through channel and spatial dual attention; The multi-level feature fusion decoding is as follows: among the four features F1, F2, F3, F4, bilinear upsampling F2, F3, F4 to the size of F1, and cascading the features of the four scales, and fusion of the features of the four scales through channel attention and spatial attention. Channel attention links channel features and selectively emphasizes interdependent channel features. At the same time, spatial attention performs weighted summation of features at all positions, selectively updates the features at each position, adds the outputs of channel and spatial attention, converts them into H / 16*W / 16 size through 1x1 convolution, and outputs the full-size prediction map through bilinear upsampling and Sigmoid function; S5. Multiple loss functions jointly supervised: Finally, the prediction map obtained by decoding is output and subjected to pixel-level loss supervision with GroundTruth. The edge features and similarity feature maps of four sizes are subjected to pixel-level loss supervision with the corresponding down-sampled GroundTruth, and the three loss optimization networks are combined.

2. The image tampering detection method based on feature similarity and multi-scale edge attention according to claim 1, Features: The features extracted from the image are as follows: Process the image to obtain an RGB image of the same size as the network input. The input size is H×W, where W is the image width and H is the image height in pixels. The input image is passed through a restricted convolutional layer to obtain a noisy view, which is then fed into the backbone network together with the RGB image to extract features from different sources while sharing parameters. Four features of different scales are generated in the four extraction stages. .

3. The image tampering detection method based on feature similarity and multi-scale edge attention according to claim 2, It is characterized in that The specific steps of the multi-scale edge attention network are as follows: The first stage feature F1 is detected by an edge detector composed of Sobel operator and Laplace operator to obtain edge features , and then Obtain edge attention maps at different scales through 1x1 convolution, reshaping, and multiplication operations The features of the remaining stages are obtained by a detector composed of a Soble operator and a Laplace operator. , edge features The formula is: , in , represent Sobel operator and Laplace operator respectively, represents 1x1 convolution, ; Edge attention map The formula is: , in Reshape function. represents 1x1 convolution, represents matrix multiplication, ; The edge features of each stage are fused with the attention map, and the original features F1, F2, F3, and F4 are further fused through residual connections to obtain the intermediate features. The formula is: , in represents element-wise multiplication, ; The residual module of the Split-Transform-Merge structure is used to further mine fine-grained edge features, and finally the edge features of the four scales are integrated into the backbone network. The formula is: , in represents element-by-element addition, Residual module representing the Split-Transform-Merge structure, .

4. The image tampering detection method based on feature similarity and multi-scale edge attention according to claim 3, It is characterized in that The feature similarity learning is specifically as follows: GroundTruth is downsampled to the same size as the F1 feature using the nearest neighbor method; the feature F1 is embedded in the channel dimension using two embedding heads implemented by MLP. and ; Next, the feature map and the transposed feature map are dot-producted, and then each element is divided by the square root of the number of channels. The similarity measure between each pair of feature pixels is obtained through the Sigmoid function, and the size is: HW / 16, HW / 16. Similarity learning is implemented based on the similarity matrix. The specific implementation formula is as follows: , S represents the similarity feature matrix, and They represent the two embedding layers implemented by MLP, represents the Sigmoid function, and Respectively represent the pixel features at positions i, j and h, k. If they are all authentic or tampered with, then s=1, otherwise s=0; Using BinaryCrossEntropyLoss, the formula is as follows: , in and They represent the i-th pixel of the GroundTruth and similarity matrices respectively, and N is the number of pixels.

5. The image tampering detection method based on feature similarity and multi-scale edge attention according to claim 4, Features ,The objective function of similarity and multi-scale edge attention network is constructed as follows: Pixel segmentation loss Composed of Diceloss and WeightCrossEntropyLoss, pixel segmentation loss The calculation is as follows: , in represents a hyperparameter, set to 0.3, represents Diceloss, Represents the WeightCrossEntropyLoss loss function, which is calculated as follows: , in, , represents two different hyperparameter weights, , They represent the true value GroundTruth and the i-th pixel in the predicted image, respectively, and N is the number of pixels in the image; Combining pixel segmentation loss, edge loss, and similarity loss, the total loss function is defined as follows: , in, Represents BinaryCrossEntropyLoss loss, represents the DiceLoss loss, represents the pixel segmentation loss.

Citation Information

Patent Citations

  • Multi-view multi-scale image tampering detection method

    CN113989245A

  • Tampered video detection method and system based on multi-domain block feature mark point registration

    CN114693607A