Image enhancement method, device, equipment and storage medium

By acquiring and adjusting images to determine sample images and using these sample images to train the lora model, the problem of training CNN models in the prior art requires a large number of images, and the effect of saving time and resources in lora model training is achieved.

CN119741224APending Publication Date: 2025-04-01SHANGHAI IQIYI NEW MEDIA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411952592.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-27
Publication Date
2025-04-01

AI Technical Summary

Technical Problem

The prior art requires a large number of sample images when training a CNN model, resulting in the time-consuming and resource-intensive process of acquiring images.

Method used

By acquiring the target intensity interval corresponding to multiple images and the target enhancement gear, the sample image corresponding to the target intensity interval is determined, and the image is adjusted using the intensity adjustment strategy to reduce the number of sample images. When the number of sample images reaches a preset number, the Lora model is trained using these sample images.

Benefits of technology

When training the lora model, there is no need to obtain a large number of images, saving time and effort in obtaining sample images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119741224A_ABST
    Figure CN119741224A_ABST
Patent Text Reader

Abstract

The present application relates to an image enhancement method, device, equipment and storage medium, the method comprising: obtaining a plurality of images and a target intensity interval corresponding to a target enhancement level; in the image, determining a sample image corresponding to the target intensity interval; when the total number of the sample images is less than a preset number, adjusting the image using an intensity adjustment strategy to obtain the total number of adjusted sample images; when the total number of the sample images is not less than a preset number, training a LoRa model using the sample images to obtain a pre-trained LoRa model, the LoRa model being used to generate an image of the target enhancement level. In the process of training the LoRa model, the method does not need to obtain a large number of images, saving time and energy in obtaining sample images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to an image enhancement method, apparatus, device and storage medium. Background Art

[0002] Posters are important materials for film and television marketing and promotion. They interpret the theme and connotation of the film and television series, and influence and shape the audience's first impression of the film and television series. In order to obtain a large number of posters, appropriate parts are often automatically selected from the original series materials as posters. At the same time, according to the needs of the film and television series, the image is enhanced.

[0003] In the prior art, images are enhanced by using a pre-trained CNN model.

[0004] However, when training the CNN model, a large number of sample images need to be prepared in advance, ranging from a few thousand to tens of thousands. That is, the training process requires a very large amount of images to meet the needs, and the process of obtaining images is time-consuming and resource-intensive. Summary of the invention

[0005] The present application provides an image enhancement method, apparatus, device and storage medium. In the process of training the Lora model, there is no need to obtain a large number of images, saving time and energy in obtaining sample images.

[0006] In a first aspect, the present application provides an image enhancement method, the method comprising:

[0007] Acquire multiple images and target intensity intervals corresponding to target enhancement levels;

[0008] In the image, determining a sample image corresponding to the target intensity interval;

[0009] When the total number of the sample images is less than a preset number, the images are adjusted using an intensity adjustment strategy to obtain a total number of adjusted sample images;

[0010] When the total number of the sample images is not less than a preset number, the LoRa model is trained using the sample images to obtain a pre-trained LoRa model, and the LoRa model is used to generate the image of the target enhancement gear.

[0011] Optionally, the intensity adjustment strategy is:

[0012] In the image, acquiring a first image other than the sample image;

[0013] Using a plurality of preset colors, adjusting the first image to obtain a plurality of second images;

[0014] In the second image, determining a third image corresponding to the target intensity interval;

[0015] The sample image and the third image are determined as adjusted sample images.

[0016] Optionally, the intensity adjustment strategy is:

[0017] In the image, a fourth image other than the sample image is acquired;

[0018] In the LAB color mode, adjusting the mean and variance of each channel of the fourth image according to the target mean and target variance of each channel of the sample image to obtain a fifth image;

[0019] In the fifth image, determining a sixth image corresponding to the target intensity interval;

[0020] The sample image and the sixth image are determined as adjusted sample images.

[0021] Optionally, the method further includes:

[0022] Get the theme color of each sample image;

[0023] According to the theme color of each sample image, determine the average theme color;

[0024] The average theme color is determined as a preset color.

[0025] Optionally, determining, in the image, a sample image corresponding to the target intensity interval includes:

[0026] Get all pixels in the image;

[0027] Determine, among all pixels, a target pixel whose intensity is within the target intensity range;

[0028] When the target pixel meets a preset condition, the image is determined as a sample image corresponding to the target intensity interval.

[0029] Optionally, the method further includes:

[0030] Acquire a test image to be used and obtain a test reference image;

[0031] Determining a wake-up word to be used according to a test target intensity interval corresponding to the test reference image;

[0032] According to the theme color of the test reference image, the test reference image is adjusted to obtain a test input image;

