Image tampering location method, computer device and storage medium

By combining the frequency-adaptive Transformer module and the KNN local density peak clustering algorithm, efficient and accurate localization of tampered regions is achieved, solving the problem of difficult feature extraction in copy, move and delete operations in existing technologies, and improving the adaptability and accuracy of the model.

CN120411749BActive Publication Date: 2026-01-06GUANGDONG INST OF SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510905261.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-02
Publication Date
2026-01-06
Estimated Expiration
2045-07-02

AI Technical Summary

Technical Problem

Existing image tampering detection methods struggle to effectively locate tampered areas during copying, moving, and deletion operations. In particular, feature extraction is difficult due to the similarity in noise and texture patterns between the tampered and original areas. Furthermore, methods relying on fixed-frequency signals lack adaptability across different images.

Method used

By employing a frequency-adaptive Transformer module combined with the KNN local density peak clustering algorithm, and generating tampered prototype markers through multi-scale feature extraction and marker weighted aggregation, the tampered region is focused layer by layer, and the positioning head is gradually fused with preset markers to achieve accurate positioning.

Benefits of technology

It improves the positioning accuracy and robustness of the tampered area, and is highly adaptable to different complex scenarios, accurately identifying the tampered area and reducing redundant information interference.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120411749B_ABST
    Figure CN120411749B_ABST
Patent Text Reader

Abstract

The application provides an image tampering positioning method, a computer device and a storage medium. The method comprises the following steps: inputting image data to be detected; processing the image data to be detected by using a preset frequency adaptive Transformer module stacked by a preset number of stages, to obtain output feature markers of each stage; using a preset prototype learning module to cluster and then weightedly aggregate the output feature markers from the previous stage by using a KNN local density peak value clustering algorithm between any two adjacent stages of the preset frequency adaptive Transformer module, to obtain tampering prototype markers, and taking the tampering prototype markers as the input of the next stage; and using a preset marker gradual fusion positioning head to fuse the output feature markers of all stages and the tampering prototype markers of all preset prototype learning modules, to generate a prediction image of a tampering region positioning. The application can efficiently generate tampering image markers and accurately position the tampering region.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image tampering technology, specifically to an image tampering location method, a computer device using the image tampering location method, and a computer-readable storage medium using the image tampering location method. Background Technology

[0002] The rapid development of image processing technology has brought powerful editing tools that allow users to modify images in ways that are almost imperceptible to the human eye. These tools, such as scaling, blurring, and contrast adjustment, offer convenience, entertainment, and aesthetic enhancement, benefiting even non-professionals.

[0003] Existing image processing techniques can be broadly categorized into three types: (1) copy-and-move, which involves copying and repositioning objects within the same image; (2) stitching, which involves inserting the content of a donor image into a source image; and (3) deletion, which involves deleting specific areas and replacing them with visually plausible content. Techniques such as rotation, scaling, and edge blurring often conceal traces of forgery, making the image appear more realistic. Furthermore, tampered images are typically stored in lossy compression formats, further masking manipulation artifacts. Despite these efforts, forensic traces (e.g., statistical inconsistencies and boundary artifacts) often remain and serve as key evidence for tamper detection.

[0004] Image forensics methods are generally divided into traditional techniques based on fixed assumptions and deep learning models that do not rely on such assumptions. While traditional methods can effectively detect specific types of tampering using handcrafted features, they struggle to cope with increasingly complex operations in the real world. To overcome these limitations, researchers have leveraged advances in computer vision (CV) to develop image tampering detection and localization (IML) models based on deep neural networks (DNNs). These models utilize convolutional neural networks (CNNs), object detection, and semantic segmentation techniques, which excel at extracting tampering features due to their powerful representational capabilities. To enhance tampering detection in the spatial domain, researchers employed four main strategies: (1) image preprocessing techniques using tools such as rich model filters (SRMs) and Bayar convolutions to extract high-frequency noise features; (2) boundary artifact enhancement to highlight inconsistencies in edge textures; (3) forensic attention modules to enhance tampering traces; and (4) supervised contrastive learning to highlight the presentation differences between forged and original regions. While these methods are effective for stitching, they often encounter difficulties in copy-and-move and deletion operations due to the similarity of noise and texture patterns between the tampered and original regions during copy-and-move, and the loss of texture or edges during deletion operations. Relying solely on spatial domain features limits the effectiveness of the model. Compared to spatial domain inconsistencies, tampering causes significant changes in the frequency domain, affecting both high-frequency (e.g., texture and noise patterns) and low-frequency (e.g., semantic and contextual features) components. Although these changes are subtle, they provide valuable clues for tampering detection. Recent advances in DNN-based IML models have incorporated frequency domain analysis. Methods such as Discrete Cosine Transform (DCT) preprocessing convert images into frequency domain representations, enabling bi-branch extractors to handle both spatial and frequency features. However, relying on fixed-frequency signals presents two major challenges: (1) cutoff frequency variations between different images; and (2) frequency changes caused by operations, which depend on the type, region, and content of the operation. To overcome these challenges, an adaptive frequency attention mechanism is needed to dynamically align with the frequency characteristics of individual images, thereby achieving robust and accurate operation detection. The Vision Transformer (ViT) has achieved significant success in computer vision (CV), inspiring exploration of its potential in image processing hierarchy (IML). The original Transformer treats an image as a sequence of tokens, dividing them into a fixed grid and assigning equal importance to each token. While this approach is effective for general CV tasks, it is less suitable for IML because tampered regions typically occupy only a small portion of the image, resulting in underrepresentation of these critical regions. This imbalance reduces ViT's ability to effectively locate tampered regions.

