Blacklight image fusion model training method and blacklight image fusion method

By adjusting the label image to match the real image features and training the black-light image fusion model, combined with the noise reduction sub-model and the prediction sub-model, the problem of low image quality of traditional black-light cameras under low illumination is solved and the output of high-quality images is achieved.

CN118230099BActive Publication Date: 2024-08-27HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410660143.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-24
Publication Date
2024-08-27
Estimated Expiration
2044-05-24

AI Technical Summary

Technical Problem

Traditional blacklight cameras cannot output high-quality images under low illumination conditions. Traditional image fusion algorithms result in high signal-to-noise ratio of fusion images but unrealistic colors or true colors but poor signal-to-noise ratio. There is a lack of deep learning network structure suitable for blacklight image fusion. .

Method used

By adjusting the label image to match the defect characteristics of the real visible road image and the fused road image, a black-light image fusion model capable of outputting high-quality images is trained. A two-stage network is used for image processing, and the noise reduction sub-model and the prediction sub-model are used together. Adjust model parameters to improve image signal-to-noise ratio and color authenticity.

Benefits of technology

It achieves the output of high-quality images in low-light environments, improves the signal-to-noise ratio and color authenticity of black-light camera images, and solves the problem of low image quality in traditional methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118230099B
    Figure CN118230099B
Patent Text Reader

Abstract

The embodiment of the present application provides a blacklight image fusion model training method and a blacklight image fusion method, the method comprising: adjusting the label image based on the defect features of each first dimension obtained by counting each real visible road image to obtain a sample visible road image; and adjusting the label image based on the defect features of each second dimension obtained by counting each real fused road image to obtain a sample fused road image; inputting the sample visible road image and the sample fused road image into the original blacklight image fusion model to obtain a predicted fused image output by the original blacklight image fusion model; adjusting the model parameters of the original blacklight image fusion model based on the difference between the predicted fused image and the label image to obtain a target blacklight image fusion model. By applying the technical solution provided by the embodiment of the present application, a blacklight image fusion model capable of outputting high-quality images can be trained.
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 a blacklight image fusion model training method and a blacklight image fusion method. Background Art

[0002] At night or in low-light environments, traditional visible light cameras may not be able to capture clear images. Therefore, black light cameras are usually used for shooting under low-light conditions. Black light cameras are equipped with infrared light sensors and visible light sensors, which can capture infrared road images with high signal-to-noise ratio but no color information and visible road images with low signal-to-noise ratio. The captured infrared road images and visible road images are then fused using traditional image fusion algorithms to obtain fused road images (i.e., images output by black light cameras in related technologies). However, during the fusion process, if there are too many reference infrared road images, the fused road image may have a high signal-to-noise ratio but unreal colors; if there are too many reference visible road images, the fused road image may have realistic colors but poor signal-to-noise ratio. Therefore, traditional image fusion algorithms cannot enable black light cameras to output high-quality images. Summary of the invention

[0003] The purpose of the embodiments of the present application is to provide a blacklight image fusion model training method and a blacklight image fusion method, so as to train a blacklight image fusion model capable of outputting high-quality images. The specific technical solution is as follows:

[0004] In a first aspect, an embodiment of the present application provides a black light image fusion model training method, the method comprising:

[0005] Based on the defect features of each first dimension obtained by counting each real visible road image, the label image is adjusted to obtain a sample visible road image; and based on the defect features of each second dimension obtained by counting each real fused road image, the label image is adjusted to obtain a sample fused road image, wherein the features of the sample visible road image in each first dimension match the features of the real visible road image, and the features of the sample fused road image in each second dimension match the features of the real fused road image;

[0006] Inputting the sample visible road image and the sample fused road image into an original blacklight image fusion model to obtain a predicted fused image output by the original blacklight image fusion model;

[0007] Based on the difference between the predicted fusion image and the label image, the model parameters of the original blacklight image fusion model are adjusted to obtain a target blacklight image fusion model.

[0008] In some embodiments, the original blacklight image fusion model includes a denoising sub-model and a prediction sub-model; inputting the sample visible road image and the sample fused road image into the original blacklight image fusion model to obtain a predicted fused image output by the original blacklight image fusion model includes:

[0009] Inputting the sample fused road image into the denoising sub-model to obtain a denoised fused road image;

[0010] Inputting the denoised fused road image and the sample visible road image into the prediction sub-model to obtain a predicted fused image output by the prediction sub-model;

[0011] Among them, the denoising sub-model is used to denoise the sample fused road image; the prediction sub-model is used to color the denoised fused road image and the sample visible road image, and process the color-adjusted images to obtain a predicted fused image.

[0012] In some embodiments, the method further comprises:

[0013] Inputting the sample visible road image into the filtering sub-model to obtain a denoised visible road image;

[0014] Based on the difference between the visible road image after denoising and the label image, adjusting the model parameters of the filtering sub-model to obtain the denoising sub-model;

[0015] The adjusting the model parameters of the original blacklight image fusion model to obtain the target blacklight image fusion model includes:

[0016] The model parameters of the prediction sub-model in the original black light image fusion model are adjusted to obtain a target black light image fusion model.

[0017] In some embodiments, the method further comprises,

[0018] Based on the denoising sub-model, weighting the denoised fused road image and the sample fused road image according to corresponding weights to obtain a weighted fused road image;

[0019] The step of inputting the denoised fused road image and the sample visible road image into the original black light image fusion model comprises:

[0020] The weighted fused road image and the sample visible road image are input into the prediction sub-model to obtain a predicted fused image output by the prediction sub-model; wherein the weight corresponding to the denoised image in the original blacklight image fusion model is less than the weight corresponding to the denoised image in the target blacklight image fusion model.

[0021] In some embodiments, the method further comprises:

[0022] Based on the denoising sub-model, obtaining the features of the sample fusion road image;

[0023] The step of inputting the denoised fused road image and the sample visible road image into the prediction sub-model to obtain a predicted fused image output by the prediction sub-model includes:

[0024] The features of the sample fused road image, the weighted fused road image, and the sample visible road image are input into the prediction sub-model to obtain a predicted fused image output by the prediction sub-model.

[0025] In some embodiments, the first dimension includes a blur dimension and / or a noise dimension, and the defect characteristics of the blur dimension are used to represent the degree of blur in each of the real visible light images caused by various preset factors; the defect characteristics of the noise dimension are used to represent the degree of noise in each of the real visible light images caused by various preset factors.

[0026] In some embodiments, the second dimension includes a color cast dimension and / or a white edge dimension and / or a contour dimension and / or a background dimension, and the defect characteristics of the color cast dimension are used to indicate the degree of color cast caused by various factors in each of the real fusion path images; the defect characteristics of the white edge dimension are used to indicate the degree of white edge caused by various factors in each of the real fusion path images; the defect characteristics of the contour dimension are used to indicate the degree of contour enlargement caused by various factors in each of the real fusion path images; the defect characteristics of the background dimension are used to indicate the degree of background darkening caused by various factors in each of the real fusion path images.

[0027] In some embodiments, adjusting the label image to obtain a sample fusion path image includes:

[0028] Segmenting the target area and the background area in the label image to obtain an initial contour image, wherein the initial contour image is used to represent the initial contour of the target area in the label image;

[0029] Filtering the initial contour image to obtain an enlarged contour image, wherein the enlarged contour image is used to represent an enlarged contour obtained by enlarging the initial contour; and enlarging the target area in the label image to obtain an enlarged target area, and intercepting the enlarged target area as an enlarged label image;

[0030] Based on the enlarged contour image and the label image, a sub-image of a first fusion area is determined in the label image, and based on the enlarged contour image and the enlarged label image, a sub-image of a second fusion area is determined in the enlarged label image, wherein the first fusion area is an area in the label image that is complementary to an area where the enlarged contour is located; and the second fusion area is an area in the enlarged label image where the enlarged contour is located;

[0031] The sub-image of the first fusion area and the sub-image of the second fusion area are fused to obtain a sample fusion path image.

[0032] In some embodiments, adjusting the label image to obtain a sample fusion path image includes:

[0033] Determine pixels in an area other than the target area in the label image as background pixels;

[0034] Based on the first preset value, the pixel value of each of the background pixels is reduced, and the proportion of the pixel points whose pixel value is less than the first threshold in the background pixels after the reduction is determined as the brightness reference value;

[0035] If the brightness reference value is less than the second threshold value, the step of reducing the pixel value of each background pixel point based on the preset value is no longer performed, or the first preset value is adjusted, and the step of reducing the pixel value of each background pixel point based on the first preset value is repeated;

[0036] If the brightness reference value is not less than the second threshold, the pixel values ​​of the pixel points whose pixel values ​​are less than the first threshold among the reduced background pixel points are adjusted to the second preset value.

[0037] In a second aspect, an embodiment of the present application further provides a black light image fusion method, the method comprising:

[0038] Obtaining a visible road image to be synthesized and a fused road image to be synthesized;

[0039] Inputting the visible road image to be synthesized and the fused road image to be synthesized into a target blacklight image fusion model to obtain a target fused image output by the target blacklight image fusion model;

[0040] Wherein, the target blacklight image fusion model is trained according to any of the aforementioned blacklight image fusion model training methods.

[0041] Beneficial effects of the embodiments of the present application:

[0042] In the technical solution provided by the embodiment of the present application, the defect features of the first dimension are obtained based on statistics of each real visible road image, and can represent the common features of each real visible road image. The label image is adjusted according to the defect features of the first dimension, so that the features of the label image in each first dimension match those of each real visible road image. In this way, an image whose image content is consistent with that of the label image but also has the features of the real visible road image can be obtained, and thus, the image can be used as a sample visible road image; similarly, the defect features of the second dimension are obtained based on statistics of each real fused road image, and can represent the common features of each real fused road image. The label image is adjusted according to the defect features of the second dimension, so that the features of the label image in each second dimension match those of each real fused road image. In this way, an image whose image content is consistent with that of the label image but also has the features of the real fused road image can be obtained, and thus, the image can be used as a sample fused road image; in this way, the sample visible road image and the sample fused road image are both obtained by adjusting the label image, and therefore, the label image can be used as a target, and the sample visible road image and the sample fused road image can be input into the original blacklight image fusion model to obtain a blacklight image fusion model that can output high-quality images.

[0043] Of course, implementing any product or method of the present application does not necessarily require achieving all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the embodiments of the present application 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 some embodiments of the present application, and for ordinary technicians in this field, other embodiments can also be obtained based on these drawings.

[0045] Figure 1 A schematic diagram of a first process flow of a black light image fusion model training method provided in an embodiment of the present application;

[0046] Figure 2 A second flow chart of the black light image fusion model training method provided in an embodiment of the present application;

[0047] Figure 3 A schematic diagram of the structure of a black light image fusion model provided in an embodiment of the present application;

[0048] Figure 4 A schematic diagram of adding a white border to a label image provided in an embodiment of the present application;

[0049] Figure 5 A schematic diagram of a process for obtaining a sample fusion road image provided in an embodiment of the present application;

[0050] Figure 6 A schematic diagram of a label image provided in an embodiment of the present application;

[0051] Figure 7 A schematic diagram of an initial contour image provided in an embodiment of the present application;

[0052] Figure 8 A schematic diagram of an enlarged contour image provided in an embodiment of the present application;

[0053] Fig. 9 A schematic diagram of a sample fusion road image provided in an embodiment of the present application;

[0054] Fig.10 Another schematic diagram of a process for obtaining a sample fusion road image provided in an embodiment of the present application;

[0055] Fig.11 Another schematic diagram of a sample fused road image provided in an embodiment of the present application;

[0056] Fig.12 A schematic diagram of obtaining a sample visible road image and a sample fused road image provided in an embodiment of the present application;

[0057] Fig.13 A schematic flow chart of a black light image fusion method provided in an embodiment of the present application. DETAILED DESCRIPTION

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

[0059] The following is an explanation of the nouns that appear in the embodiments of the present application:

[0060] Light intensity: refers to the energy of visible light received per unit area, referred to as illumination, and the unit is Lux;

[0061] Low illumination environment: refers to an environment with low light intensity. For example, when the light intensity under a street lamp is about 0.1 Lux, when the light intensity under a full moon is about 0.02 Lux, and when the light intensity under starlight is 0.0002 Lux, they can all be considered low illumination environments.

[0062] Gradient descent algorithm: refers to an algorithm that determines the direction and magnitude of parameter updates based on the gradient information of the loss function;

[0063] Label (ground truth, GT) data: refers to the data used as labels in the deep learning network; the loss function of the deep learning network can be calculated by comparing the label data with the output of the deep learning network. At the same time, the loss function of the deep learning network can be gradually reduced by combining the gradient descent algorithm to update the parameters of the deep learning network, thereby improving the performance of the deep learning network;

[0064] YUV and LAB: two color spaces. In YUV, Y represents brightness, and U and V represent chromaticity; in LAB, L represents brightness, and A and B represent chromaticity. YUV and LAB are designed to separate brightness and color, but they are not completely independent. In some cases, brightness and color may overlap or cross-influence to a certain extent.

[0065] RGB (red, green, blue): refers to the color space most commonly used for displays. R (red) refers to the red channel, G (green) refers to the green channel, and B (blue) refers to the blue channel. In the RGB format, (0, 0, 0) represents black, and (255, 255, 255) represents white.

[0066] HSV (hue, saturation, value): H (hue) refers to hue, which indicates the color type; S (saturation) refers to saturation, which indicates the purity or brightness of the color; V (value) refers to value, which indicates the brightness of the color.

[0067] In low-light and high-gain conditions, images captured by traditional visible light cameras have large noise and low signal-to-noise ratio. Therefore, black light cameras are usually used for shooting in low-light conditions. Black light cameras can use traditional image fusion algorithms to fuse the captured visible road images and infrared road images to obtain clear fused road images. However, due to the many defects of traditional image fusion algorithms, such as the following defects (a)-(b), the quality of the obtained fused road images is low, among which:

[0068] (a) The robustness of traditional image fusion algorithms is poor. Usually, a set of parameters is only applicable to specific scenarios and is not universal. For example, when denoising, a stronger filter kernel is set for denoising. In this way, for images with more noise, the quality of the image obtained after denoising is better, but for images with less noise, the image may be too blurred after denoising, resulting in poor image quality.

[0069] (b) Since YUV and LAB are not completely independent, that is, they are not absolutely separated in brightness and color, when using traditional image fusion algorithms to fuse visible road images and infrared road images, if there are too many reference infrared road images, the color of the fused road image may be cast; if there are too many reference visible road images, the signal-to-noise ratio of the fused road image may be poor, and the edges and details may be blurred.

[0070] It can be seen that traditional image fusion algorithms cannot enable black-light cameras to output high-quality images. In other words, conventional networks or complex networks usually cannot meet the task of black-light image fusion. Although deep learning network structures are emerging in an endless stream, there is basically no network structure dedicated to black-light image fusion.

[0071] In addition, if a new image fusion algorithm is to be trained, a large amount of sample data and label data is required, but there is currently no data set related to blacklight fusion, and it is difficult to construct high-quality sample data and label data even if a blacklight camera is used for shooting. For example, in a low-light environment, although a blacklight camera can be used to shoot visible road images, infrared road images, and fused road images, high-quality images cannot be captured in a low-light environment regardless of whether a traditional visible light camera or a blacklight camera is used. Therefore, high-quality sample data and label data cannot be obtained in a low-light environment; in an environment with good light intensity, although high-quality images can be captured, the quality of the visible road images, infrared road images, and fused road images captured at this time is also good, which is different from the visible road images, infrared road images, and fused road images captured in a low-light environment. Therefore, the visible road images, infrared road images, and fused road images captured in an environment with good light intensity are not suitable as sample data. Therefore, high-quality sample data and label data cannot be obtained in an environment with good light intensity.

[0072] In order to solve the above problems, the present application embodiment provides a black light image fusion model training method. Below, the water quality detection method provided by the present application embodiment is described in detail through specific examples.