[0033] The pre-trained lora model is tested according to the test input image, the test reference image and the wake-up word.

[0034] Optionally, adjusting the test reference image according to a theme color of the test reference image to obtain a test input image includes:

[0035] Obtaining a weight coefficient corresponding to the theme color and a weight coefficient of the test reference image;

[0036] Multiplying the theme color by the corresponding weight coefficient to obtain a first result;

[0037] Multiplying the test reference image by the corresponding weight coefficient to obtain a second result;

[0038] The first result and the second result are added together to obtain a test input image.

[0039] In a second aspect, the present application provides an image enhancement device, the device comprising:

[0040] An acquisition unit, used to acquire multiple images and target intensity intervals corresponding to target enhancement levels;

[0041] A first determining unit, configured to determine, in the image, a sample image corresponding to the target intensity interval;

[0042] A first utilizing unit, configured to, when the total number of the sample images is less than a preset number, adjust the images using an intensity adjustment strategy to obtain a total number of adjusted sample images;

[0043] The second utilizing unit is used for training the LoRa model using the sample images when the total number of the sample images is not less than a preset number to obtain a pre-trained LoRa model, and the LoRa model is used to generate the image of the target enhancement gear.

[0044] Optionally, the device further includes a first strategy unit, wherein the first strategy unit is configured to:

[0045] In the image, acquiring a first image other than the sample image;

[0046] Using a plurality of preset colors, adjusting the first image to obtain a plurality of second images;

[0047] In the second image, determining a third image corresponding to the target intensity interval;

[0048] The sample image and the third image are determined as adjusted sample images.

[0049] Optionally, the device further includes a second strategy unit, wherein the second strategy unit is configured to:

[0050] In the image, a fourth image other than the sample image is acquired;

[0051] In the LAB color mode, adjusting the mean and variance of each channel of the fourth image according to the target mean and target variance of each channel of the sample image to obtain a fifth image;

[0052] In the fifth image, determining a sixth image corresponding to the target intensity interval;

[0053] The sample image and the sixth image are determined as adjusted sample images.

[0054] Optionally, the device further includes a second determining unit, wherein the second determining unit is configured to:

[0055] Get the theme color of each sample image;

[0056] According to the theme color of each sample image, determine the average theme color;

[0057] The average theme color is determined as a preset color.

[0058] Optionally, the first determining unit is configured to:

[0059] Get all pixels in the image;

[0060] Determine, among all pixels, a target pixel whose intensity is within the target intensity range;

[0061] When the target pixel meets a preset condition, the image is determined as a sample image corresponding to the target intensity interval.

[0062] Optionally, the device further comprises a testing unit, wherein the testing unit is used to:

[0063] Acquire a test image to be used and obtain a test reference image;

[0064] Determining a wake-up word to be used according to a test target intensity interval corresponding to the test reference image;

[0065] According to the theme color of the test reference image, the test reference image is adjusted to obtain a test input image;

[0066] The pre-trained lora model is tested according to the test input image, the test reference image and the wake-up word.

[0067] Optionally, the testing unit is used to:

[0068] Obtaining a weight coefficient corresponding to the theme color and a weight coefficient of the test reference image;

[0069] Multiplying the theme color by the corresponding weight coefficient to obtain a first result;

[0070] Multiplying the test reference image by the corresponding weight coefficient to obtain a second result;

[0071] The first result and the second result are added together to obtain a test input image.

[0072] In a third aspect, the present application provides an image enhancement device, comprising: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; at least one memory connected to the at least one bus, wherein the processor is configured to:

[0073] Acquire multiple images and target intensity intervals corresponding to target enhancement levels;

[0074] In the image, determining a sample image corresponding to the target intensity interval;

[0075] When the total number of the sample images is less than a preset number, the images are adjusted using an intensity adjustment strategy to obtain a total number of adjusted sample images;

[0076] When the total number of the sample images is not less than a preset number, the LoRa model is trained using the sample images to obtain a pre-trained LoRa model, and the LoRa model is used to generate the image of the target enhancement gear.

[0077] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the above-mentioned image enhancement method when executed by a processor.

[0078] The above technical solution provided by the embodiment of the present application has the following advantages compared with the prior art:

[0079] In an embodiment of the present application, a plurality of images and a target intensity interval corresponding to a target enhancement gear are obtained; in the image, a sample image corresponding to the target intensity interval is determined; when the total number of the sample images is less than a preset number, the image is adjusted using an intensity adjustment strategy to obtain the total number of adjusted sample images; when the total number of the sample images is not less than a preset number, the LoRa model is trained using the sample images to obtain a pre-trained LoRa model, which is used to generate images of the target enhancement gear. Since the LoRa training method requires a small number of sample images, there is no need to obtain a large number of images in the process of training the LoRa model, saving time and energy in obtaining sample images. BRIEF DESCRIPTION OF THE DRAWINGS

