Image compression and decompression method and device, storage medium and electronic equipment

By combining bicubic interpolation and super-resolution algorithms, the problem of unclear image restoration after compression of ticket images is solved, achieving efficient compression and high-quality restoration while reducing hardware resource consumption.

CN121505055APending Publication Date: 2026-02-10AGRICULTURAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511704305.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-19
Publication Date
2026-02-10

AI Technical Summary

Technical Problem

Existing technologies cannot effectively utilize the sparsity of images when compressing ticket images, resulting in distorted fonts or inaccurate restoration after compression, making them unsuitable for practical applications.

Method used

A bicubic interpolation algorithm is used to downsample and compress the image, and a super-resolution algorithm is used to extract the shallow, deep and hierarchical features of the compressed image. The feature fusion and upsampling are performed through a multi-dimensional local topological feature enhancement module to restore the high-resolution image.

Benefits of technology

It achieves efficient compression and high-quality restoration of invoice images, maintains image clarity and text accuracy, reduces hardware resource consumption, and meets business needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121505055A_ABST
    Figure CN121505055A_ABST
Patent Text Reader

Abstract

The invention provides an image compression and decompression method and device, a storage medium and electronic equipment. The method comprises the steps of obtaining an original image of a transaction file, performing down-sampling on the original image by adopting a bicubic interpolation algorithm to obtain a compressed image, and storing the compressed image in an object storage server; under the condition that the image of the transaction file needs to be acquired, the compressed image is read from the object storage server, a super-resolution algorithm is adopted to restore the compressed image into a high-resolution image, and the super-resolution algorithm is at least used for extracting shallow layer features, deep layer features and hierarchical features of the compressed image; the shallow-layer feature comprises texture information of the compressed image, the deep-layer feature comprises text information of the compressed image, the hierarchical feature comprises a relationship between the shallow-layer feature and the deep-layer feature, and the peak signal-to-noise ratio of the high-resolution image is greater than a first preset value. According to the technology, the problem that in the prior art, when the compressed image is decompressed, accurate recovery cannot be achieved is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image compression and decompression, and more specifically, to an image compression and decompression method, an image compression and decompression apparatus, a computer-readable storage medium, and an electronic device. Background Technology

[0002] Bill images are crucial evidence in bill transactions, and their content is highly relevant to the authenticity of corporate trade. According to regulations from banks and bill exchanges, bill images must be permanently stored. However, large bill image files increase the burden on storage servers and bandwidth consumption. To reduce hardware resource consumption, compression algorithms are commonly used in the industry to reduce bill image file size. Common compression algorithms can be divided into two categories: file-based compression and image-based compression. File-based compression methods (such as dictionary compression) cannot utilize the sparsity of images, resulting in low compression levels and ineffective reduction of image file size. Image-based compression methods (such as model compression and restoration) can significantly reduce image file size, but existing algorithms have not yet been optimized for the large amount of text in bill images, leading to distorted fonts during image restoration and inaccurate recovery, hindering practical application. Summary of the Invention

[0003] The main objective of this application is to provide an image compression and decompression method, an image compression and decompression apparatus, a computer-readable storage medium, and an electronic device, so as to at least solve the problem that the prior art cannot accurately recover compressed images when decompressing them.

[0004] To achieve the above objectives, according to one aspect of this application, an image compression and decompression method is provided, comprising: acquiring an original image of a transaction file; downsampling the original image using a bicubic interpolation algorithm to obtain a compressed image, and storing the compressed image in an object storage server; when it is necessary to acquire an image of the transaction file, reading the compressed image from the object storage server, and using a super-resolution algorithm to restore the compressed image to a high-resolution image, wherein the super-resolution algorithm is used to extract at least shallow features, deep features, and hierarchical features of the compressed image, the shallow features including texture information of the compressed image, the deep features including text information of the compressed image, the hierarchical features including the relationship between the shallow features and the deep features, and the peak signal-to-noise ratio of the high-resolution image being greater than a first preset value.

[0005] Optionally, a super-resolution algorithm is used to restore the compressed image to a high-resolution image, including: extracting shallow features, hierarchical features, and deep features of the compressed image using the super-resolution algorithm; determining the sum of the pixels of the features obtained by aggregating the hierarchical features through a first convolutional layer and the pixels of the deep features as input data; inputting the input data into different processing channels of a multi-dimensional local topology feature enhancement module for multi-dimensional fusion processing to obtain multiple output sub-data, and fusing the multiple output sub-data to obtain output data, wherein the output sub-data corresponds one-to-one with the processing channel; upsampling the sum of the pixels of the output data and the pixels of the shallow features to obtain the high-resolution image.

[0006] Optionally, the super-resolution algorithm includes a backbone network, which consists of at least one stacked residual Swin Transformer block. The super-resolution algorithm is used to extract shallow features, hierarchical features, and deep features of the compressed image, including: extracting shallow features of the compressed image using a second convolutional layer; extracting hierarchical sub-features of the compressed image using multiple stacked residual Swin Transformer blocks respectively, and concatenating all the hierarchical sub-features to obtain the hierarchical features, wherein the hierarchical sub-features correspond one-to-one with the stacked residual Swin Transformer blocks; and extracting the deep features using a third convolutional layer.

[0007] Optionally, the processing channel includes a first channel, where the input data is input into different processing channels of the multi-dimensional local topological feature enhancement module for multi-dimensional fusion processing to obtain multiple output sub-data, including: inputting the deep features into a max pooling layer for processing to obtain first processed data; inputting the deep features into an average pooling layer for processing to obtain second processed data; inputting the deep features into a convolutional layer for processing to obtain third processed data; and using a multilayer perceptron to fuse the first processed data, the second processed data, and the third processed data to obtain the first sub-data.

[0008] Optionally, the processing channel includes a second channel, where the input data is input into different processing channels of the multi-dimensional local topological feature enhancement module for multi-dimensional fusion processing to obtain multiple output sub-data, including: inputting the deep features into a fourth convolutional layer for processing to obtain fourth processed data; inputting the deep features into a fifth convolutional layer for processing to obtain fifth processed data; inputting the deep features into a sixth convolutional layer for processing to obtain sixth processed data, wherein any two convolutional kernels in the fourth, fifth, and sixth convolutional layers have different sizes; using a self-attention mechanism to fuse the fourth, fifth, and sixth processed data to obtain fused data, and using a seventh convolutional layer to adjust the dimensions of the fused data to obtain a spatial attention weight matrix, wherein the spatial attention weight matrix is ​​the second sub-data.

[0009] Optionally, the output sub-data includes first sub-data and second sub-data. The multiple output sub-data are fused to obtain output data, including: determining the cross product of the first sub-data and the input data as a first calculated value; determining the dot product of the second sub-data and the input data as a second calculated value; and determining the sum of the deep features, the first calculated value, and the second calculated value as the output data.

[0010] Optionally, a bicubic interpolation algorithm is used to downsample the original image to obtain a compressed image, including: a first determination step, determining the points to be interpolated in the original image as interpolation points, and determining the coordinates of the four vertices of a preset rectangle in the original image to obtain four known data points, wherein the preset rectangle is a rectangle including the interpolation points; a second determination step, determining an initial interpolation function, wherein the initial interpolation function is a one-dimensional cubic interpolation function; a first processing step, solving the equation of the initial interpolation function based on the four known data points to obtain the target coefficients of the initial interpolation function, and determining a target interpolation function based on the target coefficients and the initial interpolation function; a second processing step, interpolating in a first direction based on the target interpolation function to obtain a first interpolation function, and interpolating in a second direction to obtain a target interpolation result; and a repeating step, repeatedly executing the first determination step, the second determination step, the first processing step, and the second processing step to obtain the compressed image.

