A white balance value prediction method, device, medium and electronic equipment

By using a trained white balance prediction model, the white balance value of the camera module in the original color temperature environment is predicted to be the white balance value in the test environment. This solves the problem of time-consuming and costly test calculations in different color temperature environments and achieves a more efficient production process.

CN116320376BActive Publication Date: 2026-04-21KUNSHAN QIUTI PHOTOELECTRIC TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
KUNSHAN QIUTI PHOTOELECTRIC TECH CO LTD
Filing Date
2023-01-30
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

In existing technologies, the white balance value of camera modules needs to be tested and calculated separately under different color temperature environments, resulting in high production costs and low efficiency, and making it impossible to directly predict the white balance value under different color temperature environments.

Method used

By obtaining the white balance value of the camera module in the original color temperature environment as a reference value, a pre-trained white balance value prediction model is used to predict the white balance value in the color temperature environment to be tested based on the learned correlation features. A neural network model is used for training and optimization.

Benefits of technology

This reduces the measurement time and cost of camera modules under different color temperature environments, improves production efficiency, and lowers production costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116320376B_ABST
    Figure CN116320376B_ABST
Patent Text Reader

Abstract

The application discloses a white balance value prediction method and device, a medium and an electronic equipment. The method comprises the following steps: obtaining a white balance value measured by a camera module in an original color temperature environment as a reference white balance value; obtaining a pre-trained white balance value prediction model, wherein the white balance value prediction model learns the correlation features between the white balance values of the camera module in any two color temperature environments; and predicting the white balance value of the camera module in a to-be-measured color temperature environment based on the reference white balance value through the white balance value prediction model, and taking the white balance value as a target white balance value. The application can predict the white balance value without direct measurement, thereby reducing the production cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of camera inspection technology, and in particular to white balance value prediction methods, devices, media, and electronic devices. Background Technology

[0002] To test the camera, it is necessary to test and calculate the white balance (AWB) value of the camera module under different color temperature environments.

[0003] Currently, the AWB value under different color temperature environments needs to be tested and calculated separately. When the AWB value of a camera module under one color temperature environment is known, it is impossible to know the AWB value of the camera module under another color temperature environment. Therefore, the testing and calculation of the camera module requires a lot of time, which increases production costs and reduces production efficiency.

[0004] Therefore, there is an urgent need for a method that can predict the AWB under other color temperature environments based on the known AWB value under one color temperature environment, in order to reduce production costs and improve production efficiency. Summary of the Invention

[0005] Embodiments of this application provide a white balance value prediction method, apparatus, medium, and electronic device, which can obtain a target white balance value based on a reference white balance value through a white balance value prediction model, thereby reducing production costs and improving production efficiency.

[0006] Other features and advantages of this application will become apparent from the following detailed description, or may be learned in part from practice of this application.

[0007] According to a first aspect of the embodiments of this application, a white balance value prediction method is provided, comprising:

[0008] Obtain the white balance value measured by the camera module under the original color temperature environment, and use it as the reference white balance value;

[0009] Obtain a pre-trained white balance prediction model, wherein the white balance prediction model has learned the correlation features between the white balance values ​​of the camera module under any two color temperature environments;

[0010] Based on the reference white balance value, the white balance value of the camera module under the color temperature to be tested is predicted by the white balance value prediction model and used as the target white balance value.

[0011] In some embodiments of this application, based on the foregoing scheme, the white balance value prediction model is trained using the following steps:

[0012] The white balance values ​​measured by the camera module under different color temperature environments are collected to obtain a sample set;

[0013] A neural network model is constructed, and the neural network model is trained based on the sample set to obtain a white balance value prediction model.

[0014] In some embodiments of this application, based on the foregoing scheme, the construction of the neural network model includes:

[0015] A deep learning network framework was built using fully connected layers as the initial neural network model;

[0016] The ReLU function is used as the activation function of the initial neural network model to perform regularization, resulting in the completed neural network model.

[0017] Define the training method for the neural network model.

[0018] In some embodiments of this application, based on the foregoing scheme, the neural network model is trained to obtain a white balance value prediction model, including:

[0019] The sample set is divided into a training set, a validation set, and a test set according to a preset ratio.

[0020] Based on the training set and the validation set, the neural network model is trained to obtain multiple candidate white balance value prediction models;