[0073] The black light image fusion model training method provided in the embodiment of the present application can be applied to electronic devices. Specifically, the electronic device can be a desktop computer, a portable computer, a smart mobile terminal, etc.

[0074] See also Figure 1 , Figure 1 The first flow chart of the black light image fusion model training method provided in the embodiment of the present application includes the following steps:

[0075] Step S11: Based on the defect features of each first dimension obtained by counting each real visible road image, the label image is adjusted to obtain a sample visible road image; and based on the defect features of each second dimension obtained by counting each real fused road image, the label image is adjusted to obtain a sample fused road image;

[0076] Step S12: inputting the sample visible road image and the sample fused road image into the original black light image fusion model to obtain a predicted fused image output by the original black light image fusion model;

[0077] Step S13: Based on the difference between the predicted fusion image and the label image, the model parameters of the original blacklight image fusion model are adjusted to obtain the target blacklight image fusion model.

[0078] In the technical solution provided by the embodiment of the present application, the defect features of the first dimension are obtained based on statistics of each real visible road image, and can represent the common features of each real visible road image. The label image is adjusted according to the defect features of the first dimension, so that the features of the label image in each first dimension match those of each real visible road image. In this way, an image whose image content is consistent with that of the label image but also has the features of the real visible road image can be obtained, and thus, the image can be used as a sample visible road image; similarly, the defect features of the second dimension are obtained based on statistics of each real fused road image, and can represent the common features of each real fused road image. The label image is adjusted according to the defect features of the second dimension, so that the features of the label image in each second dimension match those of each real fused road image. In this way, an image whose image content is consistent with that of the label image but also has the features of the real fused road image can be obtained, and thus, the image can be used as a sample fused road image; in this way, the sample visible road image and the sample fused road image are both obtained by adjusting the label image, and therefore, the label image can be used as a target, and the sample visible road image and the sample fused road image can be input into the original blacklight image fusion model to obtain a blacklight image fusion model that can output high-quality images.

[0079] In the above step S11, the label image is a high-quality image, and the high-quality image can be understood as an image with a high signal-to-noise ratio and realistic colors. The label image can be obtained from a public high-quality image dataset. For example, the label image can be a portrait image with a high signal-to-noise ratio and realistic colors, which can be obtained from a high-quality portrait dataset (Flickr-Faces-High-Quality, FFHQ); the real visible road image is a visible road image taken by a blacklight camera in a low-light environment; the real fused road image is a fused road image with a high signal-to-noise ratio but a color cast obtained by taking a blacklight camera in a low-light environment. It can be understood that the purpose of the method shown in this article is to train a blacklight image fusion model to obtain a high-quality image, and the input of the blacklight image fusion model is a visible road image and a fused road image. The signal-to-noise ratio of the visible road image is low. Therefore, in order to facilitate the training of the model, the fused road image input to the blacklight image fusion model should be an image with a high signal-to-noise ratio. Therefore, in the embodiment of the present application, the real fused road image should be a fused road image with a high signal-to-noise ratio but a color cast.

[0080] The defect features of the first dimension can be understood as the unique features of the real visible road image compared with the high-quality image. The electronic device can perform statistics on each real visible road image to obtain multiple defect features of the first dimension. Similarly, the defect features of the second dimension can be understood as the unique features of the real fused road image compared with the high-quality image. The electronic device can perform statistics on each real fused road image to obtain multiple defect features of the second dimension.

[0081] In the embodiment of the present application, the features of the sample visible road image in each first dimension match those of the real visible road images, that is, the content of the sample visible road image is consistent with the content of the label image, but the sample visible road image has defect features in each first dimension. For example, the label image is a portrait image, and the defect features in the first dimension include blur and low signal-to-noise ratio. After adjusting the portrait image based on the defect features in the first dimension, the obtained sample visible road image is also a portrait image, and the portrait in the sample visible road image is the same as the portrait in the portrait image, but the sample visible road image has the features of blur and low signal-to-noise ratio. Similarly, the features of the sample fused road image in each second dimension match those of the real visible road images, that is, the content of the sample fused road image is consistent with the content of the label image, but the sample fused road image has defect features in each second dimension.

[0082] To illustrate with an example, for example, there is a label image A, and the electronic device has statistically obtained the defect features of each first dimension and each second dimension. Based on the defect features of the first dimension, the label image A is adjusted to obtain a sample visible road image A. At this time, the content of the sample visible road image A is consistent with the content of the label image A, and has the defect features of each first dimension; at the same time, based on the defect features of the second dimension, the label image A is adjusted to obtain a sample fused road image A. At this time, the content of the sample fused road image A is consistent with the content of the label image A, and has the defect features of each second dimension. In this way, a set of data pairs can be obtained with the sample visible road image A and the sample fused road image A as sample data and the label image A as label data.

[0083] The method of adjusting the label image according to the defect features of the first dimension and the defect features of the second dimension to obtain the sample visible road image and the sample fused road image can be found in the description below and will not be repeated here.

[0084] In the above step S12, the blacklight image fusion model is used to process the visible road image and the fused road image to obtain a high-quality image; the original blacklight image fusion model refers to an untrained blacklight image fusion model, and after the sample visible road image and the sample fused road image are input into the original blacklight image fusion model, the predicted fused image output by the original blacklight image fusion model can be obtained. For example, continuing with the example in the above step S11, the sample visible road image A and the sample fused road image A can be input into the original blacklight image fusion model to obtain the predicted fused image A output by the original blacklight image fusion model.

[0085] In the above step S13, after the sample visible road image and the sample fused road image are input into the original blacklight image fusion model, the predicted fused image output by the original blacklight fusion model is obtained. Based on the difference between the predicted fused image and the label image, the model parameters of the original blacklight image can be adjusted to obtain a new blacklight image fusion model, and it is determined whether the preset conditions are met at this time. If the preset conditions are not met, the new blacklight image fusion model can be regarded as the original blacklight image fusion model, and the above steps S12-S13 are repeated until the preset conditions are met, wherein the preset conditions can be a preset number of training times, or the model parameters of the blacklight image fusion model have converged, or the loss function of the blacklight image fusion model is lower than a preset threshold, etc., wherein the preset threshold can be set according to actual conditions.

[0086] In some embodiments, the difference between the predicted fusion image and the label image can be the perceptual loss of the blacklight image fusion model determined based on the predicted fusion image and the label image, or the L1 norm loss of the blacklight image fusion model determined based on the predicted fusion image and the label image, or the perceptual loss and L1 norm loss of the blacklight image fusion model determined based on the predicted fusion image and the label image.

[0087] In some embodiments, the original black light image fusion model includes a denoising sub-model and a prediction sub-model, see Figure 2 , Figure 2 The second flow chart of the black light image fusion model training method provided in the embodiment of the present application may include the following steps:

[0088] Step S21, based on the defect features of each first dimension obtained by counting each real visible road image, the label image is adjusted to obtain a sample visible road image; and based on the defect features of each second dimension obtained by counting each real fused road image, the label image is adjusted to obtain a sample fused road image; the same as the above step S11;

[0089] Step S22: inputting the sample fused road image into the denoising sub-model to obtain a denoised fused road image;

[0090] Step S23: inputting the denoised fused road image and the sample visible road image into the prediction sub-model to obtain a predicted fused image output by the prediction sub-model;

[0091] Step S24: Based on the difference between the predicted fusion image and the label image, the model parameters of the original blacklight image fusion model are adjusted to obtain the target blacklight image fusion model, which is the same as the above step S13.

[0092] In the technical solution provided in the embodiment of the present application, the sample fused road image has the characteristics of a real fused road image, that is, the signal-to-noise ratio of the sample fused road image is relatively high; the sample visible road image has the characteristics of a real visible road image, that is, the color of the sample visible road image is relatively realistic, and a denoising sub-model and a prediction sub-model are set in the black light image fusion model. The denoising sub-model performs denoising on the input sample fused road image to obtain a denoised fused road image, and then the denoised fused road image and the sample visible road image are input into the prediction model, which is processed by the prediction model to output a predicted fused image, so that the signal-to-noise ratio of the output predicted fused image can be higher, the color can be more realistic, and it can be closer to a high-quality image.