[0011] According to another aspect of this application, an image compression and decompression apparatus is also provided, comprising: an acquisition unit for acquiring an original image of a transaction file; a compression unit for downsampling the original image using a bicubic interpolation algorithm to obtain a compressed image, and storing the compressed image in an object storage server; and a decompression unit for reading the compressed image from the object storage server when it is necessary to acquire an image of the transaction file, and using a super-resolution algorithm to restore the compressed image to a high-resolution image, wherein the super-resolution algorithm is used to extract at least shallow features, deep features, and hierarchical features of the compressed image, the shallow features including texture information of the compressed image, the deep features including text information of the compressed image, the hierarchical features including the relationship between the shallow features and the deep features, and the peak signal-to-noise ratio of the high-resolution image being greater than a first preset value.

[0012] According to another aspect of this application, a computer-readable storage medium is provided, the computer-readable storage medium including a stored program, wherein, when the program is executed, it controls the device where the computer-readable storage medium is located to perform any of the described image compression and decompression methods.

[0013] According to another aspect of this application, an electronic device is provided, comprising: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including methods for performing any of the image compression and decompression methods described above.

[0014] Applying the technical solution of this application, the above-mentioned image compression and decompression method first acquires the original image of the transaction file; secondly, it uses a bicubic interpolation algorithm to downsample the original image to obtain a compressed image, which is then stored in an object storage server; finally, when the image of the transaction file needs to be obtained, the compressed image is read from the object storage server, and a super-resolution algorithm is used to restore the compressed image to a high-resolution image. The super-resolution algorithm is used to extract at least the shallow features, deep features, and hierarchical features of the compressed image. Shallow features include texture information of the compressed image, deep features include text information of the compressed image, and hierarchical features include the relationship between shallow and deep features. The peak signal-to-noise ratio of the high-resolution image is greater than a first preset value. In the compression stage, the method uses a downsampling algorithm to compress the image to 1 / 16 of the original image, significantly reducing the image size. In the restoration stage, the proposed super-resolution algorithm fully exploits the sparsity of the image's hierarchical and deep features, efficiently restoring the compressed image and ensuring the clarity and accuracy of the image text, thereby reducing the consumption of hardware resources for the document image while meeting business requirements. This solves the problem that existing technologies cannot accurately recover compressed images when decompressing them, especially the problem of blurry text information. Attached Figure Description

[0015] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:

[0016] Figure 1 A hardware structure block diagram of a mobile terminal performing an image compression and decompression method according to an embodiment of this application is shown;

[0017] Figure 2 A schematic flowchart of an image compression and decompression method according to an embodiment of this application is shown;

[0018] Figure 3 A schematic diagram illustrating the principle of a super-resolution algorithm according to an embodiment of this application is shown;

[0019] Figure 4 A schematic diagram illustrating the principle of a multi-dimensional local topological feature enhancement according to an embodiment of this application is shown.

[0020] Figure 5 A schematic flowchart of another image compression and decompression method provided according to an embodiment of this application is shown;

[0021] Figure 6 A structural block diagram of an image compression and decompression apparatus provided according to an embodiment of this application is shown.

[0022] The above figures include the following reference numerals:

[0023] 102. Processor; 104. Memory; 106. Transmission device; 108. Input / output device. Detailed Implementation

[0024] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0025] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0026] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0027] For ease of description, the following explains some of the nouns or terms used in the embodiments of this application:

[0028] Invoice images: Electronic images obtained through scanning, photographing, or other means during the invoice business process, used to record and process relevant business information, including invoices, contracts, etc.

[0029] Object storage server: A system used to store, manage, and access large-scale unstructured data (such as files, images, videos, etc.).

[0030] Compression: A technique that uses algorithms to reduce file size.

[0031] Decompression: A technique that uses algorithms to restore compressed files; it is the reverse process of compression. The terms "restore" and "reconstruct" mentioned in this article refer to the decompression process.

[0032] Downsampling: A compression technique for signals (such as images). It reduces the number of pixels by fusing information from image pixels using algorithms, thereby reducing the storage space required for the image.

[0033] Super-resolution: An image restoration technique that is the inverse process of downsampling. By using the prior information of the super-resolution model, it restores the pixel information of the downsampled image that was fused, generating a high-definition image and improving the resolution and clarity of the image.

[0034] A pixel is the smallest unit of storage for an image in a computer. An image is composed of a two-dimensional matrix of pixels.

[0035] Resolution: The dimension of the two-dimensional matrix that makes up the pixels of an image. For example, if an image has 100 pixels and the two-dimensional matrix is ​​10 rows and 10 columns, then the resolution of the image is 10x10.

[0036] Convolutional Neural Networks (CNNs) are deep learning models specifically designed for processing locally correlated data, such as images. The core idea of ​​CNNs is to automatically extract features from images and perform classification or prediction through a combination of convolutional layers, pooling layers, and fully connected layers. Convolutional layers use learnable filters (kernels) to slide across the input data, extracting local features of the image (such as edges and textures), while utilizing parameter sharing mechanisms to reduce computational cost and the risk of overfitting. Pooling layers reduce the dimensionality of feature maps through downsampling operations (such as max pooling or average pooling), further extracting key information and improving the model's robustness. Fully connected layers map the extracted high-level features to the final output category.

[0037] Transformer is a deep learning model based on self-attention. Through multi-head attention and positional encoding, it can process sequential data in parallel, capture long-distance dependencies, and has powerful feature extraction capabilities. It is one of the core models of current deep learning.

[0038] Swin-Transformer is a computer vision model based on the Transformer architecture. It extends the powerful feature extraction capabilities of the Transformer to image processing tasks by introducing a hierarchical structure and a locally sensitive attention mechanism.

[0039] As introduced in the background section, there are many image super-resolution algorithms in the industry, with SwinIR, based on the Swin-Transformer, serving as a baseline and milestone model. SwinIR introduces hierarchical feature maps and a windowing attention mechanism through RSTB (Residual Swin-Transformer Blocks). The former extracts scale-invariant features through progressive downsampling, enhancing the model's performance in dense prediction tasks. The latter enhances the model's ability to extract global features by cropping and arranging the image. It uses stacked RSTBs to extract image features and then uses sub-pixel convolution to recover the high-resolution image. The existing implementations described above cannot preserve the text features of the invoice image during compression, resulting in poor recovery quality and unclear font edges after compression, affecting normal business processing.

[0040] To address the problem that existing technologies cannot accurately recover compressed images during decompression, embodiments of this application provide an image compression and decompression method, an image compression and decompression apparatus, a computer-readable storage medium, and an electronic device.

[0041] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.

[0042] The methods and embodiments provided in this application can be executed on a mobile terminal, computer terminal, or similar computing device. Taking running on a mobile terminal as an example, Figure 1 This is a hardware structure block diagram of a mobile terminal for an image compression and decompression method according to an embodiment of the present invention. Figure 1 As shown, a mobile terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The mobile terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0043] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to method Z in this embodiment of the invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory and non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of the aforementioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. The transmission device 106 is used to receive or send data via a network. Specific examples of the aforementioned networks may include wireless networks provided by the mobile terminal's communication provider. In one example, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to communicate with the Internet. In one example, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0044] This embodiment provides an image compression and decompression method that runs on a mobile terminal, computer terminal, or similar computing device. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Also, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0045] Figure 2 This is a flowchart of an image compression and decompression method according to an embodiment of this application. Figure 2 As shown, the method includes the following steps:

[0046] Step S201: Obtain the original image of the transaction file;

[0047] Specifically, this step typically involves account managers using a scanner or camera to obtain electronic versions of paper documents, such as invoices and contracts, when handling invoice transactions. These documents contain a large amount of text and detailed information, forming the original image.

[0048] Step S202: The original image is downsampled using a bicubic interpolation algorithm to obtain a compressed image, and the compressed image is stored in an object storage server.

[0049] Specifically, bicubic interpolation is an industry-recognized, highly efficient scaling technique. It reduces the size of the original image by considering the grayscale distribution of nine points surrounding a pixel and using a cubic polynomial function to estimate missing pixel data. For example, if the original image resolution is 1080p, it can be reduced to 720p, saving storage space while preserving key visual features. This compressed image is then stored on an object storage server to conserve server storage resources compared to high-definition images.

[0050] Step S203: When it is necessary to obtain an image of the transaction file, the compressed image is read from the object storage server, and a super-resolution algorithm is used to restore the compressed image to a high-resolution image. The super-resolution algorithm is used to extract at least the shallow features, deep features, and hierarchical features of the compressed image. The shallow features include the texture information of the compressed image, the deep features include the text information of the compressed image, and the hierarchical features include the relationship between the shallow features and the deep features. The peak signal-to-noise ratio (PSNR) of the high-resolution image is greater than a first preset value.

[0051] Specifically, when original, clear images are needed in business scenarios such as trade audits, the object storage server will invoke a super-resolution algorithm to process the previously stored compressed image. The super-resolution algorithm is used to extract at least shallow, deep, and hierarchical features from the compressed image. Shallow features mainly focus on texture information, deep features focus on extracting text information, and hierarchical features are responsible for parsing and integrating the relationship between texture and text information.

[0052] In addition, the higher the peak signal-to-noise ratio (PSNR) of a high-resolution image, the clearer the image restoration and the smaller the difference from the original image. The structural similarity (SSIM) of a high-resolution image is in the range of 0 to 1. The closer the structural similarity (SSIM) of a high-resolution image is to 1, the clearer the image restoration and the smaller the difference from the original image.

[0053] Super-resolution algorithms efficiently recover compressed images through three stages: deep feature extraction, hierarchical feature mining, and upsampling reconstruction. In the deep feature extraction stage, the algorithm uses RSTB (Residual Swing Transformer Block) to capture multi-scale features of the compressed image, enhancing feature representation. In the hierarchical feature mining stage, MLTFEM (Multi-Dimensional Local Topological Feature Enhancement Module) is used to strengthen feature interaction, especially for in-depth mining of feature information in text regions, ensuring the clarity and accuracy of the text during reconstruction. Finally, in the upsampling stage, sub-pixel convolution is used to enlarge the compressed image to its original resolution, generating a high-resolution image.

[0054] Specifically, in this embodiment, the high-resolution image recovered by the super-resolution algorithm has a peak signal-to-noise ratio (PSNR) greater than 30dB, which is a common image quality assessment threshold. PSNR is an indicator that measures the quality loss of an image before and after compression. The higher the value, the smaller the difference between the compressed image and the original image, and the better the image quality is preserved.

[0055] A PSNR of 30dB or higher means that the image's sharpness and detail are effectively preserved during compression and restoration. Even after compression, the restored image is visually almost indistinguishable from the original. This is achieved through the algorithm's deep feature extraction and hierarchical feature mining capabilities, which together ensure that information loss is minimized during compression and that the image's texture details and text sharpness are fully restored during restoration.

[0056] In summary, this embodiment solves key problems in the compression and restoration of ticket images by using bicubic interpolation and super-resolution algorithms, achieving efficient image compression and high-quality image restoration. This not only reduces server storage pressure but also meets the image clarity requirements of business scenarios, lowers costs, improves efficiency, and ensures business continuity.

[0057] This embodiment addresses the problem in existing technologies where highly compressed document image files cannot effectively restore their original clarity and detail, especially resulting in blurred text information. This method uses bicubic interpolation to downsample the original image to a smaller size, achieving compression while preserving the image's basic structure and text edge information. This method reduces storage requirements and server storage resource consumption. During decompression, a super-resolution algorithm is used to extract shallow, deep, and hierarchical features from the compressed image. Shallow features reflect texture information, deep features reflect text information, and hierarchical features capture the relationship between shallow and deep features. This multi-level feature extraction and fusion ensures the quality of the restored image, particularly the clarity of the text, with a peak signal-to-noise ratio exceeding a first preset value. This ensures the restored image meets the clarity and readability requirements for business processing, improving processing efficiency. Furthermore, the efficiency and accuracy of this method reduce processing delays and errors caused by poor image quality, further enhancing system reliability and user experience.

[0058] The image compression and decompression method described in this application first acquires the original image of the transaction file; secondly, it downsamples the original image using a bicubic interpolation algorithm to obtain a compressed image, which is then stored in an object storage server; finally, when the image of the transaction file needs to be retrieved, the compressed image is read from the object storage server, and a super-resolution algorithm is used to restore the compressed image to a high-resolution image. The super-resolution algorithm is used to extract at least the shallow, deep, and hierarchical features of the compressed image. Shallow features include texture information, deep features include text information, and hierarchical features include the relationship between shallow and deep features. The peak signal-to-noise ratio of the high-resolution image is greater than a first preset value. In the compression stage, the method uses a downsampling algorithm to compress the image to 1 / 16 of the original image, significantly reducing the image size. In the restoration stage, the proposed super-resolution algorithm fully exploits the sparsity of the image's hierarchical and deep features, efficiently restoring the compressed image while ensuring the clarity and accuracy of the image text, thereby reducing the consumption of hardware resources for the document image while meeting business requirements. This solves the problem that existing technologies cannot accurately recover compressed images when decompressing them, especially the problem of blurry text information.

[0059] Considering the characteristic that the output features of different basic modules of the backbone network of a deep learning-based image restoration model represent different levels of information, the above embodiment proposes a super-resolution network for invoice images. The features extracted by the shallow feature module of the network correspond to texture information, while the features extracted by the deep feature module correspond to edge or semantic information. After obtaining the hierarchical features, the network further obtains the relationship matrix between the hierarchical features and mines their multi-scale information, thereby better fusing the hierarchical features and reconstructing higher-quality high-resolution images. At the same time, the effective features of invoice images are concentrated in the text region, resulting in the sparsity of deep features. To address the problems of image feature information loss during image downsampling leading to further compression of features when establishing multi-scale information, and the inability to fully mine deep feature sparsity, this method proposes a Multi-dimensional Local Topological Feature Enhancement Module (MLTFEM). MLTFEM can mine deep features by fusing hierarchical and deep features using a multi-branch structure. Therefore, the above embodiment can effectively solve the problem of unclear font edges in the restored high-resolution images caused by over-compression of image features by current stacked feature extraction block networks (such as SwinIR).

[0060] In some embodiments, a bicubic interpolation algorithm is used to downsample the original image to obtain a compressed image, including the following steps:

[0061] The first determination step is to determine the points to be interpolated in the original image as the interpolation points, and to determine the coordinates of the four vertices of the preset rectangle in the original image to obtain four known data points. The preset rectangle is a rectangle that includes the interpolation points.

[0062] The second determination step is to determine the initial interpolation function, which is a one-dimensional cubic interpolation function.

[0063] The first processing step is to solve the equation of the initial interpolation function based on the four known data points to obtain the target coefficients of the initial interpolation function, and then determine the target interpolation function based on the target coefficients and the initial interpolation function.

[0064] The second processing step involves interpolating the target interpolation function in the first direction to obtain a first interpolation function, and then interpolating the first interpolation function in the second direction to obtain the target interpolation result.

[0065] Repeat the steps, including the first determination step, the second determination step, the first processing step, and the second processing step, to obtain the compressed image.

[0066] In this embodiment, the bicubic interpolation algorithm is used to downsample the original image to obtain a compressed image. The specific process is as follows: First, the point to be interpolated in the original image is determined as the interpolation point, and a preset 3x3 rectangular region including this point is found. The coordinates of the four vertices of this region in the original image are the four known data points. Next, a one-dimensional cubic interpolation function is determined as the initial interpolation function. Based on these four known data points, the target coefficients of the initial interpolation function are obtained by solving a system of equations, thereby determining the final target interpolation function. Subsequently, this target interpolation function is used to interpolate the original image in the x and y directions respectively to obtain the information of one pixel in the compressed image. Finally, by repeating the above process for each interpolation point in the image, the downsampling processing of the entire original image is completed, resulting in the compressed image. Bicubic interpolation can effectively maintain image quality during compression, especially when processing complex ticket images. It can reduce compression-induced distortion by fusing information from surrounding pixels, ensuring that the compressed image still contains sufficient detail information, which is convenient for subsequent super-resolution algorithms to accurately restore the image. This significantly reduces the consumption of hardware resources while meeting business needs, achieving a balance between high compression and high-quality restoration of ticket images.

[0067] The above process is an image compression process, which uses bicubic interpolation downsampling to compress the image. Bicubic is a commonly used two-dimensional interpolation method in the industry. It uses a cubic interpolation function to obtain the target pixel information based on the pixel information of the 3x3 area surrounding the source pixel. Bicubic has advantages such as fast computation speed, low computational requirements, flexible scaling, and wide application scenarios.

[0068] Suppose the point (x, y) to be interpolated falls within the rectangular region formed by four known data points (i, j), (i+1, j), (i, j+1), and (i+1, j+1) in the image, where i and j are integers, and the range of x and y is 0 ≤ x ≤ 1 and 0 ≤ y ≤ 1. First, define the one-dimensional cubic interpolation function f(t), as shown in (Equation 1).

[0069] (Formula 1)

[0070] For interpolation in the x-direction, four coefficients a0, a1, a2 and a3 need to be found first. The coefficients can be determined by solving the equations at four known points f(0), f(1), f'(0) and f'(1), as shown in (Formula 2).

[0071] (Formula 2)

[0072] Where f'(t) is the first derivative of f(t).

[0073] After obtaining f(t), interpolation is performed in the x direction to obtain g(x), as shown in (Formula 3).

[0074] (Formula 3)

[0075] Among them, z j,k These are the values ​​of four adjacent pixels in the image at line y=j.

[0076] Then, g(x) is interpolated in the y direction to obtain the final result I(x, y), as shown in (Equation 4).

[0077] (Formula 4)

[0078] Following the compression process, there is also a storage process, which includes two aspects: one is the process of storing the small-sized image obtained from the compression process into the object storage server, and the other is the process of the system reading the compressed image from the object storage server and sending it into the subsequent recovery process when the business calls the system interface to access the ticket image.

[0079] In some embodiments, a super-resolution algorithm is used to restore the compressed image to a high-resolution image, including the following steps:

[0080] Step S301: Use the super-resolution algorithm described above to extract the shallow features, hierarchical features and deep features of the compressed image.

[0081] Step S302: The sum of the pixels of the features obtained by aggregating the above-mentioned hierarchical features through the first convolutional layer and the pixels of the above-mentioned deep features is determined as the input data; the first convolutional layer is a 1x1 convolutional layer;

[0082] Step S303: Input the above input data into different processing channels of the multi-dimensional local topology feature enhancement module for multi-dimensional fusion processing to obtain multiple output sub-data, and fuse the above multiple output sub-data to obtain output data. The above output sub-data corresponds one-to-one with the above processing channels.

[0083] Step S304: Upsample the sum of the pixels of the output data and the pixels of the shallow features to obtain the high-resolution image.

[0084] In this embodiment, a super-resolution algorithm is used to restore compressed images to high-resolution images, aiming to effectively improve the decompression quality of invoice images. First, the algorithm extracts shallow, hierarchical, and deep features from the compressed image. This step aims to comprehensively capture the details and structural information of the invoice image. Next, hierarchical features are aggregated through a first convolutional layer and added to deep features at the pixel level to obtain input data. This integrates feature information from different levels to form a comprehensive feature representation. Subsequently, the input data is fed into different processing channels of a multi-dimensional local topology feature enhancement module. Each channel performs specific multi-dimensional fusion processing on the input data, generating multiple output sub-data. These output sub-data are then fused into a single output data. This multi-dimensional fusion process can deeply mine the intrinsic connections between image features and enhance the expressive power of features. Finally, the pixels of the output data are added to the pixels of the shallow features, and upsampling is performed to obtain a complete high-resolution image. The entire restoration process fully utilizes the advantages of deep feature fusion and multi-scale analysis, resulting in a significantly improved resolution of the decompressed invoice image, while effectively ensuring the clarity and accuracy of the text, meeting business needs while reducing storage resource consumption. The implementation of this technical solution can effectively resolve the contradiction between long-term storage and rapid access of invoice image files, and realize the efficient management and utilization of invoice images.

[0085] In some embodiments, the super-resolution algorithm includes a backbone network composed of at least one stacked residual Swing Transformer block. The algorithm is used to extract shallow features, hierarchical features, and deep features of the compressed image, comprising the following steps:

[0086] Step S3011: Use the second convolutional layer to extract the shallow features of the compressed image above;

[0087] Step S3012: Extract the hierarchical sub-features of the compressed image using multiple stacked residual Swin Transformer blocks, and stitch all the hierarchical sub-features together to obtain the hierarchical features. The hierarchical sub-features correspond one-to-one with the stacked residual Swin Transformer blocks.

[0088] Step S3013: Extract the above deep features using the third convolutional layer.

[0089] In this embodiment, the core of the super-resolution algorithm lies in its strategy of deep feature extraction and hierarchical feature mining. Specifically, the algorithm achieves effective decompression of compressed images through a backbone network composed of at least one stacked residual Swin Transformer block. First, the compressed image is processed by a second convolutional layer to extract shallow features. Then, multiple stacked residual Swin Transformer blocks independently extract hierarchical sub-features of the image, and finally, these hierarchical sub-features are stitched together to form complete hierarchical features. This hierarchical feature extraction method fully utilizes the layered advantage of the Swin Transformer in image processing, enabling more detailed capture of text details and structural information in the document image. Next, a third convolutional layer is responsible for extracting deep features. The acquisition of deep features further enhances the understanding of complex image patterns, making the reconstruction process more accurate. The entire backbone network, through the combination of deep feature extraction and hierarchical feature mining, effectively mines the different levels of information contained in the compressed image, providing a solid foundation for subsequent upsampling restoration and reconstruction. Ultimately, by fusing shallow, hierarchical, and deep features and utilizing sub-pixel convolution technology for upsampling, high-quality restoration of the ticket image was achieved. This not only solved the problem of image restoration after compression but also significantly reduced the burden on the storage system, meeting the demand for high-definition images in ticket-related business. In other embodiments not shown, the feature extraction effect can be optimized by adjusting the number of stacked residual SwinTransformer blocks or changing the convolutional layer parameters, thereby further improving the image restoration quality.

