Image color deviation correction method, model training method, device and equipment

Through the encoding, decoding and global feature extraction processing of the convolutional neural network model, the problem of poor image color deviation correction in the existing technology is solved, and a more uniform and robust color deviation correction effect is achieved.

CN112508812BActive Publication Date: 2024-08-27XIAMEN MEITUZHIJIA TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011385880.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-01
Publication Date
2024-08-27
Estimated Expiration
2040-12-01

AI Technical Summary

Technical Problem

The existing technology is less effective in correcting image color casts and cannot completely eliminate color casts, resulting in unsatisfactory correction results.

Method used

Using a convolutional neural network model, including a coding network, a decoding network and a global feature extraction network, through multiple down-sampling and up-sampling processes, combined with global feature extraction and mean pooling, full connection and expansion processing, the color shift of the image is corrected .

Benefits of technology

It effectively prevents the appearance of color blocks, suppresses color unevenness, improves the effect and robustness of color cast correction, and obtains more uniform color cast-free results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112508812B
    Figure CN112508812B
Patent Text Reader

Abstract

The present application provides an image color deviation correction method, a model training method, a device and equipment, and belongs to the field of image processing technology. The image color deviation correction method includes: obtaining an image to be corrected; inputting the image to be corrected into a pre-trained color deviation correction network model, and the color deviation correction network model performs correction processing to obtain a corrected image, wherein the color deviation correction network model is a convolutional neural network model, and the color deviation correction network model includes: an encoding network, a decoding network and a global feature extraction network, the global feature extraction network is used to obtain the global features of the image to be corrected based on the downsampling results of the encoding network, and the decoding network is used to perform decoding processing based on the global features of the image to be corrected and the downsampling results of the encoding network. The present application can improve the effect of color deviation correction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to an image color cast correction method, a model training method, a device and equipment. Background Art

[0002] In the field of image processing technology, due to environmental factors such as light when taking pictures, the light of the photos taken may be brighter or darker, and cannot accurately reflect the true color of the photographed object or scene, that is, the images in these photos have color deviation.

[0003] In order to correct such images with color deviation, the prior art generally uses white balance processing to perform correction. However, the existing white balance processing cannot completely correct the color deviation, resulting in poor color deviation correction effect. Summary of the invention

[0004] The purpose of this application is to provide an image color cast correction method, model training method, device and equipment, which can improve the effect of color cast correction.

[0005] The embodiment of the present application is implemented as follows:

[0006] In one aspect of an embodiment of the present application, a method for correcting image color shift is provided, comprising:

[0007] Acquire an image to be corrected;

[0008] The image to be corrected is input into a pre-trained color cast correction network model, and the color cast correction network model performs correction processing to obtain a corrected image, wherein the color cast correction network model is a convolutional neural network model, and the color cast correction network model includes: an encoding network, a decoding network, and a global feature extraction network. The global feature extraction network is used to obtain the global features of the image to be corrected based on the downsampling results of the encoding network, and the decoding network is used to perform decoding processing based on the global features of the image to be corrected and the downsampling results of the encoding network.

[0009] Optionally, the image to be corrected is input into a pre-trained color deviation correction network model, and the color deviation correction network model performs correction processing to obtain a corrected image, including:

[0010] The image to be corrected is input into the encoding network, and the encoding network performs multiple downsampling processes on the image to be corrected to obtain a downsampling processing result;

[0011] The downsampling processing result is input into the global feature extraction network, and the global feature extraction network extracts the global features of the image to be corrected based on the downsampling processing result;

[0012] The down-sampling result and the global features of the image to be corrected are input into the decoding network, and the decoding network performs multiple up-sampling processes based on the down-sampling result and the global features of the image to be corrected to obtain the corrected image.

[0013] Optionally, the downsampling processing result is input into a global feature extraction network, and the global feature extraction network extracts the global features of the image to be corrected based on the downsampling processing result, including:

[0014] The downsampling results are input into the global feature extraction network, which performs mean pooling, full connection and expansion on the downsampling results in sequence to obtain the global features of the image to be corrected.

[0015] Optionally, the global feature extraction network includes: a mean pooling layer, a plurality of fully connected layers connected in sequence, and an expansion processing layer.

[0016] Optionally, before acquiring the image to be corrected, the method further includes:

[0017] The initial image is corrected and preprocessed to obtain an image to be corrected corresponding to the initial image. The correction preprocessing includes downsampling preprocessing and scene preprocessing.

[0018] Optionally, performing correction preprocessing on the initial image to obtain an image to be corrected corresponding to the initial image includes:

[0019] Performing downsampling preprocessing on the initial image to obtain an image of a preset size, and using the image of the preset size as the image to be corrected;

[0020] Perform scene preprocessing on images of preset size to obtain scene fusion coefficients.

[0021] Optionally, after the image to be corrected is input into a pre-trained color deviation correction network model, and the color deviation correction network model performs correction processing to obtain a corrected image, the method further includes:

[0022] The scene fusion coefficient is used to adjust the pixel value of each pixel in the corrected image to obtain an adjusted image.