[0021] Based on the test set, a white balance prediction model is selected from multiple candidate white balance prediction models.

[0022] In some embodiments of this application, based on the foregoing scheme, selecting a white balance value prediction model from multiple candidate white balance value prediction models based on the test set includes:

[0023] The white balance value measured by the camera module under the color temperature to be tested is used as a reference white balance value.

[0024] Based on the test set, multiple white balance values ​​are predicted using multiple candidate white balance value prediction models to obtain multiple sets of white balance values ​​under the test color temperature environment, which are used as test white balance values.

[0025] Calculate the mean deviation between each group of test white balance values ​​and the reference white balance value, and use it as the reference mean;

[0026] The prediction accuracy of the candidate white balance value prediction model is judged based on the reference mean.

[0027] In some embodiments of this application, based on the foregoing scheme, after predicting the white balance value of the camera module in the color temperature environment to be measured using the white balance value prediction model, and using it as the target white balance value, the method further includes:

[0028] Obtain the actual white balance value of the camera module under the color temperature environment to be tested;

[0029] By comparing the target white balance value with the actual white balance value, the hidden layer parameters in the white balance value prediction model are corrected through gradient backpropagation to update the white balance value prediction model. The updated white balance value prediction model is used for the next white balance value prediction.

[0030] In some embodiments of this application, based on the foregoing scheme, the reference white balance value includes the white balance value of the camera module measured in any one or more color channels under the original color temperature environment, and the step of predicting the white balance value of the camera module under the color temperature environment to be measured by the white balance value prediction model includes:

[0031] The white balance prediction model is used to predict the white balance value of the camera module on any one or more color channels under the color temperature to be tested.

[0032] In some embodiments of this application, the white balance value under the original color temperature environment is measured by a camera module, and then the white balance value under the color temperature environment to be tested is predicted by a white balance value prediction model. This eliminates the need to directly use the camera module to measure the color temperature value under the color temperature environment to be tested, reducing the time and cost of camera module measurement, lowering production costs, and improving production efficiency.

[0033] According to a second aspect of the embodiments of this application, a white balance value prediction device is provided, the device comprising:

[0034] The acquisition unit is used to acquire the white balance value measured by the camera module under the original color temperature environment, and to acquire a pre-trained white balance value prediction model. The white balance value prediction model has learned the correlation features between the white balance values ​​of the camera module under any two color temperature environments.

[0035] The prediction unit, based on the reference white balance value, predicts the white balance value of the camera module under the color temperature environment to be tested using the white balance value prediction model.

[0036] According to a third aspect of the present application, a computer-readable storage medium is provided, on which a computer program is stored, the computer program including executable instructions that, when executed by a processor, implement the method described in any of the embodiments of the first aspect.

[0037] According to a fourth aspect of the present application, an electronic device is provided, comprising: one or more processors; and a memory for storing executable instructions of the processors, wherein when the executable instructions are executed by the one or more processors, the one or more processors cause the one or more processors to implement the method described in any embodiment of the first aspect above.

[0038] The beneficial effects of the embodiments of the second to fourth aspects described above can be referred to the beneficial effects of the first aspect and the embodiments of the first aspect described above, and will not be repeated here.

[0039] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description

[0040] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort. In the drawings:

[0041] Figure 1 A flowchart of the white balance value prediction method in an embodiment of this application is shown;

[0042] Figure 2 A flowchart illustrating the method for training a white balance value prediction model in an embodiment of this application is shown;

[0043] Figure 3 A flowchart illustrating the method for constructing a neural network model in an embodiment of this application is shown;

[0044] Figure 4 A flowchart illustrating the method for obtaining a white balance value prediction model in an embodiment of this application is shown;

[0045] Figure 5 A flowchart illustrating the method for selecting a white balance value prediction model from multiple candidate white balance value prediction models in an embodiment of this application is shown.

[0046] Figure 6 A flowchart illustrating a method for updating a white balance prediction model is shown.

[0047] Figure 7 A screenshot of the white balance values ​​collected in an embodiment of this application is shown;

[0048] Figure 8 A screenshot of the test white balance value of one of the candidate white balance value prediction models according to an embodiment of this application is shown;

[0049] Figure 9 A block diagram of a white balance value prediction device according to an embodiment of this application is shown;

