Image processing method and apparatus, device and storage medium
By combining pixel-based clustering results and a self-attention layer master coding network with an entropy probability model for image compression, the problem of high computational cost in image compression is solved, achieving efficient and low-cost image compression while preserving quality.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- CONTEMPORARY AMPEREX TECHNOLOGY CO LTD
- Filing Date
- 2025-09-17
- Publication Date
- 2026-07-30
AI Technical Summary
Existing technologies involve large computational demands for image compression, leading to increased costs and potentially affecting image quality during the compression process.
Feature extraction is performed based on pixel-based clustering results. The computational cost is reduced by using a main coding network and a self-attention layer. Encoding is then performed using an entropy probability model, achieving efficient image compression.
It reduces image compression costs, improves image compression efficiency and quality, ensures the accuracy of defect detection, and reduces image file size.
Smart Images

Figure CN2025121918_30072026_PF_FP_ABST
Abstract
Description
Image processing methods, apparatus, devices and storage media
[0001] Related applications
[0002] This application claims priority to Chinese patent application No. 202510111703.X, filed on January 23, 2025, the entire contents of which are incorporated herein by reference. Technical Field
[0003] This application relates to the field of image processing technology, and in particular to image processing methods, apparatus, devices and storage media. Background Technology
[0004] Currently, to comprehensively record quality control information during the production process, a large number of production images need to be stored. These images are not only configured for subsequent defect detection and analysis but also serve as an important component of quality control records, providing strong support for data analysis and quality traceability. However, with the expansion of production scale and the increase in processes, the number of images has increased dramatically, posing a significant challenge to image storage. Related technologies involve storing images after compression; however, the large computational load of image compression increases its cost. Summary of the Invention
[0005] In view of the above problems, this application provides an image processing method, apparatus, device and storage medium, which aims to alleviate the problem of high computational load in image compression, leading to increased image compression costs.
[0006] In a first aspect, this application provides an image processing method, comprising: acquiring a target image under a target process, and acquiring the clustering results of each pixel in the target image; extracting features from the target image based on the clustering results of each pixel to obtain a first latent space feature of the target image; and encoding the first latent space feature to obtain a compressed image of the target image.
[0007] In this embodiment, feature extraction is performed based on the clustering results of each pixel in the target image. Since clustering can group similar pixels into one category, similar pixels can be treated as a whole and processed together, which reduces the amount of computation in the feature extraction process and thus reduces the cost of image compression.
[0008] In one embodiment, the clustering results of each pixel and the target image are input into a main encoding network. The main encoding network includes a first image segmentation layer and multiple encoders connected in sequence. Each encoder includes a downsampling layer and a self-attention layer connected in sequence. The first image segmentation layer divides the target image into multiple image blocks. The downsampling layer in the encoder performs downsampling processing on each image block to obtain each downsampled image block. The self-attention layer in the encoder obtains the self-attention weight of each pixel in each downsampled image block based on the clustering results of the pixels in each downsampled image block and the image block itself. The first latent space feature of the target image is obtained based on the self-attention weight of each pixel in each downsampled image block.
[0009] In this embodiment, a main coding network is set up, which includes a first image segmentation layer and multiple encoders connected in sequence. Each encoder includes a downsampling layer and a self-attention layer connected in sequence. By using the cooperation of each layer and the clustering results, the computational load in the feature extraction process of the target image is reduced, thereby reducing the image compression cost.
[0010] In one embodiment, the downsampling layer in the encoder performs convolution operations on each pixel in each image block using a horizontal kernel and a vertical kernel respectively to obtain the horizontal gradient and vertical gradient of each pixel; the gradient magnitude of each pixel is determined based on the horizontal gradient and vertical gradient of each pixel; pixels with gradient magnitudes greater than a preset gradient magnitude are obtained; and each downsampled image block is obtained based on the pixels with gradient magnitudes greater than the preset gradient magnitude.
[0011] In this embodiment, Sobel filtering is used to preserve the edges in the image blocks. Even if the image is compressed and subsequently decompressed, defects in the image can be prevented from being erased, thereby improving the accuracy of image defect detection.
[0012] In one embodiment, a query vector of the first pixel in the downsampled image block is extracted, and key vectors of each second pixel in the category to which the first pixel belongs are extracted, wherein the second pixel is any pixel in the category to which the first pixel belongs, excluding the first pixel; an attention score is determined between the query vector and the key vectors of each second pixel; each attention score is normalized to obtain the self-attention weight of the first pixel; and each pixel in the downsampled image block is sequentially used as the first pixel to obtain the self-attention weight of each pixel in the downsampled image block.
[0013] In this embodiment, for each pixel, the self-attention weight between it and the second pixel in that category is calculated according to its category, which reduces the amount of data calculation and improves the cost of image compression and computational efficiency.
[0014] In one embodiment, a preset number of pixels are randomly selected from the target image as initial cluster centers; the distance between each pixel in the target image and each cluster center is determined; based on the distance, each pixel in the target image is assigned to the category to which the nearest cluster center belongs, thereby obtaining the clustering result of each pixel in the target image.
[0015] In this embodiment of the application, the distance between each pixel in the target image and each cluster center is determined, and then each pixel in the target image is assigned to the category of the nearest cluster center according to the distance, so as to obtain the clustering result of each pixel in the target image, thereby achieving the purpose of classifying each pixel in the target image and obtaining the clustering result of each pixel.
[0016] In one embodiment, each pixel in the target image is assigned to the category of the nearest cluster center based on distance; if a change in the cluster center is detected, the average pixel value of each category is calculated based on the pixels in each category, the cluster center is updated using the average pixel value, and the process returns to determine the distance between each pixel in the target image and each cluster center; and / or, if no change in the cluster center is detected, the clustering result of each pixel is obtained based on the category to which each pixel belongs.
[0017] In this embodiment of the application, when the cluster center changes, the average pixel value of each category is calculated based on all pixels in each category as the new cluster center. By continuously updating and iterating the cluster center, the output clustering result can accurately determine the category to which each pixel belongs.
[0018] In one embodiment, the first latent space features are encoded using a probabilistic coding network of an entropy probability model to obtain second latent space features; the second latent space features are quantized using a quantizer of an entropy probability model to obtain quantized second latent space features; and the quantized second latent space features are encoded using an entropy coding network of an entropy probability model to obtain a compressed image of the target image.
[0019] In this embodiment of the application, the first latent space features are encoded by the probabilistic coding network, quantizer and entropy coding network in the entropy probability model. This not only achieves efficient image compression, but also significantly reduces the size of the compressed image file, which is beneficial for storage and transmission.
[0020] In one embodiment, the compressed image is decoded by an entropy decoding network of an entropy probability model to obtain a third latent space feature; the third latent space feature is decoded by a probability decoding network of an entropy probability model to obtain a fourth latent space feature; and the fourth latent space feature is decoded by a main decoding network to obtain the target image under the target process.
[0021] In this embodiment, the fourth latent space features are obtained by decoding through the entropy decoding network and the probability decoding network in the entropy probability model. Finally, the fourth latent space features are decoded through the main decoding network to obtain the target image under the target process, thereby achieving the target image restoration effect.
[0022] In one embodiment, the fourth latent space features are decoded by a main decoding network to obtain a decoded image; the decoded image is then processed by a super-resolution network to obtain the target image for the target process.
[0023] In this embodiment, the fourth latent space features are decoded by the main decoding network to obtain a decoded image. The decoded image is then input into a super-resolution network to obtain the target image under the target process, thereby improving the clarity of the reconstructed image.
[0024] In one embodiment, a first feature image generated from the fourth latent space features and the clustering results of each pixel in the first feature image are input into a main decoding network. The main decoding network includes multiple decoders and an upsampling layer connected in sequence, and each decoder includes a self-attention layer. Based on the clustering results of each pixel in the first feature image and the first feature image, the self-attention weight of each pixel in the first feature image is obtained through the self-attention layer in the decoder. A second feature image is obtained according to the self-attention weight of each pixel in the first feature image. The second feature image is upsampled through the upsampling layer to obtain a decoded image.
[0025] In this embodiment of the application, a main decoding network is set up, which includes multiple decoders and upsampling layers connected in sequence. Each decoder includes a self-attention layer. Through the cooperative use of each layer and the clustering results, the amount of computation in the image decompression process is reduced, thereby reducing the cost of image decompression.
[0026] In one embodiment, each pixel in the decoded image is traversed through a super-resolution network; based on the distribution of each pixel in the decoded image, the neighboring pixels of each pixel are searched from the preset knowledge base of the super-resolution network, wherein the preset knowledge base stores the correspondence between compressed image samples under different processes and the target image samples reconstructed from the compressed image samples; the decoded image is reconstructed based on the neighboring pixels of each pixel to obtain the target image under the target process.
[0027] In this embodiment, a super-resolution network is an image processing technique designed to convert low-resolution decoded images into high-resolution images. By learning the mapping relationships between a large number of high-resolution and low-resolution image pairs, high-resolution images can be generated, thereby improving the fidelity of the target image.
[0028] In one embodiment, an initial super-resolution network is trained using preset compressed image samples from different processing steps and preset target image samples reconstructed from the preset compressed image samples to obtain a trained super-resolution network. The network parameters of the trained super-resolution network are then frozen. The initial master encoder network, initial probabilistic encoder network, entropy encoder network, initial probabilistic decoder network, entropy decoder network, and initial master decoder network are jointly trained using preset target image samples from different processing steps and corresponding preset compressed image samples to obtain a trained master encoder network, probabilistic encoder network, entropy encoder network, probabilistic decoder network, entropy decoder network, and master decoder network. The network parameters of the trained super-resolution network are then unfrozen. The trained master decoder network and the trained super-resolution network are then jointly trained to obtain a jointly trained master decoder network and super-resolution network, which are used for image reconstruction.
[0029] In this embodiment, by jointly training the super-resolution network and the main decoding network, a jointly trained super-resolution network and main decoding network are obtained. Joint training allows the super-resolution network and main decoding network to adapt to each other and optimize collaboratively during training. This synergy helps improve the performance of the entire system because the two networks can jointly learn how to process input data more effectively and produce more accurate output. Furthermore, through joint training, the super-resolution network can learn how to adapt to input images of different qualities and resolutions, thereby generating higher quality output. In addition, during the inference phase, the jointly trained network can be processed as a whole, thereby reducing the overhead of data transfer between different networks and improving computational efficiency.
[0030] Secondly, this application provides an image processing apparatus, comprising:
[0031] The acquisition module is configured to acquire the target image under the target process, and to acquire the clustering results of each pixel in the target image;
[0032] The feature extraction module is configured to extract features from the target image based on the clustering results of each pixel, thereby obtaining the first latent space features of the target image.
[0033] The encoding module is configured to encode the features of the first latent space to obtain a compressed image of the target image.
[0034] Thirdly, this application provides an image processing apparatus, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the image processing method described above.
[0035] Fourthly, this application provides a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the image processing method described above. Attached Figure Description
[0036] Various other advantages and benefits will become apparent to those skilled in the art upon reading the detailed description of the preferred embodiments below. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings.
[0037] In the attached diagram:
[0038] Figure 1 is a flowchart of an image processing method in some embodiments of this application;
[0039] Figure 2 is a detailed flowchart of step S20 of the image processing method in some embodiments of this application;
[0040] Figure 3 is a detailed flowchart of step S23 of the image processing method in some embodiments of this application;
[0041] Figure 4 is a detailed flowchart of step S24 of the image processing method in some embodiments of this application;
[0042] Figure 5 is a detailed flowchart of step S10 of the image processing method in some embodiments of this application;
[0043] Figure 6 is a detailed flowchart of step S13 of the image processing method in some embodiments of this application;
[0044] Figure 7 is a detailed flowchart of step S30 of the image processing method in some embodiments of this application;
[0045] Figure 8 is a schematic diagram of another process of the image processing method in some embodiments of this application;
[0046] Figure 9 is a detailed flowchart of step S03 of the image processing method in some embodiments of this application;
[0047] Figure 10 is a detailed flowchart of step S031 of the image processing method in some embodiments of this application;
[0048] Figure 11 is a detailed flowchart of step S032 of the image processing method in some embodiments of this application;
[0049] Figure 12 is a schematic diagram of another image processing method in some embodiments of this application;
[0050] Figure 13 is a schematic diagram of the module structure of an image processing apparatus according to some embodiments of this application;
[0051] Figure 14 is a schematic diagram of the structure of an image processing device according to some embodiments of this application. Detailed Implementation
[0052] The embodiments of the technical solution of this application will now be described in detail with reference to the accompanying drawings. These embodiments are merely illustrative of the technical solution of this application and are therefore intended to be examples only, not to limit the scope of protection of this application.
[0053] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the application; the terms “comprising” and “having”, and any variations thereof, in the specification, claims, and foregoing description of the drawings are intended to cover non-exclusive inclusion.
[0054] In the description of the embodiments of this application, technical terms such as "first" and "second" are only configured to distinguish different objects and should not be construed as indicating or implying relative importance or implicitly specifying the number, specific order, or primary and secondary relationship of the indicated technical features. In the description of the embodiments of this application, "multiple" means two or more, unless otherwise explicitly defined.
[0055] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0056] In the description of the embodiments in this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship.
[0057] In modern manufacturing, comprehensively recording quality control information throughout the production process is crucial for ensuring product quality, optimizing production processes, and enabling data-driven decision-making. Production images, as an important component of quality control information, carry rich on-site data and visual information, playing an irreplaceable role in subsequent defect detection and analysis, data analysis, and quality traceability.
[0058] With the expansion of production scale and the increasing complexity of processes, the number of production images has exploded. These images are not only numerous but also typically possess high resolution and clarity to capture more detailed information. However, this growth trend has brought unprecedented challenges to image storage. On the one hand, the massive amount of image data requires enormous storage space, increasing storage costs and management difficulty; on the other hand, the processing speed of image data also needs to keep pace with production to ensure timely recording and analysis.
[0059] To address these challenges, image compression technology is widely used in related technologies. Image compression reduces redundant information in image data, thereby lowering storage requirements and alleviating storage pressure. However, while traditional image compression methods achieve compression to some extent, their processing typically requires analysis of every single pixel in the image. This means that as image resolution and sharpness increase, the computational load of image compression also increases, leading to higher costs.
[0060] Furthermore, image compression must be performed while maintaining image quality. Excessive compression can lead to image information loss, affecting subsequent defect detection and analysis, and data accuracy. Therefore, achieving efficient and low-cost image compression while ensuring image quality has become a pressing issue for current production image storage technologies.
[0061] To address the aforementioned issues, this application proposes an image processing method, comprising: acquiring a target image under a target process; acquiring the clustering results of each pixel in the target image; extracting features from the target image based on the clustering results of each pixel to obtain a first latent space feature of the target image; and encoding the first latent space feature to obtain a compressed image of the target image.
[0062] Unlike related technologies, this application extracts features based on the clustering results of each pixel in the target image. Since clustering can group similar pixels into one category, similar pixels can be treated as a whole and processed together, which reduces the amount of computation in the feature extraction process and thus reduces the cost of image compression.
[0063] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0064] The image processing method of this application can be applied to industrial production scenarios. In industrial production, defect detection is a crucial quality control step, helping to ensure products meet specific quality standards. Visual inspection is currently one of the most effective methods, making the preservation of production process images particularly important. Furthermore, from the perspectives of quality control records and data analysis, it is also necessary to preserve a large number of production images. For products with large production scales and numerous processes, image compression technology is required to reduce image storage costs.
[0065] For example, during battery production, images of the battery at each stage of the process are captured for quality inspection. Since battery production involves numerous stages and the resulting images are large in size, the image processing method described in this application can be used to compress the images captured during battery production, thereby reducing storage costs.
[0066] In the context of battery cell wiring, battery cell wiring refers to the wires or cables connecting the battery cells, commonly known as battery connection wires or battery wiring cables. It primarily connects the battery cells to the battery management system or other battery components, ensuring the transmission of current and signals. This application can acquire images corresponding to each step in the battery cell wiring process and perform quality inspection based on the images at each step. Since the battery cell wiring process involves many steps and the acquired images are large in scale, the image processing method of this application can be used to compress the images acquired during the battery cell wiring process to reduce image storage costs.
[0067] The image processing method of this application is not limited to the above-mentioned scenarios, but can also be applied to other scenarios that require image compression.
[0068] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an image processing device capable of performing the above functions. The following description uses an image processing device as an example to illustrate this embodiment and the subsequent embodiments.
[0069] In some embodiments of this application, as shown in FIG1, an image processing method is provided, including the following steps:
[0070] Step S10: Obtain the target image under the target process, and obtain the clustering results of each pixel in the target image.
[0071] In this embodiment, taking the cell wire drawing scenario as an example, the processes in this scenario include material preparation, coating, roller / compacting, slitting / cutting, winding / stacking, casing / packaging, and liquid injection / drying. Each process will be described below:
[0072] Ingredient preparation: This is the initial step in battery production, including positive electrode and negative electrode ingredient preparation. Positive electrode materials consist of active materials, conductive agents, and binders, while negative electrode materials typically include active materials, conductive agents, binders, and dispersants. Strict control of parameters such as temperature, humidity, and stirring speed is required during the ingredient preparation process to ensure the uniformity and stability of the slurry.
[0073] Coating: The positive electrode slurry and negative electrode slurry are coated onto the aluminum current collector and copper current collector, respectively. During the coating process, parameters such as coating speed, baking temperature, and humidity need to be controlled to obtain a uniform and dense coating.
[0074] Roller compaction: After coating and drying, the electrode sheets need to be compacted. Compaction increases the density and strength of the electrode sheets, which is beneficial to improving battery performance. During the compaction process, parameters such as compaction density, rebound rate, and elongation need to be controlled.
[0075] Slitting / Cutting: The entire electrode sheet is cut into strips of uniform width for subsequent winding or stacking operations. The length and number of burrs need to be controlled during slitting to avoid the risk of short circuits in the battery.
[0076] Winding / Lamination: The separator, positive electrode sheet, and negative electrode sheet are formed into a single core or stacked structure using a winding machine or stacking machine. During the winding or stacking process, parameters such as tension and alignment need to be controlled to ensure the stability of the battery's internal structure and performance.
[0077] Encasing / Packaging: The wound core or stacked structure is placed into the battery casing and then encapsulated. During the encapsulation process, parameters such as encapsulation pressure and sealing performance need to be controlled to prevent internal short circuits and leakage.
[0078] Electrolyte injection / drying: Injecting electrolyte into the battery and then drying it. Strict control of the injection volume and drying degree is required during the injection process to ensure battery performance and safety.
[0079] The target process is one or more of the above processes, and the target process can be the current process or a historical process.
[0080] A target image refers to an image acquired during a target process. This target image has not yet been compressed and occupies a large amount of storage space or has a high resolution. Therefore, in order to optimize storage and transmission efficiency, these target images need to be compressed to reduce storage space.
[0081] In one feasible implementation, the target images for each target process may be captured by a digital camera, scanner, or other image acquisition device and sent to an image processing device. For example, after capturing the target images for each target process, the image acquisition device transmits the captured images to the image processing device in real time. The image processing device then compresses the captured images before storage or performs subsequent quality checks to reduce the storage space required for the target images. By acquiring the target images for each target process, the production status of each process can be analyzed based on the acquired target images to achieve the purpose of quality inspection.
[0082] In this embodiment, clustering is an unsupervised learning method configured to divide all pixels in the target image into multiple groups or clusters, such that pixels within the same cluster are as similar as possible, while pixels in different clusters are as different as possible. The clustering result of each pixel is the group or cluster to which each pixel belongs, and each group or cluster represents a category. By obtaining the clustering results of each pixel in the target image, the category to which each pixel belongs can be determined. Thus, each pixel in the target image can be classified into its corresponding category, and each category contains a group of similar pixels or the features of pixels.
[0083] In obtaining the clustering results of pixels in a target image, the clustering algorithms used include, but are not limited to, K-means, DBSCAN, and BIRCH algorithms. The K-means algorithm iteratively updates the centroid of each cluster and the affiliation of pixels within the cluster, minimizing the sum of distances between data points within the cluster. The DBSCAN algorithm divides pixels into high-density and low-density regions, using directly connected points by density. The BIRCH algorithm uses a tree-like data structure to divide pixels into a grid for rapid cluster identification.
[0084] In one feasible implementation, obtaining the clustering results of each pixel in the target image includes: clustering each pixel in the target image based on pixel features to obtain a clustering result, or clustering each pixel in the target image based on pixel feature vectors to obtain a clustering result. These features can be color, brightness, etc. Clustering based on pixel features or pixel feature vectors improves the clustering effect.
[0085] In another feasible implementation, the target image is divided into multiple image blocks. Each image block is clustered based on the feature vectors of the pixels within it. After clustering of each image block is completed, clustering is performed between the image blocks to obtain the clustering result. This method can simultaneously achieve the effects of local and global clustering.
[0086] Since compressed images lack significant semantics, in image filling tasks, the values at the filling positions are mainly based on the features of surrounding pixels, without needing features from other classes further away. Therefore, this application clusters each pixel in the target image. The purpose of obtaining the clustering results is to facilitate subsequent feature extraction based on the clustering results of each pixel in the target image. Since clustering can group similar pixels into one class, similar pixels can be treated as a whole and processed together, reducing the computational load in the feature extraction process, thereby reducing the cost of image compression and improving image compression efficiency.
[0087] Step S20: Based on the clustering results of each pixel, feature extraction is performed on the target image to obtain the first latent space features of the target image.
[0088] The first latent space feature is a low-dimensional representation obtained after feature extraction of the target image. It contains the main information and structure of the target image. The dimension of the latent space feature is usually lower than the pixel dimension of the target image, thus achieving the purpose of image compression.
[0089] In one feasible implementation, an appropriate feature representation method can be selected based on the clustering results of each pixel. For example, for K-means clustering, the color value or texture feature of each cluster center can be used as the feature representation of pixels within that category. For spectral clustering, the feature vector corresponding to each category can be used as the feature representation. Each pixel in the target image is traversed, and its corresponding feature representation is extracted according to its category. These feature representations are combined to form the feature set of the target image, thus obtaining the first latent space features of the target image.
[0090] In another feasible implementation, the target image can be downsampled first, and then the target image after downsampling can be feature extracted based on the clustering results of each pixel to obtain the first latent space features of the target image after downsampling.
[0091] In another feasible implementation, the target image can be segmented to obtain multiple image blocks. Based on the clustering results of each pixel, features are extracted from each image block separately. Then, the extracted features from each image block are concatenated to obtain the first latent space features of the target image. By segmenting and then processing features, multiple image blocks can be extracted simultaneously, improving feature extraction efficiency.
[0092] Step S30: Encode the first latent space features to obtain a compressed image of the target image.
[0093] In a feasible implementation, a suitable encoding method can be selected to encode the first latent space features based on the properties of the first latent space features and the compression requirements of the target image, thereby obtaining a compressed image of the target image. Common encoding methods include principal component analysis, sparse coding, autoencoders, etc.
[0094] In another feasible implementation, the first latent space features can be directly entropy-encoded based on a current statistical distribution. However, simple statistical distributions often fail to objectively describe the distribution of the latent space. Therefore, an entropy probability model is used to fit the latent space distribution. This entropy probability model mainly consists of two parts: one part is encoding to compress the target image, and the other part is decoding to decompress the compressed image. Regarding the encoding process, encoding the first latent space features using the entropy probability model not only achieves efficient image compression but also significantly reduces the size of the compressed image, which is beneficial for storage and transmission.
[0095] In this embodiment, a target image is acquired under the target process, and the clustering results of each pixel in the target image are obtained. Based on the clustering results of each pixel, feature extraction is performed on the target image to obtain the first latent space features of the target image. The first latent space features are then encoded to obtain a compressed image of the target image. By performing feature extraction based on the clustering results of each pixel in the target image, since clustering can group similar pixels into one category, similar pixels can be treated as a whole and processed together, reducing the computational load in the feature extraction process, thereby reducing the image compression cost.
[0096] In some embodiments of this application, as shown in Figure 2, feature extraction of the target image based on the clustering results of each pixel to obtain the first latent space features of the target image includes:
[0097] Step S21: The clustering results of each pixel and the target image are input into the main coding network. The main coding network includes a first image segmentation layer and multiple encoders connected in sequence. Each encoder includes a downsampling layer and a self-attention layer connected in sequence.
[0098] Step S22: Divide the target image into multiple image blocks using the first image segmentation layer.
[0099] The purpose of the first image segmentation layer is to divide the input target image into multiple image blocks. This is done by cutting the image into different image blocks and then converting each image block into a token, i.e., one image block represents one token, which facilitates the subsequent calculation of self-attention weights. For example, assuming the target image size is (224, 224), and the image block size is (4, 4), then the target image can be cut into (56, 56) image blocks.
[0100] Step S23: Each image block is downsampled using the downsampling layer in the encoder to obtain each downsampled image block.
[0101] Downsampling layers primarily reduce the resolution or size of the target image by decreasing the number of pixels. This allows for the processing of smaller image data, further reducing the computational load during feature extraction and lowering image compression costs. It's important to note that the downsampled image should not be excessively distorted. Subsequent super-resolution networks learn the pixel distribution for each image processing step; excessive distortion exceeding the learned pixel distribution makes upsampling and restoration impossible. Therefore, while simplifying the number of pixels and reducing computation, downsampling must also preserve as much important image information as possible.
[0102] The downsampling layer can use methods such as Sobel filtering, average pooling, or max pooling. The downsampling layer in the encoder performs downsampling on each image block individually, resulting in a downsampled image block.
[0103] Step S24: Using the self-attention layer in the encoder, based on the clustering results of the pixels in each downsampled image block and each downsampled image block, obtain the self-attention weight of each pixel in each downsampled image block.
[0104] Self-attention weights are a core concept in the self-attention mechanism of deep learning. The self-attention mechanism allows the model to directly consider the relationships between individual pixels within a sequence when processing pixel data, without relying on external information. This mechanism determines the degree of attention between different pixels by calculating the self-attention weights between each pixel.
[0105] It should be noted that related technologies require calculating the self-attention weight of a specific pixel in an image based on all pixels in that image. This calculation method increases the computational cost of self-attention weights, increases image compression costs, and reduces computational efficiency. In contrast, this application, after obtaining each downsampled image block, calculates the self-attention weight of each pixel in each downsampled image block based on all pixels within the category to which that pixel belongs. It only calculates the self-attention weight for pixels within the category to which the pixel belongs, without considering pixels in other categories, thus reducing the image compression cost of self-attention weights and improving the computational efficiency of self-attention weights.
[0106] Step S25: Based on the self-attention weights of each pixel in each downsampled image block, the first latent space features of the target image are obtained.
[0107] After obtaining the self-attention weight of each pixel in each downsampled image block, the value vector of each pixel is weighted and summed using the self-attention weight of each pixel to obtain the context representation of each pixel. The context representations of all pixels are combined to form a new feature matrix, which is the representation of the target image in the latent space, i.e., the first latent space feature.
[0108] In this embodiment, a main coding network is set up, which includes a first image segmentation layer and multiple encoders connected in sequence. Each encoder includes a downsampling layer and a self-attention layer connected in sequence. By using the cooperation of each layer and the clustering results, the computational load in the feature extraction process of the target image is reduced, thereby reducing the image compression cost.
[0109] In other embodiments, feature extraction of the target image based on the clustering results of each pixel to obtain the first latent space features of the target image includes: inputting the clustering results of each pixel and the target image into a main coding network, wherein the main coding network includes multiple encoders connected in sequence, each encoder including a self-attention layer; obtaining the self-attention weight of each pixel in the target image based on the clustering results of each pixel and the target image through the self-attention layer in the encoder; and obtaining the first latent space features of the target image according to the self-attention weight of each pixel in the target image.
[0110] In other embodiments, feature extraction of the target image based on the clustering results of each pixel to obtain the first latent space features of the target image includes: inputting the clustering results of each pixel and the target image into a main coding network, wherein the main coding network includes a first image segmentation layer and multiple encoders connected in sequence, each encoder including a self-attention layer; dividing the target image into multiple image blocks through the first image segmentation layer; obtaining the self-attention weight of each pixel in each image block based on the clustering results of the pixels in each image block and each image block through the self-attention layer in the encoder; and obtaining the first latent space features of the target image according to the self-attention weight of each pixel in each image block.
[0111] In other embodiments, feature extraction of the target image based on the clustering results of each pixel to obtain the first latent space features of the target image includes: inputting the clustering results of each pixel and the target image into a main coding network, wherein the main coding network includes multiple encoders connected in sequence, each encoder including a downsampling layer and a self-attention layer connected in sequence; performing downsampling processing on the target image through the downsampling layer in the encoder to obtain a downsampled target image; obtaining the self-attention weight of each pixel in the downsampled target image based on the clustering results of the pixels in the downsampled target image and the downsampled target image through the self-attention layer in the encoder; and obtaining the first latent space features of the target image according to the self-attention weight of each pixel in the downsampled target image.
[0112] Furthermore, as shown in Figure 3, this application uses Sobel filtering to downsample each image block to obtain each downsampled image block.
[0113] Specifically, each image block is downsampled separately using the downsampling layer in the encoder, resulting in a downsampled image block comprising:
[0114] Step S231: Through the downsampling layer in the encoder, convolution operations are performed on each pixel in each image block using horizontal and vertical kernels respectively to obtain the horizontal and vertical gradients of each pixel.
[0115] Sobel filtering is a commonly used edge detection filter that uses the rate of change of gray values in an image patch to determine the location of edges. By calculating the gradient value of each pixel in the image patch, the Sobel filter can detect edges within the patch. Specifically, the Sobel filter typically consists of two kernels: a horizontal kernel and a vertical kernel. The horizontal kernel calculates the gradient of each image patch in the horizontal and vertical directions, respectively.
[0116] In one feasible implementation, in the downsampling layer of the encoder, for each pixel in an image patch, the surrounding pixel values are convolved with a horizontal kernel to calculate the horizontal gradient of that pixel. Specifically, convolving the surrounding pixel values with the horizontal kernel includes: aligning the center of the horizontal kernel with the first pixel, multiplying each element of the horizontal kernel with the corresponding pixel value in the image patch, and summing all products to obtain the horizontal gradient of that pixel. In this way, the horizontal gradient of each pixel in each image patch can be obtained.
[0117] In another feasible implementation, the pixel values surrounding the same pixel are convolved with a vertical kernel to calculate the vertical gradient of that pixel. Specifically, convolving the surrounding pixel values with the vertical kernel includes: aligning the center of the vertical kernel with the first pixel, multiplying each element of the vertical kernel by the corresponding pixel value in the image patch, and summing all products to obtain the vertical gradient of that pixel. In this way, the vertical gradient of each pixel in each image patch can be obtained.
[0118] Step S232: Determine the gradient magnitude of each pixel based on the horizontal and vertical gradients of each pixel.
[0119] Gradient magnitude represents the gradient strength of a pixel in that direction and is typically configured for edge detection.
[0120] For each pixel, based on the horizontal and vertical gradients calculated using the Sobel filter, its corresponding gradient magnitude can be calculated. The formula for calculating the gradient magnitude is as follows:
[0121] Where G_x and G_y represent the horizontal gradient and the vertical gradient, respectively.
[0122] Step S233: Obtain pixels with gradient magnitude greater than the preset gradient magnitude.
[0123] The preset gradient magnitude can be set according to the actual situation. The gradient magnitude is compared with the preset gradient magnitude. Pixels with a gradient magnitude greater than the preset gradient magnitude are considered edge points, and pixels with a gradient magnitude less than or equal to the preset gradient magnitude are considered non-edge points, thereby realizing edge point extraction.
[0124] Step S234: Obtain each downsampled image block based on the pixels whose gradient magnitude is greater than the preset gradient magnitude.
[0125] In downsampling scenarios, the gradient magnitude can also be used as a basis for selecting which pixel information to retain within each image patch. For example, pixels with gradient magnitudes greater than a preset gradient magnitude can be retained, while pixels with gradient magnitudes less than or equal to the preset gradient magnitude can be ignored. This results in each downsampled image patch, reducing the number of pixels in the image and improving the efficiency of subsequent image processing.
[0126] In this embodiment, Sobel filtering is used to preserve the edges in the image blocks. Even if the image is compressed and subsequently decompressed, defects in the image can be prevented from being erased, thereby improving the accuracy of image defect detection.
[0127] Furthermore, as shown in Figure 4, through the self-attention layer in the encoder, based on the clustering results of pixels in each downsampled image block and each downsampled image block, the self-attention weights of each pixel in each downsampled image block are obtained, including:
[0128] Step S241: Extract the query vector of the first pixel in the downsampled image block, and extract the key vector of each second pixel in the category to which the first pixel belongs, wherein the second pixel is any pixel in the category to which the first pixel belongs, excluding the first pixel.
[0129] The first pixel can be any pixel in the downsampled image patch, representing the pixel currently being processed. The second pixel is located in the same image patch as the first pixel, and the second pixel can be any pixel in that image patch within the same category as the first pixel, excluding the first pixel.
[0130] A query vector typically represents the pixel currently being processed or the target of interest. A corresponding query vector is generated for each pixel.
[0131] The key vector is configured to be matched with the query vector to calculate similarity or self-attention weights, and a key vector is generated for each pixel within each category.
[0132] In addition, the value vector of the first pixel and the value vectors of each second pixel within the category to which the first pixel belongs can be extracted. The value vector contains information or values associated with the key vector, which will be used when calculating the weighted output. The value vector also corresponds to each pixel.
[0133] In one feasible implementation, the aforementioned query vector, key vector, and value vector can be mapped from the feature vector of the first pixel to the query, key, and value spaces via a linear transformation, i.e., a fully connected layer or a convolutional layer. This can be achieved by multiplying the feature vector of the first pixel by different preset weight matrices. Specifically, different preset weight matrices are used when calculating the query vector, key vector, and value vector. The first pixel's feature vector can be multiplied by a preset weight matrix configured for calculating the query vector to obtain the query vector; multiplied by a preset weight matrix configured for calculating the key vector to obtain the key vector; and multiplied by a preset weight matrix configured for calculating the value vector to obtain the value vector. This allows for the extraction of the query vector of the first pixel, as well as the extraction of the key and value vectors of each second pixel within the category to which the first pixel belongs.
[0134] In another feasible implementation, the query vector of the first pixel and the key and value vectors of the second pixel within the category to which the first pixel belongs can be extracted through the self-attention layer of the main encoder network, and the self-attention weights of subsequent pixels can be calculated. The main encoder network includes multiple encoders connected in sequence, each encoder including a self-attention layer and a feedforward neural network. The self-attention layer can calculate the query vector and key vector for each pixel, convert each pixel into a feature vector, and perform a linear transformation on the feature vectors to generate the query vector, key vector, and value vector.
[0135] Step S242: Determine the attention score between the query vector and the key vector of each second pixel.
[0136] The attention score is the attention score between the query vector and the key vectors of all second pixels within the category to which the first pixel belongs. The attention score can also include the attention score between the query vector of the first pixel and the key vector of the first pixel. These attention scores represent the relevance between the current position and other positions.
[0137] In one feasible implementation, for a first pixel, the dot product or other similarity measure of its query vector and the key vectors of each second pixel in the category to which the first pixel belongs is calculated and divided by a scaling factor to obtain the attention score between the query vector and the key vectors of each second pixel, wherein the scaling factor is configured to prevent gradient vanishing.
[0138] Step S243: Normalize each attention score to obtain the self-attention weight of the first pixel.
[0139] The self-attention weight represents the degree to which the first pixel allocates attention to the second pixel within its own category when focusing on the second pixel within that category. The larger the self-attention weight, the higher the attention the first pixel gives to the second pixel within its own category.
[0140] In one feasible implementation, each attention score can be input into a normalization function, such as the Softmax function, to obtain the self-attention weights of the first pixel for each second pixel. The Softmax function converts the attention scores into a probability distribution.
[0141] In other embodiments, obtaining the first latent space feature of the target image based on the self-attention weight of each pixel in each downsampled image block includes: after obtaining the self-attention weights of the first pixel with respect to each second pixel, the value vectors of each second pixel are weighted and summed using the self-attention weights of the first pixel with respect to each second pixel to obtain the context representation of the first pixel. By combining the context representations of all pixels, a new feature is formed, which is the representation of the image in the latent space, i.e., the first latent space feature described above.
[0142] For example, for each pixel i, based on its category c, extract its query vector qi, key vector ki, and value vector vi.
[0143] For each pixel j within category c, calculate the attention score sij between qi and kj.
[0144] Softmax normalization is applied to all attention scores to obtain the self-attention weight αij of pixel i to the second pixel in category c.
[0145] Based on the self-attention weights αij and the value vector vj, the weighted output oi of pixel i is calculated. This is achieved by weighted summation of αij and vj: oi = Σj(αij * vj), thus obtaining the contextual representation of pixel i.
[0146] Step S244: Sequentially take each pixel in the downsampled image block as the first pixel to obtain the self-attention weight of each pixel in the downsampled image block.
[0147] Each pixel in the downsampled image block is taken as the first pixel, and the self-attention weight of each pixel is calculated using the above steps S241 to S243.
[0148] In this embodiment, for each pixel, the self-attention weight between it and the second pixel in that category is calculated according to its category, which reduces the amount of data calculation and improves the cost of image compression and computational efficiency.
[0149] In some embodiments of this application, as shown in Figure 5, obtaining the clustering results of each pixel in the target image includes:
[0150] Step S11: Randomly select a preset number of pixels from the target image as the initial cluster centers.
[0151] Cluster centers are a core concept in cluster analysis. They represent the centroid or center point of a cluster. These cluster centers can change during the clustering process to assign each pixel in the target image to an appropriate category. A predetermined number of pixels in the target image can be randomly selected as the initial cluster centers.
[0152] Step S12: Determine the distance between each pixel in the target image and each cluster center.
[0153] The distance can be measured using one of the following methods: Euclidean distance, Manhattan distance, or cosine similarity.
[0154] In one feasible implementation, each pixel in the target image can be represented as a vector. For a grayscale image, this vector may contain only a single grayscale value; for a color image, this vector may contain values for the red, green, and blue channels. Similarly, each cluster center is also represented as a vector with the same dimensions as the pixel. Each pixel in the target image can be traversed. For each pixel, the distance between its vector and the vector of a randomly selected initial cluster center is calculated. This typically involves a nested loop: the outer loop iterates through the pixels in the image, and the inner loop iterates through the cluster centers. Finally, the calculated distances are stored for subsequent image processing.
[0155] Step S13: Based on the distance, assign each pixel in the target image to the category of the nearest cluster center to obtain the clustering result of each pixel in the target image.
[0156] Each pixel is assigned to the category of the nearest cluster center based on distance. Specifically, each pixel compares its distance to each cluster center and selects the cluster center with the smallest distance as its category.
[0157] In this embodiment of the application, the distance between each pixel in the target image and each cluster center is determined, and then each pixel in the target image is assigned to the category of the nearest cluster center according to the distance, so as to obtain the clustering result of each pixel in the target image, thereby achieving the purpose of classifying each pixel in the target image and obtaining the clustering result of each pixel.
[0158] Furthermore, as shown in Figure 6, in the clustering process, not only feature values but also pixel location information must be considered. Therefore, this application preferably uses the K-means algorithm for clustering to improve the clustering effect. Specifically, based on distance, each pixel in the target image is assigned to the category of the nearest cluster center, resulting in the following clustering results for each pixel in the target image:
[0159] Step S131: Based on the distance, assign each pixel in the target image to the category of the nearest cluster center.
[0160] The initial selection of cluster centers significantly impacts the convergence speed and clustering results of clustering algorithms. Random selection may lead the algorithm into local optima, preventing the attainment of globally optimal clustering results. To address this issue, the K-Means algorithm can be used to optimize the selection of initial cluster centers. The value of K, i.e., the number of cluster centers, greatly influences the clustering results. If K is too small, the clustering results may be too general and fail to accurately reflect the details in the target image; if K is too large, the clustering results may be too fragmented, increasing the difficulty of subsequent processing. Therefore, a trade-off must be struck when choosing the value of K based on the specific circumstances. A possible K value is 2.
[0161] In one feasible implementation, during the iterative process using the K-means algorithm, the cluster centers are updated. Then, the distance from each pixel to a cluster center is recalculated using the updated cluster centers, and pixels are reassigned to the nearest cluster center. This process is repeated until the cluster centers no longer change significantly or a predetermined number of iterations is reached, at which point the iteration stops. At this point, the output clustering results accurately determine the category to which each pixel belongs.
[0162] Step S132: If a change in cluster center is detected, calculate the average pixel value of each category based on the pixels in each category, update the cluster center using the average pixel value, and return to determine the distance between each pixel in the target image and each cluster center.
[0163] The average pixel value is the mean of all pixels within a category.
[0164] Each category corresponds to an average pixel value, which is calculated by averaging all pixels in that category.
[0165] In one feasible implementation, for each category, all pixels within it are traversed. For each pixel, the values of its individual channels are summed; for example, for a color image, this is typically the red, green, and blue channels. The sum of the summed values is calculated and divided by the number of pixels within the category to obtain the average pixel value. This average pixel value is a new cluster center, representing the location and characteristics of that cluster.
[0166] In another feasible implementation, after updating the cluster centers using the average pixel points, the distance between each pixel and the updated cluster centers is recalculated for each pixel in the target image until the cluster centers no longer change significantly or the predetermined number of iterations is reached, at which point the iteration stops.
[0167] And / or, in step S133, if the cluster center is detected to have not changed, the clustering result of each pixel is obtained according to the category to which each pixel belongs.
[0168] In this embodiment of the application, when the cluster center changes, the average pixel value of each category is calculated based on all pixels in each category as the new cluster center. By continuously updating and iterating the cluster center, the output clustering result can accurately determine the category to which each pixel belongs.
[0169] In some embodiments of this application, as shown in FIG7, encoding the first latent space features to obtain a compressed image of the target image includes:
[0170] Step S31: Encode the first latent space features using the probabilistic coding network of the entropy probability model to obtain the second latent space features.
[0171] The entropy probabilistic model mainly consists of two parts: an encoding process that compresses the target image, and a decoding process that decompresses the compressed image. The encoding process includes probabilistic coding and entropy coding; therefore, probabilistic coding networks and entropy coding networks exist.
[0172] A probabilistic coding network comprises at least one convolutional layer and at least one activation layer. The convolutional layer scans the image corresponding to the first latent space feature using a convolutional kernel, thereby extracting local features from the image. The activation layer, located after the convolutional layer, primarily performs a non-linear transformation on the output of the convolutional layer, thus enhancing the expressive power of the probabilistic coding network.
[0173] In one feasible implementation, the first latent space features are sequentially passed through a convolutional layer and an activation layer for feature extraction to obtain the second latent space features.
[0174] Step S32: The second latent space features are quantized using the quantizer of the entropy probability model to obtain the quantized second latent space features.
[0175] The main function of the quantizer is to convert continuous or high-resolution second latent space features into discrete or low-resolution second latent space feature representations.
[0176] The second latent space features are quantized using a quantizer based on an entropy probability model. The primary task of the quantizer in obtaining the quantized second latent space features is to determine the quantization range, i.e., the range of values after quantization. Based on the quantization range, the quantizer maps each element in the second latent space features to a quantized value. This mapping process may involve various strategies, such as uniform quantization and non-uniform quantization. During quantization, it is necessary to retain as much important information as possible from the original second latent space features. This is usually achieved by minimizing the quantization error, for example, by using a cross-entropy loss function to measure the difference before and after quantization.
[0177] Step S33: Encode the quantized second latent space features using the entropy coding network of the entropy probability model to obtain a compressed image of the target image.
[0178] In one feasible implementation, after encoding the quantized second latent space features using an entropy coding network based on an entropy probability model, a binary file is obtained. Simultaneously, the first latent space features are processed by another quantizer to quantize their representation, resulting in quantized first latent space features. These quantized features are then encoded using another entropy coding network, also yielding a binary file. Finally, the binary file encoded by the entropy coding network based on the entropy probability model is combined with the binary file encoded by the other entropy coding network to obtain a compressed image of the target image.
[0179] Since the second latent space features output by the probabilistic coding network are floating-point high-dimensional features, and the quantized second latent space features obtained after quantization are integer high-dimensional features, directly saving them would occupy a lot of disk space. Therefore, after obtaining the quantized second latent space features, it is necessary to entropy code the quantized second latent space features through the entropy coding network of the entropy probability model. This refers to coding that uses the statistical characteristics of the information source to compress the bit rate, such as arithmetic coding. It is based on a distribution and compresses high-dimensional features to the minimum amount of information, thereby achieving the effect of image compression.
[0180] In this embodiment of the application, the first latent space features are encoded by the probabilistic coding network, quantizer and entropy coding network in the entropy probability model. This not only achieves efficient image compression, but also significantly reduces the size of the compressed image file, which is beneficial for storage and transmission.
[0181] In some embodiments of this application, as shown in FIG8, after encoding the first latent space features to obtain a compressed image of the target image, the method further includes:
[0182] Step S01: Decode the compressed image using the entropy decoding network of the entropy probability model to obtain the third latent space features.
[0183] The third latent space feature is the same as the second latent space feature described above.
[0184] The entropy probability model includes an entropy decoding network and a probability decoding network. These networks decode compressed images to achieve high-quality image restoration.
[0185] The compressed image is stored as a binary file. This binary file can be decoded using an entropy decoding network based on an entropy probability model to obtain the third latent space features.
[0186] Step S02: Decode the third latent space features using the probability decoding network of the entropy probability model to obtain the fourth latent space features.
[0187] The fourth latent space feature is the same as the first latent space feature described above.
[0188] The probabilistic decoding network comprises at least one deconvolutional layer and at least one activation layer. The deconvolutional layer performs a deconvolution operation on the image corresponding to the third latent space feature of the input image using a convolutional kernel, thereby extracting the fourth latent space feature from the image corresponding to the third latent space feature. The activation layer, located after the deconvolutional layer, primarily performs a non-linear transformation on the output of the deconvolutional layer, thereby enhancing the expressive power of the probabilistic decoding network.
[0189] In one feasible implementation, the third latent space feature is sequentially passed through a deconvolution layer and an activation layer for feature extraction, resulting in a fourth sub-latent space feature. Furthermore, as mentioned above, the quantized first latent space feature can be encoded using another entropy coding network to obtain a binary file. This binary file can then be decoded using another entropy decoding network to obtain another fourth latent space feature. Finally, these two fourth sub-latent space features are combined to obtain the fourth latent space feature.
[0190] Step S03: Decode the fourth latent space features through the main decoding network to obtain the target image under the target process.
[0191] The main decoding network is responsible for converting the features from the fourth latent space into the image space. In this process, the main decoding network may contain multiple layers, such as fully connected layers, upsampling layers, convolutional layers, and self-attention layers. The self-attention layers are configured to capture the correlations between different locations in the feature map, thereby generating a more refined and coherent target image.
[0192] In this embodiment, the fourth latent space features are obtained by decoding through the entropy decoding network and the probability decoding network in the entropy probability model. Finally, the fourth latent space features are decoded through the main decoding network to obtain the target image under the target process, thereby achieving the target image restoration effect.
[0193] Furthermore, as shown in Figure 9, the fourth latent space features are decoded by the main decoding network to obtain the target image under the target process, including:
[0194] Step S031: Decode the fourth latent space features through the main decoding network to obtain the decoded image.
[0195] Step S032: Process the decoded image using a super-resolution network to obtain the target image for the target process.
[0196] Under normal circumstances, the decoded image output by the main decoding network can be used to obtain the target image after inverse preprocessing. However, when the target image is large and inference resources such as video memory are limited, the input of the main encoding network will be downsampled or bilinearly interpolated. After the main decoding network outputs the decoded image, it is necessary to upsample it to the size of the target image. However, the information entropy here is insufficient to supplement the details of the target image. It can only be interpolated based on a small image using traditional methods, resulting in low restoration accuracy of the restored image.
[0197] To address the aforementioned issues, this embodiment employs a super-resolution network. A super-resolution network is an image processing technique designed to convert the low-resolution decoded image of this application into a high-resolution image. Its principle primarily utilizes deep learning algorithms to learn the mapping relationships between a large number of high-resolution and low-resolution image pairs, thereby generating a high-resolution image. The super-resolution network can be viewed as a knowledge base; for a given process, the distribution patterns of adjacent positions are stored in the super-resolution network. Each point in the small-sized decoded image can find a matching distribution experience based on the current distribution, thereby performing interpolation to improve the fidelity of the target image.
[0198] In this embodiment, the fourth latent space features are decoded by the main decoding network to obtain a decoded image. The decoded image is then input into a super-resolution network to obtain the target image under the target process, thereby improving the clarity of the reconstructed image.
[0199] Furthermore, as shown in Figure 10, the fourth latent space features are decoded through the main decoding network to obtain the decoded image, which includes:
[0200] Step S0311: The first feature image generated by the fourth latent space features and the clustering results of each pixel in the first feature image are input into the main decoding network. The main decoding network includes multiple decoders and upsampling layers connected in sequence, and each decoder includes a self-attention layer.
[0201] Step S0312: Based on the clustering results of each pixel in the first feature image and the first feature image, the self-attention weight of each pixel in the first feature image is obtained through the self-attention layer in the decoder.
[0202] Self-attention weights are a core concept in the self-attention mechanism of deep learning. The self-attention mechanism allows the model to directly consider the relationships between individual pixels within a sequence when processing pixel data, without relying on external information. This mechanism determines the degree of attention between different pixels by calculating the self-attention weights between each pixel.
[0203] It should be noted that related technologies require calculating the self-attention weight of a specific pixel in an image based on all pixels in the image. This calculation method increases the computational load of self-attention weights, increases image decompression costs, and reduces computational efficiency. In contrast, this application, after obtaining the clustering results of each pixel in the first feature image, calculates the self-attention weight of each pixel in the first feature image based on the clustering results and the first feature image itself. The self-attention weight is calculated only for all pixels within the category to which the pixel belongs, without considering pixels in other categories. This reduces the image compression cost of self-attention weights and improves the computational efficiency of self-attention weights.
[0204] Step S0313: Obtain the second feature image based on the self-attention weight of each pixel in the first feature image.
[0205] After obtaining the self-attention weight of each pixel in the first feature image, the value vector of each pixel is weighted and summed using the self-attention weight of each pixel in the first feature image to obtain the context representation of each pixel; the context representations of all pixels are combined to form a new feature matrix, which constitutes the second feature image.
[0206] Step S0314: Upsample the second feature image through an upsampling layer to obtain the decoded image.
[0207] The decoded image is the same size as the target image.
[0208] The main function of an upsampling layer is to increase the resolution of the secondary feature image, typically achieved by inserting new pixels using interpolation algorithms such as bilinear interpolation or nearest neighbor interpolation. This process magnifies the image at the pixel level, thereby revealing more detailed information. In neural networks, upsampling layers, such as transposed convolutional layers, are often configured to increase the resolution of feature maps to recover or enhance detailed features in an image.
[0209] In one feasible implementation, bilinear interpolation can be performed on the second feature image to obtain the decoded image. Bilinear interpolation is a commonly used image upsampling method that calculates the grayscale value of a new pixel by linearly interpolating the grayscale values of adjacent pixels, thereby generating a higher resolution image. Specifically, performing bilinear interpolation on the second feature image to obtain the decoded image includes: determining an upsampling ratio; for example, if the size of the second feature image is 64x64 pixels, and it is enlarged to 128x128 pixels, then the upsampling ratio is 2. Next, bilinear interpolation is performed. For each pixel position (x', y') in the target image, its corresponding floating-point coordinates (x, y) in the second feature image are calculated. This is achieved by dividing the coordinates of the target pixel by the upsampling ratio, i.e., x = x' / ratio, y = y' / ratio. The four pixels with the four nearest integer coordinates to the calculated floating-point coordinates (x, y) in the second feature image are found; these four pixels are typically located in a 2x2 grid. For each row, using the grayscale values of the top-left and top-right pixels, calculate the interpolated pixel grayscale value at the corresponding position in that row based on the ratio of the floating-point coordinate x to the x-coordinate of these two pixels. Similarly, perform the same operation for the bottom-left and bottom-right pixels to obtain the grayscale value of another interpolated pixel in that row. Using the grayscale values of the two interpolated pixels calculated in the previous step, calculate the final grayscale value of the target pixel based on the ratio of the floating-point coordinate y to the y-coordinate of these two interpolated pixels. Assign the calculated grayscale value to the corresponding pixel position in the target image. Repeat the above operation until all pixels in the target image have been processed, thus completing bilinear interpolation and obtaining the second feature image.
[0210] The purpose of upsampling the second feature image through an upsampling layer to obtain the decoded image is to restore the detailed information and spatial resolution of the image or feature, so that it is restored to the same image size as the target image.
[0211] In this embodiment of the application, a main decoding network is set up, which includes multiple decoders and upsampling layers connected in sequence. Each decoder includes a self-attention layer. Through the cooperative use of each layer and the clustering results, the amount of computation in the image decompression process is reduced, thereby reducing the cost of image decompression.
[0212] Furthermore, as shown in Figure 11, the decoded image is processed using a super-resolution network to obtain the target image for the target process, including:
[0213] Step S0321: Traverse each pixel in the decoded image using a super-resolution network.
[0214] Decoded images have lower resolution due to limitations of the acquisition equipment, encoding compression, or losses during transmission.
[0215] Super-resolution networks typically consist of multiple convolutional and activation layers. These components work together to extract image features from the decoded image, learn residual information, and achieve resolution enhancement. Convolutional layers are configured to extract both shallow and deep features from the decoded image, which are crucial for subsequent residual learning and resolution enhancement. The residual block is one of the core components of a super-resolution network. By learning the residual between the input and output, the network can more easily learn the mapping relationship between the high-resolution image (the target image) and the low-resolution image (the decoded image). This learning method helps reduce the training difficulty of the network and improves the model's performance.
[0216] A super-resolution network iterates through each pixel of the decoded image to extract image features. These features are then fed into a non-linear mapping layer, which uses deep learning techniques such as convolutional layers and activation functions to learn the mapping relationship from low-resolution features to high-resolution features. This is the most crucial part of the super-resolution network because it determines whether the network can accurately recover the details of the high-resolution image. Finally, the output of the non-linear mapping layer is fed into an image reconstruction layer, which uses convolutional operations or other techniques to transform the feature information into a high-resolution image. The goal of the reconstruction layer is to generate an output that is as similar as possible to the real high-resolution image.
[0217] Step S0322: Based on the distribution of each pixel in the decoded image, search for the neighboring pixels of each pixel from the preset knowledge base of the super-resolution network. The preset knowledge base stores the correspondence between compressed image samples under different processes and the target image samples reconstructed from the compressed image samples.
[0218] The compressed image samples are low-resolution samples, while the target image samples are high-resolution samples.
[0219] Pixels in a decoded image are often not independent entities, but rather exist in spatial relationships or distribution patterns with their neighboring pixels. These distribution patterns of neighboring pixels are crucial for understanding the overall structure and details of the image. When processing decoded images, super-resolution networks analyze each pixel and its surrounding local context. The super-resolution network utilizes the knowledge learned during training—namely, the matching distribution experience—to infer the details and structures that these pixels might correspond to in a high-resolution image.
[0220] Step S0323: Reconstruct the decoded image based on the adjacent pixels of each pixel to obtain the target image under the target process.
[0221] Super-resolution networks interpolate missing high-frequency details by understanding and applying the distribution patterns of neighboring pixels and the experience learned from training data, thereby generating a more realistic and detailed high-resolution image, i.e., the target image.
[0222] In this embodiment, a super-resolution network is an image processing technique designed to convert low-resolution decoded images into high-resolution images. By learning the mapping relationships between a large number of high-resolution and low-resolution image pairs, high-resolution images can be generated, thereby improving the fidelity of the target image.
[0223] In some embodiments of this application, as shown in FIG12, the image processing method further includes:
[0224] Step S110: The initial super-resolution network is trained using preset compressed image samples under different processes and preset target image samples reconstructed from the preset compressed image samples, to obtain the trained super-resolution network.
[0225] Before training, high-quality image datasets are collected and prepared. These datasets include pre-compressed image samples under different processing steps and pre-reconstructed target image samples from the pre-compressed image samples. Image samples are preprocessed, such as cropping, scaling, and normalization, to adapt to the network's input requirements. A suitable super-resolution network architecture, such as SRResNet or EDSR, is selected, and a model is built based on this architecture, with network parameters initialized. Finally, appropriate loss functions, such as mean squared error and peak signal-to-noise ratio, are designed to evaluate the performance of the super-resolution network.
[0226] During training, optimization algorithms such as Adam and SGD are used to train the super-resolution network. In each training iteration, the input image is propagated forward through the network to calculate the loss function value, and the network parameters are updated using the backpropagation algorithm. The loss function value and validation set performance are monitored during training to adjust the learning rate, optimizer parameters, etc.
[0227] After training, evaluate the performance of the super-resolution network using a validation set. Save the trained super-resolution network model for later use.
[0228] Step S120: Freeze the network parameters of the trained super-resolution network.
[0229] The network parameters of a super-resolution network include, but are not limited to: convolutional layer parameters such as kernel size and stride; fully connected layer parameters such as number of neurons and weights; learning rate; regularization parameters; and optimizer parameters. It is important to note that different super-resolution network architectures may contain different network layer types and parameters. Therefore, when designing and training a super-resolution network, it is necessary to select an appropriate network architecture and parameter configuration based on the specific task and dataset characteristics. The network parameters of a super-resolution network can be set to an untrainable, or frozen, state.
[0230] Step S130: Using preset target image samples and corresponding preset compressed image samples under different processes, the initial master coding network, initial probabilistic coding network, entropy coding network, initial probabilistic decoding network, entropy decoding network and initial master decoding network are jointly trained to obtain the trained master coding network, probabilistic coding network, entropy coding network, probabilistic decoding network, entropy decoding network and master decoding network.
[0231] During training, preset target image samples and corresponding preset compressed image samples from different processing steps are used to jointly train the initial master encoder network, initial probabilistic encoder network, entropy encoder network, initial probabilistic decoder network, entropy decoder network, and initial master decoder network. In each training iteration, input data, such as low-resolution images or latent feature vectors, is propagated forward through the network to calculate the loss function value, and the parameters of the decoder network are updated using the backpropagation algorithm. Since the parameters of the super-resolution network are frozen, they are not updated during training. After training, the performance of the decoder network is evaluated using a validation set; the trained decoder network model is saved for subsequent use.
[0232] Step S140: Unfreeze the network parameters of the trained super-resolution network.
[0233] Load the previously frozen super-resolution network and set its network parameters to a trainable (unfrozen) state.
[0234] Step S150: Jointly train the trained master decoding network and the trained super-resolution network to obtain the jointly trained master decoding network and super-resolution network, and perform image reconstruction based on the jointly trained master decoding network and super-resolution network.
[0235] Joint training refers to simultaneously training the super-resolution network and the master decoder network, enabling them to work together to complete the decompression task. In joint training, the super-resolution network and the master decoder network are typically jointly optimized, meaning their parameters are updated simultaneously during training. This can be achieved by first training the master encoder network, probabilistic encoder network, entropy encoder network, probabilistic decoder network, entropy decoder network, and then the master decoder network; or by first training the super-resolution network separately, and then jointly training the super-resolution network and the master decoder network. This results in jointly trained super-resolution and master decoder networks, improving both the efficiency and quality of the jointly trained networks.
[0236] In one feasible implementation, during the joint training of the trained master decoding network and the trained super-resolution network, the trained super-resolution network and the master decoding network are connected to form a joint network, ensuring that the inputs and outputs of the two networks can be correctly matched. A suitable joint loss function is designed to simultaneously evaluate the performance of the super-resolution network and the master decoding network. The loss function may include loss components from the super-resolution network and the master decoding network, as well as possible regularization terms. During training, an optimization algorithm is used to train the joint network; in each training iteration, the input data is forward-propagated through the network, the joint loss function value is calculated, and the parameters of the super-resolution network and the decoding network are simultaneously updated using a backpropagation algorithm. The joint loss function value and validation set performance are monitored during training to adjust the learning rate, optimizer parameters, etc. After training, the performance of the joint network is evaluated using a validation set; the trained joint network model is saved for subsequent use or deployment.
[0237] In this embodiment, by jointly training the super-resolution network and the main decoding network, a jointly trained super-resolution network and main decoding network are obtained. Joint training allows the super-resolution network and main decoding network to adapt to each other and optimize collaboratively during training. This synergy helps improve the performance of the entire system because the two networks can jointly learn how to process input data more effectively and produce more accurate output. Furthermore, through joint training, the super-resolution network can learn how to adapt to input images of different qualities and resolutions, thereby generating higher quality output. In addition, during the inference phase, the jointly trained network can be processed as a whole, thereby reducing the overhead of data transfer between different networks and improving computational efficiency.
[0238] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0239] Secondly, as shown in Figure 13, to achieve the above objectives, this application provides an image processing apparatus, which includes:
[0240] The acquisition module 10 is configured to acquire the target image under the target process, and to acquire the clustering results of each pixel in the target image.
[0241] The feature extraction module 20 is configured to extract features from the target image based on the clustering results of each pixel, thereby obtaining the first latent space features of the target image.
[0242] The encoding module 30 is configured to encode the first latent space features to obtain a compressed image of the target image.
[0243] In some embodiments of this application, the feature extraction module 20 is further configured to: input the clustering results of each pixel and the target image into a main encoding network, wherein the main encoding network includes a first image segmentation layer and a plurality of encoders connected in sequence, each encoder including a downsampling layer and a self-attention layer connected in sequence; divide the target image into a plurality of image blocks through the first image segmentation layer; perform downsampling processing on each image block through the downsampling layer in the encoder to obtain each downsampled image block; obtain the self-attention weight of each pixel in each downsampled image block based on the clustering results of the pixels in each downsampled image block and each downsampled image block through the self-attention layer in the encoder; and obtain the first latent space features of the target image according to the self-attention weight of each pixel in each downsampled image block.
[0244] In some embodiments of this application, the feature extraction module 20 is further configured to: perform convolution operations on each pixel in each image block using a horizontal kernel and a vertical kernel respectively through the downsampling layer in the encoder to obtain the horizontal gradient and vertical gradient of each pixel; determine the gradient magnitude of each pixel based on the horizontal gradient and vertical gradient of each pixel; obtain pixels with gradient magnitudes greater than a preset gradient magnitude; and obtain each downsampled image block based on the pixels with gradient magnitudes greater than the preset gradient magnitude.
[0245] In some embodiments of this application, the feature extraction module 20 is further configured to: extract the query vector of the first pixel in the downsampled image block, and extract the key vector of each second pixel in the category to which the first pixel belongs, wherein the second pixel is any pixel in the category to which the first pixel belongs other than the first pixel; determine the attention score between the query vector and the key vector of each second pixel; normalize each attention score to obtain the self-attention weight of the first pixel; and sequentially take each pixel in the downsampled image block as the first pixel to obtain the self-attention weight of each pixel in the downsampled image block.
[0246] In some embodiments of this application, the acquisition module 10 is further configured to: randomly select a preset number of pixels from the target image as initial cluster centers; determine the distance between each pixel in the target image and each cluster center; and assign each pixel in the target image to the category to which the nearest cluster center belongs based on the distance, thereby obtaining the clustering result of each pixel in the target image.
[0247] In some embodiments of this application, the acquisition module 10 is further configured to: assign each pixel in the target image to the category to which the nearest cluster center belongs, based on the distance; if a change in the cluster center is detected, calculate the average pixel value of each category based on the pixels in each category, update the cluster center using the average pixel value, and return to determine the distance between each pixel in the target image and each cluster center; and / or, if no change in the cluster center is detected, obtain the clustering result of each pixel based on the category to which each pixel belongs.
[0248] In some embodiments of this application, the encoding module 30 is further configured to: encode the first latent space features through a probabilistic encoding network of the entropy probability model to obtain the second latent space features; quantize the second latent space features through a quantizer of the entropy probability model to obtain the quantized second latent space features; and encode the quantized second latent space features through an entropy encoding network of the entropy probability model to obtain a compressed image of the target image.
[0249] In some embodiments of this application, the image processing apparatus further includes a decoding module, which is configured to: decode the compressed image through an entropy decoding network of an entropy probability model to obtain a third latent space feature; decode the third latent space feature through a probability decoding network of an entropy probability model to obtain a fourth latent space feature; and decode the fourth latent space feature through a main decoding network to obtain the target image under the target process.
[0250] In some embodiments of this application, the decoding module is further configured to: decode the fourth latent space features through the main decoding network to obtain a decoded image; and process the decoded image through a super-resolution network to obtain a target image under the target process.
[0251] In some embodiments of this application, the decoding module is further configured to: input the first feature image generated by the fourth latent space features and the clustering results of each pixel in the first feature image into the main decoding network, wherein the main decoding network includes multiple decoders and an upsampling layer connected in sequence, and each decoder includes a self-attention layer; obtain the self-attention weight of each pixel in the first feature image based on the clustering results of each pixel in the first feature image and the first feature image through the self-attention layer in the decoder; obtain the second feature image according to the self-attention weight of each pixel in the first feature image; and perform upsampling processing on the second feature image through the upsampling layer to obtain the decoded image.
[0252] In some embodiments of this application, the decoding module is further configured to: search for neighboring pixels of each pixel from a preset knowledge base of the super-resolution network according to the distribution of each pixel in the decoded image, wherein the preset knowledge base stores the correspondence between compressed image samples under different processes and target image samples reconstructed from the compressed image samples; and reconstruct the decoded image according to the neighboring pixels of each pixel to obtain the target image under the target process.
[0253] In some embodiments of this application, the image processing apparatus further includes a training module, which is configured to: train an initial super-resolution network using preset compressed image samples under different processes and preset target image samples reconstructed from the preset compressed image samples to obtain a trained super-resolution network; freeze the network parameters of the trained super-resolution network; jointly train an initial master coding network, an initial probabilistic coding network, an entropy coding network, an initial probabilistic decoding network, an entropy decoding network, and an initial master decoding network using preset target image samples under different processes and corresponding preset compressed image samples to obtain a trained master coding network, a probabilistic coding network, an entropy coding network, a probabilistic decoding network, an entropy decoding network, and a master decoding network; unfreeze the network parameters of the trained super-resolution network; and jointly train the trained master decoding network and the trained super-resolution network to obtain a jointly trained master decoding network and a super-resolution network, so as to perform image restoration based on the jointly trained master decoding network and the super-resolution network.
[0254] The image processing apparatus provided in this application, employing the image processing method described in the above embodiments, can alleviate the problem of high computational load in image compression, leading to increased image compression costs. Compared with the prior art, the beneficial effects of the image processing apparatus provided in this application are the same as those of the image processing method described in the above embodiments, and other technical features in the image processing apparatus are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.
[0255] Thirdly, to achieve the above objectives, this application provides an image processing apparatus, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which are executed by the at least one processor to enable the at least one processor to perform the above-described image processing method.
[0256] Referring now to Figure 14, a schematic diagram of an image processing device suitable for implementing embodiments of this application is shown. The image processing device in embodiments of this application may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. The image processing device shown in Figure 14 is merely an example and should not impose any limitations on the functionality and scope of use of embodiments of this application.
[0257] As shown in Figure 14, the image processing device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1003 into a random access memory (RAM) 1004. The RAM 1004 also stores various programs and data required for the operation of the image processing device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touchscreen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1003 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. Communication device 1009 allows the image processing device to communicate wirelessly or wiredly with other devices to exchange data. Although the figure shows an image processing device with various systems, it should be understood that it is not required to implement or possess all of the systems shown. More or fewer systems may be implemented alternatively.
[0258] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code that performs the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.
[0259] The image processing device provided in this application, employing the image processing method described in the above embodiments, can alleviate the problem of high computational load in image compression, leading to increased image compression costs. Compared with the prior art, the beneficial effects of the image processing device provided in this application are the same as those of the image processing method described in the above embodiments, and other technical features of this image processing device are the same as those disclosed in the previous embodiment method, and will not be repeated here.
[0260] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.
[0261] Fourthly, to achieve the above objectives, this application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being configured to perform the image processing method described in the above embodiments.
[0262] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0263] The aforementioned computer-readable storage medium may be included in an image processing device or may exist independently without being assembled into an image processing device.
[0264] The aforementioned computer-readable storage medium carries one or more programs that, when executed by the image processing device, can alleviate the problem of increased image compression costs due to the large computational load of image compression.
[0265] Computer program code configured to perform the operations of this application can be written in one or more programming languages or a combination thereof. These programming languages include object-oriented programming languages—such as Java, Smalltalk, C++, and Python—and conventional procedural programming languages—such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0266] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions configured to implement a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0267] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.
[0268] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described image processing method. This alleviates the problem of high computational load in image compression, which leads to increased image compression costs. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the image processing method provided in the above embodiments, and will not be repeated here.
[0269] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and not to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. These modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application, and they should all be covered within the scope of the claims and specification of this application. In particular, as long as there is no structural conflict, the various technical features mentioned in the embodiments can be combined in any way. This application is not limited to the specific embodiments disclosed herein, but includes all technical solutions falling within the scope of the claims.