[0005] Therefore, more optimized methods for image tampering detection and localization need to be considered. Summary of the Invention

[0006] The first objective of this invention is to provide an image tampering localization method that can efficiently generate tampered image tags and accurately locate tampered regions by utilizing the frequency feature differences caused by tampering and a tag-weighted aggregation strategy.

[0007] A second objective of this invention is to provide a computer device that can efficiently generate tampered image markers and accurately locate tampered regions by utilizing frequency feature differences caused by tampering and a marker-weighted aggregation strategy.

[0008] A third objective of this invention is to provide a computer-readable storage medium that can efficiently generate tampered image markers and accurately locate tampered regions by utilizing frequency feature differences caused by tampering and a marker-weighted aggregation strategy.

[0009] To achieve the aforementioned first objective, the image tampering localization method provided by the present invention includes: inputting image data to be detected; processing the image data to be detected using a preset number of stacked preset frequency adaptive Transformer modules to obtain output feature labels for each stage, wherein the output feature labels include multi-scale spatial features and frequency features; between any two adjacent stages in the preset frequency adaptive Transformer modules, using a preset prototype learning module to cluster and weight-aggregate the output feature labels from the previous stage in the preset frequency adaptive Transformer module using a KNN-based local density peak clustering algorithm to obtain tampering prototype labels, and using the tampering prototype labels as input to the next stage in the preset frequency adaptive Transformer module; and using a preset label progressive fusion localization head to fuse the output feature labels of all stages of the frequency adaptive Transformer module and the tampering prototype labels of all preset prototype learning modules to generate a predicted image of the tampered region.

[0010] As can be seen from the above scheme, the image tampering localization method of the present invention simultaneously captures the spatial structure and frequency components of the image through the frequency adaptive Transformer module, covering the core clues of tampering detection. Multi-scale features are extracted using multi-scale convolutional clusters and average pooling clusters to adapt to tampering regions of different sizes, avoiding detail loss or semantic ambiguity at a single scale. The prototype learning module selects high-value features through a weighted strategy, and then generates tampering prototype markers through clustering, eliminating redundant background information and refining typical tampering features. The prototype markers from the previous stage serve as input for the next stage, guiding the network to focus on tampering-related features layer by layer, improving the targeting of feature expression. Shallow features retain pixel-level details, while deep features extract semantic-level patterns. A pre-defined marker progressive fusion localization head is used to cascade and fuse the output feature markers of all stages and the tampering prototype markers of all pre-defined prototype learning modules, avoiding the separation of details and semantics during single-stage fusion. By progressively fusing features and prototype markers from each stage, the model can gradually refine from "coarse-grained suspected regions" to "pixel-level precise boundaries," preserving fine-grained details, thereby accurately locating tampering regions.

[0011] In a further scheme, the step of inputting the image data to be detected includes: performing a convolution operation on the image data to be detected, and linearly mapping it to the input dimension of the preset frequency adaptive Transformer module.

[0012] This shows that there is a difference in the input dimension between the original image and the frequency-adaptive Transformer module. The convolution operation adjusts the number of channels to make the image data compatible with the computational logic of the frequency-adaptive Transformer module, thus avoiding computational interruption or feature loss due to dimension mismatch.