[0080] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0081] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0082] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.

[0083] Figure 1 A schematic diagram of a flow chart of an image enhancement method provided in an embodiment of the present application;

[0084] Figure 2 A flowchart of a method for determining a theme color provided in an embodiment of the present application;

[0085] Figure 3 A schematic diagram of a flow chart of a sample image determination method provided in an embodiment of the present application;

[0086] Figure 4 A flowchart of a method for determining a theme color interval provided in an embodiment of the present application;

[0087] Figure 5 A schematic diagram of a flow chart of a target image determination method provided in an embodiment of the present application;

[0088] Figure 6 A flowchart of a method for determining a theme color provided in an embodiment of the present application;

[0089] Figure 7 A schematic diagram of a flow chart of another image enhancement method provided in an embodiment of the present application;

[0090] Figure 8 A schematic diagram of a process flow of an image enhancement device provided in an embodiment of the present application;

[0091] Fig. 9 A schematic diagram of an image enhancement device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0092] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0093] The disclosure below provides many different embodiments or examples to implement different structures of the present invention. In order to simplify the disclosure of the present invention, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present invention. In addition, the present invention can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.

[0094] Posters are important materials for film and television marketing and promotion. They interpret the theme and connotation of the film and television series, and influence and shape the audience's first impression of the film and television series. In order to obtain a large number of posters, suitable parts are often automatically selected from the original series materials as posters. At the same time, according to the needs of the film and television series, the image is enhanced. In the prior art, the image is enhanced by a pre-trained CNN model. However, when training the CNN model, a large number of sample images need to be prepared in advance, ranging from a few thousand to tens of thousands. That is, the training process requires a very large amount of images to meet the needs, and the process of obtaining images is time-consuming and resource-intensive.

[0095] In order to solve the above problems, the embodiment of the present application provides an image enhancement method. In the process of training the lora model, there is no need to obtain a large number of images, which saves time and energy in obtaining sample images. Figure 1 As shown, the specific steps include:

[0096] Step 101, obtaining a plurality of images and target intensity intervals corresponding to target enhancement levels.

[0097] In this step, multiple images are collected on the Internet, generally thousands of images are collected. For example, a large number of PS poster images are collected from internal channels, the Internet, Douban, Weibo, official platforms, etc. At the same time, the intensity interval corresponding to each enhancement level is obtained. In this step, when it is necessary to use an image of a certain enhancement level for training, the enhancement level is determined as the target enhancement level, and the enhancement interval corresponding to the target enhancement level is determined as the target enhancement interval.

[0098] Among them, the enhancement level is used to indicate the effect of image enhancement. The enhancement level corresponds to the intensity interval one by one. When two enhancement levels are continuous, in order to make the LoRa model learn the difference between the two enhancement levels, the corresponding intensity interval is discontinuous.

[0099] Furthermore, both the brightness and saturation of the image can achieve image enhancement effects. According to experience, technicians can divide the brightness and saturation into multiple sub-intervals, and combine the sub-intervals of brightness and saturation to obtain intensity intervals. For example, lightness and saturation are each divided into three sub-intervals: [0,25], [40,60], [75,100]. These sub-intervals are combined to obtain nine intensity intervals, namely ([0,25], [0,25]), ([0,25], [40,60]), ([0,25], [75,100]), ([40,60], [0,25]), ([40,60], [40,60]), ([40,60], [75,100]), ([75,100], [0,25]), ([75,100], [40,60]), ([75,100], [75,100]), where the first sub-interval in the intensity interval corresponds to lightness, and the second sub-interval corresponds to saturation.

[0100] It should be noted that the reason why the sub-intervals belonging to the same color type are discontinuous is to ensure that there is an obvious gap between the images of each sub-interval. Once the continuous model cannot easily learn the gap between the gears, the result image will not be obvious between adjacent gears, or even training will fail.

[0101] Step 102: Determine a sample image corresponding to a target intensity range in the image.

[0102] The sample image is essentially one in which the main intensity is concentrated within the target intensity range.

[0103] In this step, for each image, the intensity interval of each pixel is obtained according to the intensity of each pixel in the image. Then, the pixels corresponding to the same intensity interval are divided into the same set to obtain multiple pixel sets. For the pixel set corresponding to the target intensity interval, the number of pixels in the pixel set and the total number of pixels in the image are determined, and the ratio of the number of pixels to the total number is calculated. When the ratio is greater than 50%, it means that the main intensity of the image is concentrated in the target intensity interval, and the image is determined as the sample image corresponding to the target intensity interval.

