A lossy compression detection method and terminal fusing high-frequency spatial domain and DCT domain
By integrating feature extraction methods from the high-frequency spatial domain and the DCT domain, and combining them with the Swin Transformer V2 network, a WebP lossy compression detection network was trained. This solved the problem of poor detection performance of double compression in JPEG images, and enabled accurate WebP lossy compression detection and tamper location for JPEG images.
Patent Information
- Application Number
- CN202310830562.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-05
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2043-07-05
AI Technical Summary
Existing lossy compression detection methods for JPEG double compression are ineffective, especially in detecting tampering of WebP images.
A feature extraction method that integrates high-frequency spatial domain and DCT domain is adopted, combined with the Swin Transformer V2 network, to perform feature extraction and supervised learning on JPEG images, and to train a WebP lossy compression detection network to detect whether JPEG images have undergone WebP lossy compression.
It can effectively detect whether a JPEG image has undergone WebP lossy compression, helping to locate the tampering location of the image and improving the accuracy of JPEG double compression detection.
Smart Images

Figure CN117011591B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of multimedia information security and forensics, and in particular to a lossy compression detection method and terminal fusing high-frequency spatial domain and DCT domain. BACKGROUND
[0002] With the increasing popularity of digital products such as smart phones and digital cameras, people have various means of obtaining images, and the rapid development of the Internet has further accelerated the widespread use of digital images. However, with the increasing power of image editing software such as Photoshop and ACDsee, it has become easier to create tampered photos that are difficult to distinguish with the naked eye. Tampered images can easily be used for malicious activities. If the tamperer obtains a WebP lossy compression format in the network, adds a tampered image on the picture, and finally compresses the image using JPEG for the purpose of blurring the boundary between the tampered image and other areas and more widespread dissemination. At this time, it can be divided into several cases: 1) the tampered image is the original uncompressed one, so the tampered position after JPEG compression is a single compressed image block, while the other non-tampered area is an image block compressed by WebP first and then JPEG (referred to as WJPEG image block); 2) the tampered image is a JPEG image block, so the tampered position after JPEG compression is a 2-time JPEG compressed image block (referred to as DJPEG image block), while the other non-tampered area is still a WJPEG image block; 3) the tampered image is a WebP image block, although it is a WJPEG image block, but due to the difficulty of grid alignment of the tampered image, the compressed image block and the aligned WJPEG image block are not the same. Therefore, how to distinguish between single or multiple JPEG compression and WJPEG compression is an urgent practical problem for WebP image tamper detection.
[0003] At present, although many detection methods for double JPEG compression have been proposed, single JPEG compression and double JPEG compression in WebP image tampering belong to one category, while WJPEG belongs to another category. At this time, the method for detecting double JPEG compression is not effective or even fails in some cases.
[0004] Therefore, the prior art still needs to be improved. SUMMARY
[0005] The technical problem to be solved by the present application is that, in view of the defects of the prior art, the present application provides a lossy compression detection method and terminal fusing high-frequency spatial domain and DCT domain, to solve the technical problem that the lossy compression detection method for double JPEG compression is ineffective.
[0006] The technical solution adopted by the present application to solve the technical problem is as follows:
[0007] In a first aspect, the present application provides a lossy compression detection method combining high-frequency spatial domain and DCT domain, comprising:
[0008] obtaining a first JPEG compressed image dataset, training a WebP lossy compression detection network according to the first JPEG compressed image dataset, and obtaining a trained WebP lossy compression detection network;
[0009] obtaining a second JPEG compressed image dataset, performing WebP lossy compression trace detection on the second JPEG compressed image dataset according to the trained WebP lossy compression detection network, and outputting a detection result.
[0010] In an implementation manner, the obtaining of the first JPEG compressed image dataset comprises:
[0011] performing WebP lossy compression on preset images with different compression intensities by a compression and decompression tool, and / or performing JPEG lossy compression on the preset images with different compression intensities by a JPEG compression tool, to obtain the first JPEG compressed image dataset.
[0012] In an implementation manner, the WebP lossy compression detection network comprises a high-frequency spatial domain feature extraction module and a DCT domain feature extraction module.
[0013] In an implementation manner, the training of the WebP lossy compression detection network according to the first JPEG compressed image dataset comprises:
[0014] extracting image features of the first JPEG compressed image dataset by the high-frequency spatial domain feature extraction module and the DCT domain feature extraction module respectively;
[0015] inputting the obtained image features into corresponding Swin Transformer V2 networks for analysis and learning, and focusing on WebP lossy compression traces in JPEG images by an attention module, to obtain the trained WebP lossy compression detection network.
[0016] In an implementation manner, the extracting of the image features of the first JPEG compressed image dataset by the high-frequency spatial domain feature extraction module and the DCT domain feature extraction module respectively comprises:
[0017] in the high-frequency spatial domain feature extraction module, filtering a to-be-detected grayscale image in the first JPEG compressed image dataset by using a high-pass filter, extracting first features of the to-be-detected image, and splicing the first features in a channel to obtain spliced first features;
[0018] In the DCT domain feature extraction module, the first JPEG compressed image data set is subjected to DCT basis functions to obtain DCT coefficients of each channel; the alternating current coefficients in the DCT coefficients of each channel are convolved according to the corresponding channel direction to obtain a second feature;
[0019] The DCT coefficients of each channel are counted in the corresponding channel to obtain a probability histogram of the DCT coefficients of each channel, and the probability histogram is input into a convolutional neural network to obtain a third feature.
[0020] In an implementation manner, the WebP lossy compression detection network is trained according to the first JPEG compressed image data set to obtain a trained WebP lossy compression detection network, including:
[0021] The first feature, the second feature and the third feature after splicing are combined on a full connection layer, the traces of WebP lossy compression in a JPEG image are focused through an attention module, and the trained WebP lossy compression detection network is obtained.
[0022] In an implementation manner, the first feature, the second feature and the third feature after splicing are combined on a full connection layer, the traces of WebP lossy compression in a JPEG image are focused through an attention module, and the trained WebP lossy compression detection network is obtained, including:
[0023] The second JPEG compressed image data is input into the lossy compression model to obtain a category to which the second JPEG compressed image belongs;
[0024] Whether the second JPEG image is subjected to WebP lossy compression is determined through the category to which the second JPEG image belongs, and a detection result is output.
[0025] In an implementation manner, the category to which the second JPEG compressed image belongs includes: a JPEG image not subjected to WebP lossy compression and a JPEG image subjected to WebP lossy compression;
[0026] The JPEG image not subjected to WebP lossy compression is: an image subjected to single JPEG compression and an image subjected to multiple JPEG compressions;
[0027] The JPEG image subjected to WebP lossy compression is: an image subjected to WebP lossy compression and then subjected to JPEG compression.
[0028] In a second aspect, the present application also provides a terminal, comprising: a processor and a memory, the memory storing a lossy compression detection program fusing high-frequency spatial domain and DCT domain, the lossy compression detection program fusing high-frequency spatial domain and DCT domain being used to implement the operations of the lossy compression detection method fusing high-frequency spatial domain and DCT domain when executed by the processor.
[0029] In a third aspect, the present application also provides a computer-readable storage medium storing a lossy compression detection program fusing high-frequency spatial domain and DCT domain, the lossy compression detection program fusing high-frequency spatial domain and DCT domain being used to implement the operations of the lossy compression detection method fusing high-frequency spatial domain and DCT domain when executed by a processor.
[0030] The technical scheme of the present application has the following effects:
[0031] The present application can detect whether the JPEG image has been compressed by WebP lossy compression according to the trained WebP lossy compression detection network, and output the WebP lossy compression detection result, thereby achieving the effect of detecting whether the JPEG image has been compressed by WebP lossy compression in various cases, and helping subsequent tamper positioning of tampered images. The present application proposes a lossy compression detection method fusing high-frequency spatial domain and DCT domain, which solves the problem of poor effect or even failure of the existing lossy compression detection method for JPEG double compression. BRIEF DESCRIPTION OF DRAWINGS
[0032] In order to more clearly illustrate the technical scheme in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained according to the structures shown in the drawings without creative labor.
[0033] Figure 1 is a flowchart of a lossy compression detection method fusing high-frequency spatial domain and DCT domain in an implementation manner of the present application.
[0034] Figure 2 is a schematic diagram of tamper operation steps of a tamper on a WebP image in an implementation manner of the present application.
[0035] Figure 3It is a schematic diagram of a WebP lossy compression detection network structure for detecting a JPEG image in an implementation manner of the present application.
[0036] Figure 4 It is a functional schematic diagram of a terminal in an implementation manner of the present application.
[0037] The implementation, functional features and advantages of the present application will be further described with reference to the accompanying drawings and embodiments. DETAILED DESCRIPTION
[0038] In order to make the purpose, technical solutions and advantages of the present application more clear and explicit, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and do not limit the present application.
[0039] Exemplary method
[0040] Since the image compressed by WebP is tampered and compressed by JPEG, it will inevitably leave traces of WebP historical compression, but at the present stage, although many detection methods for double JPEG compression have been proposed, single JPEG compression and double JPEG compression in WebP image tampering belong to one category, while WJPEG belongs to another category, at this time the method for detecting double JPEG compression is not effective and even fails in some cases, therefore the existing JPEG compression detection method still has the technical problem of poor detection effect for double JPEG compression and even failure in some cases.
[0041] In order to solve the above technical problems, the present application provides a lossy compression detection method fusing high-frequency spatial domain and DCT domain, which extracts features from images by fusing high-frequency spatial domain feature extraction module and DCT domain feature extraction module, and uses more advanced Swin Transformer V2 network for supervised learning and training of fused features, so as to better detect WJPEG image blocks in various cases, and solve the problem of poor compression detection effect for double JPEG compression in the prior art.
[0042] The present application is different from the traditional JPEG lossy compression detection method, since the image compressed by WebP lossy compression will leave traces of WebP lossy compression on the image after JPEG compression, while the image not compressed by WebP lossy compression will not leave such traces, the present application extracts features from JPEG images by fusing high-frequency spatial domain and DCT domain, which can effectively detect whether the JPEG image has been compressed by WebP lossy compression, thereby facilitating further tampering positioning operation, and the schematic diagram of tampering operation steps of the tamperer on the WebP image is as follows:Figure 2 As shown.
[0043] like Figure 1 As shown, this embodiment of the invention provides a lossy compression detection method that integrates high-frequency spatial domain and DCT domain, including the following steps:
[0044] Step S100: Obtain the first JPEG compressed image dataset, and train the WebP lossy compression detection network based on the first JPEG compressed image dataset to obtain the trained WebP lossy compression detection network.
[0045] In this embodiment, the lossy compression detection method that integrates high-frequency spatial domain and DCT domain is applied in a terminal, which includes, but is not limited to, devices such as computers and mobile terminals; the terminal is equipped with a training and transfer platform for the lossy compression detection model that integrates high-frequency spatial domain and DCT domain.
[0046] The lossy compression detection method that integrates high-frequency spatial domain and DCT domain provided in this embodiment of the invention extracts features from JPEG images through high-frequency spatial domain feature modules and DCT domain feature modules, and then inputs them into the corresponding Swing TransformerV2 network for training to obtain a trained WebP lossy compression detection network, which then performs WebP lossy compression detection on JPEG images.
[0047] In this embodiment, after obtaining the first JPEG compressed image dataset, it is also necessary to perform feature extraction on the first JPEG compressed image dataset based on the high-frequency spatial domain feature extraction module and the DCT domain feature extraction module, and input the fused features into the Swing Transformer V2 network for supervised learning and training. The attention module is used to focus on WebP lossy compression traces in the JPEG image to obtain the trained WebP lossy compression detection network.
[0048] Specifically, in one implementation of this embodiment, the following steps are included before step S100:
[0049] Step S001: Perform WebP lossy compression with different compression intensities on the preset image using a compression and decompression tool, and / or perform JPEG lossy compression with different compression intensities on the preset image using a JPEG compression tool to obtain the first JPEG compressed image dataset.
[0050] In the embodiment, the images are subjected to JPEG lossy compression with different compression intensities by using a JPEG compression tool provided by Opencv, and subjected to WebP lossy compression with different compression intensities by using a compression and decompression tool provided by a WebP official website; the images are subjected to JPEG lossy compression with different compression intensities by using the JPEG compression tool, and batch generation of pictures subjected to single JPEG compression and pictures subjected to two times of JPEG compression in sequence is performed; the images are subjected to WebP lossy compression with different compression intensities by using the compression and decompression tool provided by the WebP official website, and then subjected to JPEG lossy compression with different compression intensities by using the JPEG compression tool, and batch generation of pictures subjected to WebP lossy compression and then subjected to JPEG compression is performed, so as to obtain a first JPEG compressed image dataset.
[0051] In the embodiment, the first JPEG compressed images are divided into JPEG images not subjected to WebP lossy compression and JPEG images subjected to WebP lossy compression; wherein the JPEG images not subjected to WebP lossy compression are images subjected to single JPEG compression and images subjected to multiple times of JPEG compression; and the JPEG images subjected to WebP lossy compression are images subjected to WebP lossy compression and then subjected to JPEG compression.
[0052] In the embodiment, the WebP lossy compression detection network schematic diagram is as shown in Figure 3 The WebP lossy compression detection network schematic diagram is as shown in
[0053] In the embodiment, the first JPEG compressed image dataset is subjected to feature extraction by the high-frequency spatial domain feature extraction module, so as to obtain spliced first features; and the first JPEG compressed image dataset is subjected to feature extraction by the DCT domain feature extraction module, so as to obtain second features and third features.
[0054] Specifically, in one implementation manner of the embodiment, the step S100 includes the following steps:
[0055] The step S110 includes the following steps:
[0056] The step S120 includes the following steps:
[0057] In the embodiment, the high-frequency spatial domain feature extraction module is used for high-frequency spatial domain feature extraction on the first JPEG image, the extracted image features are spliced, and the spliced first features are obtained; the DCT domain feature extraction module is used for DCT domain image feature extraction on the first JPEG image, and second features and third features are obtained.
[0058] In the embodiment, the spliced first features are input into a first Swin Transformer V2 network for analysis and learning, and the learned first features are obtained; the second features are input into a second Swin Transformer V2 network for analysis and learning, and the learned second features are obtained.
[0059] In the embodiment, the learned first features, the learned second features and the third features are merged on a full connection layer, and the WebP lossy compression detection network after the full connection layer is obtained by adding an attention module to focus on the WebP lossy compression traces in the JPEG image, and the trained WebP lossy compression detection network is obtained.
[0060] Specifically, in one implementation manner of the embodiment, step S110 includes the following steps:
[0061] Step S111, in the high-frequency spatial domain feature extraction module, the first features of the to-be-tested gray image in the first JPEG compressed image dataset are extracted by using a high-pass filter to filter the to-be-tested gray image, and the first features are spliced on the channel to obtain the spliced first features.
[0062] Step S112, in the DCT domain feature extraction module, the first JPEG compressed image dataset is subjected to DCT basis function to obtain DCT coefficients of each channel; the alternating current coefficients in the DCT coefficients of each channel are convolved according to the direction of the channel to obtain second features.
[0063] Step S1113, the DCT coefficients of each channel are counted in the corresponding channel to obtain a probability histogram of the DCT coefficients of each channel, and the probability histogram is input into a convolutional neural network to obtain third features.
[0064] In the embodiment, 30 high-pass filters of SRM are used in the high-frequency spatial domain feature extraction module to filter the to-be-tested gray image in the first JPEG compressed image dataset, high-frequency features of the to-be-tested image are extracted, and 30 obtained high-frequency features are spliced on the channel to obtain the spliced first features for subsequent input into the Swin Transformer V2 network.
[0065] In the embodiment, since the WebP lossy compression is based on the DCT transform of 4x4 scale, the WebP compression traces of the images can be better distinguished in the DCT domain after the WebP lossy compression, so the DCT domain feature extraction module is introduced; in the DCT domain feature extraction module, the original images in the first JPEG compressed image set are respectively convolved using the 4x4 DCT basis function matrix as the convolution kernel, so as to obtain 16 channels of DCT coefficients, and each channel represents different frequency DCT coefficients.
[0066] In the embodiment, since the direct current coefficient in the DCT coefficient is too large to cause the model to pay too much attention, the alternating current coefficient in the DCT coefficient is processed by using the 3D convolution kernel in the corresponding channel direction to block and linearly embed, so as to obtain the second feature input into the Swin Transformer V2 network.
[0067] In the embodiment, since the DCT coefficients after the WebP compression are more concentrated in the vicinity of the quantization step value, the probability histogram of the value of each channel of the DCT coefficient is drawn to represent this feature, that is, the probability histogram of the DCT coefficient is obtained by counting the DCT coefficients in each channel, and then the 2D convolutional neural network is designed to obtain the third feature.
[0068] Specifically, in one implementation manner of the embodiment, the step S120 includes the following steps:
[0069] In step 121, the spliced first feature, the second feature and the third feature are combined on the full connection layer, the attention module pays attention to the WebP lossy compression traces in the JPEG image, and the trained WebP lossy compression detection network is obtained.
[0070] In the embodiment, the spliced first feature is input into the first Swin Transformer V2 network for analysis and learning to obtain the learned first feature; the second feature is input into the second Swin Transformer V2 network for analysis and learning to obtain the learned second feature; the learned first feature, the learned second feature and the third feature are combined on the full connection layer, and the attention module is added after the full connection layer stage to better pay attention to the WebP lossy compression traces in the JPEG image, so as to achieve better performance.
[0071] In this embodiment, in the Swin Transformer V2 network parameter setting, the initial embedding channel is set to 96, and the size of the sliding window is set to 16. According to different positions of different Swin Transformer V2 networks, the number of multi-head attention mechanisms in the internal part is set to 3, 6, 12 and 24.
[0072] In this embodiment, the WebP lossy compression detection network is trained in the way of random gradient descent and back propagation, the Adam optimizer is used, the initial learning rate is set to 1x10 -4 ; the WebP lossy compression detection network is trained for a total of 12 generations, the learning rate is reduced to 10% of the original every 5 generations; and cross entropy is used as the loss function of the network; in the training stage, 48 pictures in the first JPEG image dataset are used to train the WebP lossy compression detection network each time.
[0073] In this embodiment, the WebP lossy compression detection network is a pixel-level binary classifier.
[0074] As shown in Figure 1 , the embodiment of the application provides a lossy compression detection method fusing high-frequency spatial domain and DCT domain, which further includes the following steps:
[0075] Step S200, obtaining a second JPEG compressed image dataset, performing WebP lossy compression trace detection on the second JPEG compressed image dataset according to the trained WebP lossy compression detection network, and outputting a detection result.
[0076] Specifically, in one implementation manner of this embodiment, step S200 includes the following steps:
[0077] Step S210, inputting the second JPEG compressed image data into the lossy compression model to obtain the category to which the second JPEG compressed image belongs;
[0078] Step S220, judging whether the second JPEG image has been subjected to WebP lossy compression through the category to which the second JPEG image belongs, and outputting a detection result.
[0079] In this embodiment, the JPEG image to be tested is obtained as the second JPEG compressed image dataset, the JPEG image data in the second JPEG compressed image dataset is input into the trained WebP lossy compression detection network, the WebP lossy compression detection network performs test classification on the JPEG image data, and finally outputs the category to which the JPEG image data belongs, so as to judge whether the JPEG image has ever been subjected to WebP lossy compression.
[0080] The category to which the second JPEG compressed image belongs includes: a JPEG image not compressed by WebP lossy compression and a JPEG image compressed by WebP lossy compression; wherein the JPEG image not compressed by WebP lossy compression is: an image compressed by single JPEG compression and an image compressed by multiple JPEG compression; and the JPEG image compressed by WebP lossy compression is: an image compressed by WebP lossy compression and then compressed by JPEG compression.
[0081] In the embodiment, the second JPEG compressed image is detected by the WebP lossy compression detection network, and the WebP lossy compression detection network outputs the category to which the second JPEG compressed image belongs; if the second JPEG compressed image is an image not compressed by WebP lossy compression, it is determined to be an image not compressed by WebP lossy compression; and if the second JPEG compressed image is an image compressed by WebP lossy compression, it is determined to be an image compressed by WebP lossy compression.
[0082] As shown in the following table, the embodiment verifies the effectiveness of the WebP lossy compression detection effect according to different feature fusion methods on the JPEG image data set.
[0083] In order to verify that the method proposed this time can have better detection performance compared with the existing JPEG double compression algorithm, several advanced JPEG double compression detection methods are selected for comparison; the comparison results are shown in Table 1.
[0084] Table 1 Comparison of existing JPEG double compression algorithms
[0085]
[0086] In order to verify that the method using DCT domain fusion can improve the detection performance compared with a single method, experiments are performed by using only DCT domain histogram features and using mixed DCT domain features, and then the detection performance of the network is observed; the detection performance is shown in Table 2.
[0087] Table 2 Comparison of detection performance of different DCT domain features
[0088]
[0089] In order to verify the improvement of the detection performance of the method using double domain fusion, experiments are performed by using only DCT domain features and adding SRM high-pass filter features, and the improvement of the network performance is observed; the detection performance is shown in Table 3, and it can be seen from the table that the network has better detection performance after adding the SRM high-pass filter.
[0090] Table 3 Detection performance table AUC of different methods
[0091]
[0092] From the above experimental results, it is known that the WebP lossy compression detection method by adding DCT mixed features and high-frequency spatial features has better detection performance on JPEG images compressed by WebP; this has important significance for the design of image security use occasions.
[0093] The embodiment achieves the following technical effects through the above technical scheme:
[0094] The present application obtains a first JPEG compressed image data set, trains a WebP lossy compression detection network according to the first JPEG compressed image data set, obtains a trained WebP lossy compression detection network, can perform WebP lossy compression detection on the to-be-tested JPEG image data according to the trained WebP lossy compression detection network, and output the WebP lossy compression detection result, thereby achieving the effect of detecting whether the JPEG image is compressed by WebP lossy compression in various cases, and helping subsequent tampering positioning of tampered images; the present application proposes a lossy compression detection method fusing high-frequency spatial domain and DCT domain, solves the problem of poor effect of the existing lossy compression detection method for JPEG double compression, and even failure in some cases.
[0095] Exemplary device
[0096] Based on the above embodiment, the present application further provides a terminal, comprising: a processor, a memory, an interface, a display screen and a communication module connected through a system bus; wherein the processor is used to provide calculation and control capability; the memory comprises a storage medium and an internal memory; the storage medium stores an operating system and a computer program; the internal memory provides an environment for the operating system and the computer program in the storage medium to run; the interface is used to connect external devices, such as mobile terminals and computer devices; the display screen is used to display corresponding information; and the communication module is used to communicate with a cloud server or a mobile terminal.
[0097] The computer program is executed by the processor to implement the operation of the lossy compression detection method fusing high-frequency spatial domain and DCT domain.
[0098] Those skilled in the art can understand that, Figure 4 The principle block diagram shown in the figure is only a block diagram of part of the structure related to the present application scheme, and does not constitute a limitation on the terminal to which the present application scheme is applied, and the specific terminal can include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.
[0099] In one embodiment, a terminal is provided, comprising: a processor and a memory, the memory storing a lossy compression detection program fusing high-frequency spatial domain and DCT domain, the lossy compression detection program fusing high-frequency spatial domain and DCT domain, when executed by the processor, being used for implementing operations of the lossy compression detection method fusing high-frequency spatial domain and DCT domain.
[0100] In one embodiment, a computer readable storage medium is provided, the computer readable storage medium storing a lossy compression detection program fusing high-frequency spatial domain and DCT domain, the lossy compression detection program fusing high-frequency spatial domain and DCT domain, when executed by the processor, being used for implementing operations of the lossy compression detection method fusing high-frequency spatial domain and DCT domain.
[0101] It can be understood by those skilled in the art that all or part of the processes in the above-mentioned embodiments can be completed by a computer program instructing related hardware, and the computer program can be stored in a non-volatile storage medium. When the computer program is executed, it can include the processes of the above-mentioned embodiments. Any reference to memory, storage, database or other medium used in the embodiments provided by the present application can include non-volatile and / or volatile memory.
[0102] In summary, the present application provides a lossy compression detection method and terminal fusing high-frequency spatial domain and DCT domain, the method comprising: obtaining a first JPEG compressed image data set, training a WebP lossy compression detection network according to the first JPEG compressed image data set to obtain a trained WebP lossy compression detection network; obtaining a second JPEG compressed image data set, performing WebP lossy compression trace detection on the second JPEG compressed image data set according to the trained WebP lossy compression detection network, and outputting a detection result; the method for feature extraction of JPEG image fusing high-frequency spatial domain and DCT domain provided by the present application solves the problem that the lossy compression detection method for JPEG double compression in the prior art is not effective or even fails in some cases.
[0103] It should be understood that the application of the present application is not limited to the above examples, and those skilled in the art can make improvements or changes according to the above description, and all these improvements and changes should belong to the protection scope of the appended claims of the present application.
Claims
1. A lossy compression detection method that fuses high frequency spatial and DCT domain, characterized by, The method comprises the following steps: obtaining a first JPEG compressed image data set, training a WebP lossy compression detection network according to the first JPEG compressed image data set to obtain a trained WebP lossy compression detection network; obtaining a second JPEG compressed image data set, performing WebP lossy compression trace detection on the second JPEG compressed image data set according to the trained WebP lossy compression detection network, and outputting a detection result; the WebP lossy compression detection network comprises a high-frequency spatial domain feature extraction module and a DCT domain feature extraction module; the training of the WebP lossy compression detection network according to the first JPEG compressed image data set comprises the following steps: extracting image features of the first JPEG compressed image data set through the high-frequency spatial domain feature extraction module and the DCT domain feature extraction module respectively; inputting the obtained image features into corresponding Swin Transformer V2 networks for analysis and learning, and focusing on WebP lossy compression traces in JPEG images through an attention module to obtain the trained WebP lossy compression detection network; the extraction of the image features of the first JPEG compressed image data set through the high-frequency spatial domain feature extraction module and the DCT domain feature extraction module respectively comprises the following steps: in the high-frequency spatial domain feature extraction module, filtering the to-be-detected grayscale image in the first JPEG compressed image data set through a high-pass filter, extracting first features of the to-be-detected image, and splicing the first features in the channel to obtain spliced first features; in the DCT domain feature extraction module, obtaining DCT coefficients of each channel of the first JPEG compressed image data set through a DCT basis function; and convolving alternating current coefficients in the DCT coefficients of each channel according to the corresponding channel direction to obtain second features; statistically obtaining a probability histogram of the DCT coefficients of each channel in the corresponding channel, inputting the probability histogram into a convolutional neural network to obtain third features.
2. The method of claim 1, wherein the method is characterized by: Before the step of obtaining the first JPEG compressed image data set, the method further comprises the following steps: performing WebP lossy compression on a preset image at different compression intensities through a compression and decompression tool, and / or performing JPEG lossy compression on the preset image at different compression intensities through a JPEG compression tool to obtain the first JPEG compressed image data set.
3. The method of claim 1, wherein the method is characterized by: the training of the WebP lossy compression detection network according to the first JPEG compressed image data set comprises the following steps: merging the spliced first features, the second features and the third features on a full connection layer, focusing on WebP lossy compression traces in JPEG images through an attention module, and obtaining a trained WebP lossy compression detection network.
4. The method of claim 1, wherein the method is characterized by: The second JPEG compressed image data set is obtained, WebP lossy compression trace detection is performed on the second JPEG compressed image data set according to the trained WebP lossy compression detection network, and a detection result is output, including: The second JPEG compressed image data is input into the trained WebP lossy compression detection network, and a category to which the second JPEG compressed image belongs is obtained; Whether the second JPEG compressed image is compressed by WebP lossy compression is determined according to the category to which the second JPEG compressed image belongs, and a detection result is output.
5. The method of claim 4, wherein the method is characterized by: The category to which the second JPEG compressed image belongs includes a JPEG image that has not been compressed by WebP lossy compression and a JPEG image that has been compressed by WebP lossy compression; The JPEG image that has not been compressed by WebP lossy compression is an image compressed by single JPEG compression and an image compressed by multiple JPEG compressions; The JPEG image compressed by WebP lossy compression is an image compressed by WebP lossy compression and then compressed by JPEG compression.
6. A terminal, characterized by comprising: including: A processor and a memory, the memory storing a high-frequency spatial domain and DCT domain fusion lossy compression detection program, the high-frequency spatial domain and DCT domain fusion lossy compression detection program being used to implement the operations of the high-frequency spatial domain and DCT domain fusion lossy compression detection method according to any one of claims 1-5 when executed by the processor.
7. A computer readable storage medium characterized in that, The computer readable storage medium stores a high-frequency spatial domain and DCT domain fusion lossy compression detection program, the high-frequency spatial domain and DCT domain fusion lossy compression detection program being used to implement the operations of the high-frequency spatial domain and DCT domain fusion lossy compression detection method according to any one of claims 1-5 when executed by the processor.
Citation Information
Patent Citations
Tamped image detection method and device, equipment and storage medium
CN110942456A
Image detection method and device, and training method and device of neural network model
CN111415323A
Double-flow face counterfeiting detection method based on Swin Transform
CN114694220A