[0013] In a further scheme, each stage of the preset frequency adaptive Transformer module includes multiple cascaded frequency adaptive Transformer layers; each frequency adaptive Transformer layer includes a preset parallel frequency adaptive attention block and a forward propagation block, and performs the following steps: obtain the full-frequency attention features, high-frequency filtering features, and low-frequency filtering features of the input label corresponding to the current frequency adaptive Transformer layer through the preset parallel frequency adaptive attention block; perform pixel addition on the full-frequency attention features, high-frequency filtering features, and low-frequency filtering features to obtain multi-frequency fusion features; process the multi-frequency fusion features using forward propagation to obtain the output feature label of the current frequency adaptive Transformer layer.

[0014] As can be seen, the frequency adaptive Transformer layer obtains multi-frequency fusion features by pixel addition of full-frequency attention features, high-frequency filtering features, and low-frequency filtering features, and embeds high-frequency and low-frequency components into multi-head self-attention to enhance the tampered feature representation, thereby improving feature representation and localization accuracy.

[0015] In a further scheme, the steps of obtaining the full-frequency attention features, high-frequency filtering features, and low-frequency filtering features of the input label corresponding to the current frequency adaptive Transformer layer through a preset parallel frequency adaptive attention block include: processing the input label using a pyramid vision-based full-frequency attention mechanism to obtain full-frequency attention features; converting the input label into a feature map, inputting the feature map into a set of multi-scale convolutions to simulate high-pass filtering to obtain high-frequency filtered data, and performing a dot product between the high-frequency filtered data and the Q-value in the full-frequency attention mechanism to obtain high-frequency filtered features; and performing a set of multi-scale average pooling operations on the feature map to simulate low-pass filtering to obtain low-frequency filtered features.

[0016] Therefore, by constructing a feature pyramid through hierarchical pooling, the self-attention heads of different layers can simultaneously capture high-frequency details (such as tampered edges) and low-frequency semantics (such as region consistency), achieving contextual modeling across the entire frequency range. Inputting the feature map into a set of multi-scale convolutions simulates high-pass filtering; convolution kernels of different sizes are equivalent to high-pass filters with different cutoff frequencies, capturing features of tampering at different spatial frequencies. Multi-scale average pooling simulates low-pass filtering, effectively preserving the overall structural information of the image.

[0017] In a further scheme, the steps of using a preset prototype learning module to cluster and weight-aggregate the output feature labels from the previous stage in the preset frequency adaptive Transformer module using the KNN local density peak clustering algorithm to obtain the tampered prototype label include: performing one-dimensional convolution on the output feature labels from the previous stage to obtain the first label after channel dimensionality upscaling; performing dimensionality transformation from label to feature map, two-dimensional convolution, and feature map to label on the first label after channel dimensionality upscaling in sequence to obtain the second label; performing pixel addition on the first label and the second label to obtain the first tampered prototype label; clustering the first tampered prototype label based on the KNN local density peak clustering algorithm, and performing channel-weighted aggregation on the cluster centers to generate the second tampered prototype label.

[0018] Therefore, by combining one-dimensional convolution for dimensionality enhancement and two-dimensional convolution for spatial feature modeling, the channel-dimensional semantic enhancement and spatial structure feature capture of the labeled sequence are achieved. This ensures that the generated tampering prototype labels simultaneously contain global semantic information and local spatial dependencies, enhancing the richness of feature representation. Pixel addition is used to fuse the first and second labels, avoiding information loss from single operations. Furthermore, weight allocation strengthens key features (such as high-frequency edges or low-frequency texture anomalies in the tampered region), making the fused features more discriminative and facilitating subsequent clustering to distinguish tampered from non-tampered regions. The clustering method based on the KNN local density peak clustering algorithm does not require a preset number of clusters and can automatically identify the cluster centers of tampering prototypes based on data distribution, adapting to tampering pattern changes in various complex scenarios and improving algorithm robustness. Channel-dimensional weighted aggregation of the cluster centers dynamically allocates weights based on the contribution of each channel feature to tampering detection, making the final generated second tampering prototype label more accurately represent the core features of the tampering pattern and reducing redundant information interference.

[0019] In a further scheme, the preset label progressive fusion localization head includes a preset number of progressive label fusion blocks, with one progressive label fusion block corresponding to one stage of a preset frequency adaptive Transformer module. The steps of using the preset label progressive fusion localization head to fuse the output feature labels of all stages and the tampering prototype labels of all preset prototype learning modules to generate a predicted image of the tampered region include: fusing the output feature labels of each stage of the preset frequency adaptive Transformer module and the corresponding tampering prototype labels using progressive label fusion blocks to obtain a fused feature map; concatenating the fused feature map of the previous level with the fused feature map of the next level after upsampling and standard convolution, and inputting it into the next level for upsampling and standard convolution; and predicting the fused feature map output by the last level to obtain a predicted image of the tampered region.

