Image color correction model training method, device and electronic equipment
By dividing the interval between the three -dimensional RGB sample data and training the image color correction network separately, the problem of slow training and lack of model accuracy in existing technologies have been solved, and more efficient image color correction effects are achieved.
Patent Information
- Application Number
- CN201910905790.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-09-24
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2039-09-24
AI Technical Summary
The prior art has problems of slow training speed and insufficient model accuracy in image color correction, especially when processing large amounts of three-dimensional RGB sample data.
By dividing the three-dimensional RGB sample data into intervals, multiple interval segments are obtained, and the image color correction network is trained separately, and the network parameters are updated to improve the training speed and model accuracy.
It improves the training speed of image color correction network and the accuracy of the model after training, so that the effect of image color correction is more ideal.
Smart Images

Figure CN112634143B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of machine learning, and in particular to an image color correction model training method, device, computer-readable storage medium and electronic device. Background Art
[0002] With the widespread application of digital imaging equipment, the consistency of image color reproduction has gradually become a hot topic in current research. The color information of an image is often an important basis for image analysis, so it is of great research significance to study color correction technology that can truly reflect the color of the observed object itself. The goal of color correction is to study how to describe the intrinsic color of an object under various lighting conditions. At present, color correction has been applied in many image processing scenarios such as medical images, remote sensing images, mural images, and certificate images, and with the advancement of image technology, it will be more widely used in people's daily lives in the future.
[0003] At present, due to the influence of ambient light and the camera's own optical components, there is a certain error between the original image signal obtained by the camera and the real scene. In order to solve this problem, some methods for image color correction have been proposed, such as the traditional color correction method based on partial least squares regression and the traditional neural network color correction method. The traditional color correction method based on partial least squares regression can better solve problems such as multiple correlations between independent variables and relatively small number of samples, but the accuracy is still difficult to meet the needs of practical applications. The traditional color correction method based on neural network has a large number of parameters and occupies more multipliers, which is not conducive to hardware implementation. Summary of the invention
[0004] In order to solve the above technical problems, the present application is proposed. The embodiments of the present application provide an image color correction model training method, device, computer-readable storage medium and electronic device.
[0005] According to one aspect of the present application, a method for training an image color correction model is provided, comprising: dividing three-dimensional RGB sample data into intervals according to a preset method to obtain multiple interval segments corresponding to the three-dimensional RGB sample data; training an image color correction network using the multiple interval segments of the three-dimensional RGB sample data respectively, and updating parameters of the image color correction network to obtain the image color correction model.
[0006] According to a second aspect of the present application, an image color correction model training device is provided, comprising: a division module, used to divide three-dimensional RGB sample data into intervals according to a preset method, to obtain multiple interval segments corresponding to the three-dimensional RGB sample data; a model training module, used to train an image color correction network respectively through the multiple interval segments of the three-dimensional RGB sample data, and update the parameters of the image color correction network to obtain the image color correction model.
[0007] According to a third aspect of the present application, a computer-readable storage medium is provided, wherein the storage medium stores a computer program, and the computer program is used to execute any of the above-mentioned image color correction model training methods.
[0008] According to a fourth aspect of the present application, an electronic device is provided, comprising: a processor; a memory for storing instructions executable by the processor; and the processor for executing any of the above-mentioned image color correction model training methods.
[0009] The technical solution provided by the embodiments of the present application can at least bring the following beneficial effects:
[0010] By dividing the three-dimensional RGB sample data into intervals and using the multiple interval segments obtained by the interval division to train the image color correction network respectively, the training speed of the image color correction network and the accuracy of the trained image color correction model can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] By describing the embodiments of the present application in more detail in conjunction with the accompanying drawings, the above and other purposes, features and advantages of the present application will become more apparent. The accompanying drawings are used to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the present application and do not constitute a limitation of the present application. In the accompanying drawings, the same reference numerals generally represent the same components or steps.
[0012] Figure 1 It is a flowchart of an image color correction model training method provided by an exemplary embodiment of the present application.
[0013] Figure 2 It is a flowchart of an image color correction model training method provided by another exemplary embodiment of the present application.
[0014] Figure 3 It is a flowchart of an image color correction model training method provided by another exemplary embodiment of the present application.
[0015] Figure 4 It is a block diagram of an image color correction model training device provided by an exemplary embodiment of the present application.
[0016] Figure 5 It is a block diagram of an image color correction model training device provided by another exemplary embodiment of the present application.
[0017] Figure 6 It is a schematic diagram of the structure of an electronic device provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0018] Below, the exemplary embodiments according to the present application will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application, and it should be understood that the present application is not limited to the exemplary embodiments described here.
[0019] Application Overview
[0020] The color of the collected image is closely related to the collection environment. The color of the image obtained in different collection environments is different, so it is necessary to provide an image color correction model to perform color correction on the collected image.
[0021] In response to the above problems, an embodiment of the present application provides an image color correction model training method and device, which can improve the training speed of the image color correction network and the accuracy of the trained image color correction model by dividing the three-dimensional RGB sample data into intervals and using the multiple interval segments obtained by the interval division to train the image color correction network respectively.
[0022] The regression analysis prediction method is to establish a regression equation between variables based on the analysis of the correlation between independent variables and dependent variables of various phenomena, and use the regression equation as a prediction model. The relationship between dependent variables is mostly expressed as a correlation relationship based on the quantitative changes of independent variables in the prediction period. Therefore, the regression analysis prediction method is an important prediction method. When we predict the future development status and level of the phenomenon of the research object, if we can find the main factors affecting the prediction object of the research and obtain their quantitative data, we can use the regression analysis prediction method for prediction. The traditional regression analysis prediction method can be used for printer color correction. It requires less storage space, has fast calculation speed, and is easy to implement. However, the accuracy of the traditional regression analysis prediction method is not ideal, and the amount of sample data is generally small, resulting in poor generalization ability of the traditional regression model, so it cannot achieve a good image color correction effect.
[0023] In one embodiment of the present application, the image color correction model obtained by combining machine learning technology with regression analysis has higher accuracy and model generalization ability, and the obtained image color correction model has low computational complexity, which is conducive to color correction of the processed image on the terminal device.
[0024] Exemplary Methods
[0025] Figure 1 FIG. 1 is a flow chart of an image color correction model training method provided by an exemplary embodiment of the present application. This embodiment can be applied to an electronic device, such as a game console, a laptop computer, or a server. Figure 1 As shown, the process includes the following steps 110 and 110.
[0026] Step 110 , divide the three-dimensional RGB sample data into intervals according to a preset method to obtain a plurality of interval segments corresponding to the three-dimensional RGB sample data.
[0027] The three-dimensional RGB sample data is used to train the image color correction network. In some embodiments, the three-dimensional RGB sample data may be 255*255*255 RGB standard values in the RGB color space, and different RGB standard values correspond to different colors in the RGB color space, but the embodiments of the present application are not limited thereto, and the three-dimensional RGB sample data may also include other RGB values, for example.
[0028] In order to obtain a more accurate image color correction model, it is generally necessary to obtain a large amount of three-dimensional RGB sample data. However, when the image color correction network is trained directly through a large amount of three-dimensional RGB sample data, the training speed of the image color correction network will be affected. To this end, in one embodiment, the three-dimensional RGB sample data is divided into intervals to obtain a plurality of interval segments corresponding to the three-dimensional RGB sample data. The image color correction network is trained respectively through the multiple interval segments of the three-dimensional RGB sample data, which can improve the training efficiency, reduce the training error in the image color correction network training process, and improve the accuracy of the trained image color correction model, so that the trained image color correction model has a better color correction effect on the image to be corrected.
[0029] The embodiments of the present application do not limit the division method of the three-dimensional RGB sample data into intervals. For example, the three-dimensional RGB sample data can be randomly divided into multiple interval segments, or the three-dimensional RGB sample data can be evenly divided into multiple interval segments, or the three-dimensional RGB sample data can be divided into intervals in a manner that minimizes, second smallest, or smaller training errors in the current round of training, or the three-dimensional RGB sample data can be divided into intervals in combination with multiple interval division methods.
[0030] Step 120 , respectively training an image color correction network using the multiple interval segments of the three-dimensional RGB sample data, and updating parameters of the image color correction network to obtain a trained image color correction network model.
[0031] In one embodiment, the image color correction network is, for example, a regression equation based on adaboost, but the embodiment of the present application is not limited to this, and can also be a regression equation based on other machine learning algorithms. For example, the regression equation is a linear regression equation, and in another embodiment, the regression equation can also be a polynomial regression equation, which is not limited in the embodiment of the present application.
[0032] In one embodiment, the image color correction network is trained respectively through the sub-sample data corresponding to the multiple intervals of the three-dimensional RGB sample data, and the training error of the image color correction network in each interval can be obtained, and then the parameters of the image color correction network are updated according to the training error of each interval. For example, when the number of training rounds for training the image color correction network or the current round training error meets the preset conditions, the training ends, and the trained image color correction network model can be obtained at this time. For example, the current round training error is calculated based on the training error of each current interval, for example, it can be the weighted sum of the training errors of each current interval, or the mean, median, etc. of the training errors of each current interval, which is not limited in the embodiments of the present application.
[0033] In addition, the training method of the image color correction model provided in the embodiment of the present application can improve the training speed of the image color correction network and the accuracy of the trained image color correction model by dividing the three-dimensional RGB sample data into intervals and using the multiple interval segments obtained by the interval division to train the image color correction network respectively.
[0034] Figure 2 FIG. 1 is a flow chart of an image color correction model training method provided by another exemplary embodiment of the present application. This embodiment can be applied to an electronic device, such as a game console, a laptop computer, or a server. Figure 2 As shown, the method includes the following steps 210 to 290.
[0035] Step 210 , transforming the three-dimensional RGB standard value according to the color regression model to obtain a three-dimensional RGB target value corresponding to the three-dimensional RGB standard value.
[0036] In one embodiment, the color regression model is a back propagation (BP) neural network model, but the embodiment of the present application is not limited to this, and other neural network models can also be used. The following takes the color regression model obtained by training the BP neural network as an example for illustration. For example, the process of training the BP neural network can be:
[0037] a) obtaining a color card image obtained by photographing a standard color card;
[0038] b) Preprocessing the color card image to eliminate the color deviation caused by exposure and color temperature during the shooting process, such as black balance correction, white balance correction, demosaic correction and gamma correction;
[0039] c) extracting the RGB value of each pixel from the preprocessed color card image to obtain RGB data of the color card image;
[0040] d) Inputting the RGB data of the color card image and the RGB data of the standard color card into the back propagation BP neural network for processing to obtain the color regression model. The RGB data of the color card image is the sample data of the back propagation BP neural network, and the RGB data of the standard color card is the labeled data of the sample data. The sample data and the labeled data correspond one to one, or it can be said that the RGB data of the color card image and the RGB data of the standard color card correspond one to one.
[0041] In one embodiment, the three-dimensional RGB standard value is 255*255*255 RGB standard values in the RGB color space. The three-dimensional RGB standard value is transformed by the trained color regression model to obtain a three-dimensional RGB target value corresponding to the three-dimensional RGB standard value.
[0042] Step 220: Acquire the 3D RGB standard value and the 3D RGB target value as 3D RGB sample data.
[0043] The three-dimensional RGB sample data obtained according to an embodiment of the present application includes both three-dimensional RGB standard values and three-dimensional RGB target values, which expands the data volume of the three-dimensional RGB sample data, so that the image color correction model trained by the three-dimensional RGB sample data has better generalization ability and accuracy.
[0044] Step 230, determining the current value of the selection function based on the current number of training rounds, the total number of training rounds, the error of the previous training round and the preset coefficient.
[0045] In some embodiments of the present application, the image color correction network is trained for multiple rounds of iterations using the three-dimensional RGB sample data to obtain an image color correction model. For example, based on the current number of training rounds, the total number of training rounds, the error of the previous round of training, and a preset coefficient, the current value of the selection function in the current round is determined, and according to the current value of the selection function, the three-dimensional RGB sample data is divided into intervals, and the image color correction network is trained based on the multiple interval segments obtained by the interval division to obtain the image color correction model.
[0046] In one embodiment, the selection function is:
[0047]
[0048] Among them, t is the current training round number, n is the total training round number of the image color correction network, loss is the previous training error of the image color correction network, and α, β, and γ are the coefficients of the selection function. By setting the corresponding values of α, β, and γ, the current value of the selection function can be adjusted, and then different ways of dividing the three-dimensional RGB sample data into intervals can be selected.
[0049] In one embodiment, α is greater than 0 and less than 1; β is greater than 1; and γ is greater than 0 and less than 1. For example, α may also be greater than γ, for example, γ is greater than 0 and less than 0.2, and α is greater than 0.5. The specific values of α, β, and γ are not limited in the embodiment of the present application, and those skilled in the art may set the values according to the specific application.
[0050] Step 240: When the current value of the selection function meets the preset condition, the three-dimensional RGB sample data is divided into intervals according to a preset method.
[0051] In one embodiment, when the current value of the selection function is large, the three-dimensional RGB sample data is randomly divided into multiple intervals. In another embodiment, when the current value of the selection function is large, the three-dimensional RGB sample data is uniformly divided into multiple intervals, so that the sub-sample data in the multiple intervals are equal.
[0052] In some embodiments, when the current value of the selection function is greater than the third preset value, the three-dimensional RGB sample data is randomly divided into intervals. In some embodiments, when the current value of the selection function is greater than the fourth preset value, the three-dimensional RGB sample data can also be evenly divided into intervals. The fourth preset value can be equal to the third preset value, or the fourth preset value is not equal to the third preset value, which is not limited in the embodiments of the present application.
[0053] In some embodiments of the present application, when the current value of the selection function is small, for example, when the selection function is less than or equal to a first preset value, m division points are selected from the three-dimensional RGB sample data for position division, wherein the position division is to divide the three-dimensional RGB sample data into m kinds of candidate block data sets according to the m division points, where m is a positive integer; perform regression operations on the m kinds of candidate block data sets respectively to obtain regression errors of the regression operations; obtain the division point that minimizes the regression error as the preferred division point, and perform interval division on the three-dimensional RGB sample data based on the preferred division point.
[0054] For example, suppose that the three-dimensional RGB sample data is N-dimensional in the three dimensions of R, G, and B. In this way, there are N 3 RGB data. Select m division points from the three-dimensional RGB sample data for position division, and the three-dimensional RGB sample data can be divided into m candidate block data sets, where m is less than N. For example, m division points can be selected from the three-dimensional RGB sample data, and m different candidate block data sets will be generated after m position divisions. Each position division in the m position divisions will divide the three-dimensional RGB sample data into M+1 data sets, where M is the number of data sets of the three-dimensional RGB sample data in the current round of training, and M+1 is less than N. 3 That is, after position division, the three-dimensional RGB sample data is divided into M+1 data sets in the current round of training, and the m candidate block data sets all include M+1 data sets, and the RGB data included in each of the M+1 data sets in the m candidate block data sets are different.
[0055] In one embodiment, regression operations are performed on the m candidate block data sets respectively, that is, regression operations are performed on m different M+1 data sets based on m different division points. For example, the regression operation can be a polynomial regression operation, or other linear regression operations, which is not limited in the embodiment of the present application. The regression equation in the regression operation can be a linear equation, a quadratic equation, or a g-order equation can be selected according to actual conditions, where g is a positive integer greater than 2, which is not limited in the embodiment of the present application. The embodiment of the present application performs regression operations on the M+1 data sets respectively, and calculates the regression error of the M+1 data sets after the regression operation based on the input of the regression operation, that is, the value of the RGB data in the M+1 data sets and its current weight, the estimated value of the regression operation and the preset loss function. According to the sum or mean of the regression errors of the M+1 data sets, the regression error of the three-dimensional RGB sample data at the p-th position division is obtained, 1≤p≤m. For example, the preset loss function may be a mean square error (MSE). For example, a gradient descent algorithm or a least squares method may be used to calculate the minimum value of the preset loss function to obtain the regression error of each of the M+1 data sets.
[0056] The regression errors of the three-dimensional RGB sample data at m division points are compared, the division point that minimizes the regression error is obtained as the preferred division point, and the three-dimensional RGB sample data is divided into intervals based on the preferred division point.
[0057] For example, the following function (1) may be used to calculate the preferred partition point:
[0058]
[0059] Among them, (x i ;) is the estimated value of the regression operation when the partition position is p; Y i is the true value of the regression input, that is, the RGB value in the three-dimensional RGB sample data, w i is the weight coefficient of the input of the regression operation, g is the total number of inputs of the regression operation, and pos is the The value of the partition position p when the minimum value is obtained, 1≤p≤m.
[0060] In one embodiment, the preferred division points selected in each round of image color correction network training may be different, but this embodiment of the present application is not limited to this.
[0061] In some embodiments of the present application, when the selection function is less than or equal to a second preset value, k sub-data blocks are selected from the three-dimensional RGB sample data, and the sub-data blocks include three-dimensional data; regression operations are performed based on the k sub-data blocks to obtain regression errors of the regression operations; and based on the sub-data block that minimizes the regression error, the three-dimensional RGB sample data is divided into intervals.
[0062] Assume that the three-dimensional RGB sample data is N-dimensional in the three dimensions of R, G, and B. In this way, there are N 3 RGB data. Select k sub-data blocks from the three-dimensional RGB sample data, and perform k types of segmentation on the three-dimensional RGB sample data, where k is less than N. 3 For example, after k splits, k sub-data blocks can be selected from the three-dimensional RGB sample data, and each of the k splits will divide the three-dimensional RGB sample data into L+1 sub-data blocks, where L is the number of sub-data blocks of the three-dimensional RGB sample data in the current round of training, and L+1 is less than N. 3 , L is a positive integer. That is, after each segmentation, the three-dimensional RGB sample data is segmented into L+1 sub-data blocks in the current round of training. After k segments, k different sets of L+1 sub-data blocks will be generated, that is, the RGB data included in the k different sets of L+1 sub-data blocks are different.
[0063] In one embodiment, regression operations are performed based on the k sub-data blocks, that is, after k divisions, regression operations are performed on k different L+1 sub-data blocks. The embodiment of the present application does not limit the regression algorithm here. For example, the regression operation can be a polynomial regression operation, or other linear regression operations. The regression equation in the regression operation can be designed according to the actual situation, and the embodiment of the present application does not limit this. The embodiment of the present application performs regression operations on L+1 sub-data blocks respectively, and calculates the regression errors of the L+1 sub-data blocks after the regression operation according to the input of the regression operation, that is, the value of the RGB data in the L+1 sub-data blocks and their current weights, the estimated value of the regression operation and the preset loss function. According to the sum or mean of the regression errors of the L+1 sub-data blocks, the regression error of the three-dimensional RGB sample data when the position is divided k times is obtained. For example, the preset loss function can be the mean square error (MSE), for example, the minimum value of the preset loss function can be calculated by the gradient descent algorithm or the least squares method to obtain the regression error of each L+1 sub-data block.
[0064] The regression errors of the three-dimensional RGB sample data when divided k times are compared, and the three-dimensional RGB sample data is divided into intervals based on the sub-data block that minimizes the regression error.
[0065] For example, the above function (1) can be used to obtain a segmentation method that minimizes the regression error of the three-dimensional RGB sample data using a similar calculation method. Based on the segmentation method that minimizes the regression error, a sub-data block that minimizes the regression error is obtained, and then the three-dimensional RGB sample data is divided into intervals.
[0066] It should be noted that the first preset value may be equal to the second preset value, or the first preset value may not be equal to the second preset value, and the embodiment of the present application does not limit this. In one embodiment, the first preset value and the second preset value are less than or equal to the third preset value and the fourth preset value.
[0067] Polynomial regression and linear regression operations have limited ability to express nonlinear data. The embodiment of the present application divides the three-dimensional RGB sample data into intervals, and the three-dimensional RGB sub-sample data in each interval has a higher similarity with the entire three-dimensional RGB sample data, which can effectively reduce the loss when training the image color correction network, which is beneficial for the image color correction network of the embodiment of the present application to reach the convergence conditions faster and improve the accuracy of the image color correction model of the embodiment of the present application.
[0068] Step 250: Input multiple intervals of the three-dimensional RGB sample data into the image color correction network respectively, and obtain the training error of the image color correction network in each interval.
[0069] In one embodiment, the image color correction network is a regression operation based on machine learning, for example, it can be a polynomial regression operation based on adaboost, but the embodiment of the present application is not limited to this.
[0070] Initially, the weight coefficients of each sample data in the three-dimensional RGB sample data are set to be the same, for example, and the three-dimensional RGB sample data is subjected to an adaboost-based polynomial regression operation to obtain a regression error, a weight coefficient of a regression equation in the polynomial regression operation, and a weight coefficient of the three-dimensional RGB sample data. In the subsequent iterative operation process, the three-dimensional RGB sample data is divided into a plurality of interval segments, and an adaboost-based polynomial regression operation is performed in each interval segment to obtain a training error of each interval segment, a weight coefficient of a regression equation of each interval segment, and a weight coefficient of sub-sample data of each interval segment.
[0071] Step 260, calculating the current training error of the image color correction network according to the training errors of each interval segment.
[0072] In one embodiment, the weighted sum or mean of the training errors of each interval segment is used as the current training error of the image color correction network, but this embodiment of the present application is not limited to this.
[0073] Step 270: Update the parameters of the image color correction network according to the current training error.
[0074] According to the current training error of the image color correction network, the parameters of the image color correction network are updated. The parameters may be, for example, the weight coefficient of the regression equation in the image color correction network, the weight coefficient of the three-dimensional RGB sample data, etc.
[0075] Step 280, determining whether the current number of training rounds reaches a preset number and / or whether the current training error is less than a preset threshold.
[0076] In one embodiment, it can be determined whether to terminate the iterative training of the image color correction network based on the current number of training rounds or the current training error. For example, it can also be determined whether to terminate the iterative training of the image color correction network based on the current number of training rounds and the current training error. When the current number of training rounds reaches the preset number of times and / or the current training error is less than the preset threshold, the iterative training of the image color correction network is stopped and step 290 is executed. When the current number of training rounds is less than the preset number of times and / or the current training error is greater than or equal to the preset threshold, step 230 is executed to perform the next round of training on the image color correction network. The preset number of times and the preset threshold can be set according to the specific situation, and the embodiment of the present application is not limited to this.
[0077] Step 290, stop updating the parameters and obtain the trained image color correction model.
[0078] According to the trained image color correction model, the image to be corrected is color corrected to obtain a corrected image, thereby improving the display effect of the image.
[0079] The image color correction model training method of the embodiment of the present application can improve the training speed of the image color correction network and the accuracy of the trained image color correction model by dividing the three-dimensional RGB sample data into intervals and using the multiple interval segments obtained by the interval division to train the image color correction network respectively. In addition, the trained image color correction model has low computational complexity and is easy to deploy in hardware to realize color correction of the image to be corrected through the image color correction model.
[0080] Figure 3 FIG. 1 is a flow chart of an image color correction model training method provided by another exemplary embodiment of the present application. This embodiment can be applied to an electronic device, such as a game console, a laptop computer, or a server. Figure 3 As shown, the method includes the following steps 310 to 390.
[0081] Step 310: transform the three-dimensional RGB standard value according to the color regression model to obtain a three-dimensional RGB target value corresponding to the three-dimensional RGB standard value.
[0082] Step 320: Acquire the 3D RGB standard value and the 3D RGB target value as 3D RGB sample data.
[0083] Step 330, determining the current value of the selection function based on the current number of training rounds, the total number of training rounds, the error of the previous training round and the preset coefficient.
[0084] Step 340: When the current value of the selection function meets the preset condition, the three-dimensional RGB sample data is divided into intervals according to a preset method.
[0085] Step 350: Input multiple intervals of the three-dimensional RGB sample data into the image color correction network respectively, and obtain the training error of the image color correction network in each interval.
[0086] Step 360, calculating the current training error of the image color correction network according to the training errors of each interval segment.
[0087] The above steps 310 to 360 are similar to steps 210 to 260 respectively, and will not be repeated here.
[0088] Step 370: updating the parameters of the image color correction network corresponding to each interval segment according to the training error of each interval segment.
[0089] In one embodiment, according to the training error of each interval segment, the weight coefficient of the regression equation in the image color correction network corresponding to each interval segment, the weight coefficient of the sub-sample data of each interval segment, etc. are updated accordingly. By training the image color correction network for each interval segment respectively, multiple sub-image color correction models can be obtained, and the training error can be reduced and the training speed can be improved.
[0090] Step 380: determine whether the current number of training rounds reaches a preset number and / or whether the current training error is less than a preset threshold.
[0091] In one embodiment, it can be determined whether to terminate the iterative training of the image color correction network based on the current number of training rounds or the current training error. For example, it can also be determined whether to terminate the iterative training of the image color correction network based on the current number of training rounds and the current training error. When the current number of training rounds reaches the preset number of times and / or the current training error is less than the preset threshold, the iterative training of the image color correction network is stopped and step 290 is executed. When the current number of training rounds is less than the preset number of times and / or the current training error is greater than or equal to the preset threshold, step 230 is executed to perform the next round of training on the image color correction network. The preset number of times and the preset threshold can be set according to the specific situation, and the embodiment of the present application is not limited to this.
[0092] Step 390, stop updating the parameter, obtain multiple sub-image color correction models, and obtain a trained image color correction model based on the multiple sub-image color correction models.
[0093] According to the training error of each interval segment, the parameters of the image color correction network corresponding to each interval segment are updated accordingly, thereby obtaining the sub-image color correction model corresponding to each interval segment. By combining multiple sub-image color correction models, a trained image color correction model can be obtained. For example, a trained image color correction model can be obtained by directly splicing multiple sub-image color correction models, but this is not limited to the embodiments of the present application.
[0094] The image color correction model training method of the embodiment of the present application divides the three-dimensional RGB sample data into intervals and uses the multiple interval segments obtained by the interval division to train the image color correction network respectively, which can improve the training speed of the image color correction network and the accuracy of the trained image color correction model.
[0095] In addition, the trained image color correction model has low computational complexity and is easy to deploy on hardware to implement color correction of the image to be corrected through the image color correction model.
[0096] Exemplary Devices
[0097] Figure 4 This is a block diagram of an image color correction model training device provided by an exemplary embodiment of the present application. Figure 1 , Figure 2 or Figure 3 The functions in the above-mentioned embodiment can be implemented by hardware or by hardware executing corresponding software. The device can include: a partitioning module 410 and a model training module 420.
[0098] The division module 410 is used to divide the three-dimensional RGB sample data into intervals according to a preset method to obtain multiple interval segments corresponding to the three-dimensional RGB sample data.
[0099] The model training module 420 is used to train the image color correction network respectively through the multiple interval segments of the three-dimensional RGB sample data, update the parameters of the image color correction network, and obtain the image color correction model.
[0100] The image color correction model training device of the embodiment of the present application divides the three-dimensional RGB sample data into intervals and uses the multiple interval segments obtained by the interval division to train the image color correction network respectively, thereby improving the training speed of the image color correction network and the accuracy of the trained image color correction model.
[0101] Figure 5 is a block diagram of an image color correction model training device provided by another exemplary embodiment of the present application. The device has the following features: Figure 1 , Figure 2 or Figure 3 The function in the embodiment can be implemented by hardware or by hardware executing corresponding software. The device can include: a partitioning module 510 and a model training module 520, and the partitioning module 510 includes a determining unit 5110 and a partitioning unit 5120, and the model training module 520 includes a first error calculation unit 5210, a second error calculation unit 5220 and an updating unit 5230.
[0102] The division module 510 is used to divide the three-dimensional RGB sample data into intervals according to a preset method to obtain multiple interval segments corresponding to the three-dimensional RGB sample data.
[0103] The model training module 520 is used to train the image color correction network through multiple interval segments of the three-dimensional RGB sample data, update the parameters of the image color correction network, and obtain an image color correction model.
[0104] In one embodiment, the division module 510 includes a determination unit 5110 and a division unit 5120 .
[0105] The determination unit 5110 is used to determine the current value of the selection function based on the current number of training rounds, the total number of training rounds, the error of the previous round of training and the preset coefficient.
[0106] The division unit 5120 is used to divide the three-dimensional RGB sample data into intervals according to a preset method when the current value of the selection function meets the preset condition.
[0107] In one embodiment, the model training module 520 includes a first error calculation unit 5210 , a second error calculation unit 5220 , and an updating unit 5230 .
[0108] A first error calculation unit 5210 is used to input multiple intervals of the three-dimensional RGB sample data into the image color correction network respectively, and obtain the training error of the image color correction network in each interval;
[0109] A second error calculation unit 5220, used to calculate the current round training error of the image color correction network according to the training error of each interval segment;
[0110] The updating unit 5230 is used to update the parameters of the image color correction network according to the current round training error.
[0111] Based on Figure 5 In some embodiments provided by the illustrated embodiments, the division unit 5120 may also be used for: when the current value of the selection function is less than or equal to the first preset value, selecting m division points from the three-dimensional RGB sample data for position division, wherein the position division is to divide the three-dimensional RGB sample data into m types of candidate block data sets according to the m division points, where m is a positive integer; performing regression operations on the m types of candidate block data sets respectively to obtain regression errors of the regression operations; obtaining the division point that minimizes the regression error as the preferred division point, and performing interval division on the three-dimensional RGB sample data based on the preferred division point.
[0112] Based on Figure 5 In some embodiments provided by the illustrated embodiments, the preferred division points selected in each round of image color correction network training are different.
[0113] Based on Figure 5In some embodiments provided by the illustrated embodiments, the division unit 5120 may also be used to: when the current value of the selection function is less than or equal to a second preset value, select p sub-data blocks from the three-dimensional RGB sample data, wherein the sub-data blocks are three-dimensional data; perform regression operations on the p sub-data blocks respectively to obtain regression errors of the regression operations; and perform interval division on the three-dimensional RGB sample data based on the sub-data block that minimizes the regression error.
[0114] Based on Figure 5 In some embodiments provided by the illustrated embodiments, the division unit 5120 may also be used to: when the current value of the selection function is greater than a third preset value, randomly divide the three-dimensional RGB sample data into intervals; or, when the current value of the selection function is greater than the third preset value, uniformly divide the three-dimensional RGB sample data into intervals.
[0115] In another embodiment of the present application, the model training module 520 includes a third error calculation unit, a second updating unit and a model determination unit (not shown in the figure).
[0116] The third error calculation unit is used to input the multiple interval segments of the three-dimensional RGB sample data into the image color correction network respectively, and obtain the training error of the image color correction network in each interval segment respectively.
[0117] A second updating unit is used to update the parameters of the image color correction network corresponding to each interval segment according to the training error of each interval segment, so as to obtain multiple sub-image color correction models;
[0118] A model determination unit is used to obtain the image color correction model according to the multiple sub-image color correction models.
[0119] Based on Figure 5 In some embodiments provided by the illustrated embodiments, the image color correction model training device also includes a model acquisition unit, which is used to stop updating parameters and obtain a trained image color correction model when the current number of training rounds reaches a preset number and / or when the current round training error is less than a preset threshold.
[0120] Based on Figure 5 In some embodiments provided by the illustrated embodiments, the image color correction model training device further includes a transformation module and a sample acquisition module (not shown in the figure).
[0121] A transformation module, used for transforming the three-dimensional RGB standard value according to the color regression model to obtain a three-dimensional RGB target value corresponding to the three-dimensional RGB standard value;
[0122] The sample acquisition module is used to acquire the three-dimensional RGB standard value and the three-dimensional RGB target value as three-dimensional RGB sample data.
[0123] The image color correction model training device of the embodiment of the present application can improve the training speed of the image color correction network and the accuracy of the trained image color correction model by dividing the three-dimensional RGB sample data into intervals and using the multiple interval segments obtained by the interval division to train the image color correction network respectively. In addition, the trained image color correction model has low computational complexity and is easy to deploy in hardware to realize color correction of the image to be corrected through the image color correction model.
[0124] Exemplary Electronic Devices
[0125] Below, reference Figure 6 To describe an electronic device according to an embodiment of the present application.
[0126] Figure 6 A block diagram of an electronic device according to an embodiment of the present application is illustrated.
[0127] like Figure 6 As shown, the electronic device 10 includes one or more processors 11 and a memory 12 .
[0128] The processor 11 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 10 to perform desired functions.
[0129] The memory 12 may include one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, a random access memory (RAM) and / or a cache memory (cache), etc. The non-volatile memory may include, for example, a read-only memory (ROM), a hard disk, a flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 11 may run the program instructions to implement the image color correction model training method of each embodiment of the present application described above and / or other desired functions. Various contents such as input signals, signal components, noise components, etc. may also be stored in the computer-readable storage medium.
[0130] In one example, the electronic device 10 may further include: an input device 13 and an output device 14, and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).
[0131] For example, when the electronic device is the first device 100 or the second device 200, the input device 13 may be the microphone or microphone array described above, for capturing input signals from a sound source. When the electronic device is a stand-alone device, the input device 13 may be a communication network connector, for receiving collected input signals from the first device 100 and the second device 200.
[0132] In addition, the input device 13 may also include, for example, a keyboard, a mouse, and the like.
[0133] The output device 14 can output various information to the outside, including determined distance information, direction information, etc. The output device 14 can include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, and the like.
[0134] Of course, to simplify, Figure 6 Only some of the components related to the present application in the electronic device 10 are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application situations, the electronic device 10 may also include any other appropriate components.
[0135] Exemplary computer program products and computer-readable storage media
[0136] In addition to the above-mentioned methods and devices, an embodiment of the present application may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps in the image color correction model training according to various embodiments of the present application described in the above-mentioned "Exemplary Method" section of this specification.
[0137] The computer program product may be written in any combination of one or more programming languages to write program codes for performing the operations of the embodiments of the present application, including object-oriented programming languages, such as Java, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as an independent software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0138] In addition, an embodiment of the present application may also be a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, causes the processor to execute the steps in the image color correction model training according to various embodiments of the present application described in the above “Exemplary Method” section of this specification.
[0139] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0140] The basic principles of the present application are described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, effects, etc. mentioned in the present application are only examples and not limitations, and it cannot be considered that these advantages, strengths, effects, etc. are required by each embodiment of the present application. In addition, the specific details disclosed above are only for the purpose of illustration and ease of understanding, not for limitation, and the above details do not limit the present application to being implemented by adopting the above specific details.
[0141] The block diagrams of the devices, apparatuses, equipment, and systems involved in this application are only illustrative examples and are not intended to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagram. As will be appreciated by those skilled in the art, these devices, apparatuses, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including", "comprising", "having", etc. are open words, referring to "including but not limited to", and can be used interchangeably with them. The words "or" and "and" used here refer to the words "and / or" and can be used interchangeably with them, unless the context clearly indicates otherwise. The words "such as" used here refer to the phrase "such as but not limited to", and can be used interchangeably with them.
[0142] It should also be noted that in the apparatus, device and method of the present application, each component or each step can be decomposed and / or recombined. Such decomposition and / or recombination should be regarded as equivalent solutions of the present application.
[0143] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present application. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of the present application. Therefore, the present application is not intended to be limited to the aspects shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
[0144] The above description has been given for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present application to the forms disclosed herein. Although multiple example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions and sub-combinations thereof.
Claims
1. A method for training an image color correction model, comprising: Current number of training epochs based on the image color correction network t , the total number of training rounds n , the previous round of training error loss and preset coefficient , determine the current value of the selection function in this round, where the selection function is , , the current value of the selection function corresponds to different interval division methods; According to the current value of the selection function in this round, the three-dimensional RGB sample data is divided into intervals using an interval division method corresponding to the current value of the selection function in this round to obtain a plurality of interval segments corresponding to the three-dimensional RGB sample data; The image color correction network is trained respectively by the multiple intervals of the three-dimensional RGB sample data to obtain the training error of the image color correction network in each interval, and the parameters of the image color correction network are updated in this round according to the training error of the image color correction network in each interval; After the iterative training of the image color correction network is completed, the updating of the parameters of the image color correction network is stopped to obtain a trained image color correction model.
2. The method according to claim 1, wherein the three-dimensional RGB sample data is divided into intervals according to the current value of the selection function in this round and using an interval division method corresponding to the current value of the selection function in this round, comprising: When the current value of the selection function in this round is less than or equal to the first preset value, m division points are selected from the three-dimensional RGB sample data for position division, wherein the position division is to divide the three-dimensional RGB sample data into m types of candidate block data sets according to the m division points, where m is a positive integer; Performing regression operations on the m candidate block data sets respectively to obtain regression errors of the regression operations; The division point that minimizes the regression error is obtained as a preferred division point, and the three-dimensional RGB sample data is divided into intervals based on the preferred division point.
3. The method according to claim 2, wherein: In each round of image color correction network training, the selected preferred division points are different.
4. The method according to claim 1, wherein: The step of dividing the three-dimensional RGB sample data into intervals according to the current value of the selection function in the current round and using an interval division method corresponding to the current value of the selection function in the current round includes: When the current value of the selection function in this round is less than or equal to a second preset value, k sub-data blocks are selected from the three-dimensional RGB sample data, where the sub-data blocks are three-dimensional data; Using the k sub-data blocks to divide the three-dimensional RGB sample data into k types to obtain a set of k seed data blocks, where k is a positive integer; Performing regression operations on the sets of the k seed data blocks respectively to obtain regression errors of the regression operations; The three-dimensional RGB sample data is divided into intervals based on the sub-data block that minimizes the regression error among the k sub-data blocks.
5. The method according to claim 1, wherein: The step of dividing the three-dimensional RGB sample data into intervals according to the current value of the selection function in the current round and using an interval division method corresponding to the current value of the selection function in the current round includes: When the current value of the selection function in this round is greater than a third preset value, randomly dividing the three-dimensional RGB sample data into intervals; or When the current value of the selection function in this round is greater than a third preset value, the three-dimensional RGB sample data is evenly divided into intervals.
6. The method according to any one of claims 1 to 5, wherein: The image color correction network is trained respectively by the multiple intervals of the three-dimensional RGB sample data to obtain the training error of the image color correction network in each interval, and the parameters of the image color correction network are updated in this round according to the training error of the image color correction network in each interval, including: Inputting the multiple intervals of the three-dimensional RGB sample data into an image color correction network respectively, and obtaining the training error of the image color correction network in each interval; Calculating the current round training error of the image color correction network according to the training errors of each interval segment; According to the current round of training error, the parameters of the image color correction network are updated.
7. The method according to any one of claims 1 to 5, wherein: The image color correction network is trained respectively by the multiple intervals of the three-dimensional RGB sample data to obtain the training error of the image color correction network in each interval, and the parameters of the image color correction network are updated in this round according to the training error of the image color correction network in each interval, including: Inputting the multiple intervals of the three-dimensional RGB sample data into an image color correction network respectively, and obtaining training errors of the image color correction network in each interval; According to the training errors of each interval segment, the parameters of the image color correction network corresponding to each interval segment are updated to obtain multiple sub-image color correction models; The multiple sub-image color correction models are combined to obtain the image color correction network after this round of update.
8. The method according to claim 6, wherein after the iterative training of the image color correction network is finished, the updating of the parameters of the image color correction network is stopped, and the trained image color correction model is obtained, comprising: When the current training round number reaches a preset number and / or when the current round training error is less than a preset threshold, the parameter updating is stopped to obtain a trained image color correction model.
9. The method according to claim 1, further comprising: The three-dimensional RGB standard value is transformed according to the color regression model to obtain a three-dimensional RGB target value corresponding to the three-dimensional RGB standard value; The three-dimensional RGB standard value and the three-dimensional RGB target value are acquired as the three-dimensional RGB sample data.
10. An image color correction model training device, comprising: Split module for current number of training epochs based on image color correction network t , the total number of training rounds n , the previous round of training error loss and preset coefficient , determine the current value of the selection function in this round, where the selection function is , , the current value of the selection function corresponds to different interval division methods; according to the current value of the selection function in this round, the three-dimensional RGB sample data is divided into intervals using the interval division method corresponding to the current value of the selection function in this round to obtain multiple interval segments corresponding to the three-dimensional RGB sample data; The model training module is used to train the image color correction network respectively through the multiple interval segments of the three-dimensional RGB sample data, obtain the training error of the image color correction network in each interval segment, and update the parameters of the image color correction network in this round according to the training error of the image color correction network in each segment; after the iterative training of the image color correction network is completed, stop updating the parameters of the image color correction network to obtain a trained image color correction model.
11. A computer-readable storage medium storing a computer program, wherein the computer program is used to execute the image color correction model training method according to any one of claims 1 to 9.
12. An electronic device, comprising: processor; a memory for storing instructions executable by the processor; The processor is used to execute the image color correction model training method described in any one of claims 1-9.
Citation Information
Patent Citations
Convolutional-neural-network-based color correction method of face color and tongue color images
CN107507250A
Method and device for correction model training and image correction, and electronic equipment
CN111062876A