A picture texture compression method, system, computer and storage medium
By optimizing texture compression through autoencoder neural networks and multi-objective loss functions, and combining bin packing algorithms and GPU hardware acceleration, the problems of poor texture compression accuracy and low compression ratio in existing technologies are solved, achieving efficient texture quality restoration and high compression efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-08
- Publication Date
- 2026-03-17
AI Technical Summary
Existing technologies suffer from poor texture compression accuracy and low compression ratio, failing to effectively preserve color information while maintaining a high compression ratio.
An autoencoder neural network is used, combined with an asymmetric depth encoder and a lightweight decoder. The texture reconstruction quality is optimized through a multi-objective hybrid loss function, and the image processing flow is optimized by using a binning algorithm. Quantization compression is performed by combining the hardware acceleration capabilities of modern GPUs.
It significantly improves the fidelity of texture image quality and enhances compression and decompression efficiency, making it suitable for scenarios with fixed textures, such as digital twin applications.
Smart Images

Figure CN121482177B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image data processing technology, and in particular to an image texture compression method, system, computer, and storage medium. Background Technology
[0002] Texture compression is a key technology in computer graphics used to reduce texture data storage space and transmission bandwidth, and is especially important in applications such as real-time rendering, gaming, virtual reality, and digital twins.
[0003] In current technologies, most mainstream texture compression methods on GPUs are based on block compression (BC) schemes. The core principle of this scheme is to achieve compression by reducing data precision. Although this method can achieve a certain compression effect, it has significant limitations. To achieve a high compression ratio, a large amount of color information will inevitably be lost, and the highest compression ratio can only be 6:1. Summary of the Invention
[0004] In view of the shortcomings of the prior art, the purpose of this invention is to provide an image texture compression method, system, computer and storage medium, which aims to solve the technical problems of poor texture compression accuracy and low compression rate in the prior art.
[0005] To achieve the above objectives, in a first aspect, the present invention provides: an image texture compression method, comprising the following steps:
[0006] Obtain the set of images to be packaged, create a canvas of a preset pixel size, traverse the set of images, perform a boxing operation on each image, obtain a canvas set of a specified size, and generate corresponding image position metadata.
[0007] An autoencoder neural network is trained and overfitting is guided by a multi-objective hybrid loss function based on the canvas set to optimize texture reconstruction quality, wherein the autoencoder includes an asymmetric depth encoder and a lightweight decoder.
[0008] The texture image with uniform size is input into an asymmetric depth encoder to generate an encoding vector, and the encoding vector is then quantized and compressed.
[0009] The quantized encoded vector is input into a lightweight decoder based on the index, and the restored texture image is output.
[0010] According to one aspect of the above technical solution, the step of traversing the image set and performing a binning operation on each image specifically includes:
[0011] Traverse the image collection and sort it according to the pixel size of each image to generate an ordered image queue;
[0012] Traverse the ordered image queue and perform a binning operation on the images based on the canvas;
[0013] If the current image size is smaller than the canvas size, the optimal placement position of the canvas is calculated using the maximum remaining rectangle algorithm, and the current image is pasted into the optimal placement position.
[0014] If any dimension of the current image exceeds the canvas size, the current image is cut into several pixel sub-blocks that do not exceed the canvas size, and the pixel sub-blocks are added to the end of the ordered image queue.
[0015] When the remaining space on the current canvas is insufficient to hold the image, create a new canvas and repeat the boxing operation.
[0016] Output the entire canvas and summarize the metadata of the corresponding image locations to complete the boxing operation of the image set.
[0017] According to one aspect of the above technical solution, the step of calculating the optimal placement position of the canvas using the maximum remaining rectangle algorithm and pasting the current image to the optimal placement position specifically includes:
[0018] Iterate through each row of the canvas, detect and record the top-left pixel coordinates, width, height and area of the largest empty rectangle in each row, and summarize all the largest empty rectangles in the canvas as a record array.
[0019] Read the area of the current image to be inserted, and filter out the subarray of the largest empty rectangles larger than the image area from the record array, and sort the largest empty rectangles in the subarray in ascending order by area;
[0020] Traverse the subarray, find the first empty rectangle whose width and height are both greater than the image width and height as the optimal placement position, and paste the current image into the optimal placement position.
[0021] According to one aspect of the above technical solution, the asymmetric depth encoder includes the following modules connected in sequence: two 3x3 convolutional modules, one max pooling module, 34 improved ResNet modules, one dual attention module, and one 1x1 convolutional module; wherein, the improved ResNet module replaces the ReLU activation function with the PReLU activation function;
[0022] The lightweight decoder includes the following modules connected in sequence: a transposed convolution module, a convolution module, and a pixel shuffling module.
[0023] According to one aspect of the above technical solution, the calculation expression of the multi-objective hybrid loss function is as follows:
[0024] ;
[0025] ;
[0026] ;
[0027] In the formula, For pixel-level reconstruction loss function, For semantic awareness loss function, This is the original image. For image reconstruction, SSIM is the structural similarity index. For the feature extraction function of the pre-trained VGG network;
[0028] The steps to optimize texture reconstruction quality by guiding overfitting through a multi-objective mixture loss function include:
[0029] Training is performed based on the pixel-level reconstruction loss function, prioritizing the preservation of structural similarity, suppressing blurring caused by mean square error, and quickly converging to a stable state.
[0030] Training is performed based on the multi-objective hybrid loss function to optimize texture reconstruction quality.
[0031] According to one aspect of the above technical solution, the steps of inputting a texture image of uniform size into an asymmetric depth encoder to generate an encoding vector, and performing quantization and compression processing on the encoding vector specifically include:
[0032] A first neural network is constructed based on the trained asymmetric deep encoder. All texture images that have been normalized by image scale are input into the first neural network to obtain an encoding vector equivalent to the texture image.
[0033] The encoded vectors corresponding to all images are merged row by row to form a two-dimensional matrix. The row index of the vector corresponding to each image in the two-dimensional matrix is established, and the two-dimensional matrix is quantized by INT8 to obtain the image vector data.
[0034] According to one aspect of the above technical solution, the step of inputting the quantized encoded vector into a lightweight decoder based on the index and outputting the restored texture image specifically includes:
[0035] A second neural network is built based on the trained lightweight decoder, and image vector data is input into the decoding module.
[0036] Input the row index corresponding to any image, find the row vector corresponding to the row index in the image vector data, and convert the row vector into the fp16 data type to obtain the target image vector;
[0037] The target image vector is input into the second neural network, and the restored texture image is output.
[0038] Secondly, the present invention provides an image texture compression system, comprising:
[0039] The binning module is used to obtain a set of images to be packaged, establish a canvas of a preset pixel size, traverse the set of images, perform binning operations on each image, obtain a canvas set of a specified size, and generate corresponding image position metadata.
[0040] An optimization module trains an autoencoder neural network and guides overfitting based on the canvas set using a multi-objective hybrid loss function to optimize texture reconstruction quality, wherein the autoencoder includes an asymmetric depth encoder and a lightweight decoder.
[0041] The encoding and compression module is used to input the texture image of uniform size into the asymmetric depth encoder to generate the encoding vector, and to perform quantization and compression processing on the encoding vector;
[0042] The decompression module is used to input the quantized encoded vector into the lightweight decoder according to the index and output the restored texture image.
[0043] According to one aspect of the above technical solution, the packing module is specifically used for:
[0044] Traverse the image collection and sort it according to the pixel size of each image to generate an ordered image queue;
[0045] Traverse the ordered image queue and perform a binning operation on the images based on the canvas;
[0046] If the current image size is smaller than the canvas size, the optimal placement position of the canvas is calculated using the maximum remaining rectangle algorithm, and the current image is pasted into the optimal placement position.
[0047] If any dimension of the current image exceeds the canvas size, the current image is cut into several pixel sub-blocks that do not exceed the canvas size, and the pixel sub-blocks are added to the end of the ordered image queue.
[0048] When the remaining space on the current canvas is insufficient to hold the image, create a new canvas and repeat the boxing operation.
[0049] Output the entire canvas and summarize the metadata of the corresponding image locations to complete the boxing operation of the image set.
[0050] According to one aspect of the above technical solution, the bin packing module is further used to: traverse each row of the canvas, detect and record the top-left pixel coordinates, width, height and area of the largest empty rectangle in each row, and summarize all the largest empty rectangles in the canvas as a record array.
[0051] Read the area of the current image to be inserted, and filter out the subarray of the largest empty rectangles larger than the image area from the record array, and sort the largest empty rectangles in the subarray in ascending order by area;
[0052] Traverse the subarray, find the first empty rectangle whose width and height are both greater than the image width and height as the optimal placement position, and paste the current image into the optimal placement position.
[0053] According to one aspect of the above technical solution, the encoding compression module is specifically used to: construct a first neural network based on the trained asymmetric depth encoder, and input all texture images after image scale normalization into the first neural network to obtain an encoding vector equivalent to the texture image;
[0054] The encoded vectors corresponding to all images are merged row by row to form a two-dimensional matrix. The row index of the vector corresponding to each image in the two-dimensional matrix is established, and the two-dimensional matrix is quantized by INT8 to obtain the image vector data.
[0055] According to one aspect of the above technical solution, the decompression module is specifically used to: construct a second neural network based on the lightweight decoder after training, and input image vector data into the decoding module;
[0056] Input the row index corresponding to any image, find the row vector corresponding to the row index in the image vector data, and convert the row vector into the fp16 data type to obtain the target image vector;
[0057] The target image vector is input into the second neural network, and the restored texture image is output.
[0058] Thirdly, the present invention provides a computer, including a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor, when executing the computer program, implements the image texture compression method as described in the above technical solution.
[0059] Fourthly, the present invention provides a storage medium storing a computer program thereon, which, when executed by a processor, implements the image texture compression method as described in the above technical solution.
[0060] Compared with existing technologies, the beneficial effects of this invention are as follows: by utilizing active overfitting design and multi-objective loss functions, the reproduction accuracy of texture image quality is significantly improved while greatly reducing the amount of data; for scenarios with fixed textures such as digital twins, the processing flow is optimized by image packaging and boxing, and the hardware acceleration capability of modern GPUs for convolution operations is fully utilized, resulting in high compression and decompression efficiency, with significant practical value and performance advantages. Attached Figure Description
[0061] Figure 1 This is a flowchart illustrating the image texture compression method in the first embodiment of the present invention;
[0062] Figure 2 This is a structural block diagram of the image texture compression system in the second embodiment of the present invention;
[0063] Figure 3 This is a schematic diagram of the hardware structure of the computer in the third embodiment of the present invention;
[0064] The following detailed description, in conjunction with the accompanying drawings, will further illustrate the present invention. Detailed Implementation
[0065] To facilitate understanding of the present invention, a more complete description will be given below with reference to the accompanying drawings. Several embodiments of the invention are illustrated in the drawings. However, the invention can be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete.
[0066] It should be noted that when a component is said to be "fixed to" another component, it can be directly on the other component or there may be an intervening component. When a component is said to be "connected to" another component, it can be directly connected to the other component or there may be an intervening component. The terms "vertical," "horizontal," "left," "right," and similar expressions used in this document are for illustrative purposes only.
[0067] 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 invention pertains. The terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0068] Example 1
[0069] Please see Figure 1 The figure shows a flowchart of the image texture compression method in the first embodiment of the present invention. As shown in the figure, the method includes the following steps:
[0070] Step S100: Obtain the set of images to be packaged, establish a canvas of a preset pixel size, traverse the set of images, perform a boxing operation on each image, obtain a canvas set of a specified size, and generate corresponding image position metadata.
[0071] Preferably, in this embodiment, the step of traversing the image set and performing a binning operation on each image specifically includes:
[0072] Step S101: Traverse the image collection and sort it according to the pixel size of each image to generate an ordered image queue. In this embodiment, the sorting method is to arrange the images in descending order of their size. Prioritizing the processing of large-sized images helps to improve the utilization of canvas space.
[0073] Step S102: Traverse the ordered image queue and perform a binning operation on the images based on the canvas.
[0074] Step S103: If the current image size is smaller than the canvas size, calculate the optimal placement position of the canvas using the maximum remaining rectangle algorithm and paste the current image into the optimal placement position.
[0075] Preferably, the steps of calculating the optimal placement position of the canvas using the maximum remaining rectangle algorithm and pasting the current image to the optimal placement position specifically include:
[0076] Iterate through each row of the canvas, detect and record the top-left pixel coordinates, width, height and area of the largest empty rectangle in each row, and summarize all the largest empty rectangles in the canvas as a record array.
[0077] Read the area of the current image to be inserted, and filter out the subarray of the largest empty rectangles larger than the image area from the record array, and sort the largest empty rectangles in the subarray in ascending order by area;
[0078] Traverse the subarray, find the first empty rectangle with both width and height greater than the image's width and height as the optimal placement position, and paste the current image into this optimal position. By dynamically monitoring the canvas's empty area, always select the largest contiguous space for placement.
[0079] Step S104: If any dimension of the current image exceeds the canvas size, the current image is cut into several pixel sub-blocks that do not exceed the canvas size, and the pixel sub-blocks are added to the end of the ordered image queue. When any dimension of the image exceeds the canvas size, the image is automatically cut into several sub-blocks that conform to the canvas size (e.g., a 2048x1024 image will be divided into two 1024x1024 sub-blocks in a 1024x1024 canvas), and the newly generated sub-blocks are added back to the processing queue to await subsequent binning.
[0080] Step S105: When the remaining space on the current canvas cannot accommodate the images, a new canvas is created and the boxing operation is repeated. When the remaining space on the current canvas cannot accommodate any unprocessed images (including original images and cut sub-blocks) in the queue after multiple placement operations, a new canvas is automatically created to continue the boxing process until all image elements have been processed.
[0081] Step S106: Output the entire canvas and summarize the metadata of the corresponding image locations to complete the binning operation of the image set. Through the above steps, all textures of different sizes required in a single scene are unified into several textures of the same size through splicing and cropping.
[0082] Step S200: Train the autoencoder neural network and guide overfitting based on the canvas set through a multi-objective hybrid loss function to optimize texture reconstruction quality, wherein the autoencoder includes a lightweight decoder as described in the above technical solution.
[0083] Preferably, in this embodiment, the asymmetric depth encoder includes the following modules connected in sequence: two 3x3 convolutional modules, one max-pooling module, 34 improved ResNet modules, one dual attention module, and one 1x1 convolutional module; wherein, the improved ResNet module replaces the ReLU activation function with the PReLU activation function; the ResNet module changes the activation function from ReLU to PReLU to alleviate gradient vanishing; the dual attention module enhances the ability to extract high-frequency texture features through channel dimension recalibration and spatial position weighting.
[0084] The lightweight decoder includes the following modules connected in sequence: a transposed convolution module, a convolution module, and a pixel shuffling module.
[0085] Preferably, in this embodiment, the calculation expression of the multi-objective hybrid loss function is:
[0086] ;
[0087] ;
[0088] ;
[0089] In the formula, For pixel-level reconstruction loss function, For semantic awareness loss function, This is the original image. For image reconstruction, SSIM is the structural similarity index. For the feature extraction function of the pre-trained VGG network;
[0090] The steps to optimize texture reconstruction quality by guiding overfitting through a multi-objective mixture loss function include:
[0091] Training is performed based on the pixel-level reconstruction loss function, prioritizing the preservation of structural similarity and suppressing blurring caused by mean square error, thus quickly converging to a stable state. This step is coarse training, used for rapid convergence, to avoid early overfitting interfering with the optimization direction.
[0092] Training is performed based on the multi-objective hybrid loss function to optimize texture reconstruction quality; this step is fine training, used to improve training quality.
[0093] Step S300: Input the texture image after uniform size into the asymmetric depth encoder to generate the encoding vector, and perform quantization compression processing on the encoding vector.
[0094] Specifically, in this embodiment, the steps of inputting the texture image of uniform size into an asymmetric depth encoder to generate an encoding vector, and performing quantization and compression processing on the encoding vector, specifically include:
[0095] A first neural network is constructed based on the trained asymmetric deep encoder. All texture images that have been normalized by image scale are input into the first neural network to obtain an encoding vector equivalent to the texture image.
[0096] The encoded vectors corresponding to all images are merged row by row to form a two-dimensional matrix. The row index of the vector corresponding to each image in the two-dimensional matrix is established, and the two-dimensional matrix is quantized by INT8 to obtain the image vector data.
[0097] Step S400: Input the quantized encoded vector into the lightweight decoder according to the index, and output the restored texture image.
[0098] Furthermore, in this embodiment, the step of inputting the quantized encoded vector into the lightweight decoder according to the index and outputting the restored texture image specifically includes:
[0099] A second neural network is built based on the trained lightweight decoder, and image vector data is input into the decoding module.
[0100] Input the row index corresponding to any image, find the row vector corresponding to the row index in the image vector data, and convert the row vector into the fp16 data type to obtain the target image vector;
[0101] The target image vector is input into the second neural network, and the restored texture image is output.
[0102] In summary, the image texture compression method in the above embodiments of the present invention significantly improves the reproduction accuracy of texture image quality while greatly reducing the amount of data by utilizing active overfit design and multi-objective loss function; for scenarios with fixed textures such as digital twins, the processing flow is optimized by image packaging and boxing, and the hardware acceleration capability of modern GPUs for convolution operations is fully utilized, resulting in high compression and decompression efficiency, and has significant practical value and performance advantages.
[0103] Example 2
[0104] A second embodiment of this application also provides an image texture compression system for implementing the embodiments and preferred embodiments described herein, which will not be repeated hereafter. As used below, the terms "module," "unit," "subunit," etc., can refer to a combination of software and / or hardware that performs a predetermined function. Although the system described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0105] like Figure 2 As shown, the system includes: a packing module 100, an optimization module 200, an encoding and compression module 300, and a decompression module 400.
[0106] The binning module 100 is used to obtain a set of images to be packaged, establish a canvas of a preset pixel size, traverse the set of images, perform binning operations on each image, obtain a canvas set of a specified size, and generate corresponding image position metadata.
[0107] The optimization module 200 trains an autoencoder neural network and guides overfitting based on the canvas set through a multi-objective hybrid loss function to optimize texture reconstruction quality, wherein the autoencoder includes an asymmetric depth encoder and a lightweight decoder.
[0108] The encoding and compression module 300 is used to input the texture image of uniform size into the asymmetric depth encoder to generate the encoding vector, and to perform quantization and compression processing on the encoding vector;
[0109] The decompression module 400 is used to input the quantized encoded vector into the lightweight decoder according to the index and output the restored texture image.
[0110] Preferably, in this embodiment, the packing module 100 is specifically used for:
[0111] Traverse the image collection and sort it according to the pixel size of each image to generate an ordered image queue;
[0112] Traverse the ordered image queue and perform a binning operation on the images based on the canvas;
[0113] If the current image size is smaller than the canvas size, the optimal placement position of the canvas is calculated using the maximum remaining rectangle algorithm, and the current image is pasted into the optimal placement position.
[0114] If any dimension of the current image exceeds the canvas size, the current image is cut into several pixel sub-blocks that do not exceed the canvas size, and the pixel sub-blocks are added to the end of the ordered image queue.
[0115] When the remaining space on the current canvas is insufficient to hold the image, create a new canvas and repeat the boxing operation.
[0116] Output the entire canvas and summarize the metadata of the corresponding image locations to complete the boxing operation of the image set.
[0117] Preferably, in this embodiment, the bin packing module 100 is further used to: traverse each row of the canvas, detect and record the top-left pixel coordinates, width, height and area of the largest empty rectangle in each row, and summarize all the largest empty rectangles in the canvas as a record array.
[0118] Read the area of the current image to be inserted, and filter out the subarray of the largest empty rectangles larger than the image area from the record array, and sort the largest empty rectangles in the subarray in ascending order by area;
[0119] Traverse the subarray, find the first empty rectangle whose width and height are both greater than the image width and height as the optimal placement position, and paste the current image into the optimal placement position.
[0120] Preferably, in this embodiment, the encoding compression module 300 is specifically used to: construct a first neural network based on the trained asymmetric depth encoder, and input all texture images after image scale normalization into the first neural network to obtain an encoding vector equivalent to the texture image;
[0121] The encoded vectors corresponding to all images are merged row by row to form a two-dimensional matrix. The row index of the vector corresponding to each image in the two-dimensional matrix is established, and the two-dimensional matrix is quantized by INT8 to obtain the image vector data.
[0122] Preferably, in this embodiment, the decompression module 400 is specifically used to: construct a second neural network based on the trained lightweight decoder, and input image vector data into the decoding module;
[0123] Input the row index corresponding to any image, find the row vector corresponding to the row index in the image vector data, and convert the row vector into the fp16 data type to obtain the target image vector;
[0124] The target image vector is input into the second neural network, and the restored texture image is output.
[0125] It should be noted that the modules can be functional modules or program modules, and can be implemented in software or hardware. For modules implemented in hardware, the modules can reside in the same processor; or the modules can be located in different processors in any combination.
[0126] Example 3
[0127] A third embodiment of this application provides a computer that may include a processor 81 and a memory 82 storing computer program commands.
[0128] Specifically, the processor 81 may include a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.
[0129] The memory 82 may include a large-capacity storage device for data or commands. For example, and not limitingly, the memory 82 may include a hard disk drive (HDD), a floppy disk drive, a solid-state drive (SSD), flash memory, an optical disk drive, a magneto-optical disk drive, magnetic tape, or a Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, the memory 82 may include removable or non-removable (or fixed) media. Where appropriate, the memory 82 may be internal or external to a data processing device. In a particular embodiment, the memory 82 is non-volatile memory. In a particular embodiment, the memory 82 includes read-only memory (ROM) and random access memory (RAM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), an electrically alterable read-only memory (EAROM), or flash memory, or a combination of two or more of these. Where appropriate, the RAM can be Static Random-Access Memory (SRAM) or Dynamic Random-Access Memory (DRAM). DRAM can be Fast Page Mode Dynamic Random-Access Memory (FPMDRAM), Extended Data Out Dynamic Random-Access Memory (EDODRAM), Synchronous Dynamic Random-Access Memory (SDRAM), etc.
[0130] The memory 82 can be used to store or cache various data files that need to be processed and / or communicated, as well as possible computer program commands executed by the processor 81.
[0131] The processor 81 implements any of the image texture compression methods described in the above embodiments by reading and executing computer program commands stored in the memory 82.
[0132] In some embodiments, the computer may further include a communication interface 83 and a bus 80. For example, Figure 3 As shown, the processor 81, memory 82, and communication interface 83 are connected through bus 80 and complete communication with each other.
[0133] The communication interface 83 is used to enable communication between the various modules, devices, units, and / or equipment in the embodiments of this application. The communication interface 83 can also enable data communication with other components such as external devices, image / data acquisition devices, databases, external storage, and image / data processing workstations.
[0134] Bus 80 includes hardware, software, or both, that couples computer components together. Bus 80 includes, but is not limited to, at least one of the following: data bus, address bus, control bus, expansion bus, and local bus. For example, and not as a limitation, bus 80 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses, or a combination of two or more of these. Where appropriate, bus 80 may include one or more buses. Although specific buses are described and illustrated in the embodiments of this application, this application considers any suitable bus or interconnection.
[0135] Example 4
[0136] The fourth embodiment of this application provides a readable storage medium. This readable storage medium stores computer program commands; when executed by a processor, these computer program commands implement any of the image texture compression methods described in the above embodiments.
[0137] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0138] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A method of picture texture compression, characterized by, The method comprises the following steps: acquiring a picture set to be packed, establishing a canvas with a preset pixel size, traversing the picture set, performing a packing operation on each picture to obtain a canvas set with a specified size, and generating corresponding picture position metadata; training a self-encoder neural network and guiding overfitting based on the canvas set through a multi-objective hybrid loss function to optimize texture reconstruction quality, wherein the self-encoder comprises an asymmetric deep encoder and a lightweight decoder; inputting the texture picture of a uniform size into the asymmetric deep encoder to generate an encoding vector, and performing quantization compression processing on the encoding vector; inputting the quantized encoding vector into the lightweight decoder according to an index to output a restored texture picture; wherein the asymmetric deep encoder comprises the following modules connected in sequence: two 3x3 convolution modules, one maximum pooling module, 34 improved ResNet modules, one double attention module, and one 1x1 convolution module; wherein the improved ResNet module replaces the ReLU activation function with a PReLU activation function; the lightweight decoder comprises the following modules connected in sequence: one transpose convolution module, one convolution module, and one pixel shuffling module; the calculation expression of the multi-objective hybrid loss function is: ; ; ; In the formula, is a pixel-level reconstruction loss function, is a semantic-aware loss function, is an original picture, is a reconstructed picture, and SSIM is a structural similarity index, is a feature extraction function of a pre-trained VGG network; the step of guiding overfitting through the multi-objective hybrid loss function to optimize texture reconstruction quality specifically comprises: based on the pixel-level reconstruction loss function, preferentially retaining structural similarity and suppressing blurring caused by mean square error to quickly converge to a stable state; based on the multi-objective hybrid loss function, training is performed to optimize texture reconstruction quality.
2. The picture texture compression method of claim 1, wherein, The step of traversing the picture set and performing a packing operation on each picture specifically comprises: traversing the picture set and sorting the pictures according to their pixel size to generate an ordered picture queue; traversing the ordered picture queue and performing a packing operation on the pictures based on the canvas; if the size of the current picture is smaller than the size of the canvas, calculating the optimal placement position of the canvas through the maximum residual rectangle algorithm and pasting the current picture to the optimal placement position; if any dimension of the current picture exceeds the size of the canvas, cutting the current picture into a plurality of pixel subblocks that do not exceed the size of the canvas and adding the pixel subblocks to the end of the ordered picture queue; when the remaining space of the current canvas cannot accommodate the picture, creating a new canvas and repeating the packing operation; outputting all the canvases and summarizing the metadata of the corresponding picture positions to complete the packing operation of the picture set.
3. The picture texture compression method of claim 2, wherein, The step of calculating the optimal placement position of the canvas through the maximum residual rectangle algorithm and pasting the current picture to the optimal placement position specifically comprises: traversing each row of the canvas, detecting and recording the top-left pixel coordinates, width, height, and area of the maximum residual rectangle of each row, and summarizing all the maximum residual rectangles in the canvas as a record array; reading the area of the current picture to be inserted, and selecting a subarray of the maximum residual rectangles from the record array whose areas are greater than the area of the picture, and sorting the maximum residual rectangles in the subarray in ascending order according to their areas; Traverse the sub-array, find the first maximum spare rectangle where the width and height are greater than the picture width and height as the optimal placement position, and paste the current picture to the optimal placement position.
4. The picture texture compression method of claim 1, wherein, The step of inputting the normalized size texture picture into the asymmetric depth encoder to generate an encoding vector and performing quantization compression processing on the encoding vector specifically includes: Based on the trained asymmetric depth encoder, a first neural network is constructed, and all texture pictures after picture scale normalization are input into the first neural network to obtain an equivalent encoding vector of the texture picture. The encoding vectors corresponding to all pictures are merged to form a two-dimensional matrix, the row index of each picture corresponding vector in the two-dimensional matrix is established, and the two-dimensional matrix is quantized to obtain image vector data.
5. The picture texture compression method of claim 4, wherein, The step of inputting the quantized encoding vector into the lightweight decoder according to the index and outputting the restored texture picture specifically includes: Based on the trained lightweight decoder, a second neural network is constructed, and the image vector data is input into the decoding module. Input the row index corresponding to any picture, find the row vector corresponding to the row index in the image vector data, and convert the row vector to an fp16 data type to obtain a target image vector. The target image vector is input into the second neural network to output the restored texture picture.
6. A picture texture compression system based on the picture texture compression method according to any one of claims 1 to 5, characterized in that, It includes: The binning module is configured to obtain a picture set to be packed, establish a canvas with a preset pixel size, traverse the picture set, perform binning operation on each picture, obtain a canvas set with a specified size, and generate corresponding picture position metadata; The optimization module trains a self-encoder neural network and guides overfitting based on the canvas set through a multi-objective hybrid loss function to optimize texture reconstruction quality, wherein the self-encoder includes an asymmetric depth encoder and a lightweight decoder; The encoding compression module is configured to input the normalized size texture picture into the asymmetric depth encoder to generate an encoding vector, and perform quantization compression processing on the encoding vector; The decompression module is configured to input the quantized encoding vector into the lightweight decoder according to the index, and output the restored texture picture.
7. A computer comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program to realize the picture texture compression method of any one of claims 1-5.
8. A storage medium having stored thereon a computer program, characterized in that The program is executed by the processor to realize the picture texture compression method of any one of claims 1-5. The program is executed by the processor to realize the picture texture compression method of any one of claims 1-5.
Citation Information
Patent Citations
Texture compression and decompression method and device, computer equipment and storage medium
CN112929705A
Lightweight image compression method and terminal
CN117998086A