[0104] Furthermore, according to the intensity of each pixel in the image, the specific steps of obtaining the intensity range of each pixel are as follows: obtaining the brightness and saturation of each pixel, when the brightness and saturation of a pixel are both within a certain intensity range, the pixel is within the intensity range.

[0105] Step 103 : when the total number of sample images is less than a preset number, the images are adjusted using an intensity adjustment strategy to obtain the total number of adjusted sample images.

[0106] The preset number is set based on the experience of technicians. When the total number of sample images is less than the preset number, the training effect of using these sample images for training is not good. When the total number of sample images is not less than the preset number, the training effect of using these sample images for training is good. For example, the preset number is set to 200.

[0107] In this step, when the total number of sample images is less than a preset number, some other sample images need to be obtained. In order to avoid collecting images again, this step can obtain preset intensity adjustment strategies, use these intensity adjustment strategies to adjust the intensity of each pixel in the image, and then find the sample image in the image after intensity adjustment, and then count the total number of these sample images again until the total number of sample images is not less than the preset number.

[0108] Furthermore, since the main intensity of the sample image is concentrated in the target intensity interval, if its intensity is adjusted, the main intensity of the sample image may no longer be concentrated in the target intensity interval. Therefore, this step can also only adjust the intensity of the image other than the sample image to obtain an intensity-adjusted image.

[0109] Step 104: when the total number of sample images is not less than a preset number, the LoRa model is trained using the sample images to obtain a pre-trained LoRa model.

[0110] Among them, the lora model is used to generate images of the target enhancement gear.

[0111] In this step, when the total number of sample images is not less than the preset number, the intensity of the sample image is first adjusted so that the adjusted sample image does not correspond to the target intensity interval, and it is used as the sample input image of the LoRa model. After that, the wake-up word of the target enhancement gear is obtained. Finally, the sample input image and the wake-up word are used as the input data of the LoRa model, and each sample image is used as the reference image in the training process to train the LoRa model, thereby obtaining a pre-trained LoRa model.

[0112] In an embodiment of the present application, a plurality of images and a target intensity interval corresponding to a target enhancement gear are obtained; in the image, a sample image corresponding to the target intensity interval is determined; when the total number of the sample images is less than a preset number, the image is adjusted using an intensity adjustment strategy to obtain the total number of adjusted sample images; when the total number of the sample images is not less than a preset number, the LoRa model is trained using the sample images to obtain a pre-trained LoRa model, which is used to generate images of the target enhancement gear. Since the LoRa training method requires a small number of sample images, there is no need to obtain a large number of images in the process of training the LoRa model, saving time and energy in obtaining sample images.

[0113] In an embodiment of the present application, when the total number of sample images is less than a preset number, it means that the sample images are relatively small. If fewer sample images are used for training, the training effect may not be good. In order to ensure the training effect, when the total number of sample images is less than the preset number, some other sample images need to be obtained. If the images are collected again, it will be time-consuming and laborious. Therefore, in order to avoid collecting images again, an intensity adjustment strategy is provided in an embodiment of the present application, and the images are adjusted based on the intensity adjustment strategy, and then sample images that meet the conditions are found in the images after the intensity adjustment. Therefore, an embodiment of the present application provides an intensity adjustment strategy, which is as follows: Figure 2 As shown, the specific steps include:

[0114] Step 201: in an image, obtain a first image other than a sample image.

[0115] In this step, if the intensity of the sample image is adjusted, the intensity of the adjusted sample image may not be within the target intensity range. To avoid this, the embodiment of the present application only needs to adjust the intensity of the first image other than the sample image.

[0116] It should be noted that when the present application executes this step for multiple intensity intervals at the same time, since each intensity interval is not continuous, the first image is essentially an image whose intensity is not in all intensity intervals.

[0117] Step 202: Use a plurality of preset colors to adjust the first image to obtain a plurality of second images.

[0118] In this step, for each preset color, the preset color is superimposed on each pixel of the first image to obtain an adjusted first image, which is determined as the second image. Since there are multiple first images and multiple preset colors, multiple second images will be obtained in this step.

[0119] Step 203: Determine a third image corresponding to the target intensity interval in the second image.

[0120] This step is similar to step 102 and will not be described in detail here.

[0121] Step 204: determine the sample image and the third image as the adjusted sample image.

[0122] In this step, the sample image and the third image are determined as adjusted sample images. Afterwards, it is continued to detect whether the number of adjusted sample images is less than the preset number. If it is still less than the preset number, it can also be based on Figure 4 The embodiment obtains the adjusted sample images. If the number is not less than a preset number, the LoRa model is trained using the sample images to obtain a pre-trained LoRa model.