[0090] In some embodiments, the super-resolution algorithm includes a backbone network composed of at least one stacked residual Swing Transformer block. The algorithm is used to extract shallow features, hierarchical features, and deep features of the compressed image, comprising the following steps:

[0091] Step S401: Input the above deep features into the max pooling layer for processing to obtain the first processed data;

[0092] Step S402: Input the above deep features into the average pooling layer for processing to obtain the second processed data;

[0093] Step S403: Input the above deep features into the convolutional layer for processing to obtain the third processed data;

[0094] Step S404: A multilayer perceptron is used to fuse the first processed data, the second processed data, and the third processed data to obtain the first sub-data.

[0095] In this embodiment, the Multi-Dimensional Local Topological Feature Enhancement Module (MLTFEM) includes a first channel, designed to obtain richer and more expressive feature representations by multi-dimensionally fusing deep features. Specifically, deep features are simultaneously input into the max pooling layer, average pooling layer, and convolutional layer under the first channel, resulting in first, second, and third processed data, each emphasizing different statistical characteristics. Subsequently, a multilayer perceptron (MLP) is used to fuse these three types of processed data to obtain the first sub-data. This sub-data integrates multi-level and multi-angle feature information, enabling a more comprehensive restoration of the text details in the document image, especially showing significant improvements in edge sharpness and font accuracy. In this way, MLTFEM not only enhances the expressive power of deep features but also fully utilizes the complementary advantages of hierarchical features, achieving effective decompression of compressed document images and ensuring that the quality of the restored image meets business requirements.

[0096] In some embodiments, the above-mentioned processing channel includes a second channel, which inputs the above-mentioned input data into different processing channels of the multi-dimensional local topology feature enhancement module for multi-dimensional fusion processing to obtain multiple output sub-data, including the following steps:

[0097] Step S4011: Input the above deep features into the fourth convolutional layer for processing to obtain the fourth processed data;

[0098] Step S4012: Input the above deep features into the fifth convolutional layer for processing to obtain the fifth processed data;

[0099] Step S4013: Input the above deep features into the sixth convolutional layer for processing to obtain the sixth processed data, wherein any two convolutional kernels in the fourth, fifth and sixth convolutional layers are of different sizes.

[0100] Step S4014: The fourth, fifth, and sixth processed data are fused using a self-attention mechanism to obtain fused data. The dimensions of the fused data are then adjusted using a seventh convolutional layer to obtain a spatial attention weight matrix, wherein the spatial attention weight matrix is ​​the second sub-data.

[0101] In this embodiment, the design of the Multi-Dimensional Local Topological Feature Enhancement Module (MLTFEM) further enriches the layers and dimensions of feature fusion. Specifically, the processing channels include a second channel, designed to process deep features using convolutional kernels of different sizes to obtain fourth, fifth, and sixth processing data, corresponding to small-scale, medium-scale, and large-scale feature information, respectively. The convolutional kernel sizes of the fourth, fifth, and sixth convolutional layers are different, ensuring that the network can capture subtle differences in features from multiple perspectives. Subsequently, a self-attention mechanism is introduced to fuse these three different scales of processed data, obtaining fused data. The channel dimensions of the fused data are adjusted through a seventh convolutional layer to form a spatial attention weight matrix as the second sub-data. The generation of the spatial attention weight matrix not only strengthens the interaction between features but also highlights important information in the text regions of the ticket image, improving the quality and clarity of the restored image, especially in the accurate restoration of font edges. This series of steps constitutes the core processing flow of MLTFEM, which effectively compensates for the compression loss of feature information during downsampling, improves the detail performance of super-resolution recovery, and enables the compressed and decompressed ticket images to meet the standards required by business needs, while reducing the resource pressure on the object storage server.

[0102] In some embodiments, the above-mentioned output sub-data includes first sub-data and second sub-data. The process of fusing the multiple output sub-data to obtain output data includes the following steps:

[0103] Step S501: Determine the first calculated value by cross product of the first sub-data and the input data.

[0104] Step S502: The dot product of the second sub-data and the input data is determined as the second calculated value;

[0105] Step S503: The sum of the above-mentioned deep features, the above-mentioned first calculated value, and the above-mentioned second calculated value is determined as the above-mentioned output data.

[0106] In this embodiment, the output sub-data includes first sub-data and second sub-data. The process of fusing multiple output sub-data to obtain the output data is as follows: First, the cross product of the first sub-data and the input data is determined as the first calculated value; then, the dot product of the second sub-data and the input data is determined as the second calculated value; finally, the sum of the deep features, the first calculated value, and the second calculated value is determined as the output data. This fusion strategy fully utilizes the interaction between the input data and different sub-data. Through weighted processing of the cross product and dot product results, it not only enhances the restoration of local details and texture information of the image but also optimizes the expression of global features, achieving efficient and high-quality super-resolution reconstruction of compressed document images, thereby ensuring the effective fulfillment of business needs such as trade background verification. In this way, the method provided in this embodiment can significantly reduce the server storage resource requirements of document images while ensuring the clarity and accuracy of the decompressed image, demonstrating a combination of practicality and efficiency.

[0107] The above process is the recovery process, which is the core part of this embodiment. The super-resolution algorithm proposed in this embodiment is as follows: Figure 3 As shown, the algorithm can be divided into three parts: i) deep feature extraction; ii) hierarchical feature mining; and iii) upsampling recovery and reconstruction.

[0108] (i) Deep feature extraction:

[0109] In the backbone network, this embodiment extracts hierarchical visual features by stacking Residual Swin Transformer Blocks (RSTBs). The backbone network composed of RSTBs can construct long-range connections and capture the features of the entire document image, thereby fully mining the information of the compressed image. The backbone network first uses a convolutional layer to extract shallow features of the compressed image, as shown in (Equation 5). Then, multiple RSTBs are used to extract hierarchical features, as shown in (Equation 6). Finally, a convolutional layer is used to fuse deep features, as shown in (Equation 7).

[0110] (Formula 5)

[0111] (Formula 6)

[0112] (Formula 7)

[0113] Where k is an integer from 1 to n, I LR H represents the input compressed image. 3×3 () indicates a 3×3 convolutional layer, RSTB k() represents the k-th RSTB module in {1,2,…,n}, where n represents the number of RSTBs, and F b This represents the deep features extracted by the backbone network. Fk represents the hierarchical sub-features output by each RSTB module.

[0114] (ii) Hierarchical feature mining:

[0115] To address the issues of image feature loss during image downsampling leading to further feature compression when constructing multi-scale information, and the inability to fully exploit deep feature sparsity, this method proposes a Multi-dimensional Local Topological Feature Enhancement Module (MLTFEM), such as... Figure 4 As shown, this module can map hierarchical features to low, medium, and high-level features based on the amplification factor, and then use a self-attention mechanism to fuse the degenerate features.