[0050] Figure 10 A schematic diagram of a computer-readable storage medium in an embodiment of this application is shown;

[0051] Figure 11 A schematic diagram of the system structure of an electronic device in an embodiment of this application is shown. Detailed Implementation

[0052] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0053] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a thorough understanding of embodiments of this application. However, those skilled in the art will recognize that the technical solutions of this application can be practiced without one or more of the specific details, or other methods, components, apparatuses, steps, etc., can be employed. In other instances, well-known methods, apparatuses, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of this application.

[0054] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0055] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.

[0056] In the description of this application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, unless otherwise stated, "multiple" means two or more.

[0057] Figure 1 A flowchart of a white balance value prediction method according to an embodiment of this application is shown. This white balance value prediction method can be executed by a device with computational processing capabilities. (Refer to...) Figure 1 As shown, this white balance prediction method includes at least steps S1 to S3, which are described in detail below:

[0058] In step S1, the white balance value measured by the camera module under the original color temperature environment is obtained as a reference white balance value.

[0059] In this application, the camera module can be any camera module, and the model is not limited. The original color temperature environment can be any color temperature environment, such as a 5100K color temperature environment. The reference white balance value can be obtained by taking a photo with the camera module and then calculating the white balance value in the photo. The reference white balance value includes the white balance value of at least one channel, such as the white balance value of one or more of the R channel, GB channel, GR channel and B channel.

[0060] In step S2, a pre-trained white balance prediction model is obtained, wherein the white balance prediction model learns the correlation features between the white balance values ​​of the camera module under any two color temperature environments.

[0061] In this application, the white balance prediction model can be obtained by learning the correlation features between the white balance values ​​of the camera module under any two color temperature environments. For example, it can be obtained by learning the correlation features between the white balance values ​​of the R channel under any two color temperature environments. The correlation features can be a linear relationship between the white balance values ​​under any two color temperature environments or a non-linear relationship between the white balance values ​​under any two color temperature environments.

[0062] In step S3, based on the reference white balance value, the white balance value of the camera module under the color temperature to be tested is predicted by the white balance value prediction model and used as the target white balance value.

[0063] In this application, the target white balance value can be the white balance value predicted by the white balance value prediction model, or it can be used as a reference white balance value. That is, the target white balance value can be used as the final prediction value or as an intermediate value.

[0064] Figure 2 A flowchart of a method for training a white balance prediction model according to an embodiment of this application is shown. The method for training a white balance prediction model includes at least S21 to S22, which are described in detail below:

[0065] In step S21, the white balance values ​​measured by the camera module under different color temperature environments are collected to obtain a sample set.

[0066] In this application, different color temperature environments may include at least two color temperature environments, such as at least 5100K and 4000K environments.

[0067] In step S22, a neural network model is constructed, and the neural network model is trained based on the sample set to obtain a white balance value prediction model.

[0068] In this application, the neural network model can be either a feedforward neural network model or a feedback neural network model.

[0069] For details, see Figure 3 , Figure 3 A flowchart of a method for constructing a neural network model in an embodiment of this application is shown. The construction of the neural network model in step S22 includes at least S221 to S223, which are described in detail below:

[0070] In step S221, a deep learning network framework is built using a fully connected layer approach as the initial neural network model.

[0071] In this application, the deep learning network framework may include 2-3 dense layers.

[0072] In step S222, the ReLU function is used as the activation function of the initial neural network model to perform regularization processing on the initial neural network model, thereby obtaining the completed neural network model;

[0073] In step S223, the training method for the neural network model is set.

[0074] In this application, the ReLU function optimizes the initial neural network model, which can prevent randomness between data, prevent the neural network model from overfitting prematurely, and ensure that the neural network model fits the data better. Regularizing the initial neural network model can prevent data from being backpropagated during error propagation, and can better fit the data, allowing the data weights to be better passed and updated.

[0075] In this application, the constructed neural network model can be used to train the sample set.

[0076] For details, see Figure 4 , Figure 4 A flowchart of the method for obtaining a white balance value prediction model in an embodiment of this application is shown, including at least S22a to S22c, which are described in detail below:

[0077] In step S22a, the sample set is divided into a training set, a validation set, and a test set according to a preset ratio.