[0123] In order to achieve directional enhancement, the embodiment of the present application can also set the preset color to the average theme color corresponding to the target intensity range, and then adjust the first image directionally based on the average theme color to obtain more third images that meet the conditions. Therefore, the embodiment of the present application provides a method for determining a preset color. Figure 3 As shown, the specific steps include:

[0124] Step 301, obtaining the theme color of each sample image.

[0125] In this step, for each sample image, the color of each pixel in the sample image is obtained; based on the color interval in which the color of each pixel is located, the number of pixels corresponding to each color interval is determined; the color interval with the largest number of corresponding pixels is determined as the target color interval; based on the target color interval, the theme color of the sample image is determined.

[0126] It should be noted that the color interval can be set according to the experience of technicians, or determined by other methods, which is not limited here.

[0127] Step 302: Determine an average theme color according to the theme color of each sample image.

[0128] In this step, the theme colors of the sample images are obtained, and the average values ​​of the theme colors are calculated to obtain the average theme color.

[0129] Step 303: determine the average theme color as the preset color.

[0130] In this step, the average theme color is determined as the preset color.

[0131] In addition, the present application embodiment also provides a strength adjustment strategy. Figure 4 As shown, the specific steps include:

[0132] Step 401: Acquire a fourth image other than the sample image in the image.

[0133] This step is similar to step 301 and will not be described in detail here.

[0134] In order to reduce the calculation process, the first image in step 201 may be directly determined as the fourth image.

[0135] Step 402 : In the LAB color mode, according to the target mean and target variance of the sample image in each channel, the mean and variance of the fourth image in each channel are adjusted to obtain a fifth image.

[0136] In this step, in the LAB color mode, according to the target mean and target variance of the sample image in each channel, the mean and variance of the fourth image in each channel are adjusted to be adjusted toward the target mean and target variance to obtain the fifth image.

[0137] Further, the sample image and the fourth image are converted from the RGB color mode to the LAB color mode. For the sample image, in the LAB color mode, the target mean and target variance of each channel are calculated. The target mean is ref_l_mean, ref_a_mean and ref_b_mean. The target variance is ref_l_var, ref_a_var and ref_b_var. For the fourth image, in the LAB color mode, the mean and variance of each channel are calculated. The mean is src_l_mean, src_a_mean and src_b_mean, and the variance is src_l_var, src_a_var and src_b_var. According to the preset formula new_src_l(i)=(src_l(i)-src_l_mean)*ref_l_var / src_l_var+ref_l_mean, the channel value new_src_l(i) of the i-th pixel in the l channel in the fifth image is calculated, and then the channel value of each pixel in the l channel in the fifth image is obtained. Among them, src_l(i) is the channel value of the ith pixel in the fourth image in the l channel. Similarly, the channel values ​​of each pixel in the fifth image in other channels are obtained. Then, the channel is converted back to the RGB channel to obtain the fifth image.

[0138] Step 403: Determine a sixth image corresponding to the target intensity interval in the fifth image.

[0139] This step is similar to step 102 and will not be described in detail here.

[0140] Step 404: determine the sample image and the sixth image as the adjusted sample image.

[0141] In this step, the sample image and the sixth image are determined as adjusted sample images.

[0142] It should be noted that you can first execute Figure 2 The embodiment described above may also be performed first Figure 3 The embodiment described. Figure 2 In the embodiment, if the number of sample images after adjustment is less than the preset number, the process may continue to be performed. Figure 3 Similarly, when the execution is completed first Figure 3 In the embodiment, if the number of sample images after adjustment is less than the preset number, the process may continue to be performed. Figure 2 The embodiment described.

[0143] In the embodiment of the present application, a target pixel whose intensity is within the target intensity interval in the image can be determined, and then whether the image is determined as a sample image corresponding to the target intensity interval is determined according to whether the target pixel meets a preset condition. Therefore, the embodiment of the present application provides a sample image determination method, such as Figure 5 As shown, the specific steps include:

[0144] Step 501, obtaining all pixels in the image.

[0145] In this step, for each image, all pixels in the image are obtained.

[0146] Step 502: Determine, among all pixels, target pixels whose intensities are within a target intensity range.

[0147] In this step, the intensity of each pixel is determined, and based on the intensity of each pixel, pixels whose intensities are within the target intensity range are determined, and these pixels are determined as target pixels.

[0148] Step 503: when the target pixel meets the preset condition, the image is determined as a sample image corresponding to the target intensity interval.