[0116] The input to MLTFEM is the sum of the pixels of the hierarchical features extracted by the backbone network and the deep features extracted by the backbone network after being aggregated by a 1x1 convolutional layer, as shown in (Equation 8).

[0117] (Formula 8)

[0118] Where Fb represents the deep features extracted by the backbone network, Fh represents the hierarchical features obtained by concatenating the hierarchical sub-features output by all RSTB modules extracted by the backbone network, and H... 1x1 () represents a 1x1 convolutional layer, and FinMLTFEM represents the input features of MLTFEM.

[0119] The channel branch obtains different channel responses through three different mapping functions and then uses a multilayer perceptron to redistribute the channel weights. Specifically, in the channel branch, MLTFEM uses max pooling, average pooling, and convolutional layers in parallel to obtain different channel weights, as shown in Equations (9), (10), and (11), respectively. Then, a multilayer perceptron is used for fusion, as shown in Equation (12).

[0120] (Formula 9)

[0121] (Formula 10)

[0122] (Formula 11)

[0123] (Formula 12)

[0124] Where Fb represents the deep features extracted by the backbone network, Fmp, Fap and Fconv correspond to max pooling, average pooling and convolution-Sigmoid features respectively, H3x3c() represents a 3x3 convolutional layer, Sigmoid() represents the Sigmoid function, MLP() represents a multilayer perceptron, and Fchannel represents the channel branch weight features.

[0125] In the spatial branch, MLTFEM uses multiple convolutional layers with different kernel sizes to obtain multi-scale features of the image, as shown in (Equation 13), (Equation 14), and (Equation 15). Convolutional layers with small kernels can extract small-scale information such as edges, while convolutional layers with large kernels can extract local information such as texture. The module then uses a self-attention mechanism for fusion and adjusts the channel dimensions using a 1×1 convolutional layer to obtain the spatial attention weight matrix, as shown in (Equation 16).

[0126] (Formula 13)

[0127] (Formula 14)

[0128] (Formula 15)

[0129] (Formula 16)

[0130] Where Hkxk(·) represents a kxk convolutional layer, Fb represents the deep features extracted by the backbone network, Softmax(·) represents the Softmax function, dm represents the feature dimension, and Fspatial represents the spatial branch weight feature.

[0131] In the mapping path, low-level features are downsampled four times, medium-level features are upsampled and downsampled twice, and high-level features are upsampled four times.

[0132] Finally, the results of the two branches are merged, as shown in (Formula 17).

[0133] (Formula 17)

[0134] (iii) Upsampling recovery and reconstruction:

[0135] The network reconstruction module uses subpixel convolution to upsample the pixels of shallow features, hierarchical features fused by MHSM, and deep features extracted by stacked RSTB, as shown in (Equation 18).

[0136] (Formula 18)

[0137] Where Up() represents subpixel convolution, I SR This indicates the result of network super-resolution reconstruction.

[0138] The methods and steps in the above embodiments are simple and effective, which can solve the problem that the current invoice images are highly compressed and cannot be recovered. At the same time, they solve the problem that the invoice images need to be permanently stored and occupy too much storage resources, and the cost is low.

[0139] To enable those skilled in the art to better understand the technical solution of this application, the implementation process of the image compression and decompression method of this application will be described in detail below with reference to specific embodiments.

[0140] This embodiment relates to a specific image compression and decompression method, which can be divided into three steps: 1) compression process; 2) storage process; 3) recovery process. The overall process is as follows: Figure 5 As shown. When handling invoice-related business, account managers need to verify the authenticity of a company's trade information and will keep records of the company's invoices, contracts, and other information. After the account manager uploads the original image, this method first uses a bicubic interpolation algorithm to downsample the original image, obtaining a compressed image, which is then stored in an object storage server. When the business requires the image file, the compressed image is read from the object storage server, and then the super-resolution algorithm proposed in this method is used to restore it, obtaining a high-definition image that meets the requirements for trade background verification and other business operations.

[0141] This application also provides an image compression and decompression apparatus. It should be noted that the image compression and decompression apparatus of this application can be used to execute the image compression and decompression method provided in this application. This apparatus is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0142] The image compression and decompression apparatus provided in the embodiments of this application is described below.

[0143] Figure 6 This is a schematic diagram of an image compression and decompression apparatus according to an embodiment of this application. Figure 6As shown, the device includes: an acquisition unit 10, a compression unit 20, and a decompression unit 30. The acquisition unit 10 is used to acquire the original image of the transaction file; the compression unit 20 is used to downsample the original image using a bicubic interpolation algorithm to obtain a compressed image, and store the compressed image in an object storage server; the decompression unit 30 is used to read the compressed image from the object storage server when it is necessary to acquire the image of the transaction file, and use a super-resolution algorithm to restore the compressed image to a high-resolution image. The super-resolution algorithm is used to extract at least the shallow features, deep features, and hierarchical features of the compressed image. The shallow features include the texture information of the compressed image, the deep features include the text information of the compressed image, and the hierarchical features include the relationship between the shallow features and the deep features. The peak signal-to-noise ratio of the high-resolution image is greater than a first preset value.

[0144] The image compression and decompression apparatus of this application includes an acquisition unit, a compression unit, and a decompression unit. The acquisition unit acquires the original image of the transaction file. The compression unit downsamples the original image using a bicubic interpolation algorithm to obtain a compressed image and stores the compressed image in an object storage server. The decompression unit reads the compressed image from the object storage server when an image of the transaction file needs to be acquired, and uses a super-resolution algorithm to restore the compressed image to a high-resolution image. The super-resolution algorithm at least extracts shallow features, deep features, and hierarchical features from the compressed image. The shallow features include texture information, the deep features include text information, and the hierarchical features include the relationship between the shallow and deep features. The peak signal-to-noise ratio of the high-resolution image is greater than a first preset value. During the compression stage, the apparatus uses a downsampling algorithm to compress the image to 1 / 16 of the original image, significantly reducing the image size. During the recovery phase, the proposed super-resolution algorithm fully exploits the sparsity of image hierarchical and deep features to efficiently recover compressed images, ensuring the clarity and accuracy of image text. This reduces the hardware resource consumption of invoice images while meeting business requirements. It solves the problem of inaccurate recovery, especially the problem of blurred text information, that existing technologies cannot accurately recover compressed images during decompression.

[0145] In some embodiments, the decompression unit includes a first extraction module, a first determination module, a first processing module, and a second determination module. The first extraction module is used to extract shallow features, hierarchical features, and deep features of the compressed image using the super-resolution algorithm described above. The first determination module is used to determine the sum of the pixels of the features obtained after aggregating the hierarchical features through a first convolutional layer and the pixels of the deep features as input data. The first processing module is used to input the input data into different processing channels of the multi-dimensional local topology feature enhancement module for multi-dimensional fusion processing to obtain multiple output sub-data, and then fuse the multiple output sub-data to obtain output data, wherein the output sub-data corresponds one-to-one with the processing channel. The second determination module is used to upsample the sum of the pixels of the output data and the pixels of the shallow features to obtain the high-resolution image. Specifically, this not only solves the problem of difficult recovery of compressed document images in the prior art, but also significantly improves the clarity and realism of the recovered image through a series of advanced image processing techniques, such as multi-dimensional local topology feature enhancement and upsampling, thereby achieving image quality recovery that meets business needs while saving storage resources and bandwidth.