[0023] Another aspect of the embodiment of the present application provides a color cast correction network model training method, including:

[0024] Obtain training set sample images and test set sample images;

[0025] Based on the sample images of the training set, the sample images of the test set and the preset discriminator, a color cast correction network model is trained. The color cast correction network model is a convolutional neural network model. The color cast correction network model includes: an encoding network, a decoding network and a global feature extraction network. The global feature extraction network is used to obtain the global features of the image to be corrected based on the downsampling results of the encoding network. The decoding network is used to perform decoding processing based on the global features of the image to be corrected and the downsampling results of the encoding network. The discriminator is used to discriminate the global authenticity and local correction effect of the image output by the color cast correction network model.

[0026] Optionally, the discriminator includes: a global branch and a local branch;

[0027] The global branch is used to predict the probability that the image output by the color cast correction network model is correctly identified, and the local branch is used to compare the image output by the color cast correction network model with the real image corresponding to the sample image of the test set to determine the local correction effect of the color cast correction network model.

[0028] Another aspect of the embodiments of the present application provides an image color deviation correction device, including: an acquisition module, a correction module;

[0029] An acquisition module, used for acquiring an image to be corrected;

[0030] The correction module is used to input the image to be corrected into the pre-trained color deviation correction network model, and the color deviation correction network model performs correction processing to obtain the corrected image, wherein the color deviation correction network model is a convolutional neural network model, and the color deviation correction network model includes: an encoding network, a decoding network and a global feature extraction network, the global feature extraction network is used to obtain the global features of the image to be corrected based on the downsampling results of the encoding network, and the decoding network is used to perform decoding processing based on the global features of the image to be corrected and the downsampling results of the encoding network.

[0031] Optionally, the correction module is specifically used to input the image to be corrected into the encoding network, and the encoding network performs multiple downsampling processes on the image to be corrected to obtain the downsampling processing results; the downsampling processing results are input into the global feature extraction network, and the global feature extraction network extracts the global features of the image to be corrected based on the downsampling processing results; the downsampling results and the global features of the image to be corrected are input into the decoding network, and the decoding network performs multiple upsampling processes based on the downsampling results and the global features of the image to be corrected to obtain the corrected image.

[0032] Optionally, the correction module is also used to input the downsampling processing results into the global feature extraction network, and the global feature extraction network sequentially performs mean pooling, full connection and expansion processing on the downsampling processing results to obtain the global features of the image to be corrected.

[0033] Optionally, in the correction module, the global feature extraction network includes: a mean pooling layer, a plurality of fully connected layers connected in sequence, and an expansion processing layer.

[0034] Optionally, the device further includes: a preprocessing module; the preprocessing module is used to perform correction preprocessing on the initial image to obtain an image to be corrected corresponding to the initial image, and the correction preprocessing includes downsampling preprocessing and scene preprocessing.

[0035] Optionally, the preprocessing module is specifically used to perform downsampling preprocessing on the initial image to obtain an image of a preset size, and use the image of the preset size as the image to be corrected; perform scene preprocessing on the image of the preset size to obtain a scene fusion coefficient.

[0036] Optionally, the correction module is further used to use the scene fusion coefficient to adjust the pixel value of each pixel in the corrected image to obtain an adjusted image.

[0037] Another aspect of the embodiment of the present application provides a color cast correction network model training device, including: a sample acquisition module, a training module;

[0038] A sample acquisition module is used to acquire training set sample images and test set sample images;

[0039] The training module is used to train a color cast correction network model based on training set sample images, test set sample images and a preset discriminator. The color cast correction network model is a convolutional neural network model. The color cast correction network model includes: an encoding network, a decoding network and a global feature extraction network. The global feature extraction network is used to obtain the global features of the image to be corrected based on the downsampling results of the encoding network. The decoding network is used to perform decoding processing based on the global features of the image to be corrected and the downsampling results of the encoding network. The discriminator is used to discriminate the global authenticity and local correction effect of the image output by the color cast correction network model.

[0040] Optionally, in the training module, the discriminator includes: a global branch and a local branch; the global branch is used to predict the probability that the image output by the color cast correction network model is correctly identified, and the local branch is used to perform image spot comparison between the image output by the color cast correction network model and the real image corresponding to the sample image of the test set to discriminate the local correction effect of the color cast correction network model.

[0041] In another aspect of an embodiment of the present application, a computer device is provided, including: a first memory and a first processor, wherein the first memory stores a computer program that can be run on the first processor, and when the first processor executes the computer program, the steps of the above-mentioned image color deviation correction method are implemented.

[0042] On the other hand, an embodiment of the present application provides another computer device, including: a second memory and a second processor, wherein the second memory stores a computer program that can be run on the second processor, and when the second processor executes the computer program, the steps of the above-mentioned color cast correction network model training method are implemented.

[0043] In another aspect of an embodiment of the present application, a storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned image color cast correction method and color cast correction network model training method are implemented.

[0044] The beneficial effects of the embodiments of the present application include:

[0045] In the image color deviation correction method, model training method, device and equipment provided by the embodiments of the present application, by obtaining the image to be corrected and inputting the image to be corrected into the pre-trained color deviation correction network model, the color deviation correction network model performs correction processing to obtain the corrected image, wherein the color deviation correction network model is a convolutional neural network model, and the color deviation correction network model includes: an encoding network, a decoding network and a global feature extraction network, the global feature extraction network is used to obtain the global features of the image to be corrected based on the downsampling results of the encoding network, and the decoding network is used to perform decoding processing based on the global features of the image to be corrected and the downsampling results of the encoding network. By processing the downsampling results of the encoding network through the global feature extraction network, it is possible to prevent the appearance of color blocks and excessive color unevenness in the corrected image, and the color block effect can be effectively suppressed by extracting the global features, so that the color is uniform and the color deviation-free result can be obtained, and the correction in the color deviation correction network model can also keep the correction result highly robust, thereby improving the effect of color deviation correction. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0047] Figure 1 Schematic diagram of the process of the image color cast correction method provided in the embodiment of the present application Figure 1 ;

[0048] Figure 2 A schematic diagram of the structure of a color cast correction network model provided in an embodiment of the present application;

[0049] Figure 3 Schematic diagram of the process of the image color cast correction method provided in the embodiment of the present application Figure 2 ;

[0050] Figure 4 A schematic diagram of the structure of a global feature extraction network provided in an embodiment of the present application;

[0051] Figure 5 Schematic diagram of the process of the image color cast correction method provided in the embodiment of the present application Figure 3 ;

[0052] Figure 6 A flowchart of a color cast correction network model training method provided in an embodiment of the present application;

[0053] Figure 7 A schematic diagram of the structure of a discriminator provided in an embodiment of the present application;

[0054] Figure 8 A schematic diagram of the structure of an image color deviation correction device provided in an embodiment of the present application;

[0055] Fig. 9 A schematic diagram of the structure of a color cast correction network model training device provided in an embodiment of the present application;

[0056] Fig.10 A schematic diagram of the structure of a computer device provided in an embodiment of the present application;

[0057] Fig.11 A schematic diagram of the structure of another computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0058] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.

[0059] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.

[0060] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0061] In the description of the present application, it should be noted that the terms "first", "second", "third", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0062] In order to facilitate the understanding of the relevant professional terms involved in this application, the relevant terms in the field of image processing that may be involved in this application are explained as follows:

[0063] White balance: White balance is a way to restore the inherent color of an object, which enables the camera image to accurately reflect the color of the object. It has great commercial value in many application scenarios, such as the pre-processing of mobile devices to obtain equipment and the post-processing of photo studios. White balance is a necessary step to obtain high-quality images. People may encounter the following problems when shooting with digital cameras: images shot in a room with fluorescent lights are greenish, scenes shot under indoor tungsten lights are yellowish, and photos taken in the shadow of sunlight are blue. The reason lies in the setting of white balance. White balance is to restore the inherent color of an object as much as possible under different light conditions according to the color of the object obtained at that time, that is, to minimize the influence of the color of the light source on the color of the object. Different white points can be specified according to the situation of the light source during the color conversion process to obtain the corresponding correct color conversion results.

[0064] The specific implementation process of the image color cast correction method provided in the embodiment of the present application is explained in detail below.

[0065] Figure 1 Schematic diagram of the process of the image color cast correction method provided in the embodiment of the present application Figure 1 , please refer to Figure 1 , an image color cast correction method, comprising:

[0066] S110: Acquire the image to be corrected.

[0067] Optionally, the image to be corrected can be an image of fixed height and width obtained by processing in a preset processing method, and its specific height and width pixel ratio can be set according to actual needs. For example, an image of 640 (height) × 640 (width) pixels can be set as the image to be corrected.

[0068] Optionally, the image shown on the image to be corrected may be a scene image or a person image, which is not limited here.

[0069] S120: Inputting the image to be corrected into a pre-trained color deviation correction network model, and the color deviation correction network model performs correction processing to obtain a corrected image.

[0070] Among them, the color cast correction network model is a convolutional neural network model, which includes: an encoding network, a decoding network and a global feature extraction network. The global feature extraction network is used to obtain the global features of the image to be corrected based on the downsampling results of the encoding network, and the decoding network is used to perform decoding processing based on the global features of the image to be corrected and the downsampling results of the encoding network.

[0071] It should be noted that the global feature may refer to the full-size feature of the extracted image, covering the entire image; each image also includes local features, which may be a local expression of the image feature.

[0072] Optionally, the color cast correction network model may be a pre-trained neural network model, specifically a CNN network (Convolutional Neural Networks) model. It may be a structure that adds a global feature extraction network to the encoding-decoding neural network structure, and may convert the simulated image of the color cast correction network model from sRGB format to RAW format, and then back to sRGB format. sRGB and RAW are two different simulated image formats.

[0073] It should be noted that sRGB and RAW are ways of describing the color domain of an image. An image in RAW format may refer to an original image captured by a camera sensing element without any image correction processing. An image in sRGB (standard RedGreenBlue) format may refer to an image in a color domain mapped after the original image has been processed by a series of cameras.

