Image compression method, device, computer equipment and computer readable storage medium
The deep lossless image compression framework, which combines progressive mask sampling and multi-directional autoregressive context modeling, solves the problems of insufficient context modeling and low computational efficiency in image compression using autoregressive models. It achieves efficient image compression and visual lossless reconstruction, adapting to different image modalities.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUANGDONG WOFU HUAZHONG TECHNOLOGY CO LTD
- Filing Date
- 2025-09-01
- Publication Date
- 2026-05-01
AI Technical Summary
Existing autoregressive models suffer from insufficient contextual modeling, low computational efficiency, and poor modal adaptability in image compression. They are unable to effectively integrate the global structure and local details of an image, and the computational latency increases linearly with resolution, failing to meet the requirements of real-time applications.
A deep lossless image compression framework employing progressive mask sampling and multi-directional autoregressive context modeling is proposed. The spatial structure information of the image residual is gradually refined through an iterative mask sampling strategy. Combined with a multi-directional autoregressive module, the contextual dependencies of historical, current and future symbols are dynamically fused. Multi-source contextual features are extracted and compressed using a residual probability estimation model.
It significantly improves image compression efficiency and reconstruction quality, achieving a balance between visual lossless reconstruction and ultra-high compression rate. It adapts to different image modalities without retraining, is compatible with grayscale and color images, and improves computational efficiency and compression performance.
Smart Images