[0146] In some embodiments, the first extraction module includes a second extraction module, a third extraction module, and a fourth extraction module. The second extraction module is used to extract shallow features of the compressed image using a second convolutional layer. The third extraction module is used to extract hierarchical sub-features of the compressed image using multiple stacked residual Swin Transformer blocks, and concatenates all the hierarchical sub-features to obtain the hierarchical features, where each hierarchical sub-feature corresponds one-to-one with a stacked residual Swin Transformer block. The fourth extraction module is used to extract deep features using a third convolutional layer. Specifically, this hierarchical feature extraction and fusion decompression method not only achieves a breakthrough in image restoration quality but also demonstrates significant advantages in computational efficiency, information fidelity, and adaptability.

[0147] In some embodiments, the first processing module includes a second processing module, a third processing module, a fourth processing module, and a third determining module. The second processing module is used to input the aforementioned deep features into a max pooling layer for processing to obtain first processed data; the third processing module is used to input the aforementioned deep features into an average pooling layer for processing to obtain second processed data; the fourth processing module is used to input the aforementioned deep features into a convolutional layer for processing to obtain third processed data; and the third determining module is used to fuse the aforementioned first processed data, second processed data, and third processed data using a multilayer perceptron to obtain first sub-data. Specifically, the design and operation of these modules significantly improve the performance of the invoice image compression and decompression system, not only significantly improving the visual effect of image restoration but also demonstrating excellent characteristics in terms of processing efficiency, resource consumption, and adaptability, providing users with an efficient and high-quality invoice image management solution.

[0148] In some embodiments, the first processing module includes a fifth processing module, a sixth processing module, a seventh processing module, and a fourth determining module. The fifth processing module is used to input the aforementioned deep features into a fourth convolutional layer for processing to obtain fourth processed data; the sixth processing module is used to input the aforementioned deep features into a fifth convolutional layer for processing to obtain fifth processed data; the seventh processing module is used to input the aforementioned deep features into a sixth convolutional layer for processing to obtain sixth processed data, wherein any two convolutional kernels in the aforementioned fourth, fifth, and sixth convolutional layers have different sizes; the fourth determining module is used to fuse the aforementioned fourth, fifth, and sixth processed data using a self-attention mechanism to obtain fused data, and uses a seventh convolutional layer to adjust the dimensions of the fused data to obtain a spatial attention weight matrix, wherein the aforementioned spatial attention weight matrix is ​​the second sub-data. Specifically, it not only achieves significant improvements in the visual effects of image restoration, but also demonstrates significant advantages in processing efficiency, resource consumption, and adaptability, providing a new and advanced technical means for the efficient management of ticket images.

[0149] In some embodiments, the first processing module includes a fifth determining module, a sixth determining module, and a seventh determining module. The fifth determining module is used to determine the first calculated value by cross-product of the first sub-data and the input data; the sixth determining module is used to determine the second calculated value by dot product of the second sub-data and the input data; and the seventh determining module is used to determine the output data by summing the deep features, the first calculated value, and the second calculated value. Specifically, by introducing cross-product, dot product, and addition fusion operations, the first processing module can more finely control the feature fusion process, significantly improve the restoration quality of compressed document images, and exhibit excellent performance in terms of computational efficiency, resource utilization, and adaptability, providing an efficient and high-quality solution for document image management.

[0150] In some embodiments, the compression unit comprises an eighth determining module, a ninth determining module, an eighth processing module, a ninth processing module, and a first repeating module. The eighth determining module determines the points to be interpolated in the original image as interpolation points and determines the coordinates of the four vertices of a preset rectangle in the original image to obtain four known data points. The preset rectangle includes the points to be interpolated. The ninth determining module determines an initial interpolation function, which is a one-dimensional cubic interpolation function. The eighth processing module solves the equation of the initial interpolation function based on the four known data points to obtain the target coefficients of the initial interpolation function, and determines a target interpolation function based on the target coefficients and the initial interpolation function. The ninth processing module interpolates the target interpolation function in a first direction to obtain a first interpolation function, and then interpolates the first interpolation function in a second direction to obtain the target interpolation result. The first repeating module repeatedly executes the first determining step, the second determining step, the first processing step, and the second processing step to obtain the compressed image. Specifically, this achieves effective compression and information preservation of the ticket image, laying a solid foundation for subsequent image restoration. This compression strategy not only improves the efficiency of image management, but also ensures the stability of image quality during compression and restoration.

[0151] The aforementioned image compression and decompression device includes a processor and a memory. The aforementioned acquisition units, etc., are all stored as program units in the memory, and the processor executes these program units stored in the memory to achieve the corresponding functions. All of the aforementioned modules are located in the same processor; alternatively, the aforementioned modules may be located in different processors in any combination.

[0152] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured. By adjusting kernel parameters, a compression and decompression method based on super-resolution technology suitable for invoice images can be designed. This ensures that the compressed invoice images meet business requirements during decompression, solving the problem of inaccurate recovery during decompression of compressed images in existing technologies. A set of invoice image file compression and decompression devices will be implemented to reduce the storage resource consumption of high-definition images on the server.

[0153] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0154] This invention provides a computer-readable storage medium including a stored program, wherein, when the program is executed, it controls the device containing the computer-readable storage medium to perform the image compression and decompression method.

[0155] Specifically, it not only reflects the practical value of the technical solution, but also emphasizes its advantages in improving work efficiency, ensuring data quality, and reducing costs. This helps to demonstrate the innovation and unique contribution of the invention in the patent application, and also makes it easier for potential users to understand and evaluate the practical application potential of the technology.

[0156] This invention provides a processor for running a program, wherein the program executes the image compression and decompression method.

[0157] This invention provides an electronic device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it implements the steps of an image compression and decompression method. The device described herein can be a server, PC, tablet, mobile phone, etc.

[0158] This application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program having at least the following method steps:

[0159] Step S201: Obtain the original image of the transaction file;

[0160] Step S202: The original image is downsampled using a bicubic interpolation algorithm to obtain a compressed image, and the compressed image is stored in an object storage server.

[0161] Step S203: When it is necessary to obtain an image of the transaction file, the compressed image is read from the object storage server, and a super-resolution algorithm is used to restore the compressed image to a high-resolution image. The super-resolution algorithm is used to extract at least the shallow features, deep features, and hierarchical features of the compressed image. The shallow features include the texture information of the compressed image, the deep features include the text information of the compressed image, and the hierarchical features include the relationship between the shallow features and the deep features. The peak signal-to-noise ratio of the high-resolution image is greater than a first preset value.

[0162] It is obvious to those skilled in the art that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those described herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.

[0163] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0164] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0165] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0166] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0167] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0168] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0169] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0170] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0171] It should also be noted that the terms "comprising," "including," or any other variations thereof are 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. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0172] As can be seen from the above description, the embodiments of this application achieve the following technical effects:

[0173] 1) The image compression and decompression method described in this application first acquires the original image of the transaction file; secondly, it uses a bicubic interpolation algorithm to downsample the original image to obtain a compressed image, which is then stored in an object storage server; finally, when the image of the transaction file needs to be obtained, the compressed image is read from the object storage server, and a super-resolution algorithm is used to restore the compressed image to a high-resolution image. The super-resolution algorithm is used to extract at least the shallow features, deep features, and hierarchical features of the compressed image. Shallow features include texture information of the compressed image, deep features include text information of the compressed image, and hierarchical features include the relationship between shallow and deep features. The peak signal-to-noise ratio of the high-resolution image is greater than a first preset value. In the compression stage, the method uses a downsampling algorithm to compress the image to 1 / 16 of the original image, significantly reducing the image size. In the restoration stage, the proposed super-resolution algorithm fully exploits the sparsity of the image's hierarchical and deep features, efficiently restoring the compressed image and ensuring the clarity and accuracy of the image text, thereby reducing the consumption of hardware resources for the document image while meeting business requirements. This solves the problem that existing technologies cannot accurately recover compressed images when decompressing them, especially the problem of blurry text information.