[0149] Among them, the preset condition is that the proportion of the target pixel in the image is greater than the first preset value. The first preset value is set according to the experience of the technicians. For example, the first preset value is 50%. It can also be determined by other methods and is not limited here.

[0150] In this step, the total number of all pixels in the image is obtained, and the ratio of the number of target pixels to the total number is calculated. When the ratio is greater than a first preset value, the image is determined as a sample image corresponding to the target intensity interval.

[0151] Furthermore, in order to prevent the brightness and saturation in the sample image from deviating too much from the target intensity interval, the sample image can be further tested, and when the sample image fails the test, the sample image is discarded. When the sub-intervals included in the intensity interval are discontinuous, a reference intensity interval can be generated based on the target intensity interval, and the proportion of pixels in the sample image whose intensity is in the reference intensity interval is detected. When the proportion is not greater than a second preset value, the sample image is discarded.

[0152] The second preset value is set according to the experience of technicians. For example, the second preset value is 80%. It can also be determined according to other methods and is not limited here.

[0153] Since the target intensity interval includes two sub-intervals, it is necessary to first generate reference sub-intervals corresponding to the two sub-intervals, and then combine the two reference sub-intervals to obtain a reference intensity interval. Therefore, the specific steps for generating a reference sub-interval corresponding to each sub-interval are as follows: when there are other sub-intervals before the sub-interval, the end point of the previous sub-interval is determined as the upper boundary of the reference sub-interval; when there are no other sub-intervals before the sub-interval, the starting point of the sub-interval is determined as the upper boundary of the reference sub-interval. Similarly, when there are other sub-intervals after the sub-interval, the starting point of the next sub-interval is determined as the lower boundary of the reference sub-interval; when there are no other sub-intervals after the sub-interval, the end point of the sub-interval is determined as the lower boundary of the reference sub-interval. Finally, a reference sub-interval is generated based on the upper and lower boundaries of the reference sub-interval.

[0154] For example, the target intensity interval ([0, 25], [40, 60]) corresponds to the reference intensity interval ([0, 40], [25, 75]), and the target intensity interval ([0, 25], [75, 100]) corresponds to the reference intensity interval ([0, 40], [60, 100]).

[0155] In the embodiment of the present application, after obtaining the pre-trained lora model, it is necessary to test it to test whether the pre-trained lora model is qualified. Therefore, the embodiment of the present application provides a model testing method, which is as follows Figure 6 As shown, the specific steps include:

[0156] Step 601: Acquire a test image to be used to obtain a test reference image.

[0157] In this step, the test image to be used is used as a test reference image to evaluate whether the output image of the pre-trained LoRa model is accurate. For example, when the test reference image is not much different from the output image, the pre-trained LoRa model is determined to be qualified, and when the test reference image is greatly different from the output image, the pre-trained LoRa model is determined to be unqualified.

[0158] Step 602: Determine the wake-up word to be used according to the test intensity interval corresponding to the test reference image.

[0159] In this step, the method for determining the test intensity interval corresponding to the test reference image is similar to that in step 102 and will not be described in detail here.

[0160] In this step, the correspondence between the enhancement gear, the intensity interval and the wake-up word is preselected, and then the wake-up word to be used is determined according to the test intensity interval corresponding to the test reference image and the correspondence.

[0161] Furthermore, the wake-up word is used to instruct the pre-trained lora model to adjust the test input image to an image with an intensity within the intensity range indicated by the wake-up word.

[0162] Step 603: Adjust the test reference image according to the theme color of the test reference image to obtain a test input image.

[0163] In this step, the theme color of the test reference image is determined according to the color of each pixel in the test reference image, and the color of each pixel in the test reference image is adjusted according to the theme color to adjust the brightness and saturation of each pixel in the test reference image, thereby obtaining a test input image.

[0164] Step 604: Test the pre-trained LoRa model based on the test input image, the test reference image, and the wake-up word.

[0165] In this step, the test input image and the wake-up word are input into the pre-trained LoRa model to obtain the output image, and then the pre-trained LoRa model is tested whether it is qualified based on the output image and the test reference image.

[0166] In the embodiment of the present application, since the pre-trained lora model will adjust the intensity of the test input image to the intensity range corresponding to the wake-up word, the test input image does not need to be an image with an intensity in this intensity range. For such a test input image, the present application can adjust the intensity of each pixel in the test reference image according to the theme color of the test reference image. Therefore, the embodiment of the present application provides a test input image determination method, such as Figure 7 As shown, the specific steps include:

[0167] Step 701, obtaining a weight coefficient corresponding to a theme color and a weight coefficient corresponding to a test reference image.