[0074] In order to more clearly explain the color shift correction network model provided in this application, the specific structure of the color shift correction network model is explained below.

[0075] Figure 2 For a schematic diagram of the structure of the color shift correction network model provided in the embodiment of the present application, please refer to Figure 2 The color shift correction network model includes an encoding network 210, a decoding network 220 and a global feature extraction network 230, wherein the encoding network 210 can be directly connected to the decoding network 220, or connected to the decoding network 220 through the global feature extraction network 230.

[0076] Among them, the encoding network 210 can reversely restore the analog image in sRGB format to an image in RAW format and perform color cast correction on the RAW format image. After completing the correct white balance setting, the decoding network 220 can decode and generate an image in sRGB format using the correct white balance setting, that is, an image that has completed the correction process.

[0077] In the image color deviation correction method provided in the embodiment of the present application, the image to be corrected can be obtained by obtaining the image to be corrected and inputting the image to be corrected into the pre-trained color deviation correction network model, and the color deviation correction network model performs correction processing to obtain the corrected image, wherein the color deviation correction network model is a convolutional neural network model, and the color deviation correction network model includes: an encoding network, a decoding network, and a global feature extraction network, the global feature extraction network is used to obtain the global features of the image to be corrected based on the downsampling results of the encoding network, and the decoding network is used to perform decoding processing based on the global features of the image to be corrected and the downsampling results of the encoding network. By processing the downsampling results of the encoding network through the global feature extraction network, it is possible to prevent the appearance of color blocks and excessive color unevenness in the corrected image, and the color block effect can be effectively suppressed by extracting the global features, so that the color is uniform and the color deviation-free result can be obtained, and the correction in the color deviation correction network model can also keep the correction result highly robust, thereby improving the effect of color deviation correction.

[0078] Another specific implementation process of the image color cast correction method provided in the embodiment of the present application is explained in detail below.

[0079] Figure 3 Schematic diagram of the process of the image color cast correction method provided in the embodiment of the present application Figure 2 , please refer to Figure 3 , input the image to be corrected into the pre-trained color deviation correction network model, and the color deviation correction network model performs correction processing to obtain a corrected image, including:

[0080] S310: Input the image to be corrected into the encoding network, and the encoding network performs multiple downsampling processes on the image to be corrected to obtain a downsampling processing result.

[0081] Optionally, after obtaining the image to be corrected, the image to be corrected can be input into the encoding network, and the encoding network can downsample the image to be corrected. Each downsampling can shorten the height and width of the image to be corrected by half. For example, if the size of the image to be corrected is 640×640 (pixels), the result of the first downsampling is 320×320 (pixels). If the height of the image to be corrected is H and the width is W, the result of each downsampling can be represented by a number pair. (H / 2, W / 2) is the result of the first downsampling, and (H / 2 n , W / 2 n ) is the result of the nth downsampling.

[0082] Optionally, the specific number of downsampling times can be set according to actual computing requirements and is not limited here.

[0083] S320: Input the downsampling processing result into the global feature extraction network, and the global feature extraction network extracts the global features of the image to be corrected based on the downsampling processing result.

[0084] Optionally, the global feature extraction network can perform global feature extraction according to the downsampling result, and further obtain the global features of the image to be corrected.

[0085] S330: Input the down-sampling result and the global features of the image to be corrected into a decoding network, and the decoding network performs multiple up-sampling processes based on the down-sampling result and the global features of the image to be corrected to obtain a corrected image.

[0086] Optionally, after the global feature extraction network extracts all the local features, the decoding network can perform multiple upsampling processes based on the downsampling results and the global features of the image to be corrected to obtain the corrected image. For example, the global features of the image to be corrected can be added to the downsampling results of the previous level (if downsampling is performed n times, it can be added to the downsampling results of the n-1th time), and the added results can be upsampled step by step through the decoding network to restore to the pixel size of the image to be corrected, and the corrected image can be obtained.

[0087] For example, the encoding network in the color shift correction network model can perform downsampling 5 times to obtain an intermediate image of (H / 32, W32) pixel size. After the intermediate image is added to the global features output by the global feature extraction network, it is upsampled step by step to the original pixel size (H, W), where the image to be corrected in the processing process includes three color channels.

[0088] The working principle and specific implementation process of the global feature extraction network are explained below through the structure of the specific global feature extraction network.

[0089] Figure 4 For a schematic diagram of the structure of the global feature extraction network provided in the embodiment of the present application, please refer to Figure 4 , the global feature extraction network includes: a mean pooling layer 510, a plurality of fully connected layers 520 connected in sequence, and an expansion processing layer 530.

[0090] Among them, the expansion processing layer 530 can be a neural network layer for performing expansion processing, or it can be a processing step for performing expansion processing, which is not limited here.

[0091] Optionally, the downsampling processing result is input into a global feature extraction network, and the global feature extraction network extracts the global features of the image to be corrected based on the downsampling processing result, including:

[0092] The downsampling results are input into the global feature extraction network, which performs mean pooling, full connection and expansion on the downsampling results in sequence to obtain the global features of the image to be corrected.

