An unsupervised end-to-end demosaicing method and system

Through an unsupervised end-to-end demosaicing method and a demosaicing model that combines spatial and channel attention structures, the problem of false color and texture detail loss in the demosaicing algorithm in the existing technology is solved, and efficient color image reconstruction is achieved, which is suitable for Various scenarios.

CN117274060BActive Publication Date: 2024-10-01SHENZHENSHENZHI WEILAICO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202311345733.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-18
Publication Date
2024-10-01
Estimated Expiration
2043-10-18

AI Technical Summary

Technical Problem

Existing demosaicing algorithms suffer from problems such as false color, blur, and loss of texture details, especially in high-frequency areas, and have poor performance and high implementation complexity.

Method used

Adopting an unsupervised end-to-end demosaicing method, video images are collected through camera equipment, and an initial data set is constructed for preprocessing and network training. Demosaic models using spatial attention structure and channel attention structure are used, combined with color difference consistency loss and brightness consistency. loss function to achieve demosaic processing.

Benefits of technology

Effectively resists false colors, retains texture details, reduces network complexity, is suitable for different scenarios, simplifies data set augmentation, and improves detail effects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117274060B_ABST
    Figure CN117274060B_ABST
Patent Text Reader

Abstract

The present invention discloses an unsupervised end-to-end demosaicing method and system, which relates to the field of image processing technology, including: using a camera to collect video images in different scenes, obtaining original image data from the video images, and constructing an initial data set; preprocessing the initial data set to obtain an enhanced training data set; inputting the training data set into a demosaicing model for network training until the loss function converges to obtain a trained demosaicing model; using the trained demosaicing model to process the mosaic image, and outputting a reconstructed color image. The technical solution in the present invention can be better implemented and can resist pseudo-color and retain texture details, thereby producing a better detail effect; there is no need to make GT, and the network complexity is low.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and more particularly to an unsupervised end-to-end de-mosaicing method and system. Background Art

[0002] By adding a color filter structure and a color information processing module (Color Filter Arrays, CFA) after CMOS, the color information of the image can be obtained. After processing the color information, a color image with realistic colors can be obtained. The vast majority of camera products use the primary color Bayer Pattern CFA. R, G, and B represent the filter array units that transmit red, green, and blue, respectively. Since human vision is most sensitive to green, the G component in the Bayer CFA is twice that of R and B. Only one color component information can be obtained at each pixel, and then a full-color image is obtained through an interpolation algorithm based on the information of the color component.

[0003] Common demosaic algorithms include bilinear interpolation, color difference method, and Hamilton & Adams interpolation algorithm.

[0004] 1. Bilinear interpolation

[0005] The G channel interpolation is obtained by averaging four adjacent G pixels in the Bayer format;

[0006] The interpolation of the R and B channels is obtained by averaging two adjacent R pixels in the Bayer format;

[0007] The defects of bilinear interpolation are: serious pseudo-color phenomenon and blur.

[0008] 2. Color difference method

[0009] Based on the principle of color difference consistency;

[0010] Since the G channel has the most sampling points, bilinear interpolation is first used to interpolate the G channel so that all pixels have G components;

[0011] Calculate the color difference of R and B pixels: Kr = G–R, Kr = G–B;

[0012] Perform bilinear interpolation on the color difference at each pixel to obtain Kr' and Kb';

[0013] Subtracting the color difference from the G value of each pixel will give the R and B component values ​​of that pixel.

[0014] The defects of the color difference method are: it does not take image texture into consideration; and it does not perform well in high-frequency areas.

[0015] 3.Hamilton&Adams interpolation algorithm

[0016] Each pixel is filtered through the HA filter to obtain the interpolation in the H and V directions;

[0017] First, interpolate the G channel. Calculate the gradients of the G channel in the H and V directions, and interpolate in the direction with the smaller gradient;

[0018] Calculate the gradient of B and R channels based on the G component value, and then interpolate in the direction with small gradient;

[0019] The defects of the Hamilton & Adams interpolation algorithm are: complex implementation; poor detection accuracy in areas with tight edges or fine textures, resulting in erroneous green interpolation, which is then propagated to red and blue interpolation, resulting in erroneous colors in the final output image.

