Data compression method for image low-light enhancement
By extracting symbolic vectors and performing logarithmic transformation on the weight array in the supervised learning model to form FP8 data, the problem of slow processing speed of low-light images is solved, and efficient low-light image enhancement is achieved, significantly improving processing efficiency.
Patent Information
- Application Number
- CN202311830802.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-28
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2043-12-28
AI Technical Summary
Existing technologies suffer from slow processing speeds when handling low-light images, especially video images. In particular, the binary conversion of weight parameters during neural network training is time-consuming, resulting in low processing efficiency in applications such as video surveillance.
By establishing an initial supervised learning model, the weight arrays W and B are subjected to sign vector extraction and logarithmic transformation to form E5M2 FP8 data, which replaces the original weight array, thereby achieving data compression and improving processing speed.
It significantly improves the processing speed of low-light enhancement of images, shortens the processing time from 36 seconds to about 0.05 seconds, and improves processing efficiency.
Smart Images

Figure CN117788612B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a data compression method for enhancing low-light performance in images. Background Technology
[0002] As is well known, outdoor image shooting is often affected by a variety of natural factors. For example, images taken in unfavorable natural environments such as cloudy days, nights, and dusk are often dark and appear as low-light images of poor quality.
[0003] Therefore, it is necessary to perform tone enhancement processing on such low-light images. The low-light enhancement process is actually a data transformation process, which often involves massive data processing. On the one hand, the amount of data contained in a single image is huge, and on the other hand, low-light image enhancement is often not aimed at a single image, but at countless frames formed in the video. The large number of image frames also increases the amount of data that needs to be processed.
[0004] In particular, low-light enhancement processes often inevitably involve training neural networks. Currently, all weights in neural network training are performed on the GPU. If binary codes are used to convert the weight parameters, the weight parameters must first be moved from the GPU to the CPU, then calculated one number at a time in a loop: first the integer bits, then the fractional bits, then concatenating the integer and fractional bits together, converting this binary code into an FP8 result, and finally loading all the FP8 results onto the GPU. This process is extremely time-consuming.
[0005] Therefore, if the processing speed of a single image is slightly slow, the data processing of a large number of video frames will amplify this slowness by millions or even hundreds of millions of times. This problem is particularly serious in today's society where video surveillance is widely used. Summary of the Invention
[0006] This invention provides a data compression method for enhancing low-light performance in images, effectively solving the aforementioned problems existing in the prior art.
[0007] Specifically, this invention provides a data compression method for enhancing low-light images. An initial supervised learning model is established to convert a low-light image into a normal color image. The training set of the initial supervised learning model is set as an initial vector data set X representing the low-light image, and the output corresponding to the initial vector data set X is a vector data set Y of the normal image. The formula of the supervised learning model is Y = W*X + B, where W and B are weight arrays to be learned during the supervised learning process. Then, data transformation is performed on the weight arrays W and B. During the data transformation process, the sign vectors of the weight arrays W and B are first extracted, namely w_sign and b_sign, respectively. The weight array B is multiplied term by term by the b_sign vector to obtain the arrB vector, and the weight array W is multiplied term by term by the w_sign vector to obtain the arrW vector. For each term of arrB, the logarithm to base 2 is calculated, and the result is rounded down to the nearest integer, resulting in the vector B_log_v. For each term of arrW, the logarithm to base 2 is calculated, and the result is rounded down to the nearest integer, resulting in the vector W_log_v. For positive terms B_pos in the B_log_v array, the offset B_shift_pos = 2 - B_pos is calculated; for negative terms B_neg... Calculate its offset value B_shift_neg = |B_neg| + 3, thus obtaining the offset vector B_shift of array arrB. Calculate the transformed array arr1B for item B, which is arr1B = arrB * (2^B_shift). Then, round each item in the transformed array arr1B to obtain array arr2B. Finally, calculate the transformed vector B' = (arr2B / 2^B_shift) * b_sign. For the positive number item W_pos in the W_log_v array, calculate its offset value W_shift_pos = 2 - W_pos; for W_log... The negative term W_neg in the _v array is used to calculate its offset W_shift_neg = |W_neg| + 3, thus obtaining the offset vector W_shift of the array arrW. The transformation array arr1W is calculated, which is arrW * (2^W_shift). Then, the transformation array arr1W is rounded down item by item to obtain the array arr2W. Finally, the transformed vector W' = (arr2W / 2^W_shift) * w_sign is calculated. The transformed vectors B' and W' are suitable for forming the FP8 data of E5M2 to replace the weight arrays B and W in the initial supervised model.
[0008] Preferably, the initial supervised learning model is a convolutional neural network.
[0009] Preferably, the weight arrays W and B are four-dimensional arrays.
[0010] Preferably, the formula for calculating the sign vector b_sign of the weight array B is b_sign = (B≥0)*2-1, that is, this formula means: if any element in B is greater than or equal to 0, it is "true", then (B≥0) takes the value of 1, and thus the corresponding element in the b_sign vector takes the value of 1*2-1 = 1; if any element in B is less than 0, it is "false", then (B≥0) takes the value of 0, and thus the corresponding element in the b_sign vector takes the value of 0*2-1 = -1.
[0011] Preferably, the formula for calculating the sign vector w_sign of the weight array W is w_sign = (W≥0)*2-1, that is, this formula means: if any element in W is greater than or equal to 0, it is "true", then (W≥0) takes the value of 1, and thus the corresponding element in the w_sign vector takes the value of 1*2-1 = 1; if any element in W is less than 0, it is "false", then (W≥0) takes the value of 0, and thus the corresponding element in the w_sign vector takes the value of 0*2-1 = -1.
[0012] In summary, the data compression method for image low-light enhancement provided by this invention performs data transformation on the weight array, which is essential in the supervised learning model during image conversion, using a specific method. The transformed vector replaces the original weight array in the supervised learning model, thereby effectively compressing the data in the supervised model. This efficiently enhances image low light with almost no loss of accuracy. Compared to existing technologies where related data needs to be converted back and forth using binary, its processing speed is greatly improved. Attached Figure Description
[0013] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be discussed below. Obviously, the technical solutions described in conjunction with the accompanying drawings are only some embodiments of the present invention. For those skilled in the art, other embodiments and their accompanying drawings can be obtained based on the embodiments shown in these drawings without creative effort.
[0014] Figure 1 An exemplary schematic diagram of a supervised learning model in an image low-light enhancement method according to the present invention is shown;
[0015] Figure 2 A flowchart of a data compression method for image low-light enhancement according to the present invention is shown. Detailed Implementation
[0016] The technical solutions of various embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments described in the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0017] This invention provides a method for enhancing low-light images, which can effectively enhance the light in low-light images through supervised learning. Furthermore, this invention also considers data transformation of the input values during the supervised learning process, thereby significantly reducing resource consumption.
[0018] Figure 1 An exemplary schematic diagram of a supervised learning model in an image low-light enhancement method according to the present invention is shown.
[0019] like Figure 1 As shown, Figure 1 The upper left section shows a low-light image. As can be seen, this low-light image is of poor quality, likely taken on a cloudy day or at night, and is clearly unusable and unprocessable. Therefore, it is necessary to convert this low-light image to a higher quality one. Figure 1 The normal image on the right.
[0020] To accomplish this transformation, a model needs to be built for supervised learning. In the supervised learning process, the training set is set as the initial vector data set X representing the low-light image, and the corresponding output is the vector data set Y of multiple normal images. The formula for the initial supervised learning model is Y = W * X + B, where W and B are the weight parameters that need to be learned during the supervised learning process.
[0021] For example, in Figure 1 In this study, CNN (Convolutional Neural Network) is used as the learning model for supervised learning.
[0022] The key consideration now is that the initial vector data set X representing a low-light image often contains massive amounts of data, typically high-precision data like FP32. This data needs to be compressed into FP8 data in E5M2 format. For example, if the initial vector data set X representing a low-light image has four elements [3, 3, 512, 512], the total number of elements is 2,359,296. Performing a compression operation on all elements would take approximately 36 seconds. However, using the data compression method for low-light image enhancement according to this invention, the time is reduced to approximately 0.05 seconds, thus significantly accelerating the processing speed. The data compression method for low-light image enhancement according to this invention will be described in detail below.
[0023] The key to the data compression method for image low-light enhancement of the present invention lies in the data transformation of the above-mentioned weight parameters W and B, which are converted into E5M2 FP8 data. Figure 2 A flowchart of a data compression method for image low-light enhancement according to the present invention is shown.
[0024] The weight parameters W and B are both weight arrays, for example, a four-dimensional array of [O, I, H, K].
[0025] First, extract the sign vectors of the weight arrays for the weight parameters W and B, which are w_sign and b_sign, respectively.
[0026] For example, if the weight parameter B = [-0.12, 0.5, 0.2, -0.138], it can be seen that in the four-dimensional array of this weight parameter, the first and fourth dimensions (i.e., "-0.12" and "-0.138") are negative, so the sign is "-1"; while the second and third dimensions (i.e., "0.5" and "0.2") are positive, so the sign is "1".
[0027] The extracted symbol vector is [-1, 1, 1, -1].
[0028] The specific calculation formula is b_sign = (B≥0)*2 - 1. To explain this formula in more detail: if any element in B is greater than or equal to 0, it is considered "true," and (B≥0) takes the value 1. Therefore, the corresponding element in the b_sign vector takes the value 1*2 - 1 = 1. Conversely, if any element in B is less than 0, it is considered "false," and (B≥0) takes the value 0. Therefore, the corresponding element in the b_sign vector takes the value 0*2 - 1 = -1.
[0029] Similarly, the formula for calculating the sign vector w_sign of the weight array W is w_sign = (W≥0)*2-1, which means that if any element in W is greater than or equal to 0, it is "true", then (W≥0) takes the value of 1, and thus the corresponding element in the w_sign vector takes the value of 1*2-1 = 1; if any element in W is less than 0, it is "false", then (W≥0) takes the value of 0, and thus the corresponding element in the w_sign vector takes the value of 0*2-1 = -1.
[0030] For example, if the second dimension of the weight parameter B is 0.5≥0, then it is "true", and the corresponding (B≥0) value is 1. Therefore, the second dimension element in the b_sign vector is 1*2-1=1.
[0031] If the first dimension of the weight parameter B is -0.12 < 0, then it is "false", and the corresponding (B≥0) value is 0. Therefore, the first dimension element in the b_sign vector is 0*2-1=-1.
[0032] The weight parameter B is then multiplied term by term by the b_sign vector to obtain the arrB vector. Since each term of the b_sign vector is 1 or -1, the arrB vector does not change the absolute value of each term in the weight parameter B after the term-by-term multiplication, but it can ensure that each term is non-negative.
[0033] Continuing with the previous example, the weight parameter B = [-0.12, 0.5, 0.2, -0.138], and its corresponding b_sign vector is [-1, 1, 1, -1]. Then, the arrB vector after multiplying each term is [0.12, 0.5, 0.2, 0.138], all of which become non-negative values.
[0034] Similarly, the weight parameter W is multiplied term by term with the w_sign vector to obtain the arrW vector.
[0035] Next, take the logarithm of each term in arrB with base 2, and round the result to the nearest integer, which is then denoted as vector B_log_v.
[0036] For example, if the weight parameter B = [0.1865487, -2.2689, 3.569, -0.00156], then arrB = [0.1865487, 2.2689, 3.569, 0.00156]. Taking the logarithm of each term in arrB to base 2 and rounding the result to the nearest integer, we get B_log_v = [-2, 1, 1, -9].
[0037] For the positive number B_pos in the B_log_v array, calculate its offset value B_shift_pos = 2 - B_pos; for the negative number B_neg in the B_log_v array, calculate its offset value B_shift_neg = |B_neg| + 3, thus obtaining the offset value vector B_shift of the array arrB.
[0038] In the example above, the offset values of the first term (i.e., -2) and the fourth term (i.e., -9) of B_log_v are |-2|+3=5 and |-9|+3=12, respectively; the offset values of the second term (i.e., 1) and the third term (i.e., 1) are 2-1=1 and 2-1=1, respectively. Thus, the offset value vector B_shift=[5, 1, 1, 12] is formed.
[0039] Next, we will encounter the crucial B-term transformation array arr1B in the data compression method of this invention. This transformation array arr1B = arrB * (2^B_shift). Then, we will round each term of the transformation array arr1B to obtain the array arr2B.
[0040] In the example above, we first calculate 2^B_shift, resulting in [32, 2, 2, 4096]. Then, we multiply each term of arrB = [0.1865487, 2.2689, 3.569, 0.00156], resulting in arr1B = [5.9695584, 4.5378, 7.138, 6.38976]. Finally, we round each term of arr1B to obtain arr2B = [5, 4, 7, 6].
[0041] The final calculated vector is B' = (arr2B / 2^B_shift) * b_sign.
[0042] In the example above, the first term of B' is 5 / (2^5)*1=0.15625, the second term is 4 / 2^1*(-1)=-2, the third term is 7 / (2^1)*1=3.5, and the fourth term is 6 / (2^12)*(-1)=-0.00146484375.
[0043] Based on this, B' = [0.15625, -2, 3.5, -0.00146484375]. Therefore, the transformed vector B' is suitable for replacing the weight parameter B in the initial supervised model using FP8 data of E5M2.
[0044] Similarly, the weight array W is multiplied term by term by the w_sign vector to obtain the arrW vector. The logarithm of each term in arrW is calculated to base 2, and the result is rounded down to the nearest integer and denoted as the vector W_log_v.
[0045] For the positive number W_pos in the W_log_v array, calculate its offset W_shift_pos = 2 - W_pos; for the negative number W_neg in the W_log_v array, calculate its offset W_shift_neg = |W_neg| + 3. This yields the offset vector W_shift of the array arrW.
[0046] Calculate the transformation array arr1W for W terms, where arr1W = arrW * (2^W_shift). Then, round each term of the transformation array arr1W to obtain the array arr2W. Finally, calculate the transformed vector W' = (arr2W / 2^W_shift) * w_sign.
[0047] The transformed vector W' is suitable for forming the FP8 data of E5M2 to replace the weight array W in the initial supervised model.
[0048] This concludes the basic introduction of the data compression method for image low-light enhancement according to the present invention. In the data compression method for image low-light enhancement provided by the present invention, the weight array, which is essential in the supervised learning model during image transformation, is transformed using a specific method. The transformed vector replaces the original weight array in the supervised learning model, thereby effectively compressing the data in the supervised model. This efficiently achieves image low-light enhancement with almost no loss of accuracy. Compared to existing technologies where related data requires back-and-forth conversion via binary, its processing speed is significantly improved.
[0049] The above description is merely an exemplary embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A data compression method for enhancing low-light performance in images, characterized in that, An initial supervised learning model is established to convert a low-light image into a normal color image. The training set of the initial supervised learning model is defined as the initial vector data set X representing the low-light image, and the output corresponding to the initial vector data set X is the vector data set Y of the normal image. The formula for the supervised learning model is Y = W * X + B, where W and B are the weight arrays to be learned during the supervised learning process. Then, data transformation is performed on the weight arrays W and B. During this data transformation process... First, extract the sign vectors of the weight arrays W and B, which are w_sign and b_sign, respectively. Next, multiply the weight array B with the b_sign vector item by item to obtain the arrB vector, and multiply the weight array W with the w_sign vector item by item to obtain the arrW vector. For each term of arrB, take the logarithm to base 2, round the result to the nearest integer, and record it as a vector B_log_v. For each term of arrW, take the logarithm to base 2, round the result to the nearest integer, and record it as a vector W_log_v. For the positive number B_pos in the B_log_v array, calculate its offset B_shift_pos = 2 - B_pos; For the negative item B_neg in the B_log_v array, calculate its offset value B_shift_neg = |B_neg| + 3, thus obtaining the offset vector B_shift of the array arrB. Calculate the transformation array arr1B for item B, which is arrB * (2^B_shift). Then, round each item in the transformation array arr1B to obtain the array arr2B. Finally, calculate the transformed vector B' = (arr2B / 2^B_shift) * b_sign. For each positive term W_pos in the W_log_v array, calculate its offset W_shift_pos = 2 - W_pos; for each negative term W_neg in the W_log_v array, calculate its offset W_shift_neg = |W_neg| + 3. This yields the offset vector W_shift of the array arrW. Calculate the transformation array arr1W, which is arrW * (2^W_shift). Then, round each element of the transformation array arr1W to obtain the array arr2W. Finally, calculate the transformed vector W' = (arr2W / 2^W_shift) * w_sign. The transformed vectors B' and W' are suitable for forming the FP8 data of E5M2, which replaces the weight arrays B and W in the initial supervised model. The first calculation formula for the sign vector b_sign of the weight array B is b_sign = (B≥0) * 2 - 1; the second calculation formula for the sign vector w_sign of the weight array W is w_sign = (W≥0) * 2 - 1.
2. The method according to claim 1, characterized in that, The initial supervised learning model is a convolutional neural network.
3. The method according to claim 1, characterized in that, The weight arrays W and B are four-dimensional arrays.
4. The method according to claim 1, characterized in that, The first calculation formula means: if any element in B is greater than or equal to 0, it is "true", then (B≥0) takes the value 1, and thus the corresponding element in the b_sign vector takes the value 1*2-1=1; if any element in B is less than 0, it is "false". Then (B≥0) takes the value 0, and thus the corresponding element in the b_sign vector takes the value 0*2-1=-1.
5. The method according to claim 1, characterized in that, The second calculation formula means: if any element in W is greater than or equal to 0, it is "true", then (W≥0) takes the value 1, and thus the corresponding element in the w_sign vector takes the value 1*2-1=1; if any element in W is less than 0, it is "false". Then (W≥0) takes the value 0, and thus the corresponding element in the w_sign vector takes the value 0*2-1=-1.
Citation Information
Patent Citations
Gesture image retrieval method based on multi-scale Retinex and improved VGGNet network
CN111695508A
Dark light image enhancement method based on attention mechanism
CN114399431A