[0093] Optionally, the global feature extraction network provided in the embodiment of the present application may include a mean pooling layer 510, three fully connected layers 520, and an expansion processing layer 530, and the neuron parameters of the three fully connected layers 520 are 256, 128, and 64 respectively.

[0094] Specifically, the intermediate image of (H / 32, W32) pixels obtained by downsampling 5 times can be added to the mean pooling layer for mean pooling processing, and then added to the fully connected layer for full connection processing in sequence. Finally, the expansion processing layer and the downsampling result of the (H / 16, W16) layer are expanded and fused to obtain a global feature map with pixels of (H / 16, W16). The feature information reflected by the global feature map is the global feature of the image to be corrected.

[0095] Optionally, the purpose of the entire color cast correction network model is not to re-render the image to the original sRGB format, but to use the correct white balance setting on the RAW format image to generate a color cast-free image. In order to reuse the feature map output by the encoding network and extract the underlying feature information, it is necessary to connect the feature map output by the encoding network and the feature map of the corresponding size of the decoding network. Different from the previous addition connection method, this network model uses a function to merge feature maps. The outermost residual layer of the network uses pixel-by-pixel multiplication instead of addition to convert the residual into scaling, thereby achieving the ability to learn scaling.

[0096] Optionally, before acquiring the image to be corrected, the method further includes:

[0097] The initial image is corrected and preprocessed to obtain an image to be corrected corresponding to the initial image. The correction preprocessing includes downsampling preprocessing and scene preprocessing.

[0098] Optionally, the initial image may be a photograph obtained by shooting, a picture downloaded from the Internet, or other images with different sizes and formats. Downsampling preprocessing may be a process of converting the initial image into an image to be corrected, and scene preprocessing may be a process of extracting scene features from the initial image.

[0099] Another specific implementation process of the image color cast correction method provided in the embodiment of the present application is explained in detail below.

[0100] Figure 5 Schematic diagram of the process of the image color cast correction method provided in the embodiment of the present application Figure 3 , please refer to Figure 5, perform correction preprocessing on the initial image to obtain the image to be corrected corresponding to the initial image, including:

[0101] S610: Perform downsampling preprocessing on the initial image to obtain an image of a preset size, and use the image of the preset size as the image to be corrected.

[0102] Optionally, the height and width of the initial image can be reduced by pyramid downsampling to obtain an image of a preset size, and the image of the preset size is used as the image to be corrected. Each time the length and width of the image are halved for downscaling and each sampled intermediate image is retained, compared with directly downsampling to the pixels of the image to be corrected (640×640), the image details can be better retained and the jagged phenomenon can be avoided.

[0103] S620: Perform scene preprocessing on the image of the preset size to obtain a scene fusion coefficient.

[0104] Optionally, scene preprocessing may be performed on an image of a preset size to obtain a scene fusion coefficient k, and the scene fusion coefficient k may be used to restore the scene.

[0105] Optionally, after the image to be corrected is input into a pre-trained color deviation correction network model, and the color deviation correction network model performs correction processing to obtain a corrected image, the method further includes:

[0106] The scene fusion coefficient is used to adjust the pixel value of each pixel in the corrected image to obtain an adjusted image.

[0107] Optionally, the following formula may be used for calculation:

[0108] T = I × (1-k) + O × k;

[0109] Wherein, T is the adjusted image, I is the initial image, O is the corrected image, k is the fusion coefficient, that is, the above-mentioned scene fusion coefficient k, and the range of k is between 0 and 1. In the process of executing the above formula calculation, each pixel in the initial image I can be multiplied by (1-k); each pixel in the corrected image can be multiplied by k, and the two results can be added together to finally obtain the adjusted image T.

[0110] The specific implementation process of the color cast correction network model training method provided in the embodiment of the present application is explained below.

[0111] Figure 6 For a flow chart of the color cast correction network model training method provided in the embodiment of the present application, please refer to Figure 6 , a color cast correction network model training method, including:

[0112] S710: Obtain training set sample images and test set sample images.

[0113] Optionally, a high-definition data set or high-definition portraits and landscapes taken by a camera can be collected (ensuring a balanced ratio of portraits and landscapes, and portraits and landscapes should include daytime and night scenes as well as indoor and outdoor scenes), and divided into a training set and a test set. The training set includes multiple training set sample images, and the test set includes multiple test set sample images.

[0114] S720: Based on the training set sample images, the test set sample images and the preset discriminator, a color cast correction network model is trained.

[0115] Among them, the color cast correction network model is a convolutional neural network model, which includes: an encoding network, a decoding network and a global feature extraction network. The global feature extraction network is used to obtain the global features of the image to be corrected based on the downsampling results of the encoding network. The decoding network is used to perform decoding processing based on the global features of the image to be corrected and the downsampling results of the encoding network. The discriminator is used to discriminate the global authenticity and local correction effect of the image output by the color cast correction network model.

[0116] Optionally, in order to obtain an image that is closer to the real result, a discriminator with adversarial loss can be used to minimize the distance between the actual light distribution and the output normal light distribution.