Figure CN121099053B_ABST
Abstract
Description
Image compression methods, apparatus, computer devices, and computer-readable storage media Technical Field
[0001] This application relates to the field of big data technology, specifically to an image compression method, apparatus, computer device, and computer-readable storage medium. Background Technology
[0002] Lossless image compression technology has significant application value in fields such as digital healthcare, remote sensing imagery, and archival storage. In recent years, lossless compression methods based on deep learning have significantly outperformed traditional coding standards (such as PNG and FLIF) on benchmark datasets like Kodak by modeling the joint probability distribution of images. Among these, autoregressive models (AR) have become the mainstream approach due to their excellent probability estimation capabilities, with typical examples including PixelCNN++ and DLPR. These models achieve compression performance approaching the entropy limit by predicting symbol distribution pixel-wise or block-wise through chain-like conditional probability decomposition. However, existing autoregressive frameworks still have fundamental limitations in terms of context modeling and computational efficiency, restricting their application in real-time scenarios and large-scale data.
[0003] Current autoregressive models primarily employ unidirectional scanning strategies (such as raster order) for context modeling, including local block partitioning in LC-FDNet and block-based serial processing in DLPR. While these methods can capture spatial relationships within local neighborhoods, unidirectional context modeling relies solely on historical information and struggles to effectively integrate global structural features across regions in the image (such as symmetrical textures and long-range edge continuity), resulting in insufficient modeling capabilities for complex spatial relationships. Strict sequential dependencies create computational efficiency bottlenecks; even with block-level parallelization (such as slice-based AR), the encoding latency still increases linearly with resolution, failing to fully leverage the parallel computing advantages of GPUs. Furthermore, existing methods typically require separate model training for different image modalities (such as grayscale / color), increasing deployment complexity.
[0004] Existing technologies suffer from the following problems: For example, insufficient contextual modeling: unidirectional scanning strategies contradict the "coarse-to-fine" cognitive process of human vision, making it difficult to simultaneously utilize the global structure and local details of an image, especially its weak ability to model cross-regional correlations (such as non-local texture repetition); low computational efficiency: symbol-by-symbol serial processing leads to high latency, with encoding time increasing exponentially in 4K and higher resolution images, making it difficult to meet the needs of real-time applications; poor modal adaptability: existing models typically require independent training for different numbers of channels (such as single-channel and three-channel), lacking a unified probabilistic modeling framework. These problems severely restrict the practical application of autoregressive models in high-resolution image compression and cross-modal scenarios. Summary of the Invention
[0005] To address the aforementioned technical problems, embodiments of this application provide an image compression method, apparatus, computer device, and computer-readable storage medium.
[0006] In a first aspect, embodiments of this application provide an image compression method, the method comprising:
[0007] The target image is input into a lossy image compressor for compression to obtain a lossy reconstructed image;
[0008] Calculate the residual map between the lossy reconstructed image and the target image;
[0009] The residual map is shifted to the non-negative interval, and the shifted residual map is segmented into a bit plane to obtain the high bit part and the low bit part;
[0010] Based on the determination result of whether the high-order part is all zero, run-length encoding is performed on the high-order part to obtain the first compressed information;
[0011] The probability distribution of the low-order part is estimated to obtain the probability distribution and its corresponding mask matrix;
[0012] Based on the state of the cumulative matrix, the low-order portion is compressed according to the pixel to be encoded indicated by the mask matrix to obtain second compressed information; wherein, the cumulative matrix is used to record the pixel position information that has been encoded.
[0013] In one embodiment of this application, the method for estimating the probability distribution of the lower-order portion further includes:
[0014] Lossy reconstruction prior features are extracted from the lossy reconstructed image using the lossy context component in the residual probability estimation model;
[0015] The channel context features of the current channel and neighboring channels in the lossy reconstructed image are extracted using the channel context component in the residual probability estimation model.
[0016] Using the spatial context component in the residual probability estimation model, and based on the mask matrix and the cumulative matrix, the spatial context features of the encoded pixels in the residual map are extracted;
[0017] The lossy reconstruction prior features, the channel context features, and the spatial context features are concatenated and fused to obtain the fused features;
[0018] The fused features are processed by the convolutional layers, activation functions, and residual connection layers in the residual probability estimation model to output the probability distribution.
[0019] In one embodiment of this application, the method for extracting channel context features of the current channel and neighboring channels in the lossy reconstructed image further includes:
[0020] For the luminance component Y in the lossy reconstructed image, the spatial context of the luminance component Y itself is used as the channel context feature;
[0021] For the chroma component U in the lossy reconstructed image, the luminance component Y is used as the channel context feature;
[0022] For the chroma component V in the lossy reconstructed image, the joint information of the luminance component Y and the chroma component U is used as the channel context feature.
[0023] In one embodiment of this application, the method further includes:
[0024] The residual probability estimation model is used to initially set the number of target pixels for each round of masking based on the scheduling function.
[0025] The probability prediction value and Gaussian noise of each pixel in the low-order part are calculated by the residual probability estimation model, and the probability score of each pixel is calculated based on the probability prediction value and the Gaussian noise.
[0026] The probability scores of each pixel are sorted using the residual probability estimation model, and the number of pixels in the target pixel count are selected as the pixels to be encoded.
[0027] In one embodiment of this application, the method further includes:
[0028] The residual probability estimation model calculates the probability score of each pixel based on the predicted probability distribution and the preset temperature parameter; wherein the temperature parameter is used to adjust the smoothness of the probability distribution to control the intensity of randomness in the pixel selection process.
[0029] The probability distribution is updated based on the probability scores of uncoded pixels using the residual probability estimation model.
[0030] The residual probability estimation model dynamically adjusts the number of target pixels in subsequent rounds based on the preset scheduling function and the updated probability distribution and / or cumulative matrix state.
[0031] The pixels selected from the adjusted target pixel count are used as the pixels to be encoded in subsequent rounds.
[0032] Secondly, embodiments of this application provide an image compression apparatus, the apparatus comprising:
[0033] The compression module is used to input the target image into the lossy image compressor for compression to obtain a lossy reconstructed image;
[0034] The calculation module is used to calculate the residual map between the lossy reconstructed image and the target image;
[0035] The translation and segmentation module is used to translate the residual map to the non-negative interval and perform bit-plane segmentation on the translated residual map to obtain the high-bit part and the low-bit part;
[0036] The first encoding module is used to perform run-length encoding on the high-order part based on the judgment result of whether the high-order part is all zero, so as to obtain the first compressed information;
[0037] The probability estimation module is used to estimate the probability distribution of the low-order part to obtain the probability distribution and its corresponding mask matrix;
[0038] The second encoding module is used to compress the low-order portion of the pixel to be encoded based on the state of the cumulative matrix and the pixel to be encoded indicated by the mask matrix, to obtain second compression information; wherein the cumulative matrix is used to record the pixel position information that has been encoded.
[0039] Thirdly, embodiments of this application also provide a computer device, including a memory storing multiple instructions; a processor loads instructions from the memory to execute the steps of any of the image compression methods provided in embodiments of this application.
[0040] Fourthly, embodiments of this application also provide a computer program product, including a computer program or instructions, which, when executed by a processor, implement the steps in any of the image compression methods provided in embodiments of this application.
[0041] Fifthly, embodiments of this application also provide a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to perform the steps of any of the image compression methods provided in embodiments of this application.
[0042] The scheme of this application embodiment inputs the target image into a lossy image compressor for compression to obtain a lossy reconstructed image; calculates the residual map between the lossy reconstructed image and the target image; shifts the residual map to a non-negative interval and performs bit-plane segmentation on the shifted residual map to obtain a high-bit part and a low-bit part; performs run-length encoding on the high-bit part according to the judgment result of whether the high-bit part is all zeros to obtain first compression information; estimates the probability distribution of the low-bit part to obtain the probability distribution and its corresponding mask matrix; based on the state of the cumulative matrix, compresses the low-bit part according to the pixel to be encoded indicated by the mask matrix to obtain second compression information. The technical solution of this application significantly improves image compression efficiency and reconstruction quality by processing residual information in a layered manner and using dynamic probability modeling: First, the lossy reconstruction residual is translated and divided into high-bit and low-bit planes, and the sparse characteristics of the high-bit part are used to greatly reduce redundancy; then, a state-aware model based on the cumulative matrix is constructed for the low-bit residual, and high-information pixels are selected for priority encoding through the mask matrix, and the probability distribution is accurately predicted by combining multi-source context features, so as to achieve efficient recovery of texture details and edge structure while approximating the lossy compression bitrate, thus achieving the unity of visual lossless reconstruction and ultra-high compression rate. Attached Figure Description
[0043] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0044] Figure 1 is a schematic diagram of the application environment of the image compression method provided in the embodiments of this application;
[0045] Figure 2 is a schematic flowchart of an embodiment of the image compression method provided in this application;
[0046] Figure 3 is a schematic flowchart of an embodiment of probability estimation in the image compression method provided in this application;
[0047] Figure 4 is a schematic flowchart of an embodiment of the image compression method provided in this application for determining the pixels to be encoded.
[0048] Figure 5 is a schematic flowchart of another embodiment of the image compression method provided in this application;
[0049] Figure 6 is a schematic diagram of a specific embodiment of the image compression framework in the image compression method provided in this application.
[0050] Figure 7 is a schematic diagram of a specific scenario of residual image processing in the image compression method provided in the embodiments of this application;
[0051] Figure 8 is a schematic diagram of a specific embodiment of the probability estimation model in the image compression method provided in this application.
[0052] Figure 9 is a structural schematic diagram of an image compression device provided in an embodiment of this application;
[0053] Figure 10 is a schematic diagram of the internal structure of the computer device provided in the embodiments of this application. Detailed Implementation
[0054] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application. At the same time, in the description of the embodiments of this application, the terms "first," "second," etc., are only used to distinguish descriptions and should not be construed as indicating or implying relative importance. Thus, features defined with "first" and "second" may explicitly or implicitly include one or more features. In the description of the embodiments of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0055] Current learning-based lossless image compression techniques primarily rely on the probability estimation capabilities of autoregressive (AR) models. These models predict the probability distribution of the current symbol successively using pixel-level or block-level contextual information through chain-like conditional probability decomposition. While these methods have achieved excellent compression performance on benchmark datasets, their strict autoregressive dependency leads to two key drawbacks:
[0056] (1) Unidirectional context modeling is difficult to fully explore the spatial correlation of two-dimensional images (such as cross-regional features like image edges and textures). Existing methods typically encode pixels or sub-image blocks step by step in raster scanning order, which can only capture the unidirectional spatial correlation of local neighborhoods and is difficult to effectively model the global structural features across regions in an image, such as the local block partitioning of LC-FDNet and the block processing of DLPR. This is significantly different from the human visual cognitive process—humans often adopt a progressive strategy of "from coarse to fine" when understanding images, that is, first perceiving the overall outline and salient regions, and then gradually refining the local details. This cognitive characteristic provides important inspiration for the improved context modeling of lossless compression in this invention.
[0057] (2) Computational efficiency bottleneck. Pixel-by-pixel or block-level serial processing causes the encoding latency to increase linearly with the image resolution. Even if the overall process is accelerated by block-level parallelization, it is still limited by sequential dependence and it is difficult to make full use of the large-scale parallel computing capabilities of the GPU.
[0058] To address the aforementioned challenges, this invention proposes a deep lossless image compression framework based on progressive mask sampling and multi-directional autoregressive context modeling. Its core idea is to view image encoding as a process of refining the probability distribution from coarse to fine: through an iterative mask sampling strategy, the spatial structure information of the image residual is gradually refined, and the contextual dependencies of historical, current, and future symbols are dynamically fused using a multi-directional autoregressive module, thereby more accurately estimating the probability distribution of the residual.
[0059] The model framework of this invention follows the idea of depthwise lossy compression plus residual coding for lossless image compression, but the residual coding is performed through T iterations of probability estimation to achieve lossless entropy coding. The contributions of this invention are as follows:
[0060] (1) Multi-directional autoregressive context modeling: This invention proposes a depth-based lossless image compression method through iterative masking sampling and coarse-to-fine autoregression. It dynamically constructs context windows in multiple directions, breaking through the unidirectional scanning limitation of traditional autoregressive models. This module utilizes an attention mechanism to adaptively fuse multi-scale context features, significantly enhancing the ability to model cross-regional correlations such as image edges and textures.
[0061] (2) Scalable lossless image compression: An adjustable number of iterations T is introduced as a control parameter, allowing users to flexibly balance compression ratio and computational efficiency. As T increases, the residual probability estimation is gradually refined, improving the compression ratio but increasing the encoding time linearly. This scalability provides flexible options for different application scenarios (such as real-time transmission and high-density storage).
[0062] (3) The trained single-depth model is compatible with both grayscale (single-channel) and color (three-channel) images. Experiments show that the model exhibits compression performance comparable to the state-of-the-art (SOTA) model on benchmark datasets, and does not require retraining the network for different data modalities.
[0063] Based on the above problems, the image compression method in this application is proposed. In one embodiment of this application, the image compression method can be run on a computer device, which can be a local terminal device or a server.
[0064] To better understand the image compression method, apparatus, computer device, and storage medium provided in the embodiments of this application, the application environment applicable to the embodiments of this application is described below.
[0065] Please refer to Figure 1, which illustrates an application environment schematic diagram of an image compression method provided in an embodiment of this application. As one implementation, the image compression method provided in this embodiment is applied to a computer device. This computer device can be a server 110 as shown in Figure 1, which can be connected to a terminal device 120 via a network. The network serves as a medium for providing a communication link between the server 110 and the terminal device 120. The network can include various connection types, such as wired communication links, wireless communication links, etc., and this embodiment does not limit this. Optionally, in other embodiments, the computer device can also be a smartphone, laptop, etc.
[0066] It is understood that the server 110, network, and terminal device 120 in Figure 1 are merely illustrative. Depending on the implementation requirements, any number of servers, networks, and terminal devices can be included. For example, server 110 can be a physical server or a server cluster composed of multiple servers, and terminal device 120 can be a mobile phone, tablet, desktop computer, laptop computer, etc. It is understood that in the embodiments of this application, multiple terminal devices 120 may also be allowed to access server 110 simultaneously.
[0067] The following detailed description, in conjunction with the accompanying drawings, illustrates the use of a computer device as an example in this embodiment. It should be noted that the order of description in the following embodiments is not intended to limit the preferred order of the embodiments. Although a logical order is shown in the flowcharts, in some cases, the steps shown or described may be performed in a different order than that shown in the drawings.
[0068] Specifically, for the technical solution of this application embodiment, please refer to Figure 2. Figure 2 is a schematic flowchart of an embodiment of the image compression model training method provided in this application embodiment. The specific flow of the image compression method in this application embodiment can be as follows: steps 201 to 206, wherein:
[0069] Step 201: Input the target image into a lossy image compressor for compression to obtain a lossy reconstructed image.
[0070] In this embodiment, the target image can be digitally acquired or computer-generated from a real-world scene, including natural images captured by devices such as digital cameras and smartphones, or remote sensing and video frames captured by satellites, drones, and surveillance cameras; it can also be from medical imaging equipment, or high-precision inspection images from industrial scenes involving production lines; furthermore, it can be computer-rendered 3D model screenshots, game screens, design drawings, and standard test images from publicly available internet datasets. These images may have undergone preliminary cropping, format conversion, or color correction, but have not yet undergone lossy compression, retaining their original resolution and detail information. As input sources for subsequent processing, their data characteristics directly affect the evaluation of the compression algorithm's effectiveness.
[0071] In the embodiments of this application, lossy image compressors mainly include: 1. JPEG standard based on discrete cosine transform, which achieves high compression ratio by discarding high-frequency information through block processing and quantization; 2. JPEG 2000 based on wavelet transform, which improves compression efficiency and reduces block artifacts by utilizing multi-resolution analysis; 3. WebP launched by Google, which combines predictive coding and transform coding to optimize network transmission while maintaining quality; 4. Intra-frame coding technologies derived from video compression, such as the still image mode of HEVC / H.265, which further reduce bitrate through more efficient prediction and transform structures; 5. In addition, there are deep learning compressors based on neural networks, which automatically learn the optimal compression strategy through end-to-end training to retain more semantic features at ultra-low bitrates. These compressors have different focuses in terms of algorithm complexity, compression efficiency, and visual fidelity, and are suitable for different application scenarios.
[0072] In this embodiment, the lossy reconstructed image is the visual output result processed by a lossy compression algorithm. Its characteristic is a significant reduction in file size but irreversible information loss. During compression, these images discard frequency domain components that are insensitive to the human eye or merge similar pixel values through quantization, resulting in the inability to fully restore the original data during reconstruction. Typical manifestations include blurred edges, color block artifacts, ringing effects, or texture distortion. Their quality can be quantitatively evaluated using metrics such as PSNR and SSIM. Despite these drawbacks, lossy reconstructed images are still widely used in bandwidth / storage space-sensitive scenarios such as network transmission and digital media storage, balancing compression ratio and visual acceptability to meet practical needs.
[0073] In this embodiment, the detailed process of inputting the target image into a lossy image compressor to obtain a lossy reconstructed image is as follows: The original target image to be processed is input into a specially designed lossy image compression algorithm or system. This compressor compresses the image data using a specific encoding method, discarding some visual information that is insensitive to the human eye or of secondary importance, thereby significantly reducing the file size. The final output is a compressed reconstructed image. Although it is visually similar to the original image, due to the characteristics of lossy compression, the two are not completely identical at the pixel level, and may suffer from quality losses such as blurring, blockiness, or color distortion. The core of this process is to achieve a controllable trade-off between file size and image quality.
[0074] Step 202: Calculate the residual map between the lossy reconstructed image and the target image.
[0075] In the embodiments of this application, the process of calculating the residual map typically includes the following steps: First, the original image and the reconstructed image are pixel-level aligned to ensure that they are completely matched in spatial size and color channels; second, an appropriate residual calculation method is selected according to specific needs. For grayscale images, the corresponding pixel values can be directly subtracted (i.e., residual = original pixel value - reconstructed pixel value), while for color images, independent calculation for each channel or conversion to a luminance channel for post-processing is required; next, the obtained original residual matrix is normalized to facilitate visualization and analysis; in applications that need to highlight specific differences, absolute value, square operation, or threshold filtering can be applied to the residual; to further enhance the interpretability of the residual map, pseudo-color mapping can be applied to convert numerical differences into intuitive color gradients, or contour markers can be superimposed to highlight edge distortion areas; for video or image sequences, dynamic residual maps can also be generated through temporal accumulation or optical flow alignment; the final output residual map can serve as a quantitative basis for quality assessment and can also intuitively reveal the distribution of defects in the compression algorithm in terms of texture details, edge sharpness, or color fidelity, providing spatial guidance information for algorithm optimization. Throughout the process, attention must be paid to numerical overflow, boundary alignment, and secondary errors that may be introduced by color space conversion, to ensure that the residual results truly reflect the distortion characteristics of lossy compression.
[0076] Step 203: Shift the residual map to the non-negative interval and perform bit-plane segmentation on the shifted residual map to obtain the high-bit part and the low-bit part.
[0077] In this embodiment, the main purpose of shifting the residual map to a non-negative interval is to adapt to the data format requirements of subsequent processing steps and simplify the calculation logic: the residual map (the difference matrix between the original image and the reconstructed image) usually contains positive and negative values (e.g., positive numbers indicate insufficient reconstructed brightness, and negative numbers indicate over-enhancement), but many image processing algorithms (e.g., bit-plane decomposition, run-length encoding, or entropy encoding) only support unsigned integer inputs. By shifting the data to a non-negative interval (e.g., mapping from [-128, 127] to [0, 255]) through shifting (e.g., adding the absolute value of the smallest negative value to all pixel values or taking the absolute value), the sign bit interference problem caused by negative values during binary bit-plane segmentation can be avoided. At the same time, it ensures that run-length encoding (RLE) can directly count continuous zero-value regions (all zeros indicate no residual) and meets the requirement of non-negativity of the probability interval for entropy encoding (e.g., arithmetic encoding). In addition, non-negation can unify the numerical range of the residual map, which is convenient for visualization analysis (e.g., pseudo-color mapping) and standardization processing. It is a common data preprocessing technique in image compression systems.
[0078] In this embodiment, the residual image is shifted to a non-negative interval, and bit-plane segmentation is performed on the shifted residual image to obtain a detailed description of the high-bit part and the low-bit part: Data preprocessing and feature separation operations are performed on the residual image (the difference matrix between the original image and the reconstructed image, which contains positive and negative values): First, the residual image is adjusted to a non-negative interval (all pixel values ≥ 0) by a shift transformation (such as adding the absolute value of the smallest negative value to all pixels) to eliminate the interference of negative values on subsequent binary processing; then, bit-plane segmentation is performed on the shifted image (the binary representation of each pixel is decomposed according to the importance of the bits), which is decomposed into the high-bit part (Most Significant Bits, MSBs, i.e., the first few bits of binary, such as the 7th to 4th bits in an 8-bit image, which carries the main structural features and significant distortion of the image) and the low-bit part (Least Significant Bits, LSBs, i.e., the last few bits, such as the 3rd to 0th bits, which contain minor noise and minor quantization errors). This separation operation can selectively process information of different importance, such as using the high-order part to optimize reconstruction quality while ignoring or compressing the low-order part to reduce the amount of data, while maintaining visual fidelity.
[0079] The residual bit-plane segmentation in this application is based on experimental analysis of the information entropy distribution of the residual graph. After non-negative shifting, the high-order bit-plane (e.g., the highest few bits) of the residual graph typically has low information entropy, exhibiting highly sparse or all-zero features. This is because the prediction error of lossy compression is concentrated in a small value range. Conversely, the low-order bit-plane (e.g., the lowest few bits) has high information entropy, with a more random distribution and containing detailed noise. Therefore, segmenting into high-order and low-order parts allows for targeted processing: the high-order part can efficiently utilize run-length encoding to handle sparsity, while the low-order part adapts to probabilistic model compression, thereby optimizing compression efficiency and robustness.
[0080] In this embodiment, by analyzing the residual maps (shifted to non-negative) generated after lossy compression of different images, the distribution of their information entropy on the bit plane exhibits a significant regularity. Experimental measurements show that higher bit planes (e.g., MSBs representing larger weights in the residual values) typically exhibit extremely low information entropy. This is intuitively reflected in the extremely high spatial sparsity or even large areas of all-zero blocks in these higher bit planes. The root cause is that lossy compression algorithms tend to constrain the energy of reconstruction errors (residuals) within a relatively small numerical range, resulting in a scarcity of residuals with large absolute values.
[0081] In this embodiment, based on entropy distribution characteristics, the segmentation strategy achieves precise adaptation to the encoding tool. For the high-order part, its extremely low entropy (high sparsity / all zeros) makes it naturally suitable for run-length encoding (RLE). RLE can compress long strings of zero or repetitive values with extremely high efficiency, perfectly matching the statistical characteristics of the high-order part and avoiding the unnecessary overhead of using complex entropy encoding. For the low-order part, its higher entropy and quasi-random characteristics require more refined probability modeling (such as estimating its distribution through context modeling) and adaptive entropy encoding (such as arithmetic encoding). Segmentation allows for the independent construction of more accurate and targeted probability models (and their mask matrices) for the low-order part, and efficient compression is performed under the guidance of contextual information tracked by the cumulative matrix, thereby significantly improving the overall compression efficiency and the robustness of the algorithm to different image content and residual statistical characteristics.
[0082] It is understandable that the implementation of the residual bit-plane segmentation method is not limited. For example, fixed bit-depth segmentation (hardware-friendly, based on the dataset statistics to preset bit-depth thresholds, such as taking the highest 4 bits as the high bit plane) and dynamic entropy-driven segmentation (compression efficiency priority, based on 3×3 window Shannon entropy to dynamically select segmentation points, with high bit plane entropy value <0.2 and low bit plane entropy value >0.6). The compression efficiency of the technical solution in this application is significantly improved: dynamic segmentation enhances the sparsity of the high bit plane by 20%-40%, improves run-length encoding efficiency by more than 15%, optimizes the accuracy of low bit plane probability modeling, and improves the overall compression rate by up to 8% compared with fixed segmentation. At the same time, the computational resources are optimized: fixed segmentation achieves microsecond-level latency for single bit operations, while dynamic segmentation is calculated quickly through local entropy, reducing segmentation overhead by 30% compared with traditional full-image analysis. The scenario adaptation advantage: the dual strategies are adapted to real-time hardware encoding (fixed segmentation) and high compression rate scenarios (dynamic segmentation) respectively. In the Kodak dataset test, the overall bit rate is saved by 12%-18%, while reducing the interference of low-frequency residual noise on the encoding model.
[0083] Step 204: Based on the determination result of whether the high-order part is all zero, run-length encoding is performed on the high-order part to obtain the first compressed information.
[0084] In this embodiment, Run-Length Encoding (RLE) is a lossless compression algorithm based on the continuous repetition of data. Its core idea is to replace consecutive sequences of identical values (called "runs") with tuples of [value, number of repetitions]. For example, the string "AAAAABBBCC" can be encoded as "A5B3C2". By counting the occurrences of consecutive characters instead of storing the original data one by one, the data volume is significantly reduced. This algorithm is particularly suitable for signals containing a large number of repetitive values (such as black and white pixel blocks in binary images, all-zero regions in residual maps, or gradient color data). Its encoding efficiency depends on the redundancy of the data—the longer the repetitive sequence, the higher the compression ratio. RLE is simple to implement and computationally efficient, and is commonly used for intra-frame compression of early image formats (such as BMP, PCX), video encoding (such as the DC coefficients in JPEG), and document compression (such as the CCITT standard for PDF). However, it may produce negative compression when dealing with highly random data (such as the noisy parts of natural images). Its variants include bit-plane RLE and group RLE to accommodate data characteristics of different granularities.
[0085] In the embodiments of this application, the first compressed information typically includes the high-order data processed by run-length encoding (RLE), and may specifically consist of the following: if the high-order part is all zero, the compressed information may only store a single marker bit (such as "0" or a specific identifier) indicating that the region has no significant features; if it is not all zero, it includes a series of [value, repetition count] tuples generated by run-length encoding (e.g., "255,10" indicates that the high-order value of 10 consecutive pixels is 255), as well as necessary separators or length identifiers to ensure decoding accuracy; in addition, metadata (such as the bit width of the high-order part, image block size, or RLE version identifier) may also be included to guide the decoding process. In optimized implementations, the first compressed information may also employ differential encoding (storing the difference between adjacent runs) or Huffman encoding (further compressing the numerical distribution of the RLE output) to improve the compression ratio, ultimately forming a compact binary stream for efficient storage or transmission of structural distortion features in the residual map.
[0086] In this embodiment, the step of performing run-length encoding on the high-order bits to obtain the first compressed information based on the determination result of whether the high-order bits are all zeros is described in detail as follows: A compression encoding method based on the data characteristics of the high-order bits first performs all-zero detection on the high-order bits, selectively performs run-length encoding based on the detection result, and finally generates the first compressed information. This method significantly improves compression efficiency by utilizing the sparsity of the high-order bits, while retaining key structural information, providing a foundation for subsequent low-order bit compression or residual reconstruction.
[0087] In this embodiment, step 204 involves performing run-length encoding on the high-order portion based on the determination result of whether the high-order portion is all zeros, to obtain first compressed information, including:
[0088] 1. When all pixel values in the high-order part are zero, generate a 1-bit flag to indicate that the high-order part is all zero;
[0089] In this embodiment, the process describes an optimized compression strategy for the high-order bits: when all pixel values in the high-order bits are detected to be zero (indicating that there is no significant structural distortion in the image region, and all residual information is concentrated in the low-order bits), the system does not need to store the actual data, but instead generates a 1-bit flag (binary 0 or 1, such as "1" representing all zeros and "0" representing non-all zeros), replacing traditional run-length encoding with this minimalist encoding method. This design utilizes the spatial sparsity characteristics of the high-order bits in smooth image regions (i.e., adjacent pixels often have consecutive zero values in their MSBs), achieving the most efficient data representation with a single bit of metadata (flag), significantly reducing storage overhead compared to directly storing the original data or applying run-length encoding. This compression strategy is particularly suitable for residual-based image coding systems (such as the residual coding layer of JPEG XR), and can adaptively select the optimal compression path (flag or conventional encoding) through a conditional judgment mechanism (all-zero detection) while ensuring reconstruction quality, thereby improving the overall compression ratio.
[0090] 2. If there are non-zero pixels in the high-order part, run-length encoding is performed on the high-order part to obtain the first compressed information.
[0091] In this embodiment, the process describes how, when non-zero pixels exist in the high-order portion (indicating significant structural distortion or edge differences in the region), the system triggers run-length encoding (RLE) to compress the high-order portion data, generating first compressed information (i.e., the compressed representation of the high-order portion, typically containing a sequence of tuples encoded by RLE and necessary delimiters). This operation utilizes the spatial redundancy of the high-order portion (such as continuous zero values in smooth regions or repeated gradient values in edge regions) to transform sparsely distributed salient features into a compact binary stream, thereby avoiding the redundant overhead of directly storing the original data. This mechanism, together with the all-zero flag strategy (1-bit flag), forms a conditional branch, constituting an adaptive residual compression framework that achieves a balance between compression efficiency and reconstruction accuracy in the image coding system.
[0092] Step 205: Estimate the probability distribution of the low-order part to obtain the probability distribution and its corresponding mask matrix.
[0093] In this application embodiment, the probability distribution estimation method can be either parametric or non-parametric: parametric methods describe probabilistic characteristics by assuming the data follows a specific distribution form and optimizing parameters; non-parametric methods directly construct distributions based on data samples, where histograms obtain discrete probabilities through bin counting, while kernel density estimation uses smoothing kernel functions superimposed on sample points to generate continuous probability density functions. In deep learning, probability distributions are often derived from the distribution parameters output by neural networks or by modeling complex distributions through normalized flow. These methods, by capturing statistical patterns in the data, provide accurate probability interval division criteria for entropy coding, thereby optimizing compression efficiency.
[0094] In this embodiment, the mask matrix is a binary matrix (typically composed of 0s and 1s) with the same size as the target image or data matrix, used to identify specific regions to be processed or retained: where "1" represents valid pixels or regions to be manipulated (such as significant structural distortions in the residual image), and "0" represents invalid regions that can be ignored or masked (such as noise or minor details). In image compression, the mask matrix is generated through probability distribution estimation (such as thresholding to filter low-frequency noise) or manual rules (such as edge detection) to guide selective coding or resource allocation. Its core function is to achieve data sparsity and attention focus, and it is widely used in progressive coding, masked convolution of neural networks, and ROI (Region of Interest) extraction tasks in computer vision.
[0095] In this embodiment, the process describes a statistical modeling method for low-order bits (LSBs): First, probability distribution estimation (statistical analysis of the pixel values in the LSBs, such as histogram counting or parametric modeling, to determine the frequency of different values, such as Gaussian distribution fitting or nonparametric kernel density estimation) is used to obtain their probability characteristics (e.g., values are concentrated in the range of 0-3). Then, a corresponding mask matrix is generated. This process quantifies the statistical redundancy of the LSBs, providing a basis for subsequent entropy coding (such as arithmetic coding) or selective filtering (discarding minor noise with a mask value of 0), thereby optimizing compression efficiency while ensuring visual quality. It is typically applied in context-based image coding systems.
[0096] Based on the determination result of whether the high-order part is all zero, run-length encoding is performed on the high-order part to obtain the first compressed information;
[0097] The probability distribution of the low-order part is estimated to obtain the probability distribution and its corresponding mask matrix;
[0098] Based on the state of the cumulative matrix, the low-order portion is compressed according to the pixel to be encoded indicated by the mask matrix to obtain the second compression information; wherein, the cumulative matrix is used to record the pixel position information that has been encoded.
[0099] Based on the judgment result of the all-zero region in the high-order part, run-length encoding (RLE) is used to efficiently compress its sparse structure and generate the first compressed information. At the same time, the probability distribution model of the low-order part is performed to generate a probability distribution describing its statistical characteristics and a mask matrix identifying the effective encoding region. Then, combined with the cumulative matrix state recording the position of the encoded pixels, and guided by the mask matrix, context-aware entropy encoding is performed on the pixels to be encoded in the low-order part, and finally the second compressed information is output, forming a hierarchical compression mechanism.
[0100] First, based on the detection results of the all-zero regions in the high-order part, run-length encoding (RLE) is used to compress its sparse structure to generate the first compressed information. Simultaneously, probabilistic modeling is performed on the low-order part to generate distribution parameters and a mask matrix identifying the effective encoded region. Then, based on the processed pixel position states recorded by the cumulative matrix, and guided by the mask matrix, dynamic context entropy encoding is performed on the pixels to be encoded in the low-order part to output the second compressed information. The technical effects are: significantly improved compression efficiency: RLE extremely compresses high-order sparse data, and the probabilistic model accurately adapts to low-order random noise, achieving dual optimization of the compression ratio; reduced computational redundancy: the mask matrix focuses on effective pixels, and combined with context tracking of the cumulative matrix, it avoids repeated scanning of already encoded regions; enhanced algorithm robustness: adaptive probabilistic modeling dynamically responds to changes in residual statistical characteristics, ensuring stable compression performance in complex textures and smooth regions.
[0101] Step 206: Based on the state of the cumulative matrix, the low-order portion is compressed according to the pixel to be encoded indicated by the mask matrix to obtain second compression information; wherein, the cumulative matrix is used to record the pixel position information that has been encoded.
[0102] In this embodiment, the cumulative matrix is a statistical representation tool generated by element-wise accumulation, typically formed by progressively stacking base matrices (such as probability distribution matrices or binary masks) along the row and column directions. In image processing, it may record the cumulative distribution of pixel values (such as cumulative probability in a histogram) or aggregated information of spatial features (such as the sum of pixels in a region of an integral image). In the field of data compression, the cumulative matrix can map the interval division of probability distributions or guide the bit allocation of entropy coding. Its core function is to transform discrete data into a monotonically increasing continuous representation, thereby supporting fast interval lookups, dynamic threshold segmentation, or statistically dependent coding optimization.
[0103] In this embodiment, the pixel to be encoded refers to a single pixel unit currently being processed in the image compression or transmission process. It contains color information of the original image (such as RGB or YUV channel values) and contextual features (such as gradients of neighboring pixels, prediction residuals, etc.). In predictive coding systems, the pixel to be encoded needs to generate a predicted value and calculate a residual using neighboring encoded pixels (left, top, or diagonal). In transform coding, it participates in frequency domain transform as an input element of the block matrix. In entropy coding, its quantized value or residual is converted into a binary bitstream according to a probability model. The core of this concept lies in dynamically marking the processing focus, ensuring that the encoder can optimize compression efficiency pixel / block by pixel in a specific order (raster scanning or region adaptation).
[0104] In this embodiment, the process describes a low-bit compression method based on statistical modeling: First, a cumulative matrix (a spatial index table recording the coordinates and states of encoded pixels, such as an integral image or a dynamically updated position marker matrix) is used to track the processing progress. A mask matrix (a binary template identifying the effective region of the pixels to be encoded, where 1 indicates significant low-bit pixels to be processed and 0 indicates negligible minor noise) is then used to filter the target data. Subsequently, conditional compression (such as context-based adaptive arithmetic coding, which optimizes the probability interval division using the distribution of neighboring pixels statistically obtained from the cumulative matrix) is performed on the pixels to be encoded with a mask marker of 1 (the low-bit pixel units currently to be compressed). Finally, the second compression information (the compressed bitstream of the low-bit portion, containing the entropy coding results of the numerical values and their contextual associations) is output. This mechanism maintains spatial consistency through the cumulative matrix and achieves noise filtering with the help of the mask matrix, preserving effective details while improving the compression ratio. It is typically applied in hybrid coding systems.
[0105] In this embodiment, based on the state of the cumulative matrix, the low-order part is compressed according to the pixel to be encoded indicated by the mask matrix. In this step, traditional methods usually use unidirectional scanning (such as raster order) for autoregressive modeling. However, this scheme replaces unidirectional scanning with multi-directional autoregressive context modeling (such as four-way dynamic path of up / down / left / right), thereby achieving efficient capture of long-range dependencies of the residual map.
[0106] Quantization advantages over classical methods (such as Masked Autoencoder): Improved long-range dependency: Traditional Masked Autoencoder (MAE) relies on a fixed mask pattern, making it difficult to adapt to image structures, thus limiting its long-range texture modeling capabilities. Our multi-directional context modeling approach, tested on the Kodak dataset, achieves a PSNR gain of 0.38~0.92dB for residual reconstruction of complex textures (such as hair and vegetation) (a 12%~18% improvement over MAE); edge continuity error is reduced by 15%~22% (verified by SSIM metrics). Hardware-friendly design: Four-way parallel computation: Each scanning path can run independently, supporting SIMD instruction set acceleration, resulting in a 2.1x improvement in encoding throughput compared to MAE; Dynamic mask pruning: Only the adjacent 3×3 effective pixel context is retained, reducing memory usage by 40% compared to Wavefront scanning, making it suitable for FPGA / ASIC deployment.
[0107] This solution's multi-directional autoregressive modeling overcomes the limitations of traditional unidirectional / fixed mask methods in the residual compression stage through a dynamic four-directional scanning mechanism: it achieves long-range dependency modeling with a hardware-friendly parallel architecture, achieving a PSNR gain of up to 0.92dB; combined with dynamic context selection of the mask matrix and cumulative matrix, it reduces memory overhead by 40% while maintaining coding accuracy; and it provides a deployable solution for real-time high-fidelity image compression (such as 8K video and medical imaging).
[0108] The "multi-directional autoregression" method in this application significantly surpasses the traditional unidirectional scanning method. For example, in terms of long-range dependency optimization, multi-directional paths cover global structural associations, solving the blind spot of MAE modeling diagonal direction dependencies (such as rotating textures), and significantly improving visual fidelity; in terms of computational efficiency, directional selective masks skip redundant calculations, and the single-frame 1080P encoding latency is <50ms (real-time performance meets the standard); in terms of resource consumption, dynamic context windows reduce the computational complexity from O(n²) to O(n), and the memory usage is only 60% of that of traditional methods.
[0109] In one embodiment of this application, referring to FIG3, FIG3 is a schematic flowchart of an embodiment of probability estimation in the image compression method provided in this application; step 205, estimating the probability distribution of the low-order portion, includes:
[0110] Step 301: Extract lossy reconstruction prior features from the lossy reconstructed image using the lossy context component in the residual probability estimation model;
[0111] In this application example, the Residual Probability Estimation Model is a probabilistic modeling system for predicting the numerical distribution of residual maps, typically implemented based on a deep learning architecture. This model outputs the probability parameters for each residual pixel through multi-level feature extraction (e.g., convolutional layers capturing local correlations and attention mechanisms modeling long-range dependencies) and context fusion (integrating lossy reconstruction priors, channel and spatial context), providing a statistical basis for entropy coding to optimize compression efficiency. Its core innovation lies in replacing traditional hand-designed probabilistic models with data-driven adaptive prediction. Through end-to-end training, it dynamically adjusts the probability estimation, significantly improving rate-distortion performance in tasks such as neural image compression and video coding, while also supporting progressive coding (hierarchical probability refinement) and handling of anomalous residuals (long-tail distribution modeling).
[0112] In this application example, the Lossy ContextModule in the residual probability estimation model is a sub-network or algorithm module specifically designed to extract and analyze compression artifacts and distortion patterns in lossy reconstructed images (images that have been distorted after compression processing). It typically consists of convolutional layers, attention mechanisms, or transform domain analyzers. This module captures the unique degradation features of lossy images (such as block artifacts, blurred edges, or frequency domain energy decay in JPEG) to generate prior features for lossy reconstruction (implicit representations of compression distortion patterns), thereby guiding the residual probability estimation model to more accurately predict the residual distribution between the original and reconstructed images (e.g., predicting larger residual variance in block boundary regions). Its core function is to utilize the known distortion characteristics of lossy images (as contextual constraints) to optimize the efficiency of residual modeling, significantly improving the accuracy of probability prediction in neural image compression systems (such as COOL-CHIC) or hybrid coding frameworks (such as residual coding in JPEG XL), thus improving the balance between final compression ratio and reconstruction quality.
[0113] In this application example, Lossy Reconstruction Prior Features refer to high-level feature representations extracted from reconstructed images after lossy compression that characterize the compression distortion patterns. These features analyze typical artifact patterns (such as blockiness, blurring, and ringing) in lossy reconstructed images (e.g., images output in JPEG, WebP, etc. compression formats), quantify the information loss characteristics caused by the compression process (e.g., the degree of high-frequency detail loss, texture degradation, or color distortion), and provide crucial guidance for subsequent residual modeling or quality enhancement. In deep learning, these features are typically automatically extracted by convolutional neural networks or transformers, serving as conditional information to guide models to more accurately predict the residual distribution between the original and reconstructed images (e.g., predicting the intensity of residuals at block boundaries), or directly used for image enhancement (e.g., deblocking, super-resolution reconstruction). Their core value lies in utilizing the known distortion characteristics (prior knowledge) of the compression algorithm to optimize the reconstruction process, achieving a more efficient rate-distortion tradeoff in tasks such as image compression and quality enhancement.
[0114] In this application example, the process describes extracting lossy reconstruction prior features from a lossy reconstructed image using a lossy context component in the residual probability estimation model. These features, through the distortion introduced by quantization compression, provide contextual guidance for residual probability estimation (e.g., predicting that the residual may exhibit greater variance in block edge regions), thereby improving the adaptability of the probabilistic model and ultimately optimizing the residual encoding efficiency. This technique is commonly found in neural image compression systems, achieving co-optimization of lossy priors and residual modeling through end-to-end training.
[0115] Step 302: Extract the channel context features of the current channel and neighboring channels in the lossy reconstructed image using the channel context component in the residual probability estimation model.
[0116] In this application example, the process describes the working mechanism of the channel context component in the residual probability estimation model: extracting channel context features of the current channel and neighboring channels from the lossy reconstructed image. These features provide cross-channel constraints for residual probability estimation by modeling the joint distribution across channels, thereby enhancing the accuracy of probability prediction and ultimately improving the compression efficiency of multi-channel images.
[0117] The method for extracting channel context features of the current channel and neighboring channels in the lossy reconstructed image further includes:
[0118] For the luminance component Y in the lossy reconstructed image, the spatial context of the luminance component Y itself is used as the channel context feature;
[0119] In this application example, the luminance component Y refers to the channel representing the brightness information of an image in the color space, usually denoted as the Y channel. Its physical meaning reflects the brightness intensity perceived by the human eye rather than color. Technically, the luminance component is obtained by linearly weighted fusion of the RGB channels, containing the main structural and texture details of the image (approximately 90% of the visual information), and therefore is often sampled at a higher resolution in image processing. As the basis for color separation, the luminance component not only dominates visual perception quality (such as edge sharpness) but is also frequently used to guide the processing of the chrominance component (such as cross-component prediction), playing a central role in tasks such as compression (JPEG), enhancement (sharpening), and analysis (feature extraction).
[0120] In this application example, the process describes a feature extraction strategy for the luminance component Y in a lossy reconstructed image: by directly utilizing the spatial context of the luminance component Y itself as channel context features, the complexity of cross-channel analysis is avoided. This method is based on the dominance of the luminance channel in human visual perception (the human eye is more sensitive to changes in luminance), and models the residual distribution (predicting the compression error pattern of the Y channel) by mining its internal spatial correlations (such as edge continuity or texture repetition). It is suitable for single-channel optimization or as a basic step in multi-channel joint modeling, and has been applied in both traditional coding standards and neural compression models.
[0121] For the chroma component U in the lossy reconstructed image, the luminance component Y is used as the channel context feature;
[0122] In this application example, the chromaticity component U refers to the channel representing blue chromaticity information in the YUV or YCbCr color space, which, together with the luminance component Y and the red chromaticity component V / Cr, constitutes the color representation of the image. Technically, the U component is generated by extracting blue difference signals from the RGB channels, reflecting the degree of blue shift of the image content relative to the luminance reference (negative values indicate yellowishness, positive values indicate bluishness). Because the human eye has low sensitivity to chromaticity, the U component is usually stored in a subsampled format to reduce data volume. In video compression and image encoding, it carries color information together with the V component, and its processing strategy directly affects the color fidelity and compression efficiency of the reconstructed image. In this application example, the process describes a feature extraction method for the chromaticity component U in lossy reconstructed images: through cross-channel correlation, the luminance component Y is directly used as the channel context feature of the chromaticity component U. This method is based on the natural correlation between chroma and luminance signals. It uses the high-frequency structural information of the luminance channel to predict the residual distribution of the chroma components, thereby improving compression efficiency while reducing the computational cost of chroma-independent modeling. It is typically applied in video coding standards and neural image compression systems.
[0123] 3. For the chroma component V in the lossy reconstructed image, the joint information of the luminance component Y and the chroma component U is used as the channel context feature.
[0124] In this application example, the chromaticity component V is a channel representing red chromaticity information in the YUV or YCbCr color space, which, together with the luminance component Y and the blue chromaticity component U / Cb, constitutes a complete color representation. Technically, the V component is calculated by extracting the red difference component from the RGB signal (e.g., Cr = R - Y), reflecting the degree of red shift of the image content relative to the luminance reference (negative values indicate a greenish tint, positive values an reddish tint). Because the human visual system has low sensitivity to chromaticity, the V component is usually used with the U component in subsampling (e.g., 4:2:0) to save bandwidth. In video coding (e.g., HEVC) and image compression (e.g., JPEG), storage efficiency is optimized through techniques such as chromaticity prediction and joint coding. Its reconstruction quality directly affects the visual fidelity of key color regions such as skin tones and warm tones.
[0125] In this application example, the process describes a feature extraction mechanism for the chroma component V in a lossy reconstructed image: by fusing the joint information of the luminance component Y and the chroma component U, the channel context features of the chroma component V are constructed. Based on the physical coupling characteristics of the chroma components, this method utilizes dual-channel priors to more accurately predict the residual distribution of the V component, thereby improving chroma compression efficiency while reducing independent coding complexity. It is typically applied in modern coding standards and end-to-end neural compression models.
[0126] Step 303: Using the spatial context component in the residual probability estimation model, and based on the mask matrix and the cumulative matrix, extract the spatial context features of the encoded pixels in the residual map;
[0127] In this application example, the process describes the working mechanism of the spatial context component in the residual probability estimation model: the target neighborhood is filtered based on the mask matrix, the available spatial context range is determined by combining the cumulative matrix, and the spatial context features of the encoded pixels are extracted from the residual map. These features constrain the probability distribution of the current pixel to be encoded (predicting the interval in which its residual value may fall) by modeling spatial continuity (such as edge extension or texture repetition patterns), thereby improving the efficiency of entropy coding (such as the interval partitioning accuracy of arithmetic coding). This technique is widely used in context-based image coding systems (such as prediction domain modeling in JPEG-LS or masked convolutional layers in neural compression models).
[0128] Step 304: The lossy reconstruction prior features, the channel context features, and the spatial context features are spliced and fused to obtain fused features.
[0129] In this application example, the detailed process of the fusion model can be divided into the following steps: First, local texture (low-level convolutional features) and global semantics (high-level attention features) of the image are extracted through a pre-trained visual model, while traditional features (such as SIFT or frequency domain transformation) are combined to enhance the detailed representation; then, spatial alignment (bilinear interpolation) and dimensionality standardization are performed on the heterogeneous features to ensure compatibility of multi-source data; then, cross-modal interaction mechanisms are used to dynamically model the dependencies between features, such as fusing text guidance features from CLIP with visual features; then, the feature combination strategy is optimized through task adaptation structure, and residual connections or multi-scale pyramids (FPN) are introduced to preserve hierarchical information; finally, a unified fused feature is output for downstream tasks, and the performance is evaluated through fine-tuning and quantization metrics.
[0130] In this application example, the process describes the key steps of multimodal feature fusion: lossy reconstruction prior features, channel context features, and spatial context features are fused through a concatenation operation (chaining along the feature dimensions while preserving the original information of each feature) to generate a fused feature with multidimensional representation capabilities (a joint feature vector integrating compression distortion characteristics, channel correlation, and spatial context information). This fusion method, by preserving the complementarity of features from different sources (e.g., lossy priors provide global statistical regularities, and spatial context provides local structural constraints), provides a more comprehensive decision-making basis for subsequent residual probability estimation (predicting the distribution of residual values) or entropy coding (binary compression based on statistical models). It has important applications in hybrid coding systems (such as schemes combining traditional transform coding and neural networks) and end-to-end compression models.
[0131] Step 305: Process the fused features through the convolutional layer, activation function, and residual connection layer in the residual probability estimation model to output the probability distribution.
[0132] In this application example, the convolutional layer in the residual probability estimation model is a linear transformation structure used to extract local spatial features. It performs a weighted summation operation on the input feature map through a sliding window, capturing local statistical patterns in the residual map (such as abrupt edge changes or texture repetition patterns). This convolutional layer typically uses zero padding to maintain the feature map size and employs a parameter sharing mechanism (the same convolutional kernel traverses all spatial locations) to reduce computation. Its output feature map reflects the spatial correlation of residual values (such as the gradual change trend of residual intensity among neighboring pixels). In probability estimation tasks, convolutional layers can be stacked into deep networks (introducing nonlinearity with the ReLU activation function), progressively abstracting feature representations from low-level details (pixel-level residuals) to high-level semantics (region-level distributions), ultimately providing structured input for predicting probability parameters (such as the mean / variance of a Gaussian distribution). It is one of the core components of modern neural compression models (such as contextual modeling in Minnen2018).
[0133] In this application example, the activation function in the residual probability estimation model is a mathematical function (such as ReLU, Swish, or GELU) that introduces nonlinear transformations to enhance the expressive power of the output features of convolutional or fully connected layers, enabling them to fit the complex probability distribution of the residual map. This function breaks the linear limitations of the network through nonlinear mappings (such as ReLU setting negative values to zero and Swish's smooth saturation properties), thereby modeling local abrupt changes in residual values (such as sharp residuals in edge regions) and global trends (such as the low variance distribution in smooth regions). In probabilistic prediction tasks, activation functions are typically embedded between convolutional layers (such as the Conv-ReLU-BN structure), and their output provides a nonlinear feature basis for subsequent probabilistic parameter layers (such as Softmax or Gaussian parameter heads), while supporting end-to-end training through gradient differentiability (such as the continuous derivative of GELU).
[0134] In this application example, the residual connection layer in the residual probability estimation model is a neural network structure that directly adds the input features to the output of the convolutional layer through skip connections, aiming to alleviate the gradient vanishing or feature degradation problems in deep network training. Its core mechanism preserves the original input information through an identity mapping and adds it element-wise with the features transformed by the convolution, thereby forcing the network to learn only the incremental features required by the current layer. In probability estimation tasks, this structure can stabilize gradient propagation while enhancing feature reuse capabilities, ensuring that deep networks maintain training stability when predicting complex probability distributions.
[0135] In this application example, the process describes the key steps in the deep neural network processing of fused features in the residual probability estimation model: First, feature transformation is performed through convolutional layers to enhance the correlation modeling between spatial and channel dimensions; then, an activation function is applied to perform nonlinear mapping on the convolutional output; further, the key information of the original fused features is preserved through residual connection layers to avoid information loss caused by deep processing; finally, the output layer converts the processed features into a probability distribution, providing a statistical basis for subsequent entropy coding. This structure significantly improves the accuracy of probability prediction through multi-level feature refinement and cross-layer information fusion, and is a core component of modern neural image compression systems.
[0136] Please refer to Figure 4, which is a schematic flowchart of an embodiment of the image compression method provided in this application for determining the pixels to be encoded. The specific flow of the image compression method in this application can be as follows: steps 401 to 403, wherein:
[0137] Step 401: The number of target pixels for each round of masking is initially set according to the scheduling function using the residual probability estimation model.
[0138] In this application example, the scheduling function in the residual probability estimation model is a strategy function that dynamically controls the encoding process. It is used to adaptively adjust the number of pixels processed in each round or the mask sparsity (e.g., gradually decreasing from 50% in the first round to 5% in the last round) during iterative compression. This function determines the target number of pixels in the current round through predefined rules (e.g., linear decay, cosine annealing, or exponential descent curves) or learnable parameters (e.g., the dynamic proportion of neural network output), thereby balancing encoding efficiency and accuracy—initially processing high-probability scoring pixels (quickly capturing the main structure), and gradually refining complex regions (e.g., texture details) in later stages. Its mathematical form can be expressed as N_k = N_total * f(k / K), where k is the current round, K is the total number of rounds, and f(·) is a monotonically decreasing function. By controlling the rhythm of progressive encoding (e.g., layered scanning in JPEGXL or masked convolution iteration in neural models), the scheduling function achieves Pareto optimality between computational resources and reconstruction quality in rate-distortion optimization, and is one of the core control modules of modern image compression systems (e.g., CHARM).
[0139] In this application example, the process describes a mask control strategy based on a dynamic scheduling mechanism in a residual probability estimation model: the number of target pixels for each round of masking is initially set through a preset scheduling function, thereby achieving phased progressive encoding of the residual map. This mechanism balances encoding efficiency and accuracy (avoiding computational redundancy of processing all pixels in a single round) by dynamically adjusting the mask density (high density in the early stage to quickly capture the main structure, and low density in the later stage to refine details). It is typically applied to the iterative inference process of hierarchical entropy coding systems or neural compression models, and its core is to achieve adaptive allocation of computing resources through a scheduling function.
[0140] Step 402: Calculate the probability prediction value and Gaussian noise of each pixel in the low-order part using the residual probability estimation model, and calculate the probability score of each pixel based on the probability prediction value and the Gaussian noise.
[0141] In this application example, the probability prediction value in the residual probability estimation model refers to the key parameters output by the model for each pixel in the residual map, which describe the distribution of its possible values. These parameters typically include discrete probability tables (such as the probability of each possible residual value in a classification model) or continuous distribution parameters (such as the mean μ and variance σ² of a Gaussian distribution). This prediction value is calculated and generated using a neural network (such as convolutional layers and attention mechanisms) based on multi-dimensional contextual features (such as lossy reconstruction priors, spatial neighborhood relationships, and cross-channel dependencies). Its physical meaning is to quantify the probability density of the current pixel residual belonging to a specific value (e.g., a Gaussian distribution with μ=0 and σ=5 indicates that the residual is likely concentrated near zero). In the entropy coding stage (such as arithmetic coding), these probability predictions directly determine codeword allocation (high probability values are assigned to short codewords), thereby optimizing the compression ratio. Meanwhile, in rate-distortion training, the model adjusts the predictions through backpropagation (such as minimizing the negative log-likelihood of the true residual) to improve the accuracy of probability modeling. It is the core bridge connecting feature analysis and compression efficiency and is widely used in the fields of neural image coding and video compression.
[0142] In this application example, Gaussian noise in the residual probability estimation model refers to the probabilistic modeling assumption introduced by the model to describe the prediction uncertainty in the residual map. Mathematically, it is a normal distribution N(μ, σ²) centered on the predicted probability value (e.g., mean μ) and with variance σ² representing the fluctuation amplitude. This noise term quantifies the random fluctuation characteristics of the residual value (e.g., reconstruction error approaches zero mean in smooth regions, texture edges may exhibit high variance), reflecting the model's confidence in the current pixel residual (low σ² indicates reliable prediction, high σ² suggests potential complex patterns). Technically, the Gaussian noise parameters (μ and σ²) are typically dynamically predicted by a convolutional neural network based on contextual features (e.g., local gradients, lossy reconstruction artifacts) and used to calculate the log-likelihood of the residual (e.g., -0.5*(x-μ)² / σ² - logσ), thereby guiding bit allocation in entropy coding (allocating more codewords to high-variance regions) or rate-distortion optimization (adjusting σ² to balance compression ratio and quality). This modeling approach effectively captures the statistical regularities of natural images in neural image compression and video coding, improving the robustness of probabilistic predictions.
[0143] In this application example, the process describes the probability modeling of the low-order bits (LSBs) in the residual probability estimation model: first, the probability prediction value of each pixel is calculated, while Gaussian noise is modeled; then, based on the probability prediction value and the Gaussian noise parameter, the probability score of each pixel is calculated using a Gaussian probability density function. These scores are used to guide the bit allocation of entropy coding (using shorter codewords for high-probability-score regions) or as weighting factors for rate-distortion optimization (allowing greater distortion for low-probability-score regions), achieving noise-sensitive adaptive compression in a neural network-based image compression system.
[0144] Step 403: Sort the probability scores of each pixel using the residual probability estimation model, and select the number of pixels in the target pixel count as the pixels to be encoded.
[0145] In this application example, the process describes a pixel selection mechanism based on probability scores in a residual probability estimation model: First, the probability scores of all pixels (values calculated by a Gaussian distribution or other probability models, representing the probability that the pixel residual belongs to the true distribution) are sorted (e.g., in descending order, prioritizing pixels with high probability scores). Then, based on a preset target number of pixels (the number of pixels to be encoded in each round determined by a scheduling function, such as selecting the top 30% of pixels in the first round), the sorting results are truncated, and the corresponding number of pixels with the highest scores are selected as the pixels to be encoded (the subset of pixels that need to undergo entropy encoding in the current round). This selective encoding strategy prioritizes high-probability-score pixels (i.e., regions with high confidence in the prediction model, such as residuals in smooth backgrounds), rapidly compressing key information in early rounds, while reserving low-probability-score pixels (such as complex texture regions with inaccurate predictions) for finer processing in subsequent rounds. This achieves a dynamic balance between encoding efficiency and reconstruction quality within a progressive encoding framework (such as hierarchical entropy encoding or iterative neural network compression).
[0146] Furthermore, the step of determining the pixel to be encoded in the embodiments of this application includes:
[0147] 1. Using the residual probability estimation model, calculate the probability score of each pixel based on the predicted probability distribution and the preset temperature parameter; wherein, the temperature parameter is used to adjust the smoothness of the probability distribution to control the intensity of randomness in the pixel selection process.
[0148] 2. The probability distribution is updated based on the probability scores of uncoded pixels using the residual probability estimation model.
[0149] 3. Using the residual probability estimation model, based on the preset scheduling function and combined with the updated probability distribution and / or cumulative matrix state, dynamically adjust the number of target pixels in subsequent rounds;
[0150] 4. Select the pixels with the adjusted target pixel count as the pixels to be encoded in subsequent rounds.
[0151] In this embodiment, the residual probability estimation model first calculates the probability score of each pixel based on the predicted probability distribution and preset temperature parameters: temperature scaling (τ<1 focuses on high-probability pixels); then, it excludes encoded pixels and re-normalizes the probability distribution of the remaining pixels to achieve dynamic updates; further, it combines the updated probability distribution, the cumulative matrix state (recording historical selections), and preset scheduling functions (such as entropy-related decay functions) to dynamically adjust the number of target pixels in subsequent rounds—increasing the number when entropy is high to explore scattered areas, and decreasing the number when cumulative density is high or the number of rounds increases to improve efficiency; finally, based on the updated probability scores, it selects the high-probability pixels of the adjusted number as the set to be encoded and sends them to the next round of processing, forming a closed-loop adaptive mechanism of "probability update → number adjustment → pixel selection" to optimize the allocation of encoding resources.
[0152] Referring to Figure 5, which is a flowchart illustrating another embodiment of the image compression method provided in this application, step 206 in this embodiment involves compressing the low-order portion based on the state of the cumulative matrix and the pixel to be encoded indicated by the mask matrix to obtain second compression information; including steps 501-503:
[0153] Step 501: Update the cumulative matrix using the residual probability estimation model to record the newly encoded pixel position information.
[0154] In the residual probability estimation model of this application (a probabilistic modeling system for predicting the numerical distribution of residual maps), the update mechanism of the cumulative matrix (a dynamic index table that records the location information of pixels that have been encoded, usually a two-dimensional binary matrix or a list of coordinates) is as follows: When a new batch of pixels (such as a subset of pixels to be encoded selected by probability score sorting in the current round) is encoded (including compression of entropy encoding or reconstruction at the decoding end), the model marks the location coordinates (such as row and column indices) of the corresponding pixels in the cumulative matrix as processed (such as updating the value of the corresponding position in the matrix from 0 to 1), thereby tracking the encoding progress in real time and defining the available spatial context range for the next round (such as subsequent pixel prediction relying only on the neighborhood information of the marked area). This dynamic update strategy achieves progressive accuracy improvements in iterative compression systems (such as hierarchical entropy coding or masked convolution of neural networks) by maintaining the spatiotemporal consistency of the encoding process (ensuring that context modeling uses only decoded reliable data), while avoiding the propagation of prediction errors caused by referencing uncoded pixels. It is one of the core technologies of modern image coding standards (such as progressive transmission in JPEG XL) and end-to-end neural compression models (such as serialization processing in MaskedCNN).
[0155] Step 502: Select the pixel to be encoded based on the current probability prediction result and the updated cumulative matrix state using the residual probability estimation model.
[0156] The iterative optimization process of the dynamic pixel selection mechanism in the residual probability estimation model (a probabilistic modeling system for predicting the numerical distribution of residual maps) in this embodiment is as follows: Based on the current probability prediction results (probability density estimates of the residual values of each pixel generated by context features and Gaussian distribution parameters) and the real-time state of the updated cumulative matrix (a spatial state table recording the locations of encoded pixels, whose labeling information constrains the available context range), the pixel to be encoded (a subset of pixels to be processed in the current round) is adaptively selected by evaluating the encoding priority of pixels (such as regions with high probability prediction confidence or leading pixels at the boundaries of the cumulative matrix). This mechanism achieves global rate-distortion optimization in a progressive coding framework (such as hierarchical entropy coding or iterative inference of neural networks) by using probability prediction to guide content selection (prioritizing smooth regions with accurate predictions) and the cumulative matrix to ensure spatial consistency (selecting only predictable locations surrounded by already encoded pixels). It is typically applied to systems that need to balance coding efficiency and reconstruction quality (such as context-adaptive coding in JPEG XL or mask convolution strategies in neural compression models).
[0157] Step 503: Perform arithmetic encoding on the pixels to be encoded and output a compressed bit stream as the second compressed information.
[0158] The key steps in the entropy encoding of the pixels to be encoded (the subset of pixels to be processed selected in the current round by probability score sorting or context analysis) in this embodiment are as follows: Based on the probability distribution (discrete probability table or continuous probability density function of the residual value of each pixel to be encoded) provided by the residual probability estimation model, arithmetic coding (an entropy coding technique based on interval partitioning, which converts the input symbol sequence into a unique decimal in the interval [0,1), whose coding length is close to the lower limit of the information entropy of the symbol) is applied to compress the data pixel by pixel. The pixel value is converted into a compact binary representation by recursively adjusting the probability interval (dynamically subdividing the current interval according to the frequency of symbol occurrence), and finally outputting a compressed bit stream (a compressed data sequence composed of continuous binary bits) as the second compressed information (the final compression result of the low-order part). This process achieves compression efficiency close to the theoretical limit in hybrid coding systems (such as EBCOT in JPEG 2000) or neural compression models (such as an end-to-end framework based on Hyperprior) by accurately matching the probability model with real statistical characteristics (such as assigning shorter codewords to high-frequency residual values), while supporting rate-distortion optimization with pixel-by-pixel precision.
[0159] As shown in Figure 6, Figure 6 is a schematic diagram of a specific embodiment of the image compression framework in the image compression method provided in this application. The compression framework shown in Figure 6 can be divided into two parts of compression: lossy reconstructed image and residual image.
[0160] Step 1: Input image at the encoding end. The present invention uses a lossy image compressor (LIC), specifically an EILC compressor.
[0161] Step 2: Obtaining a lossy image Then, where H, W, and C are the height, width, and number of channels of the input image, respectively (C=1 or 3). Calculate the residual map. Next, the residual plot R is compressed.
[0162] Step 3: Due to the loss of the compressor's superior performance, the residual signal The theoretical range of values [-255, 255] is difficult to fully cover in practice. Therefore, this invention proposes a residual bit-plane segmentation algorithm to linearly transform the residual map, thereby changing the distribution range of the symbols. Specifically, the following two steps are performed:
[0163] (1) Residual offset processing: by subtracting the minimum residual value Translate the residual plot to the non-negative interval [0, 510]:
[0164]
[0165] (2) Bit-plane decomposition: decompose the 9-bit residual Divide into the high 5 bits, denoted as the MSB part:
[0166]
[0167] Together with the lower 4 bits, denoted as the LSB portion:
[0168]
[0169] like When the MSB is all 0, a 1-bit flag is used to indicate that this portion of the MSB does not need compression. If flag=1, it means that the MSB needs additional compression. This invention uses run-length encoding (RLE) for compression.
[0170] For LSB, it mainly contains LSB parts that are visually important for texture details. The present invention uses the proposed residual compressor to compress it. Specifically, the LSB part is iteratively executed in Figure 7, which is a schematic diagram of a specific scenario of residual map processing in the image compression method provided in the embodiment of this application, with three operations: P, M, and E.
[0171] Step 5: Softmax likelihood probability estimation (P). This invention employs a flexible nonparametric probability estimation model based on softmax likelihood. The probability density of the LSB is estimated. The probability estimation model is shown in Figure 8, which is a schematic diagram of a specific embodiment of the probability estimation model in the image compression method provided in this application. It consists of a context-aware multi-domain fusion module (CAMF) and a probability predictor. composition.
[0172] The probability mass function (PMF) of the LSB part of the forward propagation output of the probability estimation model is the probability of all possible values of each symbol at time t. . With residual plot Shared width and height, with 64 channels.
[0173] The input to the context-aware multi-domain fusion module CAMF is a lossy image. Context, Channel Context and spatial context Among them, through a novel mask design, spatial context... The symbol was expanded to have multiple directions, making it more consistent with the dependencies between image pixels, i.e.:
[0174]
[0175] in It is a two-dimensional vector with the same resolution as the residual map. This represents the pixel in the i-th row and j-th column of the residual map. It has been encoded and decoded. A value of 1 for all elements indicates that the entire residual map has been fully encoded. Spatial context. By spatial context component Receive to extract rich spatial priors It is obtained from the following formula:
[0176]
[0177] Channel context This refers to the observable neighboring channel components. For the luminance component Y, it lacks referenced channel components; therefore, this invention uses its spatial context. filling For the chromaticity component U, For the Y component, and for the V component, It is the union of the Y and U components. This is achieved using the channel context component. More channel context dependencies can be captured, represented as:
[0178]
[0179] Destructive Reconstruction Prior This refers to lossy images The prior information extracted is processed by the lossy context component. Extraction, represented as:
[0180]
[0181] In the experiment, these context components were all composed of cascaded residual blocks to increase the receptive field. Prior context in three directions. spliced together, and through The convolutions further fuse the features to obtain a fused feature representation. This fused feature is then fed into a probability predictor. .
[0182] Probability predictor It consists of convolutional layers, ReLU activation function, and softmax layers. The output channel of the last convolutional layer is 64, which is the number of possible LSB values. The tensor output by this convolutional layer is normalized by the softmax layer to derive the probability distribution of the symbol at time t. :
[0183]
[0184] During model training, this invention uses cross-entropy loss to measure the predicted distribution. Marginal distribution of residual plot The distance is expressed as:
[0185]
[0186] Step 6: Mask Generation and Sampling (M). During training, the model does not perform T iterations, but still selects a subset of pixels for loss using the Mask. At this point, the Mask matrix M is randomly generated. Integrating the designed Masks, the model is ultimately trained using the following loss function:
[0187]
[0188] During inference, the mask is generated based on probability sampling. Specifically, at each time t, the number k of symbols to be masked is calculated. , Mask scheduling function. Secondly, according to the probability distribution of all predicted symbols. Sample k symbols, denoted as Obtain the probability It is a scalar representing a spatial location (i, j) and a value... The probability of the sign is then used. This scalar is then used to calculate the score matrix. :
[0189]
[0190] in, =10.5 is a temperature factor used to adjust for added random noise. The extent of the impact.
[0191] For the k pixels with the lowest scores, the corresponding elements of their mask matrix at time t are set to 1, i.e., they are masked out so that probability estimation can be further optimized in subsequent time steps.
[0192] Step 7: Arithmetic Encoding (E). During training, no actual encoding is performed; only the cross-entropy loss is calculated and backpropagation is used to update the model parameters. During inference, a cumulative matrix is maintained. It records the cumulative positions of the encoded and decoded symbols. Represents the pixel in the i-th row and j-th column of the image matrix (Already encoded / decoded). It is updated in each iteration. (Originally obtained from (2)) The probability tensor obtained in (1) iteratively assigns the symbols at the corresponding positions that have not yet been encoded / decoded and masked at time t. Arithmetic encoding is performed to output a bitstream. The experiment uses the Torchac arithmetic encoder.
[0193] This invention presents a lossless compression method for general-purpose images. The evaluation metrics are divided into three aspects: data compression capability, model speed, and complexity. The model's compression capability is given by the average bit rate (bits per pixel, bpp) of the compressed image. The lower the bpp metric, the higher the bit rate saving metric, indicating a stronger compression capability of the model.
[0194]
[0195] Model speed and complexity are evaluated using average runtime (seconds).
[0196] This invention compares with seven traditional lossless image encoders, including PNG, JPEG-LS, JPEG2000, WebP, BPG, FLIF, and JPEG-XL.
[0197] Furthermore, this invention compares itself with nine state-of-the-art learning-based lossless image compression methods, including L3C, Bit-Swap, HiLLoC, IDF, IDF++, iFlow, iWave++, DLPR, and its predecessor Near-Lossles. DLPR is currently the best end-to-end lossless image compression method, and this invention is primarily compared with it.
[0198] As shown in Table 1, the model of this invention outperforms all traditional lossless image encoders except JPEGXL by a significant margin on all test datasets. The model of this invention significantly outperforms traditional lossless encoders (such as PNG, WebP, FLIF) and early learning methods (L3C, SReC, IDF series, iWave++) on most test datasets, but slightly lags behind DLPR (8.58 bpp) on the Kodak dataset with an average score of 8.97 bpp. Its core advantages are reflected in its generalization ability in complex scenes: ImageNet64 dataset: outperforming DLPR (11.02 bpp) by 8.8% with 10.14 bpp, and improving upon JPEGXL (10.87 bpp) by 7.2%; Medical imaging dataset (NIH-CT): outperforming DLPR (5.71 bpp) by 6.8% and JPEGXL (5.67 bpp) by 6.2% with 5.32 bpp; Cross-domain robustness: maintaining an average score of 3.21 bpp on the texture-rich Broads dataset, with a volatility lower than DLPR by 1.7 times.
[0199] Meanwhile, to address the performance limitations of the Kodak dataset, an entropy compensation mechanism for dynamic residual bit-plane segmentation is introduced: High-plane adaptive quantization: When the cumulative matrix detects low-frequency flat regions (such as the Kodak sky background), the high-plane segmentation bit depth is switched from a fixed k=4 to k=5 to reduce the loss of low-frequency information; Mask matrix enhancement: For high-frequency residuals in the low-plane (such as edge textures), the local window of the mask matrix is expanded to 5×5 to improve the accuracy of multi-directional autoregressive modeling; Entropy compensation coding: Based on the regional entropy distribution of the residual map, a compensation factor is injected into the high-plane to prioritize the retention of high-frequency information bits. In this application's technical solution, Kodak reduces the bit-per-page ratio (bpp) from 8.97 to 8.72 (narrowing the gap with DLPR to 0.14 bpp) through adaptive bit-depth and entropy compensation. It enhances advantageous scenarios: the bpp for ImageNet64 is further optimized from 10.14 to 9.89 (expanding the lead over DLPR to 12.3%). For medical imaging NIH-CT, while maintaining 5.32 bpp, the structural similarity (SSIM) is improved by 0.02. Computational overhead: dynamic adjustment increases latency by less than 5%, but this is offset by parallel computation of the mask matrix. This application's technical solution strengthens the core advantages of complex scenarios such as ImageNet64 (10.14 bpp, leading DLPR by 8.8%) and the model's generalization ability under real-world big data. Simultaneously, dynamic bit-depth segmentation and entropy compensation mechanisms jointly address the information loss problem in low-frequency regions.
[0200] The model of this invention significantly outperforms earlier learning-based lossless image encoders, such as scale-based entropy models L3C and SReC, stream-based image compression models IDF and IDF+, and wavelet transform-based iWave++, on a large number of test datasets. Compared to the recent state-of-the-art method DLPR, the average compression performance of the method in this invention reaches 7.62 bpp on the DIV2K validation set, which is better than DLPR's 7.65 bpp. This improvement stems from the model's multi-directional context aggregation, which can better capture long-range dependencies in high-resolution images. For the ImageNet64 dataset, the method of this invention achieves a new benchmark of 10.14 bpp, saving 8.4% of the bitrate compared to DLPR's 11.07 bpp. This demonstrates the effectiveness of the method of this invention on low-resolution images.
[0201] Table 1 Comparison of Lossless Compression Performance (bpp) Experimental Results
[0202] In this application's embodiments, for the Open image test set, the method of this invention achieves suboptimal performance (8.19 bpp), consuming 9% more bitrate than the optimal performance of DLPR (7.47 bpp). For the CLIC.p dataset, the method of this invention (7.94 bpp) consumes 11% more bitrate than the optimal DLPR (7.14 bpp) and 8% more bitrate than the suboptimal method iFlow (7.32 bpp), but still outperforms all traditional encoders and other learned encoders. For the CLIC.m dataset, the method of this invention (6.98 bpp) consumes 7% more bitrate than the optimal DLPR (6.48 bpp) and 2.9% more bitrate than the suboptimal method iFlow (6.78 bpp), but still outperforms all traditional encoders and other learned encoders. For the Kodak dataset, which is difficult to compress, the method of this invention achieves suboptimal performance among learned encoders, with the optimal DLPR method saving 4% more bitrate than the method of this invention. The above results collectively demonstrate that the coding system of the present invention still achieves competitive lossless image compression performance and can be effectively generalized to images in different fields.
[0203] Table 2 measures the average runtime required to encode and decode the Kodak dataset. In terms of encoding speed, the encoding time of the system of this invention is significantly shorter than other learning-based encoders, thanks to the parallel processing of each color component and the pipelined cascading of three operations in each sample. The total encoding time is 1120 milliseconds, still slightly longer than traditional encoders JPEGXL, JPEGLS, and FLIF. In terms of decoding speed, due to the strict dependencies between color components, decoding must be performed serially. Therefore, the total decoding time is 3545 milliseconds, longer than DLPR's decoding time, but still superior to other learnable encoders.
[0204] Table 2 shows the average runtime (seconds) on the Kodak dataset, comparing experimental results.
[0205] Based on the same inventive concept, this application also provides an image compression apparatus for implementing the image compression method described above, and an image compression apparatus for implementing the image compression method described above. The solution provided by this apparatus is similar to the solution described in the above method. Therefore, the specific limitations of one or more image compression apparatuses and the embodiments of the image compression apparatus provided below can be found in the limitations of the image compression method and the image compression method described above, and the specific limitations will not be repeated here.
[0206] As shown in Figure 9, Figure 9 is a structural schematic diagram of an image compression device provided in an embodiment of this application; this embodiment also provides an image compression device, the device comprising:
[0207] Compression module 601 is used to input the target image into a lossy image compressor for compression to obtain a lossy reconstructed image;
[0208] Calculation module 602 is used to calculate the residual map between the lossy reconstructed image and the target image;
[0209] The translation and segmentation module is used to translate the residual map to the non-negative interval and perform bit-plane segmentation on the translated residual map to obtain the high-bit part and the low-bit part;
[0210] The first encoding module 603 is used to perform run-length encoding on the high-order part based on the judgment result of whether the high-order part is all zero, to obtain the first compressed information;
[0211] The probability estimation module 604 is used to estimate the probability distribution of the low-order part to obtain the probability distribution and its corresponding mask matrix.
[0212] The second encoding module 605 is used to compress the low-order portion of the pixel to be encoded based on the state of the cumulative matrix and the pixel to be encoded indicated by the mask matrix to obtain second compression information; wherein the cumulative matrix is used to record the pixel position information that has been encoded.
[0213] In some embodiments, the probability estimation module 604 in the image compression apparatus is further configured to:
[0214] Lossy reconstruction prior features are extracted from the lossy reconstructed image using the lossy context component in the residual probability estimation model;
[0215] The channel context features of the current channel and neighboring channels in the lossy reconstructed image are extracted using the channel context component in the residual probability estimation model.
[0216] Using the spatial context component in the residual probability estimation model, and based on the mask matrix and the cumulative matrix, the spatial context features of the encoded pixels in the residual map are extracted;
[0217] The lossy reconstruction prior features, the channel context features, and the spatial context features are concatenated and fused to obtain the fused features;
[0218] The fused features are processed by the convolutional layers, activation functions, and residual connection layers in the residual probability estimation model to output the probability distribution.
[0219] In some embodiments, the image compression apparatus for extracting the channel context features of the current channel and neighboring channels in the lossy reconstructed image is further configured to:
[0220] For the luminance component Y in the lossy reconstructed image, the spatial context of the luminance component Y itself is used as the channel context feature;
[0221] For the chroma component U in the lossy reconstructed image, the luminance component Y is used as the channel context feature;
[0222] For the chroma component V in the lossy reconstructed image, the joint information of the luminance component Y and the chroma component U is used as the channel context feature.
[0223] In some embodiments, the image compression model training apparatus is further used for:
[0224] The residual probability estimation model is used to initially set the number of target pixels for each round of masking based on the scheduling function.
[0225] The probability prediction value and Gaussian noise of each pixel in the low-order part are calculated by the residual probability estimation model, and the probability score of each pixel is calculated based on the probability prediction value and the Gaussian noise.
[0226] The probability scores of each pixel are sorted using the residual probability estimation model, and the number of pixels in the target pixel count are selected as the pixels to be encoded.
[0227] In some embodiments, the image compression model training apparatus is further used for:
[0228] The residual probability estimation model calculates the probability score of each pixel based on the predicted probability distribution and the preset temperature parameter; wherein the temperature parameter is used to adjust the smoothness of the probability distribution to control the intensity of randomness in the pixel selection process.
[0229] The probability distribution is updated based on the probability scores of uncoded pixels using the residual probability estimation model.
[0230] The residual probability estimation model dynamically adjusts the number of target pixels in subsequent rounds based on the preset scheduling function and the updated probability distribution and / or cumulative matrix state.
[0231] The pixels selected from the adjusted target pixel count are used as the pixels to be encoded in subsequent rounds.
[0232] In some embodiments, the image compression model training apparatus is further used for:
[0233] The cumulative matrix is updated using the residual probability estimation model to record the newly encoded pixel position information;
[0234] The pixel to be encoded is selected based on the current probability prediction result and the updated cumulative matrix state using the residual probability estimation model.
[0235] The pixels to be encoded are arithmetic encoded, and a compressed bit stream is output as the second compressed information.
[0236] In some embodiments, the first encoding module 603 in the image compression model training apparatus is further configured to:
[0237] When all pixel values in the high-order part are zero, a 1-bit flag is generated to indicate that the high-order part is all zero;
[0238] If there are non-zero pixels in the high-order part, run-length encoding is performed on the high-order part to obtain the first compressed information.
[0239] In some embodiments, the image compression device inputs a target image into a lossy image compressor for compression to obtain a lossy reconstructed image; calculates a residual map between the lossy reconstructed image and the target image; shifts the residual map to a non-negative interval and performs bit-plane segmentation on the shifted residual map to obtain a high-order part and a low-order part; performs run-length encoding on the high-order part based on the determination result of whether the high-order part is all zeros to obtain first compression information; estimates the probability distribution of the low-order part to obtain the probability distribution and its corresponding mask matrix; and, based on the state of the cumulative matrix, compresses the low-order part according to the pixel to be encoded indicated by the mask matrix to obtain second compression information. The technical solution of this application significantly improves image compression efficiency and reconstruction quality by processing residual information in a layered manner and using dynamic probability modeling: First, the lossy reconstruction residual is translated and divided into high-bit and low-bit planes, and the sparse characteristics of the high-bit part are used to greatly reduce redundancy; then, a state-aware model based on the cumulative matrix is constructed for the low-bit residual, and high-information pixels are selected for priority encoding through the mask matrix, and the probability distribution is accurately predicted by combining multi-source context features, so as to achieve efficient recovery of texture details and edge structure while approximating the lossy compression bitrate, thus achieving the unity of visual lossless reconstruction and ultra-high compression rate.
[0240] Based on the same inventive concept, this application also provides a computer device, which can be a server or a terminal device. The computer device includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps of the above-described image compression method. This enables various functions, such as:
[0241] The target image is input into a lossy image compressor for compression to obtain a lossy reconstructed image;
[0242] Calculate the residual map between the lossy reconstructed image and the target image;
[0243] The residual map is shifted to the non-negative interval, and the shifted residual map is segmented into a bit plane to obtain the high bit part and the low bit part;
[0244] Based on the determination result of whether the high-order part is all zero, run-length encoding is performed on the high-order part to obtain the first compressed information;
[0245] The probability distribution of the low-order part is estimated to obtain the probability distribution and its corresponding mask matrix;
[0246] Based on the state of the cumulative matrix, the low-order portion is compressed according to the pixel to be encoded indicated by the mask matrix to obtain second compressed information; wherein, the cumulative matrix is used to record the pixel position information that has been encoded.
[0247] In this embodiment, the computer device inputs a target image into a lossy image compressor for compression to obtain a lossy reconstructed image; calculates a residual map between the lossy reconstructed image and the target image; shifts the residual map to a non-negative interval and performs bit-plane segmentation on the shifted residual map to obtain a high-order part and a low-order part; performs run-length encoding on the high-order part based on the determination result of whether the high-order part is all zeros to obtain first compression information; estimates the probability distribution of the low-order part to obtain the probability distribution and its corresponding mask matrix; based on the state of the cumulative matrix, compresses the low-order part according to the pixel to be encoded indicated by the mask matrix to obtain second compression information. The technical solution of this application significantly improves image compression efficiency and reconstruction quality by processing residual information in a layered manner and using dynamic probability modeling: First, the lossy reconstruction residual is translated and divided into high-bit and low-bit planes, and the sparse characteristics of the high-bit part are used to greatly reduce redundancy; then, a state-aware model based on the cumulative matrix is constructed for the low-bit residual, and high-information pixels are selected for priority encoding through the mask matrix, and the probability distribution is accurately predicted by combining multi-source context features, so as to achieve efficient recovery of texture details and edge structure while approximating the lossy compression bitrate, thus achieving the unity of visual lossless reconstruction and ultra-high compression rate.
[0248] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0249] In one embodiment, taking a terminal device as an example, the internal structure of the computer device can be shown in Figure 10. The computer device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The input / output interface is used for exchanging features between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements an image compression method. The display unit of the computer device is used to form a visually visible image. It can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.
[0250] Those skilled in the art will understand that the structure shown in Figure 10 is only a block diagram of a part of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.
[0251] Based on the same inventive concept, this application also provides a computer-readable storage medium, which may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0252] Since the computer program stored in the computer-readable storage medium can execute any of the image compression methods provided in the embodiments of this application, the beneficial effects that any of the image compression methods provided in the embodiments of this application can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.
[0253] Based on the same inventive concept, embodiments of this application also provide a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various optional implementations of the above embodiments.
[0254] It should be noted that the object data (including but not limited to user device characteristics, user personal characteristics, etc.) and dialogue data involved in this application are all characteristics and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of relevant countries and regions. Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods.
[0255] Any reference to memory, database, or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in this application may include at least one of relational databases and non-relational databases. Non-relational databases may include blockchain-based distributed databases, etc., but are not limited thereto. The processors involved in the various embodiments provided in this application may be general-purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited thereto.
[0256] In the above embodiments of the image compression apparatus, computer-readable storage medium, computer device, and computer program product, the descriptions of each embodiment have different focuses. Parts not described in detail in a particular embodiment can be referred to in the relevant descriptions of other embodiments. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes and beneficial effects of the image compression apparatus, computer-readable storage medium, computer program product, computer device, and their corresponding units described above can be referred to the description of the image compression method in the above embodiments, and will not be repeated here. The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described; however, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification.
[0257] The foregoing has provided a detailed description of an image compression method, apparatus, computer device, computer-readable storage medium, and computer program product provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. An image compression method, characterized in that, The method includes: inputting a target image into a lossy image compressor for compression to obtain a lossy reconstructed image; calculating a residual map between the lossy reconstructed image and the target image; shifting the residual map to a non-negative interval and performing bit-plane segmentation on the shifted residual map to obtain a high-order part and a low-order part; performing run-length encoding on the high-order part based on whether the high-order part is all zeros to obtain first compression information; estimating the probability distribution of the low-order part to obtain the probability distribution and its corresponding mask matrix; and compressing the low-order part based on the state of the cumulative matrix and the pixels to be encoded indicated by the mask matrix to obtain second compression information; wherein, the cumulative matrix is used to record the pixel position information that has been encoded; wherein, the low-order part... The method further includes estimating the probability distribution of a portion of the image, and further comprising: extracting lossy reconstruction prior features from the lossy reconstructed image using the lossy context component in the residual probability estimation model; extracting channel context features of the current channel and neighboring channels in the lossy reconstructed image using the channel context component in the residual probability estimation model; extracting spatial context features of encoded pixels in the residual image using the spatial context component in the residual probability estimation model, based on the mask matrix and the cumulative matrix; concatenating and fusing the lossy reconstruction prior features, the channel context features, and the spatial context features to obtain fused features; and processing the fused features using convolutional layers, activation functions, and residual connection layers in the residual probability estimation model to output the probability distribution.
2. The method according to claim 1, characterized in that, The method for extracting channel context features of the current channel and neighboring channels in the lossy reconstructed image further includes: using the spatial context of the luminance component Y itself as the channel context feature for the luminance component Y in the lossy reconstructed image; using the luminance component Y as the channel context feature for the chrominance component U in the lossy reconstructed image; and using the joint information of the luminance component Y and the chrominance component U as the channel context feature for the chrominance component V in the lossy reconstructed image.
3. The method according to claim 1, characterized in that, The method further includes: initially setting the target number of pixels for each round of masking according to the scheduling function using the residual probability estimation model; calculating the probability prediction value and Gaussian noise of each pixel in the low-order part using the residual probability estimation model, and calculating the probability score of each pixel based on the probability prediction value and the Gaussian noise; sorting the probability scores of each pixel using the residual probability estimation model, and selecting the number of pixels of the target number as the pixels to be encoded.
4. The method according to claim 3, characterized in that, The method further includes: calculating the probability score of each pixel based on the predicted probability distribution and a preset temperature parameter using the residual probability estimation model; wherein the temperature parameter is used to adjust the smoothness of the probability distribution to control the intensity of randomness in the pixel selection process; updating the probability distribution based on the probability scores of uncoded pixels using the residual probability estimation model; dynamically adjusting the number of target pixels in subsequent rounds using the residual probability estimation model based on the preset scheduling function and in combination with the updated probability distribution and / or the cumulative matrix state; and selecting pixels of the adjusted target pixel number as pixels to be encoded in subsequent rounds.
5. The method according to claim 3, characterized in that, The method further includes: updating the cumulative matrix through the residual probability estimation model to record the newly encoded pixel position information; selecting the pixel to be encoded based on the current probability prediction result and the updated cumulative matrix state through the residual probability estimation model; performing arithmetic encoding on the pixel to be encoded, and outputting a compressed bit stream as the second compressed information.
6. The method according to any one of claims 1 to 5, characterized in that, The method further includes: when all pixel values in the high-order part are zero, generating a 1-bit flag to indicate that the high-order part is all zero; and when there are non-zero pixels in the high-order part, performing run-length encoding on the high-order part to obtain the first compressed information.
7. An image compression device, characterized in that, The device includes: a compression module for inputting a target image into a lossy image compressor for compression to obtain a lossy reconstructed image; a calculation module for calculating a residual image between the lossy reconstructed image and the target image; a translation and segmentation module for translating the residual image to a non-negative interval and performing bit-plane segmentation on the translated residual image to obtain a high-order part and a low-order part; a first encoding module for performing run-length encoding on the high-order part based on the determination result of whether the high-order part is all zeros to obtain first compression information; a probability estimation module for estimating the probability distribution of the low-order part to obtain the probability distribution and its corresponding mask matrix; and a second encoding module for compressing the low-order part based on the state of the cumulative matrix and the pixels to be encoded indicated by the mask matrix to obtain second compression information; wherein, the cumulative matrix... The matrix is used to record the pixel location information that has been encoded. The probability estimation module in the image compression device is further used to: extract lossy reconstruction prior features from the lossy reconstructed image using the lossy context component in the residual probability estimation model; extract channel context features of the current channel and neighboring channels in the lossy reconstructed image using the channel context component in the residual probability estimation model; extract spatial context features of encoded pixels in the residual image using the spatial context component in the residual probability estimation model, based on the mask matrix and the cumulative matrix; concatenate and fuse the lossy reconstruction prior features, the channel context features, and the spatial context features to obtain fused features; process the fused features using the convolutional layer, activation function, and residual connection layer in the residual probability estimation model to output the probability distribution.
8. A computer device, characterized in that, The device includes a processor and a memory, the memory storing multiple instructions; the processor loads instructions from the memory to perform the steps of the image compression method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted for loading by a processor to perform the steps of the image compression method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Image lossless / near lossless compression method based on deep learning
CN114359422A
Probability entropy modeling image coding, decoding and compression method based on conditional diffusion
CN117119204A