Training method and device of image enhancement model, electronic equipment and storage medium
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 艾索信息股份有限公司
- Filing Date
- 2026-05-14
- Publication Date
- 2026-08-04
AI Technical Summary
[0004]但是,现有的无监督算法对于低照度训练数据的依赖性较强,且无法实现针对性目标的有效增强,导致图像增强效果不佳
本申请提供一种图像增强模型的训练方法、装置、电子设备及存储介质,包括:采集初始图像数据集,初始图像数据集包含多个正常照度样本图像;根据初始图像数据集中的各正常照度样本图像,生成各正常照度样本图像对应的低照度样本图像,并根据各正常照度样本图像以及各正常照度样本图像对应的低照度样本图像,生成第一训练数据集;根据各正常照度样本图像中的目标对象,进行图像掩膜提取,得到各正常照度样本图像对应的目标掩膜信息;根据第一训练数据集以及各正常照度样本图像对应的目标掩膜信息,训练得到图像增强模型;根据第一训练数据集以及各正常照度样本图像对应的目标掩膜信息,训练得到图像增强模型。本方法通过构建包含正常照度样本图像与其对应合成的低照度样本图像的训练数据集,并结合图像的掩膜信息进行联合训练,使得所训练的图像增强模型能够有针对性地提升低照度图像中关键目标区域的可见性与细节清晰度,避免了传统方法中因全局增强而导致的噪声放大、背景失真等问题。同时,采用基于正常照度样本图像生成低照度样本图像的方式,解决了实际场景中难以获取精确配对训练样本的技术瓶颈,显著提升了模型训练效率与泛化性能。
Smart Images