[0117] The specific structures of the global branches and local branches provided in this application are explained below through specific embodiments.

[0118] Figure 7 For a schematic diagram of the structure of the discriminator provided in the embodiment of the present application, please refer to Figure 7 , Optionally, the discriminator includes: a global branch 810 and a local branch 820;

[0119] The global branch 810 is used to predict the probability that the image output by the color cast correction network model is correctly identified, and the local branch 820 is used to compare the image output by the color cast correction network model with the real image corresponding to the sample image of the test set to determine the local correction effect of the color cast correction network model.

[0120] It should be noted that a global image discriminator often cannot process images with spatial variations; for example, if the input image is obtained in a complex indoor light source scene, affected by the diffuse reflection of the indoor light source, each area needs to be corrected to a different degree, so using a global image discriminator alone often cannot provide the required adaptive capabilities. In order to adaptively correct the color cast in a local area, the discriminator contains two branches, global and local. The global branch determines the authenticity of the corrected image, and the local branch can randomly crop several spots from the input image for judgment to improve the local color cast correction effect.

[0121] The following explains the training process of this application by constructing the loss function:

[0122] To ensure the authenticity of image color and contrast, the color gamut loss function of the color model (LAB) is added as supervision. The color gamut of the color model is wider, and brightness and color are distinguished by dark channels, which can adjust a larger color range and control the color of network-generated images more accurately. To ensure the perceived similarity of images, a perceptual loss function is also introduced. To ensure the authenticity of the image, the global loss function and the local loss function are used to minimize the distance between the color estimation of the real image and the image color distribution output by the generated network.

[0123] Among them, the global loss function is expressed as:

[0124]

[0125]

[0126]

[0127] Among them, C represents the global discriminator network, x r and x f They represent the distribution of real data and false data respectively, and σ represents the constraint of least square loss, which can further improve the iteration speed. f , x r ) and D(x r , x f ) is to make the output of the global discriminator depend on the real data x r and false data x f ,(x r , x f ) refers to x r X f More real, (x f , x r ) refers to x f X r More real. refers to the probability that the real data is judged to be true, x f~P fake It refers to the probability that false data is judged as false. refers to the expectation that false data will be judged as false. It refers to the expectation that real data will be judged to be true.

[0128] The local loss function is expressed as:

[0129]

[0130] According to the above loss function, the total loss function of the model can be obtained:

[0131]

[0132] Among them, α, β, γ, μ represent the weights of each loss function respectively, L1 represents the initial loss function, represents the global loss function, represents the local loss function, L Perc represents the perceptual loss function.

[0133] In the specific training process, the Adam optimizer can be used. The initial learning rate of the training is 0.0002, the number of iterations is 400k, and the parameters can be adjusted to α=1, β=0.5, γ=0.5, and μ=0.5 after actual training.

[0134] The following describes the devices, equipment, storage media, etc. corresponding to the image color deviation correction method and the color deviation correction network model training method provided in the present application. The specific implementation process and technical effects are described above and will not be repeated below.

[0135] Figure 8 For a structural diagram of the image color deviation correction device provided in the embodiment of the present application, please refer to Figure 8 , an image color deviation correction device, comprising: an acquisition module 100, a correction module 200;

[0136] An acquisition module 100 is used to acquire an image to be corrected;

[0137] The correction module 200 is used to input the image to be corrected into a pre-trained color deviation correction network model, and the color deviation correction network model performs correction processing to obtain a corrected image, wherein the color deviation correction network model is a convolutional neural network model, and the color deviation correction network model includes: an encoding network, a decoding network and a global feature extraction network, the global feature extraction network is used to obtain the global features of the image to be corrected based on the downsampling results of the encoding network, and the decoding network is used to perform decoding processing based on the global features of the image to be corrected and the downsampling results of the encoding network.

[0138] Optionally, the correction module 200 is specifically used to input the image to be corrected into the encoding network, and the encoding network performs multiple downsampling processes on the image to be corrected to obtain the downsampling processing results; input the downsampling processing results into the global feature extraction network, and the global feature extraction network extracts the global features of the image to be corrected based on the downsampling processing results; input the downsampling results and the global features of the image to be corrected into the decoding network, and the decoding network performs multiple upsampling processes based on the downsampling results and the global features of the image to be corrected to obtain the corrected image.

[0139] Optionally, the correction module 200 is also used to input the downsampling processing results into the global feature extraction network, and the global feature extraction network sequentially performs mean pooling, full connection and expansion processing on the downsampling processing results to obtain the global features of the image to be corrected.

[0140] Optionally, in the correction module 200, the global feature extraction network includes: a mean pooling layer, a plurality of fully connected layers connected in sequence, and an expansion processing layer.

[0141] Optionally, the device further includes: a preprocessing module 300; the preprocessing module 300 is used to perform correction preprocessing on the initial image to obtain an image to be corrected corresponding to the initial image, and the correction preprocessing includes downsampling preprocessing and scene preprocessing.