[0020] Thus, each progressive label fusion block corresponds to a stage of the frequency-adaptive Transformer module, fusing features at different levels of abstraction (from shallow details to deep semantics) with the tampering prototype label of the corresponding stage, making the feature representation closer to the known tampering pattern.

[0021] In a further scheme, the steps of fusing the output feature labels of each stage of the preset frequency adaptive Transformer module and the corresponding tampered prototype labels using a progressive label fusion block to obtain a fused feature map include: performing dimensional transformation from label to feature map, concatenation, and two-dimensional convolution operations on the tampered prototype labels sequentially to obtain a first feature map; performing residual enhancement on the first feature map using a residual module to obtain an enhanced feature map; performing dimensional transformation from label to feature map on the output feature labels of the current stage to obtain a second feature map; and performing pixel addition on the enhanced feature map and the second feature map to obtain a fused feature map.

[0022] As can be seen, the progressive label fusion block transforms the tampering pattern hidden in the prototype into a feature map that can directly interact with the output feature label by sequentially performing dimensional transformation, splicing and two-dimensional convolution on the tampered prototype label, thereby eliminating the rosemary effect. Then, the residual module performs residual enhancement on the first feature map, restoring more feature map details and enhancing the model's expressive power.

[0023] To achieve the second objective of the present invention, the present invention provides a computer device including a processor and a memory, the memory storing a computer program, which, when executed by the processor, implements the steps of the above-described image tampering location method.

[0024] To achieve the third objective of the present invention, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a controller, implements the steps of the above-described image tampering location method. Attached Figure Description

[0025] Figure 1 This is a flowchart of an embodiment of the image tampering location method of the present invention.

[0026] Figure 2 This is a schematic diagram of the structure of the image tampering localization model in an embodiment of the image tampering localization method of the present invention.

[0027] Figure 3 This is a schematic diagram of the structure of the convolutional layer in an embodiment of the image tampering location method of the present invention.

[0028] Figure 4 This is a schematic diagram of the structure of the frequency adaptive Transformer layer in an embodiment of the image tampering localization method of the present invention.

[0029] Figure 5 This is a schematic diagram of the structure of the parallel frequency adaptive attention block in an embodiment of the image tampering localization method of the present invention.

[0030] Figure 6 This is a schematic diagram of the prototype learning module in an embodiment of the image tampering location method of the present invention.

[0031] Figure 7 This is a schematic diagram of the structure of the marker fusion block in an embodiment of the image tampering location method of the present invention.

[0032] Figure 8 This is a schematic diagram of the structure of the marker progressive fusion positioning head in an embodiment of the image tampering positioning method of the present invention.

[0033] Figure 9 This is a schematic diagram of the progressive marker fusion block in an embodiment of the image tampering location method of the present invention.

[0034] The present invention will be further described below with reference to the accompanying drawings and embodiments. Detailed Implementation

[0035] The image tampering location method of the present invention is an application program in a computer device used to detect and locate the tampered area of ​​a tampered image.

[0036] Example of image tampering location method:

[0037] like Figure 1 As shown, the image tampering location method of this embodiment first executes step S1, inputting the image data to be detected. When it is necessary to detect and locate image tampering, the image data to be detected can be read from the storage device.

[0038] In this embodiment, the step of inputting the image data to be detected includes: performing a convolution operation on the image data to be detected, linearly mapping it to the input dimension of a preset frequency-adaptive Transformer module. Since the original image and the input dimension of the frequency-adaptive Transformer module differ, the convolution operation adjusts the number of channels to make the image data compatible with the computational logic of the frequency-adaptive Transformer module, avoiding computational interruptions or feature loss due to dimension mismatch.

[0039] When performing convolution operations on the image data to be detected, such as Figure 2 As shown, convolutional layer 1 is used to convolve the image data to be detected. For a size of... The image data to be detected is linearly mapped to a size of by convolutional layer 1 using convolution operations. , represented as For details, see [link / reference]. Figure 3 The image data to be detected is obtained through two-dimensional convolution and reshaping. .