[0093] In the above step S22, the denoising sub-model is used to denoise the sample fused road image. After the sample fused road image is input into the denoising sub-model, a denoised fused road image can be obtained.

[0094] In the above step S23, the prediction sub-model is used to adjust the color of the fused road image after denoising and the sample visible road image, and the adjusted image is processed to obtain a predicted fused image. In the embodiment of the present application, adjusting the color of the fused road image after denoising and the sample visible road image can be understood as adjusting the color of the fused road image after denoising and the sample visible road image to be close to the color of the real fused road image. For example, the defect features of the second dimension include brightness and contrast, then the brightness and chromaticity of the fused road image after denoising and the sample visible road image can be adjusted to be close to the brightness and contrast indicated by the defect features of the second dimension.

[0095] In the above Figure 2 In the illustrated embodiment, the denoising sub-model may be an untrained model. When the denoising sub-model is an untrained model, the above step S24 may be understood as adjusting the model parameters of the denoising sub-model and the prediction sub-model in the original blacklight image fusion model based on the difference between the predicted fusion image and the label image to obtain the target blacklight image fusion model.

[0096] In some embodiments, the denoising sub-model may also be a trained filtering sub-model. In an embodiment of the present application, the electronic device may input the sample visible road image into the filtering sub-model to obtain a visible road image after denoising, and adjust the model parameters of the filtering sub-model according to the difference between the visible road image after denoising and the label image to obtain the denoising sub-model. At this time, the above step S24 may be understood as adjusting the parameters of the prediction sub-model in the original black light image fusion model based on the difference between the predicted fusion image and the label image to obtain the target black light image fusion model. That is, at this time, only the parameters of the prediction sub-model may be adjusted, and the parameters of the denoising sub-model may no longer be adjusted.

[0097] It can be understood that in the process of using the target black light image fusion model to output the target fused image, the image input to the denoising sub-model is the fused road image. Therefore, in the process of training the filter sub-model to obtain the denoising sub-model, the sample fused road image can also be used as a sample, and the model parameters of the filter sub-model can be adjusted based on the difference between the denoised fused road image and the label image to obtain the denoising sub-model. However, since the sample fused road image is an image with a relatively high signal-to-noise ratio, after the sample fused road image is input into the denoising sub-model, the difference in signal-to-noise ratio between the denoised fused road image and the label image may be small. In this way, the denoising sub-model trained based on the difference between the denoised fused road image and the label image may have poor denoising ability. When the input is an image with a poor signal-to-noise ratio, the denoising effect is not obvious.

[0098] Compared with the sample fused road image, the signal-to-noise ratio of the sample visible road image is poor. Therefore, the sample visible road image with poor signal-to-noise ratio is used as the sample, and the model parameters of the filtering sub-model are adjusted based on the difference between the visible road image after denoising and the label image. The obtained denoising sub-model has a stronger denoising ability. In this way, when the fused road image with a higher signal-to-noise ratio than the visible road image is subsequently input into the denoising sub-model, the possibility of low signal-to-noise ratio of the fused road image after denoising due to poor denoising ability of the denoising sub-model can be reduced, thereby reducing the possibility of low signal-to-noise ratio of the target fused image output by the target black light image due to low signal-to-noise ratio of the fused road image after denoising.

[0099] In the above Figure 2 In the illustrated embodiment, corresponding weights may also be set in advance for the denoised fused road image and the sample fused road image. After the sample fused road image is input into the denoising sub-model to obtain the denoised fused road image, the denoising sub-model may also weight the denoised fused road image and the sample fused road image according to corresponding weights to obtain a weighted fused road image. At this time, the above step S23 may be to input the weighted fused road image and the sample visible road image into the prediction sub-model to obtain a predicted fused image.

[0100] In some embodiments, the denoising sub-model can calculate the weighted fused road image using the following formula (1):

[0101] fus_denoise=(1-ratio)×fus restoration +(ratio)×fus (1)

[0102] Among them, fus_denoise represents the weighted fusion path image; fus restoration It represents the fused image after denoising; fus represents the sample fused image; ratio represents the weight of fus in fus_denoise, and its value range is [0,1]. It can be understood that when the ratio value is 0, it indicates that the image input to the prediction sub-model is actually the fused image after denoising and the sample visible image; when the ratio value is 1, it indicates that the image input to the prediction sub-model is actually the sample fused image and the sample visible image; the smaller the value of ratio, the higher the signal-to-noise ratio of the weighted fused image.

[0103] In some embodiments, the weight corresponding to the denoised image in the original blacklight image fusion model may be smaller than the weight corresponding to the denoised image in the target blacklight image fusion model. It is understandable that in the process of training the prediction sub-model, if the image input to the prediction sub-model is a denoised fused road image and a sample visible road image, since the signal-to-noise ratio of the denoised fused road image is good, it is easier to obtain a fused image similar to the label image in the subsequent prediction model processing the denoised fused road image and the sample visible road image. In this way, the prediction sub-model trained has poor processing ability for the input image. If the image input to the prediction sub-model is an image with a poor signal-to-noise ratio, the prediction sub-model may not be able to output the expected high-quality image. Therefore, when training the prediction sub-model, the weight corresponding to the denoised image may be set smaller so that the signal-to-noise ratio of the image input to the prediction sub-model is poor. In this way, the processing ability of the trained prediction sub-model is stronger, which is more conducive to the high-quality image output by the blacklight image fusion model. In some examples, the weight corresponding to the denoised image can be directly set to 0 during the training process.

[0104] However, in the target blacklight image fusion model, in order to make the target blacklight image fusion model output high-quality images, the difficulty of the image input to the target blacklight image fusion model should be reduced to reduce the complexity of the target blacklight image fusion model processing. Therefore, the weight corresponding to the denoised image in the target blacklight image fusion model can be set larger, so that the signal-to-noise ratio of the image input to the prediction sub-model is higher, which is more conducive to the prediction sub-model outputting high-quality images. Based on this, the weight corresponding to the denoised image in the original blacklight image fusion model should be smaller than the weight corresponding to the denoised image in the target blacklight image fusion model.

[0105] It can be understood that the denoising sub-model can determine the fused road image after denoising by acquiring the features of the sample fused road image. Therefore, in some embodiments, the features of the sample fused road image acquired by the denoising sub-model can also be input into the prediction sub-model, that is, in this embodiment, the above step S23 can be input into the prediction sub-model, and the features of the sample fused road image, the weighted fused road image, and the sample visible road image are input into the prediction sub-model to obtain the predicted fused image output by the prediction sub-model.

[0106] In the technical solution provided in the embodiment of the present application, considering that the signal-to-noise ratio of the image may be attenuated during the processing of the weighted fusion road image and the sample fusion road image by the prediction sub-model, the features of the sample fusion road image can be obtained based on the denoising sub-model, and the features of the sample fusion road image and the weighted fusion road image can be input into the prediction sub-model to compensate for the attenuated signal-to-noise ratio to a certain extent, thereby facilitating the subsequent prediction sub-model to output a high-quality fusion image.

[0107] See also Figure 3 , Figure 3 A schematic diagram of the structure of the black light image fusion model provided in the embodiment of the present application, Figure 3 The black light image fusion model shown includes a denoising sub-model and a prediction sub-model. The encoding modules in the denoising sub-model and the prediction sub-model are mainly composed of convolutional layers, and the decoding modules are composed of convolutional layers and upsampling layers.

[0108] The denoising sub-model includes encoding modules 1-encoding modules 4, and encoding modules 1-encoding modules 4 correspond to decoding modules 1-decoding modules 4 respectively, and decoding modules 1-decoding modules 4 correspond to feature encoding 1-feature encoding 4 respectively, wherein the output feature size of encoding modules 1-encoding modules 4 is gradually increased by 1 / 2 times, and the number of channels is gradually increased by 2 times, and the output feature size of decoding modules 1-decoding modules 4 is gradually increased by 1 / 2 times, and the number of channels is gradually increased by 2 times; in the denoising sub-model, output decoding 1 is obtained from feature encoding 1, and output 1 is obtained according to output decoding 1, wherein output 1 can be understood as a fused road image after denoising; the denoising sub-model also includes a summation module, which is used to perform weighted summation of output 1 (i.e., fused road image after denoising) and sample fused road image according to corresponding weights to obtain the above-mentioned weighted fused road image.