[0020] Therefore, how to solve the problems existing in the existing demosaic algorithm so that the output image retains texture details and reduces the operation complexity is a technical problem that technical personnel in this field need to solve urgently. Summary of the invention

[0021] In view of this, the present invention provides an unsupervised end-to-end de-mosaicing method and system, which can be better implemented and resist pseudo-color, retain texture details, and thus produce better detail effects; there is no need to produce GT, and the network complexity is low.

[0022] In order to achieve the above object, the present invention provides the following technical solutions:

[0023] An unsupervised end-to-end demosaicing method includes the following steps:

[0024] Use camera equipment to collect video images in different scenes, obtain original image data from the video images, and build an initial data set;

[0025] Preprocess the initial data set to obtain an enhanced training data set;

[0026] Input the training data set into the demosaicing model for network training until the loss function converges to obtain a trained demosaicing model;

[0027] The mosaic image is processed using the trained demosaicing model and the reconstructed color image is output.

[0028] Optionally, obtaining the original image data specifically includes the following steps:

[0029] Capturing a first image through a CMOS image sensor;

[0030] The first image is processed using a primary color Bayer template color filter array to obtain original image data in different scenes.

[0031] Optionally, the collection scenes of the initial data set include: early morning, evening, night, and rainy days in urban environments, park environments, and seaside environments.

[0032] Optionally, the ratio of high-frequency images to low-frequency images in the initial data set is 1:1.

[0033] Optionally, after acquiring the original image data, the method further includes:

[0034] Flip, rotate, and translate the original image data for geometric augmentation.

[0035] Optionally, the initial data set is preprocessed, specifically including the following steps:

[0036] Obtain the G component of the original image data through bilinear interpolation, calculate the color difference between the R, B pixels and the G component, and adjust it to the original size;

[0037] The original image data is split into a four-channel image, and the G component takes the average value of the two G channels; the grayscale value is calculated through the R component, G component, and B component to obtain a grayscale image with 1 / 4 the size of the original image data; the grayscale image is subjected to Sobel filtering through convolution, the filtered result is added to the grayscale image to obtain an edge-enhanced grayscale image, and the edge-enhanced grayscale image is adjusted to the original size.

[0038] Optionally, the mosaic model includes a spatial attention structure and a channel attention structure;

[0039] Spatial attention structure, used to learn detailed information in space;

[0040] Channel attention structure is used to increase nonlinearity between channels.

[0041] Optionally, the loss function is composed of a color difference consistency loss function and a brightness consistency loss function, and the calculation formula is:

[0042] L total =αL ca +(1-α)L luma ;

[0043] L ca =||f(I ca , I gray )-I ca || 1 ;

[0044] L luma =||f(I ca , Igray )-I gray || 1 ;

[0045] Where: L total represents the total loss, L ca Indicates the color difference consistency loss, L luma represents brightness consistency loss; α is a hyperparameter with a data range of 0-1, indicating the proportion of color difference loss in the total loss; I ca Represents the input color difference map, I gray represents the input brightness image, f(I ca , I gray ) represents the network output obtained by inputting the color difference map and the brightness map into the network.

[0046] An unsupervised end-to-end demosaicing system, comprising:

[0047] A construction module is used to collect video images in different scenes through a camera device, obtain original image data from the video images, and construct an initial data set;

[0048] A preprocessing module is used to preprocess the initial data set to obtain an enhanced training data set;

[0049] A training module is used to input the training data set into the demosaicing model for network training until the loss function converges to obtain a trained demosaicing model;

[0050] The reconstruction module is used to process the mosaic image through the trained demosaicing model and output a reconstructed color image.

[0051] It can be seen from the above technical solution that compared with the prior art, the present invention provides an unsupervised end-to-end de-mosaicing method and system, which can be better implemented and resist pseudo-color and retain texture details compared to traditional algorithms, thereby producing better detail effects; compared with existing networks, there is no need to produce GT, and the network complexity is low, which can flexibly adapt to different scenarios and facilitate the expansion of data sets. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0053] Figure 1 A flowchart of the unsupervised end-to-end demosaicing method provided by the present invention;

[0054] Figure 2 A schematic diagram of image preprocessing provided by the present invention;

[0055] Figure 3(a)-Figure 3(c) They are respectively the convolution kernels of the G component, B component and R component provided by the present invention.

[0056] Figure 4 A schematic diagram of the network training provided by the present invention. DETAILED DESCRIPTION