[0040] After inputting the image data to be detected, step S2 is executed. A preset number of stacked preset frequency adaptive Transformer modules are used to process the image data, obtaining output feature labels for each stage. These output feature labels include multi-scale spatial features and frequency features. Between any two adjacent stages in the preset frequency adaptive Transformer module, a preset prototype learning module uses a KNN-based local density peak clustering algorithm to cluster and weight the output feature labels from the previous stage in the preset frequency adaptive Transformer module, obtaining tampering prototype labels. These tampering prototype labels are then used as input to the next stage in the preset frequency adaptive Transformer module. The number of stages in the preset frequency adaptive Transformer module can be set as needed; in this embodiment, there are four stages.

[0041] Each stage of the preset frequency adaptive Transformer module includes multiple cascaded frequency adaptive Transformer layers (AFTs). In this embodiment, the first stage includes N1 cascaded frequency adaptive Transformer layers (AFTs), the second stage includes N2 cascaded frequency adaptive Transformer layers (AFTs), the third stage includes N3 cascaded frequency adaptive Transformer layers (AFTs), and the fourth stage includes N4 cascaded frequency adaptive Transformer layers (AFTs). The number of layers in each stage can be preset based on experimental data. Preferably, the first stage includes 3 frequency adaptive Transformer layers (AFTs), the second stage includes 8 frequency adaptive Transformer layers (AFTs), the third stage includes 27 frequency adaptive Transformer layers (AFTs), and the fourth stage includes 3 frequency adaptive Transformer layers (AFTs).

[0042] In this embodiment, see Figure 4 Each frequency-adaptive Transformer layer includes a first input terminal 21, a second input terminal 22, a preset parallel frequency-adaptive attention (PAFA) module 23, a forward propagation layer 24, and an output terminal 25. The first input terminal 21 and the second input terminal 22 are used to acquire the label sequence. The preset parallel frequency-adaptive attention block 23 is used to acquire the full-frequency attention features, high-frequency filtering features, and low-frequency filtering features of the input label corresponding to the current frequency-adaptive Transformer layer, and to perform pixel addition on the full-frequency attention features, high-frequency filtering features, and low-frequency filtering features to obtain multi-frequency fusion features.

[0043] In this embodiment, each frequency adaptive Transformer layer performs the following steps: obtaining the full-frequency attention features, high-frequency filtering features, and low-frequency filtering features of the input label corresponding to the current frequency adaptive Transformer layer through a preset parallel frequency adaptive attention block; performing pixel addition on the full-frequency attention features, high-frequency filtering features, and low-frequency filtering features to obtain multi-frequency fusion features; and processing the multi-frequency fusion features using forward propagation to obtain the output feature label of the current frequency adaptive Transformer layer.

[0044] In this embodiment, the steps of obtaining the full-frequency attention features, high-frequency filtering features, and low-frequency filtering features of the input label corresponding to the current frequency adaptive Transformer layer through a preset parallel frequency adaptive attention block include: processing the input label using a pyramid vision-based full-frequency attention mechanism to obtain full-frequency attention features; converting the input label into a feature map, inputting the feature map into a set of multi-scale convolutions to simulate high-pass filtering to obtain high-frequency filtered data, performing a dot product between the high-frequency filtered data and the Q value in the full-frequency attention mechanism to obtain high-frequency filtered features; and performing a set of multi-scale average pooling operations on the feature map to simulate low-pass filtering to obtain low-frequency filtered features.

[0045] For details, see Figure 5 The input labels at the first input terminal 21 are processed by a linear layer to obtain the Q value. The input labels at the second input terminal 22 are processed by a spatial compression layer and a linear layer to obtain the K and V values. A full-frequency attention mechanism based on pyramid vision is used to process the Q, K, and V values ​​to obtain full-frequency attention features. The input labels at the second input terminal 22 are also processed sequentially by a linear layer, labels to feature maps, and a ReLU function to obtain a feature map F. The feature map F is then input into a set of multi-scale convolutions to simulate high-pass filtering, obtaining high-frequency filtered data. In this embodiment, there are four convolution kernels with kernel sizes of 1x1, 3x3, 5x5, and 7x7. The high-frequency filtered data is concatenated along the channel dimension of the feature map F, and finally, a dot product is performed with the Q value in the full-frequency attention mechanism to obtain high-frequency filtered features. Simultaneously, the feature map F is processed by a set of multi-scale average pooling operations to simulate low-pass filtering, and then interpolated and concatenated to obtain low-frequency filtered features. In this embodiment, four sets of average pooling groups are used for low-pass filtering, with average pooling groups of 1x1, 2x2, 3x3, and 6x6. The full-frequency attention features, high-frequency filtering features, and low-frequency filtering features are pixel-wise added to obtain multi-frequency fused features. After obtaining the multi-frequency fused features, they are processed through the forward propagation layer 24 to obtain the output feature label of the current frequency adaptive Transformer layer.