[0078] In this application, the preset ratio can be 7:2:1 or 6:2:2. For example, if the sample set has 2100 data points, the training set can have 1470 data points, the validation set can have 420 data points, and the test set can have 210 data points. Alternatively, the training set can have 1260 data points, the validation set can have 420 data points, and the test set can have 420 data points.

[0079] In step S22b, the neural network model is trained based on the training set and the validation set to obtain multiple candidate white balance value prediction models.

[0080] In this application, the candidate white balance value prediction model can be obtained by adjusting the number of dense layers or by adjusting the number of training iterations.

[0081] In step S22c, a white balance prediction model is selected from multiple candidate white balance prediction models based on the test set.

[0082] In this application, multiple candidate white balance value prediction models are screened using a test set, and the candidate white balance value prediction model with higher prediction accuracy is selected to improve the prediction accuracy of white balance values.

[0083] For details, see Figure 5 , Figure 5 A flowchart illustrating the method for selecting a white balance prediction model from multiple candidate white balance prediction models in an embodiment of this application is shown, including at least S22c1 to S22c4, which are described in detail below:

[0084] In step S22c1, the white balance value measured by the acquisition camera module under the color temperature to be tested is obtained as a reference white balance value.

[0085] In step S22c2, based on the test set, multiple candidate white balance value prediction models are used to predict and obtain multiple sets of white balance values ​​under the test color temperature environment, which are used as test white balance values.

[0086] In this application, based on the test set, the candidate white balance value prediction models are used to make predictions. Each candidate white balance value prediction model obtains a set of white balance values ​​under the test color temperature environment. For example, by using three candidate white balance value prediction models, three sets of white balance values ​​under the test color temperature environment are obtained.

[0087] In step S22c3, the mean deviation between each group of test white balance values ​​and the reference white balance values ​​is calculated and used as the reference mean.

[0088] In this application, the average deviation between each group of test white balance values ​​and the reference white balance value is used to obtain the reference average value.

[0089] In step S22c4, the prediction accuracy of the candidate white balance value prediction model is determined based on the reference mean.

[0090] In this application, the reference mean can be used as a criterion for evaluating the prediction accuracy of the candidate white balance value prediction model. For example, the smaller the reference mean, the higher the prediction accuracy of the candidate white balance value prediction model.

[0091] Reference Figure 6 , Figure 6 A flowchart of a method for updating a white balance value prediction model is shown, including at least S4 to S5, which are described in detail below:

[0092] After step S3, in step S4, the actual white balance value of the camera module under the color temperature environment to be tested is obtained.

[0093] In step S5, by comparing the target white balance value with the actual white balance value, the hidden layer parameters in the white balance value prediction model are corrected through gradient backpropagation to update the white balance value prediction model. The updated white balance value prediction model is used for the next white balance value prediction.

[0094] In this application, the white balance prediction model is corrected by comparing the actual white balance value and the target white balance value under the test color temperature environment, so as to improve the prediction accuracy of the white balance prediction model.

[0095] In this embodiment of the application, based on the aforementioned scheme, the reference white balance value includes the white balance value of the camera module measured in any one or more color channels under the original color temperature environment, such as the white balance value of one R channel or three channels: R channel, GR channel, and GB channel. The step of predicting the white balance value of the camera module under the color temperature environment to be measured by the white balance value prediction model includes: predicting the white balance value of the camera module in any one or more color channels under the color temperature environment to be measured by the white balance value prediction model. Specifically, the white balance value of one R channel or three channels: R channel, GR channel, and GB channel can be predicted by the white balance value prediction model.

[0096] To better understand this embodiment, a specific example is provided below:

[0097] S1: Obtain the white balance value measured by the camera module under the original color temperature environment, and use it as the reference white balance value.

[0098] S2: Obtain a pre-trained white balance prediction model, wherein the white balance prediction model has learned the correlation features between the white balance values ​​of the camera module under any two color temperature environments.

[0099] Specifically, S2 includes S21 to S22:

[0100] S21: Collect the white balance values ​​measured by the camera module under different color temperature environments to obtain a sample set;

[0101] S22: Construct a neural network model and train the neural network model based on the sample set to obtain a white balance value prediction model.