[0168] In this step, if the weight coefficient corresponding to the theme color is the same as the weight coefficient corresponding to the test reference image, the test input image obtained based on this is likely to be an image with an intensity in the intensity range corresponding to the wake-up word. Therefore, in order to avoid this situation, the two weight coefficients are generally set to be different, for example, the weight coefficient of the theme color is set to 0.3, and the weight coefficient of the test reference image is set to 0.7.

[0169] Furthermore, this step can also adjust the test reference image based on other preset colors, such as white, red, etc., as long as the intensity area where the test input image is located is different from the intensity range where the test reference image is located.

[0170] Step 702: multiply the theme color by the corresponding weight coefficient to obtain a first result.

[0171] In this step, the theme color and the corresponding weight coefficient are multiplied to obtain a multiplication result, and the multiplication result is determined as the first result.

[0172] Step 703: multiply the test reference image by the corresponding weight coefficient to obtain a second result.

[0173] In this step, for the test reference image, the color of each pixel in the image is multiplied by the corresponding weight coefficient to obtain the multiplication result corresponding to each pixel, forming a new image, which is determined as the second result.

[0174] Step 704: Add the first result and the second result to obtain a test input image.

[0175] In this step, the first result is added to the color of each pixel in the new image to obtain a test input image.

[0176] like Figure 8 As shown, an embodiment of the present application provides an image enhancement device, which corresponds to the method embodiment and specifically includes:

[0177] An acquisition unit 801 is used to acquire a plurality of images and target intensity intervals corresponding to target enhancement levels;

[0178] A first determining unit 802 is used to determine, in the image, a sample image corresponding to the target intensity interval;

[0179] A first utilizing unit 803 is configured to, when the total number of the sample images is less than a preset number, adjust the images using an intensity adjustment strategy to obtain a total number of adjusted sample images;

[0180] The second utilizing unit 804 is used to train the LoRa model using the sample images when the total number of the sample images is not less than a preset number to obtain a pre-trained LoRa model, and the LoRa model is used to generate the image of the target enhancement gear.

[0181] Optionally, the device further includes a first strategy unit 805, wherein the first strategy unit 805 is configured to:

[0182] In the image, acquiring a first image other than the sample image;

[0183] Using a plurality of preset colors, adjusting the first image to obtain a plurality of second images;

[0184] In the second image, determining a third image corresponding to the target intensity interval;

[0185] The sample image and the third image are determined as adjusted sample images.

[0186] Optionally, the device further includes a second strategy unit 806, wherein the second strategy unit 806 is configured to:

[0187] In the image, a fourth image other than the sample image is acquired;

[0188] In the LAB color mode, adjusting the mean and variance of each channel of the fourth image according to the target mean and target variance of each channel of the sample image to obtain a fifth image;

[0189] In the fifth image, determining a sixth image corresponding to the target intensity interval;

[0190] The sample image and the sixth image are determined as adjusted sample images.

[0191] Optionally, the apparatus further includes a second determining unit 807, wherein the second determining unit 807 is configured to:

[0192] Get the theme color of each sample image;

[0193] According to the theme color of each sample image, determine the average theme color;

[0194] The average theme color is determined as a preset color.

[0195] Optionally, the first determining unit 802 is configured to:

[0196] Get all pixels in the image;

[0197] Determine, among all pixels, a target pixel whose intensity is within the target intensity range;

[0198] When the target pixel meets a preset condition, the image is determined as a sample image corresponding to the target intensity interval.

[0199] Optionally, the device further includes a testing unit 808, wherein the testing unit 808 is configured to:

[0200] Acquire a test image to be used and obtain a test reference image;

[0201] Determining a wake-up word to be used according to a test target intensity interval corresponding to the test reference image;

[0202] According to the theme color of the test reference image, the test reference image is adjusted to obtain a test input image;

[0203] The pre-trained lora model is tested according to the test input image, the test reference image and the wake-up word.

[0204] Optionally, the testing unit 808 is used to:

[0205] Obtaining a weight coefficient corresponding to the theme color and a weight coefficient of the test reference image;

[0206] Multiplying the theme color by the corresponding weight coefficient to obtain a first result;

[0207] Multiplying the test reference image by the corresponding weight coefficient to obtain a second result;

[0208] The first result and the second result are added together to obtain a test input image.

[0209] like Fig. 9 As shown, the embodiment of the present application provides an image enhancement device, including a processor 901, a communication interface 902, a memory 903 and a communication bus 904, wherein the processor 901, the communication interface 902, and the memory 903 communicate with each other through the communication bus 904.

[0210] Memory 903, used for storing computer programs;

[0211] In one embodiment of the present application, the processor 901 is used to execute the program stored in the memory 903 to implement the image enhancement method provided by any of the above method embodiments, including:

