A method and system for lossless image compression
Processing light field microscopy images through image segmentation and replacement models solves the problem of incomplete processing of redundant data in the existing technology, achieves efficient image lossless compression and fast transmission, and ensures lossless image recovery.
Patent Information
- Application Number
- CN202410782508.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-18
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2044-06-18
AI Technical Summary
Existing image lossless compression methods cannot fully reduce redundant data when processing light field microscopy images, and methods based on convolutional neural networks take a long time to process and cannot effectively process non-repeating continuous data.
The image segmentation model is used to divide the original image into irregular-shaped block images, and through the spatial information analysis model and replacement model, continuous data is replaced based on the preset mapping library, the final compressed data is generated, and the compressed information of multiple replacements is recorded. , forming an image lossless compression package and transmitting it through the optimal transmission method.
It effectively reduces the amount of redundant data in light field microscopy images, improves compression efficiency and speed, and ensures lossless recovery of images after decompression.
Smart Images

Figure CN118354087B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image compression, and in particular to a method and system for lossless image compression. Background Art
[0002] Among the existing image compression technologies, lossless compression methods can achieve completely lossless compression of images, and have received more attention in the field of optical microscopy image compression. First, when the existing image lossless compression methods segment the original image, they segment the original image into fixed-size block images. When processing the redundant data of the block images, if there is a large trend of color and spatial position changes in the block images, the redundant data of the block images cannot be fully reduced. Secondly, since the image compression model built based on the convolutional neural network uses multi-layer convolution to process redundant data of the image, the image compression process takes a long time. In addition, the existing image lossless compression methods propose to use replacement symbols to replace repeated data, but cannot process non-repeated continuous data and cannot fully reduce redundant data.
[0003] Therefore, the present invention provides a method and system for lossless image compression to solve the above problems. Summary of the invention
[0004] In view of the above situation, in order to overcome the defects of the prior art, the present invention provides a method and system for lossless image compression to solve the problem that the existing lossless image compression method cannot sufficiently reduce the redundant data of light field microscopy images.
[0005] In order to achieve the above object, the technical solution adopted by the present invention is as follows: In a first aspect, the present invention provides an image lossless compression method, comprising:
[0006] The original image to be compressed is obtained, and an image segmentation model is used to segment the original image into a number of irregularly shaped block images.
[0007] The block images are processed into initial sequence data of three color channels of R, G and B respectively, and the spatial continuity between the block images is analyzed based on the original image using a spatial information analysis model to obtain the spatial information between the block images.
[0008] Based on the preset replacement model, the continuous data in the initial sequence data that is identical to the preset data in the preset mapping library is replaced in a loop using the replacement symbol corresponding to the preset data to obtain the initial compressed data; the loop ends when the ratio of the initial compressed data to the initial sequence data is less than or equal to the set compression ratio or the initial compressed data cannot be compressed again. At this time, the initial compressed data is the final compressed data, and the compression information of multiple replacements is recorded.
[0009] The original image is compressed according to the compression information to obtain a lossless compression package of the image, wherein the lossless compression package of the image includes final compressed data, spatial information and compression information.
[0010] The optimal transmission bandwidth and the optimal transmission rate of the lossless compression package of the image are analyzed and calculated, and the lossless compression package of the image is transmitted to a designated terminal according to the transmission mode of the optimal transmission bandwidth and the optimal transmission rate.
[0011] The designated terminal uses a preset decompression model to parse the image lossless compression package to obtain the original image.
[0012] Preferably, the image segmentation model uses a first cascade decoder to extract image features rich in image change information from the original image to obtain a global feature map; uses a convolution kernel to extract mutation features of the global feature map, and connects the mutation features with curves to segment the global feature map into a number of irregularly shaped enhanced feature maps; uses deconvolution and position encoding to process each enhanced feature map to obtain irregularly shaped block images.
[0013] Preferably, the spatial information analysis model sorts and marks the positions of each block image according to its position in the original image; converts each block image into three-dimensional data through an encoder; extracts segmentation data at the segmentation position of each adjacent block image in the three-dimensional data; extracts mutation continuous data in the segmentation data based on the spatial attention mechanism; and marks the positions of each mutation continuous data according to the position marks of each block image to obtain spatial information.
[0014] Preferably, when the replacement model processes the initial sequence data, a set compression ratio of image compression and a first mapping library and a second mapping library in a preset mapping library are obtained; continuous data identical to the preset data in the first mapping library is searched for in the initial sequence data, and the continuous data is replaced with a replacement symbol corresponding to the preset data to obtain initial compressed data; continuous data identical to the preset data in the initial compressed data is cyclically searched for, and the continuous data is replaced with a replacement symbol corresponding to the preset data, and the loop is terminated when the ratio of the initial compressed data to the initial sequence data is less than or equal to the set compression ratio or the data in the initial compressed data cannot be replaced, and the last initial compressed data is the final compressed data.
[0015] Preferably, the image lossless compression method also includes: constructing a preset replacement model based on the historical image data, specifically including: a first unit, using an encoder to obtain the initial sequence data of the R, G, and B three-color channels corresponding to a single historical image data; a second unit, using a data processing model to analyze the initial sequence data, counting the number of repetitions of continuous data in the initial sequence data, and when the number of repetitions reaches a set value, generating a replacement symbol corresponding to the continuous data and replacing the continuous data; a third unit, adding the continuous data in the second unit and the replacement symbol corresponding to the continuous data to a preset mapping library, and when the data amount of the initial sequence data is greater than the set data amount, returning to execute the second unit; when the data amount of the initial sequence data is less than or equal to the set data amount, obtaining the final compressed data.
[0016] Preferably, the first replacement of the initial sequence data is analyzed, and the preset data and replacement symbols in the preset mapping library that are used more than a first preset threshold number of times are extracted into the first priority list of the first mapping library; the cyclic replacement of the initial sequence data is analyzed, and the preset data and replacement symbols in the preset mapping library that are used more than a second preset threshold number of times are extracted into the first priority list of the second mapping library.
[0017] Preferably, the image lossless compression method further comprises: constructing a dedicated transmission channel by end-to-end encryption, and transmitting the image lossless compression package by using the dedicated transmission channel.
[0018] Preferably, the preset decompression model parses the lossless compression package of the image to obtain final compressed data, spatial information and compression information; the final compressed data and compression information are processed by a decoder, and the replacement symbol in the final compressed data is replaced by the corresponding continuous data in a preset mapping library until there is no replacement symbol in the final compressed data, thereby obtaining initial compressed data; the initial compressed data is converted into a decoded image through an image processing model; the spatial continuity of the decoded image is adjusted according to the spatial information to obtain the original image.
[0019] Preferably, the image lossless compression method also includes: when the cumulative number of occurrences of continuous data in the initial sequence data of the historical image conversion during multiple compressions reaches a set value, the replacement model automatically generates a mapping relationship between the continuous data and a new replacement symbol, and adds the mapping information to a preset mapping library.
[0020] In a second aspect, the present invention provides an image lossless compression system, comprising: an image segmentation unit, which obtains an original image to be compressed and uses an image segmentation model to segment the original image into a plurality of irregularly shaped block images.
[0021] The data conversion unit processes the block images into initial sequence data of R, G, and B three-color channels respectively, and adopts a spatial information analysis model to analyze the spatial continuity between the block images based on the original image to obtain the spatial information between the block images.
[0022] The data processing unit, based on a preset replacement model, cyclically replaces the continuous data in the initial sequence data that is identical to the preset data in the preset mapping library with the replacement symbol corresponding to the preset data to obtain the initial compressed data; the loop ends when the ratio of the initial compressed data to the initial sequence data is less than or equal to the set compression ratio or the initial compressed data cannot be compressed again, at which time the initial compressed data is the final compressed data, and the compression information of multiple replacements is recorded.
[0023] The image compression unit compresses the original image according to the compression information to obtain a lossless compression package of the image, wherein the lossless compression package of the image includes final compressed data, spatial information and compression information.
[0024] The image transmission unit analyzes and calculates the optimal transmission bandwidth and the optimal transmission rate of the image lossless compression package, and transmits the image lossless compression package to a designated terminal according to the transmission mode of the optimal transmission bandwidth and the optimal transmission rate.
[0025] The image decompression unit, the designated terminal uses a preset decompression model to parse the image lossless compression package to obtain the original image.
[0026] The beneficial effects of the present invention are:
[0027] 1. The present invention divides the original image taken by the light field microscope into several irregularly shaped block images through an image segmentation model, and divides the image from multiple positions in the original image that change significantly, so that images with many identical features become a block image, and then performs redundant processing on the initial sequence data of the R, G, and B three-color channels converted from the block image; adopts a replacement model to cyclically execute the continuous data in the initial sequence data that is the same as the preset data in the preset mapping library to be replaced with the corresponding replacement symbol to obtain the initial compressed data; until the ratio of the initial compressed data to the initial sequence data is less than or equal to the set compression ratio, or there is no continuous data in the initial compressed data that is the same as the preset mapping library, the final compressed data is obtained and the compression information of multiple replacements is recorded. The above-mentioned image segmentation and the method of replacing continuous data with replacement symbols adopted by the present invention can fully reduce the amount of redundant data in the original image and improve the compression efficiency of the light field microscope image.
[0028] 2. The image segmentation model adopted by the present invention can extract the global feature map of the original image according to the first cascade decoder; then use the convolution kernel to extract the mutation features of the global feature map, and connect the mutation features with curves to divide the global feature map into several irregularly shaped enhanced feature maps, that is, divide the global feature map at the position with obvious changes in the global feature map, and let similar features be divided into one enhanced feature map; finally, use deconvolution and position coding to process each enhanced feature map to obtain each irregularly shaped block image. The irregularly shaped block images obtained by the image segmentation model adopted by the present invention can reduce the amount of data analysis when the initial sequence data of the block image is subsequently replaced by the replacement symbol, and improve the speed of comparison, analysis and replacement of the preset mapping library and the initial sequence data, thereby improving the speed of lossless compression of the image.
[0029] 3. The spatial information analysis model adopted by the present invention can process each block image converted into three-dimensional data by an encoder, and analyze the spatial continuity between each block image. First, extract the segmentation data at the segmentation position of each adjacent block image in the three-dimensional data; extract the mutation continuous data in the segmentation data based on the spatial attention mechanism; then mark the position of each mutation continuous data according to the position mark of each block image to obtain spatial information containing the spatial continuity between each block image. The present invention uses the spatial information obtained by the spatial information analysis model, so that the designated terminal can improve the spatial continuity of the decoded image obtained by decompression when using the preset decompression model, and finally restore the decoded image to the original image to ensure that the image is in a lossless state.
[0030] 4. The replacement model adopted by the present invention can analyze the recorded data of multiple original image compressions, count the number of repetitions of continuous data in the initial sequence data of the original image, and when the number of repetitions reaches a set value, automatically generate a replacement symbol for the unrecorded continuous data in the preset mapping library; and based on the statistical data, the frequently used replacement symbols in the preset mapping library are divided into different priority lists according to the frequency of use for replacement, thereby improving the compression rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 The figure is a schematic flow chart of an embodiment of the present invention.
[0032] Figure 2 It is a schematic structural diagram of an embodiment of the present invention. DETAILED DESCRIPTION
[0033] Light field microscopic images are high-precision color images. During the compression, transmission and decompression of light field microscopic images, it is necessary to keep the image data intact, and the decompressed image is a lossless image. In view of this, the present invention proposes a lossless compression method and system for the compression, transmission and decompression of light field microscopic images.
[0034] The following will refer to Figure 1 to Figure 2 The embodiments of the present invention are described in detail. It should be understood by those skilled in the art that these embodiments are only used to explain the technical principles of the present invention and are not intended to limit the protection scope of the present invention.
[0035] A lossless compression method for images, such as Figure 1 As shown, the following steps are included:
[0036] Step S11: obtaining an original image to be compressed, and using an image segmentation model to segment the original image into a number of irregularly shaped block images.
[0037] Step S12: Process the divided images into initial sequence data of the three color channels of R, G, and B respectively, and use a spatial information analysis model to analyze the spatial continuity between the divided images based on the original image to obtain the spatial information between the divided images.
[0038] Step S13: Based on a preset replacement model, the continuous data in the initial sequence data that is identical to the preset data in the preset mapping library is replaced in a loop using the replacement symbol corresponding to the preset data to obtain the replaced initial compressed data; the loop ends when the ratio of the replaced initial compressed data to the initial sequence data is less than or equal to the set compression ratio or the initial compressed data cannot be compressed again. At this time, the initial compressed data is the final compressed data, and the compression information of multiple replacements is recorded.
[0039] Step S14: compressing the original image according to the compression information to obtain a lossless compression package of the image, which includes final compressed data, spatial information and compression information.
[0040] Step S15: Analyze and calculate the optimal transmission bandwidth and optimal transmission rate of the lossless compression image packet, and transmit the lossless compression image packet to the designated terminal according to the transmission mode of the optimal transmission bandwidth and optimal transmission rate.
[0041] Step S16: The designated terminal uses a preset decompression model to parse the image lossless compression package to obtain the original image.
[0042] In this embodiment, step S12 processes the divided images separately through the color image processing model to process the divided images into initial sequence data of three color channels of R, G, and B. Setting the compression ratio is an optional compression ratio condition, and the settings for setting the compression ratio include 1:5, 1:10 or maximum compression.
[0043] In step S15, before the lossless compression package of the image is transmitted, the optimal transmission bandwidth and the optimal transmission rate are calculated according to the preset transmission method and the data volume of the lossless compression package of the image. The present invention uses an image segmentation model to segment the original image taken by the light field microscope into a number of irregularly shaped block images, and segments the image from multiple positions in the original image that change significantly, so that images with many identical features become a block image, and then performs redundant processing on the initial sequence data of the three color channels of R, G, and B converted from the block image, and uses a replacement model to cycle the continuous data in the initial sequence data that is the same as the preset data in the preset mapping library, and replaces it with a replacement symbol corresponding to the preset data to obtain the replaced initial compressed data, until the ratio of the initial compressed data to the initial sequence data is less than or equal to the set compression ratio, or the initial compressed data does not have the same continuous data as the preset mapping library when the cycle ends, and the final initial compressed data is the final compressed data, and the data volume is reduced by replacement; the image segmentation and the method of replacing continuous data with replacement symbols according to this embodiment of the present invention can fully reduce the data volume of redundant data in the original image, thereby improving the compression efficiency of the light field microscopic image.
[0044] In one embodiment of the present invention, the image segmentation model of step S11 uses a first cascade decoder to extract image features rich in image change information in the original image to obtain a global feature map; a convolution kernel is used to extract mutation features of the global feature map, and the mutation features are connected by curves to segment the global feature map into a number of irregularly shaped enhanced feature maps; deconvolution and position encoding are used to process each enhanced feature map to obtain irregularly shaped block images.
[0045] In this embodiment, the image segmentation model is constructed based on a 3D convolutional neural network. The image segmentation model used in the present invention analyzes and processes the original image through a first cascade decoder, extracts image features rich in image change information in the original image, and obtains a global feature map, which includes color change features, background change features, light change features, etc. Then, multiple convolution kernels are used to analyze and process the global feature map at the same time to improve processing efficiency, and the mutation features of the global feature map are extracted by using convolution kernels, and the mutation features are connected by curves to divide the global feature map into several irregularly shaped enhanced feature maps; finally, each enhanced feature map is processed by deconvolution and position encoding to obtain irregularly shaped block images with most similar features. The irregularly shaped block images obtained by the image segmentation model used in the present invention can reduce the amount of data analysis when the initial sequence data of the block image is replaced by the replacement symbol in the subsequent replacement, and improve the speed of comparison, analysis and replacement of the preset mapping library with the initial sequence data, thereby improving the speed of lossless compression of the image.
[0046] In one embodiment of the present invention, the spatial information analysis model in step S12 sorts and marks the positions of each block image according to the position in the original image; converts each block image into three-dimensional data through an encoder; extracts segmentation data at the segmentation position of each adjacent block image in the three-dimensional data; extracts mutation continuous data in the segmentation data based on the spatial attention mechanism; and marks the positions of each mutation continuous data according to the position marks of each block image to obtain spatial information.
[0047] In this embodiment, the spatial information analysis model is constructed based on a 3D convolutional neural network model of a spatial attention mechanism. The spatial information analysis model used in the present invention can process each block image converted into three-dimensional data by an encoder, and analyze the spatial continuity between each block image. First, extract the segmentation data at the segmentation position of each adjacent block image in the three-dimensional data; extract the mutation continuous data in the segmentation data based on the spatial attention mechanism; then mark the position of each mutation continuous data according to the position mark of each block image to obtain spatial information containing the spatial continuity between each block image. The present invention uses the spatial information obtained by the spatial information analysis model, so that the designated terminal can improve the spatial continuity of the decoded image obtained by decompression when using a preset decompression model, and finally restore the decoded image to the original image to ensure that the image is in a lossless state.
[0048] In one embodiment of the present invention, when the replacement model processes the initial sequence data, the set compression ratio of the image compression and the first mapping library and the second mapping library in the preset mapping library are obtained; the continuous data in the initial sequence data that is the same as the preset data in the first mapping library is searched, and the continuous data is replaced with the replacement symbol corresponding to the preset data to obtain the initial compressed data; the continuous data in the initial compressed data that is the same as the preset data in the second mapping library is searched cyclically, and the continuous data is replaced with the replacement symbol corresponding to the preset data, and the cycle is terminated when the ratio of the initial compressed data to the initial sequence data is less than or equal to the set compression ratio or the data in the initial compressed data cannot be replaced, and the last initial compressed data is the final compressed data. Compared with the method of replacing repeated data with a replacement symbol, the method adopted by the present invention has the continuous data corresponding to the replacement symbol including repeated data and non-repeated data, which can fully reduce the data volume of the initial compressed data, thereby improving the compression ratio.
[0049] In this embodiment, a data processing model is used to cyclically search for continuous data in the initial compressed data that is identical to the preset data in the preset mapping library, and replace it with a replacement symbol corresponding to the preset data, thereby reducing the amount of data. In the present invention, the initial sequence data is one-dimensional data, and the number of continuous data is at least 5; and in the process of cyclic search, there is a replacement symbol in the continuous data.
[0050] In one embodiment of the present invention, the image lossless compression method further includes constructing a preset replacement model according to the historical image data, specifically including:
[0051] The first unit uses an encoder to obtain initial sequence data of R, G, and B color channels corresponding to a single historical image data.
[0052] The second unit uses a data processing model to analyze the initial sequence data, counts the number of repetitions of continuous data in the initial sequence data, and when the number of repetitions reaches a set value, generates a replacement symbol corresponding to the continuous data and replaces the continuous data.
[0053] The third unit adds the continuous data in the second unit and the replacement symbols corresponding to the continuous data to the preset mapping library. When the data volume of the initial sequence data is greater than the set data volume, it returns to execute the second unit; when the data volume of the initial sequence data is less than or equal to the set data volume, the final compressed data is obtained.
[0054] Preferably, the set value of this embodiment can be 200, 300 or 500. The set value can be determined according to actual needs. The set data volume is the data volume corresponding to the ratio of the final compressed data to the initial sequence data just obtained is 1:5 or 1:10, which is not a fixed value.
[0055] In this embodiment, the replacement symbol is data different from the continuous data that has been recorded in the database, such as Greek letters, mathematical symbols, etc. The number of data in the replacement symbol itself is less than the number of data in the continuous data. When generating the replacement symbol corresponding to the continuous data, it is preferred to match the replacement symbol with less data to reduce the amount of data.
[0056] A replacement model is constructed based on historical image data, and the matching replacement rules of the preset mapping library are trained into the replacement model, so that when the user uses the image compression method of the present invention, the replacement model can be used to directly reduce the amount of data of the initial sequence data of the image, thereby improving the compression efficiency. When the initial sequence data of each block image is compared and replaced with the preset data of the preset mapping library, the initial sequence data of each block image is processed simultaneously in a distributed, parallel, multi-threaded, etc. manner to improve the efficiency of image compression.
[0057] In one embodiment of the present invention, the second unit in the above embodiment also includes: analyzing the first replacement of the initial sequence data, and extracting the preset data and replacement symbols in the preset mapping library whose number of uses exceeds a first preset threshold into a first priority list of the first mapping library; analyzing the cyclic replacement of the initial sequence data, and extracting the preset data and replacement symbols in the preset mapping library whose number of uses exceeds a second preset threshold into the first priority list of the second mapping library.
[0058] In this embodiment, two replacements and two priority lists are only used to indicate priority sorting, and the number of replacements and priority lists are adjusted according to actual needs. The replacement model of the present invention can analyze the recorded data of multiple original image compressions, count the number of repetitions of continuous data in the initial sequence data of the original image, and when the number of repetitions reaches a set value, automatically generate a replacement symbol for the unrecorded continuous data in the preset mapping library; and according to the statistical data, the frequently used replacement symbols in the preset mapping library are divided into different priority lists according to the frequency of use and the number of compressions for replacement, thereby improving the compression rate.
[0059] In one embodiment of the present invention, the image lossless compression method further includes using an end-to-end encryption method to construct a dedicated transmission channel, and using the dedicated transmission channel to transmit the image lossless compression package. Using the end-to-end encryption method to construct a dedicated transmission channel can prevent the image lossless compression data from being leaked during the transmission process.
[0060] In one embodiment of the present invention, step S16 includes: parsing the lossless compression package of the image by a preset decompression model to obtain final compressed data, spatial information and compression information; processing the final compressed data and compression information by a decoder, replacing the replacement symbol in the final compressed data with the corresponding continuous data in a preset mapping library until there is no replacement symbol in the final compressed data, thereby obtaining the initial compressed data; converting the initial compressed data into a decoded image by an image processing model; adjusting the spatial continuity of the decoded image according to the spatial information to obtain the original image.
[0061] In this embodiment, the image processing model is a model or tool that can convert the initial sequence data into an R, G, B three-color image, such as color image processing software ps, etc. The present invention adopts a 3D convolutional neural network model with a spatial attention mechanism to analyze the spatial continuity between each block image on the basis of the original image, and obtain the spatial information between each block image, so that the designated terminal can improve the spatial continuity of each block image according to the spatial information when using a preset decompression model, and finally decompress to obtain the original image. The spatial continuity of the decoded image is adjusted according to the spatial information, so that the decoded image obtained by decompression can be consistent with the original image in terms of spatial continuity, thereby obtaining the original image.
[0062] In one embodiment of the present invention, the above embodiment also includes converting the decoded image into three-dimensional decoded data through an encoder, verifying whether the sudden continuous data in the spatial information is the same as the data at the same position of the three-dimensional decoded data, and if they are different, replacing the three-dimensional decoded data at the same position with the sudden continuous data; and then converting the three-dimensional decoded data into an image through a decoder, and the image is a lossless original image. The present invention adjusts the check core of the decoded image according to the spatial information so that the decoded image obtained by decompression is consistent with the original image in terms of spatial continuity, thereby obtaining the original image, and ensuring that the light field microscopy image is in a lossless state.
[0063] In one embodiment of the present invention, the image lossless compression method also includes: when the cumulative number of occurrences of continuous data in the initial sequence data of the historical image conversion during multiple compressions reaches a set value, the replacement model automatically generates a mapping relationship between the above continuous data and a new replacement symbol, and adds the mapping relationship information to a preset mapping library.
[0064] In this embodiment, the present invention also provides a method for automatically generating corresponding replacement symbols for continuous data that appear multiple times. When a user uses the software developed by the image lossless compression method of the present invention for a long time, the image lossless compression method of the present invention can analyze the historical image data compressed by the user. When the cumulative number of occurrences of the continuous data in the initial sequence data corresponding to the image data compressed by the user exceeds a set value, the replacement model automatically generates a corresponding replacement symbol for the continuous data, establishes a mapping relationship between the continuous data and the replacement symbol, and adds the continuous data, the replacement symbol and their mapping relationship to a preset mapping library. When the user uses the software developed by the image lossless compression method of the present invention again, the continuous data in the initial sequence data of the image can be replaced with the replacement symbol corresponding to the continuous data, thereby improving the compression efficiency and reducing the amount of data compression.
[0065] The present invention also provides an image lossless compression system, such as Figure 2 As shown, including:
[0066] The image segmentation unit obtains the original image to be compressed and uses the image segmentation model to segment the original image into a number of irregularly shaped block images.
[0067] The data conversion unit processes the block images into initial sequence data of R, G, and B three-color channels respectively, and adopts a spatial information analysis model to analyze the spatial continuity between the block images based on the original image to obtain the spatial information between the block images.
[0068] The data processing unit, based on a preset replacement model, cyclically replaces the continuous data in the initial sequence data that is identical to the preset data in the preset mapping library with the replacement symbol corresponding to the preset data to obtain the initial compressed data; the loop ends when the ratio of the initial compressed data to the initial sequence data is less than or equal to the set compression ratio or the initial compressed data cannot be compressed again, at which time the initial compressed data is the final compressed data, and the compression information of multiple replacements is recorded.
[0069] The image compression unit compresses the original image according to the compression information to obtain a lossless compression package of the image, which includes final compressed data, spatial information and compression information.
[0070] The image transmission unit analyzes and calculates the optimal transmission bandwidth and optimal transmission rate of the image lossless compression package, and transmits the image lossless compression package to the designated terminal according to the transmission mode of the optimal transmission bandwidth and optimal transmission rate.
[0071] The image decompression unit specifies that the terminal uses a preset decompression model to parse the image lossless compression package to obtain the original image.
[0072] So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.
Claims
1. A method for lossless image compression, characterized in that: include: Obtaining an original image to be compressed, and using an image segmentation model to segment the original image into a number of irregularly shaped block images; The block images are processed into initial sequence data of three color channels of R, G, and B respectively, and the spatial continuity between the block images is analyzed based on the original image by using a spatial information analysis model to obtain the spatial information between the block images; the spatial information analysis model is used to sort the block images according to their positions in the original image and mark their positions; Convert each block image into three-dimensional data through an encoder; extract segmentation data at the segmentation position of each adjacent block image in the three-dimensional data; Extract mutation continuous data from segmented data based on spatial attention mechanism; Mark the position of each mutation continuous data according to the position mark of each block image to obtain spatial information; Based on a preset replacement model, the continuous data in the initial sequence data that is the same as the preset data in the preset mapping library is cyclically replaced with a replacement symbol corresponding to the preset data to obtain initial compressed data; When the ratio of the initial compressed data to the initial sequence data is less than or equal to the set compression ratio or the initial compressed data cannot be compressed again, the loop ends. At this time, the initial compressed data is the final compressed data, and the compression information of multiple replacements is recorded; wherein, a preset replacement model is constructed according to the historical image data, specifically including: a first unit, using an encoder to obtain the initial sequence data of the R, G, and B three-color channels corresponding to a single historical image data; a second unit, using a data processing model to analyze the initial sequence data, counting the number of repetitions of continuous data in the initial sequence data, and when the number of repetitions reaches a set value, generating a replacement symbol corresponding to the continuous data and replacing the continuous data; a third unit, adding the continuous data in the second unit and the replacement symbol corresponding to the continuous data to a preset mapping library, when the data volume of the initial sequence data is greater than the set data volume, returning to execute the second unit; when the data volume of the initial sequence data is less than or equal to the set data volume, obtaining the final compressed data; Compressing the original image according to the compression information to obtain a lossless compression package of the image, wherein the lossless compression package of the image includes final compressed data, spatial information and compression information; Analyze and calculate the optimal transmission bandwidth and optimal transmission rate of the image lossless compression package, and transmit the image lossless compression package to a designated terminal according to the transmission mode of the optimal transmission bandwidth and the optimal transmission rate; The designated terminal uses a preset decompression model to parse the image lossless compression package to obtain the original image.
2. The image lossless compression method according to claim 1, characterized in that: The image segmentation model uses a first cascade decoder to extract image features rich in image change information from the original image to obtain a global feature map; uses a convolution kernel to extract mutation features of the global feature map, and connects the mutation features by curves to segment the global feature map into a number of irregularly shaped enhanced feature maps; uses deconvolution and position encoding to process each enhanced feature map to obtain each irregularly shaped block image.
3. The image lossless compression method according to claim 1, characterized in that: When the replacement model processes the initial sequence data, a set compression ratio of image compression and a first mapping library and a second mapping library in a preset mapping library are obtained; continuous data identical to the preset data in the first mapping library is searched for in the initial sequence data, and the continuous data is replaced by a replacement symbol corresponding to the preset data to obtain initial compressed data; continuous data identical to the preset data in the second mapping library is searched for in a loop, and the continuous data is replaced by a replacement symbol corresponding to the preset data, and the loop is terminated when the ratio of the initial compressed data to the initial sequence data is less than or equal to the set compression ratio or the data in the initial compressed data cannot be replaced, and the last initial compressed data is the final compressed data.
4. The image lossless compression method according to claim 1, characterized in that: Analyze the first replacement of the initial sequence data, and extract the preset data and replacement symbols in the preset mapping library that have been used more than a first preset threshold into a first priority list of the first mapping library; The cyclic replacement of the initial sequence data is analyzed, and the preset data and replacement symbols in the preset mapping library that are used more than a second preset threshold are extracted into a first priority list of the second mapping library.
5. The image lossless compression method according to claim 1, characterized in that: The preset decompression model parses the image lossless compression package to obtain final compressed data, spatial information and compression information; The final compressed data and compressed information are processed by a decoder, and the replacement symbol in the final compressed data is replaced by the corresponding continuous data in a preset mapping library until there is no replacement symbol in the final compressed data, thereby obtaining the initial compressed data; the initial compressed data is converted into a decoded image through an image processing model; and the spatial continuity of the decoded image is adjusted according to the spatial information to obtain the original image.
6. The image lossless compression method according to claim 5, characterized in that: The decoded image is converted into three-dimensional decoded data through an encoder, and the mutation continuous data in the spatial information is checked to see if it is the same as the data at the same position of the three-dimensional decoded data. If they are different, the three-dimensional decoded data at the same position is replaced by the mutation continuous data.
7. The image lossless compression method according to claim 1, characterized in that: Also includes: When the cumulative number of occurrences of continuous data in the initial sequence data of the historical image conversion during multiple compressions reaches a set value, the replacement model automatically generates a mapping relationship between the continuous data and a new replacement symbol, and adds the mapping information to a preset mapping library.
8. An image lossless compression system, characterized in that: include: An image segmentation unit obtains an original image to be compressed and uses an image segmentation model to segment the original image into a number of irregularly shaped block images; A data conversion unit processes the block images into initial sequence data of three color channels of R, G, and B respectively, and adopts a spatial information analysis model to analyze the spatial continuity between the block images based on the original image to obtain the spatial information between the block images; the spatial information analysis model sorts the block images according to their positions in the original image and performs position marking; Convert each block image into three-dimensional data through an encoder; extract segmentation data at the segmentation position of each adjacent block image in the three-dimensional data; Extract mutation continuous data from segmented data based on spatial attention mechanism; Mark the position of each mutation continuous data according to the position mark of each block image to obtain spatial information; The data processing unit, based on a preset replacement model, cyclically replaces the continuous data in the initial sequence data that is the same as the preset data in the preset mapping library with a replacement symbol corresponding to the preset data to obtain initial compressed data; When the ratio of the initial compressed data to the initial sequence data is less than or equal to the set compression ratio or the initial compressed data cannot be compressed again, the loop ends. At this time, the initial compressed data is the final compressed data, and the compression information of multiple replacements is recorded; wherein, a preset replacement model is constructed according to the historical image data, specifically including: a first unit, using an encoder to obtain the initial sequence data of the R, G, and B three-color channels corresponding to a single historical image data; a second unit, using a data processing model to analyze the initial sequence data, counting the number of repetitions of continuous data in the initial sequence data, and when the number of repetitions reaches a set value, generating a replacement symbol corresponding to the continuous data and replacing the continuous data; a third unit, adding the continuous data in the second unit and the replacement symbol corresponding to the continuous data to a preset mapping library, when the data volume of the initial sequence data is greater than the set data volume, returning to execute the second unit; when the data volume of the initial sequence data is less than or equal to the set data volume, obtaining the final compressed data; An image compression unit compresses the original image according to the compression information to obtain a lossless image compression package, wherein the lossless image compression package includes final compressed data, spatial information and compression information; An image transmission unit, which analyzes and calculates the optimal transmission bandwidth and the optimal transmission rate of the image lossless compression package, and transmits the image lossless compression package to a designated terminal according to a transmission mode of the optimal transmission bandwidth and the optimal transmission rate; The image decompression unit, the designated terminal uses a preset decompression model to parse the image lossless compression package to obtain the original image.