[0046] It should be noted that in the first stage of the preset frequency adaptive Transformer module, Output feature tags are generated using a 3-layer frequency adaptive converter layer (AFT). (dimension is) In the first frequency adaptive converter layer (AFT) of the second, third, and fourth stages, the input markers at the first input terminal 21 and the second input terminal 22 have two different inputs, namely the output from the previous stage preset prototype learning module. In other frequency adaptive converter layers (AFTs), the input markers of the first input terminal 21 and the second input terminal 22 have two identical inputs, namely, the output from the previous frequency adaptive converter layer (AFT). .

[0047] In this embodiment, see Figure 6 and Figure 7 The method utilizes a pre-defined prototype learning module and the KNN local density peak clustering algorithm to cluster and weight-aggregate the output feature labels from the previous stage in a pre-defined frequency adaptive Transformer module to obtain tampered prototype labels. The steps include: performing a one-dimensional convolution on the output feature labels from the previous stage to obtain a first label after channel-level dimensionality upscaling; sequentially performing a token-to-map dimensionality transformation, a two-dimensional convolution, and a map-to-to-token dimensionality transformation on the first label to obtain a second label; performing pixel addition on the first and second labels to obtain a first tampered prototype label; and clustering the first tampered prototype label using the KNN local density peak clustering algorithm, and then performing channel-weighted aggregation on the cluster centers to generate a second tampered prototype label. By combining one-dimensional convolution dimensionality upscaling and two-dimensional convolution spatial feature modeling, the method achieves channel-level semantic enhancement and spatial structure feature capture of the label sequence, enabling the generated tampered prototype labels to simultaneously contain global semantic information and local spatial dependencies, thus enhancing the richness of feature representation. By fusing the first and second markers through pixel addition, information loss from single operations is avoided. Simultaneously, key features are strengthened through weight allocation, making the fused features more discriminative and facilitating subsequent clustering to distinguish tampered from non-tampered regions. The clustering method based on the KNN local density peak clustering algorithm does not require a preset number of clusters and can automatically identify the cluster centers of tampered prototypes based on data distribution, adapting to tampering pattern changes in various complex scenarios and improving algorithm robustness. Channel-dimensional weighted aggregation of cluster centers dynamically allocates weights based on the contribution of each channel's features to tamper detection, ensuring that the final generated second tampered prototype marker more accurately represents the core features of the tampering pattern and reduces redundant information interference.

[0048] Depend on Figure 2As can be seen, in this embodiment, there are three preset prototype learning modules. The first preset prototype learning module will adapt the preset frequency to the first stage output of the Transformer module. Reshape into two list of tags and The subsequent second, third, and fourth stages process the tampered prototype tags from the previous preset prototype learning module in sequence to generate... , and . , and The spatial reduction steps correspond to the input resolutions of 8, 16, and 32, respectively.

[0049] After obtaining the output feature labels of all stages and the tampered prototype labels of all preset prototype learning modules, step S3 is executed, which uses the preset label progressive fusion positioning head to fuse the output feature labels of all stages of the frequency adaptive Transformer module and the tampered prototype labels of all preset prototype learning modules to generate a predicted image of the tampered region.

[0050] See Figure 8 The preset marker progressive fusion positioning head includes a preset number of progressive marker fusion blocks 41, and one progressive marker fusion block 41 corresponds to one stage of a preset frequency adaptive Transformer module. In this embodiment, the number of progressive marker fusion blocks 41 is four.

[0051] The steps for generating a predicted image of the tampered region by fusing the output feature labels of all stages and the tampered prototype labels of all preset prototype learning modules using a preset labeled progressive fusion localization head include: fusing the output feature labels of each stage of the preset frequency adaptive Transformer module and the corresponding tampered prototype labels using a progressive label fusion block 41 to obtain a fused feature map; concatenating the fused feature map of the previous level with the fused feature map of the next level after upsampling and standard convolution, and inputting it into the next level for upsampling and standard convolution; and predicting the fused feature map output from the last level to obtain a predicted image of the tampered region. Each progressive label fusion block 41 corresponds to a stage of the frequency adaptive Transformer module, fusing features of different abstraction levels (from shallow details to deep semantics) with the tampered prototype labels of the corresponding stage, making the feature representation closer to the known tampering pattern.