[0102] Specifically, the white balance values ​​collected by S21 can be found in [reference needed]. Figure 7 , Figure 7 The image shown is a screenshot of the white balance values ​​collected in an embodiment of this application. Figure 7 It can be seen that the white balance values ​​of the four channels (R channel, GR channel, GB channel and B channel) were collected under three color temperature environments of 5100K, 4000K and 3100K. In this embodiment, 2100 sets of data were collected, that is, the sample set has 2100 sets of data.

[0103] For the collected white balance values, dirty data can be excluded. For example, it can be excluded based on the value range, or it can be excluded after calculating the mean. For example, taking the data in the first column as an example, the white balance value of the R channel of 5100K is mostly between 460 and 480. If the data is outside this range, it can be excluded.

[0104] S22 includes:

[0105] S221: A deep learning network framework is built using a fully connected layer approach, serving as the initial neural network model;

[0106] Specifically, since there is only one data category, three dense layers are selected. The actual code is as follows:

[0107] mode l=mode l s.Sequent ia l()

[0108] mode l.add(l ayers.Dense(32,act ivat ion='re l u',i nput.Shape=(1,)))

[0109] mode l.add(l ayers.Dense(16,act ivat ion='re l u'))

[0110] mode l.add(l ayers.Dense(8,act ivat ion='re l u'))

[0111] mode l.add(l ayers.Dense(1)).

[0112] S222: The ReLU function is used as the activation function of the initial neural network model to perform regularization on the initial neural network model, resulting in the completed neural network model;

[0113] The actual code for regularization is as follows:

[0114] mode l.comp ile(opt imi zer=opt imi zers.RMSprop(lr=1e-4),

[0115] loss = 'mse' / / Loss function, representing the error

[0116] metr i cs = ['acc']) / / Representation precision

[0117] In step S223, the training method for the neural network model is set, and the actual running code is as follows:

[0118] hi story=mode lf it(trai n_data,trai n_l abe l

[0119] epochs=50, / / Training 50 times

[0120] batch_size = 2, / / Divide the data into two batches for training, for example, divide 1470 sets of data into two batches of 735 sets each.

[0121] va li dat i on_data=(va l_data,va l_l abe l))

[0122] S22a: Divide the sample set into a training set, a validation set, and a test set according to a preset ratio;

[0123] In this embodiment, the data in columns A and E are used as the sample set, namely the white balance values ​​of the R channel at 5100K and the white balance values ​​of the R channel at 4000K. The former is used as the input data of the neural network model, and the latter is used as the label data of the neural network model. The preset ratio is 7:2:1, that is, the training set has 1470 sets of data, the validation set has 420 sets of data, and the test set has 210 sets of data.

[0124] Specifically, the data in columns A and E are saved in a .csv file. The training and validation set data are then read from the .csv file. The actual code is as follows:

[0125] with open

[0126] (". / Datasets / R5100to4000 / trai n.csv","r",encod i ng="utf-8"

[0127] )as f

[0128] reader = csv.reader(f)

[0129] train_data = [int(row[A] for row in reader)] / / Read data from column A

[0130] with open

[0131] (". / Datasets / R5100to4000 / trai n.csv","r",encod i ng="utf-8") as f:

[0132] reader = csv.reader(f)

[0133] train_data = [int(row[E] for row in reader)] / / Read the data in column E.

[0134] The training and validation sets are divided according to a preset ratio. The actual running code is as follows:

[0135] va l_data=trai n_data[1470:]

[0136] va l_l abe l=trai n_l abe l[1470:]

[0137] trai n_data=trai n_data[:1470]

[0138] trai n_l abe l=trai n_l abe l[:1470]

[0139] va l_data=np.array(va l_data)

[0140] va l_l abe l=np.array(va l_l abe l)

[0141] trai n_data=np.array(trai n_data)

[0142] trai n_l abe l=np.array(trai n_l abe l)

[0143] S22b: Based on the training set and the validation set, the neural network model is trained to obtain multiple candidate white balance value prediction models;

[0144] S22c: Based on the test set, select a white balance value prediction model from multiple candidate white balance value prediction models.

[0145] Specifically, the test set data is read first. The actual code is as follows:

[0146] with open

[0147] (". / Datasets / R5100to4000 / trai n.csv","r",encod i ng="utf-8")as f

[0148] reader = csv.reader(f)

[0149] test_data = [int(row[A] for row in reader)] / / Read data from column A

[0150] with open

[0151] (". / Datasets / R5100to4000 / trai n.csv","r",encod i ng="utf-8") as f:

[0152] reader = csv.reader(f)

[0153] test_l abe l = [int(row[E] for row in reader)] / / Read data from column E

[0154] test_data=np.array(test_data)

[0155] test_l abe l=np.array(test_l abe l)

[0156] test_l abe l=test_l abe l.reshape((214,1)).

[0157] The actual code for the multiple candidate white balance value prediction model is as follows:

[0158] ##l oad mode l

[0159] mode l=mode l sl load_mode l('. / AWBR5100to4000,h5')

[0160] mode l 1 = mode l sl oad_mode l('. / AWBR5100to4000-50-1(32)-2(16)-3(8),h5') / / Train 50 times, 3 dense layers

[0161] mode l 2 = mode l sl oad_mode l('. / AWBR5100to4000-50-1,h5') / / Training 50 times, 1 dense layer

[0162] mode l 3 = mode l sl oad_mode l('. / AWBR5100to4000-50-2,h5') / / Training 50 times, 2 dense layers

[0163] mode l4 = mode l sl oad_mode l('. / AWBR5100to4000-20-1(16),h5') / / Training 20 times, 1 dense layer

[0164] mode l5=mode l sl oad_mode l('. / AWBR5100to4000-30-1(32)-2(16)-3(8),h5') / / Train 30 times, 3 dense layers.

[0165] Therefore, it can be seen that by adjusting the number of training iterations and the number of dense layers, different candidate white balance prediction models from mode l to mode l5 can be obtained.

[0166] S22c includes:

[0167] S22c1: Obtain the white balance value measured by the camera module under the color temperature to be tested, and use it as a reference white balance value;

[0168] S22c2: Based on the test set, multiple white balance values ​​are predicted using multiple candidate white balance value prediction models to obtain multiple sets of white balance values ​​under the color temperature environment to be tested, which are used as test white balance values.

[0169] See the test white balance values ​​for one of the candidate white balance prediction models. Figure 8 , Figure 8 A screenshot of the test white balance value of one of the candidate white balance value prediction models according to an embodiment of this application is shown.

[0170] S22c3: Calculate the mean of the deviation between each group of test white balance values ​​and the reference white balance value, and use it as the reference mean. That is, calculate the deviation value between each group of test white balance values ​​and the reference white balance value, and then calculate the mean of the deviation values.

[0171] Specifically, the actual running code is as follows:

[0172] ##pred itct data

[0173] pred itct=mode l.pred itct(test_data)

[0174] d if_mean=np.sum(abs(pred itct-test_l abe l)) / test_shape[0]

[0175] prent(dif_mean) / / Calculates the reference mean of the candidate white balance prediction model mode l

[0176] ##pred itct data

[0177] pred itct1=mode l.pred itct1(test_data)

[0178] d if_mean1=np.sum(abs(pred itct1-test_l abe l)) / test_shape[0]

[0179] prent(dif_mean1) / / Calculates the reference mean of the candidate white balance prediction model mode 1.

[0180] pred itct2=mode l.pred itct2(test_data)

[0181] d if_mean2=np.sum(abs(pred itct2-test_l abe l)) / test_shape[0]

[0182] prent(dif_mean2) / / Calculates the reference mean of the candidate white balance prediction model mode l2.

[0183] pred itct3=mode l.pred itct3(test_data)

[0184] d if_mean3=np.sum(abs(pred itct3-test_l abe l)) / test_shape[0]

[0185] prent(dif_mean3) / / Calculates the reference mean of the candidate white balance prediction model mode 3.

[0186] pred itct4=mode l.pred itct4(test_data)

[0187] d if_mean4=np.sum(abs(pred itct4-test_l abe l)) / test_shape[0]

[0188] prent(dif_mean4) / / Calculates the reference mean of the candidate white balance prediction model mode l4

[0189] pred itct5=mode l.pred itct5(test_data)

[0190] d if_mean5=np.sum(abs(pred itct5-test_l abe l)) / test_shape[0]

[0191] pr i nt(d f_mean5) / / Calculate the reference mean of the candidate white balance prediction model mode l5.

[0192] S22c4: Based on the reference mean, determine the prediction accuracy of the candidate white balance value prediction model.

[0193] The actual calculation results based on the mean are as follows:

[0194] dif_mean = 2.3715341158002334, dif_mean1 = 1.6658444983936915, dif_mean2 = 2.0249656605943342, dif_mean3 = 1.7843471063631717, dif_mean4 = 1.7930976653767523, dif_mean5 = 1.8985116548627337. dif_mean1 is the smallest. If the smaller the reference mean is used as the criterion for higher prediction accuracy, then the candidate white balance value prediction model mode l1 corresponding to dif_mean1 has the highest prediction accuracy.

[0195] S3: Based on the reference white balance value, predict the white balance value of the camera module under the color temperature environment to be tested using the white balance value prediction model, and use it as the target white balance value.

[0196] S4: Obtain the actual white balance value of the camera module under the color temperature environment to be tested.

[0197] S5: By comparing the target white balance value with the actual white balance value, the hidden layer parameters in the white balance value prediction model are corrected through gradient backpropagation to update the white balance value prediction model. The updated white balance value prediction model is used for the next white balance value prediction.

[0198] Preferably, the white balance prediction model is used for white balance prediction of the same color channel, for example, using the white balance value of the R channel in a 5100K environment to predict the white balance value of the R channel in a 4000K environment.

[0199] See Figure 9 The diagram shows a block diagram of a white balance value prediction device according to an embodiment of this application.

[0200] like Figure 9 As shown, based on the same inventive concept, the second aspect of the present application also provides a white balance value prediction device 100, including: an acquisition unit 101 and a prediction unit 102.

[0201] The acquisition unit 101 is used to acquire the white balance value measured by the camera module under the original color temperature environment, and to acquire a pre-trained white balance value prediction model. The white balance value prediction model learns the correlation features between the white balance values ​​of the camera module under any two color temperature environments.

[0202] The prediction unit 102 predicts the white balance value of the camera module under the test color temperature environment based on the reference white balance value and the white balance value prediction model.

[0203] Based on the same inventive concept, a third aspect of this application also provides, as another aspect, a computer-readable storage medium storing a program product capable of implementing the bolt preload loading method described above. In some possible implementations, various aspects of this application can also be implemented as a program product including program code, which, when run on a terminal device, causes the terminal device to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of this application.

[0204] refer to Figure 10As shown, a program product 200 for implementing the above-described method according to an embodiment of this application is described. It may employ a portable compact disc read-only memory (CD-ROM) and include program code, and can run on a terminal device, such as a personal computer. However, the program product of this application is not limited thereto. In this document, a readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0205] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0206] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.

[0207] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.

[0208] Program code for performing the operations of this application can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java and C++, and conventional procedural programming languages ​​such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0209] In another respect, this application also provides an electronic device capable of implementing the above-described method.

[0210] Those skilled in the art will understand that various aspects of this application can be implemented as a system, method, or program product. Therefore, various aspects of this application can be specifically implemented in the following forms: a completely hardware implementation, a completely software implementation (including firmware, microcode, etc.), or a combination of hardware and software implementations, collectively referred to herein as a "circuit," "module," or "system."

[0211] The following reference Figure 11 To describe an electronic device 300 according to this embodiment of the present application. Figure 11 The electronic device 300 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0212] like Figure 11 As shown, the electronic device 300 is manifested in the form of a general-purpose computing device. The components of the electronic device 300 may include, but are not limited to: at least one processing unit 310, at least one storage unit 320, and a bus 330 connecting different system components (including storage unit 320 and processing unit 310).

[0213] The storage unit stores program code that can be executed by the processing unit 310, causing the processing unit 310 to perform the steps described in the "Embodiment Methods" section above according to various exemplary embodiments of this application.

[0214] Storage unit 320 may include readable media in the form of volatile storage units, such as random access memory (RAM) 321 and / or cache memory 322, and may further include read-only memory (ROM) 323.

[0215] Storage unit 320 may also include a program / utility 324 having a set (at least one) of program modules 325, including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.

[0216] Bus 330 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.

[0217] Electronic device 300 can also communicate with one or more external devices 400 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 300, and / or with any device that enables electronic device 300 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 350. Furthermore, electronic device 300 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 360. As shown, network adapter 360 communicates with other modules of electronic device 300 via bus 330. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 300, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0218] The functions described herein may be implemented in hardware, software executed by a processor, firmware, or any combination thereof. If implemented in software executed by a processor, the functions may be stored as one or more instructions or codes on or transmitted via a computer-readable medium. Other examples and embodiments are within the scope and spirit of this application and the appended claims. For example, due to the nature of software, the functions described above may be implemented using software executed by a processor, hardware, firmware, hardwired, or any combination thereof. Furthermore, the functional units may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit.

