Compression method, device and readable storage medium of image data
By initializing the low-dimensional latent feature matrix and related bias attributes, and updating them using gradient descent, the problem of uncontrollable image data compression in existing technologies is solved, and efficient image data transmission is achieved.
Patent Information
- Application Number
- CN202310183879.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-23
- Publication Date
- 2025-12-26
- Estimated Expiration
- 2043-02-23
AI Technical Summary
Existing matrix factorization-based image compression algorithms cannot achieve controllable compression of image data, resulting in low transmission efficiency.
By obtaining the matrix of the original image, specifying the latent space dimension to initialize the low-dimensional latent feature matrix and related bias attributes, and iteratively updating them using the gradient descent method until the loss function condition is met, controllable compression of image data is achieved.
It achieves effective compression of image data, improves transmission efficiency and real-time performance, and allows for control of the compression rate as needed.
Smart Images

Figure CN116320425B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, and in particular to an image data compression method, device and readable storage medium. BACKGROUND
[0002] With the upgrading and iteration of the hardware and software of the shooting device, the image quality and resolution of the shot image are further improved, and accordingly, the image data becomes larger and larger. In scenarios such as remote transmission of remote sensing images, the original image data is generally in a high-dimensional raw format. If the image data can be effectively compressed, the transmission time can be greatly reduced, and the real-time performance of the terminal in acquiring data can be enhanced.
[0003] With the continuous development and application of machine learning in various fields, combined with the feature extraction capability of machine learning for image data, image compression based on matrix decomposition is also proposed.
[0004] In the image compression algorithm based on matrix decomposition in the related art, the SVD (Singular Value Decomposition) method is used to perform mathematical decomposition on a matrix, extract key rank information, reconstruct the matrix, and compress the data.
[0005] However, since the SVD method is purely mathematical decomposition on a matrix, it cannot achieve controllable compression of image data. SUMMARY
[0006] The present application provides an image data compression method, device and readable storage medium, which realizes control of the compression rate.
[0007] The present application provides an image data compression method, comprising:
[0008] obtaining an original matrix of an input original image;
[0009] initializing an initial hidden space feature matrix by specifying a compression hidden space dimension for the original image channel to obtain a low-dimensional hidden feature matrix;
[0010] initializing a related bias attribute of the original image data;
[0011] obtaining a reconstruction matrix of the image data using the low-dimensional hidden feature matrix and the related bias attribute;
[0012] updating the low-dimensional hidden feature matrix and the related bias attribute using the reconstruction matrix and the original matrix;
[0013] storing the updated hidden feature matrix and the updated related bias attribute to obtain compressed data of the image data.
[0014] Further, the iterative updating of the low-dimensional hidden feature matrix and the related bias attribute based on the reconstruction matrix and the original matrix comprises:
[0015] Adjusting the hidden feature matrix and the related bias attribute based on the reconstruction matrix and the original matrix according to the current loss set based on the reconstruction matrix and the original matrix, until the iteration end condition is met, and outputting the updated hidden feature matrix and the updated related bias attribute.
[0016] Further, the adjusting the hidden feature matrix and the related bias attribute based on the reconstruction matrix and the original matrix according to the current loss set based on the reconstruction matrix and the original matrix comprises:
[0017] Determining a loss function of the reconstruction matrix and the original matrix based on the element value of the reconstruction matrix and the element value of the original matrix; the loss function comprises a regularization weight for adjusting the hidden feature matrix and the related bias attribute;
[0018] According to the loss function, using gradient descent method, iteratively updating the hidden feature matrix and the related bias attribute.
[0019] Further, the obtaining the original matrix of the input original image comprises:
[0020] Converting the original image data into matrix data according to a preset picture size;
[0021] Converting the original data type of the matrix data into floating point data to obtain the original matrix of the original image.
[0022] Further, the initializing the related bias attribute of the original image data comprises:
[0023] Randomly initializing the global bias, the width bias attribute of the M dimension of the original image, and the height bias attribute of the N dimension of the original image using floating point data between 0 and 1;
[0024] The using the low-dimensional hidden feature matrix and the related bias attribute to obtain the reconstruction matrix of the image data comprises:
[0025] On the basis of the low-dimensional hidden feature matrix, adding the sum of the initialized width bias attribute, the initialized height bias attribute, and the initialized global bias to obtain an MxN-dimensional reconstruction matrix.
[0026] Further, after the storing the updated hidden feature matrix and the updated related bias attribute to obtain the compressed data of the image data, the method further comprises:
[0027] According to the compressed data, an updated complete latent feature matrix and the updated complete related bias attribute are obtained.
[0028] Using the updated complete related bias attribute and the latent feature matrix and the updated complete related bias attribute, a reconstruction matrix is obtained by using a matrix reconstruction formula, and the reconstruction matrix is quantized to obtain a data matrix of the same data type as the original image data.
[0029] The application provides an image data compression device, which comprises:
[0030] A data processing module is configured to obtain an original matrix of an input original image.
[0031] A latent feature matrix initialization module is configured to initialize an initial latent feature matrix by specifying a compressed latent space dimension through an original image channel to obtain a low-dimensional latent feature matrix.
[0032] A bias attribute initialization module is configured to initialize a related bias attribute of original image data.
[0033] A matrix reconstruction module is configured to obtain a reconstruction matrix of image data by using the low-dimensional latent feature matrix and the related bias attribute.
[0034] An attribute updating module is configured to update the low-dimensional latent feature matrix and the related bias attribute by using the reconstruction matrix and the original matrix.
[0035] A data compression module is configured to store the updated complete latent feature matrix and the updated complete related bias attribute to obtain compressed data of the image data.
[0036] Further, the attribute updating module comprises an attribute updating submodule.
[0037] The attribute updating submodule is configured to adjust the latent feature matrix and the related bias attribute based on a current loss set by the reconstruction matrix and the original matrix, until an iteration end condition is met, and output the updated complete latent feature matrix and the updated complete related bias attribute.
[0038] Further, the attribute updating submodule is specifically configured to determine a loss function of the reconstruction matrix and the original matrix based on element values of the reconstruction matrix and element values of the original matrix, the loss function comprises a regularization weight for adjusting the latent feature matrix and the related bias attribute, and the latent feature matrix and the related bias attribute are iteratively updated by using a gradient descent method according to the loss function.
[0039] Further, the data processing module comprises a data format conversion submodule and a data type conversion submodule.
[0040] The data format conversion submodule is configured to perform format conversion on the original image data according to a preset picture size, to obtain matrix data.
[0041] The data type conversion submodule is configured to convert the original data type of the matrix data into floating-point data, to obtain the original matrix of the original image.
[0042] Further, the bias attribute initialization module is specifically configured to randomly initialize a global bias, a width bias attribute of M dimensions of the original image, and a height bias attribute of N dimensions of the original image using floating-point data between 0 and 1.
[0043] The matrix reconstruction module is specifically configured to add the sum of the initialized width bias attribute, the initialized height bias attribute, and the initialized global bias to the low-dimensional hidden feature matrix, to obtain an M×N-dimensional reconstructed matrix.
[0044] Further, the device further comprises:
[0045] The reconstruction restoration module is configured to, after storing the updated hidden feature matrix and the updated related bias attribute to obtain compressed data of the image data, obtain the updated hidden feature matrix and the updated related bias attribute according to the compressed data, perform original image data reconstruction using the reconstruction formula to obtain a reconstructed matrix, and quantize the reconstructed matrix to obtain a data matrix of the same data type as the original image data.
[0046] The present application provides a computer readable storage medium having a program stored thereon, which, when executed by a processor, implements the method of any one of the above.
[0047] In some embodiments, the image data compression method provided by the present application obtains a specified compressed hidden space dimension of an image channel, initializes an initial hidden space feature matrix through the specified compressed hidden space dimension, and initializes related bias attributes of original image data. In this way, the initial hidden space feature matrix can be initialized through the specified compressed hidden space dimension, and the control of the compression rate can be achieved. BRIEF DESCRIPTION OF DRAWINGS
[0048] Figure 1 Fig. 1 shows a flowchart of an image data compression method provided by an embodiment of the present application;
[0049] Figure 2 Fig. 2 shows a flowchart of an image data compression method provided by another embodiment of the present application; Figure 1A specific flowchart of the compression method of the image data shown;
[0050] Figure 3 A specific flowchart of the parameterization optimization process of step 141 of the compression method of the image data shown; Figure 2 A specific flowchart of the parameterization optimization process of step 141 of the compression method of the image data shown;
[0051] Figure 4 A specific flowchart of the parameterization optimization process of step 141 of the compression method of the image data shown; Figure 1 Another specific flowchart of the compression method of the image data shown;
[0052] Figure 5 A specific flowchart of the compression method of the image data shown;
[0053] Figure 6 A specific flowchart of the compression method of the image data shown; DETAILED DESCRIPTION
[0054] The exemplary embodiments will be described in detail herein with reference to the attached drawings. In the following description, the same numbers are used to indicate the same or similar elements, unless otherwise represented. The embodiments described in the following exemplary embodiments do not represent all the embodiments consistent with one or more embodiments of the present specification. Rather, they are merely examples of devices and methods consistent with some aspects of one or more embodiments of the present specification, as detailed in the appended claims.
[0055] It should be noted that the steps of the corresponding method are not necessarily performed in the order shown and described in the present specification in other embodiments. In some other embodiments, the steps included in the method can be more or less than described in the present specification. In addition, a single step described in the present specification can be divided into multiple steps for description in other embodiments, and multiple steps described in the present specification can be combined into a single step for description in other embodiments.
[0056] To solve the above technical problem that the controllable compression of image data cannot be achieved, the present embodiment provides a compression method of image data, which acquires an original matrix of an input original image; initializes an initial hidden space feature matrix to obtain a low-dimensional hidden feature matrix by specifying a compression hidden space dimension through an original image channel; initializes a related bias attribute of the original image data; obtains a reconstruction matrix of the image data using the low-dimensional hidden feature matrix and the related bias attribute; updates the low-dimensional hidden feature matrix and the related bias attribute using the reconstruction matrix and the original matrix; stores the updated hidden feature matrix and the updated related bias attribute to obtain compressed data of the image data.
[0057] In the embodiment of the present application, the specified compressed latent space dimension of the image channel is obtained, the initial latent space feature matrix is initialized by the specified compressed latent space dimension, and the related bias attribute of the original image data is initialized. In this way, the initial latent space feature matrix can be initialized by the specified compressed latent space dimension, and the control of the compression rate can be realized.
[0058] Figure 1 As shown in the flowchart of the image data compression method provided by the embodiment of the present application.
[0059] As shown in the flowchart of the image data compression method provided by the embodiment of the present application. Figure 1 The image data compression method can include, but is not limited to, the following steps 110 to 160:
[0060] Step 110, obtaining the original matrix of the input original image.
[0061] The original image is used to reflect the information of the image. The original image can be any one or more pictures containing picture information. The original image can be any picture selected by a user from multiple pictures according to requirements. The original image can also be referred to as an image data stream.
[0062] In addition, the details of the above-mentioned various embodiments of the original matrix are described below.
[0063] Step 120, initializing the initial latent space feature matrix by the specified compressed latent space dimension of the original image channel to obtain a low-dimensional latent feature matrix.
[0064] The specified compressed latent space dimension is used to reflect that the compressed data after compression is less than the data of the original image. The specified compressed latent space dimension D can be set according to user requirements. For example, the specified compressed latent space dimension D needs to satisfy the condition (D+1)×(M+N)+1<M×N, and the specified compressed latent space dimension D is at least 1. Wherein, M is the dimension corresponding to the width, and N is the dimension corresponding to the height. The specified compressed latent space dimension is 8 in the following description, and details are described below.
[0065] Step 130, initializing the related bias attribute of the original image data.
[0066] The original image itself has some bias information due to the horizontal and vertical dimension light. In addition, the original image is composed of height and width, so when focusing the light when collecting the original image, the bias information such as the height position and the width position of the original image data can be considered to speed up the fitting. The above-mentioned related bias attribute is used to reflect the bias information.
[0067] The related bias attribute of the original image data can include one or more of global bias information of the original image data and position bias information of the original image data. The global bias information of the original image data can be a global bias variable σ. The position bias information of the original image data can include a width bias vector B M of M dimensions and a height bias vector B N of N dimensions. Thus, the original matrix is subjected to eigenvalue decomposition to obtain a low-dimensional hidden feature matrix, position bias information, and global bias information, so that the eigenvalue decomposition of the original matrix includes three parts, i.e., the global bias information, the position bias information, and the low-dimensional hidden feature matrix, which are stored subsequently.
[0068] In step 140, the low-dimensional hidden feature matrix and the related bias attribute are used to obtain a reconstruction matrix of the image data.
[0069] In step 150, the low-dimensional hidden feature matrix and the related bias attribute are updated by using the reconstruction matrix and the original matrix, so that the parameter optimization of the matrix decomposition is achieved.
[0070] In step 160, the updated hidden feature matrix and the updated related bias attribute are stored to obtain compressed data of the image data. Thus, the updated hidden feature matrix and the updated related bias attribute are compressed data.
[0071] Figure 2 The specific flowchart of the image data compression method is shown in Figure 1 The specific flowchart of the image data compression method is shown in
[0072] As shown in Figure 2 In some embodiments, the step 110 can include, but is not limited to, a step 111 and a step 112. In other embodiments, the step 120 can include a step 121, and the step 130 can include a step 131. In yet other embodiments, the step 140 can include a step 141. The three embodiments can be implemented individually or in combination of any two or three, which is determined according to actual conditions.
[0073] In step 111, the original image data is subjected to format conversion according to a preset picture size to obtain matrix data. For example, the original matrix M M*N .
[0074] The preset picture size can be set according to user demand. For example, the preset picture size can be 512x1024.
[0075] Step 112, converting the original data type of the matrix data to floating point data to obtain the original matrix of the original image, so as to realize the matrix data format conversion. In this way, the original data type is uniformly converted to the floating point float data type, which is convenient for matrix decomposition. And the numerical value of the data is compressed between 0 and 1. At the same time, the conversion of the data type in advance is beneficial to the operation of the floating point data in the later stage, improves the efficiency of the subsequent processing, and is convenient for quantization and reduction of the reconstructed matrix.
[0076] The original data type of the matrix data can be an int data type. The int data type is, for example, an int8 data type.
[0077] For example, using the raw data of the original image, the original int8 data type data is format-converted according to the pre-set picture size 512x1024 to form the matrix data. The int8 data type data is converted to floating point data, and the numerical value of the data is compressed between 0 and 1 to obtain the original matrix M. The numerical value of the data compressed between 0 and 1 does not include 0 and 1.
[0078] In another embodiment of the above-mentioned matrix data, the original image data is format-converted according to the pre-set picture size to obtain the matrix data, which is used as the original matrix. In this way, the original data type of the matrix data does not need to be converted to floating point data to obtain the original matrix of the original image. In the subsequent operation process, the original matrix is adaptively converted according to the algorithm. In this way, the original data type of the matrix data is directly used as the input, and the floating point data is converted in the subsequent operation process, which improves the efficiency of obtaining the original matrix.
[0079] For example, the data type of the original matrix is an int data type, and in the subsequent calculation process, floating point data between 0 and 1 is needed. The int data type of the original matrix is converted to floating point data between 0 and 1 in the subsequent process.
[0080] Step 121, using floating point data between 0 and 1 to randomly initialize the global bias, the M-dimensional width bias attribute of the original image, and the N-dimensional height bias attribute of the original image. In this way, the bias information of the original image is initialized.
[0081] The above-mentioned 121 can further include using floating point data between 0 and 1 to randomly initialize the global bias variable σ and the M-dimensional width bias vector B M , and the N-dimensional height bias vector B N .
[0082] Step 131, on the basis of the low-dimensional hidden feature matrix, the sum of the initialized wide bias attribute, the initialized high bias attribute and the initialized global bias is added to obtain the M*N-dimensional reconstruction matrix.
[0083] The low-dimensional hidden feature matrix in step 131 can be a low-dimensional hidden feature matrix that is not initialized.
[0084] Of course, the low-dimensional hidden feature matrix can also be an initialized low-dimensional hidden feature matrix. Correspondingly, in other embodiments, the method further includes initializing the low-dimensional hidden feature matrix, taking the initialized low-dimensional hidden feature matrix as the low-dimensional hidden feature matrix, and then combining step 131 to obtain the M*N-dimensional reconstruction matrix. In this way, the initialized low-dimensional hidden feature matrix and the initialized bias attribute can be used to obtain the subsequent reconstruction matrix. Specifically, the low-dimensional hidden feature matrix U is randomly initialized using floating-point data between 0 and 1 M*D and V D*N , and the dimensions are set to [M, D] and [D, N] respectively.
[0085] The dimension of the original matrix M of the embodiment of the application is M*N, and the image data M' in each fixed position (w, h) in the original matrix wh is composed of four parts of data, i.e., a global bias σ, a wide dimension bias vector B M , a high dimension bias vector B N and a low-dimensional hidden feature matrix.
[0086] The global bias variable σ: Each picture has its specific shooting environment, which lays a global basis data for the shooting of the original image, and parameterizes the specific shooting environment parameter into the global bias variable σ.
[0087] The wide dimension bias vector B M and the high dimension bias vector B N : For the shooting angle of each picture, considering that different wide dimension positions and high dimension positions have their unique shooting basis composition data, they are parameterized into the wide dimension and high dimension bias vectors B M and N M , wherein the variable data at each specific position w of the wide dimension (integer value in the range of 1 and M) is represented by b w , and the variable data at the specific position h of the high dimension (integer value in the range of 1 and N) is represented by b h .
[0088] The low-dimensional hidden feature matrix, also known as the matrix decomposition-hidden feature matrix: on the basis of the common bias feature of all positions, the unique feature data of each position (w, h) is generated using matrix decomposition to generate a wide dimension hidden feature vector U w(Dimension D) and V h (Dimension D).
[0089] Based on the above, the final matrix reconstruction formula is as follows:
[0090]
[0091] The following is an example with the height and width dimensions of the picture 512x1024 and the specified compressed hidden space dimension D as 8: U w,d is the value in U w is the value in V d,g is the value in V h .
[0092] First, create two low-dimensional hidden feature matrices U (dimension 512x8) and V (dimension 8x1024), which are the low-dimensional hidden feature matrices corresponding to the high-dimensional and wide-dimensional, respectively. At the same time, create a global variable σ, a 512-dimensional bias vector B W , a 1024-dimensional bias vector B H . Then, use the obtained initialization parameters to perform matrix reconstruction, and the matrix reconstruction formula is defined as follows:
[0093]
[0094] where σ is the global bias, considering that each picture has its specific shooting environment, parameterize it as the global basic bias parameter of the image to add to the reconstruction process; B W , B H are the width and height bias vectors, considering the unique shooting angle of each picture, parameterize it as the unique bias vector B W , B H , where b w represents the variable data on the dimension w (integer value in the range of 1 and 512) of B W , b h represents the variable data on the dimension h (integer value in the range of 1 and 1024) of B H . U and V are the low-dimensional hidden feature decomposition matrices corresponding to the high-dimensional and wide-dimensional, respectively, which are used for original matrix reconstruction.
[0095] In this embodiment of the reconstruction matrix, by considering the global bias, the wide bias attribute of the M-dimensional of the original image, and the high bias attribute of the N-dimensional of the original image through the reconstruction matrix, the fitting can be accelerated, and at the same time, combined with the specified compressed hidden space dimension D for controllable compression.
[0096] In other embodiments of the reconstruction matrix, a wide bias attribute, a high bias attribute, and the sum of the global bias are added to the low-dimensional latent feature matrix to obtain an M×N dimensional reconstruction matrix. Thus, an M×N dimensional reconstruction matrix can be obtained without initializing the wide bias attribute, the high bias attribute, and the global bias.
[0097] Step 141: Based on the current loss set by the reconstruction matrix and the original matrix, adjust the latent feature matrix and related bias attributes according to the reconstruction matrix and the original matrix until the iteration termination condition is met, and output the updated latent feature matrix and the updated related bias attributes.
[0098] The above iteration termination conditions may include, but are not limited to, the loss function value E being less than a set threshold or the number of iterations exceeding a set maximum number, and the final updated latent feature matrix U is output. M*D V D*N And the related bias properties σ and B after the update are completed. M B N The output data can then be stored. In some embodiments, the reconstruction of the original image data can be performed locally. In other embodiments, to enable other receiving ends to reconstruct the original image data, the output data can be transmitted to those other receiving ends so that they can reconstruct the original image data.
[0099] Figure 3 As shown Figure 2 The diagram shows a detailed flowchart of the parameter optimization process in step 141 of the image data compression method.
[0100] like Figure 3 As shown, the current loss set based on the reconstruction matrix and the original matrix in step 141 above, and the adjustment of the latent feature matrix and related bias attributes according to the reconstruction matrix and the original matrix, may further include the following steps 1411 and 1414:
[0101] Step 1411: Based on the element values of the reconstructed matrix and the element values of the original matrix, determine the loss function for the reconstructed matrix and the original matrix; the loss function includes the regularization weights of the latent feature matrix and the relevant bias attributes.
[0102] Step 1412: Based on the loss function, use gradient descent to iteratively update the latent feature matrix and related bias attributes.
[0103] Step 1413: Determine whether the iteration termination condition is met; if not, that is, the iteration termination condition is not met, then return to step 1412; if yes, that is, the iteration termination condition is met, then execute step 1414.
[0104] Step 1414, output the updated latent feature matrix and the updated related bias attribute.
[0105] For example, set the loss function of the reconstruction matrix and the original matrix, train the matrix decomposition model based on the above matrix reconstruction formula and the loss function by using the reconstruction matrix M' and the original matrix M, and obtain the global bias σ, the bias vector B W and B H and the low-dimensional latent feature matrix U and V. The framework of the matrix decomposition model includes:
[0106] (1) The target loss function of the matrix decomposition model: the absolute loss term of matrix decomposition, the regularization term of the parameter vector and the matrix.
[0107] (2) Parameter optimization of the matrix decomposition model: according to the original matrix of the original image and the matrix reconstruction formula, update each parameter in the matrix reconstruction formula by gradient descent, and iterate repeatedly until convergence or the set number of iterations is reached.
[0108] The determination process of the final loss function of the matrix decomposition model in the above (1) is as follows: the target loss function of the reconstruction matrix and the original matrix is defined as follows:
[0109] E = L MF + L R
[0110] Wherein L MF represents the absolute loss term of the original matrix M and the reconstructed matrix M' after matrix decomposition, L R represents the regularization term.
[0111] The absolute loss term L MF of the above matrix decomposition is defined as follows:
[0112]
[0113] Wherein, M m,n represents the element value of the coordinate position [m, n] in the original matrix M, and M' m,n represents the element value in the coordinate position [m, n] of the reconstruction matrix M'.
[0114] The overfitting problem of the matrix decomposition model is considered in the target loss function, so the regularization term L R is added, and the L R formula is defined as follows:
[0115]
[0116] Wherein, λ u , λ v , λ bis a hyper parameter, used to adjust the regularization weight of the latent feature matrix and bias vector, which can be set to 0.1 in this embodiment, but is not limited thereto.
[0117] The above L MF formula and L R After the above formula, the final loss function is defined as follows:
[0118]
[0119] The above (2) further includes three steps as follows 1), 2) and 3):
[0120] 1), according to the final loss function, the derivative of each parameter is calculated, and the following is obtained:
[0121]
[0122]
[0123]
[0124]
[0125]
[0126] 2), according to the above obtained derivative, using gradient descent method, updating the parameters of the matrix decomposition model, that is, the latent feature matrix and the related bias attribute.
[0127] 3), repeat the steps of 1) and 2), constantly update the parameters of the matrix decomposition model, and recalculate the loss function, until the loss function value is less than the threshold value or the iteration number reaches the upper limit, stop updating, and output the final updated latent feature matrix U M*D , V D*N and bias information parameters sigma, B M , B N .
[0128] In this embodiment, the idea of machine learning and gradient descent method are introduced, which can improve the processing efficiency of iteration, and the original data can be effectively stored by setting appropriate loss function. Further, the matrix decomposition method of fusing global bias information and position bias information of image is adopted to speed up the fitting. At the same time, when reconstructing the matrix of the original data, the matrix reconstruction formula is simple and has strong interpretability.
[0129] Figure 4 Another flowchart of the image data compression method is shown in Figure 1 Another flowchart of the image data compression method is shown in
[0130] In combination with Figure 1 and Figure 4As shown, after the step 160, the method can but not limited to include the following steps 170 and 180 to realize the reconstruction of the original image data:
[0131] Step 170, obtaining the updated completed hidden feature matrix and the updated completed related bias attribute from the compressed data.
[0132] Step 180, using the updated completed hidden feature matrix and the updated completed related bias attribute, using the above matrix reconstruction formula to reconstruct the original image data, obtaining the reconstructed matrix, and then quantizing to obtain the data matrix of the same data type as the original image data. For example, the matrix data of the original image data of the int8 data type.
[0133] In the embodiment of the present application, the transmitted compressed data and the matrix reconstruction formula are used to perform matrix reconstruction to obtain the reconstructed matrix data, and the reconstructed matrix data is quantized to the int8 data type of the original image to complete the reconstruction of the original image using the matrix reconstruction formula using the compressed data. Further, by parameterizing the global bias information and the position bias information of the original image and adding them to the matrix reconstruction formula, the matrix decomposition model is applied to the image data compression technology using the matrix decomposition method for optimization, and the feature vectors of the two orthogonal dimensions of width and height are extracted, and the specified compressed hidden space dimension can also be used for controllable compression.
[0134] Of course, the above Figure 4 The content can be combined with Figure 2 The embodiment to realize the reconstruction of the original image data. The detailed process is not described again.
[0135] Figure 5 As shown, the structure schematic diagram of the image data compression device provided by the embodiment of the present application is shown.
[0136] As shown in Figure 5 The embodiment of the present application provides an image data compression device comprising the following modules:
[0137] The data processing module 31 is used for acquiring the original matrix of the input original image.
[0138] The hidden feature matrix initialization module 32 is used for initializing the initial hidden space feature matrix by specifying the compressed hidden space dimension of the original image channel to obtain the low-dimensional hidden feature matrix.
[0139] The bias attribute initialization module 33 is used for initializing the related bias attribute of the original image data.
[0140] The matrix reconstruction module 34 is used for obtaining the reconstruction matrix of the image data using the low-dimensional hidden feature matrix and the related bias attribute.
[0141] The attribute updating module 35 is configured to update the low-dimensional hidden feature matrix and the related bias attribute by using the reconstructed matrix and the original matrix.
[0142] The data compression module 36 is configured to store the updated hidden feature matrix and the updated related bias attribute to obtain compressed data of the image data.
[0143] In some embodiments, the attribute updating module 35 comprises an attribute updating sub-module.
[0144] The attribute updating sub-module is configured to adjust the hidden feature matrix and the related bias attribute according to the reconstructed matrix and the original matrix based on the current loss set by the reconstructed matrix and the original matrix, until the iteration end condition is met, and output the updated hidden feature matrix and the updated related bias attribute.
[0145] In some embodiments, the attribute updating sub-module is specifically configured to determine a loss function of the reconstructed matrix and the original matrix based on element values of the reconstructed matrix and element values of the original matrix, the loss function comprises a regularization weight of adjusting the hidden feature matrix and the related bias attribute, and iteratively update the hidden feature matrix and the related bias attribute by using a gradient descent method according to the loss function.
[0146] In some embodiments, the data processing module 31 comprises a data format conversion sub-module and a data type conversion sub-module.
[0147] The data format conversion sub-module is configured to perform format conversion on the original image data according to a preset picture size to obtain matrix data.
[0148] The data type conversion sub-module is configured to convert an original data type of the matrix data into a floating-point data type to obtain an original matrix of the original image.
[0149] In some embodiments, the bias attribute initialization module 33 is specifically configured to randomly initialize the global bias, the M-dimensional width bias attribute of the original image, and the N-dimensional height bias attribute of the original image by using floating-point data between 0 and 1.
[0150] The matrix reconstruction module 34 is specifically configured to add the initialized width bias attribute, the initialized height bias attribute, and the initialized global bias to the low-dimensional hidden feature matrix to obtain an MxN-dimensional reconstructed matrix.
[0151] In some embodiments, the device further comprises:
[0152] The reconstruction restoring module is configured to: after storing the updated latent feature matrix and the updated related bias attribute to obtain compressed data of the image data, obtain the updated latent feature matrix and the updated related bias attribute, reconstruct the original image data by using the reconstruction formula to obtain a reconstruction matrix; and quantize the reconstruction matrix to obtain a data matrix of the same data type as the original image data.
[0153] The functions and effects of the modules / sub-modules in the device are described in detail in the implementation process of the corresponding steps in the above method, and will not be described here.
[0154] Figure 6 A module block diagram of an electronic device 40 is shown.
[0155] As shown in Figure 6 The electronic device 40 includes one or more processors 41 configured to implement methods for compressing image data as described above.
[0156] In some embodiments, the electronic device 40 can include a computer readable storage medium 49, which can store programs that can be invoked by the processor 41, and can include a non-volatile storage medium. In some embodiments, the electronic device 40 can include a memory 48 and an interface 47. In some embodiments, the electronic device 40 can also include other hardware according to actual application.
[0157] The computer readable storage medium 49 of the embodiments of the present application has programs stored thereon, which, when executed by the processor 41, are configured to implement the method for compressing image data as described above.
[0158] The present application can take the form of a computer program product embodied in one or more computer readable storage media 49 (including but not limited to disk storage, CD-ROMs, optical storage, etc.) having a computer readable program code embodied thereon. The computer readable storage medium 49 includes permanent and non-permanent, removable and non-removable media, and can be implemented in any method or technology to store information. The information can be computer readable instructions, data structures, program modules or other data. Examples of computer readable storage medium 49 include, but are not limited to: phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, magnetic tape, magnetic disk storage or other magnetic storage device, or any other non-transmission medium that can be used to store information accessible by a computing device.
[0159] The above merely provides preferred embodiments of the present specification, but not intended to limit the present specification. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification shall be included in the protection scope of the present specification.
[0160] It also needs to be explained that the term "comprising", "including" or any other variant thereof is intended to cover the non-exclusive inclusion, so that the process, method, article or equipment including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or equipment. Without more limitations, the statement "including a……" limited element does not exclude the presence of other identical elements in the process, method, article or equipment including the element.
Claims
1. A method of compressing image data, characterized by, The method comprises the following steps: format conversion is performed on the original image data according to a preset image size to obtain matrix data; the original data type of the matrix data is converted into floating-point data to obtain an original matrix of the original image; the original image is a high-dimensional raw format remote sensing image composed of height and width; an initial hidden space feature matrix is initialized by specifying a compressed hidden space dimension of the original image channel to obtain a low-dimensional hidden feature matrix; the specified compressed hidden space dimension D is used to reflect that the compressed data is less than the data of the original image after compression; the specified compressed hidden space dimension D needs to satisfy the condition (D+1)×(M+N)+1<M×N, and the specified compressed hidden space dimension D is at least 1; M is the dimension corresponding to the width, and N is the dimension corresponding to the height; the low-dimensional hidden feature matrix is randomly initialized using floating-point data between 0 and 1, and the dimensions are set to [M, D] and [D, N] respectively; the global bias of the original image data, the width bias attribute of the M-dimensional of the original image, and the height bias attribute of the N-dimensional of the original image are randomly initialized using floating-point data between 0 and 1; on the basis of the low-dimensional hidden feature matrix, the sum of the initialized width bias attribute, the initialized height bias attribute, and the initialized global bias is added to obtain an M×N-dimensional reconstruction matrix; the low-dimensional hidden feature matrix and the related bias attribute are updated using the reconstruction matrix and the original matrix; the updated hidden feature matrix and the updated related bias attribute are stored to obtain the compressed data of the image data.
2. The compression method of image data according to claim 1, characterized in that, The iterative updating of the low-dimensional hidden feature matrix and the related bias attribute using the reconstruction matrix and the original matrix comprises: based on the current loss set by the reconstruction matrix and the original matrix, the hidden feature matrix and the related bias attribute are adjusted according to the reconstruction matrix and the original matrix until the iteration end condition is met, and the updated hidden feature matrix and the updated related bias attribute are output.
3. The compression method of image data according to claim 2, wherein, The adjustment of the hidden feature matrix and the related bias attribute based on the current loss set by the reconstruction matrix and the original matrix according to the reconstruction matrix and the original matrix comprises: based on the element value of the reconstruction matrix and the element value of the original matrix, a loss function of the reconstruction matrix and the original matrix is determined; the loss function comprises a regularization weight for adjusting the hidden feature matrix and the related bias attribute; the gradient descent method is used to iteratively update the hidden feature matrix and the related bias attribute according to the loss function.
4. The image data compression method according to any one of claims 1 to 3, wherein After the updated hidden feature matrix and the updated related bias attribute are stored to obtain the compressed data of the image data, the method further comprises: the updated hidden feature matrix and the updated related bias attribute are obtained according to the compressed data; Using the updated completed hidden feature matrix and the updated completed related bias attribute, a reconstruction matrix is obtained according to a matrix reconstruction formula, the reconstruction matrix is quantized, and a data matrix of the same data type as the original image data is obtained.
5. An apparatus for compressing image data, characterized by comprising: Comprise: The data processing module comprises a data format conversion submodule and a data type conversion submodule; The data format conversion submodule is configured to perform format conversion on the original image data according to a preset picture size, and obtain matrix data; The data type conversion submodule is configured to convert the original data type of the matrix data into floating-point data, and obtain an original matrix of the original image; the original image is a high and wide remote sensing image in a high-dimensional raw format; The hidden feature matrix initialization module is configured to initialize an initial hidden space feature matrix by specifying a compressed hidden space dimension of the original image channel, and obtain a low-dimensional hidden feature matrix; the specified compressed hidden space dimension D is used to reflect that the compressed data is less than the data of the original image after compression; the specified compressed hidden space dimension D needs to satisfy the condition (D+1)×(M+N)+1 The bias attribute initialization module is specifically configured to randomly initialize the low-dimensional hidden feature matrix using floating-point data between 0 and 1, and set the dimensions to [M, D] and [D, N] respectively; and randomly initialize a global bias, a width bias attribute of M dimensions of the original image, and a height bias attribute of N dimensions of the original image using floating-point data between 0 and 1; The matrix reconstruction module is specifically configured to add the sum of the initialized width bias attribute, the initialized height bias attribute, and the initialized global bias to the low-dimensional hidden feature matrix, and obtain an M×N-dimensional reconstruction matrix; The bias attribute initialization module is configured to initialize the related bias attribute of the original image data; The matrix reconstruction module is configured to obtain a reconstruction matrix of the image data using the low-dimensional hidden feature matrix and the related bias attribute; The attribute updating module is configured to update the low-dimensional hidden feature matrix and the related bias attribute using the reconstruction matrix and the original matrix; The data compression module is configured to store the updated completed hidden feature matrix and the updated completed related bias attribute, and obtain compressed data of the image data.
6. The image data compression apparatus of Claim 5, wherein The attribute updating module comprises an attribute updating submodule; The attribute updating submodule is configured to adjust the hidden feature matrix and the related bias attribute based on a current loss set by the reconstruction matrix and the original matrix, until an iteration end condition is met, and output the updated completed hidden feature matrix and the updated completed related bias attribute.
7. The image data compression apparatus of Claim 6, wherein The attribute updating submodule is specifically configured to determine a loss function of the reconstructed matrix and the original matrix based on element values of the reconstructed matrix and element values of the original matrix; the loss function comprises adjusting a regularization weight of the latent feature matrix and the related bias attribute; and the latent feature matrix and the related bias attribute are iteratively updated using a gradient descent method according to the loss function.
8. The image data compression apparatus of any one of claims 5 to 7, wherein The device further comprises: The reconstruction restoring module is configured to, after the updated latent feature matrix and the updated related bias attribute that have completed the updating are stored to obtain compressed data of the image data, obtain the updated latent feature matrix and the updated related bias attribute according to the compressed data, reconstruct the original image data by using the reconstruction formula to obtain a reconstructed matrix, and quantize the reconstructed matrix to obtain a data matrix of the same data type as the original image data.
9. A computer-readable storage medium, characterized in that, A program is stored thereon, and the program is executed by a processor to implement the image data compression method according to any one of claims 1-4.
Citation Information
Patent Citations
Image decomposition method based on NMF
CN108985356A