Image tampering detection and positioning method based on multiple scales and attention
By using the multi-scale feature fusion and multi-attention mechanism of the EGANet network, the problem of insufficient image tampering localization accuracy in existing technologies is solved. It achieves efficient detection and accurate localization of unknown tampering types and complex scenes, and is suitable for practical applications in a variety of complex image scenarios.
Patent Information
- Application Number
- CN202511307719.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-12
- Publication Date
- 2026-02-13
AI Technical Summary
Existing technologies suffer from insufficient image tampering localization accuracy, limited feature generalization ability, and low computational efficiency when dealing with unknown tampering types, complex real-world scenarios, and data from multiple devices, making it difficult to meet the practical application needs of high-resolution images.
The EGANet network, which combines multi-scale feature fusion and multi-attention mechanism, improves the detection accuracy and robustness of tampered regions through a dual-branch collaborative architecture, including a backbone network and an auxiliary feature extraction branch, combined with a position encoder, a dual-gated cross module, an edge perception enhancement module, and a global attention fusion module.
It significantly improves the detection accuracy and robustness of tampered areas, enhances the ability to distinguish subtle tampering and complex backgrounds, reduces missed detections and false detections, is applicable to a variety of complex image scenarios, and has good adaptability and practical value.
Smart Images

Figure CN121527604A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of artificial intelligence and machine learning technology, specifically relating to image tampering detection in computer vision. More specifically, this invention proposes a deep learning-based image tampering detection and localization method, capable of pixel-level precise localization of image tampering behavior. It aims to improve the model's detection accuracy and generalization ability when handling unknown tampering types, complex real-world scenarios, and data from multiple devices. This method can be widely applied to various scenarios requiring the assurance of image authenticity and credibility. Background Technology
[0002] With the rapid development of digital image processing technology, image editing operations have become increasingly convenient. This has also made it possible for some internet users to maliciously tamper with and alter the true meaning of images. Such tampering is often highly covert and difficult to detect with the naked eye—from fine-tuning color space adjustments to targeted content editing, effects that are virtually imperceptible can be achieved. Once these carefully altered fake images spread in key areas such as news dissemination, political propaganda, or judicial evidence collection, they can easily trigger erroneous public opinion and a crisis of social trust, and even have a serious negative impact on social order and public morality. Therefore, developing reliable technical means to verify the authenticity of image content and accurately locate tampered areas is of paramount importance for maintaining information security and safeguarding social trust, and is also a core issue that urgently needs to be addressed in the field of multimedia security.
[0003] In the early stages of image tampering localization technology development, mainstream solutions were based on traditional manual feature analysis. The core of these methods is that researchers manually design and extract specific features from images to serve as the basis for tampering identification. While manually designed features have certain advantages in interpretability, their limitations are equally significant: first, they heavily rely on expert prior knowledge and numerous manual parameter settings; second, their generalization ability is severely insufficient when facing complex and varied tampering techniques and diverse image content; and third, the computational process is complex and inefficient, especially when processing high-resolution images, making it difficult to meet practical application needs. These fundamental shortcomings limit the effectiveness of traditional methods in dealing with increasingly complex and advanced tampering threats.
[0004] The rise of deep learning has brought groundbreaking progress to the field of image tampering localization. Deep learning-based methods, leveraging the powerful representation learning capabilities of neural networks, can automatically extract deep-level tampering traces from massive datasets, requiring little or no human intervention. This allows deep learning models to exhibit far superior generalization ability and robustness compared to traditional methods when handling typical tampering types. However, current deep learning-based image tampering localization technologies still face several challenges: First, the generalization ability of model training features is limited, leading to a significant drop in localization performance when faced with unknown tampering types, complex real-world scenarios, or data from different devices. Second, the localization accuracy of existing methods still has room for improvement, often exhibiting problems such as blurred boundaries of tampered areas, incomplete internal structures, or omission of small tampered areas. Third, the computational efficiency of existing models needs further improvement when processing high-resolution images. Summary of the Invention
[0005] This invention aims to overcome the shortcomings of existing technologies in handling unknown tampering types, complex real-world scenarios, and data from multiple devices, such as insufficient positioning accuracy and limited feature generalization ability. It proposes a novel image tampering localization method. Its core innovation lies in combining the advantages of multi-scale feature fusion strategies and multi-attention mechanisms. Through a unique dual-branch collaborative architecture, it significantly improves the sensitivity to tampering traces, the model's generalization ability in complex environments, and optimizes overall computational efficiency.
[0006] Specifically, this invention provides an image tampering detection and localization method based on multi-scale and attention, called EGANet network, which includes the following steps:
[0007] Step 1: Obtain the image to be detected as input and simultaneously feed it into the backbone network branch and the auxiliary feature extraction branch. The backbone network adopts an architecture based on an improved residual network. It processes the input image through convolution, batch normalization, activation functions, and pooling operations. Multiple residual modules extract deep semantic features at different levels to form a multi-scale basic feature set containing multi-resolution feature maps. A position encoder is added to this multi-scale basic feature part to improve the feature space location representation capability. The auxiliary feature extraction branch extracts the initial structural features of the image through multi-scale convolution operations. It upsamples and compares the extracted features to generate difference features that reflect changes in image structure. It also performs deep processing on the image difference features through a feature extraction unit that shares a structure with the backbone network to generate difference information. It calculates the global mean of the difference features and outputs it to assist in the localization of tampered images.
[0008] Step 2: The multi-scale basic features of the backbone network after positional encoding, and at least one multi-scale feature (initial structural feature) output by the auxiliary feature extraction branch through multi-scale convolution operation are jointly input into the dual-gated cross-module (DGC) for cross-branch feature interaction: First, the features of the two branches are aligned in spatial resolution, and then the feature interaction weights are dynamically adjusted through the dual-gated mechanism. Combined with confidence guarantee and dropout to suppress noise, after depthwise separable convolution modulation, the features are dynamically fused through the hybrid α mechanism to generate cross-branch fused features.
[0009] Step 3: Perform edge-aware enhancement processing on the deep semantic features and cross-branch fusion features extracted from the backbone network: perform edge detection on the features at each level through horizontal and vertical Sobel convolution kernels to generate edge response maps; input the edge response maps into the edge-aware enhancement module (EAEB, which includes convolution, batch normalization, ReLU activation function and CBAM attention mechanism) to obtain enhanced multi-scale edge features.
[0010] Step 4: Fusion and dimensionality reduction of the enhanced edge features: After splicing the multi-scale edge features, the channel dimension is compressed by dimensionality reduction to generate fused edge features; the edge attention module is used to construct the association mapping between deep semantic features and fused edge features, and attention weight allocation is realized through matrix multiplication and normalization function to generate edge-guided semantic features to assist in the localization of tampered images.
[0011] Step 5: Perform multi-scale feature fusion and attention optimization: Concatenate the difference information of the auxiliary feature extraction branch with the semantic features of the backbone network to form multi-scale fused features; input the fused features into the global attention fusion module (GAR-Head), first extract key features through convolutional blocks, and then use the GAM attention mechanism to optimize feature weights to enhance the accuracy of tampering region detection and localization.
[0012] Step 6, Output Tampering Detection Results: A tampering probability map is generated through the output layer of the global attention fusion module and upsampled to restore it to the input image size; at the same time, the global mean of edge-guided semantic features and differential features is output to assist in the localization of tampered regions; an end-to-end training method is adopted to jointly optimize the tampering detection loss and edge alignment loss, thereby improving the model's detection accuracy and robustness for tampered regions.
[0013] Compared with the prior art, the present invention has the following beneficial effects:
[0014] By combining multi-scale feature fusion with a multi-attention mechanism, the detection accuracy of tampered regions is improved, while the ability to distinguish subtle tampering and complex backgrounds is enhanced, resulting in significant comprehensive performance advantages.
[0015] By fusing multi-scale features from the auxiliary feature extraction branch with the backbone network improved by residual network, the richness and discriminativeness of features are enhanced, providing comprehensive feature support for the identification of tampered regions.
[0016] The DGC dual-gated cross-feature module is designed, which combines dual-gated dynamic screening of effective cross-branch features, suppresses noise interference through confidence guarantee and dropout, and uses a hybrid α mechanism to adaptively adjust the fusion ratio to achieve fine complementarity of cross-branch features, thus significantly enhancing feature discriminability.
[0017] Introducing a position encoder enhances spatial location representation and improves spatial positioning accuracy in tampered areas;
[0018] By introducing an edge perception enhancement module, the edge features of tampered areas can be accurately captured, the accuracy of boundary positioning can be enhanced, and the missed detections and false detections can be reduced.
[0019] By introducing an edge perception enhancement module, the edge features of tampered areas can be accurately captured, the accuracy of boundary positioning can be enhanced, and the missed detections and false detections can be reduced.
[0020] A global attention fusion module is introduced to generate a tampering probability map corresponding to the input image and output the edge detection results to achieve accurate localization of the tampered area;
[0021] The multi-attention mechanism works synergistically to adaptively focus on key features of the tampered area, suppress background interference, and improve the ability to identify complex tampering such as local replacement.
[0022] The overall structure adopts end-to-end joint optimization to ensure the coordination and consistency of each module, including feature extraction, edge perception enhancement and attention optimization, and improve the stability of the model under different tampering scenarios.
[0023] It is suitable for a variety of complex image scenarios and has good adaptability and practical value in practical applications such as image authenticity verification.
[0024] All parts not covered in this invention are the same as or can be implemented using existing technologies. Attached Figure Description
[0025] Figure 1 This is a diagram illustrating the detection steps of the method described in this invention.
[0026] Figure 2 This is a schematic diagram of the framework structure of the EGANet network described in this invention.
[0027] Figure 3 This is a diagram showing the internal structure of the Edge Awareness Enhancement Module (EAEB) proposed in this method.
[0028] Figure 4This is a diagram showing the internal structure of the Global Attention Fusion Module (GAR-Head) proposed in this method.
[0029] Figure 5 This is a diagram of the internal structure of the dual-gated cross module (DGC) proposed in this method. Detailed Implementation
[0030] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit this application.
[0031] This invention provides a method for image tampering detection and localization based on multi-scale and attention, constructing an end-to-end neural network model called EGANet, the overall framework of which is as follows: Figure 2 As shown. This method mainly includes the following five functional modules:
[0032] Multi-Scale Feature Extractor (MSFE) module F;
[0033] Feature Difference Constraint Module (FDCM) C;
[0034] Dual-Gated Cross (DGC) module;
[0035] Edge-AwareEnhancement Block (EAEB) module;
[0036] EdgeAttentionModule (EA);
[0037] Global Attention Fusion (GAR-Head).
[0038] Figure 1 As shown, the multi-scale and attention-based image tampering detection and localization method in this embodiment is implemented as follows:
[0039] S1: Input image
[0040] An input image of size B×3×H×W is input into the system (where B is the batch size, 3 is the number of RGB channels, and H and W are the image height and width). The input image is then fed into the image processing module.
[0041] S2: Data Augmentation
[0042] Realistic forgery features are generated using specific algorithms such as random copy-paste and image restoration, while conventional spatial and color transformations are combined to improve the model's generalization ability. A separate dual-channel processing method is employed; after enhancing the image itself, corresponding edge information is dynamically generated and processed simultaneously. Sample labels are dynamically adjusted based on pixels in the tampered area, providing high-quality and feature-consistent training data for the deepfake detection model. The augmented image is then used as input to the model, fed into two modules across two branches:
[0043] The multi-scale feature extraction module F is used to extract multi-scale deep semantic features (backbone network branches);
[0044] The feature difference constraint module C is used to extract structural difference information of the image (auxiliary feature extraction branch).
[0045] S3: EGANet network
[0046] 1: Multi-scale feature extraction module F
[0047] This module is used for multi-scale feature extraction of images. It employs an improved residual network as the backbone network and extracts features through the following steps:
[0048] The input image is processed through convolutional layers, batch normalization, ReLU activation, and max pooling to obtain deep semantic features;
[0049] Multi-scale features are extracted from four residual block groups, and four feature maps F1-F4 at different scales are output (with resolutions of 1 / 4, 1 / 8, 1 / 16, and 1 / 16 of the input image, respectively). These correspond to different resolutions and form a multi-scale feature set. A position encoder is added to at least one multi-scale feature to provide a semantic basis for subsequent edge enhancement and attention fusion.
[0050] 2: Feature Difference Constraint Module C
[0051] Enhanced sensitivity to subtle changes in tampered regions through feature differences, structured as a process Figure 5 As shown, it specifically includes:
[0052] Multi-scale features: Multi-scale features are extracted from the input image through convolutional blocks with multiple convolutional operations, and the initial structural features C1-C4 of the output image are obtained (where C1 is a shallow feature, C4 is a deep feature, and the resolution of C1-C4 decreases sequentially with increasing layer depth).
[0053] Feature difference calculation: The deepest feature C4 is upsampled twice in a hierarchical manner so that its resolution is consistent with that of the middle feature C2. The absolute difference between the two is calculated to generate the difference feature C that reflects the structural changes.
[0054] Differential Feature Interaction: The initial structural features of the image are fed into a feature extraction network that shares a structure with the branches of the backbone network, and the differential information CF4 is output.
[0055] Auxiliary loss constraint: The global mean of the difference feature C and the main branch feature EA output by the subsequent edge attention module are both used as output results and input into the loss function for loss calculation. The loss guides the model to pay attention to the subtle feature changes in the tampered region.
[0056] 3: Dual-gated cross module D
[0057] This is used to enable cross-branch feature interaction between the multi-scale feature extraction module and the feature difference constraint module, specifically including:
[0058] The input consists of the multi-scale basic features processed by the position encoder in module F and at least one multi-scale feature extracted by the multi-scale convolution operation in module C.
[0059] Feature alignment: The resolution of the features in module C is adjusted to match the scale of the position-encoded features at the corresponding level in module F;
[0060] Dual-gated filtering: The features of the multi-scale feature extraction module and the feature difference constraint module are weighted and filtered by spatial attention gate and channel attention gate respectively to highlight key information;
[0061] Dynamic fusion: Convolution makes the feature dimensions of each branch the same. Combining the confidence guarantee mechanism and depth-separable convolution modulation, feature cross-complementation is achieved by mixing α weights, and the fused feature D is output to enhance the feature discriminativeness of the tampered region.
[0062] 4: Edge Attention Enhancement Module (EE)
[0063] This module is used to enhance edge information in feature maps, and includes edge detection and enhancement modules:
[0064] Edge detection: The multi-scale deep semantic features of F1-F4 output by module F that have not been processed by module D, and the corresponding hierarchical fusion features output by module D, are used to calculate the edge response through predefined horizontal and vertical Sobel convolution kernels to generate edge feature maps.
[0065] Edge Enhancement: Each edge feature map is processed by an Edge Aware Enhancement Module (EAEB), which includes convolution, batch normalization, ReLU activation, and incorporates the CBAM attention mechanism from the EAEB module to enhance key edge features, outputting enhanced edge features EE1-EE4. The process is as follows: Figure 3 As shown;
[0066] Multi-scale edge fusion: EE2-EE4 are upsampled to the same resolution as EE1 through bilinear interpolation, and then stitched together and reduced in dimensionality by a convolutional layer to obtain the fused edge feature E, thus integrating multi-scale edge information.
[0067] 5: Edge Attention Module (EA)
[0068] This module is used to fuse deep semantic features and edge features to enhance the ability to detect tampering edges:
[0069] The inputs are F4 output from the F module (if F4 has been processed by the dual-gated cross module, it is replaced by the fusion feature D corresponding to the F4 scale output from the dual-gated cross module) and the fusion edge feature E output from the EE module;
[0070] The input features are mapped to an intermediate dimension (e.g., 256 channels) through a feature mapping network, and the feature similarity matrix is calculated and normalized to obtain the edge-semantic attention weights.
[0071] Based on the attention weights, F4 (or the corresponding fusion feature D) is weighted and updated to generate edge-guided semantic features EA. The EA is used to assist in calculating the edge loss, so as to guide the model to optimize the learning of tampered edges and strengthen the representation of tampered edges in deep semantic features (not directly used to generate predicted tampered images).
[0072] 6: Global Attention Fusion Module G
[0073] This module is used to fuse multi-source features and output the final tamper location result. Its structure and flow are as follows: Figure 4 As shown, the specific process is as follows:
[0074] Feature concatenation: The F4 output by the F module (if the F4 has been processed by the dual-gated cross module, it is replaced with the fused feature D of the corresponding F4 scale output by the dual-gated cross module) is concatenated with the difference information CF4 of the auxiliary feature extraction branch to form a multi-scale fusion feature input module.
[0075] Feature dimensionality reduction and extraction: Multi-scale fused features are reduced to the intermediate channel through continuous convolution (including batch normalization and ReLU activation function), which preserves key semantic information and edge features while compressing dimensionality;
[0076] GAM Attention Enhancement: The GAM attention mechanism is applied to enhance the feature weights of key semantic channels through the channel attention submodule, while the spatial attention submodule focuses on the spatial location of the tampered area, adaptively enhancing the global features related to the tampering.
[0077] Output layer: After being mapped by the convolutional layer and processed by the dropout layer (to suppress overfitting), a tampering probability map is generated and output. At the same time, the global mean of edge detection results and differential features is output to assist in the localization of the tampered region.
[0078] S4: Predicting Location Tampering
[0079] The tamper probability map generated by the global attention fusion module is upsampled to restore the input image size to generate a predicted tamper location map.
[0080] S5: Model Optimization and Inference
[0081] The model employs an end-to-end multi-loss function joint optimization strategy, using the following loss functions:
[0082] Pixel-level loss (L seg Dice loss calculation is used to improve the model's sensitivity to pixel-level tampering detection by targeting the 1 / 4 to 1 / 16 resolution features output by the multi-scale feature extraction module of this invention.
[0083] Edge loss (L edg Dice loss calculation, combined with the enhanced edge features output by the edge awareness enhancement module (EAEB) of this invention, is used to learn semantic diagnostic features;
[0084] Edge reconstruction loss (L redg ): MSE loss is used to better capture the visual attributes of the tampered region based on the difference features output by the feature difference constraint module of this invention.
[0085] Image-level loss (L clf Based on BCE loss, it is used for image-level real and fake classification tasks. Combined with the global features output by the global attention fusion module of this invention, it is used to improve the detection specificity of the model for whole-image tampering (such as whole-image replacement) and make up for the lack of pixel-level loss for global judgment.
[0086] The total loss is: L total =λ seg ·L seg +λ clf ·L clf +λ edg ·L edg +λ redg ·L redg .
[0087] Where λ seg , λ clf , λ edg , λ redgThe weights are weight coefficients used to balance the synergistic effect of various loss functions in order to adapt to the comprehensive needs of pixel-level localization, edge features, and global judgment in image tampering detection. The weight values can be routinely adjusted according to specific training data and scenarios.
[0088] Training parameters: The Adam optimizer and ResNet50 backbone network were used during training. The initial learning rate was 1e-4. The training data was taken from a selected subset of the public dataset Casiav2 to ensure data diversity and coverage of tampering scenarios.
[0089] Inference process: Load the pre-trained EGANet network model, read the input image and convert it to RGB format, and uniformly scale it to the specified size; generate a tampering probability map through forward propagation of the model; finally, restore the tampering probability map to the original image size and output the final result in PNG format.
[0090] Application scenarios: The trained model can be directly used for tamper detection and localization. It is suitable for verifying the authenticity of news and social media images in digital forensics and verifying the integrity of electronic documents in government and judicial fields. It can accurately identify tampered areas and provide a reliable basis for judging the authenticity of images.
[0091] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions will not cause the essence of the corresponding technical solutions to deviate from the spirit and protection scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for image tampering detection and localization based on multi-scale and attention, characterized in that, Includes the following steps: 1) Obtain the image to be detected as the input image; 2) Multi-branch feature extraction steps: The image to be detected is input into the backbone network branch and the auxiliary feature extraction branch. The backbone network branch extracts deep semantic features at different levels of the image to form a multi-scale basic feature set. At least one feature of the multi-scale basic feature set is processed by a position encoder to improve the spatial representation capability of the feature. The auxiliary feature extraction branch extracts the initial structural features of the image through multi-scale convolution operations, generates difference features through upsampling and feature comparison, and performs deep processing on the difference features to extract information containing key structural differences. The global mean of the difference features is calculated and the result is output to assist in tamper localization. 3) Branch Feature Interaction: The multi-scale basic features encoded by position in the backbone network branches and at least one multi-scale feature (initial structural feature) output by the auxiliary feature extraction branches through multi-scale convolution operations are jointly input into the dual-gated cross-module (DGC) for cross-branch feature interaction. First, the features of the two branches are aligned in spatial resolution. Then, attention processing is performed on the features of the two branches through a dual-gating mechanism to highlight key information. Then, the channel number of the features of the two branches is aligned through convolution operations. After that, combined with confidence margin and dropout to suppress noise, after depthwise separable convolution modulation, cross-branch fused features are generated through dynamic feature fusion. 4) Edge perception enhancement step: Perform edge detection on the deep semantic features and cross-branch fusion features output by the backbone network branches that have not undergone branch feature interaction, and generate edge response maps; input the edge response maps into the edge perception enhancement module (EAEB, which includes convolution, batch normalization, ReLU activation function and CBAM attention mechanism) to obtain enhanced multi-scale edge features; 5) Edge feature fusion and attention mapping steps: After unifying the resolution of multi-scale edge features, they are stitched together and dimensionality reduced to generate fused edge features; the association mapping between deep semantic features and fused edge features is constructed through the edge attention module to generate edge-guided semantic features to assist in calculating edge loss; 6) Multi-source feature fusion and optimization steps: The difference information after deep processing of the auxiliary feature extraction branch is concatenated with the semantic features of the backbone network to form multi-scale fusion features; the fusion features are input into the global attention fusion module (GAR-Head), key features are extracted through convolution operation, and the feature weights are optimized using the GAM attention mechanism; 7) Output steps for tampering results: The output layer of the global attention fusion module generates a tampering probability map, which is then upsampled to restore the input image size. At the same time, the global mean of the semantic features and differential features calculated by the edge guide is output to assist in localization. Through end-to-end training, multiple loss functions are used to jointly optimize the model parameters to achieve the localization of the tampered area.
2. The method according to claim 1, characterized in that: The dual-gated cross-feature module (DGC) in step 3) specifically involves first acquiring the multi-scale basic features output from the backbone network branch in step 2) and processed by the position encoder, as well as at least one multi-scale feature extracted by the auxiliary feature extraction branch in step 2) through multi-scale convolution. Then, the aforementioned position-encoded multi-scale basic features and at least one multi-scale feature from the auxiliary feature extraction branch are input into the dual-gated cross-feature module (DGC) for cross-branch feature interaction. During interaction, the spatial resolution of the features from each participating branch is first aligned. Then, attention processing is applied to the features of the two branches using a dual-gated mechanism to highlight key information. Next, convolution operations are used to align the channel numbers of the two branch features (ensuring consistent feature dimensions). Subsequently, a confidence baseline strategy and dropout operations are combined to suppress noise interference. The noise-suppressed features are modulated using depthwise separable convolution to enhance key information. Finally, cross-branch fusion features are generated through dynamic feature fusion. These cross-branch fusion features will be used for edge detection processing in the edge perception enhancement step in step 4).
3. The method according to claim 1, characterized in that: The edge perception enhancement module in step 4) includes a convolutional layer, a batch normalization layer, and a ReLU activation function connected in sequence. A CBAM attention mechanism is embedded after the convolutional layer. The output of the attention mechanism is then added to the module input (edge response map) as a residual, and finally output through the ReLU activation function. The CBAM attention mechanism includes a channel attention branch and a spatial attention branch. The channel attention branch compresses the feature channels through global average pooling and obtains the channel weights through the convolutional layer. The spatial attention branch generates a dual-channel feature map through average pooling and max pooling in the channel dimension, and then calculates the spatial weights through the convolutional layer. The channel weights and spatial weights are applied to the edge response map in sequence to output enhanced multi-scale edge features.
4. The method according to claim 1, characterized in that, The specific processing steps of the edge attention module in step 5) include: inputting deep semantic features output from the backbone network branches (if branch feature interaction is performed, it is replaced by fused features of the corresponding scale output by branch feature interaction) and fused edge features output in step 4); mapping the deep semantic features and fused edge features to the same intermediate dimension through a feature mapping network; calculating the similarity matrix of the mapped features and obtaining the edge-semantic attention weights through a normalization function; and weighting and summing the deep semantic features and the edge-semantic attention weights to generate edge-guided semantic features to assist in calculating the edge loss.
5. The method according to claim 1, characterized in that, The Global Attention Fusion Module (GAR-Head) in step 6) comprises multiple sets of convolutional blocks, a Global Attention Mechanism (GAM), and an output layer connected in sequence. The module input consists of multi-scale fusion features pre-formed through feature concatenation. Each convolutional block comprises a convolutional layer, a batch normalization layer, and a ReLU activation function. Two consecutive sets of convolutional blocks reduce the dimension of the concatenated multi-scale fusion features to a preset number of intermediate channels. The Global Attention Mechanism (GAM) includes a channel attention submodule and a spatial attention submodule. The channel attention submodule generates channel attention weights through convolutional layers for channel compression and recovery and sigmoid activation, enhancing the features of key semantic channels. The spatial attention submodule generates spatial attention weights through parallel convolutional layers for expanding the receptive field and for channel adjustment, strengthening the spatial localization of the tampered region. The output layer includes convolutional layers for dimension mapping and a dropout layer, used to output the feature mapping of the tampering probability map.
6. The method according to claim 1, characterized in that, The multi-scale basic feature set extracted by the backbone network branch in step 2) includes feature maps at four levels, with resolutions of 1 / 4, 1 / 8, 1 / 16, and 1 / 16 of the input image, respectively. These feature maps provide a multi-scale semantic foundation for subsequent edge perception enhancement and attention mapping. The auxiliary feature extraction branch shares some convolution parameters with the backbone network branch, takes the differential features of the extracted image as input to generate differential information, and then concatenates it with the semantic features of the backbone network before inputting it into the global attention fusion module.
7. The method according to claim 1, characterized in that, The multiple loss functions mentioned in step 7) include: Pixel-level loss (L seg ): Dice loss is used to measure the pixel-level difference between the predicted mask and the true mask; Edge loss (L edg ): Dice loss is used to calculate and measure the difference between the predicted edge and the true edge; Edge reconstruction loss (L redg ): The MSE loss is used to measure the difference between the feature reconstruction result and the preset benchmark feature; Image-level loss (L clf ): Based on BCE loss calculation, it is used for image-level real / fake classification tasks; The total loss is: L total =λ seg ·L seg +λ clf ·L clf +λ edg ·L edg +λ redg ·L redg ; Where λ seg , λ clf , λ edg , λ redg The weight is the weighting coefficient.
Citation Information
Cited By
SAR ship detection method and system based on hierarchical attention fusion and edge enhancement
CN121962936A