Method for detecting image edge features and image tampering detection method
Patent Information
- Application Number
- CN202510472185.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-15
- Publication Date
- 2026-10-23
AI Technical Summary
[0004]本发明的目的之一在于提供一种图像边缘特征的检测方法,以解决现有技术难以兼顾多尺度边缘特征与通道维度互补信息,导致篡改区域漏检或正常区域误检的技术问题
[0021]本发明公开了一种图像边缘特征的检测方法,通过将整体边缘特征与通道子特征的边缘计算结果进行融合,使得最终边缘特征既包含全局尺度下的物体轮廓信息,又融合了通道尺度下的细节信息,这种多层次、多尺度的信息融合机制有效弥补了单一尺度边缘检测的局限性,既避免了因全局计算导致的细节丢失,又抑制了因局部通道计算可能产生的噪声干扰,增强了边缘检测的鲁棒性和准确性,使得最终边缘特征能够更全面、更精确地反映图像中的边缘结构,为后续的图像分析和处理任务提供了高质量的边缘信息。
Smart Images

Figure CN122966978A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computers, and more specifically to a method for detecting image edge features and a method for detecting image tampering. Background Technology
[0002] In the field of computer vision, edge detection is one of the key tasks in image processing and analysis, and it is widely used in scenarios such as object recognition, image segmentation, and scene understanding. Edge features, as regions in an image with significant changes in grayscale or color, can effectively reflect the contour and structural information of objects, providing important prior knowledge for identifying traces of image tampering.
[0003] Current detection methods primarily rely on a single convolutional neural network to extract global edge features or use fixed operators for channel-independent edge computation. While these approaches can capture significant structural edges, they have inherent limitations in practical applications: Firstly, traditional single-channel edge detection struggles to handle differences in cross-channel feature representation. When tampering traces only appear in a certain color channel or frequency band, the response of a single convolutional kernel ignores channel-specific information, leading to missed detections of subtle tampering edges. Secondly, existing methods typically employ simple weighted summation for multi-scale edge fusion, failing to fully consider the semantic complementarity of edge features at different scales. This can easily result in edge breaks or false connections in complex scenarios (such as when there is simultaneous large-scale object duplication and minor detail modification). Summary of the Invention
[0004] One of the objectives of this invention is to provide a method for detecting image edge features, in order to solve the technical problem that existing technologies cannot take into account both multi-scale edge features and channel dimension complementary information, resulting in missed detection of tampered areas or false detection of normal areas.
[0005] To achieve one of the above-mentioned objectives, the present invention provides a method for detecting image edge features. The method includes: obtaining an image to be detected; performing a first edge calculation to obtain a first edge feature of the image to be detected; splitting the features of the image according to the channel information of the image to be detected, performing a second edge calculation on each sub-feature, and determining the second edge feature of the image to be detected based on the second edge calculation results of the sub-features.
[0006] The edge features of the image to be detected are determined based on the first edge feature and the second edge feature.
[0007] As a further improvement of one embodiment of the present invention, the steps of determining a first edge feature and determining a second edge feature are performed simultaneously.
[0008] As a further improvement of one embodiment of the present invention, the step of performing the first edge calculation to obtain the first edge feature of the image to be detected includes: extracting image features of the image to be detected and determining the corresponding feature matrix; performing convolution operations on the feature matrix according to its corresponding rows and columns to determine the first feature matrix and the second feature matrix; and determining the corresponding first edge feature based on the first feature matrix and the second feature matrix.
[0009] As a further improvement of one embodiment of the present invention, the step of determining the corresponding first edge feature based on the first feature matrix and the second feature matrix includes: determining the corresponding third feature matrix based on the mean square error of the corresponding elements of the first feature matrix and the second feature matrix; and determining the first edge feature based on the dot product operation of the third feature matrix and the corresponding feature matrix.
[0010] As a further improvement of one embodiment of the present invention, the sub-feature includes at least one of a first sub-feature and a second sub-feature; the step of performing a second edge calculation on each sub-feature and determining the second edge feature of the image to be detected based on the edge calculation results of the sub-features includes: performing a splicing operation on the first edge calculation result of the first sub-feature and the second edge calculation result of the second sub-feature to obtain the second edge feature.
[0011] As a further improvement of one embodiment of the present invention, the first sub-feature forms a first sub-feature matrix, and the second sub-feature forms a second sub-feature matrix; the concatenation operation of the first edge calculation result of the first sub-feature and the second edge calculation result of the second sub-feature to obtain the second edge feature includes: performing convolution operations on the first sub-feature matrix according to its corresponding rows and columns to determine the third feature matrix and the fourth feature matrix; performing convolution operations on the second sub-feature matrix according to its corresponding rows and columns to determine the fifth feature matrix and the sixth feature matrix; and concatenating the third feature matrix, the fourth feature matrix, the fifth feature matrix, and the sixth feature matrix to obtain the second edge feature.
[0012] As a further improvement of one embodiment of the present invention, before performing the first edge calculation, the method further includes: extracting multi-scale convolutional features from the image to be detected according to the convolution kernel, and determining corresponding image features; the first edge calculation to obtain the first edge features of the image to be detected includes:
[0013] Perform a first edge calculation on each image feature, and then stitch together the first edge calculation results corresponding to each image feature to determine the first edge feature.
[0014] As a further improvement of one embodiment of the present invention, the step of determining the edge features of the image to be detected based on the first edge feature and the second edge feature includes splicing the first edge feature and the second edge feature, performing activation and aggregation operations on the spliced result, and determining the edge features.
[0015] To achieve one of the above-mentioned objectives, the present invention provides an image tampering detection method, the detection method comprising: performing an image edge feature detection method to determine the edge features corresponding to the image to be detected;
[0016] Based on the edge features, similar region features and tampered region features in the image to be detected are determined; the similar region features, the tampered region features, and image features of the image to be detected are spliced together, and based on the splicing result, at least one of the source region and the tampered target region in the image to be detected is identified.
[0017] As a further improvement of one embodiment of the present invention, the step of determining similar region features and tampered region features in the image to be detected based on the edge features includes: determining a first similar region feature based on local features and global features of the image to be detected; determining a second similar region feature based on local features and the edge features of the image to be detected; determining a third similar region feature based on global features and the edge features of the image to be detected; and concatenating the first correlation matrix, the second correlation matrix, and the third correlation matrix to determine the similar region features.
[0018] As a further improvement of one embodiment of the present invention, the step of determining the similar region features and the tampered region features in the image to be detected based on the edge features includes: performing multi-scale analysis on the similar region features and using an attention mechanism to determine the tampered region features.
[0019] As a further improvement of one embodiment of the present invention, before determining the local and global features of the image to be detected, the method further includes: determining global features based on the position information of each pixel in the image to be detected, using a window self-attention mechanism and a cross-window multi-head attention mechanism.
[0020] Compared with the prior art, the embodiments of the present invention have at least one of the following beneficial effects:
[0021] This invention discloses a method for detecting image edge features. By fusing the edge calculation results of the overall edge features and channel sub-features, the final edge features contain both object contour information at the global scale and detailed information at the channel scale. This multi-level, multi-scale information fusion mechanism effectively compensates for the limitations of single-scale edge detection. It avoids the loss of details caused by global calculation and suppresses noise interference that may be caused by local channel calculation, thereby enhancing the robustness and accuracy of edge detection. This allows the final edge features to more comprehensively and accurately reflect the edge structure in the image, providing high-quality edge information for subsequent image analysis and processing tasks. Attached Figure Description
[0022] Figure 1 This is a schematic diagram of the steps of an image edge feature detection method according to an embodiment of the present invention.
[0023] Figure 2 This is a schematic diagram illustrating the principle of an image edge feature detection method in one embodiment of the present invention.
[0024] Figure 3 This is a schematic diagram of step S2 in one embodiment of the present invention.
[0025] Figure 4 This is a schematic diagram of step S3' in a specific embodiment of the present invention.
[0026] Figure 5 This is a schematic diagram of the edge feature extraction structure in one embodiment of the present invention.
[0027] Figure 6 This is a schematic diagram of the steps of an image tampering detection method according to an embodiment of the present invention.
[0028] Figure 7 This is a schematic diagram of step M2 in one embodiment of the present invention.
[0029] Figure 8(a) is a schematic diagram of the structure of a similar region localization network that fuses multiple models and multiple related features in one embodiment of the present invention.
[0030] Figure 8(b) is a schematic diagram of the structure of a similar region detection network model in one embodiment of the present invention.
[0031] Figure 8(c) is a schematic diagram of the hybrid attention mechanism in one embodiment of the present invention.
[0032] Figure 9(a) is a schematic diagram of the target tampering region detection model in one embodiment of the present invention.
[0033] Figure 9(b) is a schematic diagram of the Inception network model in one embodiment of the present invention.
[0034] Figure 10 This is a schematic diagram illustrating the principle of an image tampering detection method in one embodiment of the present invention. Detailed Implementation
[0035] The present invention will now be described in detail with reference to the specific embodiments shown in the accompanying drawings. However, these embodiments do not limit the present invention, and any structural, methodological, or functional modifications made by those skilled in the art based on these embodiments are included within the scope of protection of the present invention.
[0036] It should be noted that the term "comprising" or any other variation thereof is intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Furthermore, the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0037] like Figure 1 As shown, one embodiment of the present invention provides a method for detecting image edge features, including the following steps.
[0038] Step S1: Obtain the image to be detected;
[0039] Step S2: Perform the first edge calculation to obtain the first edge features of the image to be detected;
[0040] Step S3: Decompose the features of the image according to the channel information of the image to be detected, perform second edge calculation on each sub-feature, and determine the second edge features of the image to be detected based on the second edge calculation results of the sub-features.
[0041] Step S4: Determine the edge features of the image to be detected based on the first edge feature and the second edge feature.
[0042] Thus, by performing the first edge calculation on the image to be detected, the boundaries of the main objects in the image can be quickly located. Subsequently, the features of the image are split according to the channel information of the image to be detected, and the second edge calculation is performed on each sub-feature to mine the edge detail information at different channel scales, thereby extracting more refined edge features. Finally, the edge calculation results of the overall edge features and the channel sub-features are fused together, so that the final edge features contain both the object contour information at the global scale and the detailed information at the channel scale.
[0043] This multi-level, multi-scale information fusion mechanism effectively compensates for the limitations of single-scale edge detection. It avoids the loss of details caused by global computation and suppresses noise interference that may be caused by local channel computation, thereby enhancing the robustness and accuracy of edge detection. This allows the final edge features to more comprehensively and accurately reflect the edge structure in the image, providing high-quality edge information for subsequent image analysis and processing tasks.
[0044] In step S2, edge computing extracts locations of abrupt changes in pixel values (such as object contours, texture boundaries, etc.) in the image using an edge detection algorithm. The edge detection algorithm identifies abrupt change regions by calculating the gradient of the image (i.e., the rate of change of pixel values).
[0045] Edge features refer to the features in an image that characterize changes in the contour or texture of an object. Edge features include at least one of gradient magnitude and direction. The first edge feature represents global, coarse-grained edge information; the second edge feature represents multi-channel or local finer edge information.
[0046] In one embodiment, an image to be detected is obtained, and local features of the image to be detected are extracted; a first edge calculation is performed on the local features to obtain a first edge feature; the local features are split according to channel information, and a second edge calculation is performed on each sub-feature; based on the second edge calculation results of the sub-features, the second edge feature of the image to be detected is determined.
[0047] To facilitate understanding the difference between first edge computing and second edge computing, such as Figure 2 As shown, the first branch (corresponding to the first edge calculation): Based on the Scharr operator, edge calculation is performed on the image to be detected or the corresponding image feature E (i.e., corresponding to SCHARR). X|Y Based on the calculation results, the corresponding edge gradient magnitude P is determined; based on the edge gradient magnitude P and image feature E, the first edge feature (i.e., E) is determined. a ).
[0048] The second branch (corresponding to the second edge calculation): The image feature E is split according to channel information; based on the Scharr operator, for each sub-feature E... ch Perform edge computing separately (i.e., corresponding to SCHARR) X|Y Based on the edge calculation results of the sub-features, determine the second edge feature (i.e., E). s ).
[0049] As can be seen, the first edge calculation and the second edge calculation have the same calculation steps, that is, both involve convolution operations on image features (or sub-features) along the first direction (x-direction) and the second direction (y-direction) to obtain edge feature maps in the corresponding directions. X and EdgeY The first and second directions here can be understood as the row and column directions of the corresponding feature matrix. The difference is that the first edge calculation, after performing the same steps, requires further calculation based on the edge feature map. X and Edge Y The corresponding edge gradient magnitude P is determined, and the dot product operation based on the edge gradient magnitude P and image feature E is determined.
[0050] In one embodiment, the steps of determining a first edge feature and determining a second edge feature are performed simultaneously. In other words, a first edge calculation is performed on image feature E, while simultaneously performing a second edge calculation on sub-feature E. ch Perform the second edge calculation separately.
[0051] Thus, by simultaneously executing the steps of determining the first edge feature and the steps of determining the second edge feature, parallel processing is achieved. Compared with sequential execution, this can effectively save detection time, improve overall detection efficiency, and make the detection process of image edge features faster and more efficient.
[0052] Based on this, such as Figure 3 As shown, in one embodiment, step S2 specifically includes the following steps.
[0053] Step S21: Extract image features from the image to be detected and determine the corresponding feature matrix. Perform convolution operations on the feature matrix according to its corresponding rows and columns to determine the first feature matrix and the second feature matrix.
[0054] Step S22: Determine the corresponding first edge feature based on the first feature matrix and the second feature matrix.
[0055] In this way, by performing convolution operations on the feature matrix in different directions along the rows and columns, information in the feature matrix can be mined from different dimensions, comprehensively capturing the feature changes of the image in the horizontal and vertical directions, and then combining this information to determine accurate edge features.
[0056] In one specific embodiment, a first convolution kernel sequence and a second convolution kernel sequence are obtained; the first convolution kernel sequence is used to perform convolution operation on the rows corresponding to the feature matrix to obtain a first feature matrix; the second convolution kernel sequence is used to perform convolution operation on the columns corresponding to the feature matrix to obtain a second feature matrix.
[0057] For ease of understanding, let the first convolution kernel sequence be G. x The second convolution kernel sequence is G. y The first matrix feature is Edge X The second matrix feature is Edge Y The first matrix feature Edge is determined according to formulas (3) and (4).X The second matrix feature Edge Y .
[0058]
[0059] Among them, X i conv represents the i-th image feature. x This indicates that the image features are convolved along the x-direction (i.e., the row direction), kernel = G. x This indicates that the convolution kernel used is G. x Normalized normalizes the result of a convolution operation. Similarly, conv... y This indicates that the image features are convolved along the y-direction (i.e., the column direction), kernel = G. y This indicates that the convolution kernel used is G. y .
[0060] In one specific embodiment, the first convolutional kernel sequence is configured as G according to formula (5). x With the second convolution kernel sequence being G y .
[0061]
[0062] In one specific embodiment, step S22 may specifically include the following steps.
[0063] Step S221: Determine the corresponding third feature matrix based on the mean square error of the corresponding elements of the first feature matrix and the second feature matrix;
[0064] Step S222: Determine the first edge feature based on the dot product operation of the third feature matrix and the corresponding feature matrix.
[0065] Thus, by calculating the mean squared error of the corresponding elements of the two feature matrices, a third feature matrix reflecting the differences between the two is constructed. This difference feature can effectively capture significant structural changes in the input data. Performing a dot product operation between this difference feature and the local feature matrix is essentially a weighting of the difference feature in the spatial dimension, so that the first edge feature generated at the end retains the key difference information of the original data and strengthens the response of the edge region through the guiding role of the local feature matrix.
[0066] In step S221, the third feature matrix can be understood as the edge gradient magnitude, which is used to quantify the degree of change of each position information (i.e. feature point information) in the feature matrix in the row and column directions.
[0067] For ease of understanding, let's continue with the example above. The third characteristic matrix can be defined according to formula (6).
[0068]
[0069] Continue to refer to Figure 2 As shown, in the first branch, the third characteristic matrix is S. E It is also possible to analyze the third characteristic matrix S. E Perform a nonlinear transformation (i.e., Sigmoid), then multiply the result of the nonlinear transformation with the corresponding feature matrix to obtain the first edge feature E. a .
[0070] In step S3, the channel information of the image refers to the channel dimension of the deep feature map extracted by the Convolutional Neural Network (CNN). Specifically, based on the feature map automatically learned by the CNN using multi-level convolution operations, each channel corresponds to an abstract feature response pattern. For example, some channels are sensitive to edge directions (such as horizontal or vertical edges), while other channels may be sensitive to texture patterns (such as squares, stripes) or high-frequency noise.
[0071] In one embodiment, after splitting the image features, several sub-features are obtained, and the sub-features include at least one of the first sub-feature and the second sub-feature.
[0072] Based on this, the first sub-feature forms the first sub-feature matrix, and the second sub-feature forms the second sub-feature matrix. Step S3 may specifically include step S3', which involves concatenating the first edge calculation result of the first sub-feature and the second edge calculation result of the second sub-feature to obtain the second edge feature.
[0073] In this way, by concatenating the edge calculation results of the first and second sub-features, the edge information contained in different sub-features can be integrated, making the final second edge feature more comprehensive and richer, thereby improving the accuracy and completeness of edge feature detection.
[0074] like Figure 4 As shown, in one specific embodiment, step S3' may specifically include the following steps.
[0075] Step S31: Perform convolution operations on the first sub-feature matrix according to its corresponding rows and columns to determine the third feature matrix and the fourth feature matrix;
[0076] Step S32: Perform convolution operations on the second sub-feature matrix according to its corresponding rows and columns to determine the fifth feature matrix and the sixth feature matrix;
[0077] Step S33: The third feature matrix, the fourth feature matrix, the fifth feature matrix, and the sixth feature matrix are concatenated to obtain the second edge feature.
[0078] In this way, by fusing multi-dimensional edge information in the channel dimension, the edge structure in the image or data can be reflected more comprehensively, thereby improving the accuracy and robustness of subsequent tasks (such as edge detection or feature classification).
[0079] Continue to refer to Figure 2 As shown, in the second branch, the first and second sub-features correspond to E in the figure. ch1 and E ch2 For the first sub-feature E respectively ch1 Second sub-feature E ch2 Perform edge computing (i.e., corresponding to SCHARR) X|Y The multiple results obtained from edge calculation are added together to obtain the second edge feature E. S .
[0080] In one embodiment, the first edge feature and the second edge feature are spliced together, and activation and aggregation operations are performed on the spliced result to determine the edge features.
[0081] Thus, by splicing the first edge feature and the second edge feature, and performing activation and aggregation operations on the spliced result to determine the edge features of the image to be detected, the different information contained in the first edge feature and the second edge feature can be fully integrated. The activation operation can highlight key feature information, while the aggregation operation can further integrate and refine features, thereby effectively improving the accuracy and reliability of the determined edge features, so that the edge features can more accurately reflect the edge situation of the image to be detected.
[0082] For example, continue to refer to Figure 2 As shown, the first edge feature E can be... a Second edge feature E S Perform splicing to determine edge features X E .
[0083] For example, the first edge feature E can be... a Second edge feature E S The concatenated result undergoes a non-linear mapping operation to determine the edge features X. E .
[0084] For example, the first edge feature E can also be... a Second edge feature E S The concatenated results are then subjected to a non-linear mapping operation and a standard convolution operation (i.e., Standard Convolution) to determine the edge features X.E .
[0085] Understandably, in real-world applications, edge detection at a single scale may not be sufficient to capture complex structures in an image; for example, the outline of a large-scale object may differ from the boundary representation of a small-scale texture. Therefore, image features at multiple different scales can be used to perform first and second edge calculations separately.
[0086] In one specific embodiment, prior to step S2, the method may further include the following steps.
[0087] Step P2: Extract multi-scale convolutional features from the image to be detected based on the convolution kernel, and determine the corresponding image features;
[0088] Based on this, step S2 specifically includes the following steps.
[0089] Step S2': Perform first edge calculation on each image feature, and stitch together the first edge calculation results corresponding to each image feature to determine the first edge feature.
[0090] In this way, by extracting multi-scale convolutional features, edge information from fine-grained to coarse-grained is preserved, ensuring the integrity and continuity of edge information.
[0091] In step P1, image features can be understood as local features. In one specific embodiment, multi-scale convolutional features include at least one of shallow features, mid-level features, and deep features.
[0092] In one specific embodiment, the Scharr operator is used to perform first edge calculation on multi-scale convolutional features to achieve full-channel edge extraction and obtain the first edge features.
[0093] Thus, the Scharr operator enables a smoother weight distribution of convolutional features at different scales, making it more robust to noise and blurred edges. Of course, this invention is not limited to the Scharr operator; other operators, such as the Sobel operator, can also be used, without specific limitations.
[0094] In one specific embodiment, based on a pre-trained neural network model, the image to be detected is input into a first network structure to perform convolutional feature extraction to obtain a first image feature; the image to be detected is input into a second network structure to perform convolutional feature extraction to obtain a second image feature; wherein the first image feature and the second image feature have different sizes.
[0095] In this embodiment, the first image feature and the second image feature are obtained by being extracted independently and in parallel based on the first network structure and the second network structure, respectively. In other words, the image to be detected is input into the first network structure and the second network structure, respectively, to obtain the first image feature and the second image feature.
[0096] On the other hand, the first and second image features are extracted based on the hierarchical structure of the pre-trained neural network model. In other words, the image to be detected is passed sequentially through the first and second network structures, with the output of the previous layer serving as the input for the next. That is, the second image feature is determined based on the first image feature. Furthermore, image features of different scales can be freely determined according to the actual situation, such as three scales: the first image feature, the second image feature, and the third image feature.
[0097] In one specific embodiment, the first network structure and the second network structure use the same convolutional kernel when performing convolutional feature extraction operations. For example, both use a 3×3 convolutional kernel.
[0098] In one specific embodiment, a preset convolution kernel is used to perform convolution and activation operations on the image to be detected to obtain the corresponding image features.
[0099] In one specific embodiment, a preset convolution kernel is used to perform convolution, activation, and max pooling operations on the image to be detected to obtain the corresponding image features.
[0100] For ease of understanding, such as Figure 5 As shown, in a preferred embodiment, a convolutional neural network branch is constructed based on a pre-trained neural network model, which is a VGG neural network model. In this embodiment, the pre-trained neural network model is constructed using a homogeneous structure (i.e., using the same convolutional kernels and performing the same operations) and smaller convolutional kernels, and extracts more complex features by gradually increasing the network depth. The homogeneous structure can be represented by the following formula (7).
[0101] X i+1 =MaxPooling 2×2 (RELU(δ(RELU(δ(X i ))))) (7)
[0102] Among them, X i+1 Represents the feature map of the i-th channel, MaxPooling 2×2 This indicates that a 2×2 pooling unit is used for max pooling, where ReLU represents the activation function and δ represents the convolution operation. The following section combines... Figure 5 The structure shown and the above formula (7) summarize the process of determining the first edge feature.
[0103] First, the image to be detected is resized to a preset size (e.g., 256×256×3). The preprocessed image is then input into a portion of the first 24 layers of the VGG model for convolutional feature extraction. Specifically, the preprocessed image undergoes two convolution operations and an activation operation (e.g., ReLU activation) using 64 3×3 convolution kernels to obtain a feature map of size 256×256×64. Then, max pooling is performed with a pooling unit size of 2×2, resulting in a feature map X1 (first local feature) of size 128×128×64.
[0104] Next, feature map X1 is convolved and activated twice more using 128 3×3 convolution kernels to obtain a feature map of size 128×128×128. Then, max pooling is performed with a pooling unit size of 2×2 to obtain feature map X2 (second local feature) of size 64×64×128.
[0105] Then, feature map X2 is convolved and activated twice more using 256 3×3 convolution kernels to obtain a feature map of size 64×64×256. Then, max pooling is performed with a pooling unit size of 2×2 to obtain feature map X3 (third local feature) of size 32×32×256.
[0106] Finally, edge calculations (EO) (including first edge calculation and second edge calculation) are performed on feature maps X1, X2 and X3 respectively, and the results calculated according to formula (8) are fused to obtain edge feature edge_feat.
[0107] edge_feat=cat[X3,cat(conv(cat(conv(S(X1),S(X2))),S(X3)))] (8)
[0108] Where S(X1), S(X2) and S(X3) represent the results obtained by edge calculation of feature maps (X1, X2 and X3), respectively.
[0109] In this embodiment, edge information of the image to be detected is extracted from different scales and depths, and first edge calculation and second edge calculation are performed on it respectively. The corresponding calculation results are then fused into the final edge feature edge_feat.
[0110] Combination Figure 2 and Figure 5 As can be seen from the content shown, Figure 5This paper presents a multi-scale edge detection model. It extracts local image features (X1-X3) at different scales through multiple convolutional blocks (i.e., ConvBlcok), performs edge calculations (EO) on these features (including first and second edge calculations), and fuses the edge calculation results corresponding to the image features at different scales. Figure 5 The C(Concatenate) step yields the final edge feature edge_feat. The process of performing the first and second edge calculations for each local image feature can be found in [reference needed]. Figure 2 As shown.
[0111] Understandably, with the development of digital image processing technology, image tampering has become increasingly common and complex, posing serious challenges to areas such as media authenticity, judicial evidence collection, and news dissemination. Image tampering refers to the deliberate modification, falsification, or manipulation of the content of digital images to mislead observers or conceal true information.
[0112] like Figure 6 As shown, one embodiment of the present invention provides an image tampering detection method. The detection method includes the following steps.
[0113] Step M1: Execute an image edge feature detection method to determine the edge features of the corresponding image to be detected;
[0114] Step M2: Determine the similar region features and tampered region features in the image to be detected based on the edge features;
[0115] Step M3: Combine the similar region features, the tampered region features, and the image features of the image to be detected, and identify at least one of the source region and the tampered target region in the image to be detected based on the combination result.
[0116] Thus, through edge feature clustering and spatial relationship analysis, it is possible to automatically identify repetitive regions with similar textures or structural features in an image, while simultaneously locating abnormal regions that differ significantly from the overall features, effectively distinguishing the original image content from potential tampering traces. Finally, through deep fusion, feature cross-validation is achieved, which not only accurately identifies tampered regions in the image but also further traces and locates the original source region of the tampered content.
[0117] In one embodiment, the method for detecting image edge features in step M1 can refer to the relevant description of the image edge feature detection method described above, and will not be repeated here.
[0118] In one embodiment, step M2 may specifically include the following steps.
[0119] Step M2': Extract local and global features of the image to be detected, perform correlation fusion operation on the local features, global features and edge features to determine similar region features; apply multi-scale analysis to the similar region features to determine high-confidence tampered region features.
[0120] In step M2, similar region features refer to a comprehensive feature map generated by fusing local features, global features, and edge features of the image to be detected. A similar region, in the similar region features, represents a pair of regions that may be sources of each other, responding to connected regions above a threshold. For example, if an airplane in the image to be detected is copied and pasted, both the original airplane (source region) and the pasted airplane (target region) will be marked as "similar regions."
[0121] Based on this, such as Figure 7 As shown, in one embodiment, step M2 may specifically include the following steps.
[0122] Step M21: Determine the features of the first similar region based on the local and global features of the image to be detected;
[0123] Step M22: Determine the second similar region features based on the local features of the image to be detected and the edge features;
[0124] Step M23: Determine the third similar region features based on the global features of the image to be detected and the edge features;
[0125] Step M24: Concatenate the first correlation matrix, the second correlation matrix, and the third correlation matrix to determine the characteristics of similar regions.
[0126] In this way, by comprehensively utilizing the local features, global features, and edge features of the image to be detected, a comprehensive similar region feature representation is formed, which makes full use of the multi-level information of the image, taking into account both the similarity of the internal structure and the consistency of the external contour, thereby improving the accuracy and robustness of similar region detection.
[0127] In step M21, local features refer to identifiable attributes within a local area of the image; global features refer to overall, macroscopic attributes of the image, used to reflect the overall content or structure of the image.
[0128] In one embodiment, before step M21, the detection method further includes: determining global features based on window self-attention mechanism and cross-window multi-head attention mechanism according to the position information of each pixel in the image to be detected.
[0129] In one specific embodiment, before step M21, global features are determined according to the following steps.
[0130] Step P21: The image to be detected is cut into several pixel blocks, and each pixel block is linearly mapped to determine the corresponding feature vector.
[0131] Step P22: Determine the feature vector sequence based on the position information of each pixel block in the image to be detected and the feature vector of that pixel block;
[0132] Step P23: Divide the feature vector sequence into several windows, and determine the global features based on the window self-attention mechanism and the cross-window multi-head attention mechanism.
[0133] In step P23, the window self-attention mechanism is a method that divides the input data (such as an image or image features) into fixed-size windows and calculates attention independently within each window. Specifically, the attention and algorithm scope are limited to local windows, thereby reducing computational complexity.
[0134] Cross-window multi-head attention mechanism refers to the further introduction of information interaction between windows on the basis of window attention mechanism. By sharing information between different windows through multi-head attention mechanism, the receptive field of the model is expanded.
[0135] The self-attention mechanism can be determined using the following formula (9).
[0136]
[0137] Where Q = XW q K = XW k V = XW v X is the input sequence, W q W k and W v These are learnable weight parameters, designed to enhance the model's expressiveness. d is the word vector dimension, divided by... One reason is to prevent QK T The value being too large can cause overflow in the Softmax function calculation result. On the other hand, it is to make QK T The result follows a normal distribution with an expected value of 0 and a variance of 1.
[0138] Furthermore, the multi-head attention mechanism can be determined using the following formula (10).
[0139] MultiHead(Q,K,V)=Concat(Attention1,...,Attention k W O (10)
[0140] The multi-head attention mechanism defines K different sets of learnable parameters W. q W kand W v This is equivalent to performing K self-attention calculations, and finally concatenating the feature matrices calculated in each step, and then multiplying them by the weight parameter W. O This reduces the dimensionality of the feature matrix. Multi-head attention mechanisms can capture dependencies across different pixel ranges in an image, including at least one of long-range pixel matching and short-range pixel matching.
[0141] In one specific embodiment, after step M24, the similar region features are sequentially input into the hollow space pyramid and the hybrid attention mechanism to obtain optimized similar region features.
[0142] In one specific embodiment, a first similarity region feature is determined between local and global features of the image to be detected based on the Pearson correlation calculation method. Similarly, the second and third similarity region features can also be determined based on the Pearson correlation calculation method.
[0143] Pearson correlation is a statistical method used to measure the strength and direction of a linear relationship between two variables. Specifically, it calculates a value between -1 and 1 by dividing the product of the covariance of the two variables by their respective standard deviations.
[0144] Figure 8(a) shows a similar region detection network model based on multi-model and multi-related feature fusion. This network model can determine the similar region features of the image to be detected. The following describes the process of inputting the image to be detected and outputting the similar region features, based on the content shown in Figure 8(a).
[0145] First, data preprocessing is performed on several input images to be detected. Specifically, random noise (e.g., Gaussian noise) and affine transformations (e.g., rotation, scaling, and at least one of cropping) are added to 25% of the training images to simulate real-world tampering scenarios (e.g., blurring, deformation) and improve the model's adaptability to complex tampering.
[0146] Secondly, complementary features are extracted from three dimensions—local, global, and edge—using multiple models. Specifically, local features are extracted based on the CNN local similarity feature branch (CNN-LFE model); global features are extracted based on the Swin Transformer global similarity branch (SwinT-GFE model); and edge features are extracted based on the edge feature branch (EFE model, i.e. Figure 5 The model structure shown extracts edge features.
[0147] Finally, the correlation between the three branches of features (local features, global features, and marginal features) is quantified to generate comprehensive similar region features. Specifically, based on the correlation fusion module (CorFM model), the correlation matrix between branches is calculated to measure the statistical dependence of local, global, and marginal features, avoiding bias from a single branch. The correlation matrices of each branch are concatenated to obtain the similar region features.
[0148] It should be noted that the process of the SwinT-GFE model extracting global features is as follows: the input image to be detected is segmented into non-overlapping 4×4 pixel blocks and converted into one-dimensional vectors to form the input sequence. During this process, linear mapping and positional encoding are used to capture the spatial relationships between different pixels in the image. A windowed multi-head self-attention (W-MSA) mechanism allows the model to selectively focus on local regions in the sequence. Subsequently, a sliding windowed multi-head self-attention (SW-MSA) mechanism is used to achieve information sharing between different windows through window displacement, enabling a more comprehensive capture of the global information of the sequence. The entire model adopts a hierarchical structure, processing information through multi-head attention mechanisms at each level to better mine features at different scales.
[0149] The CorFM model calculates the correlation between features by performing Pearson correlations on local, global, and edge feature information, thereby improving the comprehensive feature representation of similar regions and fully acquiring information from different features to enhance the characterization of similar regions. Finally, a hollow spatial pyramid structure and a hybrid attention mechanism are introduced to obtain multi-scale spatial and channel information, making it more accurate in processing similar regions at different scales and levels.
[0150] Continuing with the content shown in Figure 8(a), the CorFM model is followed by the Spatial Convolutional Pooling Pyramid (ASPP) and the Similar Region Detection Network (SLM). This SLM network, combined with a Hybrid Attention Mechanism (CSAM), extracts spatial and channel features from multiple scales. Figures 8(b) and 8(c) show the network structures of SLM and CSAM, respectively.
[0151] The following describes the process of determining the characteristics of the tampered area.
[0152] In one embodiment, step M2 may specifically include the following steps.
[0153] Step M2” involves performing multi-scale analysis on the features of the similar regions and using an attention mechanism to determine the features of the tampered regions.
[0154] Specifically, convolution operations are performed on similar region features based on several convolution kernels; an attention mechanism is used to weight and fuse the convolution results generated after several convolution operations to determine the tampered region features.
[0155] In one specific embodiment, a target tampering region detection model is constructed, which is used to identify the source region and the target region in the image to be detected.
[0156] For example, Figures 9(a) and 9(b) show the structure diagram of the target tampering region detection model and the Inception network structure (i.e., Inception-am), respectively. In the target tampering region detection model (i.e., MTM-Net), by combining the Inception network with a hybrid attention mechanism, the focus is on the tampered regions in the channel and spatial information during the propagation process, and the tampered region features are finally output.
[0157] To facilitate understanding the fusion operation of similar region features, tampered region features, and image features in step M3, such as... Figure 10 As shown below, in conjunction with Figure 10 Describe the detection process that distinguishes between the source region and the target tampered region in the image to be detected.
[0158] The image features after normalization of the image to be detected, the tampered region features determined by the target tampered region detection model (i.e., MTM-Net), and the similar region features determined by the similar region localization model (i.e., SLM) are fused together. The fused result is used as the input of the U-net network for source region and target region detection, and the output is the source region and the tampered region.
[0159] In this example, by fusing deep and shallow feature information, similarity and tampering feature information into the input feature map, sufficient location feature information is provided to the U-net network, maximizing the advantages of the U-net network in feature segmentation and improving the accuracy of distinguishing source and target regions.
[0160] One embodiment of the present invention provides a computer-readable storage medium.
[0161] In one embodiment, a computer-readable storage medium stores a computer program executed by the processor mentioned above, or an image edge feature detection method or an image tampering detection method from any of the preceding technical solutions.
[0162] When the processor executes the computer program, it can perform the image edge feature detection method or image tampering detection method described in any of the preceding technical solutions; therefore, it will not be repeated here. Furthermore, the beneficial effects of using the same method will also not be repeated.
[0163] The computer-readable storage medium may include: flash drive, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk, etc.
[0164] In summary, this invention provides a method for detecting image edge features and an image tampering detection method. By performing a first edge calculation on the image to be detected, the boundaries of the main objects in the image can be quickly located. Subsequently, the image features are decomposed based on the channel information of the image to be detected, and a second edge calculation is performed on each sub-feature to mine edge detail information at different channel scales, thereby extracting more refined edge features. Finally, the edge calculation results of the overall edge features and the channel sub-features are fused, so that the final edge features contain both object contour information at the global scale and detailed information at the channel scale. This multi-level, multi-scale information fusion mechanism effectively compensates for the limitations of single-scale edge detection, avoiding detail loss due to global calculation and suppressing noise interference that may be generated by local channel calculation, enhancing the robustness and accuracy of edge detection. This allows the final edge features to more comprehensively and accurately reflect the edge structure in the image, providing high-quality edge information for subsequent image analysis and processing tasks.
[0165] It should be understood that although this specification describes embodiments, not every embodiment contains only one independent technical solution. This way of describing the specification is only for clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.
[0166] The detailed descriptions listed above are merely specific descriptions of feasible embodiments of the present invention, and are not intended to limit the scope of protection of the present invention. All equivalent embodiments or modifications made without departing from the spirit of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for detecting image edge features, characterized in that, include: Obtain the image to be detected; Perform the first edge calculation to obtain the first edge features of the image to be detected; The image features are split according to the channel information of the image to be detected, and the second edge is calculated for each sub-feature. The second edge features of the image to be detected are determined according to the second edge calculation results of the sub-features. The edge features of the image to be detected are determined based on the first edge feature and the second edge feature.
2. The detection method according to claim 1, characterized in that, The method further includes: Simultaneously, the steps of determining the first edge feature and determining the second edge feature are performed.
3. The detection method according to claim 1, characterized in that, The first edge calculation, to obtain the first edge features of the image to be detected, includes: Extract image features from the image to be detected and determine the corresponding feature matrix. Perform convolution operations on the feature matrix according to its corresponding rows and columns to determine the first feature matrix and the second feature matrix. Based on the first feature matrix and the second feature matrix, the corresponding first edge feature is determined.
4. The detection method according to claim 3, characterized in that, The step of determining the corresponding first edge feature based on the first feature matrix and the second feature matrix includes: Based on the mean squared error of the corresponding elements of the first feature matrix and the second feature matrix, the corresponding third feature matrix is determined; The first edge feature is determined by the dot product operation between the third feature matrix and the corresponding feature matrix.
5. The detection method according to claim 1, characterized in that, The sub-feature includes at least one of a first sub-feature and a second sub-feature; The step of performing second edge calculations on each sub-feature and determining the second edge features of the image to be detected based on the edge calculation results of the sub-features includes: The first edge calculation result of the first sub-feature and the second edge calculation result of the second sub-feature are concatenated to obtain the second edge feature.
6. The detection method according to claim 5, characterized in that, The first sub-feature forms a first sub-feature matrix, and the second sub-feature forms a second sub-feature matrix; the concatenation operation of the first edge calculation result of the first sub-feature and the second edge calculation result of the second sub-feature to obtain the second edge feature includes: The first sub-feature matrix is convolved with its corresponding rows and columns to determine the third and fourth feature matrices. The second sub-feature matrix is convolved with its corresponding rows and columns to determine the fifth and sixth feature matrices. The third feature matrix, the fourth feature matrix, the fifth feature matrix, and the sixth feature matrix are concatenated to obtain the second edge feature.
7. The detection method according to claim 1, characterized in that, Prior to performing the first edge calculation, the method further includes: Multi-scale convolutional features are extracted from the image to be detected based on the convolution kernel, and corresponding image features are determined. The first edge calculation, to obtain the first edge features of the image to be detected, includes: Perform a first edge calculation on each image feature, and then stitch together the first edge calculation results corresponding to each image feature to determine the first edge feature.
8. The detection method according to claim 1, characterized in that, The step of determining the edge features of the image to be detected based on the first edge feature and the second edge feature includes: The first edge feature and the second edge feature are spliced together, and activation and aggregation operations are performed on the spliced result to determine the edge features.
9. A method for detecting image tampering, characterized in that, The detection method includes: The image edge feature detection method according to any one of claims 1-8 is used to determine the edge features of the corresponding image to be detected; Based on the edge features, similar region features and tampered region features in the image to be detected are determined; By splicing together the similar region features, the tampered region features, and the image features of the image to be detected, at least one of the source region and the tampered target region in the image to be detected is identified based on the splicing result.
10. The image tampering detection method according to claim 9, characterized in that, The step of determining similar region features and tampered region features in the image to be detected based on the edge features includes: Based on the local and global features of the image to be detected, the features of the first similar region are determined; Based on the local features of the image to be detected and the edge features, the features of the second similar region are determined; Based on the global features of the image to be detected and the edge features, the features of the third similar region are determined; By concatenating the first correlation matrix, the second correlation matrix, and the third correlation matrix, the characteristics of similar regions are determined.
11. The image tampering detection method according to claim 9, characterized in that, The step of determining similar region features and tampered region features in the image to be detected based on the edge features includes: Multi-scale analysis was applied to the features of the similar regions, and an attention mechanism was used to determine the features of the tampered regions.
12. The image tampering detection method according to claim 10, characterized in that, Prior to the step of basing the detection on local and global features of the image, the method further includes: Based on the position information of each pixel in the image to be detected, global features are determined using a window self-attention mechanism and a cross-window multi-head attention mechanism.
