Image enhancement method and device, equipment and storage medium
By training a model using a generative adversarial network, low-light images are automatically segmented and enhanced, solving the blurring problem in low-light images, improving the efficiency and reliability of image enhancement, and reducing manual adjustment time.
Patent Information
- Application Number
- CN202411261720.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-09
- Publication Date
- 2024-11-29
- Estimated Expiration
- 2044-09-09
Smart Images

Figure CN119048410A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of artificial intelligence and financial technology, and in particular to image enhancement methods, devices, equipment and storage media. Background Art
[0002] At night, in low light or backlit environments, due to insufficient exposure, a mobile phone photo of the damaged vehicle will produce a low-light image. The low-light image appears blurry due to insufficient light, making it impossible for the claims system to determine the extent and scope of the vehicle damage based on the low-light image.
[0003] However, the enhancement process of the current component image of the current low-light image is cumbersome, which is not conducive to improving the enhancement efficiency of the current component image. The reason is that the traditional image enhancement method lacks pertinence and cannot directly enhance the current component image, which requires the staff to enhance the current component image by manually adjusting multiple parameters. This process is not only time-consuming and labor-intensive, but also easily affected by manual intervention. Therefore, it is not conducive to improving the enhancement efficiency of the current component image. Summary of the invention
[0004] The present invention provides an image enhancement method, device, computer equipment and storage medium to solve the technical problem that the enhancement process of a current component image of a current low-light image is cumbersome and is not conducive to improving the enhancement efficiency of the current component image.
[0005] In a first aspect, an image enhancement method is provided, comprising:
[0006] Acquire a preset low-light image, and 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;
[0007] Selecting a component image in the first segmentation result as a preset component image, and combining the preset component image and a normal illumination image corresponding to the preset component image into a sample data;
[0008] 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;
[0009] Determining a first loss value, a second loss value, a third loss value, a fourth loss value, and a fifth loss value according to the enhanced preset component image and the normal illumination image;
[0010] Determine a total loss value according to 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 conditions, 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 an enhanced current component image is generated through the generator in the trained generative adversarial network, where the current low-light image is a low-light image obtained by photographing the current damaged vehicle.
[0012] Furthermore, the selecting of the component image in the first segmentation result as the preset component image, and combining the preset component image and the normal illumination image corresponding to the preset component image into a sample data includes:
[0013] Selecting a component image in the first segmentation result as a preset component image, and obtaining a query interface of a database;
[0014] Through the query interface, in the database, a normal illumination image corresponding to the preset component image is obtained, and the preset component image and the normal illumination image are combined into one sample data.
[0015] Furthermore, the training of 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 include:
[0016] Training a generative adversarial network based on the sample data, and inputting the preset component image in the sample data into a generator in the generative adversarial network;
[0017] The preset component image is processed by the generator in the generative adversarial network to generate an enhanced preset component image.
[0018] Further, the determining of a first loss value, a second loss value, a third loss value, a fourth loss value, and a fifth loss value according to the enhanced preset component image and the normal illumination image includes:
[0019] Obtaining content features, texture features, and color features of the enhanced image of the preset component, obtaining content features, texture features, and color features of the normal illumination image, decomposing the enhanced image of the preset component into a first reflection map and a first brightness map, and decomposing the normal illumination image into a second reflection map and a second brightness map;
[0020] The loss value between the enhanced content features of the preset component image and the content features of the normal lighting image is selected as the first loss value, the loss value between the enhanced texture features of the preset component image and the texture features of the normal lighting image is selected as the second loss value, the loss value between the enhanced color features of the preset component image and the color features of the normal lighting 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 brightness map and the second brightness map is selected as the fifth loss value.
[0021] Further, determining a total loss value according to the first loss value, the second loss value, the third loss value, the fourth loss value, and the fifth loss value includes:
[0022] 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;
[0023] A model is generated according to the first comprehensive loss value, the second comprehensive loss value and the preset total loss value to generate enhanced total loss values of the preset component image and the normal illumination image.
[0024] Furthermore, when the total loss value satisfies a preset condition, the trained generative adversarial network is saved, a current low-light image is acquired, 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 through a generator in the trained generative adversarial network, wherein the current low-light image is a low-light image obtained by photographing the current damaged vehicle, including:
[0025] When the total loss value is less than a preset loss value, stop training the generative adversarial network, save the trained generative adversarial network, obtain a current low-light image, input the current low-light image into a vehicle component segmentation model, and obtain a second segmentation result output by the vehicle component segmentation model based on the current low-light image;
[0026] A component image in the second segmentation result is selected as a current component image, and the current component image is input into a generator in the trained generative adversarial network. The current component image is processed by the generator in the trained generative adversarial network to generate an enhanced current component image.
[0027] Further, when the total loss value satisfies the 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, a component image in the second segmentation result is selected as the current component image, and an enhanced current component image is generated by a generator in the trained generative adversarial network. Then, the image enhancement method includes:
[0028] A preset display window is obtained, and the enhanced current component image is displayed through the display window.
[0029] In a second aspect, an image enhancement device is provided, comprising:
[0030] an acquisition module, configured to acquire a preset low-light image, segment the preset low-light image, and obtain a first segmentation result, wherein the preset low-light image is a low-light image obtained by photographing a preset damaged vehicle;
[0031] A selection module, configured to select a component image in the first segmentation result as a preset component image, and combine the preset component image and a normal illumination image corresponding to the preset component image into a sample data;
[0032] A training module, used for 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;
[0033] A first determination module, configured to determine a first loss value, a second loss value, a third loss value, a fourth loss value, and a fifth loss value according to the enhanced preset component image and the normal illumination image;
[0034] A second determining module, configured to determine a total loss value according to the first loss value, the second loss value, the third loss value, the fourth loss value, and the fifth loss value;
[0035] The enhancement module is used to save the trained generative adversarial network when the total loss value meets the preset conditions, obtain 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 an enhanced current component image through the generator in the trained generative adversarial network, wherein the current low-light image is a low-light image obtained by photographing the current damaged vehicle.
[0036] In a third aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned image enhancement method when executing the computer program.
[0037] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned image enhancement method are implemented.
[0038] The present application provides an image enhancement method, apparatus, computer equipment and storage medium, which obtain 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; select a component image in the first segmentation result as the preset component image, and form a sample data with the preset component image and a normal-light image corresponding to the preset component image; train a generative adversarial network based on the sample data, and generate an enhanced preset component image through a generator in the generative adversarial network; determine a first loss value, a second loss value, a third loss value, a fourth loss value and a fifth loss value according to the enhanced preset component image and the normal-light image; determine a total loss value according to 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 a preset condition, save the trained generative adversarial network, obtain a current low-light image, and segment the current low-light image. Cut to obtain a second segmentation result, select the component image in the second segmentation result as the current component image, and generate an 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 shooting the current damaged vehicle. The beneficial effects are in two aspects. On the one hand, when the total loss value meets the preset conditions, the trained generative adversarial network is saved, the current low-light image is obtained, and the current low-light image is segmented to obtain the second segmentation result, and the component image in the second segmentation result is selected as the current component image. Through the generator in the trained generative adversarial network, the enhanced current component image is generated. 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, which is beneficial to improve the enhancement efficiency of the current component image of the current low-light image; on the other hand, since the generator will not be affected by manual intervention, it is beneficial to improve the reliability of the acquired enhanced current component image. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0040] Figure 1is a schematic diagram of an application environment of an image enhancement method in one embodiment of the present invention;
[0041] Figure 2 A schematic diagram of a flow chart of an image enhancement method provided by an embodiment of the present invention;
[0042] Figure 3 yes Figure 1 A schematic flow chart of a specific implementation of step S23;
[0043] Figure 4 yes Figure 1 A schematic flow chart of a specific implementation of step S25;
[0044] Figure 5 yes Figure 1 A schematic flow chart of a specific implementation of step S26;
[0045] Figure 6 is a structural schematic diagram of an image enhancement device in one embodiment of the present invention;
[0046] Figure 7 is a schematic diagram of a structure of a computer device in one embodiment of the present invention;
[0047] Figure 8 It is another structural schematic diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION
[0048] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0049] See also Figure 1 , Figure 1 FIG. 1 is a schematic diagram of an application environment of an image enhancement method according to an embodiment of the present invention. The image enhancement method provided by the embodiment of the present invention can be applied in the following embodiments: Figure 1 In an application environment, a client communicates with a server through a network.
[0050] The server obtains a preset low-light image through the client, and segments 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;
[0051] Selecting a component image in the first segmentation result as a preset component image, and combining the preset component image and a normal illumination image corresponding to the preset component image into a sample data;
[0052] 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;
[0053] Determining a first loss value, a second loss value, a third loss value, a fourth loss value, and a fifth loss value according to the enhanced preset component image and the normal illumination image;
[0054] Determine a total loss value according to 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 conditions, 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 an enhanced current component image is generated through the generator in the trained generative adversarial network, where the current low-light image is a low-light image obtained by photographing the current damaged vehicle.
[0056] In an embodiment of the present invention, the beneficial effects lie in two aspects. On the one hand, when the total loss value meets the preset conditions, 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 generator in the trained generative adversarial network is used to generate an enhanced current component image. 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, which is beneficial to improving the enhancement efficiency of the current component image of the current low-light image. On the other hand, since the generator will not be affected by manual intervention, it is beneficial to improve the reliability of the acquired enhanced current component image.
[0057] The client may include but is not limited to various personal computers, laptops, smart phones, tablet computers, and portable wearable devices.
[0058] The server can be implemented with an independent task database or a task database cluster composed of multiple task databases. The present invention is described in detail below through specific embodiments.
[0059] See also Figure 2 , Figure 2 A flowchart of an image enhancement method provided by an embodiment of the present invention includes the following steps:
[0060] S21, obtaining a preset low-light image, and 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;
[0061] Exemplarily, the acquiring a preset low-light image and segmenting the preset low-light image to obtain a first segmentation result includes:
[0062] The preset low-light image is acquired, and the preset low-light image is input into a preset vehicle component segmentation model to obtain a first segmentation result output by the vehicle component segmentation model based on the preset low-light image.
[0063] Among them, the vehicle parts segmentation model is a machine learning model specifically used to identify and segment individual parts in vehicle images.
[0064] S22, selecting a component image in the first segmentation result as a preset component image, and combining the preset component image and a normal illumination image corresponding to the preset component image into a sample data;
[0065] The selecting of the component image in the first segmentation result as the preset component image and combining the preset component image and the normal illumination image corresponding to the preset component image into a sample data comprises:
[0066] Selecting a component image in the first segmentation result as a preset component image, and obtaining a query interface of a database;
[0067] Through the query interface, in the database, a normal light image corresponding to the preset component image is obtained, and the preset component image and the normal light image are combined into one sample data, wherein the normal light image is an image of the preset damaged vehicle taken under normal lighting conditions.
[0068] Normal lighting conditions generally refer to a lighting environment that is neither too bright nor too dim, and that allows the human eye and photographic equipment to comfortably capture and identify details of a pre-determined damaged vehicle. Such conditions are common in both natural and artificial environments, such as outdoors on a clear day, in a room using conventional indoor lighting equipment, etc.
[0069] Under normal lighting conditions, the light distribution is relatively uniform, with no obvious direct strong light or dark shadow areas, so that the pre-set damaged vehicle surface can clearly show its original color, texture and shape. At the same time, the intensity and color temperature of the light are also within the appropriate range, which will neither cause color distortion nor dim images or blurred details due to insufficient light.
[0070] Such lighting conditions are crucial for fields such as photography, videography, image processing, and computer vision, as they ensure the quality and accuracy of image data and provide a reliable basis for subsequent image analysis, processing, and applications.
[0071] S23, 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;
[0072] Among them, Generative Adversarial Networks (GAN) is an innovative unsupervised deep learning model that works through the mutual game learning between the generative model and the discriminative model. The task of the generative model is to capture the distribution of real data and generate new data that is as realistic as possible, such as images, text, etc.; while the discriminative model is a binary classifier that is responsible for judging whether the input data is real or generated by the generative model.
[0073] S24, determining a first loss value, a second loss value, a third loss value, a fourth loss value, and a fifth loss value according to the enhanced preset component image and the normal illumination image;
[0074] Wherein, determining the first loss value, the second loss value, the third loss value, the fourth loss value and the fifth loss value according to the enhanced preset component image and the normal illumination image includes:
[0075] Obtaining content features, texture features, and color features of the enhanced image of the preset component, obtaining content features, texture features, and color features of the normal illumination image, decomposing the enhanced image of the preset component into a first reflection map and a first brightness map, and decomposing the normal illumination image into a second reflection map and a second brightness map;
[0076] The loss value between the enhanced content features of the preset component image and the content features of the normal lighting image is selected as the first loss value, the loss value between the enhanced texture features of the preset component image and the texture features of the normal lighting image is selected as the second loss value, the loss value between the enhanced color features of the preset component image and the color features of the normal lighting 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 brightness map and the second brightness map is selected as the fifth loss value.
[0077] Exemplarily, the selecting of the loss value between the content feature of the enhanced preset component image and the content feature of the normal illumination image as the first loss value, the selecting of the loss value between the texture feature of the enhanced preset component image and the texture feature of the normal illumination image as the second loss value, the selecting of the loss value between the color feature of the enhanced preset component image and the color feature of the normal illumination image as the third loss value, the selecting of the loss value between the first reflection map and the second reflection map as the fourth loss value, and the selecting of the loss value between the first brightness map and the second brightness map as the fifth loss value includes:
[0078] Obtaining a loss value between the enhanced content features of the preset component image and the content features of the normal illumination image through a content loss function;
[0079] Obtaining a loss value between the enhanced texture features of the preset component image and the texture features of the normal illumination image through a style loss function;
[0080] Obtaining a loss value between the enhanced color feature of the preset component image and the color feature of the normal illumination image through an absolute value loss function or a square loss function;
[0081] Obtaining a loss value between the first reflection map and the second reflection map, and obtaining a loss value between the first brightness map and the second brightness map through a pixel loss function;
[0082] The loss value between the enhanced content features of the preset component image and the content features of the normal lighting image is selected as the first loss value, the loss value between the enhanced texture features of the preset component image and the texture features of the normal lighting image is selected as the second loss value, the loss value between the enhanced color features of the preset component image and the color features of the normal lighting 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 brightness map and the second brightness 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 difference between the content features of the enhanced preset component image and the normal illumination image.
[0084] Among them, the style loss function is a loss measurement method used in generative adversarial networks and style transfer tasks.
[0085] Among them, the absolute value loss function, also known as L1 loss, is calculated by taking the absolute value of the difference between the model prediction value and the actual value.
[0086] Among them, 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] Among them, 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, determining a total loss value according to 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 conditions, save the trained generative adversarial network, obtain 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 an enhanced current component image through the generator in the trained generative adversarial network, where the current low-light image is a low-light image obtained by photographing the current damaged vehicle.
[0090] Among them, the claims system can determine the damaged parts of the current damaged vehicle through the current parts image.
[0091] For the sake of illustration, the types of damaged parts of the current damaged vehicles are as follows:
[0092] The exterior parts of a vehicle, such as bumpers, lights, windows and body panels, are usually the first to be impacted and possibly damaged in an accident. Damage to these parts not only affects the appearance of the vehicle, but may also affect the driver's field of vision and the overall safety of the vehicle.
[0093] The vehicle's frame and chassis components: such as the frame, suspension arms, drive shafts, etc., if damaged in these collisions, may have a serious impact on the vehicle's stability and driving performance. The distortion or breakage of the frame will weaken the vehicle's anti-collision ability, while damage to the chassis components may directly lead to vehicle control failure or abnormal noise during driving.
[0094] The power components of a vehicle, such as the engine cylinder, crankshaft, piston, etc., will directly affect the power output and normal operation of the vehicle once a failure occurs. The repair or replacement of these components often requires professional technology and equipment, and is costly.
[0095] Wherein, when the total loss value satisfies the 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, a component image in the second segmentation result is selected as the current component image, and an enhanced current component image is generated by a generator in the trained generative adversarial network, the image enhancement method comprises:
[0096] A preset display window is obtained, and the enhanced current component image is displayed through the display window.
[0097] In an embodiment of the present invention, the beneficial effects lie in two aspects. On the one hand, when the total loss value meets the preset conditions, 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 generator in the trained generative adversarial network is used to generate an enhanced current component image. 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, which is beneficial to improving the enhancement efficiency of the current component image of the current low-light image. On the other hand, since the generator will not be affected by manual intervention, it is beneficial to improve the reliability of the acquired enhanced current component image.
[0098] See also Figure 3 , Figure 3 yes Figure 1 A specific implementation flow diagram of step S23 is described in detail as follows:
[0099] S31, training a generative adversarial network based on the sample data, and inputting the preset component image in the sample data into a generator in the generative adversarial network;
[0100] S32, processing the preset component image through the generator in the generative adversarial network to generate an enhanced preset component image.
[0101] In the embodiment of the present invention, by comparing the enhanced image of the preset component with the normal illumination image, the training efficiency of the generative adversarial network can be improved.
[0102] See also Figure 4 , Figure 4 yes Figure 1 A specific implementation flow diagram of step S25 is described in detail as follows:
[0103] S41, adding the first loss value, the second loss value, and the third loss value to generate a first comprehensive loss value, and adding the fourth loss value and the fifth loss value to generate a second comprehensive loss value;
[0104] S42, generating a model according to the first comprehensive loss value, the second comprehensive loss value and the preset total loss value, and generating enhanced total loss values of the preset component image and the normal illumination image.
[0105] Among them, the total loss value generation model is
[0106] L = λ1*L1+λ2*L2;
[0107] Among them, 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 the embodiment of the present invention, the total loss value of the enhanced preset component image and the normal illumination image can be used to evaluate the performance of the generator.
[0111] See also Figure 5 , Figure 5 yes Figure 1 A specific implementation flow diagram of step S26 is described in detail as follows:
[0112] S51, when the total loss value is less than a preset loss value, stop training the generative adversarial network, save the trained generative adversarial network, obtain a current low-light image, input the current low-light image into a vehicle component segmentation model, and obtain a second segmentation result output by the vehicle component segmentation model based on the current low-light image;
[0113] S52, selecting a component image in the second segmentation result as a current component image, inputting the current component image into a generator in the trained generative adversarial network, and processing the current component image through the generator in the trained generative adversarial network to generate an enhanced current component image.
[0114] In the embodiment of the present 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, which is beneficial to improving the enhancement efficiency of the current component image of the current low-light image.
[0115] See also Figure 6 , Figure 6 FIG. 1 is a schematic diagram of a structure of an image enhancement device in one embodiment of the present invention. 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. The functional modules are described in detail as follows:
[0116] An acquisition module 101 is used to acquire a preset low-light image and 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] A selection module 102 is used to select a component image in the first segmentation result as a preset component image, and combine the preset component image and a normal illumination image corresponding to the preset component image into a sample data;
[0118] A training module 103 is used to train a generative adversarial network based on the sample data, and generate an enhanced image of the preset component through a generator in the generative adversarial network;
[0119] A first determining module 104, configured to determine a first loss value, a second loss value, a third loss value, a fourth loss value, and a fifth loss value according to the enhanced preset component image and the normal illumination image;
[0120] A second determining module 105, configured to determine a total loss value according to 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, obtain 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 an enhanced current component image through the generator in the trained generative adversarial network, where the current low-light image is a low-light image obtained by photographing the current damaged vehicle.
[0122] In one embodiment, the selection module 102 includes:
[0123] A first acquisition subunit is used to select a component image in the first segmentation result as a preset component image and acquire a query interface of a database;
[0124] The second acquisition subunit is used to acquire the normal illumination image corresponding to the preset component image in the database through the query interface, and combine the preset component image and the normal illumination image into one sample data.
[0125] In one embodiment, the training module 103 includes:
[0126] A training subunit, configured to train a generative adversarial network based on the sample data, and input the preset component image in the sample data into a generator in the generative adversarial network;
[0127] The generating 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] a decomposition subunit, configured to obtain content features, texture features, and color features of the enhanced preset component image, obtain 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 a loss value between the content features of the enhanced preset component image and the content features of the normal lighting image as a first loss value, select a loss value between the texture features of the enhanced preset component image and the texture features of the normal lighting image as a second loss value, select a loss value between the color features of the enhanced preset component image and the color features of the normal lighting image as a third loss value, select a loss value between the first reflection map and the second reflection map as a fourth loss value, and select a 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] A first generating subunit is configured 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 generating subunit is used to generate a model according to the first comprehensive loss value, the second comprehensive loss value and the preset total loss value, and generate the enhanced total loss value of the preset component image and the normal illumination image.
[0134] In one embodiment, the enhancement module 106 includes:
[0135] a segmentation subunit, configured 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 a current low-light image, input the current low-light image into a vehicle component segmentation model, and obtain a 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 a component image in the second segmentation result as a 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 an 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 current component image through the display window.
[0139] In an embodiment of the present invention, the beneficial effects lie in two aspects. On the one hand, when the total loss value meets the preset conditions, 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 generator in the trained generative adversarial network is used to generate an enhanced current component image. 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, which is beneficial to improving the enhancement efficiency of the current component image of the current low-light image. On the other hand, since the generator will not be affected by manual intervention, it is beneficial to improve the reliability of the acquired enhanced current component image.
[0140] For the specific definition of the image enhancement device, please refer to the definition of the image enhancement method above, which will not be repeated here.
[0141] Each module in the above-mentioned image enhancement device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module.
[0142] See also Figure 7 , Figure 7is a schematic diagram of a computer device in one embodiment of the present invention. In one embodiment, a computer device is provided. The computer device may be a server. The internal structure diagram thereof may be as shown in FIG. Figure 7 The computer device includes a processor, a memory, a network interface and a database connected through a system bus.
[0143] The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external client through a network connection. When the computer program is executed by the processor, a function or step of an image enhancement method can be implemented on the server side.
[0144] See also Figure 8 , Figure 8 is another structural diagram of a computer device in one embodiment of the present invention. In one embodiment, a computer device is provided. The computer device may be a client, and its internal structure diagram may be as shown in FIG. Figure 8 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external task database through a network connection. When the computer program is executed by the processor, the functions or steps of an image enhancement method can be implemented on the client.
[0145] In one embodiment, a computer device is provided, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor.
[0146] It should be noted that the above functions or steps that can be implemented by the computer-readable storage medium or computer device can refer to the relevant descriptions of the server and the client in the aforementioned method embodiment. To avoid repetition, they will not be described one by one here.
[0147] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a graphics processing unit (GPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0148] The flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to the embodiment of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. In the description corresponding to the flowchart and the block diagram in the accompanying drawings, the operations or steps corresponding to different boxes can also occur in a different order from the order disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. Each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified functions or actions, or may be implemented by a combination of dedicated hardware and computer instructions.
Claims
1. An image enhancement method, characterized in that: include: Acquire a preset low-light image, and 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; Selecting a component image in the first segmentation result as a preset component image, and combining the preset component image and a normal illumination image corresponding to the preset component image into a sample data; 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; Determining a first loss value, a second loss value, a third loss value, a fourth loss value, and a fifth loss value according to the enhanced preset component image and the normal illumination image; Determine a total loss value according to 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 conditions, 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 an enhanced current component image is generated through the generator in the trained generative adversarial network, where the current low-light image is a low-light image obtained by photographing the current damaged vehicle.
2. The image enhancement method according to claim 1, characterized in that: The selecting a component image in the first segmentation result as a preset component image, and combining the preset component image and a normal illumination image corresponding to the preset component image into a sample data comprises: Selecting a component image in the first segmentation result as a preset component image, and obtaining a query interface of a database; Through the query interface, in the database, a normal illumination image corresponding to the preset component image is obtained, and the preset component image and the normal illumination image are combined into one sample data.
3. The image enhancement method according to claim 1, characterized in that: 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: Training a generative adversarial network based on the sample data, and inputting the preset component image in the sample data into a generator in the generative adversarial network; The preset component image is processed by the generator in the generative adversarial network to generate an enhanced preset component image.
4. The image enhancement method according to claim 1, characterized in that: The determining of a first loss value, a second loss value, a third loss value, a fourth loss value, and a fifth loss value according to the enhanced preset component image and the normal illumination image comprises: Obtaining content features, texture features, and color features of the enhanced image of the preset component, obtaining content features, texture features, and color features of the normal illumination image, decomposing the enhanced image of the preset component into a first reflection map and a first brightness map, and decomposing the normal illumination image into a second reflection map and a second brightness map; The loss value between the enhanced content features of the preset component image and the content features of the normal lighting image is selected as the first loss value, the loss value between the enhanced texture features of the preset component image and the texture features of the normal lighting image is selected as the second loss value, the loss value between the enhanced color features of the preset component image and the color features of the normal lighting 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 brightness map and the second brightness map is selected as the fifth loss value.
5. The image enhancement method according to claim 1, characterized in that: The determining a total loss value according to the first loss value, the second loss value, the third loss value, the fourth loss value, and the fifth loss value comprises: 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; A model is generated according to the first comprehensive loss value, the second comprehensive loss value and the preset total loss value to generate enhanced total loss values of the preset component image and the normal illumination image.
6. The image enhancement method according to claim 1, characterized in that: When the total loss value satisfies a preset condition, the trained generative adversarial network is saved, a current low-light image is acquired, 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 a generator in the trained generative adversarial network, wherein the current low-light image is a low-light image obtained by photographing the current damaged vehicle, including: When the total loss value is less than a preset loss value, stop training the generative adversarial network, save the trained generative adversarial network, obtain a current low-light image, input the current low-light image into a vehicle component segmentation model, and obtain a second segmentation result output by the vehicle component segmentation model based on the current low-light image; A component image in the second segmentation result is selected as a current component image, and the current component image is input into a generator in the trained generative adversarial network. The current component image is processed by the generator in the trained generative adversarial network to generate an enhanced current component image.
7. The image enhancement method according to any one of claims 1 to 6, characterized in that: When the total loss value satisfies the preset condition, the trained generative adversarial network is saved, a current low-light image is acquired, 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 a generator in the trained generative adversarial network, the image enhancement method comprises: A preset display window is obtained, and the enhanced current component image is displayed through the display window.
8. An image enhancement device, characterized in that: include: an acquisition module, configured to acquire a preset low-light image, segment the preset low-light image, and obtain a first segmentation result, wherein the preset low-light image is a low-light image obtained by photographing a preset damaged vehicle; A selection module, configured to select a component image in the first segmentation result as a preset component image, and combine the preset component image and a normal illumination image corresponding to the preset component image into a sample data; A training module, used for 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; A first determination module, configured to determine a first loss value, a second loss value, a third loss value, a fourth loss value, and a fifth loss value according to the enhanced preset component image and the normal illumination image; A second determining module, configured to determine a total loss value according to 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 save the trained generative adversarial network when the total loss value meets the preset conditions, obtain 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 an enhanced current component image through the generator in the trained generative adversarial network, wherein the current low-light image is a low-light image obtained by photographing the current damaged vehicle.
9. 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, the steps of the image enhancement method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the image enhancement method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Image enhancement method, device and equipment and readable storage medium
CN114648457A
Image enhancement method, vehicle snapshot method, device and medium
CN115984133A
Low-illumination image enhancement method and system based on improved generative adversarial network
CN117593238A
Image enhancement method and device, computer equipment and storage medium
CN118096562A
Image processing method and apparatus, electronic device, and storage medium
WO2020168706A1