[0052] In this embodiment, see Figure 9The steps for fusing the output feature labels of each stage of the preset frequency adaptive Transformer module and the corresponding tampered prototype labels using progressive label fusion block 41 to obtain a fused feature map include: sequentially performing dimensionality transformation from label to feature map, concatenation, and two-dimensional convolution operations on the tampered prototype labels to obtain the first feature map. The residual module is used to process the first feature map. Residual enhancement is performed to obtain an enhanced feature map; the output feature labels of the current stage are transformed into a feature map dimension to obtain a second feature map. Enhance the feature map and the second feature map. Pixel addition is performed to obtain a fused feature map. The progressive label fusion block 41 transforms the tampered prototype label by performing dimensionality transformation, concatenation, and two-dimensional convolution on the tampered prototype label in sequence, transforming the tampering pattern hidden in the prototype into a feature map that can directly interact with the output feature label, eliminating the rosemary effect. Then, the residual module performs residual enhancement on the first feature map to restore more feature map details and enhance the model's expressive power.

[0053] As described above, the image tampering localization method of this invention simultaneously captures the spatial structure and frequency components of an image through a frequency-adaptive Transformer module, covering the core clues of tampering detection. Multi-scale features are extracted using multi-scale convolutional clusters and average pooling clusters, adapting to tampered regions of different sizes and avoiding detail loss or semantic ambiguity at a single scale. The prototype learning module uses a weighted strategy to filter high-value features, then generates tampering prototype markers through clustering, eliminating redundant background information and refining typical tampering features. The prototype markers from the previous stage serve as input for the next stage, guiding the network to focus on tampering-related features layer by layer, improving the targeting of feature expression. Shallow features retain pixel-level details, while deep features extract semantic-level patterns. A pre-defined marker progressive fusion localization head is used to cascade and fuse the output feature markers of all stages and the tampering prototype markers of all pre-defined prototype learning modules, avoiding the separation of details and semantics during single-stage fusion. By progressively fusing features and prototype markers from each stage, the model can gradually refine from "coarse-grained suspected regions" to "pixel-level precise boundaries," preserving fine-grained details and thus accurately locating tampered regions.

[0054] Computer device embodiment:

[0055] The computer device in this embodiment includes a controller, which executes a computer program to implement the steps in the above-described image tampering location method embodiment.

[0056] For example, a computer program can be divided into one or more modules, one or more of which are stored in memory and executed by a controller to perform the present invention. One or more modules can be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in a computer device.

[0057] A computer device may include, but is not limited to, a controller and memory. Those skilled in the art will understand that a computer device may include more or fewer components, or a combination of certain components, or different components; for example, a computer device may also include input / output devices, network access devices, buses, etc.

[0058] For example, a controller can be a Central Processing Unit (CPU), or other general-purpose controllers, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose controller can be a microcontroller or any conventional controller. The controller is the control center of a computer device, connecting all parts of the computer device through various interfaces and lines.

[0059] The memory can be used to store computer programs and / or modules. The controller implements various functions of the computer device by running or executing the computer programs and / or modules stored in the memory, and by accessing data stored in the memory. For example, the memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound receiving function, sound-to-text function, etc.), etc.; the data storage area may store data created based on the use of the mobile phone (such as audio data, text data, etc.). In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, RAM, plug-in hard disk, SmartMediaCard (SMC), Secure Digital (SD) card, FlashCard, at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0060] Examples of computer-readable storage media:

[0061] If the modules integrated into the computer device in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the above-described image tampering location method embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a controller, it can implement the steps of the above-described image tampering location method embodiments. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The storage medium can include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content contained in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.

[0062] It should be noted that the above are only preferred embodiments of the present invention, but the design concept of the invention is not limited thereto. Any non-substantial modifications made to the present invention using this concept also fall within the protection scope of the present invention.

Claims