[0109] The prediction sub-model includes encoding modules 5-encoding modules 8, and the encoding modules 5-encoding modules 8 correspond to decoding modules 5-decoding modules 8 respectively. The feature codes 1-feature codes 4 in the denoising sub-model are respectively input into the decoding modules 5-decoding modules 8 in the prediction sub-model. After the encoding modules 5-encoding modules 8 and the decoding modules 5-decoding modules 8 process the input weighted fusion road image and the sample visible road image, the prediction sub-model obtains the feature code 5, and the output decoding 2 is obtained based on the feature code 5. The output 2 is obtained according to the output decoding 2, wherein the output 2 can be understood as the image output by the black light image fusion model, that is, the predicted fusion image or the target fusion image.

[0110] The network structure of the black light image provided in the embodiment of the present application is different from the general network structure. It adopts a two-stage network to process the visible road image and the fused road image. It can adjust the signal-to-noise ratio of the image input to the prediction sub-model through preset weights, and can input the features extracted by the denoising sub-model into the prediction sub-model to act on the prediction sub-model.

[0111] Next, a method of adjusting the label image according to the defect features of the first dimension and the defect features of the second dimension in the embodiment of the present application to obtain a sample visible road image and a sample fused road image is described.

[0112] First, it can be understood that after a large number of real visible road images are counted, the main characteristics of the visible road images are blur, loss of details, and low signal-to-noise ratio. Therefore, in some embodiments, the defect feature of the first dimension includes a blur dimension and a noise dimension; or, the defect feature of the first dimension includes a blur dimension; or, the defect feature of the first dimension includes a noise dimension. Among them, the defect feature of the blur dimension is used to represent the blur degree caused by various preset factors in each real visible road image; the defect feature of the noise dimension is used to represent the noise degree caused by various preset factors in each real visible light image.

[0113] The electronic device can add blur to the label image in the following ways (a)-(d), and add noise to the label image in the way (e). It can be understood that when the defect feature of the first dimension includes a blur dimension and a noise dimension, the electronic device can first add blur to the label image, and then add noise to the blurred image, that is, first execute the following (a)-(d), and then execute (e); or, the electronic device can also first add noise to the label image, and then add blur to the label image after adding noise, that is, execute the following (e), and then execute (a)-(d); similarly, when adding blur to the label image, the embodiment of the present application provides four different ways (a)-(d), and the electronic device can use any one or more of these four ways to add blur to the label image, and at the same time, add noise to it. There is no limitation on the order of blurring. For example, if the electronic device only adds noise to the label image according to (a)-(c), the electronic device can first execute (a), then execute (b), and then execute (c). At this time, the object to be processed by method (b) is the image processed by method (a), and the object to be processed by method (c) is the image processed by method (b); or, the electronic device can first execute (b), then execute (a), and then execute (c). At this time, the object to be processed by method (a) is the image processed by method (b), and the object to be processed by method (c) is the image processed by method (a). It can be seen that there are many ways to add blur and label to the label image. Therefore, for the convenience of description, the subsequent content takes the label image as an example to explain the processing method. The specific image to be processed by the method can be determined according to the actual execution order. Below, methods (a)-(e) are explained respectively:

[0114] (a) The relative motion between the scene and the camera may cause motion blur in the image captured by the camera. Therefore, the motion blur kernel of the image can be determined by the following formula (2), and then the label image can be adjusted to have motion blur by the following formula (3):

[0115] kernal motion=fspecial('motion',len,theta) (2)

[0116] Among them, kernel motion Represents the generated motion blur kernel; fspecial() represents the function used to generate the blur kernel; motion represents the blur kernel to be generated is a motion blur kernel; len represents the number of moving pixels, and the value range can be set to a random value in the range of [3,15]; theta represents the motion angle, and the value range can be set to a random value in the range of [1,360].

[0117] (3)

[0118] Among them, image motion Represents the label image after motion blur; kernal motion represents the motion blur kernel, image original Represents a label image.

[0119] (b) Upsampling and downsampling the label image to achieve scaling blur of the label image. Here, the upsampling and downsampling can be implemented by the nearest neighbor interpolation method, the bilinear interpolation method, etc. For example, the label image can be downsampled to a random multiple of the original size, and then upsampled to the original size. In order to avoid making the image too blurred, the random multiple of the downsampling should not be too small. For example, the value range of the random multiple of the downsampling can be [0.5, 1].

[0120] (c) Use Gaussian distribution to generate a convolution blur kernel to blur the label image. The Gaussian blur kernel of the image can be determined by the following formula (4), and the label image can be adjusted to have Gaussian blur by the following formula (5):

[0121] kernal gaussian =fspecial('gaussian',kernal_size,sigma) (4)

[0122] Among them, kernel gaussian Represents the generated Gaussian blur kernel; fspecial() represents the function used to generate the blur kernel; gaussian is used to indicate that the type of the generated blur kernel is a Gaussian blur kernel; kernal_size is used to indicate the size of the generated Gaussian blur kernel; sigma indicates the Gaussian standard deviation of the generated Gaussian blur kernel, and its value range can be set to a random value in [0.1,2.1].

[0123] (5)

[0124] Among them, image gaussianRepresents the label image after Gaussian blur; image original Represents a label image; kernal gaussian represents the Gaussian blur kernel.

[0125] (d) Due to the use of a large aperture, objects that are not on the focal plane may produce defocus blur, and the farther away from the focal plane, the blurrier the photographed object is in the image. The defocus blur kernel of the image can be determined by the following formula (6), and the label image can be adjusted to have defocus blur by the following formula (7):

[0126] kernal disk =fspecial('disk',r) (6)

[0127] Among them, kernel disk Represents the generated defocus blur kernel; fspecial() represents the function used to generate the blur kernel; disk is used to indicate that the type of the generated blur kernel is a defocus blur kernel; r represents the size of the generated defocus blur kernel, and its value range can be set to a random value in [3,7].

[0128] (7)

[0129] Among them, image disk Represents the label image after defocus blur, image original Represents a label image; kernal disk Represents the defocus blur kernel.

[0130] (e) When adding noise to the label image, in order to make the added noise shape more consistent with the noise distribution of the real visible road image, a large number of real visible road images with different gains and different scenes are collected. The noise image of any real visible road image in the collected real visible road images can be calculated by the following formula (8), and the noise image calculated by formula (8) can be added to the label image by the following formula (9):

[0131] noise i =image capture -CBM3D(image capture ) (8)

[0132] image noise =image original +ratio×noise k (9)

[0133] Among them, noise irepresents the noise of the i-th real visible road image (also called noise image); CBM3D represents the traditional denoising algorithm; image capture represents the i-th real visible road image, where the value range of i can be expressed as i∈[1,n], and n is the number of real visible road images collected. image noise Represents the label image after adding noise; image original Represents label image; noise k represents the noise image of the kth real visible road image, where the value range of k can be expressed as k∈[1,n], n is the number of real visible road images collected; ratio represents the noise k The weight of the label image after adding noise, the value of ratio can be set according to the noise level of the real visible road image obtained by statistics, for example, the value range of ratio can be [0.3, 10.3].

[0134] Secondly, it is understandable that after statistics of a large number of real fused road images, the fused road images obtained mainly include the following features:

[0135] (a) The signal-to-noise ratio of the fused road image is high but the color is biased;

[0136] (b) The white edge of the fused road image synthesized by the traditional image fusion algorithm is relatively heavy;

[0137] (c) The fused road image is obtained by fusing the visible road image and the infrared road image. When the visible road image has a high gain, the edge of the fused road image may be blurred due to the influence of filtering in the time domain and spatial domain.

