JPEG image recovery method based on discrete cosine transform and mamba network
By combining the Discrete Cosine Transform and the Mamba network, the DCTMamba framework solves the problems of global information processing and computational complexity in JPEG image restoration, and achieves high-quality image restoration results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- UNIV OF SCI & TECH OF CHINA
- Filing Date
- 2025-02-18
- Publication Date
- 2026-04-14
AI Technical Summary
Existing CNN-based JPEG image restoration methods are limited by local subtraction bias and have difficulty effectively processing global information. Transformer-based methods face computational complexity bottlenecks, and Mamba is not suitable for non-causal image restoration tasks, resulting in poor JPEG image restoration performance.
By combining discrete cosine transform and Mamba network, a DCTMamba framework is constructed. Through multi-scale feature extraction and expansion modules, a causal scanning sequence is established to adapt to the restoration needs of images of different sizes. The network parameters are optimized through the total loss function.
It improves the fidelity and quality consistency of JPEG image restoration, especially when processing images of different sizes, and surpasses the restoration results of existing methods.
Smart Images

Figure CN120070268B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image processing, specifically a JPEG image restoration method based on discrete cosine transform and Mamba network. Background Technology
[0002] JPEG is a widely used lossy compression method that initially divides an image into 8×8 pixel blocks, then uses a Discrete Cosine Transform (DCT) to transform these blocks from the spatial domain to the frequency domain. This transformation prioritizes low-frequency components, significantly reducing high-frequency details during quantization, which often contain subtle features of the image. Therefore, this compression method achieves a significant reduction in file size, minimizing storage and bandwidth requirements. The quality factor (QF) in JPEG determines how much high-frequency information is discarded; a lower QF value leads to stronger compression and more noticeable image distortion. While JPEG compression is effective in reducing file size, the artifacts it introduces degrade visual quality and hinder computer vision tasks such as image recognition and object detection.
[0003] With the rapid development of deep learning, the field of JPEG restoration has undergone a transformation, with neural network-based methods gradually replacing traditional model-based approaches. These neural network methods have demonstrated remarkable performance; Convolutional Neural Networks (CNNs) utilize their non-linear mapping capabilities to restore degraded images to their original state. Furthermore, techniques like SwinIR leverage the long-sequence modeling potential of transformers, significantly expanding the receptive field. Recently, Mamba has been at the forefront of long-sequence modeling, particularly renowned for its powerful performance. Mamba is now being used in image restoration projects to effectively utilize global information, setting a new standard in the field.
[0004] However, these advanced methods face unique challenges: (1) CNN-based methods are limited by their inherent local scaling bias, resulting in poor performance when dealing with image restoration tasks that require global information; (2) Transformer-based methods face secondary computational complexity, making it difficult to process very long sequence inputs, thus leading to bottlenecks in resource consumption and processing speed; (3) Although Mamba is suitable for causal autoregressive tasks, it is not suitable for non-causal image restoration tasks, limiting its effectiveness in such applications. Summary of the Invention
[0005] This invention addresses the shortcomings of existing technologies by proposing a JPEG image restoration method based on discrete cosine transform and Mamba network. The aim is to establish a scanning sequence that conforms to the autoregressive properties of Mamba and to flexibly process images of different sizes, thereby improving the fidelity of JPEG image restoration.
[0006] To solve the above-mentioned technical problems, the present invention adopts the following technical solution:
[0007] The JPEG image restoration method based on discrete cosine transform and Mamba network of this invention is characterized by the following steps:
[0008] Step 1: Acquire a batch of JPEG images and its corresponding clean image ,in, Indicates the first A JPEG image, Indicates the first A clean image, where B represents the number of images in a batch. This represents the number of channels in an image. and These represent the height and width of the image, respectively.
[0009] from and its corresponding Each of the above images is cropped to the same position, and the corresponding image patch is denoted as the first one. JPEG image blocks and the A clean image block Where N represents the height and width of the image patch;
[0010] Step 2: Construct the DCTMamba network, including: shallow feature extraction module, encoder module, decoder module and reconstruction module;
[0011] Step 3: The shallow feature extraction module consists of a convolutional kernel with a size of... The convolutional layer is composed of a cascaded GELU activation function, and is used for... Processing is performed to obtain the first... shallow features ;
[0012] Step 4: The encoder module consists of Q multi-scale feature reduction modules connected in series, and performs... Processing is performed to obtain the first... Multi-scale coded feature set ={ },in, This represents the q-th multi-scale encoded feature;
[0013] Step 5: The decoder module consists of Q multi-scale feature expansion modules connected in series, and performs... The i-th multi-scale decoding feature set is obtained through processing. ={ ,... },in, This represents the q-th multi-scale decoding feature;
[0014] Step 6: The reconstruction module consists of R convolutional kernels of size R. Step size is The fill parameters are / / 2 convolutional layers are connected in series, and for After processing, the first result is obtained. A restored JPEG image block Where / / indicates rounding down;
[0015] Step 7: Calculate the total loss function It is used to perform backpropagation training on the DCTMamba network and to optimize the parameters of the DCTMamba network using the Adam optimizer. When the maximum number of training iterations is reached, the training stops, thereby obtaining the optimal JPEG image restoration model for JPEG image restoration.
[0016] The JPEG image restoration method based on discrete cosine transform and Mamba network described in this invention is also characterized in that each multi-scale feature reduction module in step 4 is composed of a first multi-level unit and a downsampling module connected in series.
[0017] Step 4.1: The first multi-level unit consists of a local module and a state space module arranged in parallel from coarse to fine.
[0018] When q=1, the first multi-level unit pair The q-th encoded state space feature is obtained through processing. ;
[0019] Step 4.2: The downsampling module consists of convolutional layers and the GELU activation function;
[0020] When q=1, The input is processed in the downsampling module of the q-th multi-scale feature reduction module, so that... The size was reduced to the original. The number of channels is increased by a times, thus obtaining the q-th multi-scale encoded feature. Where a represents the scaling factor;
[0021] Step 4.3: When q=2,3,…,Q, encode the (q-1)th multi-scale feature. The input is processed in the q-th multi-scale feature reduction module, and the Q-th multi-scale encoded feature is output by the Q-th multi-scale feature reduction module. .
[0022] Furthermore, step 4.1 includes:
[0023] Step 4.1.1: The local module is composed of Y dense residual modules in sequence, and each dense residual module includes Z convolutional layers;
[0024] When q=1, The input is processed by the Y dense residual modules of the local module of the first multi-level unit to obtain the q-th encoded local feature. ;
[0025] Step 4.1.2: The coarse-to-fine state space module consists of two parallel paths and a linear layer with an expansion factor of 1 / Z. The first path consists of a scale modulation module and a scale adaptation module connected in series, and the second path consists of a linear layer with an expansion factor of Z and a SiLU activation function connected in series. The scale modulation module consists of a linear layer with an expansion factor of Z, a depth convolutional layer, and a SiLU activation function connected in series. The scale adaptation module consists of a discrete cosine transform layer, a normalization layer, and an inverse discrete cosine transform layer.
[0026] Step 4.1.2.1: When q=1, The input is processed by the scale modulation module of the first path of the state space module after being fed into the q-th multi-scale feature reduction module, resulting in the q-th coded scale modulation feature. ;
[0027] Will The input is then processed in the Discrete Cosine Transform layer of the scale adaptation module of the first path to obtain the q-th Discrete Cosine Feature. The normalization layer uses equation (1) to obtain the q-th normalized discrete cosine feature. :
[0028] (1)
[0029] In equation (1), m and n represent respectively The row and column positions of the feature values; express The position coordinates of the eigenvalues;
[0030] right After performing top-down and left-to-right Mamba autoregressive processing, the input is placed into the inverse discrete cosine transform layer, and the output is the q-th encoder scale adaptive feature. ;
[0031] Step 4.1.2.2: [The text abruptly ends here, likely due to an incomplete sentence or a formatting error.] After processing the input in the second path, the q-th encoded scale dilation feature is obtained. ;
[0032] Step 4.1.2.3: [The text abruptly ends here, likely due to an incomplete sentence or a formatting error.] and After performing the Hadamard product operation, it is then processed through a linear layer with an inflation factor of 1 / Z to obtain the q-th encoded state space feature. .
[0033] Furthermore, each multi-scale feature expansion module in step 5 is composed of a second multi-level unit and an upsampling module connected in series;
[0034] Step 5.1: The second multi-level unit has the same structure as the first multi-level unit;
[0035] When q=1, The input is placed into the second multi-level unit of the q-th multi-scale feature expansion module and processed according to steps 4.1.1-4.1.2.3 to obtain the q-th decoded state space feature. ;
[0036] Step 5.2: The upsampling module consists of a transposed convolutional layer and a GELU activation function;
[0037] When q=Q, The input is processed in the upsampling module of the q-th multi-scale feature expansion module, so that... The size is increased to a times the original, and the number of channels is reduced to the original. After doubling, then with Add them together to obtain the q-th multi-scale decoding feature. ;
[0038] Step 5.3: When q = Q-1, Q-2, ..., 1, decode the (q-1)th multi-scale feature. The input is processed in the q-th multi-scale feature expansion module, thereby outputting the first multi-scale decoded feature from the first multi-scale feature expansion module. .
[0039] Furthermore, the total loss function in step 7 It is established according to the following steps:
[0040] Step 7.1: Construct the absolute value loss function using equation (2). :
[0041] (2)
[0042] Step 7.2: Construct the discrete cosine loss function using equation (3). :
[0043] (3)
[0044] In equation (3), DCT represents the discrete cosine transform operation;
[0045] Step 7.3: Construct the structural similarity loss using equation (4). :
[0046] (4)
[0047] In equation (4), SSIM represents the structural similarity calculation function;
[0048] Step 7.4: Construct the total loss function using equation (5) :
[0049] (5)
[0050] In equation (5), and There are two hyperparameters.
[0051] The present invention provides an electronic device, including a memory and a processor, wherein the memory is used to store a program that supports the processor in executing a JPEG image restoration method, and the processor is configured to execute the program stored in the memory.
[0052] The present invention discloses a computer-readable storage medium on which a computer program is stored, wherein the computer program, when executed by a processor, performs the steps of the JPEG image restoration method.
[0053] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0054] 1. This invention introduces the DCTMamba framework, combining the compression features of JPEG with the advantages of Mamba long sequence processing. By integrating discrete cosine transform into Mamba, scanning from low to high frequencies is achieved, establishing causal relationships between scan sequences, thereby enhancing the fidelity of image restoration.
[0055] 2. To address the challenges posed by variations in frequency component density due to different image sizes, this invention introduces a normalization process for the discrete cosine variation coefficients. This normalization balances the contributions of various frequency components, improving the consistency of image restoration quality across different sizes. Attached Figure Description
[0056] Figure 1 These are the low-frequency and high-frequency components of the image after DCT transformation;
[0057] Figure 2 This is a comparison chart before and after normalization;
[0058] Figure 3 This is a diagram of the overall network framework;
[0059] Figure 4 This is a graph showing the quantitative performance indicators of the present invention;
[0060] Figure 5 This is a visual comparison of the present invention with other methods on Classic5;
[0061] Figure 6 This is a visual comparison of the invention with other methods on Twitter. Detailed Implementation
[0062] In this embodiment, a JPEG image restoration method based on DCT and Mamba is presented, aiming to address the challenges in JPEG image restoration. It constructs an image restoration framework that combines the compression characteristics of JPEG with the advantages of Mamba, and includes the following steps:
[0063] Step 1: Acquire a batch of JPEG images and its corresponding clean image ,in, Indicates the first A JPEG image, Indicates the first A clean image, where B represents the number of images in a batch. This represents the number of channels in an image. and These represent the height and width of the image, respectively.
[0064] from and its corresponding Each of the above images is cropped to the same position, and the corresponding image patch is denoted as the first one. JPEG image blocks and the A clean image block Where N represents the height and width of the image patch; in the specific implementation, B=8, N=256, C=3, and so on. and Perform operations such as rotating and flipping at will.
[0065] Step 2: Construct the DCTMamba network, including: shallow feature extraction module, encoder module, decoder module and reconstruction module;
[0066] Step 3: The shallow feature extraction module consists of a convolutional kernel with a size of... The convolutional layer is composed of a cascaded GELU activation function, and is used for... Processing is performed to obtain the first... shallow features In practice, The size is 3, and the number of channels for shallow features is 28.
[0067] Step 4: The encoder module consists of Q multi-scale feature reduction modules connected in series, and performs... Processing is performed to obtain the first... Multi-scale coded feature set ={ },in, Let Q represent the q-th multi-scale encoded feature; where each multi-scale feature reduction module consists of a first multi-level unit and an upsampling module connected in series; in specific implementation, Q is 3.
[0068] Step 4.1: The first multi-level unit consists of a local module and a state space module arranged in parallel from coarse to fine.
[0069] Step 4.1.1: The local module is composed of Y dense residual modules, and each dense residual module includes Z convolutional layers; in the specific implementation, Y is 3 and Z is 4.
[0070] When q=1, The input is processed by the Y dense residual modules of the local module of the first multi-level unit to obtain the q-th encoded local feature. .
[0071] Step 4.1.2: The coarse-to-fine state space module consists of two parallel paths and a linear layer with an expansion factor of 1 / Z. The first path consists of a scale modulation module and a scale adaptation module connected in series. The second path consists of a linear layer with an expansion factor of Z and a SiLU activation function connected in series. The scale modulation module consists of a linear layer with an expansion factor of Z, a depth convolutional layer, and a SiLU activation function connected in series. The scale adaptation module consists of a discrete cosine transform layer, a normalization layer, and an inverse discrete cosine transform layer. In the specific implementation, Z is set to 4.
[0072] Step 4.1.2.1: When q=1, The input is processed by the scale modulation module of the first path of the state space module after being fed into the q-th multi-scale feature reduction module, resulting in the q-th coded scale modulation feature. ;
[0073] Will The input is then processed in the discrete cosine transform layer of the scale adaptation module of the first path. Figure 1 This demonstrates the high and low frequency components of the image after DCT transformation, yielding the q-th discrete cosine feature. The normalization layer uses equation (1) to obtain the q-th normalized discrete cosine feature. :
[0074] (1)
[0075] In equation (1), m and n represent respectively The row and column positions of the feature values; express The position coordinates of the eigenvalues; Figure 2 The distribution of DCT coefficients before and after normalization is shown;
[0076] right After performing top-down and left-to-right Mamba autoregressive scanning processing, the data is input into the inverse discrete cosine transform layer, and the output is the q-th coded scale adaptive feature. .
[0077] Step 4.1.2.2: [The text abruptly ends here, likely due to an incomplete sentence or a formatting error.] After processing the input in the second path, the q-th encoded scale dilation feature is obtained. ;
[0078] Step 4.1.2.3: [The text abruptly ends here, likely due to an incomplete sentence or a formatting error.] and After performing the Hadamard product operation, it is then processed through a linear layer with an inflation factor of 1 / Z to obtain the q-th encoded state space feature. In practice, Z is set to 4.
[0079] Step 4.2: The downsampling module consists of convolutional layers and the GELU activation function;
[0080] When q=1, The input is processed in the downsampling module of the q-th multi-scale feature reduction module, so that... The size was reduced to the original. The number of channels is increased by a times, thus obtaining the q-th multi-scale encoded feature. , where a represents the scaling factor; in practice, a is taken as 2.
[0081] Step 4.3: When q=2,3,…,Q, encode the (q-1)th multi-scale feature. The input is processed in the q-th multi-scale feature reduction module, and the Q-th multi-scale encoded feature is output by the Q-th multi-scale feature reduction module. In practice, the number of channels for each multi-scale encoded feature is 28, 56, and 112, respectively.
[0082] Step 5: The decoder module consists of Q multi-scale feature expansion modules connected in series, and... The i-th multi-scale decoding feature set is obtained through processing. ={ ,... },in, This represents the q-th multi-scale decoding feature; each multi-scale feature expansion module consists of a second multi-level unit and an upsampling module connected in series.
[0083] Step 5.1: The second multi-level unit has the same structure as the first multi-level unit;
[0084] When q=1, The input is placed into the second multi-level unit of the q-th multi-scale feature expansion module and processed according to steps 4.1.1-4.1.2.3 to obtain the q-th decoded state space feature. .
[0085] Step 5.2: The upsampling module consists of a transposed convolutional layer and a GELU activation function;
[0086] When q=Q, The input is processed in the upsampling module of the q-th multi-scale feature expansion module, so that... The size is increased to a times the original, and the number of channels is reduced to the original. After doubling, then with Add them together to obtain the q-th multi-scale decoding feature. In practice, a is 2, and the q-th multi-scale decoding feature and the q-th multi-scale coding feature have the same dimensionality.
[0087] Step 5.3: When q = Q-1, Q-2, ..., 1, decode the (q-1)th multi-scale feature. The input is processed in the q-th multi-scale feature expansion module, thereby outputting the first multi-scale decoded feature from the first multi-scale feature expansion module. .
[0088] Step 6: The reconstruction module consists of R convolutional kernels of size [missing value]. Step size is The fill parameters are / / 2 convolutional layers are connected in series, and for After processing, the first result is obtained. A restored JPEG image block Where / / indicates rounding down; Figure 3 An overall framework diagram of the present invention is shown.
[0089] Step 7: Calculate the total loss function This method is used to backpropagate and train the DCTMamba network, and the Adam optimizer is used to optimize the parameters of the DCTMamba network. When the maximum number of training iterations is reached, training is stopped, thus obtaining the optimal JPEG image restoration model for JPEG image restoration. In this example, the learning rate is set to 2e-4, and the cosine annealing algorithm is used to decay the learning rate, with the decay period set to 1000.
[0090] Step 7.1: Construct the absolute value loss function using equation (2). :
[0091] (2)
[0092] Step 7.2: Construct the discrete cosine loss function using equation (3). :
[0093] (3)
[0094] In equation (3), DCT represents the discrete cosine transform operation;
[0095] Step 7.3: Construct the structural similarity loss using equation (4). :
[0096] (4)
[0097] In equation (4), SSIM represents the structural similarity calculation function;
[0098] Step 7.4: Construct the total loss function using equation (5) :
[0099] (5)
[0100] In equation (5), and There are two hyperparameters. In this example, and Take values of 0.1 and 10 respectively.
[0101] In this embodiment, an electronic device includes a memory and a processor. The memory stores a program that supports the processor in executing the above-described method, and the processor is configured to execute the program stored in the memory.
[0102] In this embodiment, a computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the above-described method.
[0103] This invention verifies the effectiveness of DCTMamba in JPEG image restoration from both quantitative and qualitative perspectives. Experiments were conducted on multiple JPEG compressed datasets to evaluate the quality of the restored images. Performance was evaluated using metrics such as Peak Signal-to-Noise Ratio (PSNR) and Structural Similarity Index (SSIM), and compared with existing technologies to confirm DCTMamba's superior performance in restoring both coarse structure and detail. Specifically, this invention quantitatively compares it with previous JPEG restoration methods ARCNN (Artifacts Reduction Convolutional Neural Network), DnCNN (Denoising Convolutional Neural Network), DCSC (Deep Convolutional Sparse Coding), MWCNN (Multi-level Wavelet Convolutional Neural Networks), RNAN (Residual Non-local Attention Networks for Image Restoration), QGAC (Quantization Guided JPEG Artifact Correction), FBCNN (Towards Flexible Blind JPEG Artifacts Removal), and Zhao et al. (Comprehensive and Delicate: An Efficient Transformer for Image Restoration) on the LIVE1, Classic5, and BSDS500 datasets. Figure 4 As shown, the best-performing index is highlighted in bold in the quantitative analysis. The results demonstrate that this invention achieves comprehensive superior performance across four compression qualities across three datasets. Figure 5 and Figure 6 This paper demonstrates a comparison of the visual effects of this invention with other methods. Test images were obtained from the Classic5 (simulation) dataset and the Twitter (real-world) dataset. The results show that this method performs better in restoring texture details and achieves superior overall visual quality compared to other methods. Extensive testing on multiple datasets confirms the effectiveness of DCTMamba in restoring JPEG images. The results demonstrate that DCTMamba surpasses current state-of-the-art methods.
Claims
1. A JPEG image restoration method based on discrete cosine transform and Mamba network, characterized in that, The procedure is as follows: Step 1: Acquire a batch of JPEG images and its corresponding clean image ,in, Indicates the first A JPEG image, Indicates the first A clean image, where B represents the number of images in a batch. This represents the number of channels in an image. and These represent the height and width of the image, respectively. from and its corresponding Each of the above images is cropped to the same position, and the corresponding image patch is denoted as the first one. JPEG image blocks and the A clean image block Where N represents the height and width of the image patch; Step 2: Construct the DCTMamba network, including: shallow feature extraction module, encoder module, decoder module and reconstruction module; Step 3: The shallow feature extraction module consists of a convolutional kernel with a size of... The convolutional layer is composed of a cascaded GELU activation function, and is used for... Processing is performed to obtain the first... shallow features ; Step 4: The encoder module consists of Q multi-scale feature reduction modules connected in series, and performs... Processing is performed to obtain the first... Multi-scale coded feature set ={ },in, This represents the q-th multi-scale encoded feature; Step 5: The decoder module consists of Q multi-scale feature expansion modules connected in series, and performs... The i-th multi-scale decoding feature set is obtained through processing. ={ ,... },in, This represents the q-th multi-scale decoding feature; Step 6: The reconstruction module consists of R convolutional kernels of size R. Step size is The fill parameters are / / 2 convolutional layers are connected in series, and for After processing, the first result is obtained. A restored JPEG image block Where / / indicates rounding down; Step 7: Calculate the total loss function The method is used to perform backpropagation training on the DCTMamba network and optimize the parameters of the DCTMamba network using the Adam optimizer. When the maximum number of training iterations is reached, the training stops, thereby obtaining the optimal JPEG image restoration model for JPEG image restoration.
2. The JPEG image restoration method based on discrete cosine transform and Mamba network according to claim 1, characterized in that, In step 4, each multi-scale feature reduction module consists of a first multi-level unit and a downsampling module connected in series. Step 4.1: The first multi-level unit consists of a local module and a state space module arranged in parallel from coarse to fine. When q=1, the first multi-level unit pair The q-th encoded state space feature is obtained through processing. ; Step 4.2: The downsampling module consists of convolutional layers and the GELU activation function; When q=1, The input is processed in the downsampling module of the q-th multi-scale feature reduction module, so that... The size was reduced to the original. The number of channels is increased by a times, thus obtaining the q-th multi-scale encoded feature. Where a represents the scaling factor; Step 4.3: When q=2,3,…,Q, encode the (q-1)th multi-scale feature. The input is processed in the q-th multi-scale feature reduction module, and the Q-th multi-scale encoded feature is output by the Q-th multi-scale feature reduction module. .
3. The JPEG image restoration method based on discrete cosine transform and Mamba network according to claim 2, characterized in that, Step 4.1 includes: Step 4.1.1: The local module is composed of Y dense residual modules in sequence, and each dense residual module includes Z convolutional layers; When q=1, The input is processed by the Y dense residual modules of the local module of the first multi-level unit to obtain the q-th encoded local feature. ; Step 4.1.2: The coarse-to-fine state space module consists of two parallel paths and a linear layer with an expansion factor of 1 / Z. The first path consists of a scale modulation module and a scale adaptation module connected in series, and the second path consists of a linear layer with an expansion factor of Z and a SiLU activation function connected in series. The scale modulation module consists of a linear layer with an expansion factor of Z, a depth convolutional layer, and a SiLU activation function connected in series. The scale adaptation module consists of a discrete cosine transform layer, a normalization layer, and an inverse discrete cosine transform layer. Step 4.1.2.1: When q=1, The input is processed by the scale modulation module of the first path of the state space module after being fed into the q-th multi-scale feature reduction module, resulting in the q-th coded scale modulation feature. ; Will The input is then processed in the Discrete Cosine Transform layer of the scale adaptation module of the first path to obtain the q-th Discrete Cosine Feature. The normalization layer uses equation (1) to obtain the q-th normalized discrete cosine feature. : (1) In equation (1), m and n represent respectively The row and column positions of the feature values; express The position coordinates of the eigenvalues; right After performing top-down and left-to-right Mamba autoregressive processing, the input is placed into the inverse discrete cosine transform layer, and the output is the q-th encoder scale adaptive feature. ; Step 4.1.2.2: [The text abruptly ends here, likely due to an incomplete sentence or a formatting error.] After processing the input in the second path, the q-th encoded scale dilation feature is obtained. ; Step 4.1.2.3: [The text abruptly ends here, likely due to an incomplete sentence or a formatting error.] and After performing the Hadamard product operation, it is then processed through a linear layer with an inflation factor of 1 / Z to obtain the q-th encoded state space feature. .
4. The JPEG image restoration method based on discrete cosine transform and Mamba network according to claim 3, characterized in that, Each multi-scale feature expansion module in step 5 consists of a second multi-level unit and an upsampling module connected in series. Step 5.1: The second multi-level unit has the same structure as the first multi-level unit; When q=1, The input is placed into the second multi-level unit of the q-th multi-scale feature expansion module and processed according to steps 4.1.1-4.1.2.3 to obtain the q-th decoded state space feature. ; Step 5.2: The upsampling module consists of a transposed convolutional layer and a GELU activation function; When q=Q, The input is processed in the upsampling module of the q-th multi-scale feature expansion module, so that... The size is increased to a times the original, and the number of channels is reduced to the original. After doubling, then with Add them together to obtain the q-th multi-scale decoding feature. ; Step 5.3: When q = Q-1, Q-2, ..., 1, decode the (q-1)th multi-scale feature. The input is processed in the q-th multi-scale feature expansion module, thereby outputting the first multi-scale decoded feature from the first multi-scale feature expansion module. .
5. The JPEG image restoration method based on discrete cosine transform and Mamba network according to claim 4, characterized in that, The total loss function in step 7 It is established according to the following steps: Step 7.1: Construct the absolute value loss function using equation (2). : (2) Step 7.2: Construct the discrete cosine loss function using equation (3). : (3) In equation (3), DCT represents the discrete cosine transform operation; Step 7.3: Construct the structural similarity loss using equation (4). : (4) In equation (4), SSIM represents the structural similarity calculation function; Step 7.4: Construct the total loss function using equation (5) : (5) In equation (5), and There are two hyperparameters.
6. An electronic device, comprising a memory and a processor, characterized in that, The memory is used to store a program that supports the processor in executing the JPEG image restoration method as described in any one of claims 1-5, and the processor is configured to execute the program stored in the memory.
7. A computer-readable storage medium storing a computer program thereon, characterized in that, The computer program is executed by the processor to perform the steps of the JPEG image restoration method as described in any one of claims 1-5.