[0057] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0058] In view of the problems existing in the prior art, an embodiment of the present invention discloses an unsupervised end-to-end demosaicing method, which is located after white balance in the ISP pipeline. Figure 1 As shown, the following steps are included:

[0059] Use camera equipment to collect video images in different scenes, obtain original image data from the video images, and build an initial data set;

[0060] Preprocess the initial data set to obtain an enhanced training data set;

[0061] Input the training data set into the demosaicing model for network training until the loss function converges to obtain a trained demosaicing model;

[0062] The mosaic image is processed using the trained demosaicing model and the reconstructed color image is output.

[0063] Further, obtaining the original image data specifically includes the following steps:

[0064] Capturing a first image through a CMOS image sensor;

[0065] The first image is processed using a primary color Bayer template color filter array to obtain original image data in different scenes.

[0066] Furthermore, the collection scenes of the initial data set include, but are not limited to: early morning, evening, night, and rainy days in urban environments, park environments, and seaside environments.

[0067] Furthermore, the ratio of high-frequency images to low-frequency images in the initial dataset is 1:1.

[0068] Furthermore, after obtaining the original image data, the method further includes:

[0069] Flip, rotate, and translate the original image data for geometric augmentation.

[0070] Furthermore, the initial data set is preprocessed, such as Figure 2 As shown, the specific steps include:

[0071] Obtain the G component of the original image data through bilinear interpolation, calculate the color difference between the R, B pixels and the G component (Kr=GR, Kr=GB), and resize to the original size;

[0072] The original image data is split into four-channel images, and the G component takes the average of the two G channels; the grayscale value is calculated through the R component, G component, and B component to obtain a grayscale image with 1 / 4 the size of the original image data; the grayscale image is subjected to sobel filtering through convolution, the filtered result is added to the grayscale image to obtain an edge-enhanced grayscale image, and the edge-enhanced grayscale image is resized to the original size.

[0073] Specifically, bilinear demosaic is implemented through convolution kernel. Taking the Bayer pattern as grbg as an example, it can be implemented as follows Figure 3(a)-Figure 3(c) The convolution kernel is designed as shown in FIG3(a). Among them, FIG3(a) is the G component; FIG3(b) on the left is the B component of the interpolated R pixel, and on the right is the B component of the interpolated G pixel; FIG3(c) on the left is the R component of the interpolated B pixel, and on the right is the R component of the interpolated G pixel.

[0074] Further, refer to Figure 4 The mosaic model includes a spatial attention structure and a channel attention structure; the spatial attention structure is used to learn the details in the space; the channel attention structure is used to increase the nonlinearity between channels, which is beneficial to the learning of each color channel. The edge-enhanced grayscale image and the bilinear demosaic image are concat to increase the edge information. The size of the network output image is consistent with the input image size, and the number of channels of the output image is 3.

[0075] Furthermore, the loss function is composed of the color difference consistency loss function and the brightness consistency loss function, and the calculation formula is:

[0076] L total =αL ca +(1-α)L luma ;

[0077] L ca =||f(I ca , I gray )-I ca ||1 ;

[0078] L luma =||f(I ca , I gray )-I gray || 1 ;

[0079] Where: L total represents the total loss, L ca Indicates the color difference consistency loss, L luma represents brightness consistency loss; α is a hyperparameter with a data range of 0-1, indicating the proportion of color difference loss in the total loss; I ca Represents the input color difference map, I gray represents the input brightness image, f(I ca , I gray ) represents the network output obtained by inputting the color difference map and the brightness map into the network.

[0080] and Figure 1 Corresponding to the method described above, an embodiment of the present invention further provides an unsupervised end-to-end de-mosaicing system for Figure 1 The specific implementation of the method in the embodiment of the present invention is an unsupervised end-to-end de-mosaicing system which can be applied to a computer terminal or various mobile devices, and specifically includes:

[0081] A construction module is used to collect video images in different scenes through a camera device, obtain original image data from the video images, and construct an initial data set;

[0082] A preprocessing module is used to preprocess the initial data set to obtain an enhanced training data set;

[0083] A training module is used to input the training data set into the demosaicing model for network training until the loss function converges to obtain a trained demosaicing model;

[0084] The reconstruction module is used to process the mosaic image through the trained demosaicing model and output a reconstructed color image.