[0138] (d) The fused road image has more references to the infrared road image, so the edge details are better preserved. For example, for a portrait image, the portrait in the fused road image has a few more pixels than that in the visible road image;

[0139] (e) Since the fused road image refers to the infrared road image, the background of the fused road image is often darker.

[0140] Based on this, in some embodiments, the defect features of the second dimension include color cast dimension and / or white edge dimension and / or contour dimension and / or background dimension, wherein the defect features of the color cast dimension are used to represent the degree of color cast caused by various factors in each real fusion road image; the defect features of the white edge dimension are used to represent the degree of white edge caused by various factors in each real fusion road image; the defect features of the contour dimension are used to represent the degree of enlargement of the contour caused by various factors in each real fusion road image; the defect features of the background dimension are used to represent the degree of background darkening caused by various factors in each real fusion road image.

[0141] It can be understood that based on the defect characteristics of the second dimension, the electronic device can perform color conversion (see (a)-(d) below), add white edges (see Figure 4 ), contour extension (see below Figure 5 ), background brightness adjustment (see below Fig.10 ). It can be understood that in the actual processing process, the execution order of these four methods is not restricted, and in the process of color conversion, the execution order of methods (a)-(d) is also not restricted. Therefore, for the convenience of description, the subsequent content takes the object processed by each method as the label image as an example to illustrate the processing method. The specific image to be processed by the method can be determined according to the actual execution order. The following describes the methods of color conversion, adding white edges, contour expansion, and background brightness adjustment of the label image.

[0142] The electronic device may perform color transformation (colortransform) on the label image in the following ways (a)-(d) to cause the label image to have a color cast;

[0143] (a) The brightness of the label image is adjusted by the following formula (10):

[0144] image bright =CLIP 255 (ratio bright ×image original ) (10)

[0145] Among them, image bright Represents the label image after adjusting the brightness; ratio bright Indicates the adjustment of the brightness of the label image, and its value range can be [0.3,1.7]. CLIP 255 () indicates truncation, that is, the pixel value of the point whose pixel value is greater than 255 is set to 255, and the pixel value of the pixel point whose pixel value is less than 0 is set to 0.

[0146] (b) The contrast of the label image is adjusted by the following formula (11):

[0147] image contrast =( image original -mean(image original ))×ratio contrast +mean(image original ) (11)

[0148] Among them, image contrastRepresents the label image after adjusting the contrast; mean() is used to calculate the mean; ratio contrast Represents weight, ratio contrast The value of can be set according to the statistical contrast of the real fusion road image, for example, its value range can be [0.55,1.45].

[0149] (c) Adjust the chromaticity of the label image by using the following formulas (12)-(14). First, convert the image from RGB format to HSV format by using the following formula (12). Then, randomly change the V channel to generate a new V channel by using formula (13). Then, convert the H channel, S channel and the new V channel into RGB images by using formula (14).

[0150] H,S,V=rgb2hsv(image original ) (12)

[0151] V new =(ratio v ×V+360)%360 (13)

[0152] image hue =hsv2rgb(H,S, V new ) (14)

[0153] Among them, rgb2hsv() is used to convert images from RGB format to HSV format; hsv2rgb() is used to convert images from HSV format to RGB format; ratio v Indicates the random change value of the V channel, the value range can be set to [-0.35, 0.35]; % indicates the remainder operation; V new Indicates the new V channel.

[0154] (d) The random change of the saturation of the label image is achieved through the following formulas (15)-(17). First, the image is converted from RGB format to HSV format through the following formula (15), and then the S channel is randomly changed to generate a new S channel through formula (16). After that, the H channel, the new S channel and the V channel are converted into RGB images through formula (17).

[0155] H,S,V=rgb2hsv(image original ) (15)

[0156] S new =CLIP 1 (ratio s ×S) (16)

[0157] image saturation=hsv2rgb(H, S new , V) (17)

[0158] Among them, CLIP 1 () indicates truncation. After randomly changing the S channel, all values ​​greater than 1 are set to 1, and all values ​​less than 0 are set to 0; ratio s Indicates the random change value of the S channel, the value range can be set to [0.3,1.7]; S new Indicates a new S channel.

[0159] In some embodiments, the electronic device may Figure 4 The method shown is to add white edges to the label image. First, the label image is filtered to obtain a filtered image. The purpose of this filtering is to filter out the detail information in the label image. The filter kernel of the filtering can be a Gaussian filter kernel with a filter kernel of 3 and a Gaussian standard deviation of 2.1. Then, the details are extracted by a subtraction operation, that is, the input image is subtracted from the filtered image as the extracted detail image, and the pixel values ​​of the pixels in the detail image with pixel values ​​less than 0 are set to 0 (that is, the negative details are set to 0). Then, the detail image is filtered to obtain the filtered details (that is, the white edges). The filter kernel of this filtering can be a filter kernel with a filter kernel of 5 and a Gaussian standard deviation of 0.6. Then, the white edges are superimposed on the label image through an addition operation to complete the operation of adding white edges to the label image, and the label image after adding white edges is obtained. When the white edges are superimposed on the label image, the superposition strength can be set according to the white edge strength of the real fused road image obtained by statistics. For example, the value range of the superposition strength can be [0.5,2].

[0160] For more information about how to adjust the label image based on the outline dimension and background dimension, see the following Figure 5 and Fig.10 The description in will not be repeated here.

[0161] See also Figure 5 , Figure 5 A schematic diagram of a process for obtaining a sample fusion road image provided in an embodiment of the present application may include the following steps:

[0162] Step S51: segmenting the target area and the background area in the label image to obtain an initial contour image;

[0163] Step S52: filtering the initial contour image to obtain an enlarged contour image; enlarging the target area in the label image to obtain an enlarged target area, and intercepting the enlarged target area as an enlarged label image;

[0164] Step S53: determining a sub-image of the first fusion region in the label image based on the enlarged contour image and the label image, and determining a sub-image of the second fusion region in the enlarged label image based on the enlarged contour image and the enlarged label image;

[0165] Step S54: Fusing the sub-image of the first fusion area and the sub-image of the second fusion area to obtain a sample fusion path image.

[0166] In the technical solution provided in the embodiment of the present application, an initial contour image of the target area in the label image is extracted, and the initial contour image is expanded by filtering to obtain an expanded contour, which is then superimposed on the label image to expand the contour of the target area in the label image, thereby making the label image have the characteristics of a larger contour of the real fused road image.

[0167] In the above step S51, the target area refers to the main area in the label image, and the background area refers to the area other than the target area in the label image. For example, if the label image is a portrait image, the target area in the label image can be the area occupied by the portrait, and the background area can be the area other than the area occupied by the portrait in the label image.

[0168] The electronic device can use an image segmentation algorithm to segment the target area and the background area in the label image to obtain an initial contour image used to represent the initial contour of the target area in the label image, and the initial contour image can be recorded as a mask. After the target area and the background area are segmented, the initial contour image can be obtained by setting the pixel values ​​of the target area and the background area to different values, labeling the pixel values ​​of the target area and the background area with different labels, etc.

[0169] To facilitate subsequent processing, the initial contour image can be obtained by setting the pixel values ​​of the target area and the background area to different values. Figure 6 The portrait image shown is taken as an example of a label image. Figure 6 The portrait area and background area of ​​the portrait image shown in the figure are segmented, and the values ​​of the pixels occupied by the portrait area after segmentation are set to 1, and the values ​​of the pixels occupied by the background area are set to 0. The initial contour image is as follows Figure 7 shown.

[0170] In the above step S52, the enlarged contour image is used to represent the enlarged contour obtained by enlarging the initial contour. The electronic device can obtain the enlarged contour image by filtering the initial contour image.