[0142] Optionally, the preprocessing module 300 is specifically used to perform downsampling preprocessing on the initial image to obtain an image of a preset size, and use the image of the preset size as the image to be corrected; perform scene preprocessing on the image of the preset size to obtain a scene fusion coefficient.

[0143] Optionally, the correction module 200 is further configured to use a scene fusion coefficient to adjust the pixel value of each pixel in the corrected image to obtain an adjusted image.

[0144] Fig. 9 For a structural diagram of the color cast correction network model training device provided in the embodiment of the present application, please refer to Fig. 9 , a color cast correction network model training device, comprising: a sample acquisition module 400, a training module 500;

[0145] The sample acquisition module 400 is used to acquire training set sample images and test set sample images;

[0146] The training module 500 is used to train a color cast correction network model based on training set sample images, test set sample images and a preset discriminator. The color cast correction network model is a convolutional neural network model. The color cast correction network model includes: an encoding network, a decoding network and a global feature extraction network. The global feature extraction network is used to obtain the global features of the image to be corrected based on the downsampling results of the encoding network. The decoding network is used to perform decoding processing based on the global features of the image to be corrected and the downsampling results of the encoding network. The discriminator is used to discriminate the global authenticity and local correction effect of the image output by the color cast correction network model.

[0147] Optionally, in the training module 500, the discriminator includes: a global branch and a local branch; the global branch is used to predict the probability that the image output by the color cast correction network model is correctly identified, and the local branch is used to perform image spot comparison between the image output by the color cast correction network model and the real image corresponding to the sample image of the test set to discriminate the local correction effect of the color cast correction network model.

[0148] The above-mentioned device is used to execute the method provided by the aforementioned embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0149] The above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more digital singnal processors (DSP), or one or more field programmable gate arrays (FPGA). For another example, when a module is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0150] Fig.10 For a schematic diagram of the structure of the computer device provided in the embodiment of the present application, please refer to Fig.10 , a computer device includes: a first memory 610 and a first processor 710, wherein the first memory 610 stores a computer program that can be run on the first processor 710, and when the first processor 710 executes the computer program, the steps of the above-mentioned image color deviation correction method are implemented.

[0151] Fig.11For a structural diagram of another computer device provided in an embodiment of the present application, please refer to Fig.11 Another computer device includes: a second memory 620 and a second processor 720. The second memory 620 stores a computer program that can be run on the second processor 720. When the second processor 720 executes the computer program, the steps of the above-mentioned color cast correction network model training method are implemented.

[0152] In another aspect of an embodiment of the present application, a storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned image color cast correction method and color cast correction network model training method are implemented.

[0153] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0154] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0155] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0156] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to perform some steps of the methods of various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (English: Read-Only Memory, abbreviated: ROM), random access memory (English: Random Access Memory, abbreviated: RAM), disk or optical disk and other media that can store program codes.

[0157] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0158] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for correcting image color shift, characterized in that: include: Acquire an image to be corrected; The image to be corrected is input into a pre-trained color cast correction network model, and the color cast correction network model performs correction processing to obtain a corrected image, wherein the color cast correction network model is a convolutional neural network model, and the color cast correction network model includes: an encoding network, a decoding network and a global feature extraction network, the global feature extraction network is used to obtain the global features of the image to be corrected based on the downsampling result of the encoding network, and the decoding network is used to perform decoding processing based on the global features of the image to be corrected and the downsampling result of the encoding network; wherein the encoding network is used to reversely restore the analog image in sRGB format to the analog image in RAW format, and perform color cast correction on the analog image in RAW format, and perform white balance setting, the analog image in sRGB format is the image to be corrected, and the downsampling result of the encoding network is: the analog image in RAW format after white balance setting; The decoding network is used to generate a simulated image in sRGB format with the white balance setting performed as the corrected image based on the global features of the image to be corrected and the simulated image in RAW format after the white balance setting is performed.

2. The method according to claim 1, characterized in that The step of inputting the image to be corrected into a pre-trained color deviation correction network model, and performing correction processing by the color deviation correction network model to obtain a corrected image includes: Inputting the image to be corrected into the encoding network, and performing multiple downsampling processes on the image to be corrected by the encoding network to obtain a downsampling processing result; Inputting the downsampling processing result into the global feature extraction network, and the global feature extraction network extracts the global features of the image to be corrected based on the downsampling processing result; The down-sampling result and the global features of the image to be corrected are input into the decoding network, and the decoding network performs multiple up-sampling processes based on the down-sampling result and the global features of the image to be corrected to obtain the corrected image.

3. The method according to claim 2, characterized in that The step of inputting the downsampling processing result into the global feature extraction network, and extracting the global features of the image to be corrected based on the downsampling processing result by the global feature extraction network, comprises: The downsampling processing result is input into the global feature extraction network, and the global feature extraction network sequentially performs mean pooling, full connection and expansion processing on the downsampling processing result to obtain the global features of the image to be corrected.

4. The method according to claim 3, characterized in that The global feature extraction network includes: a mean pooling layer, a plurality of fully connected layers connected in sequence, and an expansion processing layer.

