Model training method and apparatus, tone mapping method and apparatus, electronic device, computer storage medium, and computer program product
By iteratively training the diffusion model, the pre-configured parsing module and encoding module are used to analyze and encode the visual structural features of the tone image samples, which solves the difficulty of obtaining high-quality LDR images, achieves zero-time learning tone mapping, and reduces the need for HDR images. Dynamic tonal range requirements.
Patent Information
- Application Number
- CN202410808893.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-20
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-06-20
AI Technical Summary
Obtaining pairs of tone image samples (such as HDR images and high-quality LDR images) is difficult, posing a challenge to deep learning-based tone mapping methods.
By obtaining training data, including tonal image samples and multi-scale visual structure data, the diffusion model is determined, including a pre-training module, a pre-configured parsing module and an encoding module, iteratively trains network parameters, generates a tone mapping model, and uses the pre-configured parsing module to contextualize The feature map performs visual structural feature analysis and reconstruction, and the encoding module performs latent space encoding to achieve tone mapping.
It effectively represents potential features that are independent of the dynamic tone range, reduces the dynamic tone range requirements for tone image samples, and achieves zero-pass learning tone mapping, ensuring the tone mapping effect while reducing the dynamic tone range requirements for image samples.
Smart Images

Figure CN118735827A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of computer technology, and in particular, to a model training method and device, a tone mapping method and device, an electronic device, a computer storage medium, and a computer program product. Background Art
[0002] With the increasing applications of tonal images such as dynamic range imaging (DR) images, tone mapping technology, a technology used to convert high-tone images such as HDR images into low-tone images such as low dynamic range imaging (LDR) images for display, plays an increasingly important role in real-world visual systems. However, it is difficult to obtain paired tonal image samples (e.g., HDR image samples and high-quality LDR image samples), which poses a challenge to deep learning-based tone mapping methods. Summary of the invention
[0003] In view of this, embodiments of the present invention provide a model training method and device, a tone mapping method and device, an electronic device, a computer storage medium, and a computer program product to solve the above problems.
[0004] According to a first aspect of an embodiment of the present invention, a model training method is provided, comprising: acquiring training data, the training data comprising a tone image sample and multi-scale visual structure data of the tone image sample; determining a diffusion model, the diffusion model comprising a pre-training module, a pre-configured parsing module and an encoding module; taking the tone image sample as the main input and output of the diffusion model, taking the multi-scale visual structure data as the conditional input of the pre-configured parsing module, and iteratively training at least the network parameters of the encoding module to obtain a tone mapping model; wherein the pre-training module is used to generate a context feature map according to a random noise addition result of the tone image sample, the pre-configured parsing module is used to perform visual structure feature parsing on the context feature map and use the multi-scale visual structure data as a reconstruction condition to perform visual structure feature reconstruction on the parsing result to obtain a reconstructed feature map, and the encoding module is used to perform latent space encoding on the reconstructed feature map to obtain the tone image sample.
[0005] In another implementation of the present invention, at least the network parameters of the encoding module are iteratively trained, including: the pre-configured analysis module determines the visual structure features of the initial iteration as the shared visual structure features of each iteration; in each iterative training, the pre-configured analysis module performs visual structure feature analysis on the context feature map of that iteration to generate the hue features and visual structure features of that iteration; the pre-configured analysis module uses the multi-scale visual structure data as a reconstruction condition, fuses the hue features of that iteration with the shared visual structure features, and obtains a reconstructed feature map.
[0006] In another implementation of the present invention, the pre-training module includes a generation network and a control network, wherein at least the network parameters of the encoding module are iteratively trained, including: while iteratively training the network parameters of the encoding module, at least using the multi-scale visual structure data as a conditional input of the control network to fine-tune the control network.
[0007] In another implementation of the present invention, the training data also includes blurred brightness data of the tone image samples, wherein at least the multi-scale visual structure data is used as a conditional input of the control network to perform fine-tuning training on the control network, including: using the multi-scale visual structure data and the blurred brightness data as the first conditional input and the second conditional input of the control network respectively to perform fine-tuning training on the control network.
[0008] In another implementation of the present invention, the multi-scale visual structure data and the fuzzy brightness data are used as the first conditional input and the second conditional input of the control network respectively, and the control network is fine-tuned and trained, including: the visual structure feature is fed into the first coding layer in the control network as the first conditional input, and the fuzzy brightness data is fed into the second coding layer in the control network as the second conditional input, and the control network is fine-tuned and trained, wherein, in each coding layer of the control network, the first coding layer is located at the input side of the second coding layer.
[0009] In another implementation of the present invention, each decoding layer of the control network is fused to the corresponding decoding layer of the generation network.
[0010] According to a second aspect of an embodiment of the present invention, a tone mapping method is provided, comprising: obtaining a tone mapping model, the tone mapping model comprising a pre-training module, a pre-configured parsing module and an encoding module, the tone mapping model being trained according to the method described in the first aspect; performing visual structure processing on a high-tone image to obtain multi-scale visual structure data of the high-tone image; feeding at least the high-tone image into a main input of the tone mapping model, and feeding the multi-scale visual structure data into a conditional input of the pre-configured parsing module, and outputting a low-tone image from the tone mapping model.
[0011] In another implementation of the present invention, the method further includes: performing brightness processing on the high-key image to obtain blurred brightness data of the high-key image, wherein when a low-key image is output from the tone mapping model, the multi-scale visual structure data and the blurred brightness data are fed into a first conditional input and a second conditional input of a control network in the pre-trained module.
[0012] According to a third aspect of an embodiment of the present invention, a model training device is provided, comprising: an acquisition unit, which acquires training data, wherein the training data comprises a tone image sample and multi-scale visual structure data of the tone image sample; a determination unit, which determines a diffusion model, wherein the diffusion model comprises a pre-training module, a pre-configured parsing module and an encoding module; a training unit, which uses the tone image sample as the main input and output of the diffusion model, uses the multi-scale visual structure data as the conditional input of the pre-configured parsing module, and iteratively trains at least the network parameters of the encoding module to obtain a tone mapping model, wherein the pre-training module is used to generate a context feature map according to a random noise addition result of the tone image sample, the pre-configured parsing module is used to perform visual structure feature parsing on the context feature map and use the multi-scale visual structure data as a reconstruction condition to perform visual structure feature reconstruction on the parsing result to obtain a reconstructed feature map, and the encoding module is used to perform latent space encoding on the reconstructed feature map to obtain the tone image sample.
[0013] According to a fourth aspect of an embodiment of the present invention, a tone mapping device is provided, comprising: a model acquisition unit, which acquires a tone mapping model, wherein the tone mapping model comprises a pre-training module, a pre-configured parsing module and an encoding module, and the tone mapping model is obtained by training according to the method described in the first aspect; an image processing unit, which performs visual structure processing on a high-tone image to obtain multi-scale visual structure data of the high-tone image; and a tone mapping unit, which feeds at least the high-tone image into a main input of the tone mapping model, and feeds the multi-scale visual structure data into a conditional input of the pre-configured parsing module, and outputs a low-tone image from the tone mapping model.
[0014] According to a fifth aspect of an embodiment of the present invention, there is provided an electronic device, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; the memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute the method described in the first aspect.
[0015] According to a sixth aspect of an embodiment of the present invention, there is provided a computer storage medium on which a computer program is stored. When the program is executed by a processor, the method described in the first aspect is implemented.
[0016] According to a seventh aspect of an embodiment of the present invention, there is provided a computer program product, comprising computer instructions, which, when executed by a processor, implement the method as described in the first aspect.
[0017] In the scheme of the embodiment of the present invention, the visual structure feature can effectively characterize the potential features that are unrelated to the dynamic tone range. The pre-configured parsing module is used to perform visual structure feature parsing on the context feature map and use the multi-scale visual structure data as a reconstruction condition to reconstruct the visual structure features of the parsing result to obtain a reconstructed feature map. That is to say, the multi-scale visual structure data of the tone image sample can enable the pre-configured parsing module to reconstruct the parsing result of the visual structure feature, so that the network parameters of the encoding module can learn the potential representation of the visual structure feature. Therefore, while ensuring the tone mapping effect of the trained tone mapping model, the requirement for the dynamic tone range of the tone image sample is reduced, that is, zero-time learning tone mapping is achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present invention. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0019] Figure 1 The present invention is a flowchart of the steps of the model training method in some embodiments of the present invention.
[0020] Figure 2 Schematic diagram of the structure of the tone mapping model and the diffusion model of the embodiment of the present invention.
[0021] Figure 3 Schematic diagram of the structure of a pre-training module according to some embodiments of the present invention.
[0022] Figure 4 FIG. 4 is a flowchart of a tone mapping method according to another embodiment of the present invention.
[0023] Figure 5 It is a structural block diagram of a model training device according to some other embodiments of the present invention.
[0024] Figure 6 is a structural block diagram of a tone mapping device according to some other embodiments of the present invention.
[0025] Figure 7 Schematic diagram of the structure of electronic devices according to other embodiments of the present invention. DETAILED DESCRIPTION
[0026] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in the field based on the embodiments in the embodiments of the present invention should fall within the scope of protection of the embodiments of the present invention.
[0027] The specific implementation of the embodiment of the present invention is further described below in conjunction with the accompanying drawings of the embodiment of the present invention.
[0028] Tone mapping is a long-standing computer vision task that focuses on imaging HDR scenes by converting HDR images into high-quality LDR images. Unlike LDR images, HDR images usually have wider bit widths, resulting in greater diversity in pixel value distributions, and can capture more information, especially in extreme cases such as backlit scenes. Although the human eye can perceive both HDR and LDR scenes, conventional displays have difficulty accurately presenting the rich information in HDR images. Therefore, mapping HDR information to an LDR space that has both a natural appearance and accurate structure is a critical task for real-world visual systems.
[0029] The visual structural features of an image generally refer to features in the image other than brightness or color information, which describe the visual structural features of objects in the image, such as shape, texture, edge, and contour. For example, shape is the basic outline or boundary of an object in an image, which can be a simple geometric shape or a complex natural shape. For another example, texture is the pixel grayscale or color distribution pattern in a local area of an image, which describes the details and roughness of the object's surface. For another example, an edge is where the brightness or color changes significantly in an image, usually corresponding to the boundary or outline of an object. For another example, a contour is the outer boundary of an object in an image, which describes the overall shape and size of the object.
[0030] In the tone mapping task, it is particularly important to preserve the visual structural features of the image. The visual structural features ensure the preservation of the image structure details and features. The remaining "tone" refers to the distribution of light and dark values in the image, which characterizes the different values of brightness in different areas of the image.
[0031] Figure 1 This is a flowchart of the steps of the model training method of some embodiments of the present invention. The solution of this embodiment can be applied to any appropriate electronic device with data processing capabilities, including but not limited to: servers, mobile terminals (such as mobile phones, PADs, etc.) and PCs, etc. For example, in the model training stage, a computing device (for example, a data center) configured with a CPU (an example of a processing unit) + GPU (an example of an acceleration unit) architecture can be used to train the encoder-decoder model based on training samples. Computing devices such as data centers can be deployed in cloud servers such as proprietary clouds, private clouds, or hybrid clouds. Accordingly, in the inference stage, a computing device (for example, a terminal device or a cloud server) configured with a CPU (an example of a processing unit) + GPU (an example of an acceleration unit) architecture can also be used to perform inference operations. Specifically, Figure 1 The model training methods include:
[0032] S110: Acquire training data, where the training data includes tone image samples and multi-scale visual structure data of the tone image samples.
[0033] It should be understood that the tone image sample can be an LRD image sample, for example, a high-quality LRD image sample. The multi-scale visual structure data can be MSCN data after the tone image sample is subjected to mean subtraction and contrast normalization (Multiple Scale Contrast Normalization, MSCN) processing. In the MSCN processing, the structural information of the image is focused on by removing the brightness component of the image (i.e., mean subtraction processing). Generally speaking, brightness information is usually related to external factors such as the lighting conditions and exposure time of the image, while visual structure information reflects the inherent properties of objects in the image. MSCN data is conducive to extracting and analyzing the visual structure information of the image, thereby improving the accuracy and efficiency of image processing.
[0034] S120: Determine a diffusion model, where the diffusion model includes a pre-training module, a pre-configured parsing module, and an encoding module.
[0035] It should be understood that the diffusion model (DM) can be a generative diffusion model or other diffusion models. The diffusion model is a type of generative model, and its purpose is to learn to generate data given training data, so as to generate diversified outputs similar to the training data.
[0036] S130: Using the tone image sample as the main input and output of the diffusion model, using the multi-scale visual structure data as the conditional input of the pre-configured parsing module, and iteratively training at least the network parameters of the encoding module to obtain a tone mapping model, wherein the pre-training module is used to generate a context feature map based on the random noise addition result of the tone image sample, the pre-configured parsing module is used to perform visual structure feature parsing on the context feature map, and using the multi-scale visual structure data as the reconstruction condition, reconstructing the visual structure features of the parsing result to obtain a reconstructed feature map, and the encoding module is used to perform latent space encoding on the reconstructed feature map to obtain the tone image sample.
[0037] It should be understood that the diffusion model enables iteration of the diffusion process, starting with random noise and gradually refining it over multiple steps until an output image emerges. In each iteration, the expanded model estimates how to denoise the current input. Since only small changes are made in each iteration, any errors in the estimates from previous iterations can be corrected in updates from later iterations.
[0038] In the scheme of the embodiment of the present invention, the visual structure feature can effectively characterize the potential features that are unrelated to the dynamic tone range. The pre-configured parsing module is used to perform visual structure feature parsing on the context feature map and use the multi-scale visual structure data as a reconstruction condition to reconstruct the visual structure features of the parsing result to obtain a reconstructed feature map. That is to say, the multi-scale visual structure data of the tone image sample can enable the pre-configured parsing module to reconstruct the parsing result of the visual structure feature, so that the network parameters of the encoding module can learn the potential representation of the visual structure feature. Therefore, while ensuring the tone mapping effect of the trained tone mapping model, the requirement for the dynamic tone range of the tone image sample is reduced, that is, zero-time learning tone mapping is achieved.
[0039] In some specific examples, such as Figure 2As shown, the diffusion model 1000 includes a pre-training module 10, a pre-configured parsing module 20 and an encoding module 30. In the model training method, the diffusion model 1000 is iteratively trained for multiple times. The random noise addition result of the tone image sample can be used as the main input of the pre-training module 10, the output of the pre-training module 10 is connected to the input of the pre-configured parsing module 20, the output of the pre-configured parsing module 20 is connected to the input of the encoding module 30, and the output of the encoding module 30 is used as the output of the diffusion model 1000. The pre-training module 10 may include its own encoder and decoder. In other examples, the brightness processing unit 40 is used to process the tone image sample or the high tone image, and correspondingly obtains blurred brightness data such as low channel brightness data, and the visual structure processing unit 50 is used to process the tone image sample or the high tone image, and correspondingly obtains visual structure data such as MSCN data.
[0040] In some examples, the network parameters of the pre-training module 10 can be obtained by pre-training, and when the diffusion model 1000 is trained for multiple iterations, the pre-configured logic of the pre-configured parsing module 20 is maintained, and the network parameters of the encoding module 30 are adjusted.
[0041] It should be understood that the preconfigured logic of the preconfigured parsing module 20 includes a parsing logic 21 and a reconstruction logic 22. For example, the parsing logic may be referred to as Tone Structure Decomposition (TSD) and the reconstruction logic may be referred to as Tone Structure Reconstruction (TSR).
[0042] Specifically, the pre-configured parsing module performs visual structure feature analysis on the context feature map of each iteration to generate the tone feature and visual structure feature of that iteration. For example, in each iteration, the parsing logic performs visual structure feature analysis on the context feature map of that iteration to obtain the tone feature and visual structure feature of that iteration as the parsing result. In addition, the pre-configured parsing module determines the visual structure feature of the initial iteration as the shared visual structure feature of each iteration. Accordingly, the reconstruction logic is used to fuse the tone feature of that iteration with the shared visual structure feature using multi-scale visual structure data as the reconstruction condition to obtain a reconstructed feature map. Since the reverse sampling process of the diffusion model is modified and the visual structure feature is significantly integrated into the intermediate result of the extended model, the tone mapping effect of the tone mapping model is significantly guaranteed.
[0043] It should be understood that the parsing logic performs visual structural feature parsing on the context feature map of this iteration, and obtains the hue feature and visual structural feature of this iteration as the parsing result. For example, the hue feature of this iteration can be a local average feature map obtained by filtering the context feature map of this iteration using a linear filter kernel. In addition, the context feature map can also be filtered using a linear filter kernel to obtain a local annotation difference feature map, and the linear filter can be a Gaussian filter kernel. More specifically, the local average feature map and the local annotation difference feature map can be implemented using the following formulas 1 and 2, respectively:
[0044]
[0045]
[0046] Among them, I(x,y) represents the context feature map; x, y represent the pixel position of the context feature map; K is the size of the linear filter kernel, i, j represent the degree of offset of the linear filter kernel for the position (x, y); μ(i,j) represents the local average feature map of the context feature map filtered by the linear filter kernel (that is, the local average value corresponding to each pixel); σ(i,j) represents the local annotation difference feature map obtained by filtering the context feature map by the linear filter kernel (that is, the local annotation difference corresponding to each pixel); ω(x,y) represents the weight value of the linear filter kernel such as the Gaussian filter kernel at the position (x,y).
[0047] Furthermore, the visual structural features of this iteration, for example, can be characterized as the proportional relationship between the degree to which the pixel value of each pixel in the feature map deviates from the local average and the local annotation difference, so as to efficiently and accurately characterize the visual structural features in the feature map of the mountain context. More specifically, the visual structural features can be implemented using Formula 3:
[0048]
[0049] Right now, represents the visual structure feature; ε is an empirical value, for example, ε can be a constant.
[0050] It should also be understood that the reconstruction logic is used to use the multi-scale visual structure data as the reconstruction condition to fuse the hue features of this iteration with the shared visual structure features to obtain a reconstructed feature map. For example, the hue features of this iteration and the shared visual structure features can be weighted based on the noise variation parameter of the diffusion model to obtain a reconstructed feature map. More specifically, the reconstruction logic can be implemented using the following formula:
[0051]
[0052] Among them, I predRepresents the reconstructed feature map; Characterizing shared visual structural features, e.g., the visual structural features of the first iteration of the diffusion model; represents the visual structure features; μ represents the local average feature map obtained by filtering the context feature map using a linear filter kernel; σ represents the local annotation difference feature map obtained by filtering the context feature map using a linear filter kernel; γ represents the parameter of noise change (for example, increase) during the diffusion process of the diffusion model.
[0053] In other examples, when the diffusion model 1000 is iteratively trained for multiple times, the network parameters of the control network in the pre-training module 10 are fine-tuned. For example, the pre-training module 10 includes a generation network 11 and a control network 12. As an example of iteratively training at least the network parameters of the encoding module, the control network can be fine-tuned while the network parameters of the encoding module are iteratively trained, at least using multi-scale visual structure data as a conditional input of the control network. This example can also be referred to as fine-scale control, and multi-scale visual structure data such as MSCN can be used as a conditional input, for example, to the first encoding layer of the control network, and accordingly, intermediate results of different scales can be added to the feature map of the corresponding decoder layer of the generation branch to implicitly control the content of the generated feature map.
[0054] More specifically, the training data also includes blurred brightness data of the hue image samples. Exemplarily, blurred brightness data. The blurred brightness data can be obtained by processing a YUV color-coded image. In the YUV color coding system, "Y" represents brightness, and "U" and "V" represent chrominance, which is used to describe the color and saturation of the image. For example, the blurred brightness data can be obtained by blurring the Y channel (brightness map) of the hue image sample encoded by YUV color through a Gaussian filter. During training and inference, the brightness guidance is a low-pass brightness map. The network parameters use the information contained in the MSCN data to generate fine-scale textures, and generate coarser-scale content by utilizing the blurred brightness map as a low-pass brightness map.
[0055] Specifically, as an example of fine-tuning the control network using at least the multi-scale visual structure data as the conditional input of the control network, the control network can be fine-tuned using the multi-scale visual structure data and the fuzzy brightness data as the first conditional input and the second conditional input of the control network, respectively. Figure 3As shown, each decoding layer of the control network 12 is fused to the corresponding decoding layer of the generation network 11. In some examples, each decoding layer of the control network 12 can be a zero convolution layer. In addition, in each encoding layer of the control network, the first encoding layer is located at the input side of the second encoding layer, the first encoding layer is used to receive the first conditional input, and the second encoding layer is used to receive the second conditional input.
[0056] That is, as an example of fine-tuning the control network, the visual structure feature can be fed into the first encoding layer in the control network as the first conditional input, and the blurred brightness data can be fed into the second encoding layer in the control network as the second conditional input to fine-tune the control network.
[0057] This example can also be called coarse scale control. Multi-scale visual structure data such as MSCN significantly eliminates brightness information, and brightness may also be distorted. For example, the relative brightness intensity between different parts of the image may be incorrect, resulting in an unnatural appearance. Therefore, another conditional input containing brightness information is needed.
[0058] The following will be combined Figure 4 To describe a tone mapping method according to another embodiment of the present invention. Specifically, Figure 4 The tone mapping methods include:
[0059] S410: Acquire a tone mapping model, where the tone mapping model includes a pre-training module, a pre-configured parsing module, and an encoding module.
[0060] It should be understood that the tone mapping model is trained by the above-mentioned model training method.
[0061] S420: Perform visual structure processing on the high-key image to obtain multi-scale visual structure data of the high-key image.
[0062] It should be understood that the multi-scale visual structure data can be MSCN data after the high-tone image samples are subjected to mean subtraction and contrast normalization (MSCN) processing. In the MSCN processing, the brightness component of the image is removed (i.e., mean subtraction processing) so that the structural information of the image can be focused on. Generally speaking, brightness information is usually related to external factors such as the lighting conditions and exposure time of the image, while visual structure information reflects the inherent properties of objects in the image. MSCN data is conducive to extracting and analyzing the visual structure information of the image, thereby improving the accuracy and efficiency of image processing.
[0063] S430: Feed at least the high-tone image into a main input of a tone mapping model, and feed the multi-scale visual structure data into a conditional input of a pre-configured parsing module, and output a low-tone image from the tone mapping model.
[0064] It should be understood that an example of a high-key image is an HDR image, and an example of a low-key image is an LDR image.
[0065] In the scheme of the embodiment of the present invention, the visual structure feature can effectively characterize the potential features that are unrelated to the dynamic tone range. The pre-configured parsing module is used to perform visual structure feature parsing on the context feature map and use the multi-scale visual structure data as a reconstruction condition to reconstruct the visual structure feature of the parsing result to obtain a reconstructed feature map. That is, the multi-scale visual structure data of the tone image sample can enable the pre-configured parsing module to reconstruct the parsing result of the visual structure feature, so that the network parameters of the encoding module can learn the potential representation of the visual structure feature. Therefore, while ensuring the tone mapping effect of the trained tone mapping model, the requirements for the dynamic tone range of the tone image sample are reduced. Therefore, the tone mapping model can perform tone mapping on a high-tone image to obtain a low-tone image.
[0066] In some examples, the diffusion model 1000 includes a pre-training module 10, a pre-configured parsing module 20, and an encoding module 30. In the model training method, the diffusion model 1000 is trained for multiple iterations. The random noise addition result of the tone image sample can be used as the main input of the pre-training module 10, the output of the pre-training module 10 is connected to the input of the pre-configured parsing module 20, the output of the pre-configured parsing module 20 is connected to the input of the encoding module 30, and the output of the encoding module 30 is used as the output of the diffusion model 1000. It should be understood that the pre-configured logic of the pre-configured parsing module 20 includes a parsing logic 21 and a reconstruction logic 22. Accordingly, in the inference process of the tone mapping model, the multi-scale visual structure data is fed into the conditional input of the reconstruction logic 22.
[0067] In other examples, the high-key image is subjected to brightness processing to obtain blurred brightness data of the high-key image. The blurred brightness data of the high-key image can be obtained by blurring the Y channel (brightness map) of the YUV color-coded high-key image through a Gaussian filter. When the diffusion model 1000 is iteratively trained for multiple times, the network parameters of the control network in the pre-training module 10 are fine-tuned. For example, the pre-training module 10 includes a generation network 11 and a control network 12. While the network parameters of the encoding module are iteratively trained, the control network can be fine-tuned using at least the multi-scale visual structure data as a conditional input of the control network. Accordingly, in the inference process of the tone mapping model, when the low-key image is output from the tone mapping model, the multi-scale visual structure data and the blurred brightness data are fed into the first conditional input and the second conditional input of the control network in the pre-training module.
[0068] The following will be combined Figure 5 Describe the model training device of other embodiments of the present invention. The scheme of this embodiment can be applied to any appropriate electronic device with data processing capabilities, including but not limited to: servers, mobile terminals (such as mobile phones, PADs, etc.) and PCs, etc. For example, in the model training stage, a computing device (for example, a data center) configured with a CPU (an example of a processing unit) + GPU (an example of an acceleration unit) architecture can be used to train the encoder-decoder model based on training samples. Computing devices such as data centers can be deployed in cloud servers such as proprietary clouds, private clouds, or hybrid clouds. Accordingly, in the inference stage, a computing device (for example, a terminal device or a cloud server) configured with a CPU (an example of a processing unit) + GPU (an example of an acceleration unit) architecture can also be used to perform inference operations. Specifically, Figure 5 The model training device includes:
[0069] The acquiring unit 510 acquires training data, where the training data includes tone image samples and multi-scale visual structure data of the tone image samples.
[0070] The determination unit 520 determines a diffusion model, where the diffusion model includes a pre-training module, a pre-configured parsing module, and an encoding module.
[0071] The training unit 530 uses the tone image sample as the main input and output of the diffusion model, uses the multi-scale visual structure data as the conditional input of the pre-configured parsing module, and iteratively trains at least the network parameters of the encoding module to obtain a tone mapping model, wherein the pre-training module is used to generate a context feature map based on the random noise result of the tone image sample, the pre-configured parsing module is used to perform visual structure feature parsing on the context feature map and use the multi-scale visual structure data as a reconstruction condition to reconstruct the visual structure features of the parsing result to obtain a reconstructed feature map, and the encoding module is used to perform latent space encoding on the reconstructed feature map to obtain the tone image sample.
[0072] In the scheme of the embodiment of the present invention, the visual structure feature can effectively characterize the potential features that are unrelated to the dynamic tone range. The pre-configured parsing module is used to perform visual structure feature parsing on the context feature map and use the multi-scale visual structure data as a reconstruction condition to reconstruct the visual structure features of the parsing result to obtain a reconstructed feature map. That is to say, the multi-scale visual structure data of the tone image sample can enable the pre-configured parsing module to reconstruct the parsing result of the visual structure feature, so that the network parameters of the encoding module can learn the potential representation of the visual structure feature. Therefore, while ensuring the tone mapping effect of the trained tone mapping model, the requirement for the dynamic tone range of the tone image sample is reduced, that is, zero-time learning tone mapping is achieved.
[0073] In some other embodiments, the training unit is specifically used for: the pre-configured analysis module determines the visual structure features of the initial iteration as the shared visual structure features of each iteration; in each iteration training, the pre-configured analysis module performs visual structure feature analysis on the context feature map of that iteration to generate the hue features and visual structure features of that iteration; the pre-configured analysis module uses the multi-scale visual structure data as a reconstruction condition to fuse the hue features of that iteration with the shared visual structure features to obtain a reconstructed feature map.
[0074] In some other embodiments, the pre-training module includes a generating network and a controlling network. The training unit is specifically used to: while iteratively training the network parameters of the encoding module, at least use the multi-scale visual structure data as a conditional input of the controlling network to perform fine-tuning training on the controlling network.
[0075] In some other embodiments, the training data also includes blurred brightness data of the tone image sample. The training unit is specifically used to: use the multi-scale visual structure data and the blurred brightness data as the first condition input and the second condition input of the control network respectively, and perform fine-tuning training on the control network.
[0076] In some other embodiments, the training unit is specifically used to: feed the visual structure feature as a first conditional input into a first coding layer in the control network, and feed the blurred brightness data as a second conditional input into a second coding layer in the control network, to fine-tune the control network, wherein, in each coding layer of the control network, the first coding layer is located at the input side of the second coding layer.
[0077] In other embodiments, each decoding layer of the control network is fused to a corresponding decoding layer of the generation network.
[0078] The following will be combined Figure 6 The structural block diagram of the tone mapping device of some other embodiments of the present invention is described. Specifically, Figure 6 The tone mapping device includes:
[0079] A model acquisition unit 610 acquires a tone mapping model, wherein the tone mapping model includes a pre-training module, a pre-configured parsing module, and an encoding module;
[0080] The image processing unit 620 performs visual structure processing on the high-key image to obtain multi-scale visual structure data of the high-key image;
[0081] The tone mapping unit 630 feeds at least the high-tone image into a main input of a tone mapping model, and feeds the multi-scale visual structure data into a conditional input of the pre-configured parsing module, and outputs a low-tone image from the tone mapping model.
[0082] In the scheme of the embodiment of the present invention, the visual structure feature can effectively characterize the potential features that are unrelated to the dynamic tone range. The pre-configured parsing module is used to perform visual structure feature parsing on the context feature map and use the multi-scale visual structure data as a reconstruction condition to reconstruct the visual structure feature of the parsing result to obtain a reconstructed feature map. That is, the multi-scale visual structure data of the tone image sample can enable the pre-configured parsing module to reconstruct the parsing result of the visual structure feature, so that the network parameters of the encoding module can learn the potential representation of the visual structure feature. Therefore, while ensuring the tone mapping effect of the trained tone mapping model, the requirements for the dynamic tone range of the tone image sample are reduced. Therefore, the tone mapping model can perform tone mapping on a high-tone image to obtain a low-tone image.
[0083] In some other embodiments, an example of the image processing unit 620 is Figure 2The visual structure processing unit 50 and the brightness processing unit 40. The image processing unit 620 (i.e., the brightness processing unit 40) is specifically used to: perform brightness processing on the high-key image to obtain blurred brightness data of the high-key image. The tone mapping unit 630 is specifically used to: when outputting a low-key image from the tone mapping model, feed the multi-scale visual structure data and the blurred brightness data into the first conditional input and the second conditional input of the control network in the pre-trained module.
[0084] The specific implementation of each module in the device for implementing the above-mentioned methods can refer to the corresponding description of the corresponding steps in the above-mentioned method embodiments, and has corresponding beneficial effects, which will not be repeated here. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the device and module for implementing the above-mentioned methods can refer to the corresponding process description in the above-mentioned method embodiments, which will not be repeated here.
[0085] Reference Figure 7 , shows a schematic structural diagram of an electronic device according to another embodiment of the present invention. The specific embodiment of the present invention does not limit the specific implementation of the electronic device.
[0086] like Figure 7 As shown, the electronic device may include: a processor (processor) 702 for executing a program 710 , a communication interface (Communications Interface) 704 , a memory (memory) 706 , and a communication bus 708 .
[0087] The processor, the communication interface, and the memory communicate with each other via a communication bus.
[0088] Communication interface, used to communicate with other electronic devices or servers.
[0089] The processor is used to execute the program, and specifically can execute the relevant steps in the above method embodiment.
[0090] Specifically, the program may include program codes including computer operation instructions.
[0091] The processor may be a CPU, or an application specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present invention. The one or more processors included in the smart device may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.
[0092] The memory is used to store programs. The memory may include a high-speed RAM memory, and may also include a non-volatile memory, such as at least one disk memory.
[0093] The program may include multiple computer instructions. Specifically, the program may enable the processor to execute the model training method or tone mapping method described in any of the aforementioned method embodiments through multiple computer instructions.
[0094] The specific implementation of each step in the program can refer to the corresponding description of the corresponding steps, modules or units in the above method embodiments, and has corresponding beneficial effects, which will not be repeated here. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described device, equipment or module can refer to the corresponding process description in the above method embodiments, which will not be repeated here.
[0095] The embodiment of the present invention further provides a computer storage medium on which a computer program is stored, and when the program is executed by a processor, the method described in any of the above-mentioned multiple method embodiments is implemented. The computer storage medium includes, but is not limited to: a compact disc read-only memory (CD-ROM), a random access memory (RAM), a floppy disk, a hard disk or a magneto-optical disk, etc.
[0096] An embodiment of the present invention also provides a computer program product, including computer instructions, which instruct a computing device to execute the model training method or tone mapping method in the above-mentioned multiple method embodiments.
[0097] In addition, it should be noted that the user-related information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to sample data used to train the model, data used for analysis, stored data, displayed data, etc.) involved in the embodiments of the present invention are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with relevant regulations and standards, and corresponding operation entrances are provided for users to choose to authorize or refuse.
[0098] It should be pointed out that, according to the needs of implementation, the various components / steps described in the embodiments of the present invention can be split into more components / steps, or two or more components / steps or partial operations of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of the present invention.
[0099] The above-mentioned method according to the embodiment of the present invention can be implemented in hardware, firmware, or implemented as software or computer code that can be stored in a recording medium (such as a CD-ROM, RAM, floppy disk, hard disk or magneto-optical disk), or implemented as a computer code originally stored in a remote recording medium or a non-temporary machine-readable medium downloaded through a network and to be stored in a local recording medium, so that the method described herein can be stored in such software processing on a recording medium using a general-purpose computer, a dedicated processor or programmable or dedicated hardware (such as an application-specific integrated circuit (ASIC) or a field programmable gate array (FPGA)). It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component (e.g., a random access memory (RAM), a read-only memory (ROM), a flash memory, etc.) that can store or receive software or computer code, and when the software or computer code is accessed and executed by a computer, a processor or hardware, the method described herein is implemented. In addition, when a general-purpose computer accesses the code for implementing the method shown here, the execution of the code converts the general-purpose computer into a dedicated computer for executing the method shown here.
[0100] Those of ordinary skill in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present invention.
[0101] The above implementation methods are only used to illustrate the embodiments of the present invention, and are not limitations of the embodiments of the present invention. Ordinary technicians in the relevant technical field may make various changes and modifications without departing from the spirit and scope of the embodiments of the present invention. Therefore, all equivalent technical solutions also belong to the scope of the embodiments of the present invention. The patent protection scope of the embodiments of the present invention should be defined by the claims.
Claims
1. A model training method, comprising: Acquire training data, wherein the training data includes tone image samples and multi-scale visual structure data of the tone image samples; Determining a diffusion model, wherein the diffusion model includes a pre-training module, a pre-configured parsing module, and an encoding module; Using the tone image sample as the main input and output of the diffusion model, using the multi-scale visual structure data as the conditional input of the pre-configured parsing module, iteratively training at least the network parameters of the encoding module, and obtaining a tone mapping model; Among them, the pre-training module is used to generate a context feature map according to the random noise addition result of the hue image sample, the pre-configured parsing module is used to perform visual structure feature analysis on the context feature map and use the multi-scale visual structure data as a reconstruction condition to reconstruct the visual structure feature of the parsing result to obtain a reconstructed feature map, and the encoding module is used to perform latent space encoding on the reconstructed feature map to obtain the hue image sample.
2. The method according to claim 1, wherein: At least the network parameters of the encoding module are iteratively trained, including: The pre-configured parsing module determines the visual structure features of the first iteration as the shared visual structure features of each iteration; In each iteration training, the pre-configured parsing module performs visual structure feature parsing on the context feature map of the iteration to generate the hue feature and visual structure feature of the iteration; The pre-configured parsing module uses the multi-scale visual structure data as a reconstruction condition, fuses the hue feature of this iteration with the shared visual structure feature, and obtains a reconstructed feature map.
3. The method according to claim 1, wherein: The pre-training module includes a generation network and a control network, wherein at least the network parameters of the encoding module are iteratively trained, including: While iteratively training the network parameters of the encoding module, at least the multi-scale visual structure data is used as a conditional input of the control network to perform fine-tuning training on the control network.
4. The method according to claim 3, wherein: The training data also includes blurred brightness data of the tone image sample, wherein at least the multi-scale visual structure data is used as a conditional input of the control network, and fine-tuning the control network includes: The multi-scale visual structure data and the fuzzy brightness data are used as the first condition input and the second condition input of the control network respectively, and the control network is fine-tuned and trained.
5. The method according to claim 4, wherein: Using the multi-scale visual structure data and the fuzzy brightness data as the first condition input and the second condition input of the control network respectively, fine-tuning the control network includes: The visual structure feature is fed as a first conditional input to a first encoding layer in the control network, and the blurred brightness data is fed as a second conditional input to a second encoding layer in the control network, and the control network is fine-tuned and trained, wherein, in each encoding layer of the control network, the first encoding layer is located at the input side of the second encoding layer.
6. The method according to claim 4, wherein: Each decoding layer of the control network is fused to the corresponding decoding layer of the generation network.
7. A tone mapping method, comprising: Acquire a tone mapping model, wherein the tone mapping model comprises a pre-training module, a pre-configured parsing module and an encoding module, and the tone mapping model is obtained by training according to any one of claims 1 to 6; Performing visual structure processing on the high-key image to obtain multi-scale visual structure data of the high-key image; At least the high-key image is fed into a main input of a tone mapping model, and the multi-scale visual structure data is fed into a conditional input of the pre-configured parsing module, from which a low-key image is output.
8. The method according to claim 7, wherein: The method further comprises: Performing brightness processing on the high-key image to obtain blurred brightness data of the high-key image, wherein: When a low-key image is output from the tone mapping model, the multi-scale visual structure data and the blurred brightness data are fed into a first conditional input and a second conditional input of a control network in the pre-trained module.
9. A model training device, comprising: An acquisition unit, which acquires training data, wherein the training data includes a tone image sample and multi-scale visual structure data of the tone image sample; A determination unit, which determines a diffusion model, wherein the diffusion model includes a pre-training module, a pre-configured parsing module, and an encoding module; A training unit, using the tone image sample as the main input and output of the diffusion model, using the multi-scale visual structure data as the conditional input of the pre-configured parsing module, iteratively training at least the network parameters of the encoding module to obtain a tone mapping model, wherein the pre-training module is used to generate a context feature map according to the random noise result of the tone image sample, the pre-configured parsing module is used to perform visual structure feature parsing on the context feature map and use the multi-scale visual structure data as the reconstruction condition to reconstruct the visual structure feature of the parsing result to obtain a reconstructed feature map, and the encoding module is used to perform latent space encoding on the reconstructed feature map to obtain the tone image sample.
10. A tone mapping device, comprising: A model acquisition unit, which acquires a tone mapping model, wherein the tone mapping model includes a pre-training module, a pre-configured parsing module and an encoding module, and the tone mapping model is obtained by training according to any one of claims 1 to 6; An image processing unit performs visual structure processing on the high-key image to obtain multi-scale visual structure data of the high-key image; A tone mapping unit feeds at least the high-tone image into a main input of a tone mapping model, and feeds the multi-scale visual structure data into a conditional input of the pre-configured parsing module, and outputs a low-tone image from the tone mapping model.
11. An electronic device, comprising: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute the method according to any one of claims 1-8.
12. A computer storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the method according to any one of claims 1 to 8.
13. A computer program product, comprising computer instructions, which implement the method according to any one of claims 1 to 8 when executed by a processor.
Citation Information
Patent Citations
Inverse tone mapping method based on image content
CN109544463A
Image processing model training method and high dynamic range image generation method
CN116157825A
HDR video reconstruction by converted tone mapping
EP4277281A1
Method and apparatus for inverse tone mapping
US20210166360A1