[0171] Continuing with the example in the above step S51, the electronic device can perform 3×3 filtering on the initial contour image. After filtering, there will be pixels with pixel values ​​between 0 and 1 in the initial contour image. Therefore, there are pixels with a pixel value of 1 (i.e., pixels occupied by the portrait area), pixels with a pixel value of 0 (i.e., pixels occupied by the background area), and pixels with pixel values ​​between 0 and 1 (i.e., pixels occupied by the expanded contour) in the initial contour after filtering. The pixel values ​​of the pixels with a pixel value of 0 in the initial contour image after filtering are also set to 1. Then, there are only pixels with a pixel value of 1 and pixels with a pixel value between 0 and 1 in the initial contour image after filtering. At this time, the pixel values ​​of the pixels with pixel values ​​other than 1 in the initial contour image after filtering are set to 0, and the obtained image is the expanded contour image, such as Figure 8 As shown in FIG. 1 , the area represented by the pixel points with a pixel value of 0 in the enlarged contour image is the enlarged contour. Here, the filtered initial contour image can be recorded as mask_filter, and the enlarged contour image can be recorded as mask_broder.

[0172] At the same time, the electronic device enlarges the target area in the label image to obtain an enlarged target area, and captures the enlarged target area as the enlarged label image. Here, the enlarged contour represented by the enlarged contour image is approximately the contour of the target area in the enlarged label image.

[0173] Continuing with the example in step S51 above, the electronic device Figure 6 The portrait in the portrait image shown is enlarged, for example, Figure 6 The original size of the portrait area in the image is 512×512, so it can be enlarged to 520×520; then, the image at the 512×512 position in the middle of the 520×520 is cut using the crop operation as the enlarged label image. The enlarged label image can be recorded as image_big.

[0174] In the above step S53, the first fusion area is an area in the label image that is complementary to the area where the enlarged contour image is located, that is, the first fusion area is the area in the label image except the area occupied by the enlarged contour; the second fusion area is an area in the enlarged label image that is complementary to the area where the enlarged contour is located, that is, the second fusion area is the area where the enlarged contour is located in the enlarged label image.

[0175] The electronic device may determine a sub-image of the first fusion area based on the enlarged contour image and the label image, and determine a sub-image of the second fusion area based on the enlarged contour image and the enlarged label image. For example, when there are only pixels with a pixel value of 0 and pixels with a pixel value of 1 in the enlarged contour image, and the area occupied by the pixels with a pixel value of 0 is the area occupied by the enlarged contour, the electronic device may determine a sub-image of the first fusion area by convolving the enlarged contour image with the label image, and obtain a sub-image of the second fusion area by convolving the enlarged contour image with the enlarged label image.

[0176] In the above step S54, the electronic device may fuse the sub-image of the first fusion area with the sub-image of the second fusion area to obtain a sample fusion path image.

[0177] Continuing with the example in the above step S51 and step S52, the electronic device can fuse the sub-image of the first fusion area and the sub-image of the second fusion area by using the following formula (18):

[0178] image_result=mask_broder×image_original+(1- mask_broder)×image_big (18)

[0179] Wherein, image_result represents the image obtained by fusing the sub-image of the first fusion area and the sub-image of the second fusion area; mask_broder is the enlarged contour image determined in the above step S52, and image_original represents the label image, that is, Figure 6 The portrait image shown in FIG. 1 and image_big represent the enlarged label image determined in the above step S52. Here, the image_result obtained is as follows: Fig. 9 shown.

[0180] See also Fig.10 , Fig.10 Another schematic diagram of a process for obtaining a sample fusion path image provided in an embodiment of the present application may include the following steps:

[0181] Step S101: Determine pixels in the area other than the target area in the label image as background pixels;

[0182] Step S102: reducing the pixel value of each background pixel point based on a first preset value, and determining the proportion of the pixel points whose pixel values ​​are less than the first threshold in the background pixel points after reduction as a brightness reference value;

[0183] Step S103: if the brightness reference value is less than the second threshold value, then the step of reducing the pixel value of each background pixel point based on the preset value is no longer performed, or the first preset value is adjusted, and the step of reducing the pixel value of each background pixel point based on the first preset value is repeatedly performed;

[0184] Step S104: if the brightness reference value is not less than the second threshold, the pixel values ​​of the pixel points whose pixel values ​​are less than the first threshold in the reduced background pixel points are adjusted to the second preset value.

[0185] In the technical solution provided by the embodiment of the present application, the pixel values ​​of the background pixels in the label image are reduced according to the first preset value to reduce the brightness of the background area in the label image, so that the adjusted label image has the characteristic of a darker background area of ​​the real fused road image. In the process of adjusting the pixel values ​​of the background pixels, a brightness reference value is determined. When the brightness reference value is not less than the second threshold value, the pixel values ​​of the background pixels are adjusted to avoid the values ​​of the adjusted background pixels being too small as much as possible.

[0186] In the above step S101, the electronic device may determine pixels in the area other than the target area in the label image as background pixels. For example, the electronic device may use an image segmentation algorithm to segment the target area and the background area in the label image to obtain background pixels.

[0187] In some examples, if the label image is first contour expanded, that is, the above Figure 5 The electronic device can determine the background pixel points according to the filtered mask image. For example, Figure 5 In the example shown, the initial contour image mask is determined, the area with a pixel value of 1 in the mask represents the area occupied by the portrait, and the area with a pixel value of 0 represents the area occupied by the background. After filtering the mask, pixels with pixel values ​​between 0 and 1 appear in the image. At this time, all pixels with non-0 pixel values ​​in the image are set to 1, and all pixels with a pixel value of 0 in the image are background pixels.

[0188] In the above step S102, the first preset value may be a value set according to actual conditions. The electronic device may reduce the value of each background pixel based on the pixel value of the first preset pixel, and determine the proportion of pixels whose pixel values ​​are less than the first threshold in the background pixels after reduction as a brightness reference value. The brightness reference value is used to indicate whether the current first preset value setting is appropriate. For example, if the brightness reference value is too small, it indicates that the proportion of pixels whose pixel values ​​are lower than the first threshold in the background pixels is high, and the current first preset value is set to be small.

[0189] In some embodiments, the first preset value may be set to 1 / 2 of the average value of each background pixel. After determining the first preset value, the first preset value may be subtracted from the value of each background pixel to obtain a new background pixel.

[0190] In an embodiment of the present application, the first threshold is a value set according to actual conditions. For example, the first threshold may be 0. After subtracting the first preset value from the value of each background pixel, it is obtained that there may be pixels with pixel values ​​less than 0 in the new background pixels. Therefore, the proportion of pixels with pixel values ​​less than 0 in the new background pixels can be counted as a brightness reference value.

[0191] In the above step S103, if the brightness reference value is less than the second threshold, the value of the background pixel can be reduced. Alternatively, the first preset value can be adjusted and the above step S102 can be performed again using the adjusted first preset value to make the brightness reference value greater than the second threshold.

[0192] In the above step S104, if the brightness reference value is greater than the second threshold, the pixel value of each background pixel can be reduced according to the first preset value, and the pixel value of the pixel point whose pixel value is less than the first threshold after reduction can be adjusted to the second preset value, such as setting the pixel value of the pixel point whose pixel value is less than 0 after reduction to 0.