[0085] The algorithm disclosed in this embodiment can be quickly deployed on a terminal device with good real-time performance; it takes into account both anti-pseudo-color and edge detail retention, and can better reconstruct in areas with rich textures and color transitions; the network implementation is simple, and it can be flexibly applied to different bayer patterns with strong portability.

[0086] In addition to the content disclosed in this embodiment, the Sobel operator can also be replaced by other edge extraction operators; the data set can be flexibly expanded according to the application scenario; the convolution implementation of the bilinear demosaic can be optimized, or replaced by other convolution implementation interpolation methods.

[0087] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0088] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. An unsupervised end-to-end demosaicing method, characterized in that The following steps are involved: Use camera equipment to collect video images in different scenes, obtain raw image data from the video images, and build an initial data set; Preprocess the initial data set to obtain an enhanced training data set; The training data set is input into the demosaicing model for network training until the loss function converges to obtain a trained demosaicing model; Use the trained demosaicing model to process the mosaic image and output the reconstructed color image; Preprocess the initial data set, including the following steps: Obtain the G component of the original image data through bilinear interpolation, calculate the color difference between the R, B pixels and the G component, and adjust it to the original size; The original image data is split into a four-channel image, and the G component takes the average of the two G channels; the grayscale value is calculated through the R component, G component, and B component to obtain a grayscale image with 1 / 4 the size of the original image data; the grayscale image is subjected to Sobel filtering through convolution, and the filtered result is added to the grayscale image to obtain an edge-enhanced grayscale image, which is then adjusted to its original size.

2. The unsupervised end-to-end demosaicing method according to claim 1, characterized in that Obtaining original image data includes the following steps: Capturing a first image through a CMOS image sensor; The first image is processed using a primary color Bayer template color filter array to obtain original image data under different scenes.

3. The unsupervised end-to-end demosaicing method according to claim 1, wherein: The collection scenarios of the initial data set include: early morning, evening, night, and rainy days in urban environments, park environments, and seaside environments.

4. The unsupervised end-to-end demosaicing method according to claim 1, wherein The ratio of high-frequency images to low-frequency images in the initial dataset is 1:

1.

5. The unsupervised end-to-end demosaicing method according to claim 1, characterized in that After acquiring the original image data, the method further includes: Flip, rotate, and translate the original image data for geometric augmentation.

6. The unsupervised end-to-end demosaicing method according to claim 1, characterized in that The mosaic model includes spatial attention structure and channel attention structure; Spatial attention structure, used to learn detailed information in space; Channel attention structure is used to increase nonlinearity between channels.

7. The unsupervised end-to-end demosaicing method according to claim 1, characterized in that The loss function consists of the color difference consistency loss function and the brightness consistency loss function, and the calculation formula is: L total =αL ca +(1-α)L luma ; L ca =||f(I ca ,I gray )-I ca ||1; L luma =||f(I ca ,I gray )-I gray ||1; Where: L total Represents the total loss, L ca Indicates the color difference consistency loss, L luma Represents brightness consistency loss; α is a hyperparameter with a data range of 0-1, indicating the proportion of color difference loss in the total loss; I ca Represents the input color difference map, I gray Represents the input brightness image, f(I ca ,I gray ) represents the network output obtained by inputting the color difference map and the brightness map into the network.

8. A system for implementing the unsupervised end-to-end demosaicing method according to any one of claims 1 to 7, characterized in that: include: A construction module is used to collect video images in different scenes through camera equipment, obtain raw image data from the video images, and construct an initial data set; The preprocessing module is used to preprocess the initial data set to obtain an enhanced training data set; The training module is used to input the training data set into the demosaicing model for network training until the loss function converges to obtain a trained demosaicing model; The reconstruction module is used to process the mosaic image through the trained demosaicing model and output a reconstructed color image.

Citation Information

Patent Citations

  • High-quality color image demosaicing method based on convolutional neural network

    CN110009590A

  • Image demosaicing method based on attention mechanism

    CN114972072A

  • Image demosaicing method based on super-resolution generative adversarial network SRGAN

    CN114972073A

  • Method for reconstructing color image by demosaicing based on SwinTransform

    CN115601240A

  • Multispectral image demosaicing method based on convolutional neural network

    CN116029930A