5. The method according to any one of claims 1 to 4, characterized in that: Before obtaining the image to be corrected, the method further includes: The initial image is corrected and preprocessed to obtain the image to be corrected corresponding to the initial image, wherein the correction preprocessing includes downsampling preprocessing and scene preprocessing.

6. The method according to claim 5, characterized in that The step of performing correction preprocessing on the initial image to obtain the image to be corrected corresponding to the initial image includes: Performing down-sampling preprocessing on the initial image to obtain an image of a preset size, and using the image of the preset size as the image to be corrected; Perform scene preprocessing on images of preset size to obtain scene fusion coefficients.

7. The method according to claim 6, characterized in that After inputting the image to be corrected into a pre-trained color deviation correction network model, and performing correction processing by the color deviation correction network model to obtain a corrected image, the method further includes: The scene fusion coefficient is used to adjust the pixel value of each pixel in the corrected image to obtain an adjusted image.

8. A color cast correction network model training method, characterized in that: include: Obtain training set sample images and test set sample images; Based on the training set sample images, the test set sample images and the preset discriminator, a color cast correction network model is trained, and the color cast correction network model is a convolutional neural network model. The color cast correction network model includes: an encoding network, a decoding network and a global feature extraction network. The global feature extraction network is used to obtain the global features of the image to be corrected based on the downsampling result of the encoding network. The decoding network is used to perform decoding processing based on the global features of the image to be corrected and the downsampling result of the encoding network. The discriminator is used to discriminate the global authenticity and local correction effect of the image output by the color cast correction network model. The encoding network is used to reversely restore the simulated image in sRGB format to the simulated image in RAW format, and perform color cast correction on the simulated image in RAW format, and perform white balance setting. The simulated image in sRGB format is the image to be corrected, and the downsampling result of the encoding network is: the simulated image in RAW format after white balance setting. The decoding network is used to generate a simulated image in sRGB format with the white balance setting performed as the corrected image based on the global features of the image to be corrected and the simulated image in RAW format after the white balance setting is performed.

9. The method according to claim 8, characterized in that The discriminator includes: a global branch and a local branch; The global branch is used to predict the probability that the image output by the color cast correction network model is correctly identified, and the local branch is used to perform image patch comparison between the image output by the color cast correction network model and the real image corresponding to the test set sample image to determine the local correction effect of the color cast correction network model.

10. An image color deviation correction device, characterized in that: include: Acquisition module, correction module; The acquisition module is used to acquire the image to be corrected; The correction module is used to input the image to be corrected into a pre-trained color cast correction network model, and the color cast correction network model performs correction processing to obtain a corrected image, wherein the color cast correction network model is a convolutional neural network model, and the color cast correction network model includes: an encoding network, a decoding network and a global feature extraction network, the global feature extraction network is used to obtain the global features of the image to be corrected based on the downsampling result of the encoding network, and the decoding network is used to perform decoding processing based on the global features of the image to be corrected and the downsampling result of the encoding network; wherein the encoding network is used to reversely restore the analog image in sRGB format to the analog image in RAW format, and perform color cast correction on the analog image in RAW format, and perform white balance setting, the analog image in sRGB format is the image to be corrected, and the downsampling result of the encoding network is: the analog image in RAW format after white balance setting; The decoding network is used to generate a simulated image in sRGB format with the white balance setting performed as the corrected image based on the global features of the image to be corrected and the simulated image in RAW format after the white balance setting is performed.

11. A color cast correction network model training device, characterized in that: include: Sample acquisition module, training module; The sample acquisition module is used to acquire training set sample images and test set sample images; The training module is used to train a color cast correction network model based on the training set sample images, the test set sample images and a preset discriminator. The color cast correction network model is a convolutional neural network model. The color cast correction network model includes: an encoding network, a decoding network and a global feature extraction network. The global feature extraction network is used to obtain the global features of the image to be corrected based on the downsampling result of the encoding network. The decoding network is used to perform decoding processing based on the global features of the image to be corrected and the downsampling result of the encoding network. The discriminator is used to discriminate the global authenticity and local correction effect of the image output by the color cast correction network model; wherein the encoding network is used to reversely restore the simulated image in sRGB format to the simulated image in RAW format, and perform color cast correction on the simulated image in RAW format, and perform white balance setting. The simulated image in sRGB format is the image to be corrected, and the downsampling result of the encoding network is: the simulated image in RAW format after white balance setting; The decoding network is used to generate a simulated image in sRGB format with the white balance setting performed as the corrected image based on the global features of the image to be corrected and the simulated image in RAW format after the white balance setting is performed.

12. A computer device, characterized in that: include: A first memory and a first processor. The first memory stores a computer program that can be run on the first processor. When the first processor executes the computer program, the steps of the method described in any one of claims 1 to 7 are implemented.

13. A computer device, characterized in that: include: A second memory and a second processor. The second memory stores a computer program that can be run on the second processor. When the second processor executes the computer program, the steps of the method described in any one of claims 8 to 9 are implemented.

14. A storage medium, characterized in that: The storage medium stores a computer program, which, when executed by a processor, implements the steps of the method described in any one of claims 1 to 9.