[0212] Acquire multiple images and target intensity intervals corresponding to target enhancement levels;

[0213] In the image, determining a sample image corresponding to the target intensity interval;

[0214] When the total number of the sample images is less than a preset number, the images are adjusted using an intensity adjustment strategy to obtain a total number of adjusted sample images;

[0215] When the total number of the sample images is not less than a preset number, the LoRa model is trained using the sample images to obtain a pre-trained LoRa model, and the LoRa model is used to generate the image of the target enhancement gear.

[0216] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps performed by the image enhancement method provided in any of the aforementioned method embodiments are implemented.

[0217] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, i.e., they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.

[0218] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0219] It should be understood that the terms used herein are for the purpose of describing specific example embodiments only and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an", and "said" as used herein may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive and therefore specify the presence of stated features, steps, operations, elements, and / or parts, but do not exclude the presence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the order of execution is clearly indicated. It should also be understood that additional or alternative steps may be used.

[0220] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.

Claims

1. An image enhancement method, characterized in that: The method comprises: Acquire multiple images and target intensity intervals corresponding to target enhancement levels; In the image, determining a sample image corresponding to the target intensity interval; When the total number of the sample images is less than a preset number, the images are adjusted using an intensity adjustment strategy to obtain a total number of adjusted sample images; When the total number of the sample images is not less than a preset number, the LoRa model is trained using the sample images to obtain a pre-trained LoRa model, and the LoRa model is used to generate the image of the target enhancement gear.

2. The method according to claim 1, characterized in that: The intensity adjustment strategy is: In the image, acquiring a first image other than the sample image; Using a plurality of preset colors, adjusting the first image to obtain a plurality of second images; In the second image, determining a third image corresponding to the target intensity interval; The sample image and the third image are determined as adjusted sample images.

3. The method according to claim 1, characterized in that: The intensity adjustment strategy is: In the image, a fourth image other than the sample image is acquired; In the LAB color mode, adjusting the mean and variance of each channel of the fourth image according to the target mean and target variance of each channel of the sample image to obtain a fifth image; In the fifth image, determining a sixth image corresponding to the target intensity interval; The sample image and the sixth image are determined as adjusted sample images.

4. The method according to claim 2, characterized in that: The method further comprises: Get the theme color of each sample image; According to the theme color of each sample image, determine the average theme color; The average theme color is determined as a preset color.

5. The method according to claim 1, characterized in that: Determining, in the image, a sample image corresponding to the target intensity interval includes: Get all pixels in the image; Determine, among all pixels, a target pixel whose intensity is within the target intensity range; When the target pixel meets a preset condition, the image is determined as a sample image corresponding to the target intensity interval.

6. The method according to claim 1, characterized in that: The method further comprises: Acquire a test image to be used and obtain a test reference image; Determining a wake-up word to be used according to a test target intensity interval corresponding to the test reference image; According to the theme color of the test reference image, the test reference image is adjusted to obtain a test input image; The pre-trained lora model is tested according to the test input image, the test reference image and the wake-up word.

7. The method according to claim 1, characterized in that: The step of adjusting the test reference image according to the theme color of the test reference image to obtain a test input image includes: Obtaining a weight coefficient corresponding to the theme color and a weight coefficient of the test reference image; Multiplying the theme color by the corresponding weight coefficient to obtain a first result; Multiplying the test reference image by the corresponding weight coefficient to obtain a second result; The first result and the second result are added together to obtain a test input image.

8. An image enhancement device, characterized in that: The device comprises: An acquisition unit, used to acquire multiple images and target intensity intervals corresponding to target enhancement levels; A determination unit, configured to determine, in the image, a sample image corresponding to the target intensity interval; A first utilizing unit, configured to, when the total number of the sample images is less than a preset number, adjust the images using an intensity adjustment strategy to obtain a total number of adjusted sample images; The second utilizing unit is used for training the LoRa model using the sample images when the total number of the sample images is not less than a preset number to obtain a pre-trained LoRa model, and the LoRa model is used to generate the image of the target enhancement gear.

9. An image enhancement device, characterized in that: include: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; at least one memory connected to the at least one bus, wherein the processor is configured to: Acquire multiple images and target intensity intervals corresponding to target enhancement levels; In the image, determining a sample image corresponding to the target intensity interval; When the total number of the sample images is less than a preset number, the images are adjusted using an intensity adjustment strategy to obtain a total number of adjusted sample images; When the total number of the sample images is not less than a preset number, the LoRa model is trained using the sample images to obtain a pre-trained LoRa model, and the LoRa model is used to generate the image of the target enhancement gear.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the image enhancement method according to any one of claims 1 to 7 is implemented.