[0219] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.

[0220] The units described as separate components may or may not be physically separate. Similarly, the components of the control device may or may not be physical units; they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.

[0221] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0222] The above description is merely an embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A method of white balance value prediction, characterized by, include: Obtain the white balance value measured by the camera module under the original color temperature environment, and use it as the reference white balance value; Obtain a pre-trained white balance prediction model, wherein the white balance prediction model has learned the correlation features between the white balance values ​​of the camera module under any two color temperature environments; Based on the reference white balance value, the white balance value of the camera module in the color temperature environment to be tested is predicted by the white balance value prediction model as the target white balance value, including: predicting the white balance value of the camera module in any one or more color channels in the color temperature environment to be tested by the white balance value prediction model, wherein the reference white balance value includes the white balance value of the camera module in any one or more color channels measured in the original color temperature environment; Obtain the actual white balance value of the camera module under the color temperature environment to be tested; By comparing the target white balance value with the actual white balance value, the hidden layer parameters in the white balance value prediction model are corrected through gradient backpropagation to update the white balance value prediction model. The updated white balance value prediction model is used for the next white balance value prediction.

2. The method of claim 1, wherein, The white balance prediction model was trained using the following steps: The white balance values ​​measured by the camera module under different color temperature environments are collected to obtain a sample set; A neural network model is constructed, and the neural network model is trained based on the sample set to obtain a white balance value prediction model.

3. The method of claim 2, wherein, The construction of the neural network model includes: A deep learning network framework was built using fully connected layers as the initial neural network model; The ReLU function is used as the activation function of the initial neural network model to perform regularization, resulting in the completed neural network model. Define the training method for the neural network model.

4. The method of claim 2, wherein, Based on the sample set, the neural network model is trained to obtain a white balance value prediction model, including: The sample set is divided into a training set, a validation set, and a test set according to a preset ratio. Based on the training set and the validation set, the neural network model is trained to obtain multiple candidate white balance value prediction models; Based on the test set, a white balance prediction model is selected from multiple candidate white balance prediction models.

5. The method of claim 4, wherein, The step of selecting a white balance prediction model from multiple candidate white balance prediction models based on the test set includes: The white balance value measured by the camera module under the color temperature to be tested is used as a reference white balance value. Based on the test set, multiple white balance values ​​are predicted using multiple candidate white balance value prediction models to obtain multiple sets of white balance values ​​under the test color temperature environment, which are used as test white balance values. Calculate the mean deviation between each group of test white balance values ​​and the reference white balance value, and use it as the reference mean; The prediction accuracy of the candidate white balance value prediction model is judged based on the reference mean.

6. A white balance value prediction device, the device comprising: The acquisition unit is used to acquire the white balance value measured by the camera module under the original color temperature environment, and use it as a reference white balance value. Obtain a pre-trained white balance prediction model, wherein the white balance prediction model has learned the correlation features between the white balance values ​​of the camera module under any two color temperature environments; The prediction unit, based on the reference white balance value, predicts the white balance value of the camera module in the color temperature environment to be tested using the white balance value prediction model, as the target white balance value. This includes: predicting the white balance value of the camera module in any one or more color channels in the color temperature environment to be tested using the white balance value prediction model; the reference white balance value includes the white balance value of the camera module in any one or more color channels measured in the original color temperature environment; obtaining the actual white balance value of the camera module in the color temperature environment to be tested; comparing the target white balance value with the actual white balance value; and correcting the hidden layer parameters in the white balance value prediction model through gradient backpropagation to update the white balance value prediction model. The updated white balance value prediction model is used for the next white balance value prediction.

7. A computer-readable storage medium having a computer program stored thereon, the computer program including executable instructions that, when executed by a processor, implement the method as claimed in any one of claims 1-5.

8. An electronic device, comprising: One or more processors; A memory for storing executable instructions of the processor, which, when executed by the one or more processors, cause the one or more processors to perform the method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Method and device for using neural network to correct white balance of images

    CN107578390A

  • Image automatic white balance method and device

    CN113518210A