1. An image tampering localization method, characterized in that, The method comprises the following steps: inputting image data to be detected; processing the image data to be detected by using a preset frequency adaptive Transformer module stacked by a preset number of stages, to obtain output feature labels of each stage, wherein the output feature labels comprise multi-scale spatial features and frequency features; each stage of the preset frequency adaptive Transformer module comprises a plurality of cascaded frequency adaptive Transformer layers, each frequency adaptive Transformer layer comprises a preset parallel frequency adaptive attention block and a forward propagation block, and the following steps are performed: obtaining full-frequency attention features, high-frequency filtering features and low-frequency filtering features of input labels corresponding to the current frequency adaptive Transformer layer by using the preset parallel frequency adaptive attention block, and performing pixel addition on the full-frequency attention features, the high-frequency filtering features and the low-frequency filtering features to obtain multi-frequency fusion features; processing the multi-frequency fusion features by using forward propagation to obtain output feature labels of the current frequency adaptive Transformer layer; between any two adjacent stages of the preset frequency adaptive Transformer module, using a preset prototype learning module to use a KNN local density peak clustering algorithm to cluster and then weightedly aggregate output feature labels from a previous stage in the preset frequency adaptive Transformer module, to obtain tampering prototype labels, and using the tampering prototype labels as input of a next stage in the preset frequency adaptive Transformer module; using a preset label progressive fusion positioning head to fuse the output feature labels of all stages of the preset frequency adaptive Transformer module and the tampering prototype labels of all preset prototype learning modules, to generate a predicted image of a tampering region. The step of using a preset prototype learning module to use a KNN local density peak clustering algorithm to cluster and then weightedly aggregate output feature labels from a previous stage in the preset frequency adaptive Transformer module to obtain tampering prototype labels comprises the following steps: performing one-dimensional convolution on the output feature labels of the previous stage to obtain first labels with upgraded channels; sequentially performing label-to-feature map dimension conversion, two-dimensional convolution and feature map-to-label dimension conversion on the first labels with upgraded channels to obtain second labels; performing pixel addition on the first labels and the second labels to obtain first tampering prototype labels; clustering the first tampering prototype labels based on the KNN local density peak clustering algorithm, and performing channel weighted aggregation on the cluster centers to generate second tampering prototype labels.

2. The image tampering positioning method according to claim 1, wherein the step of inputting image data to be detected comprises: performing convolution operation on the image data to be detected to linearly map it to an input dimension of the preset frequency adaptive Transformer module. ​ 3. The image tampering positioning method of claim 2, characterized in that: the step of obtaining the full-frequency attention feature, the high-frequency filtering feature and the low-frequency filtering feature of the input mark corresponding to the current frequency adaptive Transformer layer through the preset parallel frequency adaptive attention block comprises: processing the input mark by using the full-frequency attention mechanism based on the pyramid vision to obtain the full-frequency attention feature; converting the input mark into a feature map, inputting the feature map into a group of multi-scale convolution to simulate high-pass filtering to obtain high-frequency filtering data, and performing dot product between the high-frequency filtering data and the Q value in the full-frequency attention mechanism to obtain the high-frequency filtering feature; performing a group of multi-scale average pooling operations on the feature map to simulate low-pass filtering to obtain the low-frequency filtering feature.

4. The image tampering positioning method of any one of claims 1 to 3, characterized in that: the preset mark progressive fusion positioning head comprises the preset number of progressive mark fusion blocks, and one progressive mark fusion block corresponds to one stage of the preset frequency adaptive Transformer module; the step of generating the predicted image of the tampered region by fusing the output feature mark of all stages and the tampering prototype mark of all preset prototype learning modules using the preset mark progressive fusion positioning head comprises: fusing the output feature mark of each stage of the preset frequency adaptive Transformer module and the corresponding tampering prototype mark using the progressive mark fusion block to obtain a fusion feature map; performing upsampling and standard convolution on the fusion feature map of the previous stage, splicing the fusion feature map of the previous stage with the fusion feature map of the next stage, and inputting the fusion feature map of the next stage to perform upsampling and standard convolution; predicting the fusion feature map output by the last stage to obtain the predicted image of the tampered region.

5. The image tampering positioning method of claim 4, characterized in that: the step of fusing the output feature mark of each stage of the preset frequency adaptive Transformer module and the corresponding tampering prototype mark using the progressive mark fusion block to obtain a fusion feature map comprises: performing mark-to-feature map dimension conversion, splicing and two-dimensional convolution operations on the tampering prototype mark in sequence to obtain a first feature map; performing residual enhancement on the first feature map by using a residual module to obtain an enhanced feature map; performing mark-to-feature map dimension conversion on the output feature mark of the current stage to obtain a second feature map; performing pixel addition on the enhanced feature map and the second feature map to obtain the fusion feature map.

6. A computer apparatus comprising a processor and a memory, characterized in that: The memory stores a computer program, and the computer program is executed by the processor to implement the steps of the image tampering positioning method of any one of claims 1 to 5.

7. A computer readable storage medium having stored thereon a computer program, characterized in that: The computer program is executed by the controller to implement the steps of the image tampering positioning method of any one of claims 1 to 5.

Citation Information

Patent Citations

  • Small tampering region positioning method based on multi-information guidance and progressive mask Transform

    CN117876704A

  • Method for enhancing image operation positioning by generating text prompt through large language model

    CN120182561A