Image enhancement methods, apparatus, devices and storage media
By optimizing the low-light image enhancement process through generative adversarial network training, the problem of cumbersome low-light image enhancement is solved, and efficient and reliable image enhancement results are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- PING AN TECH (SHENZHEN) CO LTD
- Filing Date
- 2024-09-09
- Publication Date
- 2026-05-26
Smart Images

Figure CN119048410B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence and financial technology, and in particular to image enhancement methods, apparatus, devices, and storage media. Background Technology
[0002] At night, in low light, or backlit environments, due to insufficient exposure, mobile phones will produce low-light images of the damaged vehicle. These low-light images are blurry due to insufficient light, making it impossible for the claims system to determine the extent and scope of the vehicle damage based on them.
[0003] However, the current process of enhancing the current part image in low-light images is cumbersome and not conducive to improving the enhancement efficiency of the current part image. This is because traditional image enhancement methods lack specificity and cannot directly enhance the current part image. This requires staff to manually adjust multiple parameters to enhance the current part image, which is not only time-consuming and labor-intensive but also easily affected by human intervention, thus hindering the improvement of the enhancement efficiency of the current part image. Summary of the Invention
[0004] This invention provides an image enhancement method, apparatus, computer device, and storage medium to solve the technical problem that the current component image enhancement process is cumbersome and not conducive to improving the enhancement efficiency of the current component image in low-light images.
[0005] Firstly, an image enhancement method is provided, including:
[0006] A preset low-light image is obtained, and the preset low-light image is segmented to obtain a first segmentation result. The preset low-light image is a low-light image obtained by photographing a preset damaged vehicle.
[0007] Select the component image from the first segmentation result as the preset component image, and combine the preset component image and the normal lighting image corresponding to the preset component image into a sample data;
[0008] A generative adversarial network is trained based on the sample data, and an enhanced image of the preset component is generated through the generator in the generative adversarial network.
[0009] Based on the enhanced image of the preset component and the normal lighting image, a first loss value, a second loss value, a third loss value, a fourth loss value, and a fifth loss value are determined.
[0010] The total loss value is determined based on the first loss value, the second loss value, the third loss value, the fourth loss value, and the fifth loss value;
[0011] When the total loss value meets the preset condition, the trained generative adversarial network is saved, the current low-light image is obtained, the current low-light image is segmented to obtain a second segmentation result, the component image in the second segmentation result is selected as the current component image, and the enhanced current component image is generated by the generator in the trained generative adversarial network. The current low-light image is a low-light image obtained by taking pictures of the currently damaged vehicle.
[0012] Further, the step of selecting the component image from the first segmentation result as the preset component image, and combining the preset component image and the corresponding normal lighting image into a sample data, includes:
[0013] Select the component image from the first segmentation result as the preset component image and obtain the database query interface;
[0014] Through the query interface, the normal lighting image corresponding to the preset component image is obtained from the database, and the preset component image and the normal lighting image are combined to form a sample data.
[0015] Further, the step of training a generative adversarial network based on the sample data, and generating an enhanced image of the preset component through a generator in the generative adversarial network, includes:
[0016] A generative adversarial network is trained based on the sample data, and the preset component image in the sample data is input into the generator in the generative adversarial network.
[0017] The generator in the generative adversarial network processes the preset component image to generate an enhanced preset component image.
[0018] Further, determining the first loss value, the second loss value, the third loss value, the fourth loss value, and the fifth loss value based on the enhanced preset component image and the normal lighting image includes:
[0019] The content features, texture features, and color features of the enhanced preset component image are obtained, as are the content features, texture features, and color features of the normal illumination image. The enhanced preset component image is decomposed into a first reflection image and a first brightness image, and the normal illumination image is decomposed into a second reflection image and a second brightness image.
[0020] The loss value between the content features of the enhanced preset component image and the content features of the normal illumination image is selected as the first loss value; the loss value between the texture features of the enhanced preset component image and the texture features of the normal illumination image is selected as the second loss value; the loss value between the color features of the enhanced preset component image and the color features of the normal illumination image is selected as the third loss value; the loss value between the first reflection map and the second reflection map is selected as the fourth loss value; and the loss value between the first luminance map and the second luminance map is selected as the fifth loss value.
[0021] Further, determining the total loss value based on the first loss value, the second loss value, the third loss value, the fourth loss value, and the fifth loss value includes:
[0022] The first loss value, the second loss value, and the third loss value are added together to generate a first comprehensive loss value; the fourth loss value and the fifth loss value are added together to generate a second comprehensive loss value.
[0023] Based on the first comprehensive loss value, the second comprehensive loss value, and the preset total loss value generation model, the enhanced total loss value of the preset component image and the normal lighting image is generated.
[0024] Further, when the total loss value meets a preset condition, the trained generative adversarial network is saved, the current low-light image is acquired, the current low-light image is segmented to obtain a second segmentation result, the component image in the second segmentation result is selected as the current component image, and the enhanced current component image is generated through the generator in the trained generative adversarial network. The current low-light image is a low-light image obtained by photographing the currently damaged vehicle, including:
[0025] When the total loss value is less than the preset loss value, the training of the generative adversarial network is stopped, the trained generative adversarial network is saved, the current low-light image is obtained, the current low-light image is input into the vehicle component segmentation model, and the second segmentation result output by the vehicle component segmentation model based on the current low-light image is obtained.
[0026] The component image in the second segmentation result is selected as the current component image. The current component image is input into the generator in the trained generative adversarial network. The generator in the trained generative adversarial network processes the current component image to generate the enhanced current component image.
[0027] Further, when the total loss value meets a preset condition, the trained generative adversarial network is saved, the current low-light image is obtained, the current low-light image is segmented to obtain a second segmentation result, the component image in the second segmentation result is selected as the current component image, and the enhanced current component image is generated by the generator in the trained generative adversarial network. The image enhancement method then includes:
[0028] Obtain a preset display window, and display the enhanced image of the current component through the display window.
[0029] Secondly, an image enhancement device is provided, comprising:
[0030] The acquisition module is used to acquire a preset low-light image, segment the preset low-light image to obtain a first segmentation result, wherein the preset low-light image is a low-light image obtained by photographing a preset damaged vehicle;
[0031] The selection module is used to select the component image in the first segmentation result as the preset component image, and to combine the preset component image and the normal lighting image corresponding to the preset component image into a sample data;
[0032] The training module is used to train a generative adversarial network based on the sample data, and to generate an enhanced image of the preset component through the generator in the generative adversarial network;
[0033] The first determining module is used to determine a first loss value, a second loss value, a third loss value, a fourth loss value, and a fifth loss value based on the enhanced preset component image and the normal illumination image.
[0034] The second determining module is used to determine the total loss value based on the first loss value, the second loss value, the third loss value, the fourth loss value, and the fifth loss value;
[0035] An enhancement module is used to save the trained generative adversarial network when the total loss value meets a preset condition, acquire the current low-light image, segment the current low-light image to obtain a second segmentation result, select the component image in the second segmentation result as the current component image, and generate the enhanced current component image through the generator in the trained generative adversarial network. The current low-light image is a low-light image obtained by taking a picture of the currently damaged vehicle.
[0036] Thirdly, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above-described image enhancement method.
[0037] Fourthly, a computer-readable storage medium is provided, which stores a computer program that, when executed by a processor, implements the steps of the above-described image enhancement method.
[0038] This application provides an image enhancement method, apparatus, computer device, and storage medium. The method involves acquiring a preset low-light image, segmenting the preset low-light image to obtain a first segmentation result, wherein the preset low-light image is a low-light image obtained by photographing a preset damaged vehicle; selecting component images from the first segmentation result as preset component images; combining the preset component images and their corresponding normal lighting images into sample data; training a generative adversarial network (GAN) based on the sample data; generating an enhanced preset component image using a generator within the GAN; determining a first loss value, a second loss value, a third loss value, a fourth loss value, and a fifth loss value based on the enhanced preset component image and the normal lighting image; determining a total loss value based on the first loss value, the second loss value, the third loss value, the fourth loss value, and the fifth loss value; and when the total loss value meets a preset condition, saving the trained GAN, acquiring a current low-light image, and segmenting the current low-light image. The process involves segmenting the image to obtain a second segmentation result, selecting a component image from the second segmentation result as the current component image, and then generating an enhanced current component image using the generator in the trained generative adversarial network. The current low-light image is a low-light image obtained by photographing the damaged vehicle. This process has two advantages: First, when the total loss value meets a preset condition, the trained generative adversarial network is saved, the current low-light image is obtained, and the current low-light image is segmented to obtain a second segmentation result. The component image from the second segmentation result is selected as the current component image, and the generator in the trained generative adversarial network generates an enhanced current component image. Since no manual adjustment is required, the processing time for the current component image is reduced, and the enhancement of the current component image is completed in a shorter processing time, thus improving the enhancement efficiency of the current component image from the current low-light image. Second, since the generator is not affected by human intervention, the reliability of the obtained enhanced current component image is improved. Attached Figure Description
[0039] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0040] Figure 1This is a schematic diagram of an application environment for an image enhancement method according to an embodiment of the present invention;
[0041] Figure 2 This is a schematic flowchart of an image enhancement method provided in an embodiment of the present invention;
[0042] Figure 3 yes Figure 1 A flowchart illustrating a specific implementation of step S23;
[0043] Figure 4 yes Figure 1 A schematic diagram of a specific implementation method for step S25;
[0044] Figure 5 yes Figure 1 A schematic diagram of a specific implementation method for step S26;
[0045] Figure 6 This is a schematic diagram of the structure of an image enhancement device according to an embodiment of the present invention;
[0046] Figure 7 This is a schematic diagram of the structure of a computer device according to an embodiment of the present invention;
[0047] Figure 8 This is another structural schematic diagram of a computer device according to one embodiment of the present invention. Detailed Implementation
[0048] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0049] Please see Figure 1 , Figure 1 This is a schematic diagram illustrating an application environment of the image enhancement method according to an embodiment of the present invention. The image enhancement method provided in this embodiment can be applied to, for example... Figure 1 In this application environment, the client communicates with the server via a network.
[0050] The server obtains a preset low-light image from the client, segments the preset low-light image, and obtains a first segmentation result. The preset low-light image is a low-light image obtained by photographing a preset damaged vehicle.
[0051] Select the component image from the first segmentation result as the preset component image, and combine the preset component image and the normal lighting image corresponding to the preset component image into a sample data;
[0052] A generative adversarial network is trained based on the sample data, and an enhanced image of the preset component is generated through the generator in the generative adversarial network.
[0053] Based on the enhanced image of the preset component and the normal lighting image, a first loss value, a second loss value, a third loss value, a fourth loss value, and a fifth loss value are determined.
[0054] The total loss value is determined based on the first loss value, the second loss value, the third loss value, the fourth loss value, and the fifth loss value;
[0055] When the total loss value meets the preset condition, the trained generative adversarial network is saved, the current low-light image is obtained, the current low-light image is segmented to obtain a second segmentation result, the component image in the second segmentation result is selected as the current component image, and the enhanced current component image is generated by the generator in the trained generative adversarial network. The current low-light image is a low-light image obtained by taking pictures of the currently damaged vehicle.
[0056] In this embodiment of the invention, the beneficial effects are twofold. Firstly, when the total loss value meets the preset condition, the trained generative adversarial network is saved, the current low-light image is obtained, the current low-light image is segmented to obtain a second segmentation result, and the component image in the second segmentation result is selected as the current component image. The enhanced current component image is generated by the generator in the trained generative adversarial network. Since no manual adjustment is required, the processing time of the current component image is reduced, and the enhancement of the current component image is completed in a shorter processing time, thus improving the enhancement efficiency of the current component image of the current low-light image. Secondly, since the generator is not affected by human intervention, the reliability of the obtained enhanced current component image is improved.
[0057] The client can include, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices.
[0058] The server can be implemented using a separate task database or a task database cluster consisting of multiple task databases. The invention will be described in detail below through specific embodiments.
[0059] Please see Figure 2 , Figure 2 A schematic flowchart of an image enhancement method according to an embodiment of the present invention includes the following steps:
[0060] S21, acquire a preset low-light image, segment the preset low-light image to obtain a first segmentation result, wherein the preset low-light image is a low-light image obtained by photographing a preset damaged vehicle;
[0061] For example, the step of acquiring a preset low-light image and segmenting the preset low-light image to obtain a first segmentation result includes:
[0062] The process involves acquiring a preset low-light image, inputting the preset low-light image into a preset vehicle component segmentation model, and obtaining a first segmentation result output by the vehicle component segmentation model based on the preset low-light image.
[0063] Among them, the vehicle component segmentation model is a machine learning model specifically designed for identifying and segmenting individual components in vehicle images.
[0064] S22, Select the component image in the first segmentation result as the preset component image, and combine the preset component image and the normal lighting image corresponding to the preset component image into a sample data;
[0065] The step of selecting a component image from the first segmentation result as a preset component image, and combining the preset component image and the corresponding normal lighting image into a sample data set, includes:
[0066] Select the component image from the first segmentation result as the preset component image and obtain the database query interface;
[0067] Through the query interface, the normal lighting image corresponding to the preset component image is obtained from the database, and the preset component image and the normal lighting image are combined into a sample data. The normal lighting image is an image of the preset damaged vehicle taken under normal lighting conditions.
[0068] Normal lighting conditions typically refer to a lighting environment that is neither too bright nor too dim, allowing the human eye and photographic equipment to comfortably capture and identify details of a pre-existing damaged vehicle. Such conditions are common in both natural and artificial environments, such as outdoors on a sunny day or in a room using standard indoor lighting.
[0069] Under normal lighting conditions, the light distribution is relatively uniform, with no obvious direct strong light or dark shadow areas, allowing the original color, texture, and shape of the pre-set damaged vehicle surface to be clearly displayed. At the same time, the light intensity and color temperature are also within an appropriate range, neither causing color distortion nor resulting in a dim image or blurred details due to insufficient light.
[0070] This lighting condition is crucial for fields such as photography, videography, image processing, and computer vision because it ensures the quality and accuracy of image data, providing a reliable foundation for subsequent image analysis, processing, and applications.
[0071] S23, a generative adversarial network is trained based on the sample data, and an enhanced image of the preset component is generated through the generator in the generative adversarial network;
[0072] Generative Adversarial Networks (GANs) are an innovative unsupervised deep learning model that works through a game-like learning process between a generative model and a discriminative model. The generative model's task is to capture the distribution of real data and generate new data, such as images and text, that are as realistic as possible; while the discriminative model is a binary classifier responsible for determining whether the input data is real or generated by the generative model.
[0073] S24, based on the enhanced preset component image and the normal lighting image, determine the first loss value, the second loss value, the third loss value, the fourth loss value and the fifth loss value;
[0074] The step of determining the first loss value, the second loss value, the third loss value, the fourth loss value, and the fifth loss value based on the enhanced preset component image and the normal lighting image includes:
[0075] The content features, texture features, and color features of the enhanced preset component image are obtained, as are the content features, texture features, and color features of the normal illumination image. The enhanced preset component image is decomposed into a first reflection image and a first brightness image, and the normal illumination image is decomposed into a second reflection image and a second brightness image.
[0076] The loss value between the content features of the enhanced preset component image and the content features of the normal illumination image is selected as the first loss value; the loss value between the texture features of the enhanced preset component image and the texture features of the normal illumination image is selected as the second loss value; the loss value between the color features of the enhanced preset component image and the color features of the normal illumination image is selected as the third loss value; the loss value between the first reflection map and the second reflection map is selected as the fourth loss value; and the loss value between the first luminance map and the second luminance map is selected as the fifth loss value.
[0077] For example, the step of selecting the loss value between the content features of the enhanced preset component image and the content features of the normal illumination image as a first loss value, selecting the loss value between the texture features of the enhanced preset component image and the texture features of the normal illumination image as a second loss value, selecting the loss value between the color features of the enhanced preset component image and the color features of the normal illumination image as a third loss value, selecting the loss value between the first reflection map and the second reflection map as a fourth loss value, and selecting the loss value between the first luminance map and the second luminance map as a fifth loss value includes:
[0078] The content loss function is used to obtain the loss value between the content features of the enhanced preset component image and the content features of the normal lighting image;
[0079] The loss value between the texture features of the enhanced preset component image and the texture features of the normal lighting image is obtained by using a style loss function.
[0080] The loss value between the color features of the enhanced preset component image and the color features of the normal illumination image is obtained by using an absolute value loss function or a squared loss function.
[0081] The loss value between the first reflection map and the second reflection map is obtained by using the pixel loss function, and the loss value between the first brightness map and the second brightness map is obtained.
[0082] The loss value between the content features of the enhanced preset component image and the content features of the normal illumination image is selected as the first loss value; the loss value between the texture features of the enhanced preset component image and the texture features of the normal illumination image is selected as the second loss value; the loss value between the color features of the enhanced preset component image and the color features of the normal illumination image is selected as the third loss value; the loss value between the first reflection map and the second reflection map is selected as the fourth loss value; and the loss value between the first luminance map and the second luminance map is selected as the fifth loss value.
[0083] The content loss function quantifies the similarity of content information between the enhanced preset component image and the normal illumination image by comparing the differences in content features between them.
[0084] The style loss function is a loss metric used in generative adversarial networks and style transfer tasks.
[0085] The absolute value loss function, also known as L1 loss, is calculated by taking the absolute value of the difference between the model's predicted value and the actual value.
[0086] The squared loss function, also known as L2 loss, is calculated by taking the square of the difference between the model's predicted value and the actual value.
[0087] The pixel loss function is a loss function that directly evaluates the similarity between the generated image and the target image at the pixel level.
[0088] S25, determine the total loss value based on the first loss value, the second loss value, the third loss value, the fourth loss value, and the fifth loss value;
[0089] S26, when the total loss value meets the preset condition, save the trained generative adversarial network, obtain the current low-light image, segment the current low-light image to obtain the second segmentation result, select the component image in the second segmentation result as the current component image, and generate the enhanced current component image through the generator in the trained generative adversarial network. The current low-light image is the low-light image obtained by taking pictures of the currently damaged vehicle.
[0090] The claims system can identify the damaged parts of a vehicle based on the current part image.
[0091] For clarity, examples of the types of damaged parts in the currently damaged vehicles are provided below:
[0092] Exterior components of a vehicle, such as bumpers, headlights, windows, and body panels, are typically the first parts to be impacted and potentially damaged in an accident. Damage to these components not only affects the vehicle's appearance but can also impair the driver's visibility and the vehicle's overall safety.
[0093] The vehicle's frame and chassis components, such as the chassis, suspension arms, and drive shaft, can be severely affected by damage in a collision, potentially impacting the vehicle's stability and handling performance. Torsion or breakage of the frame weakens the vehicle's crashworthiness, while damage to chassis components can directly lead to loss of vehicle control or unusual noises while driving.
[0094] Vehicle power components, such as the engine block, crankshaft, and pistons, will directly affect the vehicle's power output and normal operation if they malfunction. Repairing or replacing these components often requires specialized technology and equipment, and is costly.
[0095] Wherein, when the total loss value meets a preset condition, the trained generative adversarial network is saved, the current low-light image is obtained, the current low-light image is segmented to obtain a second segmentation result, a component image in the second segmentation result is selected as the current component image, and an enhanced current component image is generated by the generator in the trained generative adversarial network, the image enhancement method includes:
[0096] Obtain a preset display window, and display the enhanced image of the current component through the display window.
[0097] In this embodiment of the invention, the beneficial effects are twofold. Firstly, when the total loss value meets the preset condition, the trained generative adversarial network is saved, the current low-light image is obtained, the current low-light image is segmented to obtain a second segmentation result, and the component image in the second segmentation result is selected as the current component image. The enhanced current component image is generated by the generator in the trained generative adversarial network. Since no manual adjustment is required, the processing time of the current component image is reduced, and the enhancement of the current component image is completed in a shorter processing time, thus improving the enhancement efficiency of the current component image of the current low-light image. Secondly, since the generator is not affected by human intervention, the reliability of the obtained enhanced current component image is improved.
[0098] Please see Figure 3 , Figure 3 yes Figure 1 A detailed flowchart of a specific implementation method for step S23 is described below:
[0099] S31, a generative adversarial network is trained based on the sample data, and the preset component image in the sample data is input into the generator in the generative adversarial network;
[0100] S32, the preset component image is processed by the generator in the generative adversarial network to generate an enhanced preset component image.
[0101] In this embodiment of the invention, by comparing the enhanced preset component image with a normal illumination image, the training efficiency of the generative adversarial network can be improved.
[0102] Please see Figure 4 , Figure 4 yes Figure 1 A detailed flowchart of a specific implementation method for step S25 is described below:
[0103] S41, add the first loss value, the second loss value, and the third loss value to generate a first comprehensive loss value, and add the fourth loss value and the fifth loss value to generate a second comprehensive loss value;
[0104] S42, based on the first comprehensive loss value, the second comprehensive loss value, and the preset total loss value generation model, generate the enhanced total loss value of the preset component image and the normal illumination image.
[0105] The total loss value generation model is as follows:
[0106] L = λ1*L1 + λ2*L2;
[0107] Where L is the total loss value, L1 is the first comprehensive loss value, L2 is the second comprehensive loss value, λ1 is the first weighting coefficient, and λ2 is the second weighting coefficient.
[0108] Among them, λ1 and λ2 are set manually.
[0109] Optionally, λ1 is 0.6 and λ2 is 0.4. Optionally, λ1 is 0.55 and λ2 is 0.45.
[0110] In this embodiment of the invention, the total loss value of the enhanced preset component image and the normal lighting image can be used to evaluate the performance of the generator.
[0111] Please see Figure 5 , Figure 5 yes Figure 1 A detailed flowchart of a specific implementation method for step S26 is described below:
[0112] S51, when the total loss value is less than the preset loss value, stop training the generative adversarial network, save the trained generative adversarial network, obtain the current low-light image, input the current low-light image into the vehicle component segmentation model, and obtain the second segmentation result output by the vehicle component segmentation model based on the current low-light image.
[0113] S52, Select the component image in the second segmentation result as the current component image, input the current component image into the generator in the trained generative adversarial network, and process the current component image through the generator in the trained generative adversarial network to generate the enhanced current component image.
[0114] In this embodiment of the invention, since no manual adjustment is required, the processing time of the current component image is reduced, and the enhancement of the current component image is completed in a shorter processing time. Therefore, it is beneficial to improve the enhancement efficiency of the current component image of the current low-light image.
[0115] Please see Figure 6 , Figure 6 This is a schematic diagram of the structure of an image enhancement device according to an embodiment of the present invention, as shown below. Figure 6 As shown, the image enhancement device includes an acquisition module 101, a selection module 102, a training module 103, a first determination module 104, a second determination module 105, and an enhancement module 106. Detailed descriptions of each functional module are as follows:
[0116] The acquisition module 101 is used to acquire a preset low-light image, segment the preset low-light image to obtain a first segmentation result, wherein the preset low-light image is a low-light image obtained by photographing a preset damaged vehicle.
[0117] The selection module 102 is used to select the component image in the first segmentation result as the preset component image, and to combine the preset component image and the normal lighting image corresponding to the preset component image into a sample data;
[0118] Training module 103 is used to train a generative adversarial network based on the sample data, and to generate an enhanced image of the preset component through the generator in the generative adversarial network;
[0119] The first determining module 104 is used to determine a first loss value, a second loss value, a third loss value, a fourth loss value, and a fifth loss value based on the enhanced preset component image and the normal illumination image.
[0120] The second determining module 105 is used to determine the total loss value based on the first loss value, the second loss value, the third loss value, the fourth loss value, and the fifth loss value;
[0121] The enhancement module 106 is used to save the trained generative adversarial network when the total loss value meets the preset conditions, acquire the current low-light image, segment the current low-light image to obtain a second segmentation result, select the component image in the second segmentation result as the current component image, and generate the enhanced current component image through the generator in the trained generative adversarial network. The current low-light image is a low-light image obtained by taking a picture of the currently damaged vehicle.
[0122] In one embodiment, the selection module 102 includes:
[0123] The first acquisition subunit is used to select the component image in the first segmentation result as the preset component image and obtain the query interface of the database;
[0124] The second acquisition subunit is used to acquire, through the query interface, a normal illumination image corresponding to the preset component image in the database, and combine the preset component image and the normal illumination image into a sample data.
[0125] In one embodiment, the training module 103 includes:
[0126] The training subunit is used to train the generative adversarial network based on the sample data, and inputs the preset component image from the sample data into the generator in the generative adversarial network.
[0127] The generation subunit is used to process the preset component image through the generator in the generative adversarial network to generate an enhanced preset component image.
[0128] In one embodiment, the first determining module 104 includes:
[0129] The decomposition subunit is used to obtain the content features, texture features, and color features of the enhanced preset component image, obtain the content features, texture features, and color features of the normal illumination image, decompose the enhanced preset component image into a first reflection map and a first brightness map, and decompose the normal illumination image into a second reflection map and a second brightness map.
[0130] A selection subunit is used to select the loss value between the content features of the enhanced preset component image and the content features of the normal illumination image as a first loss value, the loss value between the texture features of the enhanced preset component image and the texture features of the normal illumination image as a second loss value, the loss value between the color features of the enhanced preset component image and the color features of the normal illumination image as a third loss value, the loss value between the first reflection map and the second reflection map as a fourth loss value, and the loss value between the first brightness map and the second brightness map as a fifth loss value.
[0131] In one embodiment, the second determining module 105 includes:
[0132] The first generation subunit is used to add the first loss value, the second loss value, and the third loss value to generate a first comprehensive loss value, and to add the fourth loss value and the fifth loss value to generate a second comprehensive loss value;
[0133] The second generation subunit is used to generate the enhanced total loss value of the preset component image and the normal illumination image based on the first comprehensive loss value, the second comprehensive loss value and the preset total loss value generation model.
[0134] In one embodiment, the enhancement module 106 includes:
[0135] The segmentation subunit is used to stop training the generative adversarial network when the total loss value is less than a preset loss value, save the trained generative adversarial network, obtain the current low-light image, input the current low-light image into the vehicle component segmentation model, and obtain the second segmentation result output by the vehicle component segmentation model based on the current low-light image.
[0136] The enhancement subunit is used to select the component image in the second segmentation result as the current component image, input the current component image into the generator in the trained generative adversarial network, and process the current component image through the generator in the trained generative adversarial network to generate the enhanced current component image.
[0137] In one embodiment, the image enhancement device further includes:
[0138] The display module is used to obtain a preset display window and display the enhanced image of the current component through the display window.
[0139] In this embodiment of the invention, the beneficial effects are twofold. Firstly, when the total loss value meets the preset condition, the trained generative adversarial network is saved, the current low-light image is obtained, the current low-light image is segmented to obtain a second segmentation result, and the component image in the second segmentation result is selected as the current component image. The enhanced current component image is generated by the generator in the trained generative adversarial network. Since no manual adjustment is required, the processing time of the current component image is reduced, and the enhancement of the current component image is completed in a shorter processing time, thus improving the enhancement efficiency of the current component image of the current low-light image. Secondly, since the generator is not affected by human intervention, the reliability of the obtained enhanced current component image is improved.
[0140] For specific limitations on image enhancement devices, please refer to the limitations on image enhancement methods mentioned above, which will not be repeated here.
[0141] Each module in the aforementioned image enhancement device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0142] Please see Figure 7 , Figure 7This is a schematic diagram of a computer device according to one embodiment of the present invention. In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows. Figure 7 As shown. This computer device includes a processor, memory, network interface, and database connected via a system bus.
[0143] The processor of this computer device provides computing and control capabilities. The memory of the computer device includes non-volatile and / or volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and databases. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface of the computer device is used for communication with external clients via a network connection. When the computer program is executed by the processor, it can implement the functions or steps of an image enhancement method on the server side.
[0144] Please see Figure 8 , Figure 8 This is another structural schematic diagram of a computer device according to one embodiment of the present invention. In one embodiment, a computer device is provided, which can be a client, and its internal structure diagram can be as follows. Figure 8 As shown, the computer device includes a processor, memory, network interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface is used to communicate with an external task database via a network connection. When the computer program is executed by the processor, it can implement the function or steps of an image enhancement method on a client side.
[0145] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor.
[0146] It should be noted that the functions or steps that can be implemented by the computer-readable storage medium or computer device described above can be referred to the relevant descriptions of the server and client in the foregoing method embodiments. To avoid repetition, they will not be described one by one here.
[0147] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), graphics processing units (GPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0148] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than that shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. In the descriptions corresponding to the flowcharts and block diagrams in the accompanying drawings, the operations or steps corresponding to different blocks may also occur in a different order than disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. Each block in a block diagram and / or flowchart, and combinations of blocks in a block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
Claims
1. An image enhancement method, characterized in that, include: A preset low-light image is obtained, and the preset low-light image is segmented to obtain a first segmentation result. The preset low-light image is a low-light image obtained by photographing a preset damaged vehicle. Select the component image from the first segmentation result as the preset component image, and combine the preset component image and the normal lighting image corresponding to the preset component image into a sample data; A generative adversarial network is trained based on the sample data, and an enhanced image of the preset component is generated through the generator in the generative adversarial network. Based on the enhanced image of the preset component and the normal lighting image, a first loss value, a second loss value, a third loss value, a fourth loss value, and a fifth loss value are determined. The total loss value is determined based on the first loss value, the second loss value, the third loss value, the fourth loss value, and the fifth loss value; When the total loss value meets the preset condition, the trained generative adversarial network is saved, the current low-light image is obtained, the current low-light image is segmented to obtain a second segmentation result, the component image in the second segmentation result is selected as the current component image, and the enhanced current component image is generated by the generator in the trained generative adversarial network. The current low-light image is a low-light image obtained by taking a picture of the currently damaged vehicle. The step of determining a first loss value, a second loss value, a third loss value, a fourth loss value, and a fifth loss value based on the enhanced preset component image and the normal lighting image includes: The content features, texture features, and color features of the enhanced preset component image are obtained, as are the content features, texture features, and color features of the normal illumination image. The enhanced preset component image is decomposed into a first reflection image and a first brightness image, and the normal illumination image is decomposed into a second reflection image and a second brightness image. The loss value between the content features of the enhanced preset component image and the content features of the normal illumination image is selected as the first loss value; the loss value between the texture features of the enhanced preset component image and the texture features of the normal illumination image is selected as the second loss value; the loss value between the color features of the enhanced preset component image and the color features of the normal illumination image is selected as the third loss value; the loss value between the first reflection map and the second reflection map is selected as the fourth loss value; and the loss value between the first luminance map and the second luminance map is selected as the fifth loss value.
2. The image enhancement method according to claim 1, characterized in that, The step of selecting a component image from the first segmentation result as a preset component image, and combining the preset component image and the corresponding normal lighting image into a sample data set, includes: Select the component image from the first segmentation result as the preset component image and obtain the database query interface; Through the query interface, the normal lighting image corresponding to the preset component image is obtained from the database, and the preset component image and the normal lighting image are combined to form a sample data.
3. The image enhancement method according to claim 1, characterized in that, The process of training a generative adversarial network based on the sample data, and generating an enhanced image of the preset component through a generator in the generative adversarial network, includes: A generative adversarial network is trained based on the sample data, and the preset component image in the sample data is input into the generator in the generative adversarial network. The generator in the generative adversarial network processes the preset component image to generate an enhanced preset component image.
4. The image enhancement method according to claim 1, characterized in that, The step of determining the total loss value based on the first loss value, the second loss value, the third loss value, the fourth loss value, and the fifth loss value includes: The first loss value, the second loss value, and the third loss value are added together to generate a first comprehensive loss value; the fourth loss value and the fifth loss value are added together to generate a second comprehensive loss value. Based on the first comprehensive loss value, the second comprehensive loss value, and the preset total loss value generation model, the enhanced total loss value of the preset component image and the normal lighting image is generated.
5. The image enhancement method according to claim 1, characterized in that, When the total loss value meets a preset condition, the trained generative adversarial network is saved, the current low-light image is acquired, the current low-light image is segmented to obtain a second segmentation result, the component image in the second segmentation result is selected as the current component image, and the enhanced current component image is generated by the generator in the trained generative adversarial network. The current low-light image is a low-light image obtained by photographing the currently damaged vehicle, including: When the total loss value is less than the preset loss value, the training of the generative adversarial network is stopped, the trained generative adversarial network is saved, the current low-light image is obtained, the current low-light image is input into the vehicle component segmentation model, and the second segmentation result output by the vehicle component segmentation model based on the current low-light image is obtained. The component image in the second segmentation result is selected as the current component image. The current component image is input into the generator in the trained generative adversarial network. The generator in the trained generative adversarial network processes the current component image to generate the enhanced current component image.
6. The image enhancement method according to any one of claims 1 to 5, characterized in that, When the total loss value meets a preset condition, the trained generative adversarial network is saved, the current low-light image is obtained, the current low-light image is segmented to obtain a second segmentation result, the component image in the second segmentation result is selected as the current component image, and the enhanced current component image is generated by the generator in the trained generative adversarial network. The image enhancement method then includes: Obtain a preset display window, and display the enhanced image of the current component through the display window.
7. An image enhancement device, characterized in that, include: The acquisition module is used to acquire a preset low-light image, segment the preset low-light image to obtain a first segmentation result, wherein the preset low-light image is a low-light image obtained by photographing a preset damaged vehicle; The selection module is used to select the component image in the first segmentation result as the preset component image, and to combine the preset component image and the normal lighting image corresponding to the preset component image into a sample data; The training module is used to train a generative adversarial network based on the sample data, and to generate an enhanced image of the preset component through the generator in the generative adversarial network; The first determining module is used to determine a first loss value, a second loss value, a third loss value, a fourth loss value, and a fifth loss value based on the enhanced preset component image and the normal illumination image. The second determining module is used to determine the total loss value based on the first loss value, the second loss value, the third loss value, the fourth loss value, and the fifth loss value; The enhancement module is used to, when the total loss value meets a preset condition, save the trained generative adversarial network, acquire the current low-light image, segment the current low-light image to obtain a second segmentation result, select the component image in the second segmentation result as the current component image, and generate the enhanced current component image through the generator in the trained generative adversarial network. The current low-light image is a low-light image obtained by photographing the currently damaged vehicle. The step of determining a first loss value, a second loss value, a third loss value, a fourth loss value, and a fifth loss value based on the enhanced preset component image and the normal lighting image includes: The content features, texture features, and color features of the enhanced preset component image are obtained, as are the content features, texture features, and color features of the normal illumination image. The enhanced preset component image is decomposed into a first reflection image and a first brightness image, and the normal illumination image is decomposed into a second reflection image and a second brightness image. The loss value between the content features of the enhanced preset component image and the content features of the normal illumination image is selected as the first loss value; the loss value between the texture features of the enhanced preset component image and the texture features of the normal illumination image is selected as the second loss value; the loss value between the color features of the enhanced preset component image and the color features of the normal illumination image is selected as the third loss value; the loss value between the first reflection map and the second reflection map is selected as the fourth loss value; and the loss value between the first luminance map and the second luminance map is selected as the fifth loss value.
8. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the image enhancement method as described in any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the image enhancement method as described in any one of claims 1 to 6.