[0193] The electronic device first expands the outline of the label image, and then adjusts the brightness of the background area of ​​the expanded label image (i.e., first perform Figure 5 Follow the steps shown in the figure and then execute Fig.10 For example, the label image after contour expansion is Fig. 9 , then Fig. 9 After adjusting the brightness value of the background area, the resulting image can be Fig.11 As shown, Fig.11 The middle gray area represents the background area after the brightness value is reduced.

[0194] Below, we take the label image as a high-quality portrait image as an example. Fig.12 The method of obtaining the sample visible road image and the sample fused road image provided by the present application is described. It can be understood that Fig.12 The processing order of obtaining the sample visible road image and the sample fused road image from the label image is only one possible processing order. In the actual processing process, the specific processing order can be set according to the actual situation and is not limited to this.

[0195] like Fig.12As shown, in the process of obtaining the sample visible road image (vis) from the label image (GT), the label image is first blurred (blur), and the specific processing steps can be found in (a)-(d) when determining the sample visible road image in the above content; then, noise is added to the label image (add noise), and the specific processing steps can be found in (e) when determining the sample visible road image in the above content. In the process of obtaining the sample fused road image (fus) from the label image, the processing order of the label image is color transformation (color transform), adding white edge (add white edge), and portrait extension (portraitextension), among which the specific steps of color transformation can be found in (a)-(d) when performing color transformation on the label image in the above content, and the specific steps of adding white edge can be found in the above content. Figure 4 For the detailed steps of portrait expansion, please refer to the above Figure 5 In some embodiments, background area brightness adjustment can also be considered as part of portrait extension. The specific steps of lowering the background area brightness can be found in the above Fig.10 Description in .

[0196] Corresponding to the above-mentioned black light image fusion model training method, the present application embodiment also provides a black light image fusion method, such as Fig.13 As shown, the following steps may be included:

[0197] Step S131: obtaining a visible road image to be synthesized and a fused road image to be synthesized;

[0198] In the embodiment of the present application, the visible road image to be synthesized can be understood as a visible road image taken by a blacklight camera, and the fused road image to be synthesized can be understood as a fused road image with a high signal-to-noise ratio but color cast that is output after the blacklight camera takes a visible road image and an infrared road image and processes the image using a traditional image fusion method.

[0199] Step S132: inputting the visible road image to be synthesized and the fused road image to be synthesized into the target blacklight image fusion model to obtain a target fused image output by the target blacklight image fusion model.

[0200] Among them, the target blacklight image fusion model is a blacklight image fusion model trained according to the above-mentioned blacklight image fusion model training method.

[0201] In the technical solution provided in the embodiment of the present application, the purpose of the above-mentioned training of the blacklight image fusion model is that when the visible road image and the fused road image are input into the blacklight image fusion model, the blacklight image fusion model can output a high-quality image, and the target blacklight image fusion model is obtained by training with the training method. Therefore, after the visible road image to be synthesized and the fused road image to be synthesized are input into the target blacklight image fusion model, a high-quality image, i.e., the target fused image, can be obtained.

[0202] In another embodiment provided in the present application, a computer-readable storage medium is also provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned black light image fusion model training methods are implemented.

[0203] In another embodiment provided in the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any black light image fusion model training method in the above-mentioned embodiments.

[0204] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a solid-state hard disk (SSD), etc.

[0205] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0206] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the black light image fusion method, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0207] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims

1. A black light image fusion model training method, characterized in that: The method comprises: Based on the defect features of each first dimension obtained by counting each real visible road image, the label image is adjusted to obtain a sample visible road image; and based on the defect features of each second dimension obtained by counting each real fused road image, the label image is adjusted to obtain a sample fused road image, wherein the features of the sample visible road image in each first dimension match the features of each real visible road image, and the features of the sample fused road image in each second dimension match the features of each real fused road image; the real fused road image is a fused road image with a high signal-to-noise ratio and color cast; Inputting the sample visible road image and the sample fused road image into an original blacklight image fusion model to obtain a predicted fused image output by the original blacklight image fusion model; Based on the difference between the predicted fusion image and the label image, the model parameters of the original blacklight image fusion model are adjusted to obtain a target blacklight image fusion model.

2. The method according to claim 1, characterized in that The original blacklight image fusion model includes a denoising sub-model and a prediction sub-model; the step of inputting the sample visible road image and the sample fused road image into the original blacklight image fusion model to obtain a predicted fused image output by the original blacklight image fusion model includes: Inputting the sample fused road image into the denoising sub-model to obtain a denoised fused road image; Inputting the denoised fused road image and the sample visible road image into the prediction sub-model to obtain a predicted fused image output by the prediction sub-model; Among them, the denoising sub-model is used to denoise the sample fused road image; the prediction sub-model is used to color the denoised fused road image and the sample visible road image, and process the color-adjusted images to obtain a predicted fused image.

3. The method according to claim 2, characterized in that The method further comprises: Inputting the sample visible road image into the filtering sub-model to obtain a denoised visible road image; Based on the difference between the visible road image after denoising and the label image, adjusting the model parameters of the filtering sub-model to obtain the denoising sub-model; The adjusting the model parameters of the original blacklight image fusion model to obtain the target blacklight image fusion model includes: The model parameters of the prediction sub-model in the original black light image fusion model are adjusted to obtain a target black light image fusion model.

4. The method according to claim 3, characterized in that The method further comprises, Based on the denoising sub-model, weighting the denoised fused road image and the sample fused road image according to corresponding weights to obtain a weighted fused road image; The step of inputting the denoised fused road image and the sample visible road image into the original black light image fusion model comprises: The weighted fused road image and the sample visible road image are input into the prediction sub-model to obtain a predicted fused image output by the prediction sub-model; wherein the weight corresponding to the denoised image in the original blacklight image fusion model is less than the weight corresponding to the denoised image in the target blacklight image fusion model.

5. The method according to claim 2, characterized in that: The method further comprises: Based on the denoising sub-model, obtaining the features of the sample fusion road image; The step of inputting the denoised fused road image and the sample visible road image into the prediction sub-model to obtain a predicted fused image output by the prediction sub-model includes: The features of the sample fused road image, the weighted fused road image, and the sample visible road image are input into the prediction sub-model to obtain the predicted fused image output by the prediction sub-model; the weighted fused road image is obtained by weighting the denoised fused road image and the sample fused road image according to corresponding weights.

6. The method according to claim 1, characterized in that The first dimension includes a blur dimension and / or a noise dimension. The defect characteristics of the blur dimension are used to represent the blur degree caused by various preset factors in each of the real visible road images; the defect characteristics of the noise dimension are used to represent the noise degree caused by various preset factors in each of the real visible road images.

7. The method according to claim 1, characterized in that The second dimension includes a color cast dimension and / or a white edge dimension and / or a contour dimension and / or a background dimension. The defect characteristics of the color cast dimension are used to indicate the degree of color cast caused by various factors in each of the real fusion road images; the defect characteristics of the white edge dimension are used to indicate the degree of white edge caused by various factors in each of the real fusion road images; the defect characteristics of the contour dimension are used to indicate the degree of contour magnification caused by various factors in each of the real fusion road images; the defect characteristics of the background dimension are used to indicate the degree of background darkening caused by various factors in each of the real fusion road images.

8. The method according to claim 1, characterized in that: The step of adjusting the label image to obtain a sample fusion path image includes: Segmenting the target area and the background area in the label image to obtain an initial contour image, wherein the initial contour image is used to represent the initial contour of the target area in the label image; Filtering the initial contour image to obtain an enlarged contour image, wherein the enlarged contour image is used to represent an enlarged contour obtained by enlarging the initial contour; and enlarging the target area in the label image to obtain an enlarged target area, and intercepting the enlarged target area as an enlarged label image; Based on the enlarged contour image and the label image, a sub-image of a first fusion area is determined in the label image, and based on the enlarged contour image and the enlarged label image, a sub-image of a second fusion area is determined in the enlarged label image, wherein the first fusion area is an area in the label image that is complementary to an area where the enlarged contour is located; and the second fusion area is an area in the enlarged label image where the enlarged contour is located; The sub-image of the first fusion area and the sub-image of the second fusion area are fused to obtain a sample fusion path image.

9. The method according to claim 1, characterized in that: Adjusting the label image to obtain a sample fusion path image includes: Determine pixels in an area other than the target area in the label image as background pixels; Based on the first preset value, the pixel value of each of the background pixels is reduced, and the proportion of the pixel points whose pixel value is less than the first threshold in the background pixels after the reduction is determined as the brightness reference value; If the brightness reference value is less than the second threshold value, the step of reducing the pixel value of each background pixel point based on the first preset value is no longer performed, or the first preset value is adjusted, and the step of reducing the pixel value of each background pixel point based on the first preset value is repeated; If the brightness reference value is not less than the second threshold, the pixel values ​​of the pixel points whose pixel values ​​are less than the first threshold among the reduced background pixel points are adjusted to the second preset value.

10. A black light image fusion method, characterized in that: The method comprises: Obtaining a visible road image to be synthesized and a fused road image to be synthesized; Inputting the visible road image to be synthesized and the fused road image to be synthesized into a target blacklight image fusion model to obtain a target fused image output by the target blacklight image fusion model; Wherein, the target black light image fusion model is trained according to any of the methods described in claims 1-9 above.