[0174] 2) The image compression and decompression apparatus of this application includes an acquisition unit, a compression unit, and a decompression unit. The acquisition unit acquires the original image of the transaction file; the compression unit downsamples the original image using a bicubic interpolation algorithm to obtain a compressed image and stores the compressed image in an object storage server; the decompression unit reads the compressed image from the object storage server when it is necessary to acquire the image of the transaction file, and restores the compressed image to a high-resolution image using a super-resolution algorithm. The super-resolution algorithm at least extracts shallow features, deep features, and hierarchical features from the compressed image. The shallow features include texture information of the compressed image, the deep features include text information of the compressed image, and the hierarchical features include the relationship between the shallow features and the deep features. The peak signal-to-noise ratio of the high-resolution image is greater than a first preset value. In the compression stage, the apparatus uses a downsampling algorithm to compress the image to 1 / 16 of the original image, significantly reducing the image size. During the recovery phase, the proposed super-resolution algorithm fully exploits the sparsity of image hierarchical and deep features to efficiently recover compressed images, ensuring the clarity and accuracy of image text. This reduces the hardware resource consumption of invoice images while meeting business requirements. It solves the problem of inaccurate recovery, especially the problem of blurred text information, that existing technologies cannot accurately recover compressed images during decompression.

[0175] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. An image compression and decompression method, characterized in that, include: Obtain the original image of the transaction file; The original image is downsampled using a bicubic interpolation algorithm to obtain a compressed image, which is then stored in an object storage server. When it is necessary to obtain an image of the transaction file, the compressed image is read from the object storage server, and a super-resolution algorithm is used to restore the compressed image to a high-resolution image. The super-resolution algorithm is used to extract at least the shallow features, deep features, and hierarchical features of the compressed image. The shallow features include the texture information of the compressed image, the deep features include the text information of the compressed image, and the hierarchical features include the relationship between the shallow features and the deep features. The peak signal-to-noise ratio of the high-resolution image is greater than a first preset value.

2. The method according to claim 1, characterized in that, The compressed image is restored to a high-resolution image using a super-resolution algorithm, including: The super-resolution algorithm described above is used to extract shallow features, hierarchical features, and deep features of the compressed image; The sum of the pixels of the feature obtained by aggregating the hierarchical features through the first convolutional layer and the pixels of the deep feature is determined as the input data; The input data is input into different processing channels of the multi-dimensional local topology feature enhancement module for multi-dimensional fusion processing to obtain multiple output sub-data. The multiple output sub-data are then fused to obtain output data, and the output sub-data corresponds one-to-one with the processing channel. The high-resolution image is obtained by upsampling the sum of the pixels in the output data and the pixels in the shallow features.

3. The method according to claim 2, characterized in that, The super-resolution algorithm includes a backbone network, which consists of at least one stacked residual Swing Transformer block. The super-resolution algorithm extracts shallow features, hierarchical features, and deep features of the compressed image, including: The shallow features of the compressed image are extracted using a second convolutional layer; Multiple stacked residual Swin Transformer blocks are used to extract the hierarchical sub-features of the compressed image, and all the hierarchical sub-features are concatenated to obtain the hierarchical feature, wherein the hierarchical sub-feature corresponds one-to-one with the stacked residual Swin Transformer block; The deep features are extracted using a third convolutional layer.

4. The method according to claim 2, characterized in that, The processing channel includes a first channel, which inputs the input data into different processing channels of the multi-dimensional local topology feature enhancement module for multi-dimensional fusion processing to obtain multiple output sub-data, including: The deep features are input into a max pooling layer for processing to obtain the first processed data; The deep features are input into an average pooling layer for processing to obtain the second processed data; The deep features are input into a convolutional layer for processing to obtain the third processed data; A multilayer perceptron is used to fuse the first processed data, the second processed data, and the third processed data to obtain the first sub-data.

5. The method according to claim 2, characterized in that, The processing channel includes a second channel, which inputs the input data into different processing channels of the multi-dimensional local topology feature enhancement module for multi-dimensional fusion processing to obtain multiple output sub-data, including: The deep features are input into the fourth convolutional layer for processing to obtain the fourth processed data; The deep features are input into the fifth convolutional layer for processing to obtain the fifth processed data; The deep features are input into the sixth convolutional layer for processing to obtain the sixth processed data, wherein any two convolutional kernels in the fourth, fifth and sixth convolutional layers are of different sizes; The fourth, fifth, and sixth processed data are fused using a self-attention mechanism to obtain fused data. A seventh convolutional layer is then used to adjust the dimensions of the fused data to obtain a spatial attention weight matrix, wherein the spatial attention weight matrix is ​​the second sub-data.

6. The method according to claim 2, characterized in that, The output sub-data includes first sub-data and second sub-data. The multiple output sub-data are fused to obtain output data, including: The cross product of the first sub-data and the input data is determined as the first calculated value; The dot product of the second sub-data and the input data is determined as the second calculated value; The sum of the deep features, the first calculated value, and the second calculated value is determined as the output data.

7. The method according to claim 1, characterized in that, The original image is downsampled using a bicubic interpolation algorithm to obtain a compressed image, including: The first determination step involves determining the points in the original image to be interpolated as the interpolation points, and determining the coordinates of the four vertices of a preset rectangle in the original image to obtain four known data points. The preset rectangle is a rectangle that includes the interpolation points. The second determination step is to determine the initial interpolation function, which is a one-dimensional cubic interpolation function; The first processing step involves solving the equation of the initial interpolation function based on the four known data points to obtain the target coefficients of the initial interpolation function, and determining the target interpolation function based on the target coefficients and the initial interpolation function. The second processing step involves interpolating the target interpolation function in the first direction to obtain a first interpolation function, and then interpolating the first interpolation function in the second direction to obtain the target interpolation result. Repeat the steps, including the first determination step, the second determination step, the first processing step, and the second processing step, to obtain the compressed image.

8. An image compression and decompression apparatus, characterized in that, include: The acquisition unit is used to acquire the original image of the transaction file; The compression unit is used to downsample the original image using a bicubic interpolation algorithm to obtain a compressed image, and to store the compressed image in an object storage server. The decompression unit is used to read the compressed image from the object storage server when it is necessary to obtain an image of the transaction file, and to restore the compressed image to a high-resolution image using a super-resolution algorithm. The super-resolution algorithm is used to extract at least shallow features, deep features, and hierarchical features of the compressed image. The shallow features include the texture information of the compressed image, the deep features include the text information of the compressed image, and the hierarchical features include the relationship between the shallow features and the deep features. The peak signal-to-noise ratio of the high-resolution image is greater than a first preset value.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein, when the program is executed, it controls the device on which the computer-readable storage medium is located to perform the image compression and decompression method according to any one of claims 1 to 7.

10. An electronic device, characterized in that, include: One or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including methods for performing the image compression and decompression method according to any one of claims 1 to 7.