Figure CN122510097A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and more specifically, to a training method, apparatus, electronic device, and storage medium for an image enhancement model. Background Technology
[0002] In the field of computer vision, low-light image enhancement is an important research topic, widely used in security monitoring, autonomous driving, drone aerial photography, and other scenarios. Due to insufficient lighting conditions, low-light images often suffer from problems such as high noise, low contrast, and loss of detail, which seriously affect subsequent tasks, such as target detection.
[0003] Currently, a low-light image enhancement method based on unsupervised algorithms has been implemented.
[0004] However, existing unsupervised algorithms are highly dependent on low-light training data and cannot effectively enhance specific targets, resulting in poor image enhancement effects. Summary of the Invention
[0005] The purpose of this application is to address the shortcomings of the prior art by providing a training method, apparatus, electronic device, and storage medium for an image enhancement model, so as to solve the technical bottleneck of difficulty in obtaining accurately paired training samples in real-world scenarios, improve model training efficiency and generalization performance, and enhance the model's enhancement effect on low-light images.
[0006] To achieve the above objectives, the technical solutions adopted in the embodiments of this application are as follows: In a first aspect, embodiments of this application provide a method for training an image enhancement model, comprising: An initial image dataset is collected, which contains multiple normal illumination sample images, including images taken under normal lighting conditions that do not contain target objects and images that contain different types of target objects; Based on each normal illumination sample image in the initial image dataset, generate low illumination sample images corresponding to each normal illumination sample image, and generate a first training dataset based on each normal illumination sample image and the low illumination sample images corresponding to each normal illumination sample image. Based on the target objects in each normal illumination sample image, image mask extraction is performed to obtain the target mask information corresponding to each normal illumination sample image; An image enhancement model is trained based on the first training dataset and the target mask information corresponding to each normal illumination sample image.
[0007] Optionally, generating low-light sample images corresponding to each normal-light sample image from the initial image dataset includes: The image brightness of each normal illumination sample image is adjusted to obtain the low illumination sample image corresponding to each normal illumination sample image.
[0008] Optionally, the step of extracting image masks based on the target objects in each normal illumination sample image to obtain target mask information corresponding to each normal illumination sample image includes: An edge detection algorithm is used to identify and obtain the edge information of the target object from each normal illumination sample image; Based on the edge information of the target object in each normal illumination sample image, determine the first mask region corresponding to the target object and the second mask region corresponding to the non-target object in each normal illumination sample image; Based on the first mask region and the second mask region corresponding to each normal illumination sample image, the target mask information corresponding to each normal illumination sample image is generated.
[0009] Optionally, training the image enhancement model based on the first training dataset and the target mask information corresponding to each normal illumination sample image includes: The first training dataset is input into the initial image enhancement model, and the initial image enhancement model performs image enhancement processing on the low-light sample images corresponding to each normal illumination sample image to obtain the enhanced image corresponding to each low-light sample image. Based on the enhanced image corresponding to each low-light sample image, the target mask information corresponding to each normal-light sample image, and the target brightness enhancement information, the brightness of each enhanced image is enhanced to obtain the actual brightness enhancement image corresponding to each enhanced image. Based on the enhanced image corresponding to each low-light sample image and the normal-light sample image corresponding to each low-light sample image, the first loss information of the initial image enhancement model is determined; Based on the actual brightness enhancement image corresponding to each enhanced image and the target brightness enhancement information, the second loss information of the initial image enhancement model is determined; Based on the first loss information and the second loss information of the initial image enhancement model, the target loss information of the initial image enhancement model is determined, and the initial image enhancement model is iteratively optimized based on the target loss information until the target loss information meets the preset conditions. Then, training stops, and the image enhancement model at the time of training stop is taken as the image enhancement model.
[0010] Optionally, the step of enhancing the brightness of each enhanced image based on the enhanced image corresponding to each low-light sample image, the target mask information corresponding to each normal-light sample image, and the target brightness enhancement information, to obtain the actual brightness enhancement image corresponding to each enhanced image, includes: Each enhanced image is divided into multiple sub-feature maps corresponding to each enhanced image. Based on the target mask information corresponding to each normal illumination sample image, determine the target mask information corresponding to each enhanced image; Based on the target mask information corresponding to each enhanced image, the type of each sub-feature map corresponding to each enhanced image is determined, and the type is used to indicate whether the sub-feature map is a target sub-feature map or a background sub-feature map; Based on the type of each sub-feature map corresponding to each enhanced image, the comparison result of the average brightness of the target object and the average brightness of the background in the normal illumination sample image corresponding to each enhanced image, and the target brightness enhancement information, brightness enhancement processing is performed on each sub-feature map corresponding to each enhanced image to obtain the actual brightness enhancement image corresponding to each enhanced image; wherein, the target brightness enhancement information includes: different brightness thresholds.
[0011] Optionally, determining the type of each sub-feature map corresponding to each enhanced image based on the target mask information corresponding to each enhanced image includes: Based on the target mask information corresponding to the enhanced image, determine the number of pixels belonging to the target object in the sub-feature map corresponding to the enhanced image; If the number of pixels belonging to the target object in the sub-feature map is greater than or equal to a preset number, then the type of the sub-feature map is determined to be a target sub-feature map; If the number of pixels belonging to the target object in the sub-feature map is less than the preset number, then the type of the sub-feature map is determined to be a background sub-feature map.
[0012] Optionally, the step of performing brightness enhancement processing on each sub-feature map corresponding to each enhanced image based on the type of each sub-feature map corresponding to each enhanced image, the comparison result of the average brightness of the target object and the average brightness of the background in the normal illumination sample image corresponding to each enhanced image, and the target brightness enhancement information, to obtain the actual brightness enhancement image corresponding to each enhanced image, includes: Based on the target mask information of the normal illumination sample image corresponding to the enhanced image, the average brightness of each pixel constituting the target object and the average brightness of each pixel constituting the background in the normal illumination sample image are determined. The average brightness of each pixel constituting the target object is taken as the average brightness of the target object in the normal illumination sample image corresponding to the enhanced image, and the average brightness of each pixel constituting the background is taken as the average brightness of the background in the normal illumination sample image corresponding to the enhanced image. For each first sub-feature map of type target sub-feature map in the enhanced image, if the average brightness of the target object in the normal illumination sample image corresponding to the enhanced image is greater than or equal to the average brightness of the background, then according to the first brightness threshold, the average brightness enhancement processing is performed on each first feature map to obtain the actual brightness enhancement image of each first sub-feature map. If the average brightness of the target object in the normal illumination sample image corresponding to the enhanced image is less than the average brightness of the background, then according to the second brightness threshold, the average brightness enhancement processing is performed on each first sub-feature map to obtain the actual brightness enhancement image of each first sub-feature map. For each second sub-feature map of type background in the enhanced image, the average brightness enhancement processing is performed on each second sub-feature map according to the third brightness threshold to obtain the actual brightness enhancement image of each second sub-feature map. Based on the actual brightness enhancement images of each first sub-feature map and each second sub-feature map, the actual brightness enhancement image corresponding to the enhanced image is obtained.
[0013] Optionally, determining the second loss information of the initial image enhancement model based on the actual brightness-enhanced image corresponding to each enhanced image and the target brightness enhancement information includes: Based on the actual brightness enhancement images of each first sub-feature image and each second sub-feature image, determine the actual brightness value of each first sub-feature image and the actual brightness value of each second sub-feature image respectively. The first brightness loss is determined based on the actual brightness value of each first sub-feature map and the brightness threshold corresponding to the target sub-feature map; the brightness threshold corresponding to the target sub-feature map is either the first brightness threshold or the second brightness threshold. The second brightness loss is determined based on the actual brightness value of each second sub-feature map and the brightness threshold corresponding to the background sub-feature map; the brightness threshold corresponding to the background sub-feature map is the third brightness threshold. The second loss information is obtained based on the first brightness loss and the second brightness loss.
[0014] Optionally, determining the first loss information of the initial image enhancement model based on the enhanced image corresponding to each low-light sample image and the normal-light sample image corresponding to each low-light sample image includes: The enhanced images corresponding to each low-light sample image and the normal-light sample images corresponding to each low-light sample image are input into a pre-trained classification network, which identifies and extracts the feature information of each enhanced image and the feature information of each normal-light sample image. Based on the feature information of each enhanced image and the feature information of the normal illumination sample image corresponding to each enhanced image, the image similarity between each enhanced image and the corresponding normal illumination sample image is determined. The first loss information is determined based on the image similarity between each enhanced image and the corresponding normal illumination sample image.
[0015] Optionally, the initial image dataset acquired includes: Collect initial normal illumination sample images taken under normal lighting conditions; Color channel conversion is performed on each initial normal illumination sample image to obtain the sample grayscale image corresponding to each initial normal illumination sample image; The grayscale images of each sample are normalized to obtain the normal illumination sample images.
[0016] Secondly, embodiments of this application also provide a training apparatus for an image enhancement model, including: an acquisition module, a generation module, a processing module, and a training module; The acquisition module is used to acquire an initial image dataset, which includes multiple normal illumination sample images, including images taken under normal lighting conditions that do not contain target objects and images that contain different types of target objects; The generation module is used to generate low-light sample images corresponding to each normal illumination sample image based on each normal illumination sample image in the initial image dataset, and to generate a first training dataset based on each normal illumination sample image and the low-light sample images corresponding to each normal illumination sample image. The processing module is used to extract image masks based on the target objects in each normal illumination sample image to obtain the target mask information corresponding to each normal illumination sample image. The training module is used to train an image enhancement model based on the first training dataset and the target mask information corresponding to each normal illumination sample image.
[0017] Optionally, the generation module is specifically used to adjust the image brightness of each normal illumination sample image to obtain a low illumination sample image corresponding to each normal illumination sample image.
[0018] Optionally, the processing module is specifically used to use an edge detection algorithm to identify and obtain edge information of the target object from each normal illumination sample image; Based on the edge information of the target object in each normal illumination sample image, determine the first mask region corresponding to the target object and the second mask region corresponding to the non-target object in each normal illumination sample image; Based on the first mask region and the second mask region corresponding to each normal illumination sample image, the target mask information corresponding to each normal illumination sample image is generated.
[0019] Optionally, the training module is specifically used to input the first training dataset into an initial image enhancement model, and the initial image enhancement model performs image enhancement processing on the low-light sample images corresponding to each normal illumination sample image to obtain the enhanced image corresponding to each low-light sample image. Based on the enhanced image corresponding to each low-light sample image, the target mask information corresponding to each normal-light sample image, and the target brightness enhancement information, the brightness of each enhanced image is enhanced to obtain the actual brightness enhancement image corresponding to each enhanced image. Based on the enhanced image corresponding to each low-light sample image and the normal-light sample image corresponding to each low-light sample image, the first loss information of the initial image enhancement model is determined; Based on the actual brightness enhancement image corresponding to each enhanced image and the target brightness enhancement information, the second loss information of the initial image enhancement model is determined; Based on the first loss information and the second loss information of the initial image enhancement model, the target loss information of the initial image enhancement model is determined, and the initial image enhancement model is iteratively optimized based on the target loss information until the target loss information meets the preset conditions. Then, training stops, and the image enhancement model at the time of training stop is taken as the image enhancement model.
[0020] Optionally, the training module is specifically used to divide each enhanced image to obtain multiple sub-feature maps corresponding to each enhanced image; Based on the target mask information corresponding to each normal illumination sample image, determine the target mask information corresponding to each enhanced image; Based on the target mask information corresponding to each enhanced image, the type of each sub-feature map corresponding to each enhanced image is determined, and the type is used to indicate whether the sub-feature map is a target sub-feature map or a background sub-feature map; Based on the type of each sub-feature map corresponding to each enhanced image, the comparison result of the average brightness of the target object and the average brightness of the background in the normal illumination sample image corresponding to each enhanced image, and the target brightness enhancement information, brightness enhancement processing is performed on each sub-feature map corresponding to each enhanced image to obtain the actual brightness enhancement image corresponding to each enhanced image; wherein, the target brightness enhancement information includes: different brightness thresholds.
[0021] Optionally, the training module is specifically used to determine the number of pixels belonging to the target object in the sub-feature map corresponding to the enhanced image based on the target mask information corresponding to the enhanced image. If the number of pixels belonging to the target object in the sub-feature map is greater than or equal to a preset number, then the type of the sub-feature map is determined to be a target sub-feature map; If the number of pixels belonging to the target object in the sub-feature map is less than the preset number, then the type of the sub-feature map is determined to be a background sub-feature map.
[0022] Optionally, the training module is specifically used to determine the average brightness of each pixel constituting the target object and the average brightness of each pixel constituting the background in the normal illumination sample image based on the target mask information of the normal illumination sample image corresponding to the enhanced image, and to use the average brightness of each pixel constituting the target object as the average brightness of the target object in the normal illumination sample image corresponding to the enhanced image, and to use the average brightness of each pixel constituting the background as the average brightness of the background in the normal illumination sample image corresponding to the enhanced image. For each first sub-feature map of type target sub-feature map in the enhanced image, if the average brightness of the target object in the normal illumination sample image corresponding to the enhanced image is greater than or equal to the average brightness of the background, then according to the first brightness threshold, the average brightness enhancement processing is performed on each first feature map to obtain the actual brightness enhancement image of each first sub-feature map. If the average brightness of the target object in the normal illumination sample image corresponding to the enhanced image is less than the average brightness of the background, then according to the second brightness threshold, the average brightness enhancement processing is performed on each first sub-feature map to obtain the actual brightness enhancement image of each first sub-feature map. For each second sub-feature map of type background in the enhanced image, the average brightness enhancement processing is performed on each second sub-feature map according to the third brightness threshold to obtain the actual brightness enhancement image of each second sub-feature map. Based on the actual brightness enhancement images of each first sub-feature map and each second sub-feature map, the actual brightness enhancement image corresponding to the enhanced image is obtained.
[0023] Optionally, the training module is specifically used to determine the actual brightness value of each first sub-feature map and the actual brightness value of each second sub-feature map based on the actual brightness enhancement images of each first sub-feature map and the actual brightness enhancement images of each second sub-feature map, respectively. The first brightness loss is determined based on the actual brightness value of each first sub-feature map and the brightness threshold corresponding to the target sub-feature map; the brightness threshold corresponding to the target sub-feature map is either the first brightness threshold or the second brightness threshold. The second brightness loss is determined based on the actual brightness value of each second sub-feature map and the brightness threshold corresponding to the background sub-feature map; the brightness threshold corresponding to the background sub-feature map is the third brightness threshold. The second loss information is obtained based on the first brightness loss and the second brightness loss.
[0024] Optionally, the training module is specifically used to input the enhanced image corresponding to each low-light sample image and the normal-light sample image corresponding to each low-light sample image into a pre-trained classification network, and the classification network identifies and extracts the feature information of each enhanced image and the feature information of each normal-light sample image. Based on the feature information of each enhanced image and the feature information of the normal illumination sample image corresponding to each enhanced image, the image similarity between each enhanced image and the corresponding normal illumination sample image is determined. The first loss information is determined based on the image similarity between each enhanced image and the corresponding normal illumination sample image.
[0025] Optionally, the training module is further configured to: perform category labeling on each normal illumination sample image in the first training dataset to obtain a second training dataset; The classification network is trained based on the second training dataset.
[0026] Optionally, the acquisition module is specifically used to acquire initial normal illumination sample images taken under normal lighting conditions; Color channel conversion is performed on each initial normal illumination sample image to obtain the sample grayscale image corresponding to each initial normal illumination sample image; The grayscale images of each sample are normalized to obtain the normal illumination sample images.
[0027] Thirdly, embodiments of this application provide an electronic device, including: a processor, a storage medium, and a bus. The storage medium stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to implement the training method of the image enhancement model provided in the first aspect.
[0028] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, performs a training method for the image enhancement model as provided in the first aspect.
[0029] The beneficial effects of this application are: This application provides a training method, apparatus, electronic device, and storage medium for an image enhancement model, comprising: acquiring an initial image dataset containing multiple normal illumination sample images; generating low illumination sample images corresponding to each normal illumination sample image based on the normal illumination sample images in the initial image dataset, and generating a first training dataset based on the normal illumination sample images and their corresponding low illumination sample images; extracting image masks from target objects in each normal illumination sample image to obtain target mask information corresponding to each normal illumination sample image; training an image enhancement model based on the first training dataset and the target mask information corresponding to each normal illumination sample image; and training the image enhancement model based on the first training dataset and the target mask information corresponding to each normal illumination sample image. This method constructs a training dataset containing normal illumination sample images and their corresponding synthesized low illumination sample images, and performs joint training using image mask information. This enables the trained image enhancement model to specifically improve the visibility and detail clarity of key target regions in low illumination images, avoiding problems such as noise amplification and background distortion caused by global enhancement in traditional methods. Meanwhile, by generating low-light sample images based on normal illumination sample images, the technical bottleneck of difficulty in obtaining accurately paired training samples in real-world scenarios is solved, significantly improving model training efficiency and generalization performance.
[0030] Specifically, a pre-trained classification network calculates the feature similarity between the enhanced image output by the image enhancement network and its corresponding normal illumination sample image, serving as the first loss information. This guides the image enhancement model to output an enhanced image that more closely resembles the original image, improving the overall enhancement effect. Based on the extracted target mask information and the average brightness of the target object and the average brightness of the background in the corresponding normal illumination sample image, the image enhancement model is guided to perform different brightness enhancements on the target and background portions of the enhanced image. A second loss information is calculated based on the actual and expected brightness enhancement values. This guides the image enhancement model to selectively enhance small target objects in the image while improving the overall brightness, making the contrast between the target and the background more pronounced. This improves the enhancement effect of the image enhancement model on low-light images. Attached Figure Description
[0031] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0032] Figure 1A flowchart illustrating the training method for the image enhancement model provided in this application embodiment. Figure 1 ; Figure 2 A flowchart illustrating the training method for the image enhancement model provided in this application embodiment. Figure 2 ; Figure 3 A flowchart illustrating the training method for the image enhancement model provided in this application embodiment. Figure 3 ; Figure 4 A flowchart illustrating the training method for the image enhancement model provided in this application embodiment. Figure 4 ; Figure 5 A flowchart illustrating the training method for the image enhancement model provided in this application embodiment. Figure 5 ; Figure 6 A flowchart illustrating the training method for the image enhancement model provided in this application embodiment. Figure 6 ; Figure 7 A flowchart illustrating the training method for the image enhancement model provided in this application embodiment. Figure 7 ; Figure 8 A flowchart illustrating the training method for the image enhancement model provided in this application embodiment. Figure 8 ; Figure 9 A flowchart illustrating the training method for the image enhancement model provided in this application embodiment. Figure 9 ; Figure 10 A flowchart illustrating the training method for the image enhancement model provided in this application embodiment. Figure 10 ; Figure 11 A schematic diagram illustrating the overall process of a training method for an image enhancement model provided in this application embodiment; Figure 12 A schematic diagram of a training device for an image enhancement model provided in an embodiment of this application; Figure 13 This is a schematic diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0033] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the accompanying drawings in this application are for illustrative and descriptive purposes only and are not intended to limit the scope of protection of this application. Furthermore, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in this application illustrate operations implemented according to some embodiments of this application. It should be understood that the operations in the flowcharts may not be implemented in sequence, and steps without logical contextual relationships may be reversed or implemented simultaneously. In addition, those skilled in the art, guided by the content of this application, may add one or more other operations to the flowcharts, or remove one or more operations from the flowcharts.
[0034] Furthermore, the described embodiments are merely some, not all, of the embodiments of this application. The components of the embodiments of this application described and illustrated herein can typically be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0035] It should be noted that the term "comprising" will be used in the embodiments of this application to indicate the presence of the features declared thereafter, but does not exclude the addition of other features.
[0036] In the field of computer vision and image processing, images in low-light environments often suffer from poor quality, commonly exhibiting problems such as insufficient brightness, low contrast, significant noise, and loss of detail, severely impacting the performance of subsequent high-level vision tasks (such as object detection, recognition, tracking, and semantic segmentation). Especially in critical application scenarios such as nighttime surveillance, drone countermeasures, autonomous driving, and security deployment, effectively improving the quality of low-light images has become a core prerequisite for achieving accurate perception.
[0037] Traditional low-light image enhancement methods are mainly divided into two categories: one is the classic algorithm based on image processing, and the other is the deep learning-based method that has emerged in recent years.
[0038] The first category of methods mainly includes histogram equalization techniques (such as global histogram equalization and contrast-restricted adaptive histogram equalization) and models based on image enhancement theory (Retinex). These methods improve image visibility by adjusting pixel grayscale distribution or separating illumination and reflection components. However, these methods rely on manually designed prior rules, which can easily lead to problems such as over-enhancement, color distortion, noise amplification, or halo artifacts under complex lighting conditions. Furthermore, they struggle to balance global brightness enhancement with local detail preservation, resulting in limited generalization ability.
[0039] The second category of methods, namely deep learning-based image enhancement models, has made significant progress in recent years. Among them, Zero-Reference Deep Curve Estimation (Zero-DCE), as a representative unsupervised method that does not require paired training data, has attracted widespread attention. This method adjusts the brightness of the input image pixel by pixel by estimating a set of differentiable curve parameters, and achieves end-to-end optimization by combining various constraints such as spatial consistency loss and exposure control loss. Because it does not rely on "low-light-normal-light" image pairs in real-world scenes, it reduces data acquisition costs and demonstrates strong flexibility in practical applications.
[0040] However, the standard Zero-DCE model still has several key technical bottlenecks that limit its application effectiveness in specific scenarios: 1. Insufficient enhancement capability for small targets: In scenarios such as long-distance observation or high-altitude aerial photography, the targets to be detected (such as drones flying at night or self-driving cars at night) usually occupy only a very small area in the image, which are typical small targets. The original Zero-DCE model uses a global or local sliding window enhancement strategy, which lacks targeted attention to small target areas. As a result, the contrast improvement between the enhanced small targets and the background is not significant, and the structural texture is blurred, making it difficult to meet the needs of subsequent detection tasks.
[0041] 2. Training data relies on real low-light samples: Although Zero-DCE does not require paired data, it still requires a large number of real low-light images as training input. However, the collection of real low-light images is limited by factors such as weather, time, and equipment, resulting in poor sample diversity, difficulty in annotation, and difficulty in covering various complex scenes, thus limiting the model's generalization ability.
[0042] 3. Inappropriate Loss Function Design: The original Zero-DCE introduced multiple loss terms, including TVLoss (smoothing regularization), SpatialLoss (spatial consistency loss), ColorLoss (color constancy loss), and ExpLoss (exposure loss). However, for single-channel grayscale image enhancement tasks, ColorLoss has no applicable basis, and TVLoss and SpatialLoss are prone to causing over-smoothing, suppressing edge details and affecting the clear rendering of small objects. Furthermore, it may lead to instability and convergence difficulties during training.
[0043] 4. Lack of high-level semantic guidance mechanisms: Traditional enhancement models mostly optimize at the pixel level or low-order feature level, lacking the ability to understand image content. Especially in small target scenes, if the location and structural features of the target cannot be perceived, it is difficult to achieve "selective" enhancement, resulting in wasted resources and poor enhancement effects.
[0044] Therefore, there is an urgent need for a new low-light image enhancement method that can be trained without real low-light samples, effectively improve the contrast and recognizability of small target regions, while maintaining the realism of background details, and has good generalization ability and real-time inference performance. It is particularly suitable for small target detection-oriented applications such as nighttime drone monitoring.
[0045] Based on this, this solution provides a training method for an image enhancement model. By collecting normal illumination sample images, corresponding low illumination sample images are derived, thus constructing a training dataset for training the image enhancement model. During the training process, a classification network is introduced to guide model training, improving the enhancement effect on small targets while maintaining the realism of background details. Simultaneously, feature similarity calculation is performed between the enhanced image output by the model and the normal illumination sample image, serving as the first type of loss information to constrain the enhanced image output by the model to be closer to the normal illumination sample image. Furthermore, for the enhanced image output by the model, sub-feature maps are divided, and the target sub-feature map and the background sub-feature map are enhanced to different brightness levels. Based on the actual brightness enhancement results of the model and a preset brightness enhancement threshold, a second type of loss information is calculated. This trains the model to enhance the background and target in the image to different brightness levels, improving the overall brightness of the image while making the contrast between the target and the background more pronounced.
[0046] Figure 1 A flowchart illustrating the training method for the image enhancement model provided in this application embodiment. Figure 1 The subject executing this method can be a computer device. For example... Figure 1 As shown, the method may include: S101. Collect the initial image dataset, which contains multiple normal illumination sample images.
[0047] Multiple normal illumination sample images include images taken under normal lighting conditions that do not contain the target object, as well as images that contain different types of target objects.
[0048] In some embodiments, an initial image dataset can be obtained based on a publicly available small target database. This database may store historical normal illumination sample images taken under normal lighting conditions. A portion of the normal illumination sample images in the initial image dataset may contain images with different types of target objects. These target objects can refer to small target objects, and the target objects to be included in the images can be determined based on the specific image enhancement scenario. For example, when applied to detecting drones flying at night, the target objects in the normal illumination sample images may be drones. Different types of target objects can refer to drones of different shapes, models, or sizes. Different normal illumination sample images may contain drones of different shapes, thus obtaining images containing different types of target objects. Another portion of the normal illumination sample images in the initial image dataset may be images without target objects.
[0049] S102. Based on each normal illumination sample image in the initial image dataset, generate a low illumination sample image corresponding to each normal illumination sample image, and generate the first training dataset based on each normal illumination sample image and the low illumination sample image corresponding to each normal illumination sample image.
[0050] In some embodiments, low-illuminance sample images can be obtained by processing the image illuminance of each normal illuminance sample image. The low-illuminance sample images corresponding to the normal illuminance sample images contain completely identical image content; only the image illuminance differs.
[0051] It's worth noting that "normal illumination" and "low illumination" are technical terms describing ambient lighting conditions. They are used to distinguish imaging scenes under different light intensities. Normal illumination refers to an environment with sufficient lighting to produce clear, color-accurate, and low-noise images without the need for special gain or enhancement techniques by conventional imaging equipment (such as standard cameras). Low illumination refers to an environment with weak lighting conditions where conventional cameras struggle to directly capture usable images, requiring gain enhancement, long exposure, infrared illumination, or image enhancement algorithms to improve visibility.
[0052] Low-light images typically exhibit weaker brightness, contrast, and color compared to normal-light images. Acquiring low-light sample images is generally difficult, resulting in poor image quality. This solution derives corresponding low-light sample images from acquired normal-light sample images, thus overcoming the limitations of low-light sample image data acquisition.
[0053] S103. Based on the target objects in each normal illumination sample image, perform image mask extraction to obtain the target mask information corresponding to each normal illumination sample image.
[0054] In some embodiments, for each normal illumination sample image, image mask information can also be extracted. The purpose of mask extraction is to quickly distinguish the target object region and the background region from the image based on the target mask information, so as to guide the subsequent model to highlight and enhance the target object in the image, so as to improve the local contrast of the target region in a targeted manner and achieve a clear distinction between the target and the background.
[0055] Each normal illumination sample image corresponds to a target mask information, which can be a black and white image. The white area indicates the area where the target object is located, while the black area is the background area.
[0056] S104. Based on the first training dataset and the target mask information corresponding to each normal illumination sample image, train the image enhancement model.
[0057] In some embodiments, the first training dataset obtained above can be used as input data to train the image enhancement model. Simultaneously, based on the enhanced image output by the image enhancement model and the target mask information corresponding to each normal illumination sample image, the image enhancement model can be further trained to enhance the target object and background to different brightness levels. When used for image illumination enhancement, the image enhancement model trained in this way not only improves the overall brightness of the image but also makes the contrast between the target and the background more pronounced. It enhances the enhancement effect of small targets while maintaining the integrity of background details.
[0058] In summary, the image enhancement model training method provided in this embodiment includes: acquiring an initial image dataset containing multiple normal illumination sample images; generating low illumination sample images corresponding to each normal illumination sample image based on the normal illumination sample images in the initial image dataset, and generating a first training dataset based on the normal illumination sample images and their corresponding low illumination sample images; extracting image masks from the target objects in each normal illumination sample image to obtain target mask information corresponding to each normal illumination sample image; training an image enhancement model based on the first training dataset and the target mask information corresponding to each normal illumination sample image; and training the image enhancement model based on the first training dataset and the target mask information corresponding to each normal illumination sample image. This method constructs a training dataset containing normal illumination sample images and their corresponding synthesized low illumination sample images, and performs joint training using image mask information. This enables the trained image enhancement model to specifically improve the visibility and detail clarity of key target areas in low illumination images, avoiding problems such as noise amplification and background distortion caused by global enhancement in traditional methods. Meanwhile, by generating low-light sample images based on normal illumination sample images, the technical bottleneck of difficulty in obtaining accurately paired training samples in real-world scenarios is solved, significantly improving model training efficiency and generalization performance.
[0059] Figure 2 A flowchart illustrating the training method for the image enhancement model provided in this application embodiment. Figure 2 Optionally, in step S101, an initial image dataset is acquired, including: S201. Collect initial normal illumination sample images taken under normal lighting conditions.
[0060] In some embodiments, the initial normal illumination sample images obtained under normal lighting conditions can be preprocessed to meet the input requirements for subsequent model training.
[0061] S202. Perform color channel conversion on each initial normal illumination sample image to obtain the sample grayscale image corresponding to each initial normal illumination sample image.
[0062] First, the initial normal illumination sample image can be converted by changing the image color channels to convert the original red-green-blue color space (RGB) image into a grayscale image, and then the grayscale image can be used as the sample grayscale image.
[0063] S203. Perform size normalization processing on each sample grayscale image to obtain each normal illumination sample image.
[0064] The sample grayscale images are then normalized according to their size to ensure that each sample grayscale image is processed to a fixed input size, thus ensuring data consistency.
[0065] After the above processing, the normal illumination sample image is obtained.
[0066] Optionally, in step S102, generating low-light sample images corresponding to each normal illumination sample image based on each normal illumination sample image in the initial image dataset includes: adjusting the image brightness of each normal illumination sample image to obtain the low-light sample images corresponding to each normal illumination sample image.
[0067] In some embodiments, the overall brightness of a normal illumination sample image can be adjusted using the gamma correction (Gamma) method to obtain a low illumination sample image corresponding to the normal illumination sample image. Specifically, different brightness adjustments can be made to different normal illumination sample images to simulate different degrees of low illumination sample images.
[0068] For example, by adjusting the brightness of normal illumination sample image 1 and normal illumination sample image 2 to different degrees, the resulting low illumination sample image 1 corresponding to normal illumination sample image 1 and low illumination sample image 2 corresponding to normal illumination sample image 2 have different illuminance.
[0069] In other embodiments, the normal illumination sample image can be subjected to brightness attenuation processing according to preset virtual exposure parameters. Poisson noise and Gaussian noise related to light intensity are then superimposed on the attenuated image. Non-uniform gain is applied to the image's color channels to simulate white balance deviation under low illumination conditions, thereby obtaining a low illumination sample image that conforms to the real imaging mechanism. Of course, in practical applications, the above two processing methods are not the only options; low illumination sample images can also be generated using image degradation methods driven by deep learning.
[0070] Figure 3 A flowchart illustrating the training method for the image enhancement model provided in this application embodiment. Figure 2 Optionally, in step S103, image mask extraction is performed based on the target object in each normal illumination sample image to obtain the target mask information corresponding to each normal illumination sample image, including: S301. An edge detection algorithm is used to identify and obtain the edge information of the target object from each normal illumination sample image.
[0071] Optionally, for each normal illumination sample image, an edge detection algorithm can be used to extract the edge information of the target object. For normal illumination sample images that do not contain the target object, the extraction of the target object's edge information is ignored. The normal illumination sample images that do not contain the target object can be treated as a background image.
[0072] In some embodiments, the gradient magnitude and direction of each pixel in the normal illumination sample image can be calculated, and the first-order gradients in the horizontal and vertical directions can be extracted using the first-order differential edge detection algorithm (Sobel Operator, or Sobel for short). Non-maximum suppression technology is applied to retain local maximum points in the gradient direction to form a refined edge candidate set. Strong edge points and weak edge points are determined by double threshold detection, and the final effective edge set is determined by hysteresis connection.
[0073] For example: if the target object is a drone flying at night, after this step, the closed edge line of the drone's outline can be clearly extracted, while the buildings, sky textures, etc. in the background are effectively suppressed because they do not conform to the characteristics of overall structural continuity and gradient saliency.
[0074] S302. Based on the edge information of the target object in each normal illumination sample image, determine the first mask region corresponding to the target object and the second mask region corresponding to the non-target object in each normal illumination sample image.
[0075] After obtaining the edge information of the target object, it can be further semantically segmented to distinguish the foreground region belonging to the target object, i.e., the first mask region, and the background region not belonging to the target object, i.e., the second mask region.
[0076] Optionally, a method combining edge closure and internal filling can be used to complete the region segmentation: analyze the connected edge structure in the edge information, identify one or more closed contours, and use morphological closing operations to complete potentially broken edge segments to improve contour integrity; for each closed contour, determine the pixel density, texture consistency, and matching degree with known prior shapes (e.g., aspect ratio, area range) within its enclosed area; if a closed contour meets the preset target object feature model (e.g., area greater than 500 pixels, aspect ratio between 1.5 and 4), then its internal region is marked as the first mask region; the remaining unmarked regions of the image are defined as the second mask region. S303. Generate target mask information corresponding to each normal illumination sample image based on the first mask area and the second mask area corresponding to each normal illumination sample image.
[0077] The generated target mask information can be represented as a single-channel label image with the same resolution as the normal illumination sample image. Its pixel values are either 0 or 1. Pixels in the first mask region are set to 1, and pixels in the second mask region are set to 0, resulting in a black and white image where white areas represent the target object and black areas represent the background. The target mask information allows for the rapid determination of which pixels in the image belong to the target object and which belong to the background, subsequently guiding the model to differentiate between the background and the target object.
[0078] Figure 4 A flowchart illustrating the training method for the image enhancement model provided in this application embodiment. Figure 3 Optionally, in step S104, an image enhancement model is trained based on the first training dataset and the target mask information corresponding to each normal illumination sample image, including: S401. Input the first training dataset into the initial image enhancement model. The initial image enhancement model performs image enhancement processing on the low-light sample images corresponding to each normal illumination sample image to obtain the enhanced image corresponding to each low-light sample image.
[0079] The initial image augmentation model can refer to the model before the parameters are trained. After training the parameters using the scene data of this scheme, the desired image augmentation model is obtained.
[0080] In some embodiments, low-light sample images in the first training dataset can be used as training data, and normal-light sample images corresponding to the low-light sample images can be used as label data. The initial image enhancement model can perform image enhancement processing on each low-light sample image to obtain the enhanced image.
[0081] S402. Based on the enhanced image corresponding to each low-light sample image, the target mask information corresponding to each normal-light sample image, and the target brightness enhancement information, the brightness of each enhanced image is enhanced to obtain the actual brightness enhancement image corresponding to each enhanced image.
[0082] Since the normal illumination sample image corresponds to the low illumination sample image, and the low illumination sample image corresponds to the enhanced image, their image content is consistent, only the image brightness or contrast is different. Therefore, the target mask information corresponding to the normal illumination sample image can be used as the target mask information of the enhanced image of the low illumination sample image corresponding to the normal illumination sample image after enhancement processing.
[0083] For the enhanced image output by the image enhancement model, the target part and the background part in the enhanced image can be distinguished based on the target mask information corresponding to the enhanced image. Then, based on the target brightness enhancement information, the initial image enhancement model performs brightness enhancement processing on the target part and the background part of the enhanced image to obtain the actual brightness enhancement image corresponding to the enhanced image.
[0084] The reason this image shows the actual brightness enhancement is that the model is expected to enhance the brightness to the target level. However, the model cannot actually do this in one go. The actual brightness enhancement may differ from the expected brightness enhancement. The model gradually enhances the image's brightness to the desired level through continuous exploration and optimization.
[0085] S403. Based on the enhanced image corresponding to each low-light sample image and the normal-light sample image corresponding to each low-light sample image, determine the first loss information of the initial image enhancement model.
[0086] In some embodiments, based on the feature similarity between the enhanced image output by the initial image enhancement model and the corresponding normal illumination sample image, a first loss information of the initial image enhancement model can be calculated. The first loss information is used to constrain the enhanced image output by the model to be closer to the original image.
[0087] S404. Based on the actual brightness enhancement image corresponding to each enhanced image and the target brightness enhancement information, determine the second loss information of the initial image enhancement model.
[0088] Based on the difference between the actual brightness enhancement image and the target brightness enhancement information corresponding to each enhanced image, the second loss information of the initial image enhancement model can be calculated. The second loss information is used to constrain the model to enhance the background and target parts in the image to different brightness regions, improve the contrast of the target part, and achieve a clear distinction between the target and the background.
[0089] S405. Based on the first loss information and the second loss information of the initial image enhancement model, determine the target loss information of the initial image enhancement model, and iteratively optimize the initial image enhancement model based on the target loss information until the target loss information meets the preset conditions. Then, stop training and use the image enhancement model at the time of stopping training as the image enhancement model.
[0090] In this embodiment, the target loss information can be calculated based on the first loss information, the second loss information, and the balance parameter. The target loss information is used as the final loss information of the initial image enhancement model. The training method is iterated repeatedly until the target loss information reaches the preset loss accuracy or the number of iterations reaches the preset number, at which point the training stops and the image enhancement model is obtained.
[0091] By combining the two types of loss information mentioned above to train the model, the trained image enhancement model can not only improve the overall brightness of the image, but also make the local contrast of small targets in the enhanced image more obvious, making it easier to quickly locate the small targets of interest in the enhanced image.
[0092] Figure 5 A flowchart illustrating the training method for the image enhancement model provided in this application embodiment. Figure 5 Optionally, in step S402, based on the enhanced image corresponding to each low-light sample image, the target mask information corresponding to each normal-light sample image, and the target brightness enhancement information, the brightness of each enhanced image is enhanced to obtain the actual brightness enhancement image corresponding to each enhanced image, including: S501. Divide each enhanced image into multiple sub-feature maps corresponding to each enhanced image.
[0093] The enhanced image can be divided into multiple sub-feature maps. For example, an enhanced image can be divided into multiple 4... 4. Sub-feature map of size.
[0094] S502. Based on the target mask information corresponding to each normal illumination sample image, determine the target mask information corresponding to each enhanced image.
[0095] Based on the correspondence between the enhanced image and the low-light sample image, and the correspondence between the low-light sample image and the normal-light sample image, the normal-light sample image corresponding to the enhanced image can be determined. Thus, the target mask information corresponding to the determined normal-light sample image can be used as the target mask information corresponding to the enhanced image.
[0096] S503. Based on the target mask information corresponding to each enhanced image, determine the type of each sub-feature map corresponding to each enhanced image. The type is used to indicate whether the sub-feature map is a target sub-feature map or a background sub-feature map.
[0097] In some embodiments, the target mask information corresponding to the enhanced image and the pixel information contained in each sub-feature map corresponding to the enhanced image can be used to determine whether the sub-feature map belongs to the target part or the background part.
[0098] S504. Based on the type of each sub-feature map corresponding to each enhanced image, the comparison result of the average brightness of the target object and the average brightness of the background in the normal illumination sample image corresponding to each enhanced image, and the target brightness enhancement information, perform brightness enhancement processing on each sub-feature map corresponding to each enhanced image to obtain the actual brightness enhancement image corresponding to each enhanced image.
[0099] The target brightness enhancement information includes different brightness thresholds.
[0100] The average brightness of the target object and the average brightness of the background in the normal illumination sample image corresponding to the enhanced image can be determined based on the target mask information of the normal illumination sample image, which has already been extracted previously. For the sub-feature map belonging to the target part, different brightness enhancement processes can be performed based on the comparison results between the average brightness of the target object and the average brightness of the background. For the background sub-feature map, brightness enhancement can be performed directly based on the brightness threshold.
[0101] It is worth noting that the target brightness enhancement information is not a single brightness value. It includes all the brightness thresholds used in this solution for brightness enhancement. In this embodiment, the target brightness enhancement information includes the brightness thresholds corresponding to the background sub-feature map and the brightness thresholds corresponding to the target sub-feature map. The brightness thresholds corresponding to the target sub-feature map may include two different thresholds. Depending on the actual situation, one of the thresholds can be used for brightness enhancement processing.
[0102] Figure 6 A flowchart illustrating the training method for the image enhancement model provided in this application embodiment. Figure 6 Optionally, in step S503, the type of each sub-feature map corresponding to each enhanced image is determined based on the target mask information corresponding to each enhanced image, including: S601. Based on the target mask information corresponding to the enhanced image, determine the number of pixels belonging to the target object in the sub-feature map corresponding to the enhanced image.
[0103] Based on the information of each pixel in the sub-feature map and the target mask information corresponding to the enhanced image, it is possible to determine which pixels in the sub-feature map belong to the target object, and thus count the number of pixels in the sub-feature map that belong to the target object.
[0104] S602. If the number of pixels belonging to the target object in the sub-feature map is greater than or equal to a preset number, then the type of the sub-feature map is determined to be a target sub-feature map.
[0105] With sub-feature maps as 4 Taking size 4 as an example, the sub-feature map contains 16 pixels. Assuming the preset number is 4, if at least 4 of the 16 pixels in the sub-feature map belong to the target object, then the type of the sub-feature map can be determined as a target sub-feature map, that is, as a target part sub-feature map.
[0106] S603. If the number of pixels belonging to the target object in the sub-feature map is less than the preset number, then the type of the sub-feature map is determined to be a background sub-feature map.
[0107] If the number of pixels belonging to the target object in the sub-feature map is less than 4, then the type of the sub-feature map can be determined as a background sub-feature map.
[0108] Of course, the above preset number is only an example. In actual applications, it can be adjusted adaptively according to the required accuracy of the target sub-feature map.
[0109] Figure 7 A flowchart illustrating the training method for the image enhancement model provided in this application embodiment. Figure 7 Optionally, in step S504, based on the type of each sub-feature map corresponding to each enhanced image, the comparison result of the average brightness of the target object and the average brightness of the background in the normal illumination sample image corresponding to each enhanced image, and the target brightness enhancement information, brightness enhancement processing is performed on each sub-feature map corresponding to each enhanced image to obtain the actual brightness enhancement image corresponding to each enhanced image, including: S701. Based on the target mask information of the normal illumination sample image corresponding to the enhanced image, determine the average brightness of each pixel constituting the target object and the average brightness of each pixel constituting the background in the normal illumination sample image, and use the average brightness of each pixel constituting the target object as the average brightness of the target object in the normal illumination sample image corresponding to the enhanced image, and use the average brightness of each pixel constituting the background as the average brightness of the background in the normal illumination sample image corresponding to the enhanced image.
[0110] Based on the target mask information of the normal illumination sample image corresponding to the enhanced image, all target object pixels and all background pixels in the normal illumination sample image can be determined. By calculating the average brightness of all target object pixels, the average brightness of the target object can be obtained; by calculating the average brightness of all background pixels, the average brightness of the background can be obtained.
[0111] S702. For each first sub-feature map of type target sub-feature map in the enhanced image, if the average brightness of the target object in the normal illumination sample image corresponding to the enhanced image is greater than or equal to the average brightness of the background, then according to the first brightness threshold, the average brightness enhancement processing is performed on each first feature map to obtain the actual brightness enhancement image of each first sub-feature map.
[0112] Here, all sub-feature maps of type "target sub-feature map" are referred to as the first sub-feature map, meaning that all sub-feature maps of the target portion are considered as the first sub-feature map. For the first sub-feature map, if the average brightness of the target object in the normal illumination sample image corresponding to the enhanced image is greater than or equal to the average brightness of the background, then it is desirable to increase the average brightness of the first sub-feature map to a first brightness threshold. The first brightness threshold can be 1, to achieve a higher brightness of the target object compared to the background, making the brighter target more prominent.
[0113] S703. If the average brightness of the target object in the normal illumination sample image corresponding to the enhanced image is less than the average brightness of the background, then according to the second brightness threshold, the average brightness enhancement processing is performed on each first sub-feature map to obtain the actual brightness enhancement image of each first sub-feature map.
[0114] If the average brightness of the target object in the normal illumination sample image corresponding to the enhanced image is less than the average brightness of the background, then it is desirable to increase the average brightness of the first sub-feature map to a second brightness threshold. The second brightness threshold can be 0.4, to ensure that the target object is less bright than the background, making the darker target more prominent.
[0115] This allows for the targeted highlighting of small objects within an image.
[0116] For image enhancement models, it is unclear how to improve the brightness of the first sub-feature map by average brightness enhancement to the desired first brightness threshold or second brightness threshold. It is through continuous exploration and optimization of parameters that the output actual brightness enhancement image gradually approaches the set brightness threshold.
[0117] S704. For each second sub-feature map of type background in the enhanced image, the average brightness enhancement processing is performed on each second sub-feature map according to the third brightness threshold to obtain the actual brightness enhancement image of each second sub-feature map.
[0118] All sub-feature maps of type background in the enhanced image are called second sub-feature maps. For the second sub-feature maps, it is desired to increase their average brightness to a third brightness threshold, which can be 0.7.
[0119] S705. Based on the actual brightness enhancement images of each first sub-feature map and the actual brightness enhancement images of each second sub-feature map, obtain the actual brightness enhancement image corresponding to the enhanced image.
[0120] After the initial image enhancement model brightens each sub-feature map, the actual brightness-enhanced image corresponding to the enhanced image output by the model can be obtained. At this point, the average brightness of each sub-feature map in the actual brightness-enhanced image may not reach the desired brightness value. However, through continuous iterative training of the model, it can eventually be guided to enhance both the target sub-feature map and the background sub-feature map to the desired brightness value, achieving a clear distinction between the target and the background.
[0121] Figure 8 A flowchart illustrating the training method for the image enhancement model provided in this application embodiment. Figure 8 Optionally, in step S404, based on the actual brightness enhancement image corresponding to each enhanced image and the target brightness enhancement information, the second loss information of the initial image enhancement model is determined, including: S801. Based on the actual brightness enhancement images of each first sub-feature image and each second sub-feature image, determine the actual brightness value of each first sub-feature image and the actual brightness value of each second sub-feature image respectively.
[0122] In any iteration, the actual brightness value of each first sub-feature map can be determined based on the actual brightness enhancement image of each first sub-feature map output by the initial image enhancement model. Similarly, the actual brightness value of each second sub-feature map can be determined, which is to determine the actual brightness value that the initial image enhancement model has enhanced after performing brightness enhancement on each sub-feature map.
[0123] S802. Determine the first brightness loss based on the actual brightness value of each first sub-feature map and the brightness threshold corresponding to the target sub-feature map.
[0124] The brightness threshold corresponding to the target sub-feature map is either the first brightness threshold or the second brightness threshold.
[0125] When the average brightness of the target object in the enhanced image is greater than or equal to the average brightness of the background, the brightness threshold corresponding to the target sub-feature map is the first brightness threshold mentioned above. When the average brightness of the target object in the enhanced image is less than the average brightness of the background, the brightness threshold corresponding to the target sub-feature map is the second brightness threshold mentioned above.
[0126] Therefore, by calculating the difference between the actual brightness value and the brightness threshold of each first sub-feature map, the first brightness loss can be calculated.
[0127] S803. Determine the second brightness loss based on the actual brightness value of each second sub-feature map and the brightness threshold corresponding to the background sub-feature map.
[0128] The brightness threshold corresponding to the background sub-feature map is the third brightness threshold.
[0129] Similarly, the second brightness loss can be obtained by calculating the difference between the actual brightness value of each second sub-feature map and the third brightness threshold.
[0130] S804. Based on the first brightness loss and the second brightness loss, obtain the second loss information.
[0131] In some embodiments, the first brightness loss corresponding to all first sub-feature maps in all enhanced images and the second brightness loss corresponding to all second sub-feature maps in all enhanced images can be weighted and summed to obtain the second loss information.
[0132] Figure 9 A flowchart illustrating the training method for the image enhancement model provided in this application embodiment. Figure 9 Optionally, in step S403, based on the enhanced image corresponding to each low-light sample image and the normal-light sample image corresponding to each low-light sample image, the first loss information of the initial image enhancement model is determined, including: S901. Input the enhanced images corresponding to each low-light sample image and the normal-light sample image corresponding to each low-light sample image into a pre-trained classification network. The classification network identifies and extracts the feature information of each enhanced image and the feature information of each normal-light sample image.
[0133] In some embodiments, the enhanced image corresponding to the low-light sample image output by the initial image enhancement model and the normal-light sample image corresponding to the low-light sample image can be input into a pre-trained classification network, and the feature extraction part trained by the classification network can be used to extract the feature information of the enhanced image and the normal-light sample image respectively.
[0134] S902. Based on the feature information of each enhanced image and the feature information of the normal illumination sample image corresponding to each enhanced image, determine the image similarity between each enhanced image and the corresponding normal illumination sample image.
[0135] Based on the feature information of the enhanced image and the feature information of the normal illumination sample image, the feature similarity between the enhanced image and its corresponding normal illumination sample image can be calculated. The greater the feature similarity, the closer the enhanced image is to the normal illumination sample image, which proves that the enhancement effect is better.
[0136] S903. Determine the first loss information based on the image similarity between each enhanced image and the corresponding normal illumination sample image.
[0137] In some embodiments, the first loss information can be calculated based on the image similarity between all enhanced images and their corresponding normal illumination sample images.
[0138] Figure 10 A flowchart illustrating the training method for the image enhancement model provided in this application embodiment. Figure 10 The classification network in step S901 is trained in the following manner: S1001. Classify each normal illumination sample image in the first training dataset to obtain the second training dataset.
[0139] It is worth noting that the training samples used to train the image enhancement model and the training samples used to train the classification network are the same batch of data. However, when training the classification network, it is also necessary to label the normal illumination sample images in the first training dataset with image categories. The labeling information is used to indicate whether the image contains a target object and the type of the target object.
[0140] The second training dataset contains normal illumination sample images labeled with category information.
[0141] S1002. Based on the second training dataset, a classification network is trained.
[0142] Using the second training dataset as input data, a classification network can be trained.
[0143] In some embodiments, the second training dataset can be divided into a training set and a validation set. A reparameterized VGG (RepVGG) architecture can be used as the backbone of the classification network, and the loss function of the classification network is calculated using the classic cross-entropy loss function. The loss value can be calculated based on the image category predicted by the classification network and the corresponding labeled category of the image.
[0144] The classification network that achieves the highest accuracy on the validation set while maintaining essentially constant network parameters is used as the final classification network. After training, the network parameters of the classification network can be fixed to guide the training of image augmentation models.
[0145] It should be noted that the classification network described above was trained on normal illumination sample images. This means that the features it learns (such as edges, textures, and shapes) are formed under conditions of sufficient brightness and good contrast. When the input becomes a low-light grayscale image, the visual characteristics of the image change significantly, which may cause the classification network to lack good feature extraction capabilities and high classification accuracy for low-light grayscale images.
[0146] Although the classification network is not explicitly trained to judge brightness levels, in order to correctly identify objects in classification tasks, the model implicitly learns the statistical characteristics of the image, such as overall brightness, local contrast, and signal-to-noise ratio.
[0147] For example, objects of the same type exhibit different pixel distributions under different lighting conditions. For a model to classify stably, it must learn to be robust or sensitive to changes in lighting. This means that its internal feature representations will respond to changes in brightness / contrast. Therefore, in deep feature maps, low-light images and normal-light images will produce significantly different activation patterns, indicating that the network perceives brightness differences.
[0148] In other words, although the classification network itself cannot directly and effectively process low-light images, as a powerful learner trained under normal lighting conditions, its intermediate layer features are naturally sensitive to attributes such as image brightness and contrast. This approach leverages this by using the classification network as a feature reference standard to construct a feature-level consistency constraint (i.e., feature similarity loss) to guide the enhancement process of low-light images. This ensures that the enhanced image becomes visually clearer while maintaining consistency with the original image at the deep feature level, thereby improving the final classification accuracy.
[0149] In some embodiments, since the classification network is trained on sample images containing and not containing the target object, during the training of its classification ability, the classification network can not only pay attention to the background features in the image, but also effectively pay attention to the features of the target object, thereby guiding the image enhancement model to have a better enhancement effect on the target object in the image.
[0150] Figure 11 This is a schematic diagram of the overall process of training an image enhancement model according to an embodiment of this application. The steps in the diagram have been described in detail above and will not be repeated here.
[0151] In summary, the image enhancement model training method provided in this embodiment includes: acquiring an initial image dataset containing multiple normal illumination sample images; generating low illumination sample images corresponding to each normal illumination sample image based on the normal illumination sample images in the initial image dataset, and generating a first training dataset based on the normal illumination sample images and their corresponding low illumination sample images; extracting image masks from the target objects in each normal illumination sample image to obtain target mask information corresponding to each normal illumination sample image; training an image enhancement model based on the first training dataset and the target mask information corresponding to each normal illumination sample image; and training the image enhancement model based on the first training dataset and the target mask information corresponding to each normal illumination sample image. This method constructs a training dataset containing normal illumination sample images and their corresponding synthesized low illumination sample images, and performs joint training using image mask information. This enables the trained image enhancement model to specifically improve the visibility and detail clarity of key target areas in low illumination images, avoiding problems such as noise amplification and background distortion caused by global enhancement in traditional methods. Meanwhile, by generating low-light sample images based on normal illumination sample images, the technical bottleneck of difficulty in obtaining accurately paired training samples in real-world scenarios is solved, significantly improving model training efficiency and generalization performance.
[0152] Specifically, a pre-trained classification network calculates the feature similarity between the enhanced image output by the image enhancement network and its corresponding normal illumination sample image, serving as the first loss information. This guides the image enhancement model to output an enhanced image that more closely resembles the original image, improving the overall enhancement effect. Based on the extracted target mask information and the average brightness of the target object and the average brightness of the background in the corresponding normal illumination sample image, the image enhancement model is guided to perform different brightness enhancements on the target and background portions of the enhanced image. A second loss information is calculated based on the actual and expected brightness enhancement values. This guides the image enhancement model to selectively enhance small target objects in the image while improving the overall brightness, making the contrast between the target and the background more pronounced. This improves the enhancement effect of the image enhancement model on low-light images.
[0153] The following describes the apparatus, device, and storage medium used to execute the image enhancement model method provided in this application. The specific implementation process and technical effects are described above and will not be repeated below.
[0154] Figure 12This diagram illustrates a training apparatus for an image enhancement model provided in an embodiment of this application. The functions implemented by this training apparatus correspond to the steps performed by the method described above. This apparatus can be understood as the aforementioned server, or the server's processor, or as a component independent of the aforementioned server or processor but under the server's control that implements the functions of this application, such as... Figure 12 As shown, the device includes: a data acquisition module 100, a generation module 200, a processing module 300, and a training module 400; The acquisition module 100 is used to acquire an initial image dataset, which contains multiple normal illumination sample images. These multiple normal illumination sample images include images taken under normal lighting conditions that do not contain target objects and images that contain different types of target objects. The generation module 200 is used to generate low-light sample images corresponding to each normal-light sample image based on each normal-light sample image in the initial image dataset, and to generate the first training dataset based on each normal-light sample image and the low-light sample images corresponding to each normal-light sample image. The processing module 300 is used to extract the image mask based on the target object in each normal illumination sample image to obtain the target mask information corresponding to each normal illumination sample image. The training module 400 is used to train an image enhancement model based on the first training dataset and the target mask information corresponding to each normal illumination sample image.
[0155] Optionally, the generation module 200 is specifically used to adjust the image brightness of each normal illumination sample image to obtain the low illumination sample image corresponding to each normal illumination sample image.
[0156] Optionally, the processing module 300 is specifically used to use an edge detection algorithm to identify and obtain edge information of the target object from each normal illumination sample image; Based on the edge information of the target object in each normal illumination sample image, determine the first mask region corresponding to the target object and the second mask region corresponding to the non-target object in each normal illumination sample image; Based on the first mask region and the second mask region corresponding to each normal illumination sample image, the target mask information corresponding to each normal illumination sample image is generated.
[0157] Optionally, the training module 400 is specifically used to input the first training dataset into the initial image enhancement model, and the initial image enhancement model performs image enhancement processing on the low-light sample images corresponding to each normal illumination sample image to obtain the enhanced image corresponding to each low-light sample image. Based on the enhanced image corresponding to each low-light sample image, the target mask information corresponding to each normal-light sample image, and the target brightness enhancement information, the brightness of each enhanced image is enhanced to obtain the actual brightness enhancement image corresponding to each enhanced image. Based on the enhanced image corresponding to each low-light sample image and the normal-light sample image corresponding to each low-light sample image, the first loss information of the initial image enhancement model is determined. Based on the actual brightness enhancement image corresponding to each enhanced image and the target brightness enhancement information, the second loss information of the initial image enhancement model is determined; Based on the first and second loss information of the initial image augmentation model, the target loss information of the initial image augmentation model is determined. Based on the target loss information, the initial image augmentation model is iteratively optimized until the target loss information meets the preset conditions. Then, training stops, and the image augmentation model at the point where training stops is taken as the image augmentation model.
[0158] Optionally, the training module 400 is specifically used to divide each enhanced image to obtain multiple sub-feature maps corresponding to each enhanced image; Based on the target mask information corresponding to each normal illumination sample image, determine the target mask information corresponding to each enhanced image; Based on the target mask information corresponding to each enhanced image, the type of each sub-feature map corresponding to each enhanced image is determined. The type is used to indicate whether the sub-feature map is a target sub-feature map or a background sub-feature map. Based on the type of each sub-feature map corresponding to each enhanced image, the comparison results of the average brightness of the target object and the average brightness of the background in the normal illumination sample image corresponding to each enhanced image, and the target brightness enhancement information, brightness enhancement processing is performed on each sub-feature map corresponding to each enhanced image to obtain the actual brightness enhancement image corresponding to each enhanced image; wherein, the target brightness enhancement information includes: different brightness thresholds.
[0159] Optionally, the training module 400 is specifically used to determine the number of pixels belonging to the target object in the sub-feature map corresponding to the enhanced image based on the target mask information corresponding to the enhanced image. If the number of pixels belonging to the target object in the sub-feature map is greater than or equal to a preset number, then the type of the sub-feature map is determined to be a target sub-feature map; If the number of pixels belonging to the target object in the sub-feature map is less than a preset number, then the type of the sub-feature map is determined to be a background sub-feature map.
[0160] Optionally, the training module 400 is specifically used to determine the average brightness of each pixel constituting the target object and the average brightness of each pixel constituting the background in the normal illumination sample image based on the target mask information of the normal illumination sample image corresponding to the enhanced image, and to use the average brightness of each pixel constituting the target object as the average brightness of the target object in the normal illumination sample image corresponding to the enhanced image, and to use the average brightness of each pixel constituting the background as the average brightness of the background in the normal illumination sample image corresponding to the enhanced image. For each first sub-feature map of type target sub-feature map in the enhanced image, if the average brightness of the target object in the normal illumination sample image corresponding to the enhanced image is greater than or equal to the average brightness of the background, then according to the first brightness threshold, the average brightness enhancement processing is performed on each first feature map to obtain the actual brightness enhancement image of each first sub-feature map. If the average brightness of the target object in the normal illumination sample image corresponding to the enhanced image is less than the average brightness of the background, then according to the second brightness threshold, the average brightness enhancement processing is performed on each first sub-feature map to obtain the actual brightness enhancement image of each first sub-feature map. For each second sub-feature map of type background in the enhanced image, the average brightness enhancement processing is performed on each second sub-feature map according to the third brightness threshold to obtain the actual brightness enhancement image of each second sub-feature map. Based on the actual brightness enhancement images of each first sub-feature map and each second sub-feature map, the actual brightness enhancement image corresponding to the enhanced image is obtained.
[0161] Optionally, the training module 400 is specifically used to determine the actual brightness value of each first sub-feature map and the actual brightness value of each second sub-feature map based on the actual brightness enhancement images of each first sub-feature map and the actual brightness enhancement images of each second sub-feature map. The first brightness loss is determined based on the actual brightness value of each first sub-feature map and the brightness threshold corresponding to the target sub-feature map; the brightness threshold corresponding to the target sub-feature map is either the first brightness threshold or the second brightness threshold. The second brightness loss is determined based on the actual brightness value of each second sub-feature map and the brightness threshold corresponding to the background sub-feature map; the brightness threshold corresponding to the background sub-feature map is the third brightness threshold. Based on the first brightness loss and the second brightness loss, the second loss information is obtained.
[0162] Optionally, the training module 400 is specifically used to input the enhanced image corresponding to each low-light sample image and the normal-light sample image corresponding to each low-light sample image into a pre-trained classification network, so that the classification network can identify and extract the feature information of each enhanced image and the feature information of each normal-light sample image. Based on the feature information of each enhanced image and the feature information of the normal illumination sample image corresponding to each enhanced image, the image similarity between each enhanced image and the corresponding normal illumination sample image is determined. The first loss information is determined based on the image similarity between each enhanced image and the corresponding normal illumination sample image.
[0163] Optionally, the training module 400 is also used to: perform category labeling on each normal illumination sample image in the first training dataset to obtain a second training dataset; The classification network is trained based on the second training dataset.
[0164] Optionally, the acquisition module 100 is specifically used to acquire initial normal illumination sample images taken under normal lighting conditions; Color channel conversion is performed on each initial normal illumination sample image to obtain the sample grayscale image corresponding to each initial normal illumination sample image; The grayscale images of each sample are normalized to obtain the normal illumination sample images.
[0165] The above-described device is used to execute the method provided in the foregoing embodiments, and its implementation principle and technical effect are similar, so they will not be described again here.
[0166] These modules can be one or more integrated circuits configured to implement the above methods, such as one or more Application Specific Integrated Circuits (ASICs), one or more digital signal processors (DSPs), or one or more Field Programmable Gate Arrays (FPGAs). Alternatively, when a module is implemented using processing element scheduler code, the processing element can be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. Furthermore, these modules can be integrated together as a system-on-a-chip (SOC).
[0167] The modules described above can be connected or communicate with each other via wired or wireless connections. Wired connections can include metal cables, optical fibers, hybrid cables, or any combination thereof. Wireless connections can include connections via LAN, WAN, Bluetooth, ZigBee, or NFC, or any combination thereof. Two or more modules can be combined into a single module, and any module can be divided into two or more units. Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems and devices described above can be referred to the corresponding processes in the method embodiments, and will not be repeated here.
[0168] Figure 13 This is a schematic diagram of an electronic device provided in an embodiment of this application. The device may be a computing device with data processing capabilities.
[0169] The device includes a processor 801, a storage medium 802, and a bus 803. The storage medium 802 stores program instructions that can be executed by the processor 801. When the electronic device is running, the processor 801 communicates with the storage medium 802 through the bus 803. The processor 801 executes the program instructions to implement the training method of the image enhancement model as described in the embodiment.
[0170] Storage medium 802 is used to store programs, and processor 801 calls the programs stored in storage medium 802 to execute the above method embodiments. The specific implementation and technical effects are similar, and will not be described in detail here.
[0171] The storage medium 802 stores program code, which, when executed by the processor 801, causes the processor 801 to perform various steps in the image enhancement model method according to various exemplary embodiments of this application as described in the "Exemplary Methods" section above.
[0172] The processor 801 can be a general-purpose processor, such as a central processing unit (CPU), digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.
[0173] Storage medium 802, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. The storage medium can include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type storage medium, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic storage medium, magnetic disk, optical disk, etc. The storage medium is any other medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer, but is not limited thereto. In the embodiments of this application, storage medium 802 can also be a circuit or any other device capable of implementing storage functions for storing program instructions and / or data.
[0174] Optionally, this application also provides a program product, such as a computer-readable storage medium, including a program that, when executed by a processor, performs the above-described method embodiments.
[0175] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0176] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0177] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in a combination of hardware and software functional units.
[0178] The integrated units implemented as software functional units described above can be stored in a computer-readable storage medium. These software functional units, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
Claims
1. A training method for an image enhancement model, characterized in that, include: An initial image dataset is collected, which contains multiple normal illumination sample images, including images taken under normal lighting conditions that do not contain target objects and images that contain different types of target objects; Based on each normal illumination sample image in the initial image dataset, generate low illumination sample images corresponding to each normal illumination sample image, and generate a first training dataset based on each normal illumination sample image and the low illumination sample images corresponding to each normal illumination sample image. Based on the target objects in each normal illumination sample image, image mask extraction is performed to obtain the target mask information corresponding to each normal illumination sample image; An image enhancement model is trained based on the first training dataset and the target mask information corresponding to each normal illumination sample image.
2. The method according to claim 1, characterized in that, The step of generating low-light sample images corresponding to each normal-light sample image from the initial image dataset includes: The image brightness of each normal illumination sample image is adjusted to obtain the low illumination sample image corresponding to each normal illumination sample image.
3. The method according to claim 1, characterized in that, The step of extracting image masks based on the target objects in each normal illumination sample image to obtain the target mask information corresponding to each normal illumination sample image includes: An edge detection algorithm is used to identify and obtain the edge information of the target object from each normal illumination sample image; Based on the edge information of the target object in each normal illumination sample image, determine the first mask region corresponding to the target object and the second mask region corresponding to the non-target object in each normal illumination sample image; Based on the first mask region and the second mask region corresponding to each normal illumination sample image, the target mask information corresponding to each normal illumination sample image is generated.
4. The method according to claim 1, characterized in that, The step of training an image enhancement model based on the first training dataset and the target mask information corresponding to each normal illumination sample image includes: The first training dataset is input into the initial image enhancement model, and the initial image enhancement model performs image enhancement processing on the low-light sample images corresponding to each normal illumination sample image to obtain the enhanced image corresponding to each low-light sample image. Based on the enhanced image corresponding to each low-light sample image, the target mask information corresponding to each normal-light sample image, and the target brightness enhancement information, the brightness of each enhanced image is enhanced to obtain the actual brightness enhancement image corresponding to each enhanced image. Based on the enhanced image corresponding to each low-light sample image and the normal-light sample image corresponding to each low-light sample image, the first loss information of the initial image enhancement model is determined; Based on the actual brightness enhancement image corresponding to each enhanced image and the target brightness enhancement information, the second loss information of the initial image enhancement model is determined; Based on the first loss information and the second loss information of the initial image enhancement model, the target loss information of the initial image enhancement model is determined, and the initial image enhancement model is iteratively optimized based on the target loss information until the target loss information meets the preset conditions. Then, training stops, and the image enhancement model at the time of training stop is taken as the image enhancement model.
5. The method according to claim 4, characterized in that, The step of enhancing the brightness of each enhanced image based on the enhanced image corresponding to each low-light sample image, the target mask information corresponding to each normal-light sample image, and the target brightness enhancement information, to obtain the actual brightness enhancement image corresponding to each enhanced image, includes: Each enhanced image is divided into multiple sub-feature maps corresponding to each enhanced image. Based on the target mask information corresponding to each normal illumination sample image, determine the target mask information corresponding to each enhanced image; Based on the target mask information corresponding to each enhanced image, the type of each sub-feature map corresponding to each enhanced image is determined, and the type is used to indicate whether the sub-feature map is a target sub-feature map or a background sub-feature map; Based on the type of each sub-feature map corresponding to each enhanced image, the comparison result of the average brightness of the target object and the average brightness of the background in the normal illumination sample image corresponding to each enhanced image, and the target brightness enhancement information, brightness enhancement processing is performed on each sub-feature map corresponding to each enhanced image to obtain the actual brightness enhancement image corresponding to each enhanced image; wherein, the target brightness enhancement information includes: different brightness thresholds.
6. The method according to claim 5, characterized in that, The step of determining the type of each sub-feature map corresponding to each enhanced image based on the target mask information corresponding to each enhanced image includes: Based on the target mask information corresponding to the enhanced image, determine the number of pixels belonging to the target object in the sub-feature map corresponding to the enhanced image; If the number of pixels belonging to the target object in the sub-feature map is greater than or equal to a preset number, then the type of the sub-feature map is determined to be a target sub-feature map; If the number of pixels belonging to the target object in the sub-feature map is less than the preset number, then the type of the sub-feature map is determined to be a background sub-feature map.
7. The method according to claim 5, characterized in that, The process involves performing brightness enhancement processing on each sub-feature map corresponding to each enhanced image based on the type of each sub-feature map corresponding to each enhanced image, the comparison result of the average brightness of the target object and the average brightness of the background in the normal illumination sample image corresponding to each enhanced image, and the target brightness enhancement information, to obtain the actual brightness enhancement image corresponding to each enhanced image, including: Based on the target mask information of the normal illumination sample image corresponding to the enhanced image, the average brightness of each pixel constituting the target object and the average brightness of each pixel constituting the background in the normal illumination sample image are determined. The average brightness of each pixel constituting the target object is taken as the average brightness of the target object in the normal illumination sample image corresponding to the enhanced image, and the average brightness of each pixel constituting the background is taken as the average brightness of the background in the normal illumination sample image corresponding to the enhanced image. For each first sub-feature map of type target sub-feature map in the enhanced image, if the average brightness of the target object in the normal illumination sample image corresponding to the enhanced image is greater than or equal to the average brightness of the background, then according to the first brightness threshold, the average brightness enhancement processing is performed on each first feature map to obtain the actual brightness enhancement image of each first sub-feature map. If the average brightness of the target object in the normal illumination sample image corresponding to the enhanced image is less than the average brightness of the background, then according to the second brightness threshold, the average brightness enhancement processing is performed on each first sub-feature map to obtain the actual brightness enhancement image of each first sub-feature map. For each second sub-feature map of type background in the enhanced image, the average brightness enhancement processing is performed on each second sub-feature map according to the third brightness threshold to obtain the actual brightness enhancement image of each second sub-feature map. Based on the actual brightness enhancement images of each first sub-feature map and each second sub-feature map, the actual brightness enhancement image corresponding to the enhanced image is obtained.
8. The method according to claim 7, characterized in that, The step of determining the second loss information of the initial image enhancement model based on the actual brightness enhancement image corresponding to each enhanced image and the target brightness enhancement information includes: Based on the actual brightness enhancement images of each first sub-feature image and each second sub-feature image, determine the actual brightness value of each first sub-feature image and the actual brightness value of each second sub-feature image respectively. The first brightness loss is determined based on the actual brightness value of each first sub-feature map and the brightness threshold corresponding to the target sub-feature map; the brightness threshold corresponding to the target sub-feature map is either the first brightness threshold or the second brightness threshold. The second brightness loss is determined based on the actual brightness value of each second sub-feature map and the brightness threshold corresponding to the background sub-feature map; the brightness threshold corresponding to the background sub-feature map is the third brightness threshold. The second loss information is obtained based on the first brightness loss and the second brightness loss.
9. The method according to claim 4, characterized in that, The step of determining the first loss information of the initial image enhancement model based on the enhanced image corresponding to each low-light sample image and the normal-light sample image corresponding to each low-light sample image includes: The enhanced images corresponding to each low-light sample image and the normal-light sample images corresponding to each low-light sample image are input into a pre-trained classification network, which identifies and extracts the feature information of each enhanced image and the feature information of each normal-light sample image. Based on the feature information of each enhanced image and the feature information of the normal illumination sample image corresponding to each enhanced image, the image similarity between each enhanced image and the corresponding normal illumination sample image is determined. The first loss information is determined based on the image similarity between each enhanced image and the corresponding normal illumination sample image.
10. The method according to claim 1, characterized in that, The initial image dataset acquired includes: Collect initial normal illumination sample images taken under normal lighting conditions; Color channel conversion is performed on each initial normal illumination sample image to obtain the sample grayscale image corresponding to each initial normal illumination sample image; The grayscale images of each sample are normalized to obtain the normal illumination sample images.
11. A training device for an image enhancement model, characterized in that, include: The module includes a data acquisition module, a generation module, a processing module, and a training module. The acquisition module is used to acquire an initial image dataset, which includes multiple normal illumination sample images, including images taken under normal lighting conditions that do not contain target objects and images that contain different types of target objects; The generation module is used to generate low-light sample images corresponding to each normal illumination sample image based on each normal illumination sample image in the initial image dataset, and to generate a first training dataset based on each normal illumination sample image and the low-light sample images corresponding to each normal illumination sample image. The processing module is used to extract image masks based on the target objects in each normal illumination sample image to obtain the target mask information corresponding to each normal illumination sample image. The training module is used to train an image enhancement model based on the first training dataset and the target mask information corresponding to each normal illumination sample image.
12. An electronic device, characterized in that, include: The device includes a processor, a storage medium, and a bus. The storage medium stores program instructions executable by the processor. When the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the program instructions to implement the training method of the image enhancement model as described in any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which is executed by a processor to implement the training method of the image enhancement model as described in any one of claims 1 to 10.