Anti-forensic image tampering method, device and storage medium
The image tampering method using dynamic weights and cross-scale feature consistency constraints solves the problems of missing collaboration among multi-scale features and insufficient scene adaptability, achieving visually realistic and difficult-to-obtain image tampering effects, thus improving the practicality of image tampering.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HARBIN INST OF TECH
- Filing Date
- 2026-01-16
- Publication Date
- 2026-05-29
AI Technical Summary
Existing image tampering methods based on diffusion models lack coordination among multi-scale features and have poor adaptability to different tampering scenarios, resulting in insufficient visual realism and resistance to forensic analysis of the generated images.
By constructing an execution process of dynamic constraint scheduling, cross-scale fusion, and bidirectional guidance, and utilizing dynamic weights and cross-scale feature consistency constraints, the collaborative fusion of multi-scale features is achieved. Combined with Laplacian pyramid decomposition and gradient descent optimization, visually realistic tampered images that are difficult to detect by forensic tools are generated.
It improves the visual consistency and resistance to forensic analysis of image tampering, ensures the synergy and scene adaptability of generated images across multiple scale features, and enhances the practicality and ease of use of image tampering.
Smart Images

Figure CN122116099A_ABST
Abstract
Description
Technical Field
[0001] This application relates to a method for resisting forensic image tampering, an electronic device, and a computer-readable storage medium, belonging to the field of digital image processing. Background Technology
[0002] With the popularization of digital image editing technology, the information security problems caused by image tampering are becoming increasingly serious. Anti-forensic image tampering technology aims to generate visually realistic tampering results that are difficult to detect by forensic tools. Its core challenge lies in balancing three mutually restrictive goals: content fidelity, visual consistency, and forensic concealment.
[0003] While image manipulation methods based on Generative Adversarial Networks (GANs) can generate visually plausible content, they suffer from pattern collapse and training instability. Furthermore, residual GAN-specific statistical features (such as high-frequency artifacts) in the generated images are easily detected by specially designed forensic tools. In contrast, image manipulation methods based on diffusion models, which generate images through a step-by-step denoising process, exhibit significantly higher visual fidelity than GAN-based methods.
[0004] However, in current related technologies, the image tampering methods based on diffusion models are not well adapted to different constraints in different tampering scenarios. When image features have obvious multi-scale characteristics, since the features at each scale are both relatively independent and mutually influential, the image tampering methods based on diffusion models do not independently impose constraints on each scale feature, resulting in a lack of coordination between multi-scale features. Summary of the Invention
[0005] This application discloses a method for resisting forensic image tampering, an electronic device, and a computer-readable storage medium.
[0006] The anti-forensic image tampering method in the embodiments of this application includes: Based on the image to be tampered with and the target tampering conditions, the image tampering task parameters are determined, wherein the image tampering task parameters include initial dynamic weights; Based on the current noisy image and the image tampering task parameters, the current dynamic weight of the current iteration step is updated to set the constraint optimization strategy for the current iteration step, wherein the current noisy image is obtained by tampering with the image to be tampered with through one or more iteration steps; Based on the current noisy image, the current dynamic weights, the image to be tampered with, and the image tampering task parameters, the total energy loss of the current iteration step and the image features after boundary processing are determined in order to set a collaborative strategy for multi-scale features; Based on the current noisy image, the total energy loss of the current iteration step, the current dynamic weights, and the image tampering task parameters, image tampering is performed to determine the current noisy image for the next iteration step.
[0007] In some implementations, determining the image tampering task parameters based on the image to be tampered with and the target tampering conditions includes: Based on the image to be tampered with, a tampering mask is determined to mark the area of the image to be tampered with; Based on the target tampering conditions, determine the tampering condition vector; Based on the image to be tampered with and the target tampering conditions, auxiliary image feature parameters of the image to be tampered with are obtained.
[0008] In some implementations, determining the image tampering task parameters based on the image to be tampered with and the target tampering conditions further includes: The initial dynamic weights are determined based on the image to be tampered with and the target tampering conditions. Based on the image texture of the image to be tampered with, determine the number of scales, cross-scale constraint weights, and scale boundary thresholds; Based on preset prior data, the energy guiding intensity and initial fusion coefficient are determined, wherein the prior data is determined based on the historical execution of the method; The total number of iteration steps is determined based on the balance between execution quality and execution efficiency when performing tampering on the image to be tampered with; Based on the image to be tampered with, the tampering mask, and the tampering condition vector, a tampering scene feature vector and a tampering scene type label are determined using a pre-trained scene classification model to clarify the tampering task type.
[0009] In some implementations, updating the current dynamic weights for the current iteration step based on the current noisy image and the image tampering task parameters to set the constraint optimization strategy for the current iteration step includes: Based on the tampered scene feature vector, the current noisy image, and the tampering condition vector, calculate the constraint error corresponding to each item in the current dynamic weight of the current iteration step to determine the output error feature vector; Perform sinusoidal position encoding based on the number of iterations corresponding to the current iteration step to determine the time feature vector; Based on a preset weighted scheduling network, the current dynamic weight of the current iteration step is updated and determined according to the tampered scene feature vector, the output error feature vector, and the time feature vector.
[0010] In some implementations, determining the total energy loss of the current iteration step and the image features after boundary processing based on the current noisy image, the current dynamic weights, the image to be tampered with, and the image tampering task parameters, in order to set a collaborative strategy for multi-scale features, includes: Based on Laplacian pyramid decomposition, the current noisy image is split into a first-scale feature representation vector, a second-scale feature representation vector, and a third-scale feature representation vector. Based on the first scale feature representation vector and the second scale feature representation vector, a first consistency constraint is determined to ensure that the pixel distribution conforms to the texture pattern. Based on the second-scale feature representation vector and the third-scale feature representation vector, a second consistency constraint is determined to ensure that the local texture conforms to the scene semantics; The total energy loss is determined based on the output error feature vector, the cross-scale constraint weights, the tampering condition vector, the first consistency constraint, and the second consistency constraint. Based on the edge gradient of the tampered region in the current noisy image, the edge gradient of the corresponding region in the image to be tampered with, a boundary processing strategy is determined to obtain the image features after boundary processing.
[0011] In some implementations, the step of updating and determining the current dynamic weights of the current iteration step based on the current noisy image and the image tampering task parameters to set the constraint optimization strategy for the current iteration step further includes: If the total energy loss exceeds a preset threshold, the network parameters of the weight scheduling network are updated based on gradient descent to limit the total energy loss and improve the scenario adaptability of the weight scheduling network.
[0012] In some implementations, the step of performing image manipulation based on the current noisy image, the total energy loss of the current iteration step, the current dynamic weights, and the image manipulation task parameters to determine the current noisy image for the next iteration step includes: Based on the total energy loss, determine the first energy gradient that meets the physical constraints; Based on a pre-trained noise prediction network, a second energy gradient conforming to the statistical laws of natural images is determined according to the current noise image of the current iteration step and the output error feature vector. Based on the preset reference noise vector and the noise prediction network, the fusion coefficients in the current iteration step are updated and determined. The fusion gradient parameters are determined based on the fusion coefficient, the first energy gradient, and the second energy gradient. Based on the fusion gradient parameters, image manipulation is performed to determine the current noisy image for the next iteration step.
[0013] In some implementations, the step of performing image manipulation based on the fusion gradient parameters to determine the current noisy image for the next iteration includes: Based on the fusion gradient parameters and the energy guidance intensity, the noise prediction vector of the current iteration step is corrected to determine the noise prediction correction vector, wherein the noise prediction vector is obtained by the noise prediction network performing prediction in the current iteration step; Based on a preset denoising function, the current noise image for the next iteration step is determined according to the noise prediction correction vector and the current noise image of the current iteration step.
[0014] The electronic device in this application includes a memory and a processor. The memory stores a computer program, and when the computer program is executed by the processor, the anti-forensic image tampering method in the above-described embodiments is implemented.
[0015] The computer-readable storage medium in the embodiments of this application stores a computer program that, when executed by one or more processors, implements the anti-forensic image tampering method in the above embodiments.
[0016] The beneficial effects of this application are: the anti-forensic image tampering method in the embodiments of this application constructs an execution flow of dynamic constraint scheduling-cross-scale fusion-bidirectional guidance to execute image tampering, realizes the scenario-based adaptive allocation of constraint weights, and establishes a multi-scale feature association fusion mechanism by utilizing the consistency constraints of cross-scale features. Furthermore, it utilizes bidirectional guidance to realize the synergy between physical constraints and scale data driving, thereby improving the practicality and ease of use of anti-forensic image tampering. Attached Figure Description
[0017] Figure 1 This is one of the flowcharts illustrating the anti-forensic image tampering method in the embodiments of this application; Figure 2 This is the second flowchart illustrating the method for resisting forensic image tampering in the embodiments of this application; Figure 3 This is the third flowchart illustrating the anti-forensic image tampering method in the embodiments of this application; Figure 4 This is the fourth flowchart illustrating the anti-forensic image tampering method in the embodiments of this application; Figure 5 This is the fifth flowchart illustrating the anti-forensic image tampering method in the embodiments of this application; Figure 6 This is the sixth flowchart illustrating the anti-forensic image tampering method in the embodiments of this application; Figure 7 This is the seventh flowchart illustrating the anti-forensic image tampering method in the embodiments of this application. Detailed Implementation
[0018] Please see Figure 1 The anti-forensic image tampering method in the embodiments of this application includes the following steps: Step 01: Determine the image tampering task parameters based on the image to be tampered with and the target tampering conditions. The image tampering task parameters include initial dynamic weights.
[0019] Specifically, the anti-forensic tampering method in this application is an image tampering method based on a diffusion model. It executes the anti-forensic image tampering method in the above embodiments based on a pre-trained image tampering model based on the diffusion model.
[0020] In some examples, firstly, image data to be tampered with that meets the model input requirements and the corresponding target tampering conditions are obtained. Based on the image to be tampered with and the corresponding target tampering conditions, the parameters of the image tampering model are initialized, thereby adapting each parameter to the aforementioned target tampering conditions to form the image tampering task parameters. The image tampering task parameters include at least a set of initial dynamic weights, which comprises multiple weight values corresponding to multiple physical constraint characteristics of the image, such as image content, image noise, image texture, and the corresponding semantic information of the image, as shown in Formula 1.
[0021] ………… Formula 1 in The above are the initial dynamic weights. As the initial content weight, As the initial noise weights, As the initial texture weights, This represents the initial semantic weights.
[0022] The initial dynamic weights described above represent the image tampering strategies for different characteristics, and the sum of all weight values in each initial dynamic weight is 1. The initial dynamic weights directly determine the emphasis of each constraint in the first iteration. For example, for tampering with face images, the initial semantic weight should be set to the highest value to prioritize semantics in the strategy. The initial dynamic weights are the starting point for dynamic weight scheduling in subsequent iterations. The dynamic weights updated in each subsequent iteration are adjusted in the image adjustment direction represented by the initial dynamic weights, taking into account scene, error, and temporal information, thereby ensuring that the image tampering optimization process gradually converges from the initial direction adapted to the scene.
[0023] Further, please refer to Figure 2 Step 01 specifically includes: Step 011: Determine the tampering mask based on the image to be tampered with, so as to mark the area of the image to be tampered with; Step 012: Determine the tampering condition vector based on the target tampering conditions; Step 013: Based on the image to be tampered with and the target tampering conditions, obtain the auxiliary image feature parameters of the image to be tampered with.
[0024] Please refer to further information. Figure 3 In some implementations, step 01 further includes: Step 014: Determine the initial dynamic weights based on the image to be tampered with and the target tampering conditions; Step 015: Determine the number of scales, cross-scale constraint weights, and scale boundary thresholds based on the image texture of the image to be tampered with; Step 016: Determine the energy guiding intensity and initial fusion coefficient based on the preset prior data, wherein the prior data is determined based on the historical execution of the method; Step 017: Determine the total number of iteration steps based on the balance between execution quality and execution efficiency when performing tampering on the image to be tampered with; Step 018: Based on the image to be tampered with, the tampering mask, and the tampering condition vector, determine the tampering scene feature vector and the tampering scene type label based on the pre-trained scene classification model to clarify the tampering task type.
[0025] It should be noted that, Figure 2 as well as Figure 3 The execution order of each step is only a flowchart illustration; there are no restrictions on the specific execution order. Specifically, the parameters for the image tampering task include other parameters besides the initial dynamic weights. The specific parameters and their corresponding determination methods are as follows: Based on the image to be tampered with and the corresponding tampering task, a tampering mask can be generated. The purpose of the tampering mask is to mark the areas to be tampered with on the image. For example, for face image tampering, it marks the face area, and for outdoor image tampering that needs to fill in the sky, it marks the area where the sky is missing.
[0026] Based on the target tampering conditions, conditional coding models (such as the CLIP model) in current related technologies can transform these conditions into feature vectors (corresponding to tampering condition vectors) that the image tampering model can recognize. For example, based on the above example, for a face image tampering task, the target tampering conditions correspond to the target face features, so the CLIP model can be used to convert the target face features into a tampering condition vector. As another example, based on the above example, for an outdoor image tampering task that requires filling in the sky, the target tampering conditions correspond to the natural sky image features that will be filled into the image, and the CLIP model can be used to further convert these natural sky image features into a tampering condition vector.
[0027] Next, by combining the image to be tampered with and the target tampering conditions, key information for the tampering task can be extracted, and the extracted information can be saved as auxiliary image feature parameters of the image to be tampered with. For example, in the example above, multiple key points at the facial contour in the image to be tampered with can be extracted, and multiple key points at the boundary of the sky area can be extracted from the outdoor image to be tampered with.
[0028] The initial dynamic weights have been explained in detail above and will not be repeated here.
[0029] Based on the image texture information of the image to be tampered with, the initial settings are set for the number of scales, cross-scale constraint weights, and scale boundary thresholds. The number of scales primarily defines the number of subsequent multi-scale decomposition layers, determining the precision of multi-scale feature collaboration. A larger number of scales results in more precise multi-scale feature capture and better resolution of issues such as "pixel-texture breaks" and "texture-semantic conflicts," but also increases computational cost. Cross-scale constraint weights are mainly used to adjust the strength of cross-scale consistency constraints relative to basic constraints such as content, noise, texture, and semantics. This balances single-constraint optimization with multi-scale collaboration. If the cross-scale constraint weights are too small, pixel matching may occur with texture conflicts; conversely, if the weights are too large, content distortion may result (i.e., excessive pursuit of multi-scale consistency at the expense of basic constraints). The scale boundary thresholds are used to classify the edge type of the tampered region (e.g., soft edges or sharp edges) to determine the selection rules for mixed boundary conditions. The scale boundary threshold directly affects the naturalness of the fusion between the tampered area and the image to be tampered with. When the scale boundary threshold is too large, it is easy to misjudge soft edges as sharp edges, while when the scale boundary threshold is too small, it is easy to misjudge sharp edges as soft edges.
[0030] Based on the historical running data of the image tampering model (corresponding to the preset prior data), the current energy guidance strength and initial fusion coefficient can be set. The energy guidance parameter is mainly used to control the correction strength of the physical constraint gradient on noise prediction. Its role is to balance the anti-forensic effect and visual realism. If the energy guidance parameter is too large, the physical constraints will be too strong, which may make the image texture unnatural, resulting in an overly harsh visual effect. If the energy guidance parameter is too small, the physical constraints will be insufficient, and it will be easy to leave traces of forensic evidence after image tampering, such as unnatural noise distribution in the image. The initial fusion coefficient is mainly used to determine the initial weight ratio of the prior gradient in the early stage of iteration. During the iteration process, the value of the fusion coefficient is gradually reduced from the initial fusion coefficient to achieve a gradual denoising effect. In the early stage of iteration, the proportion of the prior gradient is higher than that of the physical constraint gradient to ensure visual realism, while in the later stage of iteration, the proportion of the prior gradient is lower than that of the physical constraint gradient to rely on the physical constraint gradient to ensure the anti-forensic effect.
[0031] Furthermore, considering the goal of progressive denoising and the balance between execution quality and efficiency in image tampering, the total number of iteration steps can be initialized. The total number of iteration steps represents the time frame of the entire iteration process; each iteration step completes dynamic weight scheduling, cross-scale constraints, gradient fusion, and image updating. A larger total number of iteration steps results in more refined optimization at each step, stronger visual consistency and resistance to forensic analysis in the tampered image, and thus higher execution quality, but longer processing time per image. Conversely, a smaller total number of iteration steps results in higher execution efficiency, but the tampered image may exhibit rough texture or residual forensic traces. Regarding the interaction between the total number of iteration steps and the aforementioned parameters, for example, when the total number of iteration steps is increased, the number of scales can be appropriately increased and the energy guidance intensity reduced, depending on the actual situation. This improves the optimization refinement at multiple scales while avoiding excessive physical constraints, thereby balancing the execution quality and efficiency of image tampering.
[0032] It's also important to note that, due to the underlying logic of the diffusion model, the iteration step number decreases progressively during the iterative image manipulation process, corresponding to the reverse denoising process in image processing. For example, if the total number of iterations is 50, the iteration step number is 50 in the first iteration, 49 in the second iteration, and 1 in the last iteration.
[0033] Furthermore, based on the image to be tampered with and the obtained tampering mask and tampering condition vector, by calling the pre-trained ResNet-50 scene classification model and referring to the tampering condition vector, feature extraction can be performed on the image to be tampered with and the corresponding tampering mask to generate the corresponding tampering scene feature vector, as shown in Formula 2.
[0034] ………… Formula 2 in, To tamper with scene feature vectors, This represents the total number of scene categories, which include scenes such as "face replacement," "sky fill," and "image detail restoration." The name of each scene is the corresponding tampering scene type label.
[0035] Furthermore, based on the tampering scene feature vector or the tampering scene type label, the image tampering model can further identify the specific task type and load the initial dynamic weights corresponding to that scene. The main function of the tampering scene feature vector and the tampering scene type label is to enable the image tampering model to clearly understand the current image tampering task type, thereby providing a scene basis for the subsequent dynamic weight adjustment process and avoiding mismatch between the actual image tampering process and the image tampering task.
[0036] At this point, the initialization process of the image tampering model is complete, and the image tampering will then begin to be executed iteratively in sequence.
[0037] Please continue reading Figure 1 The anti-forensic image tampering method in the embodiments of this application further includes: Step 02: Based on the current noisy image and the image tampering task parameters, update and determine the current dynamic weights for the current iteration step to set the constraint optimization strategy for the current iteration step. The current noisy image is obtained by modifying the image to be modified through one or more iterations.
[0038] Specifically, once the image tampering model is initialized, the image tampering model starts from the image to be tampered, which is a pure noisy image, and performs image tampering through a gradual denoising process of several iterations, eventually generating a clear tampered image. The execution logic of each iteration step is consistent. The following will use one iteration step as an example for explanation.
[0039] For example, let the number of iterations corresponding to the current iteration step be . t First, dynamic weight scheduling is performed to set the constraint optimization strategy for the current iteration step. This strategy mainly includes the setting of the priority of each constraint. The inputs for this step mainly include the tampered scene feature vector, the tampered condition vector, and the current noisy image determined at the end of the previous iteration step.
[0040] For details on the specific implementation of dynamic weight scheduling, please refer to [link / reference] in some implementation methods. Figure 4 Step 02 specifically includes: Step 021: Based on the tampered scene feature vector, the current noisy image, and the tampered condition vector, calculate the constraint error corresponding to each item in the current dynamic weight of the current iteration step to determine the output error feature vector; Step 022: Perform sinusoidal position encoding based on the iteration number corresponding to the current iteration step to determine the time feature vector; Step 023: Based on the preset weight scheduling network, update and determine the current dynamic weight of the current iteration step according to the tampered scene feature vector, output error feature vector and time feature vector.
[0041] Specifically, based on the tampered scene feature vector, the current noisy image, and the tampered condition vector, the algorithm is then applied to the current iteration step. t The errors corresponding to the four basic constraints of image content, image noise, image texture, and the corresponding semantics are calculated, and these errors are concatenated into an output error feature vector. Content error Content error refers to the matching degree between the tampered region in the current noisy image and the content of the image to be tampered with. For example, in a face image tampering task, content error refers to the matching error between the pose of the replaced face and the pose of the face in the image to be tampered with. Noise error This refers to the consistency error between the tampered region in the current noisy image and the noise distribution in the image to be tampered with. Texture error. This refers to the coherence error between the texture of the tampered region in the current noisy image and the surrounding Beijing area. Semantic error. This refers to the semantic consistency error between the tampered region in the current noisy image and the image tampering scenario. For example, in a face image tampering task, the semantic error refers to the identity consistency error that occurs after face replacement. The errors corresponding to the above four basic constraints can be calculated by the image tampering model according to the calculation methods in current related technologies, and this application does not impose specific limitations.
[0042] Then, by concatenating the errors corresponding to the four basic constraints according to the format of the initial dynamic weights, the output error feature vector in the current iteration step is formed. Specifically, as shown in Formula 3.
[0043] ………… Formula 3 Next, the number of iterations corresponding to the current iteration step is numbered using methods such as sinusoidal position encoding. tThis is transformed into a time feature vector, thereby injecting temporal information into the dynamic weight adjustment process. This allows for the adjustment of the weights corresponding to each constraint based on the guidance of the temporal information, such as the number of occurrences. t At a relatively large number (i.e., in the early stages of iteration), the dynamic weight scheduling process tends to set the weights of semantic constraints at a larger level to emphasize semantic constraints, especially in the iteration numbering stage. t When the iteration is relatively small (i.e., in the later stages), the dynamic weight scheduling process tends to set the texture constraint to a larger level to emphasize the texture constraint. This can effectively maintain the execution quality of image tampering throughout the entire iteration process, thus ensuring both the visual effect and anti-forensic effectiveness of the tampered image during tampering. The process of determining the temporal feature vector is shown in Equation 4.
[0044] ………… Formula 4 in For time feature vectors, To encode the embedded function, This is the time embedding dimension, and its value can be adjusted according to the actual situation. For example, its value range can be 64 to 128.
[0045] Finally, the tampered scene feature vector, output error feature vector, and time vector are concatenated and input into a pre-defined weight scheduling network for forward propagation, thereby determining the current dynamic weights for the current iteration step. The specific forward propagation process is shown in Equations 5, 6, and 7.
[0046] ………… Formula 5 ………… Formula 6 ………… Formula 7 in, Here are the hidden layer features of the weighted scheduling network, ReLU is the activation function of the hidden layer, Concat is the concatenation function, and the subscript T indicates transpose. as well as The weights are the weight coefficients of the weighted scheduling network. as well as For the bias vector of the weighted scheduling network, The weighted output layer of the network is the output value, and Softmax is the activation function of the output layer. The current content weight for the current iteration step. The current noise weight for the current iteration step. The current texture weight for the current iteration step. This represents the current semantic weight for the current iteration step.
[0047] Please continue reading Figure 1 The anti-forensic image tampering method in the embodiments of this application further includes: Step 03: Based on the current noisy image, current dynamic weights, image to be tampered with, and image tampering task parameters, determine the total energy loss of the current iteration step and the image features after boundary processing, so as to set a collaborative strategy for multi-scale features.
[0048] Specifically, based on the above implementation method, after determining the current dynamic weights in the current iteration step, cross-scale constraint fusion can be further performed to set collaborative rules between various constraints in the current iteration step, thereby breaking down the barriers at the constraint scales of pixels, textures, and semantics, and ensuring that the tampered region has consistent features at all scales. The inputs to this step generally include: the current noisy image determined in the previous iteration step, the current dynamic weights in the current iteration step, the original image to be tampered with, and the tampering condition vector.
[0049] In some implementations, please refer to Figure 5 Step 03 specifically includes: Step 031: Based on Laplacian pyramid decomposition, the current noisy image is split into a first-scale feature representation vector, a second-scale feature representation vector, and a third-scale feature representation vector. Step 032: Determine the first consistency constraint based on the first scale feature representation vector and the second scale feature representation vector to ensure that the pixel distribution conforms to the texture pattern; Step 033: Determine the second consistency constraint based on the second-scale feature representation vector and the third-scale feature representation vector to ensure that the local texture conforms to the scene semantics; Step 034: Determine the total energy loss based on the output error feature vector, cross-scale constraint weights, tampering condition vector, first consistency constraint, and second consistency constraint; Step 035: Determine the boundary processing strategy based on the edge gradient of the tampered region in the current noisy image, the edge gradient of the corresponding region in the image to be tampered with, and the scale boundary threshold, so as to obtain the image features after boundary processing.
[0050] Specifically, based on the above implementation methods, the specific execution method of cross-scale constraint fusion can be referred to in the following example.
[0051] For example, the current noisy image is first decomposed into feature representation vectors at three different scales using Laplacian pyramid decomposition. The first scale feature representation vector is a low-scale pixel-level feature, which mainly represents the pixel detail information of the image. The second scale feature representation vector is a mid-scale texture-level feature, which mainly represents the local texture structure of the image. The third scale feature representation vector is a high-scale semantic-level feature, which mainly represents the scene association of the image.
[0052] Next, pixel-texture consistency constraints are constructed for the first-scale feature representation vector and the second-scale feature representation vector. The main method is to calculate the feature consistency between adjacent scales. Specifically, as shown in Equation 8.
[0053] ………… Formula 8 in The first consistency constraint represents the consistency energy from low-level to mid-level scales, used to ensure that the pixel distribution of the image conforms to its texture patterns. For the current noisy image, To tamper with the condition vector, This represents the total number of levels in the Laplace pyramid. Indicates the current noisy image In the decomposition of the Laplace pyramid, the first Features at the layer, For transformation operators.
[0054] For the second-scale feature representation vector and the third-scale feature representation vector, texture-semantic consistency constraints can be constructed. The main approach is to use an attention mechanism to establish the relationship between texture features and semantic features, as shown in Formula 9.
[0055] ………… Formula 9 in The second consistency constraint represents the consistency energy from the mid-scale to the high-scale, used to ensure that the local texture of the image conforms to the scene semantics of the image. To modify the spatial domain corresponding to the region, Attn is the attention function. Represents any specific coordinate in the feature map. Indicates the current noisy image In coordinates Texture features at the location, Indicates the current noisy image semantic features Indicates the current noisy image In coordinates The true semantic features of the location.
[0056] Based on the first and second consistency constraints, the overall cross-scale consistency constraint can then be determined. Specifically, as shown in Formula 10.
[0057] ………… Formula 10 Furthermore, based on the cross-scale consistency constraint, the current dynamic weight, the output error feature vector, and the cross-scale constraint weight in the image tampering task parameters, the total energy loss of the current iteration step can be determined, thereby combining the cross-scale constraint with the basic four constraints, as shown in Equation 11.
[0058] ………… Formula 11 in This represents the total energy loss in the current iteration step. This is the set of indexes for the basic constraints, which includes indexes for four basic constraints: content, noise, texture, and semantics. , Current dynamic weights One of them, Output error eigenvector One of them, These are the cross-scale constraint weights. The total energy loss for the current iteration step is as described above. This is the optimization goal of this step.
[0059] Furthermore, to ensure a natural transition of the edges of the tampered region when image tampering is performed in the current iteration step, a boundary strategy needs to be selected based on the edge gradient of the tampered region. This is illustrated in Equation 12.
[0060] ………… Formula 12 in For the current noisy image The edge gradient of the tampered region, For image tampering task parameters, scale boundary threshold, For the current noisy image At the border pixel values on For the image to be tampered with at the boundary pixel values on Indicates boundary The normal vector, Represents relative to the boundary The normal derivative.
[0061] According to Formula 12, if the current noisy image Edge gradient of the tampered region Less than the scale boundary threshold If the boundary of the tampered area in the current noisy image is a soft edge, then a value continuity condition is applied to ensure that the boundary pixels in the current noisy image are consistent with those in the image to be tampered with, avoiding abrupt boundary transitions. If the current noisy image... Edge gradient of the tampered region Not less than the scale boundary threshold If the boundary of the tampered region in the current noisy image is a sharp edge, then a gradient continuity condition is applied to ensure that the normal derivative of the boundary in the current noisy image remains consistent with the original image, thus guaranteeing clear region edges. This determines the boundary processing strategy and further yields the image features after boundary processing.
[0062] In some implementations, step 02 further includes: If the total energy loss exceeds a preset threshold, the network parameters of the weight scheduling network are updated based on gradient descent to limit the total energy loss and improve the scenario adaptability of the weight scheduling network.
[0063] Specifically, based on the above implementation method, when different total energy losses are continuously determined in multiple iterations, the total energy loss may gradually increase, even to an unexpected level. This indicates that the adaptability of the network parameters of the weight scheduling network to the dynamic weight adjustment process has decreased. At this time, it is necessary to optimize and update the network parameters of the weight scheduling network to limit the upward trend of the total energy loss, thereby improving the adaptability of the weight scheduling network to various image tampering scenarios, and ultimately ensuring the correct and accurate execution of the image tampering process.
[0064] For the actual adjustment and optimization of the weight scheduling network, for example, it is generally based on an online meta-learning mechanism, which optimizes the network parameters of the weight scheduling network by minimizing the total energy loss of each element in the entire iteration process. The specific optimization process can be found in Equation 13.
[0065] ………… Formula 13 in For the set of network parameters of the weighted scheduling network, The meta-learning rate represents the meta-learning mechanism. For gradient operators, For the total energy loss in the example above, Indicates the first n The image to be tampered with is in the iteration step. t Predicted initial state estimate, T This represents the total number of iterations.
[0066] The optimization process described above can be optionally executed as the iteration progresses, depending on the change in the total energy loss generated in each iteration step.
[0067] Please refer to further information. Figure 1 The anti-forensic image tampering method in the embodiments of this application further includes: Step 04: Based on the current noisy image, the total energy loss of the current iteration step, the current dynamic weights, and the image tampering task parameters, perform image tampering to determine the current noisy image for the next iteration step.
[0068] Furthermore, based on the above implementation, since the current dynamic weights and total energy loss have been determined in the current iteration step, image tampering can be performed on the current noise image determined in the previous iteration step at the end of the current iteration step, based on these two sets of data, thereby generating the current noise image finally determined in the current iteration step, which is also the current noise image in the next iteration step. The inputs to this step generally include: the current noise image of the current iteration step, the total energy loss and current dynamic weights determined in the above steps, and the cross-scale constraint weights in the image tampering task parameters.
[0069] In some implementations, please refer to Figure 6 Step 04 specifically includes: Step 041: Determine the first energy gradient that meets the physical constraints based on the total energy loss; Step 042: Based on the pre-trained noise prediction network, determine the second energy gradient that conforms to the statistical laws of natural images according to the current noise image and the output error feature vector in the current iteration step; Step 043: Update and determine the fusion coefficients in the current iteration step based on the preset reference noise vector and the noise prediction network; Step 044: Determine the fusion gradient parameters based on the fusion coefficient, the first energy gradient, and the second energy gradient; Step 045: Based on the fusion gradient parameters, perform image manipulation to determine the current noisy image for the next iteration step.
[0070] Specifically, the process of image tampering in the current iteration mainly relies on the bidirectional gradient guidance module in the image tampering model, so that the four basic constraints in the above implementation method and the model prior data can work together to guide the image to be updated in a direction that balances visual realism and anti-forensic effects.
[0071] First, based on the total energy loss obtained from the above steps, a functional calculation is performed to obtain the total energy gradient (corresponding to the first energy gradient). The total energy gradient represents the optimization direction that meets the basic constraints of image noise, texture, and semantics. Specifically, as shown in Equation 14.
[0072] …………Formula 14 in This represents the total energy gradient described above.
[0073] The noise prediction network in the image tampering model can calculate the prior gradient (corresponding to the second energy gradient). The prior gradient represents the optimization direction of the computational data driving force and the optimization direction that conforms to the statistical laws of natural images. Specifically, it is shown in Equation 15.
[0074] ………… Formula 15 in This represents the generation of the prior gradient described above. This represents a noise prediction network.
[0075] Using the initial fusion coefficients in the image tampering task parameters as a benchmark, the fusion coefficients can be dynamically adjusted based on the noise vector predicted by the noise prediction network in the current iteration step and the reference noise vector preset in each iteration step. This is illustrated in Equation 16.
[0076] ………… Formula 16 in The fusion coefficient in the current iteration step. This is the noise vector predicted by the noise prediction network in the current iteration step. A pre-set reference noise vector.
[0077] The main function of the aforementioned fusion coefficients is to act as weights when performing gradient fusion updates with the total energy gradient and the generated prior gradient, thereby achieving weighted fusion and obtaining the fused gradient parameters. This is illustrated in Equation 17.
[0078] ………… Formula 17 in The above refers to the fusion gradient parameters.
[0079] The process of further performing image manipulation based on the fusion gradient parameters is described in some implementations, please refer to [link to relevant documentation]. Figure 7 Step 045 further includes: Step 0451: Based on the fused gradient parameters and energy guidance intensity, correct the noise prediction vector for the current iteration step, and determine the noise prediction correction vector. The noise prediction vector is obtained by the noise prediction network performing predictions in the current iteration step; Step 0452: Based on the preset denoising function, determine the current noise image for the next iteration step according to the noise prediction correction vector and the current noise image of the current iteration step.
[0080] Specifically, the noise vector determined by the noise prediction network can be corrected based on the fusion gradient parameters, and the image can be further modified based on the corrected noise vector, thereby determining the current noise image at the end of the current iteration step, which is also the current noise image in the next iteration step. This is illustrated in Equation 18.
[0081] ………… Formula 18 in This is the noise prediction correction vector. The energy-guided intensity in the image tampering task parameters. (*) is the denoising function. This is the current noisy image for the next iteration.
[0082] At this point, all steps of the current iteration step have been completed, based on the current noisy image determined at the end of the previous iteration step. After following the steps in the examples above, the current noise image in the next iteration step is finally determined when the current iteration step is completed. .when When the current iteration step is completed, the target image that has been tampered with is obtained.
[0083] Thus, the anti-forensic image tampering method in this application constructs an execution flow of dynamic constraint scheduling, cross-scale fusion, and bidirectional guidance to execute image tampering, realizing the scenario-based adaptive allocation of constraint weights. In addition, it uses the consistency constraints of cross-scale features to establish a multi-scale feature association fusion mechanism, and further utilizes bidirectional guidance to realize the synergy between physical constraints and scale data driving, thereby improving the overall practicality and ease of use of anti-forensic image tampering.
[0084] The electronic device in this application includes a memory and a processor. The memory stores a computer program, and when the computer program is executed by the processor, the anti-forensic image tampering method in the above-described embodiments is implemented.
[0085] The computer-readable storage medium in the embodiments of this application stores a computer program, which, when executed by one or more processors, implements the anti-forensic image tampering method in the above embodiments.
[0086] The above description is merely a preferred embodiment of this application and is not intended to limit this application in any way. Although this application has disclosed the preferred embodiment as above, it is not intended to limit this application. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the technical solution of this application. Any simple modifications, equivalent substitutions, and improvements made to the above embodiments without departing from the technical solution of this application, based on the technical essence of this application and within the spirit and principles of this application, shall still fall within the protection scope of the technical solution of this application.
Claims
1. A method for resisting forensic image tampering, characterized in that, The method includes: Based on the image to be tampered with and the target tampering conditions, the image tampering task parameters are determined, wherein the image tampering task parameters include initial dynamic weights; Based on the current noisy image and the image tampering task parameters, the current dynamic weight of the current iteration step is updated to set the constraint optimization strategy for the current iteration step, wherein the current noisy image is obtained by tampering with the image to be tampered with through one or more iteration steps; Based on the current noisy image, the current dynamic weights, the image to be tampered with, and the image tampering task parameters, the total energy loss of the current iteration step and the image features after boundary processing are determined in order to set a collaborative strategy for multi-scale features; Based on the current noisy image, the total energy loss of the current iteration step, the current dynamic weights, and the image tampering task parameters, image tampering is performed to determine the current noisy image for the next iteration step.
2. The method according to claim 1, characterized in that, The step of determining the image tampering task parameters based on the image to be tampered with and the target tampering conditions includes: Based on the image to be tampered with, a tampering mask is determined to mark the area of the image to be tampered with; Based on the target tampering conditions, determine the tampering condition vector; Based on the image to be tampered with and the target tampering conditions, auxiliary image feature parameters of the image to be tampered with are obtained.
3. The method according to claim 2, characterized in that, The step of determining the image tampering task parameters based on the image to be tampered with and the target tampering conditions also includes: The initial dynamic weights are determined based on the image to be tampered with and the target tampering conditions. Based on the image texture of the image to be tampered with, determine the number of scales, cross-scale constraint weights, and scale boundary thresholds; Based on preset prior data, the energy guiding intensity and initial fusion coefficient are determined, wherein the prior data is determined based on the historical execution of the method; The total number of iteration steps is determined based on the balance between execution quality and execution efficiency when performing tampering on the image to be tampered with; Based on the image to be tampered with, the tampering mask, and the tampering condition vector, a tampering scene feature vector and a tampering scene type label are determined using a pre-trained scene classification model to clarify the tampering task type.
4. The method according to claim 3, characterized in that, The step of updating and determining the current dynamic weights for the current iteration step based on the current noisy image and the image tampering task parameters, in order to set the constraint optimization strategy for the current iteration step, includes: Based on the tampered scene feature vector, the current noisy image, and the tampering condition vector, calculate the constraint error corresponding to each item in the current dynamic weight of the current iteration step to determine the output error feature vector; Perform sinusoidal position encoding based on the number of iterations corresponding to the current iteration step to determine the time feature vector; Based on a preset weighted scheduling network, the current dynamic weight of the current iteration step is updated and determined according to the tampered scene feature vector, the output error feature vector, and the time feature vector.
5. The method according to claim 4, characterized in that, The step of determining the total energy loss and boundary-processed image features of the current iteration step based on the current noisy image, the current dynamic weights, the image to be tampered with, and the image tampering task parameters, in order to set a collaborative strategy for multi-scale features, includes: Based on Laplacian pyramid decomposition, the current noisy image is split into a first-scale feature representation vector, a second-scale feature representation vector, and a third-scale feature representation vector. Based on the first scale feature representation vector and the second scale feature representation vector, a first consistency constraint is determined to ensure that the pixel distribution conforms to the texture pattern. Based on the second-scale feature representation vector and the third-scale feature representation vector, a second consistency constraint is determined to ensure that the local texture conforms to the scene semantics; The total energy loss is determined based on the output error feature vector, the cross-scale constraint weights, the tampering condition vector, the first consistency constraint, and the second consistency constraint. Based on the edge gradient of the tampered region in the current noisy image, the edge gradient of the corresponding region in the image to be tampered with, and the scale boundary threshold, a boundary processing strategy is determined to obtain the image features after boundary processing.
6. The method according to claim 5, characterized in that, The step of updating and determining the current dynamic weights for the current iteration step based on the current noisy image and the image tampering task parameters, in order to set the constraint optimization strategy for the current iteration step, further includes: If the total energy loss exceeds a preset threshold, the network parameters of the weight scheduling network are updated based on gradient descent to limit the total energy loss and improve the scenario adaptability of the weight scheduling network.
7. The method according to claim 5, characterized in that, The step of performing image tampering based on the current noisy image, the total energy loss of the current iteration step, the current dynamic weight, and the image tampering task parameters to determine the current noisy image for the next iteration step includes: Based on the total energy loss, determine the first energy gradient that meets the physical constraints; Based on a pre-trained noise prediction network, a second energy gradient conforming to the statistical laws of natural images is determined according to the current noise image of the current iteration step and the output error feature vector. Based on the preset reference noise vector and the noise prediction network, the fusion coefficients in the current iteration step are updated and determined. The fusion gradient parameters are determined based on the fusion coefficient, the first energy gradient, and the second energy gradient. Based on the fusion gradient parameters, image manipulation is performed to determine the current noisy image for the next iteration step.
8. The method according to claim 7, characterized in that, The step of performing image manipulation based on the fusion gradient parameters and determining the current noisy image for the next iteration includes: Based on the fusion gradient parameters and the energy guidance intensity, the noise prediction vector of the current iteration step is corrected to determine the noise prediction correction vector, wherein the noise prediction vector is obtained by the noise prediction network performing prediction in the current iteration step; Based on a preset denoising function, the current noise image for the next iteration step is determined according to the noise prediction correction vector and the current noise image of the current iteration step.
9. An electronic device, characterized in that, The electronic device includes a memory and a processor. The memory stores a computer program that, when executed by the processor, implements the anti-forensic image tampering method as described in any one of claims 1-8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by one or more processors, implements the anti-forensic image tampering method as described in any one of claims 1-8.