Image enhancement method, image enhancement device, electronic device, and storage medium
By performing feature extraction, grayscale attribute enhancement, and brightness contrast encoding and decoding on low-light images, the problems of noise and color distortion in low-light image enhancement are solved, achieving higher image enhancement accuracy and recognition performance.
Patent Information
- Application Number
- CN202411530817.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-29
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2044-10-29
AI Technical Summary
Existing image enhancement methods cannot effectively improve the accuracy of low-light images and suffer from serious noise and color distortion problems.
By obtaining sample data, the feature extraction layer of the preset enhancement model is used to extract features, the image grayscale attributes are enhanced, and combined with brightness and contrast enhancement, the image encoding layer and decoding layer are used to generate enhanced features. Finally, the model parameters are adjusted based on the model loss value to generate the target enhanced image.
The enhancement accuracy of low-light images is improved, noise and color distortion are avoided, and image recognition performance is improved.
Smart Images

Figure CN119295359B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology and is applicable to the field of financial technology, and in particular to an image enhancement method and image enhancement device, electronic device, and storage medium. Background Art
[0002] Image enhancement refers to technology that improves the visual quality of images, making them more suitable for human observation or machine analysis and processing. For example, in the insurance sector of FinTech, when a claimant activates an automated vehicle damage claims system, they can upload images of the damaged vehicle. The automated claims system then uses the images to determine the damage and conduct a claim assessment. However, due to low-light conditions such as at night or in backlit conditions, low-light images captured by mobile phones often suffer from quality degradation issues such as underexposure, loss of detail, color distortion, or blurring, resulting in insufficient image quality for the captured images of damaged vehicles. Therefore, by performing image enhancement on uploaded damaged vehicle images, the accuracy of the vehicle damage assessment can be ensured.
[0003] However, current image enhancement methods can only enhance low-light images that are free of noise. By simply increasing image contrast or brightness, they still suffer from severe noise and color distortion, resulting in poor image enhancement results. Therefore, improving the accuracy of image enhancement for low-light images while avoiding severe noise and color distortion has become a pressing technical challenge. Summary of the Invention
[0004] The main purpose of the embodiments of the present application is to propose an image enhancement method and an image enhancement device, an electronic device, and a storage medium, aiming to improve the enhancement accuracy of low-light images, avoid severe noise and color distortion, and thus improve the recognition performance of enhanced images.
[0005] To achieve the above objectives, a first aspect of an embodiment of the present application provides an image enhancement method, the method comprising:
[0006] Acquire sample data, where the sample data includes a sample original illumination map and a sample normal illumination map, where the sample original illumination map is an image containing the sample object captured under low illumination, and the sample normal illumination map is an image containing the sample object captured under normal illumination;
[0007] Performing feature extraction on the sample original illumination map based on a feature extraction layer of a preset enhancement model to obtain the sample low-illumination image features;
[0008] Performing image grayscale attribute enhancement on the sample original illumination image to obtain a sample brightness enhancement image and a sample contrast enhancement image;
[0009] Performing image encoding on the sample brightness enhancement map and the sample contrast enhancement map based on the image encoding layer of the preset enhancement model to obtain a sample enhancement feature;
[0010] Performing image decoding on the sample enhancement feature and the sample low-illumination image feature based on the decoding layer of the preset enhancement model to obtain a sample enhancement map;
[0011] Determining a model loss value based on the sample original illumination map, the sample normal illumination map, and the sample enhanced map, and adjusting parameters of the preset enhancement model based on the model loss value to obtain an image enhancement model;
[0012] The target image is enhanced based on the image enhancement model to obtain a target enhanced image.
[0013] In some embodiments, the feature extraction layer based on the preset enhancement model extracts features from the sample original illumination map to obtain sample low-illumination image features, including:
[0014] Performing image decomposition on the sample original illumination image to obtain a sample reflection image and a sample illumination image;
[0015] Based on the feature extraction layer, feature extraction is performed on the sample reflection image and the sample original illumination image to obtain the sample low-illumination image feature.
[0016] In some embodiments, determining the model loss value based on the sample original illumination map, the sample normal illumination map, and the sample enhancement map includes:
[0017] Performing visual feature loss calculation based on the sample normal illumination map and the sample enhanced map to obtain a visual feature loss value;
[0018] Performing image decomposition loss calculation based on the sample original illumination map, the sample reflection map, and the sample illumination map to obtain an image decomposition loss value;
[0019] Performing image decomposition on the sample enhancement image to obtain a sample enhanced reflection image;
[0020] Performing image grayscale attribute loss calculation based on the sample enhanced reflection map, the sample enhanced map, and the sample normal illumination map to obtain an image grayscale attribute loss value;
[0021] The visual feature loss value, the image decomposition loss value and the image grayscale attribute loss value are weighted and calculated to obtain the model loss value.
[0022] In some embodiments, the performing visual feature loss calculation based on the sample normal illumination map and the sample enhanced map to obtain a visual feature loss value includes:
[0023] Performing color loss calculation on the sample normal illumination image and the sample enhanced image based on a preset color loss function to obtain an image color loss value;
[0024] Performing texture loss calculation on the sample normal illumination image and the sample enhanced image based on a preset texture loss function to obtain an image texture loss value;
[0025] Performing content loss calculation on the sample normal illumination image and the sample enhanced image based on a preset content loss function to obtain an image content loss value;
[0026] A weighted sum calculation is performed on the image color loss value, the image texture loss value, and the image content loss value to obtain a visual feature loss value.
[0027] In some embodiments, the performing of image grayscale attribute loss calculation based on the sample enhanced reflection map, the sample enhanced map, and the sample normal illumination map to obtain the image grayscale attribute loss value includes:
[0028] Based on preset three-channel weights and a preset brightness value, a color enhancement loss calculation is performed on the sample enhanced reflection map and the sample normal illumination map to obtain a color enhancement loss value; wherein the preset brightness value is used to indicate the degree of enhancement of the brightness attribute;
[0029] Performing image contrast loss calculation based on the sample enhancement image and the sample normal illumination image to obtain an image contrast loss value;
[0030] A weighted sum calculation is performed on the color enhancement loss value and the image contrast loss value to obtain the image grayscale attribute loss value.
[0031] In some embodiments, the image coding layer based on the preset enhancement model performs image coding on the sample brightness enhancement map and the sample contrast enhancement map to obtain sample enhancement features, including:
[0032] Performing image encoding on the sample brightness enhancement image to obtain a brightness enhancement feature;
[0033] Performing image encoding on the sample contrast enhancement image to obtain a contrast enhancement feature;
[0034] Performing feature splicing on the brightness enhancement feature and the contrast enhancement feature to obtain a sample splicing feature;
[0035] Feature extraction is performed on the sample splicing features to obtain the sample enhancement features.
[0036] In some embodiments, the performing feature stitching on the brightness enhancement feature and the contrast enhancement feature to obtain a sample stitching feature includes:
[0037] Obtaining a detection accuracy of the sample target based on the target type of the sample target;
[0038] determining enhancement parameters based on the target type and the detection accuracy, the enhancement parameters comprising a brightness enhancement weight of the brightness enhancement feature and a contrast enhancement weight of the contrast enhancement feature;
[0039] Feature weighted splicing is performed based on the brightness enhancement feature, the brightness enhancement weight, the contrast enhancement feature, and the contrast enhancement weight to obtain the sample splicing feature.
[0040] To achieve the above-mentioned purpose, a second aspect of an embodiment of the present application provides an image enhancement device, comprising:
[0041] an acquisition module, configured to acquire sample data, wherein the sample data includes a sample original illumination map and a sample normal illumination map, wherein the sample original illumination map is an image containing the sample object captured under low illumination, and the sample normal illumination map is an image containing the sample object captured under normal illumination;
[0042] An extraction module is used to extract features from the sample original illumination image based on a feature extraction layer of a preset enhancement model to obtain features of the sample low-illumination image;
[0043] An attribute enhancement module is used to enhance the image grayscale attributes of the sample original illumination map to obtain a sample brightness enhancement map and a sample contrast enhancement map;
[0044] an encoding module, configured to perform image encoding on the sample brightness enhancement map and the sample contrast enhancement map based on the image encoding layer of the preset enhancement model to obtain a sample enhancement feature;
[0045] A decoding module, configured to perform image decoding on the sample enhancement feature and the sample low-illumination image feature based on a decoding layer of the preset enhancement model to obtain a sample enhancement map;
[0046] a training module, configured to determine a model loss value based on the sample original illumination map, the sample normal illumination map, and the sample enhanced map, and adjust parameters of the preset enhancement model based on the model loss value to obtain an image enhancement model;
[0047] The image enhancement module is used to perform image enhancement on the target image based on the image enhancement model to obtain a target enhanced image.
[0048] To achieve the above-mentioned purpose, the third aspect of an embodiment of the present application proposes an electronic device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the method described in the first aspect when executing the computer program.
[0049] To achieve the above-mentioned purpose, the fourth aspect of the embodiments of the present application proposes a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the method described in the first aspect.
[0050] The present application proposes an image enhancement method, an image enhancement device, an electronic device, and a storage medium. The method obtains sample data, wherein the sample data includes a sample original illumination map and a sample normal illumination map. The sample original illumination map is an image containing a sample object captured under low illumination, and the sample normal illumination map is an image containing a sample object captured under normal illumination. Further, a feature extraction layer based on a preset enhancement model performs feature extraction on the sample original illumination map to obtain sample low-illumination image features. Image grayscale attribute enhancement is performed on the sample original illumination map to obtain a sample brightness enhancement map and a sample contrast enhancement map. Further, an image encoding layer based on a preset enhancement model performs image encoding on the sample brightness enhancement map and the sample contrast enhancement map to obtain sample enhancement features. Further, a decoding layer based on a preset enhancement model performs image decoding on the sample enhancement features and the sample low-illumination image features to obtain a sample enhancement map. Further, a model loss value is determined based on the sample original illumination map, the sample normal illumination map, and the sample enhancement map, and parameters of the preset enhancement model are adjusted based on the model loss value to obtain an image enhancement model. Finally, image enhancement is performed on the target image based on the image enhancement model to obtain a target enhanced image. Compared to related technologies that can only enhance low-light images without noise, and simply by increasing image contrast or brightness, the embodiments of the present application simultaneously consider the image's brightness enhancement map and contrast enhancement map when enhancing the image, which can enhance the learning of the detailed brightness and contrast features of the low-light image. In this way, the generated enhanced image can retain both the essential attributes of the image and the light-dark contrast. Therefore, the embodiments of the present application can improve the enhancement accuracy of low-light images, avoid severe noise and color distortion, and thus improve the recognition performance of the enhanced image. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 is a flow chart of the image enhancement method provided in an embodiment of the present application;
[0052] Figure 2 yes Figure 1 A flowchart of step S120 in FIG.
[0053] Figure 3 yes Figure 1 A flowchart of step S140 in FIG.
[0054] Figure 4 yes Figure 3 A flowchart of step S330 in FIG.
[0055] Figure 5 yes Figure 1 A flowchart of step S160 in FIG.
[0056] Figure 6 yes Figure 5 A flowchart of step S510 in FIG.
[0057] Figure 7 yes Figure 5 A flowchart of step S540 in FIG.
[0058] Figure 8 This is a flow chart of image enhancement based on an image enhancement model provided in an embodiment of the present application;
[0059] Figure 9 is a structural schematic diagram of an image enhancement device provided in an embodiment of the present application;
[0060] Figure 10 This is a hardware structure diagram of the electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0061] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0062] It should be noted that although the device schematics illustrate functional module divisions and the flowcharts illustrate logical sequences, in certain circumstances, the steps shown or described may be performed in a sequence that differs from the module divisions in the device or the sequence in the flowcharts. The terms "first," "second," and so on, in the specification, claims, and drawings, are used to distinguish similar items and are not necessarily used to describe a specific sequence or precedence.
[0063] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.
[0064] First, let’s analyze some of the terms used in this application:
[0065] Artificial Intelligence (AI) is a new technical discipline that studies and develops theories, methods, technologies, and application systems for simulating, extending, and expanding human intelligence. A branch of computer science, AI seeks to understand the essence of intelligence and create new intelligent machines that can respond in a manner similar to human intelligence. Research in this field includes robotics, speech recognition, image recognition, natural language processing, and expert systems. AI can simulate the information processes of human consciousness and thinking. It also encompasses theories, methods, technologies, and application systems that use digital computers or digital computer-controlled machines to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results.
[0066] Image decomposition refers to the process of breaking down an image into several components or parts, which are then used to describe the different characteristics or attributes of the image. The purpose of image decomposition is to represent the information of the original image in a form that is easier to process or analyze, so as to facilitate further processing or analysis. Types of image decomposition include: color space decomposition (i.e., decomposing the pixel values of an image into different color channels according to a color space (such as RGB, HSV, Lab, etc.), with each channel representing a color component of the image); frequency domain decomposition (i.e., decomposing an image into different frequency components using methods such as Fourier transform); spatial domain decomposition (i.e., decomposing an image into components of different spatial scales, such as decomposing it into sub-band images of different resolutions using wavelet transform); and illumination and reflectance decomposition (as done by the Retinex algorithm, which decomposes an image into illumination components and reflectance components, where the illumination component describes the illumination distribution in the image and the reflectance component describes the reflective properties of the object's surface).
[0067] Retinex image decomposition is a technique that decomposes an image into two main components: illumination (such as the illumination map in the following example) and reflectance (such as the reflectance map in the following example). This decomposition simulates the human eye's perception of changing illumination and aims to improve image brightness and contrast, especially in low-light conditions.
[0068] The Gaussian Blur Operator is a commonly used blurring technique in image processing and computer vision. It uses a Gaussian function to reduce image noise and detail, thereby blurring the image. Gaussian blur smoothes the image by taking a weighted average of the pixel values within a neighborhood, with the weights determined by a Gaussian distribution.
[0069] Image enhancement refers to technology that improves the visual quality of images, making them more suitable for human observation or machine analysis and processing. For example, in the insurance sector of FinTech, when a claimant activates an automated vehicle damage claims system, they can upload images of the damaged vehicle. The automated claims system then uses the images to determine the damage and conduct a claim assessment. However, due to low-light conditions such as at night or in backlit conditions, low-light images captured by mobile phones often suffer from quality degradation issues such as underexposure, loss of detail, color distortion, or blurring, resulting in insufficient image quality for the captured images of damaged vehicles. Therefore, by performing image enhancement on uploaded damaged vehicle images, the accuracy of the vehicle damage assessment can be ensured.
[0070] However, current image enhancement methods can only enhance low-light images that are free of noise. By simply increasing image contrast or brightness, they still suffer from severe noise and color distortion, resulting in poor image enhancement results. Therefore, improving the accuracy of image enhancement for low-light images while avoiding severe noise and color distortion has become a pressing technical challenge.
[0071] Based on this, the embodiments of the present application provide an image enhancement method and an image enhancement device, an electronic device, and a storage medium, aiming to improve the accuracy of image enhancement of low-light images, avoid severe noise and color distortion, and thus improve the recognition performance of enhanced images.
[0072] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to achieve optimal results.
[0073] Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0074] The image enhancement method provided in the embodiment of the present application relates to the field of artificial intelligence technology. The image enhancement method provided in the embodiment of the present application can be applied to a terminal, can be applied to a server side, or can be software running in a terminal or a server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or as a server cluster or distributed system composed of multiple physical servers, or as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application that implements the image enhancement method, etc., but is not limited to the above forms.
[0075] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, and the like. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments in which tasks are performed by remote processing devices connected via a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media, including storage devices.
[0076] It should be noted that in each specific embodiment of the present application, when it comes to the need to perform relevant processing based on data related to the identity or characteristics of the object, such as object feedback data, object item data, etc., the permission or consent of the object will be obtained first, and the collection, use and processing of such data will comply with relevant laws, regulations and standards. In addition, when the embodiment of the present application needs to obtain the sensitive personal information of the object, the separate permission or consent of the object will be obtained through a pop-up window or by jumping to a confirmation page. After clearly obtaining the separate permission or consent of the object, the necessary user-related data for the normal operation of the embodiment of the present application will be obtained.
[0077] See also Figure 1 , Figure 1 This is an optional flow chart of the image enhancement method provided in the embodiment of the present application. In some embodiments of the present application, Figure 1 The method may specifically include but is not limited to steps S110 to S170.
[0078] Step S110, obtaining sample data;
[0079] Step S120, extracting features from the sample original illumination image based on the feature extraction layer of the preset enhancement model to obtain the sample low-illumination image features;
[0080] Step S130, performing image grayscale attribute enhancement on the sample original illumination map to obtain a sample brightness enhancement map and a sample contrast enhancement map;
[0081] Step S140, performing image encoding on the sample brightness enhancement map and the sample contrast enhancement map based on the image encoding layer of the preset enhancement model to obtain sample enhancement features;
[0082] Step S150, performing image decoding on the sample enhancement features and the sample low-light image features based on the decoding layer of the preset enhancement model to obtain a sample enhancement map;
[0083] Step S160, determining a model loss value based on the sample original illumination map, the sample normal illumination map, and the sample enhanced map, and adjusting parameters of a preset enhancement model based on the model loss value to obtain an image enhancement model;
[0084] Step S170: performing image enhancement on the target image based on the image enhancement model to obtain a target enhanced image.
[0085] Compared to related technologies that can only perform image enhancement on some low-light images without noise, and only by increasing the contrast or brightness of the image, steps S110 to S170 of the present application will simultaneously consider the brightness enhancement map and contrast enhancement map of the image when enhancing the image, which can strengthen the learning of the detailed brightness and contrast features of the low-light image, and at the same time enhance the image in combination with the backbone network. In this way, the generated enhanced image can retain both the essential attributes of the image and the light-dark contrast. Therefore, the embodiment of the present application can improve the enhancement accuracy of low-light images, avoid severe noise and color distortion, and thus improve the recognition performance of the enhanced image.
[0086] In step S110 of some embodiments, a training sample set is obtained, which is used to train an image enhancement model. The training sample set includes multiple sample data, and each sample data includes a pair of sample original illumination maps and sample normal illumination maps. The sample original illumination map is an image containing the sample object captured under low illumination, and the sample normal illumination map is an image containing the sample object captured under normal illumination. The sample normal illumination map and the sample original illumination map have the same image content, representing images captured under different illumination conditions, and the sample normal illumination map can serve as a reference label for the sample original illumination map.
[0087] It should be noted that the original illumination map of the sample is equivalent to an image captured under low-light conditions, such as at night, indoors, and other weak-light or backlit conditions. In low-light conditions, image acquisition will have some disadvantages, such as increased image noise (the camera's photosensitive element may increase its sensitivity (ISO value), which will increase image noise and affect image quality), underexposure, color distortion, reduced dynamic range (that is, in insufficient light, the dynamic range of the image (that is, the details of the brightest and darkest parts of the image) will be reduced, resulting in overexposure of highlights or loss of details in shadows), and difficulty in focusing (that is, in low-light environments, the autofocus system may find it difficult to focus accurately, resulting in blurred images). Although low-light images can be improved by using larger apertures, slower shutter speeds, and increasing ISO values, image enhancement algorithms can significantly improve the visibility and quality of images without increasing hardware costs.
[0088] In step S120 of some embodiments, during the model training process, the present application may input the sample original illumination map into a preset enhancement model, which may be a model constructed based on a convolutional neural network model, a machine learning model, or the like, without specific limitation. The preset enhancement model may include a feature extraction layer, an image encoding layer, and a decoding layer. Furthermore, the feature extraction layer in the preset enhancement model may be used to perform feature extraction on the sample original illumination map taken under low illumination conditions. The obtained sample low illumination image features can represent key information in the sample original illumination map, such as texture, contour, etc., which is helpful for the subsequent image enhancement process.
[0089] See also Figure 2 , Figure 2 This is a specific flow chart of step S120 provided in an embodiment of the present application. In some embodiments of the present application, step S120 may specifically include but is not limited to steps S210 to S220.
[0090] Step S210, performing image decomposition on the sample original illumination map to obtain a sample reflection map and a sample illumination map;
[0091] Step S220 , performing feature extraction on the sample reflection image and the sample original illumination image based on the feature extraction layer to obtain the sample low-illumination image features.
[0092] In step S210 of some embodiments, in order to better learn the detailed features of the low-light image, the present application may first perform image decomposition on the sample original illumination image to obtain a sample reflection image and a sample illumination image. The sample reflection image can reflect the color and material information of the image and can remain relatively unchanged under different lighting conditions, so it is also called the true color image. The sample illumination image (also known as a brightness image, highlight image, etc.) can reflect the lighting conditions of the image and can also reflect the brightness distribution of the image.
[0093] It should be noted that the image decomposition of the present application can adopt the Retinex image decomposition algorithm, that is, the image can be decomposed into two independent components: the reflection component (Reflectance) and the illumination component (Illumination). In this way, the image in any scene can be expressed as the product of the reflection component and the illumination component of the object. In other words, the final color and brightness of the image can be jointly determined by the color of the object surface (reflection component) and the light irradiated on the object (illumination component). In addition, the present application can also adopt other image decomposition algorithms, such as Fourier Transform (Fourier Transform), Wavelet Transform (Wavelet Transform), etc., without specific limitation.
[0094] In step S220 of some embodiments, feature extraction can further be performed on the sample reflectance map and the sample original illumination map based on the feature extraction layer to obtain sample low-light image features. The sample low-light image features are extracted from the sample reflectance map and the sample original illumination map, and contain both key information such as texture and contour, as well as detailed information such as color distribution. The feature extraction layer is typically composed of a series of convolutional layers, which can extract useful features from the image. By extracting these features, the system can better understand the content of the image and use this information to enhance the image in subsequent steps.
[0095] It should be noted that the specific process of extracting features from the sample reflectance map and the sample original illumination map based on the feature extraction layer to obtain the sample low-light image features may include: image encoding the sample reflectance map to obtain the reflectance map encoding features; image encoding the sample original illumination map to obtain the original illumination map encoding features; and feature fusion of the reflectance map encoding features and the original illumination map encoding features to obtain the sample low-light image features. Feature fusion refers to adding feature maps extracted from different images to preserve image information at different levels and enhance semantic information and spatial details.
[0096] It should be noted that, in other embodiments, the present application can also perform feature extraction on the sample reflection map, the sample illumination map and the sample original illumination map based on the feature extraction layer to obtain the sample low-light image features, that is, the sample low-light image features at this time refer to the image features that integrate the features of the sample reflection map, the sample illumination map and the sample original illumination map, and the specific extraction process can be referred to the above steps and will not be repeated here.
[0097] In step S130 of some embodiments, since it is difficult to accurately estimate the scene brightness and contrast by only extracting the features of the sample original illumination map, the embodiment of the present application also performs image grayscale attribute enhancement on the sample original illumination map to obtain a sample brightness enhancement map and a sample contrast enhancement map, and combines the sample brightness enhancement map, the sample contrast enhancement map, the sample reflection map, the sample illumination map and the sample original illumination map. Figure 1 It is used to enhance the image of the original illumination map of the sample.
[0098] It should be noted that the image grayscale attributes of the present application include brightness and contrast. Brightness and contrast are different. Brightness is the degree of brightness of light, and contrast is the difference between different colors. People perceive the two differently, and the methods of enhancing the two are also different. The image grayscale attribute enhancement of the present application includes the adjustment of brightness and contrast. The brightness enhancement map is intended to increase the overall brightness of the image, while the contrast enhancement map is intended to enhance the contrast between different areas in the image to make the image details clearer. For example, the image brightness of the sample original illumination map can be enhanced by histogram equalization to obtain a sample brightness enhancement map. The image contrast of the sample original illumination map can be enhanced by linear transformation to obtain a sample contrast enhancement map. In addition, the present application can also use other methods to enhance the image brightness of the illumination map, such as gamma correction, linear transformation, etc., and can also use other methods to enhance the image contrast of the illumination map, such as adaptive histogram equalization, multi-scale contrast enhancement, etc., which are not specifically limited here.
[0099] In step S140 of some embodiments, the present application may further use the coding layer of the preset enhancement model to perform image encoding on the sample brightness enhancement map and the sample contrast enhancement map respectively to extract more significant sample enhancement features for further processing and enhancement of the image.
[0100] See also Figure 3 , Figure 3 This is a specific flow chart of step S140 provided in an embodiment of the present application. In some embodiments of the present application, step S140 may specifically include but is not limited to steps S310 to S340.
[0101] Step S310, performing image encoding on the sample brightness enhancement image to obtain brightness enhancement features;
[0102] Step S320, performing image encoding on the sample contrast enhancement image to obtain contrast enhancement features;
[0103] Step S330, performing feature splicing on the brightness enhancement feature and the contrast enhancement feature to obtain a sample splicing feature;
[0104] Step S340: extract the sample splicing features to obtain sample enhancement features.
[0105] In steps S310 to S340 of some embodiments, the purpose of image encoding is to convert image data into a set of features that can represent the brightness, contrast information, etc. of the image. The present application can improve the visual differences between different areas in the image and make the details more obvious by encoding the sample brightness enhancement map and the sample contrast enhancement map respectively, and the encoding process converts these visual differences into numerical features to provide a basis for subsequent analysis. Furthermore, the brightness enhancement features and the contrast enhancement features are merged or spliced together. This splicing can be a simple data-level merging or a fusion based on a certain algorithm, the purpose of which is to integrate the information contained in the two features into a unified feature representation. Finally, the spliced features are further extracted and processed, that is, a machine learning algorithm (such as a deep learning model) can be used to learn more abstract and representative features from the sample splicing features to obtain sample enhancement features that can better represent the important information of the image after brightness and contrast enhancement.
[0106] In the above embodiment, the present application performs image encoding on the image after the image grayscale attribute enhancement of the original illumination map of the sample, extracts features that can represent the image enhancement effect, and uses these features for subsequent image analysis or machine learning tasks, which can improve the accuracy of image enhancement of low-light images, avoid serious noise and color distortion, and thus improve the recognition performance of enhanced images.
[0107] See also Figure 4 , Figure 4 This is a specific flow chart of step S330 provided in an embodiment of the present application. In some embodiments of the present application, step S330 may specifically include but is not limited to steps S410 to S430.
[0108] Step S410, obtaining the detection accuracy of the sample target based on the target type of the sample target;
[0109] Step S420, determining enhancement parameters based on target type and detection accuracy;
[0110] Step S430 , performing feature weighted splicing based on the brightness enhancement feature, the brightness enhancement weight, the contrast enhancement feature, and the contrast enhancement weight to obtain a sample splicing feature.
[0111] In step S410 of some embodiments, the sample original illumination map may include a sample target to be detected. For example, in the insurance field of FinTech, the sample original illumination map may be a vehicle damage image. The sample target in the sample original illumination map may be the entire claim-claimed vehicle or a local detail of the claim-claimed vehicle (such as a door, trunk, etc.). Therefore, the present application can obtain the detection accuracy of the target in the target detection task based on the target type of the sample target. For example, the detection accuracy of the rearview mirror of the claim-claimed vehicle is higher when the sample target is the entire claim-claimed vehicle compared to the rearview mirror of the claim-claimed vehicle.
[0112] In step S420 of some embodiments, the present application may further determine enhancement parameters based on the target type and detection accuracy, wherein the enhancement parameters include a brightness enhancement weight for the brightness enhancement feature and a contrast enhancement weight for the contrast enhancement feature. These weights are used to adjust the degree of brightness and contrast enhancement to optimize image quality and improve the accuracy of target detection. For example, if the detection accuracy of a certain target type is low, the system may increase the weight of brightness or contrast enhancement to improve the detectability of the target.
[0113] In step S430 of some embodiments, the present application may further combine the brightness enhancement features and contrast enhancement features, as well as their respective weights, to perform feature weighted splicing. This means that the brightness enhancement features and contrast enhancement features are not simply merged, but are integrated based on their corresponding weights to generate a more comprehensive sample splicing feature. This ensures that the contributions of different enhancement features are balanced and optimized in the final feature representation.
[0114] In the above embodiments, the present application can dynamically adjust the image enhancement strategy according to the target type and detection accuracy of the sample target in the sample original illumination image, in order to improve the performance of target detection.
[0115] In step S150 of some embodiments, the present application may further utilize the decoding layer of the preset enhancement model to combine the extracted sample enhancement features with the original low-light image features, perform image decoding, and generate an enhanced sample enhancement map. This sample enhancement map is the image effect under normal lighting conditions simulated by the model.
[0116] It should be noted that the present application performs image decoding on the sample enhancement features and the sample low-illumination image features based on the decoding layer of the preset enhancement model to obtain a sample enhancement map, which may specifically include: feature fusion of the sample enhancement features and the sample low-illumination image features to obtain the sample target enhancement features; image decoding of the sample target enhancement features based on the decoding layer to obtain a sample enhancement map.
[0117] It should be noted that the decoding layer of this application can be constructed based on the UNet network model or other CNN models, without limitation.
[0118] In some embodiments, step S160 further determines a model loss value based on the sample original illumination map, the sample normal illumination map, and the sample enhanced map, and adjusts parameters of the preset enhancement model based on the model loss value to obtain an image enhancement model. This model loss value can reflect the performance of the preset enhancement model, that is, the difference between the current performance of the model and the ideal state, so as to optimize the model performance and obtain an image enhancement model that can better improve the accuracy of image enhancement for low-light images.
[0119] It should be noted that the sample reflection map and sample illumination map of the present application are normalized RGB pixel maps obtained by image decomposition of the original illumination map of the sample.
[0120] See also Figure 5 , Figure 5 This is a specific flow chart of step S160 provided in an embodiment of the present application. In some embodiments of the present application, step S160 may specifically include but is not limited to steps S510 to S550.
[0121] Step S510, performing visual feature loss calculation based on the sample normal illumination image and the sample enhanced image to obtain a visual feature loss value;
[0122] Step S520 , performing image decomposition loss calculation based on the sample original illumination map, the sample reflection map, and the sample illumination map to obtain an image decomposition loss value;
[0123] Step S530, performing image decomposition on the sample enhancement image to obtain a sample enhanced reflection image;
[0124] Step S540, performing image grayscale attribute loss calculation based on the sample enhanced reflection image, the sample enhanced image, and the sample normal illumination image to obtain an image grayscale attribute loss value;
[0125] Step S550 , performing weighted sum calculation on the visual feature loss value, the image decomposition loss value, and the image grayscale attribute loss value to obtain the model loss value.
[0126] In step S510 of some embodiments, to enhance an underexposed image, the present application may use a composite loss function comprising content, texture, and color to calculate a visual feature loss value to preserve image details. This composite loss function may serve as the loss function of the backbone network of the present application's image enhancement model.
[0127] See also Figure 6 , Figure 6 This is a specific flow chart of step S510 provided in an embodiment of the present application. In some embodiments of the present application, step S510 may specifically include but is not limited to steps S610 to S640.
[0128] Step S610, performing color loss calculation on the sample normal illumination image and the sample enhanced image based on a preset color loss function to obtain an image color loss value;
[0129] Step S620, performing texture loss calculation on the sample normal illumination image and the sample enhanced image based on a preset texture loss function to obtain an image texture loss value;
[0130] Step S630, performing content loss calculation on the sample normal illumination image and the sample enhanced image based on a preset content loss function to obtain an image content loss value;
[0131] Step S640 , performing weighted sum calculation on the image color loss value, the image texture loss value, and the image content loss value to obtain a visual feature loss value.
[0132] In step S610 of some embodiments, the present application may perform color loss calculation on the sample normal illumination image and the sample enhanced image based on a preset color loss function to obtain an image color loss value. The specific process of calculating the image color loss value may be as shown in the following formula 1:
[0133]
[0134] In formula 1, Represents the image color loss value, represents the sample enhancement map, Y represents the sample normal illumination map, and G(·) represents the Gaussian blur operator.
[0135] In step S620 of some embodiments, at the same time, the present application may perform texture loss calculation on the sample normal illumination map and the sample enhanced map based on a preset texture loss function to obtain an image texture loss value, and the specific process of calculating the image texture loss value can be shown in the following formula 2:
[0136]
[0137] In formula 2, Denotes the image texture loss value, D(·) denotes the discriminative convolutional neural network (CNN), and can be the last layer of the decoding layer of the present application, or a network structure set separately, without limitation. represents the sample enhancement map, and Y represents the sample normal illumination map.
[0138] In step S630 of some embodiments, the present application may also perform content loss calculation on the sample normal illumination image and the sample enhanced image based on a preset content loss function to obtain an image content loss value. The specific process of calculating the image content loss value may be as shown in the following formula 3:
[0139]
[0140] In formula 3, represents the image content loss value, ‖·‖2 represents the L2 norm of the vector (in mathematics, norm is a way to measure the size of a vector. Different norms give different "lengths" or "sizes" of the vector. The L2 norm (also known as the Euclidean norm) is defined as the square root of the sum of the squares of the vector elements).
[0141] In step S640 of some embodiments, the image color loss value, the image texture loss value, and the image content loss value may be further weighted and calculated to obtain a visual feature loss value. In this way, the specific process of calculating the visual feature loss value may be as shown in the following formula 4:
[0142]
[0143] In formula 4, α1 represents the image content loss value The weight of α2 represents the image texture loss value The weight of α3 represents the image color loss value The weights of L1 represent the visual feature loss value. For example, α1 is 1, α2 is 0.4, and α3 is 0.1. These weights represent the contribution of the corresponding loss values to the visual feature loss value.
[0144] In step S520 of some embodiments, because the product of the sample reflection map and the sample illumination map obtained by image decomposition (such as retinex decomposition, which is also a deep learning-based process) is not exactly the same as the sample original illumination map, the present application can also perform image decomposition loss calculation based on the sample original illumination map, the sample reflection map, and the sample illumination map to obtain the image decomposition loss value. Therefore, the specific process of calculating the image decomposition loss value can be shown in the following formula 5:
[0145]
[0146] In formula 5, L2 represents the image decomposition loss value, S represents the sample original illumination map, R represents the sample reflection map, and I represents the sample illumination map. represents the gradient, including horizontal and vertical directions, exp(·) represents the natural exponential function, ‖·‖1 represents the L1 norm of the vector (also known as the Manhattan distance, which is the sum of the absolute values of the vector components), λ1, λ2, λ3, and λ4 are weight parameters, indicating the contribution of the corresponding function to the calculation of the image decomposition loss value. They can be flexibly adjusted according to actual needs and are not specifically limited.
[0147] In step S530 of some embodiments, the present application may further decompose the enhanced image to obtain a sample enhanced reflectance map. The image decomposition method used for this decomposition has been described in the above embodiments and will not be repeated here. This step facilitates further analysis and evaluation of the quality of the enhanced image, as well as the impact of the enhancement process on the image's reflectance components.
[0148] In step S540 of some embodiments, the present application may also perform image grayscale attribute loss calculation based on the sample enhanced reflection map, the sample enhanced map, and the sample normal illumination map to obtain the image grayscale attribute loss value to standardize the brightness and contrast of the enhanced image.
[0149] See also Figure 7 , Figure 7 This is a specific flow chart of step S540 provided in an embodiment of the present application. In some embodiments of the present application, step S540 may specifically include but is not limited to steps S710 to S730.
[0150] Step S710, performing color enhancement loss calculation on the sample enhanced reflection image and the sample normal illumination image based on the preset three-channel weights and the preset brightness value to obtain a color enhancement loss value;
[0151] Step S720, performing image contrast loss calculation based on the sample enhanced image and the sample normal illumination image to obtain an image contrast loss value;
[0152] Step S730 , performing weighted sum calculation on the color enhancement loss value and the image contrast loss value to obtain the image grayscale attribute loss value.
[0153] In step S710 of some embodiments, the preset three-channel weights refer to preset enhancement weights corresponding to the RGB brightness attribute. The preset brightness value is used to indicate the degree of enhancement of the brightness attribute. Based on this, the specific process of calculating the color enhancement loss value can be seen in the following formulas 6 and 7:
[0154]
[0155] In formula 6, represents the color enhancement loss value, Represents the sample enhanced reflection map, Y R In Formula 7, X1 represents the input parameter of the function G, i represents the pixel number in the input parameter, n represents the total number of pixels in the input parameter, t represents the preset brightness value, and X1 iR Represents the R channel parameter in the RGB channel image of the sample normal illumination map, X1 iG Represents the G channel parameter in the RGB channel image of the sample normal illumination map, X1 iB Represents the B channel parameter in the RGB channel image of the sample normal illumination map. β1, β2, and β3 represent the weights corresponding to each channel parameter, which can be flexibly adjusted as needed. For example, β1 is 1, β2 is 1.5, and β3 is 0.6. K is a custom value determined based on the three weights of β1, β2, and β3. For example, when β1 is 1, β2 is 1.5, and β3 is 0.6, t is 2.2. Represents the weighted average of RGB channels.
[0156] In step S720 of some embodiments, the present application may also perform image contrast loss calculation based on the sample enhancement map and the sample normal illumination map to obtain an image contrast loss value. The specific process of calculating the image contrast loss value can be shown in the following formula 8:
[0157]
[0158] In formula 8, represents the image contrast loss value, represents the sample enhancement map, Y represents the sample normal illumination map, Where F(X2) is the sum of the color differences of the k nearest neighbors of the image, X2 represents the input parameter of the function F, k represents the number of neighboring points of pixel i in feature X2, n represents the total number of pixels in the input parameter, and X2 i Represents the i-th pixel in feature X2, X2 j Represents the jth neighboring point of pixel i in feature X2.
[0159] In step S730 of some embodiments, after obtaining the color enhancement loss value and the image contrast loss value, a weighted sum calculation may be performed on the two loss values. In this way, the specific process of obtaining the image grayscale attribute loss value can be shown in the following formula 9:
[0160]
[0161] In Formula 9, L3 represents the image grayscale attribute loss value, and γ1 represents the color enhancement loss value Corresponding weight, γ2 represents the image contrast loss value The corresponding weights are adjusted flexibly according to actual needs without specific limitations.
[0162] In the above embodiment, the present application calculates the grayscale attribute difference between the enhanced image and the image under normal lighting conditions based on the sample enhanced reflection image, the sample enhanced image and the sample normal lighting image, reflecting the accuracy and naturalness of the enhanced image in the grayscale level, that is, whether the enhanced image is close to the image under normal lighting conditions in brightness and contrast, which can improve the enhancement accuracy of low-light images and avoid serious noise and color distortion.
[0163] In step S550 of some embodiments, the present application may further perform a weighted sum calculation on the visual feature loss value L1, the image decomposition loss value L2, and the image grayscale attribute loss value L3. In this way, the specific process of calculating the model loss value can be shown in the following formula 10:
[0164] L = a·L1+b·L2+c·L3 (Formula 10)
[0165] In Formula 10, L represents the model loss value, a represents the weight corresponding to the visual feature loss value L1, b represents the weight corresponding to the image decomposition loss value L2, and c represents the weight corresponding to the image grayscale attribute loss value L3. These three weights can be flexibly adjusted according to actual needs without specific limitations.
[0166] Furthermore, the present application can perform iterative training based on the constructed model loss value L until the preset training end conditions of the model are reached, such as reaching a preset number of iterations or reaching a preset recognition accuracy, without limitation.
[0167] In the above embodiment, the present application can guide the model to learn how to improve the effect of low-light image enhancement by comprehensively evaluating different loss values, making it visually closer to the image under normal lighting conditions. It can help the model optimize its performance at multiple levels, improve the enhancement accuracy of low-light images, avoid severe noise and color distortion, and thus improve the recognition performance of enhanced images.
[0168] In step S170 of some embodiments, after the image enhancement model is trained, the present application can perform image enhancement on the target image input into the model based on the image enhancement model to obtain a target enhanced image. At this time, the obtained target enhanced image can retain both the essential attributes of the image and the light and dark contrast.
[0169] In some embodiments, see Figure 8 , Figure 8This is a flow chart of image enhancement based on the image enhancement model provided by the embodiment of the present application. The image enhancement model includes a feature extraction layer 810, a map encoding layer 820 and a decoding layer 830. The present application can enhance the grayscale attributes of the input target image to obtain a brightness enhancement map and a contrast enhancement map, and decompose the target image to obtain a target reflection map. Furthermore, the target image, target reflection map, brightness enhancement map and contrast enhancement map can be Figure 1 The image enhancement model is input to perform image enhancement. Specifically, based on the feature extraction layer 810, feature extraction can be performed on the target image and the target reflection map respectively to obtain the original image features and the target reflection map features, and the target image features and the target reflection map features can be fused to obtain the target image features. Based on the image coding layer 820, the brightness enhancement map and the contrast enhancement map can be image encoded respectively to obtain the brightness enhancement features and the target contrast enhancement features, and the features after the brightness enhancement features and the target contrast enhancement features are concatenated can be feature extracted to obtain the target enhancement features. Furthermore, the present application can perform feature fusion on the target image features and the target enhancement features based on the decoding layer 830, and perform image decoding on the fused features to obtain the target enhanced image.
[0170] It should be noted that the non-Company's software tools or components appearing in the embodiments of this application are merely examples and do not represent actual use.
[0171] Compared to related technologies that can only enhance some low-light images without noise, and only by increasing the contrast or brightness of the image, the image enhancement method provided in the embodiment of the present application will consider both the brightness enhancement map and the contrast enhancement map of the image when enhancing the image, which can enhance the learning of the detailed brightness and contrast features of the low-light image. And through comparative calculations in multiple dimensions, a more comprehensive loss function is obtained to train the model. In this way, the generated enhanced image can retain both the essential attributes of the image and the light-dark contrast. Therefore, the embodiment of the present application can improve the enhancement accuracy of low-light images, avoid serious noise and color distortion, and thus improve the recognition performance of enhanced images.
[0172] See also Figure 9 The present application also provides an image enhancement device that can implement the above-mentioned image enhancement method. The device includes:
[0173] An acquisition module 910 is configured to acquire sample data, where the sample data includes a sample original illumination map and a sample normal illumination map. The sample original illumination map is an image containing the sample object captured under low illumination, and the sample normal illumination map is an image containing the sample object captured under normal illumination.
[0174] Extraction module 920, configured to extract features from the sample original illumination map based on a feature extraction layer of a preset enhancement model to obtain features of the sample low-illumination image;
[0175] The attribute enhancement module 930 is used to enhance the grayscale attributes of the sample original illumination map to obtain a sample brightness enhancement map and a sample contrast enhancement map;
[0176] An encoding module 940 is configured to perform image encoding on the sample brightness enhancement map and the sample contrast enhancement map based on an image encoding layer of a preset enhancement model to obtain a sample enhancement feature;
[0177] A decoding module 950 is configured to perform image decoding on the sample enhancement features and the sample low-light image features based on a decoding layer of a preset enhancement model to obtain a sample enhancement map;
[0178] A training module 960 is configured to determine a model loss value based on the sample original illumination map, the sample normal illumination map, and the sample enhanced map, and adjust parameters of a preset enhancement model based on the model loss value to obtain an image enhancement model;
[0179] The image enhancement module 970 is used to perform image enhancement on the target image based on the image enhancement model to obtain a target enhanced image.
[0180] The specific implementation of the image enhancement device in the embodiment of the present application is basically the same as the specific embodiment of the above-mentioned image enhancement method, and will not be repeated here.
[0181] The present application also provides an electronic device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the above-mentioned image enhancement method when executing the computer program. The electronic device can be any smart terminal including a tablet computer, an in-vehicle computer, or the like.
[0182] See also Figure 10 , Figure 10 The hardware structure of an electronic device according to another embodiment is shown. The electronic device includes:
[0183] The processor 1010 can be implemented as a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application.
[0184] The memory 1020 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 1020 can store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 1020 and is called by the processor 1010 to execute the image enhancement method of the embodiments of this application.
[0185] Input / output interface 1030, used to implement information input and output;
[0186] Communication interface 1040, used to implement communication interaction between this device and other devices, which can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WiFi, Bluetooth, etc.);
[0187] bus 1050 , which transmits information between various components of the device (e.g., processor 1010 , memory 1020 , input / output interface 1030 , and communication interface 1040 );
[0188] The processor 1010 , the memory 1020 , the input / output interface 1030 , and the communication interface 1040 are connected to each other in communication within the device via a bus 1050 .
[0189] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned image enhancement method is implemented.
[0190] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0191] The embodiments described in the embodiments of this application are intended to more clearly illustrate the technical solutions of the embodiments of this application and do not constitute a limitation on the technical solutions provided by the embodiments of this application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0192] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0193] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, i.e., they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of this embodiment.
[0194] Those skilled in the art will appreciate that all or some of the steps in the methods, systems, and functional modules / units in the devices disclosed above may be implemented as software, firmware, hardware, or appropriate combinations thereof.
[0195] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0196] It should be understood that in this application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0197] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the above-mentioned units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0198] The units described above as separate components may or may not be physically separate, and 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 these units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0199] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0200] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes multiple instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: various media that can store programs, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0201] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but are not intended to limit the scope of the present invention. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and essence of the present invention should be within the scope of the present invention.
Claims
1. An image enhancement method, characterized in that: The method comprises: Acquire sample data, where the sample data includes a sample original illumination map and a sample normal illumination map, where the sample original illumination map is an image containing the sample object captured under low illumination, and the sample normal illumination map is an image containing the sample object captured under normal illumination; The feature extraction layer based on the preset enhancement model performs feature extraction on the sample original illumination map to obtain sample low-illumination image features; wherein the feature extraction layer based on the preset enhancement model performs feature extraction on the sample original illumination map to obtain sample low-illumination image features, including: performing image decomposition on the sample original illumination map to obtain a sample reflection map and a sample illumination map; and performing feature extraction on the sample reflection map and the sample original illumination map based on the feature extraction layer to obtain the sample low-illumination image features; Performing image grayscale attribute enhancement on the sample original illumination image to obtain a sample brightness enhancement image and a sample contrast enhancement image; The image coding layer based on the preset enhancement model performs image coding on the sample brightness enhancement map and the sample contrast enhancement map to obtain a sample enhancement feature; wherein the image coding layer based on the preset enhancement model performs image coding on the sample brightness enhancement map and the sample contrast enhancement map to obtain a sample enhancement feature, including: performing image coding on the sample brightness enhancement map to obtain a brightness enhancement feature; performing image coding on the sample contrast enhancement map to obtain a contrast enhancement feature; performing feature splicing on the brightness enhancement feature and the contrast enhancement feature to obtain a sample splicing feature; and performing feature extraction on the sample splicing feature to obtain the sample enhancement feature; Performing image decoding on the sample enhancement feature and the sample low-illumination image feature based on the decoding layer of the preset enhancement model to obtain a sample enhancement map; A model loss value is determined based on the sample original illumination map, the sample normal illumination map and the sample enhanced map, and parameters of the preset enhancement model are adjusted based on the model loss value to obtain an image enhancement model; wherein, determining the model loss value based on the sample original illumination map, the sample normal illumination map and the sample enhanced map includes: performing visual feature loss calculation based on the sample normal illumination map and the sample enhanced map to obtain a visual feature loss value; performing image decomposition loss calculation based on the sample original illumination map, the sample reflection map and the sample illumination map to obtain an image decomposition loss value; performing image decomposition on the sample enhanced map to obtain a sample enhanced reflection map; performing image grayscale attribute loss calculation based on the sample enhanced reflection map, the sample enhanced map and the sample normal illumination map to obtain an image grayscale attribute loss value; performing weighted sum calculation on the visual feature loss value, the image decomposition loss value and the image grayscale attribute loss value to obtain the model loss value; The target image is enhanced based on the image enhancement model to obtain a target enhanced image.
2. The method according to claim 1, characterized in that The performing visual feature loss calculation based on the sample normal illumination map and the sample enhanced map to obtain a visual feature loss value includes: Performing color loss calculation on the sample normal illumination image and the sample enhanced image based on a preset color loss function to obtain an image color loss value; Performing texture loss calculation on the sample normal illumination image and the sample enhanced image based on a preset texture loss function to obtain an image texture loss value; Performing content loss calculation on the sample normal illumination image and the sample enhanced image based on a preset content loss function to obtain an image content loss value; A weighted sum calculation is performed on the image color loss value, the image texture loss value, and the image content loss value to obtain a visual feature loss value.
3. The method according to claim 1, characterized in that The performing of image grayscale attribute loss calculation based on the sample enhanced reflection map, the sample enhanced map, and the sample normal illumination map to obtain an image grayscale attribute loss value includes: Based on preset three-channel weights and a preset brightness value, a color enhancement loss calculation is performed on the sample enhanced reflection map and the sample normal illumination map to obtain a color enhancement loss value; wherein the preset brightness value is used to indicate the degree of enhancement of the brightness attribute; Performing image contrast loss calculation based on the sample enhancement image and the sample normal illumination image to obtain an image contrast loss value; A weighted sum calculation is performed on the color enhancement loss value and the image contrast loss value to obtain the image grayscale attribute loss value.
4. The method according to claim 1, wherein The step of performing feature stitching on the brightness enhancement feature and the contrast enhancement feature to obtain a sample stitching feature includes: Obtaining a detection accuracy of the sample target based on the target type of the sample target; determining enhancement parameters based on the target type and the detection accuracy, the enhancement parameters comprising a brightness enhancement weight of the brightness enhancement feature and a contrast enhancement weight of the contrast enhancement feature; Feature weighted splicing is performed based on the brightness enhancement feature, the brightness enhancement weight, the contrast enhancement feature, and the contrast enhancement weight to obtain the sample splicing feature.
5. An image enhancement device, characterized in that: The device comprises: an acquisition module, configured to acquire sample data, wherein the sample data includes a sample original illumination map and a sample normal illumination map, wherein the sample original illumination map is an image containing the sample object captured under low illumination, and the sample normal illumination map is an image containing the sample object captured under normal illumination; An extraction module is configured to perform feature extraction on the sample original illumination map based on a feature extraction layer of a preset enhancement model to obtain sample low-illumination image features; wherein the feature extraction layer based on the preset enhancement model performs feature extraction on the sample original illumination map to obtain sample low-illumination image features, including: performing image decomposition on the sample original illumination map to obtain a sample reflection map and a sample illumination map; and performing feature extraction on the sample reflection map and the sample original illumination map based on the feature extraction layer to obtain the sample low-illumination image features; An attribute enhancement module is used to enhance the image grayscale attributes of the sample original illumination map to obtain a sample brightness enhancement map and a sample contrast enhancement map; A coding module, configured to perform image coding on the sample brightness enhancement map and the sample contrast enhancement map based on the image coding layer of the preset enhancement model to obtain a sample enhancement feature; wherein the image coding layer based on the preset enhancement model performs image coding on the sample brightness enhancement map and the sample contrast enhancement map to obtain a sample enhancement feature, including: performing image coding on the sample brightness enhancement map to obtain a brightness enhancement feature; performing image coding on the sample contrast enhancement map to obtain a contrast enhancement feature; performing feature splicing on the brightness enhancement feature and the contrast enhancement feature to obtain a sample splicing feature; and performing feature extraction on the sample splicing feature to obtain the sample enhancement feature; A decoding module, configured to perform image decoding on the sample enhancement feature and the sample low-illumination image feature based on a decoding layer of the preset enhancement model to obtain a sample enhancement map; A training module is used to determine a model loss value based on the sample original illumination map, the sample normal illumination map and the sample enhanced map, and adjust the parameters of the preset enhancement model based on the model loss value to obtain an image enhancement model; wherein, determining the model loss value based on the sample original illumination map, the sample normal illumination map and the sample enhanced map includes: performing visual feature loss calculation based on the sample normal illumination map and the sample enhanced map to obtain a visual feature loss value; performing image decomposition loss calculation based on the sample original illumination map, the sample reflectance map and the sample illumination map to obtain an image decomposition loss value; performing image decomposition on the sample enhanced map to obtain a sample enhanced reflectance map; performing image grayscale attribute loss calculation based on the sample enhanced reflectance map, the sample enhanced map and the sample normal illumination map to obtain an image grayscale attribute loss value; performing weighted sum calculation on the visual feature loss value, the image decomposition loss value and the image grayscale attribute loss value to obtain the model loss value; The image enhancement module is used to perform image enhancement on the target image based on the image enhancement model to obtain a target enhanced image.
6. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1 to 4 when executing the computer program.
7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.