Image processing method, device, electronic device and storage medium

By determining the dermabrasion weight of the skin and facial areas in image processing and gradually updating the image, the problem of unnatural images after dermabrasion in the existing technology is solved, and the naturalness and detail retention are improved.

CN117274498BActive Publication Date: 2024-10-25BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311340047.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-16
Publication Date
2024-10-25
Estimated Expiration
2043-10-16

AI Technical Summary

Technical Problem

Existing image microdermabrasion technology is difficult to reduce skin imperfections while retaining skin details, causing the image after microdermabrasion to look unnatural.

Method used

By obtaining the dermabrasion image of the image to be processed, the dermabrasion weight of the skin area and the facial area is determined, and the image is gradually updated to obtain the target dermabrasion image. The entire skin area is first dermabraded, and then the facial area is finer. deal with.

Benefits of technology

It achieves the reduction of skin defects while retaining skin details, making the image after microdermabrasion look more natural and real.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117274498B_ABST
    Figure CN117274498B_ABST
Patent Text Reader

Abstract

The present disclosure provides an image processing method, device, electronic device and storage medium, which relate to the field of computer technology, and in particular to the field of artificial intelligence technology such as image processing, deep learning, and large language models. The method comprises: obtaining a first skin-refining image corresponding to an image to be processed; determining a first skin-refining weight corresponding to a first pixel in a skin area of ​​the first skin-refining image; updating the skin area in the first skin-refining image based on the first skin-refining weight and the skin area in the image to be processed to obtain a second skin-refining image; determining a second skin-refining weight corresponding to a second pixel in a face area of ​​the second skin-refining image; updating the face area in the second skin-refining image based on the second skin-refining weight and the face area in the image to be processed to obtain a target skin-refining image. Thus, the target skin-refining image obtained reduces skin blemishes while retaining skin details, making the skin-refined image look more natural.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to the field of artificial intelligence technology such as image processing, deep learning, and large language models, and specifically to an image processing method, device, electronic device, and storage medium. Background Art

[0002] With the development of image processing technology and the gradual improvement of users' demand for image quality, more and more users are keen on image beautification. Skin resurfacing is a commonly used beautification method that can process details such as skin texture or impurities in the image, making the skin area more delicate and improving the display effect. Therefore, how to perform skin resurfacing on images has become a key research direction. Summary of the invention

[0003] The present disclosure provides an image processing method, device, electronic device and storage medium.

[0004] According to a first aspect of the present disclosure, there is provided an image processing method, comprising:

[0005] Acquire a first skin resurfacing image corresponding to the image to be processed;

[0006] determining a first skin resurfacing weight corresponding to a first pixel point in a skin area of ​​the first skin resurfacing image;

[0007] Based on the first skin resurfacing weight and the skin area in the image to be processed, the skin area in the first skin resurfacing image is updated to obtain a second skin resurfacing image.

[0008] determining a second skin refining weight corresponding to a second pixel point in the facial area of ​​the second skin refining image;

[0009] Based on the second skin refining weight and the facial region in the image to be processed, the facial region in the second skin refining image is updated to obtain a target skin refining image.

[0010] According to a second aspect of the present disclosure, a method for training a large language model is provided, comprising:

[0011] Acquire an image to be processed and a target skin resurfacing image corresponding to the image to be processed, wherein the target skin resurfacing image is obtained by processing the image to be processed based on the image processing method according to the first aspect;

[0012] Inputting the image to be processed into an initial large language model to obtain a predicted skin resurfacing image output by the initial large language model;

[0013] The initial large language model is trained according to the difference between the target skin resurfacing image and the predicted skin resurfacing image to obtain a target large language model.

[0014] According to a third aspect of the present disclosure, there is provided an image processing apparatus, comprising:

[0015] An acquisition module, used for acquiring a first skin resurfacing image corresponding to the image to be processed;

[0016] A first determination module, configured to determine a first skin resurfacing weight corresponding to a first pixel point in a skin area of ​​the first skin resurfacing image;

[0017] A first updating module, configured to update the skin area in the first skin refining image based on the first skin refining weight and the skin area in the image to be processed, so as to obtain a second skin refining image;

[0018] A second determination module, configured to determine a second skin refining weight corresponding to a second pixel point in the facial area of ​​the second skin refining image;

[0019] The second updating module is used to update the facial area in the second skin refining image based on the second skin refining weight and the facial area in the image to be processed to obtain a target skin refining image.

[0020] According to a fourth aspect of the present disclosure, a large language model training device is provided, comprising:

[0021] A first acquisition module, used to acquire an image to be processed and a target skin resurfacing image corresponding to the image to be processed, wherein the target skin resurfacing image is obtained by processing the image to be processed based on the image processing method described in the second aspect;

[0022] A second acquisition module is used for inputting the image to be processed into an initial large language model to obtain a predicted skin resurfacing image output by the initial large language model;

[0023] The training module is used to train the initial large language model according to the difference between the target skin resurfacing image and the predicted skin resurfacing image to obtain a target large language model.

[0024] According to a fifth aspect of the present disclosure, there is provided an electronic device, including:

[0025] at least one processor; and

[0026] a memory communicatively connected to the at least one processor; wherein,

[0027] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform the image processing method as described in the first aspect.

[0028] According to a sixth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the image processing method as described in the first aspect.

[0029] According to a seventh aspect of the present disclosure, a computer program product is provided, comprising computer instructions, which, when executed by a processor, implement the steps of the image processing method as described in the first aspect.

[0030] The image processing method, device, electronic device and storage medium provided by the present disclosure have the following beneficial effects:

[0031] In the disclosed embodiment, a first skin refining image corresponding to the image to be processed can be first obtained, and then a first skin refining weight corresponding to a first pixel in the skin area of ​​the first skin refining image can be determined. Based on the first skin refining weight and the skin area in the image to be processed, the skin area in the first skin refining image is updated to obtain a second skin refining image, and then a second skin refining weight corresponding to a second pixel in the face area of ​​the second skin refining image is determined. Finally, based on the second skin refining weight and the face area in the image to be processed, the face area in the second skin refining image is updated to obtain a target skin refining image. Thus, the entire skin area in the image to be processed can be first skin refining to obtain a second skin refining image, and then the face area in the second skin refining image can be further skin refining pixel by pixel, so that the obtained target skin refining image can reduce skin blemishes while retaining skin details, so that the skin refining image looks more natural.

[0032] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.

[0034] Figure 1 is a flowchart of an image processing method provided according to an embodiment of the present disclosure;

[0035] Figure 2 is a flowchart of an image processing method provided according to another embodiment of the present disclosure;

[0036] Figure 3is a flowchart of an image processing method provided according to another embodiment of the present disclosure;

[0037] Figure 4 is a flowchart of an image processing method provided according to another embodiment of the present disclosure;

[0038] Figure 5 is a flowchart of an image processing method provided according to another embodiment of the present disclosure;

[0039] Figure 6 is a flowchart of a method for training a large language model provided according to another embodiment of the present disclosure;

[0040] Figure 7 is a structural schematic diagram of an image processing device provided according to an embodiment of the present disclosure;

[0041] Figure 8 is a structural schematic diagram of a large language model training device provided according to an embodiment of the present disclosure;

[0042] Fig. 9 It is a block diagram of an electronic device used to implement the image processing method according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0043] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0044] The embodiments of the present disclosure relate to the fields of artificial intelligence technologies such as computer vision and deep learning.

[0045] Artificial Intelligence (AI) is a new technical science that studies and develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence.

[0046] Deep learning is the process of learning the inherent laws and representation levels of sample data. The information obtained in the learning process is of great help in interpreting data such as text, images, and sounds. The ultimate goal of deep learning is to enable machines to have analytical learning capabilities like humans and to be able to recognize data such as text, images, and sounds.

[0047] Image processing is a technique that uses computers to analyze images to achieve the desired results. It is also called image processing. Image processing generally refers to digital image processing. A digital image is a large two-dimensional array obtained by shooting with industrial cameras, video cameras, scanners and other equipment. The elements of the array are called pixels, and their values ​​are called grayscale values. Image processing technology generally includes three parts: image compression, enhancement and restoration, matching, description and recognition.

[0048] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0049] The image processing method, apparatus, electronic device, and storage medium according to the embodiments of the present disclosure are described below with reference to the accompanying drawings.

[0050] It should be noted that the executor of the image processing method of this embodiment is an image processing device, which can be implemented by software and / or hardware. The device can be configured in an electronic device, which may include but is not limited to a terminal, a server, etc.

[0051] Figure 1 It is a flowchart of an image processing method provided according to an embodiment of the present disclosure.

[0052] like Figure 1 As shown, the image processing method includes:

[0053] S101: Acquire a first skin resurfacing image corresponding to an image to be processed.

[0054] The image to be processed may be an image to be subjected to skin resurfacing.

[0055] In some embodiments, the image to be processed may include a skin region, wherein the skin region may include a face region, that is, the image to be processed may include only the face region, or may include the face region and other skin regions except the face region.

[0056] The first skin resurfacing image may be an image obtained by performing initial skin resurfacing on the skin area in the image to be processed.

[0057] Optionally, the skin area in the image to be processed may be subjected to frequency domain filtering to obtain the first skin resurfacing image. Alternatively, the skin area in the image to be processed may be subjected to Gaussian blur processing to obtain the first skin resurfacing image. The present disclosure does not limit this.

[0058] Frequency domain filtering is an image processing technique based on Fourier transform, which can adjust the spectral content of the image to be processed through filtering operations. In the skin resurfacing process, high-frequency information can be filtered out to make the skin color look smoother.

[0059] Among them, Gaussian blur is a commonly used blur filter that can achieve a skin smoothing effect by reducing the high-frequency details of the image to be processed.

[0060] S102: Determine a first skin resurfacing weight corresponding to a first pixel point in a skin area of ​​a first skin resurfacing image.

[0061] The first pixel point may be a pixel point in the skin area of ​​the first dermabrasion image.

[0062] Optionally, the skin area of ​​the first skin resurfacing image may include one first pixel point or multiple first pixel points.

[0063] In some embodiments, a first skin resurfacing weight corresponding to a first pixel in a skin region of the first skin resurfacing image may be preset. Optionally, the first skin resurfacing weights corresponding to a plurality of first pixels may be the same or different, which is not limited in the present disclosure.

[0064] S103: Based on the first skin resurfacing weight and the skin region in the image to be processed, the skin region in the first skin resurfacing image is updated to obtain a second skin resurfacing image.

[0065] Optionally, a first pixel value of a pixel point corresponding to the first pixel point in the image to be processed and a third pixel value corresponding to the first pixel point are obtained, and then the first pixel value and the third pixel value are fused based on the first skin resurfacing weight to obtain a first target pixel value, and finally the third pixel value in the first skin resurfacing image is updated based on the first target pixel value to obtain a second skin resurfacing image. In this way, the skin area in the first skin resurfacing image can be updated pixel by pixel, so that the second skin resurfacing image can be accurately determined.

[0066] It should be noted that the number of pixels in the image to be processed and the first skin resurfacing image is the same, and the positions of the pixels are one-to-one corresponding. Therefore, the first pixel value of the pixel corresponding to the first pixel in the image to be processed can be fused with the third pixel value of the first pixel, and then the third pixel value of the first pixel in the first skin resurfacing image can be updated, so as to obtain an updated second skin resurfacing image.

[0067] In some embodiments, a third skin refining weight corresponding to a pixel point corresponding to the first pixel point in the image to be processed may be determined according to the first skin refining weight. Specifically, the sum of the first skin refining weight and the third skin refining weight is 1, that is, the third skin refining weight is the difference between 1 and the first skin refining weight.

[0068] The first target pixel value corresponding to the first pixel point may be: the first skin resurfacing weight*the first pixel value+the third skin resurfacing weight*the third pixel value.

[0069] S104: Determine a second skin resurfacing weight corresponding to a second pixel point in the facial area of ​​the second skin resurfacing image.

[0070] The second pixel point may be a pixel point in the face area of ​​the second skin resurfacing image.

[0071] Optionally, the facial area of ​​the second skin resurfacing image may include a plurality of second pixel points.

[0072] In some embodiments, the second skin refining weight corresponding to the second pixel point in the facial area of ​​the second skin refining image may be preset. Optionally, the second skin refining weights corresponding to multiple second pixel points may be the same or different. This disclosure does not limit this.

[0073] In some embodiments, a pre-trained image recognition model can be used to recognize the image to be processed to obtain the skin area and face area in the image to be processed. Further, a mask image can be generated, wherein the skin area, face area and other areas in the mask image can be displayed using different pixel values, respectively, and then the skin area and face area in other images other than the image to be processed in the embodiment of the present disclosure can be quickly determined based on the mask image.

[0074] Among them, the image recognition model can be generated by training based on a large amount of images containing skin area and face area label data.

[0075] S105: Based on the second skin refining weight and the facial region in the image to be processed, the facial region in the second skin refining image is updated to obtain a target skin refining image.

[0076] It should be noted that, since the skin of the face area is different from that of other areas, for example, the face area will have multiple colors when wearing makeup. In addition, the face area has facial features. In order to highlight the three-dimensional sense of the facial features, the face area can be processed more finely after the skin area is uniformly smoothed, so that the face area in the target smoothed image is more realistic and three-dimensional.

[0077] Optionally, a fourth pixel value of a pixel point corresponding to the second pixel point in the image to be processed and a fifth pixel value corresponding to the second pixel point are obtained, and then the fourth pixel value and the fifth pixel value are merged based on the second skin resurfacing weight to obtain a second target pixel value, and finally the fifth pixel value in the second skin resurfacing image is updated based on the second target pixel value to obtain a target skin resurfacing image. In this way, the facial area in the second skin resurfacing image can be updated pixel by pixel, so that the target skin resurfacing image can be accurately determined.

[0078] It should be noted that the number of pixels in the image to be processed and the second skin resurfacing image is the same, and the positions of the pixels are one-to-one corresponding. Therefore, the fourth pixel value of the pixel corresponding to the second pixel in the image to be processed can be fused with the fifth pixel value of the second pixel, and then the fifth pixel value of the second pixel in the second skin resurfacing image can be updated, so as to obtain an updated target skin resurfacing image.

[0079] In some embodiments, a fourth skin refining weight corresponding to a pixel point corresponding to the second pixel point in the image to be processed may be determined according to the second skin refining weight. Specifically, the sum of the second skin refining weight and the fourth skin refining weight is 1, that is, the fourth skin refining weight is the difference between 1 and the second skin refining weight.

[0080] The second target pixel value corresponding to the second pixel point may be: the second skin resurfacing weight*the third pixel value+the fourth skin resurfacing weight*the fifth pixel value.

[0081] In the disclosed embodiment, a first skin refining image corresponding to the image to be processed can be first obtained, and then a first skin refining weight corresponding to a first pixel in the skin area of ​​the first skin refining image can be determined. Based on the first skin refining weight and the skin area in the image to be processed, the skin area in the first skin refining image is updated to obtain a second skin refining image, and then a second skin refining weight corresponding to a second pixel in the face area of ​​the second skin refining image is determined. Finally, based on the second skin refining weight and the face area in the image to be processed, the face area in the second skin refining image is updated to obtain a target skin refining image. Thus, the entire skin area in the image to be processed can be first skin refining to obtain a second skin refining image, and then the face area in the second skin refining image can be further skin refining pixel by pixel, so that the obtained target skin refining image can reduce skin blemishes while retaining skin details, so that the skin refining image looks more natural.

[0082] Figure 2 is a flowchart of an image processing method provided according to another embodiment of the present disclosure;

[0083] like Figure 2 As shown, the image processing method includes:

[0084] S201, obtaining a first skin resurfacing image corresponding to an image to be processed.

[0085] The specific implementation form of step S201 can refer to the detailed description in the other embodiments of the present disclosure, and will not be described in detail here.

[0086] S202, performing edge processing on the image to be processed to obtain an edge image.

[0087] In some embodiments, a Laplace operator, a Sobel operator, etc. may be used to perform edge processing on the image to be processed to obtain an edge image.

[0088] Optionally, the image to be processed may be subjected to Gaussian filtering based on the second radius and the second step length to obtain a second Gaussian image, and then the skin area in the second Gaussian image may be updated based on the skin area in the image to be processed to obtain a third Gaussian image, and finally the third Gaussian image may be subjected to Gaussian filtering based on the second radius and the second step length to obtain an edge image. Thus, by subjecting the image to be processed to Gaussian filtering, and then updating the second image based on the image to be processed, and then subjecting it to Gaussian filtering again, the edge image obtained may more clearly reflect the edge between the skin and other areas.

[0089] For example, the second radius may be 6, and the second step length may be 3. The present disclosure does not limit this.

[0090] Optionally, the skin area in the image to be processed may be fused with the skin area in the second Gaussian image to obtain a third Gaussian image.

[0091] Specifically, the first pixel value of the pixel corresponding to the first pixel in the image to be processed and the second pixel value of the pixel corresponding to the first pixel in the second Gaussian image can be obtained first, then the pixel difference between the first pixel value and the second pixel value is determined, and the first product between the pixel difference and the fourth parameter is determined, and finally based on the minimum value between the square value of the first product and the fourth value, the second pixel value in the second Gaussian image is updated to obtain the third Gaussian image. In this way, the second Gaussian image can be accurately updated based on the image to be processed, so as to obtain a more accurate third Gaussian image.

[0092] For example, the formula for determining the first product can be: d = γ (om 1 )

[0093] Among them, d is the first product, γ is the fourth parameter, the value range is [0, 1], o is the first pixel value in the image to be processed, m 1 is the second pixel value in the second Gaussian image, om 1is the pixel difference.

[0094] S203: Based on the first radius and the first step length, perform Gaussian filtering on the image to be processed to obtain a first Gaussian image.

[0095] The first radius is different from the second radius, and the first step length is half of the first radius.

[0096] S204: Determine a first skin resurfacing weight according to the skin areas corresponding to the image to be processed, the edge image, and the first Gaussian image, respectively.

[0097] Optionally, determining the first skin resurfacing weight may include the following steps:

[0098] (1) Obtain a first red component of a pixel point corresponding to a first pixel point in the image to be processed, and a second red component of a pixel point corresponding to the first pixel point in the first Gaussian image.

[0099] The position of the pixel corresponding to the first pixel in the image to be processed is the same as the position of the first pixel in the first skin resurfacing image. The position of the pixel corresponding to the first pixel in the first Gaussian image is the same as the position of the first pixel in the first skin resurfacing image.

[0100] The first red component is the red pixel value of the pixel corresponding to the first pixel in the image to be processed, and the second red component is the red pixel value of the pixel corresponding to the first pixel in the first Gaussian image.

[0101] (2) Determine a first value according to the first red component and the second red component.

[0102] Optionally, the first difference between the second red component and the first parameter may be determined first, then the minimum value between the first difference and the first red component may be determined, and then the second difference between the minimum value and the second parameter may be determined; finally, the product between the second difference and the third parameter may be determined as the first value. Thus, the first value may be accurately determined in combination with the preset parameters, which provides support for the subsequent accurate determination of the first skin resurfacing weight.

[0103] The formula for determining the first value may be:

[0104] p = λ(min(Ro, Rc-α)-β)

[0105] Among them, p is the first value, λ is the third parameter, Ro is the first red component, Rc is the second red component, α is the first parameter, and β is the second parameter.

[0106] (3) Obtain a third red component, a green component, and a blue component of a pixel point corresponding to the first pixel point in the edge image.

[0107] The position of the pixel point in the edge image corresponding to the first pixel point in the edge image is the same as the position of the first pixel point in the first skin resurfacing image.

[0108] The third red component, green component and blue component are respectively the red channel value, green channel value and blue channel value of the pixel point corresponding to the first pixel point in the edge image.

[0109] (4) Determine a first skin resurfacing weight corresponding to the first pixel according to an average value of the third red component, the green component, and the blue component and the first value.

[0110] The third difference between the average value and the second value may be determined first, then the ratio between the average value and the third difference may be determined, then the fourth difference between the third value and the ratio may be determined, and finally the product of the fourth difference and the first value may be determined as the first skin resurfacing weight. Thus, the first skin resurfacing weight may be accurately determined.

[0111] It should be noted that the embodiment of the present disclosure performs skin resurfacing processing on the skin in the image. Since the red component accounts for a large proportion of the skin color, the red components in the pixels in the image to be processed and the first Gaussian image are obtained respectively, and then the first skin resurfacing weight is determined based on the red component, so that the original skin color can be retained in the generated second skin resurfacing image to avoid color distortion.

[0112] It should be noted that the pixel values ​​corresponding to the pixel points in the embodiments of the present disclosure (for example, the first pixel value, the second pixel value, etc.), red components (the first red component, the second red component, the third red component), green components, blue components, etc. are all normalized.

[0113] S205: Based on the first skin resurfacing weight and the skin region in the image to be processed, the skin region in the first skin resurfacing image is updated to obtain a second skin resurfacing image.

[0114] S206: Determine a second skin resurfacing weight corresponding to a second pixel point in the facial area of ​​the second skin resurfacing image.

[0115] S207: Based on the second skin refining weight and the facial region in the image to be processed, the facial region in the second skin refining image is updated to obtain a target skin refining image.

[0116] The specific implementation forms of steps S205 to S207 can refer to the detailed descriptions in the other embodiments of the present disclosure, and will not be described in detail here.

[0117] In the disclosed embodiment, a first skin resurfacing image corresponding to the image to be processed is obtained, edge processing is performed on the image to be processed to obtain an edge image, and based on the first radius and the first step length, Gaussian filtering is performed on the image to be processed to obtain a first Gaussian image, and a first skin resurfacing weight is determined according to the skin areas corresponding to the image to be processed, the edge image, and the first Gaussian image, respectively. Then, based on the first skin resurfacing weight and the skin area in the image to be processed, the skin area in the first skin resurfacing image is updated to obtain a second skin resurfacing image, and finally, a second skin resurfacing weight corresponding to a second pixel point in the face area of ​​the second skin resurfacing image is determined, and based on the second skin resurfacing weight and the face area in the image to be processed, the face area in the second skin resurfacing image is updated to obtain a target skin resurfacing image. Thus, the first skin resurfacing weight can be accurately determined in combination with the image to be processed, the edge image, and the skin area in the first Gaussian image, so that the generated second skin resurfacing image is more natural, and thus the determined target skin resurfacing image is more natural.

[0118] Figure 3 is a flowchart of an image processing method provided according to another embodiment of the present disclosure;

[0119] like Figure 3 As shown, the image processing method includes:

[0120] S301, obtaining a first skin resurfacing image corresponding to the image to be processed.

[0121] S302: Determine a first skin resurfacing weight corresponding to a first pixel point in a skin area of ​​a first skin resurfacing image.

[0122] S303: Based on the first skin resurfacing weight and the skin region in the image to be processed, the skin region in the first skin resurfacing image is updated to obtain a second skin resurfacing image.

[0123] The specific implementation forms of steps S301 to S303 can refer to the detailed descriptions in the other embodiments of the present disclosure, and will not be described in detail here.

[0124] S304, determining a grayscale image corresponding to the image to be processed.

[0125] S305: Determine a second skin resurfacing weight based on the grayscale value of the pixel point corresponding to the second pixel point in the grayscale image.

[0126] The position of the pixel point in the grayscale image corresponding to the second pixel point in the grayscale image is the same as the position of the second pixel point in the second skin resurfacing image.

[0127] Optionally, the absolute value of the difference between the gray value and the fifth value may be determined first, then the second product between the absolute value of the difference and the sixth value may be determined, and finally the difference between the seventh value and the second product may be determined as the second skin resurfacing weight.

[0128] The fifth value may be 0.5, the sixth value may be 2, and the seventh value may be 1. The formula for determining the second skin resurfacing weight may be: q=1-2|0.5-J|; wherein q is the second skin resurfacing weight, and J is the grayscale value of the pixel point corresponding to the second pixel point in the grayscale image.

[0129] It should be noted that people still have a lot of makeup on their faces, so skin smoothing needs to be more delicate. Grayscale images are used to ensure that the light and shadow of the face are not distorted and to ensure a three-dimensional effect. In the formula, J less than 0.5 is shadow, and greater than 0.5 is light. Multiplying by 2 can amplify the adjustment effect, allowing more adjustment of dark areas and less adjustment of light areas. Therefore, the light and shadow of the facial area can be determined based on the grayscale image, and the light and shadow are taken into account to adjust the facial area, which helps to retain the original three-dimensional sense of light and shadow in the facial area and increase the delicacy of the facial detail area.

[0130] S306: Based on the second skin refining weight and the facial region in the image to be processed, the facial region in the second skin refining image is updated to obtain a target skin refining image.

[0131] In the disclosed embodiment, the first skin resurfacing image corresponding to the image to be processed is first obtained, and then the first skin resurfacing weight corresponding to the first pixel in the skin area of ​​the first skin resurfacing image is determined. Based on the first skin resurfacing weight and the skin area in the image to be processed, the skin area in the first skin resurfacing image is updated to obtain the second skin resurfacing image, and then the grayscale image corresponding to the image to be processed is determined. Based on the grayscale value of the pixel corresponding to the second pixel in the grayscale image, the second skin resurfacing weight is determined. Finally, based on the second skin resurfacing weight and the face area in the image to be processed, the face area in the second skin resurfacing image is updated to obtain the target skin resurfacing image. Thus, the light and shadow parts of the face area can be accurately determined in combination with the grayscale image, and then the second skin resurfacing weight can be accurately determined, so that the generated target skin resurfacing image can retain the three-dimensional sense of light and shadow of the original face area and increase the delicacy of the face area.

[0132] Figure 4 is a flowchart of an image processing method provided according to another embodiment of the present disclosure;

[0133] like Figure 4 As shown, the image processing method includes:

[0134] S401, obtaining a first convolution kernel and a second convolution kernel, wherein a blur level of the first convolution kernel is greater than a blur level of the second convolution kernel.

[0135] S402, performing surface blur filtering processing on the image to be processed based on the first convolution kernel and the second convolution kernel respectively to obtain a first blurred image and a second blurred image.

[0136] The first convolution kernel is used to perform fuzzy filtering on the image to be processed to obtain a first blurred image, which is a low-frequency image. The low-frequency image contains overall information of the image to be processed.

[0137] The second convolution is used to perform fuzzy filtering on the image to be processed to obtain a second blurred image, where the second blurred image is a high-frequency image, and the high-frequency image contains detailed information of the image to be processed.

[0138] Therefore, the blur level of the first convolution kernel needs to be set greater than the blur level of the second convolution kernel, that is, the first blurred image is more blurred than the second blurred image.

[0139] S403: Based on the first blurred image and the second blurred image, update the skin area of ​​the image to be processed to obtain a third blurred image.

[0140] In the disclosed embodiment, based on the first blurred image and the second blurred image, the dark part of the image to be processed can be brightened and the bright part can be darkened, so that the skin area in the third blurred image is smoother. The third blurred image can also be called a soft image.

[0141] Optionally, the second blurred image can be differentially processed from the first blurred image to obtain a differential image, and then the first pixel value of the pixel corresponding to the first pixel in the image to be processed and the sixth pixel value of the pixel corresponding to the first pixel in the differential image are obtained, and the fifth difference between the eighth value and the sixth pixel value is determined, and the product of the fifth difference and the first pixel value is determined as the third target pixel value. Finally, based on the third target pixel value, the skin area of ​​the image to be processed is updated to obtain a third blurred image.

[0142] The second blurred image is subjected to a difference process with the first blurred image, that is, the pixel values ​​of the corresponding pixels in the second blurred image are subtracted from each other to obtain a difference image, which can also be called a shadow image.

[0143] Among them, in the difference image, the color value of the skin highlight is greater than 0, and the brighter the value, the larger the value; the color value of the shadow is less than 0, and the darker the value, the smaller the value.

[0144] The position of the pixel point in the differential image corresponding to the first pixel point in the differential image is the same as the position of the first pixel point in the first skin resurfacing image.

[0145] Among them, the eighth value can be 1.

[0146] In the disclosed embodiment, by performing differential processing on the second blurred image and the first blurred image, the shadow part and the highlight part in the image to be processed can be accurately determined, so that the skin area of ​​the image to be processed is updated, and the skin area in the third blurred image is obtained to be smoother and softer.

[0147] S404: Based on the first blurred image, update the skin area of ​​the third blurred image to obtain a first skin resurfacing image.

[0148] Optionally, a first weight corresponding to the third blurred image and a second weight corresponding to the first blurred image are obtained, and then based on the first weight and the second weight, the skin area of ​​the first blurred image is fused with the skin area of ​​the third blurred image to obtain a fused skin area image, and finally the skin area of ​​the third blurred image is updated using the skin area image to obtain a first skin resurfacing image. Thus, the fusion ratio of the first blurred image and the third blurred image can be accurately determined based on the first weight and the second weight, so that more skin details can be retained while removing blemishes in the first skin resurfacing image.

[0149] The sum of the first weight and the second weight is 1, and the ratio of the first weight to the second weight can be 4:1, 5:1, etc., which is not limited in the present disclosure. For example, if the ratio is 4:1, the first weight is 0.8 and the second weight is 0.2.

[0150] In the embodiment of the present disclosure, each pixel point of the skin area of ​​the first blurred image can be fused with the pixel value of the corresponding pixel point of the skin area of ​​the third blurred image based on the first weight and the second weight to obtain a skin area image. Specifically, the pixel value corresponding to any pixel point in the skin area image is: the pixel value in the first blurred image * the first weight + the pixel value in the third blurred image * the second weight.

[0151] Here, the skin region of the third blurred image is updated by using the skin region image, which can be understood as replacing the skin region in the third blurred image with the fused skin region image.

[0152] S405: Determine a first skin resurfacing weight corresponding to a first pixel point in a skin area of ​​the first skin resurfacing image.

[0153] S406: Based on the first skin resurfacing weight and the skin region in the image to be processed, the skin region in the first skin resurfacing image is updated to obtain a second skin resurfacing image.

[0154] S407: Determine a second skin resurfacing weight corresponding to a second pixel point in the facial region of the second skin resurfacing image.

[0155] S408: Based on the second skin refining weight and the facial region in the image to be processed, the facial region in the second skin refining image is updated to obtain a target skin refining image.

[0156] The specific implementation forms of steps S405 to S408 can refer to the detailed descriptions in the other embodiments of the present disclosure, and will not be described in detail here.

[0157] In the disclosed embodiment, the surface blur filter processing can be performed on the image to be processed based on the first convolution kernel and the second convolution kernel respectively to obtain the first blurred image and the second blurred image, the skin area of ​​the image to be processed is updated based on the first blurred image and the second blurred image to obtain the third blurred image, and the skin area of ​​the third blurred image is updated based on the first blurred image to obtain the first skin grinding image, and then the skin area in the first skin grinding image is updated based on the first skin grinding weight and the skin area in the image to be processed to obtain the second skin grinding image; based on the second skin grinding weight and the face area in the image to be processed, the face area in the second skin grinding image is updated to obtain the target skin grinding image. Thus, the image to be processed can be initially skin-grinded based on the first blurred image and the second blurred image, so that the first skin grinding image obtained is smoother while retaining more skin details, which improves the conditions for further skin grinding of the first skin grinding image, and thus makes the generated target skin grinding image more natural while removing blemishes.

[0158] Figure 5 is a flowchart of an image processing method provided according to another embodiment of the present disclosure;

[0159] like Figure 5 As shown, the image processing method includes:

[0160] S501: Obtain an image O to be processed.

[0161] S502: Performing surface blur filtering processing on the image to be processed based on the first convolution kernel and the second convolution kernel respectively to obtain a first blurred image A and a second blurred image B.

[0162] S503: Performing a difference process on the second blurred image and the first blurred image to obtain a difference image D.

[0163] S504: Based on the differential image D, update the skin area of ​​the image to be processed to obtain a third blurred image E.

[0164] Specifically, the third blurred image E can be determined by O*(1-D).

[0165] S505: Based on the first blurred image A, update the skin area of ​​the third blurred image E to obtain a first skin resurfacing image F.

[0166] Specifically, the third blurred image E and the first blurred image A may be mixed in a ratio of 4:1 to obtain the first resurfacing image F.

[0167] S506: Perform edge processing on the image to be processed O to obtain an edge image G.

[0168] S507, performing Gaussian filtering on the image to be processed to obtain a first Gaussian image C.

[0169] S508: Determine a first skin resurfacing weight k according to the skin areas corresponding to the image to be processed, the edge image, and the first Gaussian image, respectively.

[0170] S509: Based on the first skin resurfacing weight k and the skin area in the image to be processed O, the skin area in the first skin resurfacing image F is updated to obtain a second skin resurfacing image H.

[0171] Specifically, the image to be processed O and the skin area in the first skin resurfacing image F may be fused at a ratio of k:(1-K) to obtain the second skin resurfacing image H.

[0172] S510, determining a grayscale image J corresponding to the image to be processed.

[0173] S511, based on the grayscale image J, determine a second skin resurfacing weight q.

[0174] S512: Based on the second skin refining weight q and the facial region in the image to be processed O, the facial region in the second skin refining image H is updated to obtain a target skin refining image R.

[0175] Specifically, the face region in the image to be processed O and the second skin resurfacing image H may be fused at a ratio of q:(1-q) to obtain the target skin resurfacing image R.

[0176] Figure 5 The mask image M (Mask image) in can be used to determine the face area and skin area in each image.

[0177] Figure 6 is a flowchart of a method for training a large language model provided according to another embodiment of the present disclosure;

[0178] like Figure 6 As shown, the training method of the large language model includes:

[0179] S601, obtaining an image to be processed and a target skin resurfacing image corresponding to the image to be processed.

[0180] The target skin resurfacing image is obtained by processing the image to be processed using the image processing method in other embodiments of the present disclosure.

[0181] In some embodiments, the image to be processed may be one or more images, which is not limited in the present disclosure.

[0182] S602: Input the image to be processed into the initial large language model to obtain a predicted skin resurfacing image output by the initial large language model.

[0183] The initial large language model (LLM) may be a Chat Generative Pre-trained Transformer (ChatGPT) type model, such as ChatGPT-3, ChatGPT-4, etc. This disclosure does not limit this.

[0184] The predicted smoothed skin image may be an image obtained after the large language model performs skin smoothing on the image to be processed.

[0185] S603: training the initial large language model according to the difference between the target skin resurfacing image and the predicted skin resurfacing image to obtain a target large language model.

[0186] In the disclosed embodiment, the difference between the target skin resurfacing image and the predicted skin resurfacing image can be calculated according to the loss function, and then the parameters in the initial large language model can be fine-tuned according to the calculated loss value to obtain the target large language model.

[0187] In some embodiments, if there are multiple images to be processed, the initial large language model can be iteratively trained to obtain a target large language model with better performance.

[0188] In the disclosed embodiment, the image to be processed and the target resurfacing image corresponding to the image to be processed can be first obtained, and then the image to be processed is input into the initial large language model to obtain the predicted resurfacing image output by the initial large language model, and finally the initial large language model is trained according to the difference between the target resurfacing image and the predicted resurfacing image to obtain the target large language model. Thus, the initial large language model can be fine-tuned based on the image to be processed and the corresponding target resurfacing image, so that the fine-tuned target large language model can have the ability of image resurfacing, and then the large language model can be applied in the field of image resurfacing, and the resurfacing image output by the large language model reduces skin blemishes while retaining the details of the skin, so that the resurfacing image looks more natural.

[0189] Figure 7 is a structural diagram of an image processing device provided according to an embodiment of the present disclosure

[0190] like Figure 7 As shown, the image processing device 700 includes:

[0191] An acquisition module 701 is used to acquire a first skin resurfacing image corresponding to the image to be processed;

[0192] A first determination module 702 is used to determine a first skin resurfacing weight corresponding to a first pixel point in a skin region of a first skin resurfacing image;

[0193] A first updating module 703 is used to update the skin area in the first skin refining image based on the first skin refining weight and the skin area in the image to be processed to obtain a second skin refining image;

[0194] A second determination module 704 is used to determine a second skin resurfacing weight corresponding to a second pixel point in the facial area of ​​the second skin resurfacing image;

[0195] The second updating module 705 is used to update the facial area in the second skin refining image based on the second skin refining weight and the facial area in the image to be processed to obtain a target skin refining image.

[0196] In some embodiments of the present disclosure, the first determining module 702 is used to:

[0197] Perform edge processing on the image to be processed to obtain an edge image;

[0198] Based on the first radius and the first step length, Gaussian filtering is performed on the image to be processed to obtain a first Gaussian image;

[0199] A first skin resurfacing weight is determined according to skin areas corresponding to the image to be processed, the edge image, and the first Gaussian image, respectively.

[0200] In some embodiments of the present disclosure, the first determining module 702 is configured to:

[0201] Obtain a first red component of a pixel point corresponding to the first pixel point in the image to be processed, and a second red component of a pixel point corresponding to the first pixel point in the first Gaussian image;

[0202] Determine a first value according to the first red component and the second red component;

[0203] Obtain a third red component, a green component, and a blue component of a pixel point corresponding to the first pixel point in the edge image;

[0204] A first skin resurfacing weight corresponding to the first pixel is determined according to an average value of the third red component, the green component, and the blue component and the first value.

[0205] In some embodiments of the present disclosure, the first determining module 702 is configured to:

[0206] determining a first difference between the second red component and the first parameter;

[0207] determining a minimum value between the first difference value and the first red component;

[0208] determining a second difference between the minimum value and a second parameter;

[0209] The product of the second difference and the third parameter is determined as the first value.

[0210] In some embodiments of the present disclosure, the first determining module 702 is configured to:

[0211] determining a third difference between the average value and the second value;

[0212] determining a ratio between the mean and the third difference;

[0213] determining a fourth difference between the third value and the ratio;

[0214] The product of the fourth difference and the first value is determined as the first skin resurfacing weight.

[0215] In some embodiments of the present disclosure, the first determining module 702 is configured to:

[0216] Based on the second radius and the second step length, performing Gaussian filtering on the image to be processed to obtain a second Gaussian image;

[0217] Based on the skin area in the image to be processed, the skin area in the second Gaussian image is updated to obtain a third Gaussian image;

[0218] Based on the second radius and the second step length, Gaussian filtering is performed on the third Gaussian image to obtain an edge image.

[0219] In some embodiments of the present disclosure, the first determining module 702 is configured to:

[0220] Acquire a first pixel value of a pixel point corresponding to the first pixel point in the image to be processed, and a second pixel value of a pixel point corresponding to the first pixel point in the second Gaussian image;

[0221] determining a pixel difference between a first pixel value and a second pixel value;

[0222] determining a first product between the pixel difference and a fourth parameter;

[0223] Based on the minimum value between the square value of the first product and the fourth value, the second pixel value in the second Gaussian image is updated to obtain a third Gaussian image.

[0224] In some embodiments of the present disclosure, the first updating module 703 is used to:

[0225] Obtaining a first pixel value of a pixel point corresponding to the first pixel point in the image to be processed and a third pixel value corresponding to the first pixel point;

[0226] Based on the first skin resurfacing weight, the first pixel value is fused with the third pixel value to obtain a first target pixel value;

[0227] Based on the first target pixel value, the third pixel value in the first skin resurfacing image is updated to obtain a second skin resurfacing image.

[0228] In some embodiments of the present disclosure, the second determining module 704 is configured to:

[0229] Determine the grayscale image corresponding to the image to be processed;

[0230] A second skin resurfacing weight is determined based on the grayscale value of a pixel point corresponding to the second pixel point in the grayscale image.

[0231] In some embodiments of the present disclosure, the second determining module 704 is configured to:

[0232] determining an absolute value of a difference between the gray value and a fifth value;

[0233] determining a second product between the absolute value of the difference and a sixth value;

[0234] The difference between the seventh value and the second product is determined as the second skin resurfacing weight.

[0235] In some embodiments of the present disclosure, the second updating module 705 is used to:

[0236] Obtaining a fourth pixel value of a pixel point corresponding to the second pixel point in the image to be processed and a fifth pixel value corresponding to the second pixel point;

[0237] Based on the second skin resurfacing weight, the fourth pixel value is fused with the fifth pixel value to obtain a second target pixel value;

[0238] Based on the second target pixel value, the fifth pixel value in the second skin resurfacing image is updated to obtain a target skin resurfacing image.

[0239] In some embodiments of the present disclosure, the acquisition module 701 is used to:

[0240] Obtaining a first convolution kernel and a second convolution kernel, wherein a blur level of the first convolution kernel is greater than a blur level of the second convolution kernel;

[0241] Based on the first convolution kernel and the second convolution kernel, surface blur filtering is performed on the image to be processed to obtain a first blurred image and a second blurred image;

[0242] Based on the first blurred image and the second blurred image, updating the skin area of ​​the image to be processed to obtain a third blurred image;

[0243] Based on the first blurred image, the skin area of ​​the third blurred image is updated to obtain a first skin resurfacing image.

[0244] In some embodiments of the present disclosure, the acquisition module 701 is used to:

[0245] Performing differential processing on the second blurred image and the first blurred image to obtain a differential image;

[0246] Acquire a first pixel value of a pixel point corresponding to the first pixel point in the image to be processed, and a sixth pixel value of a pixel point corresponding to the first pixel point in the difference image;

[0247] determining a fifth difference between the eighth value and the sixth pixel value;

[0248] Determine the product of the fifth difference value and the first pixel value as the third target pixel value;

[0249] Based on the third target pixel value, the skin area of ​​the image to be processed is updated to obtain a third blurred image.

[0250] In some embodiments of the present disclosure, the acquisition module 701 is used to:

[0251] Obtaining a first weight corresponding to the third blurred image and a second weight corresponding to the first blurred image;

[0252] Based on the first weight and the second weight, fusing the skin area of ​​the first blurred image with the skin area of ​​the third blurred image to obtain a fused skin area image;

[0253] The skin region of the third blurred image is updated using the skin region image to obtain a first skin resurfacing image.

[0254] It should be noted that the above explanation of the image processing method is also applicable to the image processing device of this embodiment and will not be repeated here.

[0255] In the disclosed embodiment, a first skin refining image corresponding to the image to be processed can be first obtained, and then a first skin refining weight corresponding to a first pixel in the skin area of ​​the first skin refining image can be determined. Based on the first skin refining weight and the skin area in the image to be processed, the skin area in the first skin refining image is updated to obtain a second skin refining image, and then a second skin refining weight corresponding to a second pixel in the face area of ​​the second skin refining image is determined. Finally, based on the second skin refining weight and the face area in the image to be processed, the face area in the second skin refining image is updated to obtain a target skin refining image. Thus, the entire skin area in the image to be processed can be first skin refining to obtain a second skin refining image, and then the face area in the second skin refining image can be further skin refining pixel by pixel, so that the obtained target skin refining image can reduce skin blemishes while retaining skin details, so that the skin refining image looks more natural.

[0256] Figure 8 is a structural schematic diagram of a large language model training device provided according to an embodiment of the present disclosure;

[0257] like Figure 8 As shown, the training device 800 of the large language model includes:

[0258] A first acquisition module 801 is used to acquire an image to be processed and a target skin resurfacing image corresponding to the image to be processed, wherein the target skin resurfacing image is obtained based on the image processing device 700 processing the image to be processed;

[0259] A second acquisition module 802 is used for inputting the image to be processed into the initial large language model to obtain a predicted skin resurfacing image output by the initial large language model;

[0260] The training module 803 is used to train the initial large language model according to the difference between the target skin resurfacing image and the predicted skin resurfacing image to obtain a target large language model.

[0261] In the disclosed embodiment, the image to be processed and the target resurfacing image corresponding to the image to be processed can be first obtained, and then the image to be processed is input into the initial large language model to obtain the predicted resurfacing image output by the initial large language model, and finally the initial large language model is trained according to the difference between the target resurfacing image and the predicted resurfacing image to obtain the target large language model. Thus, the initial large language model can be fine-tuned based on the image to be processed and the corresponding target resurfacing image, so that the fine-tuned target large language model can have the ability of image resurfacing, and then the large language model can be applied in the field of image resurfacing, and the resurfacing image output by the large language model reduces skin blemishes while retaining the details of the skin, so that the resurfacing image looks more natural.

[0262] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.

[0263] Fig. 9 A schematic block diagram of an example electronic device 900 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0264] like Fig. 9 As shown, the device 900 includes a computing unit 901, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 902 or a computer program loaded from a storage unit 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the device 900 can also be stored. The computing unit 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0265] A number of components in the device 900 are connected to the I / O interface 905, including: an input unit 906, such as a keyboard, a mouse, etc.; an output unit 907, such as various types of displays, speakers, etc.; a storage unit 908, such as a disk, an optical disk, etc.; and a communication unit 909, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 909 allows the device 900 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0266] The computing unit 901 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 901 performs the various methods and processes described above, such as image processing methods. For example, in some embodiments, the image processing method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 908. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 900 via the ROM 902 and / or the communication unit 909. When the computer program is loaded into the RAM 903 and executed by the computing unit 901, one or more steps of the image processing method described above may be performed. Alternatively, in other embodiments, the computing unit 901 may be configured to perform the image processing method in any other appropriate manner (e.g., by means of firmware).

[0267] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0268] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0269] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0270] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0271] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), the Internet, and a blockchain network.

[0272] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.

[0273] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0274] In addition, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, the meaning of "multiple" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined. In the description of the present disclosure, the words "if" and "if" used can be interpreted as "at the time of" or "when" or "in response to determination" or "under the circumstances of".

[0275] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. An image processing method, comprising: Acquire a first skin resurfacing image corresponding to an image to be processed, wherein the image to be processed includes a skin region, and the skin region includes a facial region; determining a first skin resurfacing weight corresponding to a first pixel point in a skin area of ​​the first skin resurfacing image; Based on the first skin resurfacing weight and the skin area in the image to be processed, updating the skin area in the first skin resurfacing image to obtain a second skin resurfacing image; determining a second skin refining weight corresponding to a second pixel point in the facial area of ​​the second skin refining image; Based on the second skin refining weight and the facial region in the image to be processed, updating the facial region in the second skin refining image to obtain a target skin refining image; The step of determining a first skin resurfacing weight corresponding to a first pixel point in a skin area of ​​the first skin resurfacing image includes: Performing edge processing on the image to be processed to obtain an edge image; Based on the first radius and the first step length, performing Gaussian filtering on the image to be processed to obtain a first Gaussian image; determining the first skin resurfacing weight according to skin areas respectively corresponding to the image to be processed, the edge image, and the first Gaussian image; The step of determining the first skin resurfacing weight according to the skin areas respectively corresponding to the image to be processed, the edge image, and the first Gaussian image includes: Acquire a first red component of a pixel point corresponding to the first pixel point in the image to be processed, and a second red component of a pixel point corresponding to the first pixel point in the first Gaussian image; Determine a first value according to the first red component and the second red component; Obtain a third red component, a green component, and a blue component of a pixel point corresponding to the first pixel point in the edge image; determining a first skin resurfacing weight corresponding to the first pixel point according to an average value of the third red component, the green component, and the blue component and the first value; The step of determining a second skin refining weight corresponding to a second pixel point in the facial area of ​​the second skin refining image includes: Determine a grayscale image corresponding to the image to be processed; The second skin resurfacing weight is determined based on the grayscale value of a pixel point corresponding to the second pixel point in the grayscale image.

2. The method according to claim 1, wherein: The determining a first value according to the first red component and the second red component includes: determining a first difference between the second red component and a first parameter; determining a minimum value between the first difference value and the first red component; determining a second difference between the minimum value and a second parameter; The product of the second difference and the third parameter is determined as the first value.

3. The method according to claim 1, wherein: The step of determining a first skin resurfacing weight corresponding to the first pixel point according to an average value of the third red component, the green component, and the blue component and the first value includes: determining a third difference between the average value and a second value; determining a ratio between the average value and the third difference; determining a fourth difference between the third value and the ratio; The product of the fourth difference and the first value is determined as the first skin resurfacing weight.

4. The method according to claim 1, wherein: The step of performing edge processing on the image to be processed to obtain an edge image includes: Based on the second radius and the second step length, performing Gaussian filtering on the image to be processed to obtain a second Gaussian image; Based on the skin area in the image to be processed, updating the skin area in the second Gaussian image to obtain a third Gaussian image; Based on the second radius and the second step size, Gaussian filtering is performed on the third Gaussian image to obtain the edge image.

5. The method according to claim 4, wherein: The updating of the skin area in the second Gaussian image based on the skin area in the image to be processed to obtain a third Gaussian image includes: Acquire a first pixel value of a pixel point corresponding to the first pixel point in the image to be processed, and a second pixel value of a pixel point corresponding to the first pixel point in the second Gaussian image; determining a pixel difference between the first pixel value and the second pixel value; determining a first product between the pixel difference and a fourth parameter; Based on the minimum value between the square value of the first product and the fourth value, the second pixel value in the second Gaussian image is updated to obtain the third Gaussian image.

6. The method according to any one of claims 1 to 5, wherein: The updating of the skin area in the first skin resurfacing image based on the first skin resurfacing weight and the skin area in the image to be processed to obtain a second skin resurfacing image includes: Acquire a first pixel value of a pixel point corresponding to the first pixel point in the image to be processed and a third pixel value corresponding to the first pixel point; Based on the first skin resurfacing weight, the first pixel value and the third pixel value are merged to obtain a first target pixel value; Based on the first target pixel value, a third pixel value in the first skin resurfacing image is updated to obtain the second skin resurfacing image.

7. The method according to claim 1, wherein: The determining the second skin resurfacing weight based on the grayscale value of the pixel point corresponding to the second pixel point in the grayscale image includes: Determining an absolute value of a difference between the grayscale value and a fifth value; determining a second product between the absolute value of the difference and a sixth value; The difference between the seventh value and the second product is determined as the second skin resurfacing weight.

8. The method according to claim 1, wherein: The updating of the facial area in the second skin refining image based on the second skin refining weight and the facial area in the image to be processed to obtain a target skin refining image includes: Acquire a fourth pixel value of a pixel point corresponding to the second pixel point in the image to be processed and a fifth pixel value corresponding to the second pixel point; Based on the second skin resurfacing weight, the fourth pixel value is merged with the fifth pixel value to obtain a second target pixel value; Based on the second target pixel value, the fifth pixel value in the second skin resurfacing image is updated to obtain the target skin resurfacing image.

9. The method according to claim 1, wherein: The step of obtaining a first skin resurfacing image corresponding to the image to be processed includes: Obtaining a first convolution kernel and a second convolution kernel, wherein a blur level of the first convolution kernel is greater than a blur level of the second convolution kernel; Based on the first convolution kernel and the second convolution kernel, respectively, the image to be processed is subjected to surface blur filtering processing to obtain a first blurred image and a second blurred image; Based on the first blurred image and the second blurred image, updating the skin area of ​​the image to be processed to obtain a third blurred image; Based on the first blurred image, the skin area of ​​the third blurred image is updated to obtain the first skin resurfacing image.

10. The method according to claim 9, wherein: The updating of the skin area of ​​the image to be processed based on the first blurred image and the second blurred image to obtain a third blurred image includes: Performing difference processing on the second blurred image and the first blurred image to obtain a difference image; Acquire a first pixel value of a pixel point corresponding to the first pixel point in the image to be processed, and a sixth pixel value of a pixel point corresponding to the first pixel point in the differential image; determining a fifth difference between the eighth value and the sixth pixel value; Determine the product of the fifth difference value and the first pixel value as a third target pixel value; Based on the third target pixel value, the skin area of ​​the image to be processed is updated to obtain the third blurred image.

11. The method according to claim 9, wherein: The updating of the skin area of ​​the third blurred image based on the first blurred image to obtain the first skin resurfacing image includes: Obtaining a first weight corresponding to the third blurred image and a second weight corresponding to the first blurred image; Based on the first weight and the second weight, fusing the skin area of ​​the first blurred image with the skin area of ​​the third blurred image to obtain a fused skin area image; The skin region of the third blurred image is updated using the skin region image to obtain the first skin resurfacing image.

12. A method for training a large language model, comprising: Acquire an image to be processed and a target skin resurfacing image corresponding to the image to be processed, wherein the target skin resurfacing image is obtained by processing the image to be processed based on the image processing method according to any one of claims 1 to 11; Inputting the image to be processed into an initial large language model to obtain a predicted skin resurfacing image output by the initial large language model; The initial large language model is trained according to the difference between the target skin resurfacing image and the predicted skin resurfacing image to obtain a target large language model.

13. An image processing device, comprising: An acquisition module, used for acquiring a first skin resurfacing image corresponding to an image to be processed, wherein the image to be processed includes a skin area, and the skin area includes a facial area; A first determination module, configured to determine a first skin resurfacing weight corresponding to a first pixel point in a skin area of ​​the first skin resurfacing image; A first updating module, configured to update the skin area in the first skin refining image based on the first skin refining weight and the skin area in the image to be processed, so as to obtain a second skin refining image; A second determination module, configured to determine a second skin refining weight corresponding to a second pixel point in the facial area of ​​the second skin refining image; a second updating module, configured to update the facial region in the second skin refining image based on the second skin refining weight and the facial region in the image to be processed, so as to obtain a target skin refining image; Wherein, the first determining module is used: Performing edge processing on the image to be processed to obtain an edge image; Based on the first radius and the first step length, performing Gaussian filtering on the image to be processed to obtain a first Gaussian image; determining the first skin resurfacing weight according to skin areas corresponding to the image to be processed, the edge image, and the first Gaussian image respectively; Wherein, the first determining module is used to: Acquire a first red component of a pixel point corresponding to the first pixel point in the image to be processed, and a second red component of a pixel point corresponding to the first pixel point in the first Gaussian image; Determine a first value according to the first red component and the second red component; Obtain a third red component, a green component, and a blue component of a pixel point corresponding to the first pixel point in the edge image; determining a first skin resurfacing weight corresponding to the first pixel point according to an average value of the third red component, the green component, and the blue component and the first value; Wherein, the second determining module is used to: Determine a grayscale image corresponding to the image to be processed; The second skin resurfacing weight is determined based on the grayscale value of a pixel point corresponding to the second pixel point in the grayscale image.

14. The device according to claim 13, wherein: The first determining module is used to: determining a first difference between the second red component and a first parameter; determining a minimum value between the first difference value and the first red component; determining a second difference between the minimum value and a second parameter; The product of the second difference and the third parameter is determined as the first value.

15. The device according to claim 13, wherein: The first determining module is used to: determining a third difference between the average value and a second value; determining a ratio between the average value and the third difference; determining a fourth difference between the third value and the ratio; The product of the fourth difference and the first value is determined as the first skin resurfacing weight.

16. The device according to claim 13, wherein: The first determining module is used to: Based on the second radius and the second step length, performing Gaussian filtering on the image to be processed to obtain a second Gaussian image; Based on the skin area in the image to be processed, updating the skin area in the second Gaussian image to obtain a third Gaussian image; Based on the second radius and the second step size, Gaussian filtering is performed on the third Gaussian image to obtain the edge image.

17. The device according to claim 16, wherein: The first determining module is used to: Acquire a first pixel value of a pixel point corresponding to the first pixel point in the image to be processed, and a second pixel value of a pixel point corresponding to the first pixel point in the second Gaussian image; determining a pixel difference between the first pixel value and the second pixel value; determining a first product between the pixel difference and a fourth parameter; Based on the minimum value between the square value of the first product and the fourth value, the second pixel value in the second Gaussian image is updated to obtain the third Gaussian image.

18. The device according to any one of claims 13 to 17, wherein: The first updating module is used to: Acquire a first pixel value of a pixel point corresponding to the first pixel point in the image to be processed and a third pixel value corresponding to the first pixel point; Based on the first skin resurfacing weight, the first pixel value and the third pixel value are merged to obtain a first target pixel value; Based on the first target pixel value, a third pixel value in the first skin resurfacing image is updated to obtain the second skin resurfacing image.

19. The device according to claim 13, wherein: The second determining module is used to: Determining an absolute value of a difference between the grayscale value and a fifth value; determining a second product between the absolute value of the difference and a sixth value; The difference between the seventh value and the second product is determined as the second skin resurfacing weight.

20. The device according to claim 13, wherein: The second updating module is used to: Acquire a fourth pixel value of a pixel point corresponding to the second pixel point in the image to be processed and a fifth pixel value corresponding to the second pixel point; Based on the second skin resurfacing weight, the fourth pixel value is merged with the fifth pixel value to obtain a second target pixel value; Based on the second target pixel value, the fifth pixel value in the second skin resurfacing image is updated to obtain the target skin resurfacing image.

21. The device according to claim 13, wherein: The acquisition module is used to: Obtaining a first convolution kernel and a second convolution kernel, wherein a blur level of the first convolution kernel is greater than a blur level of the second convolution kernel; Based on the first convolution kernel and the second convolution kernel, respectively, the image to be processed is subjected to surface blur filtering processing to obtain a first blurred image and a second blurred image; Based on the first blurred image and the second blurred image, updating the skin area of ​​the image to be processed to obtain a third blurred image; Based on the first blurred image, the skin area of ​​the third blurred image is updated to obtain the first skin resurfacing image.

22. The device according to claim 21, wherein The acquisition module is used to: Performing difference processing on the second blurred image and the first blurred image to obtain a difference image; Acquire a first pixel value of a pixel point corresponding to the first pixel point in the image to be processed, and a sixth pixel value of a pixel point corresponding to the first pixel point in the differential image; determining a fifth difference between the eighth value and the sixth pixel value; Determine the product of the fifth difference value and the first pixel value as a third target pixel value; Based on the third target pixel value, the skin area of ​​the image to be processed is updated to obtain the third blurred image.

23. The device according to claim 21, wherein The acquisition module is used to: Obtaining a first weight corresponding to the third blurred image and a second weight corresponding to the first blurred image; Based on the first weight and the second weight, fusing the skin area of ​​the first blurred image with the skin area of ​​the third blurred image to obtain a fused skin area image; The skin region of the third blurred image is updated using the skin region image to obtain the first skin resurfacing image.

24. A large language model training device, comprising: A first acquisition module, configured to acquire an image to be processed and a target skin resurfacing image corresponding to the image to be processed, wherein the target skin resurfacing image is obtained by processing the image to be processed by the image processing device according to any one of claims 13 to 23; A second acquisition module is used to input the image to be processed into an initial large language model to obtain a predicted skin resurfacing image output by the initial large language model; The training module is used to train the initial large language model according to the difference between the target skin resurfacing image and the predicted skin resurfacing image to obtain a target large language model.

25. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method of any one of claims 1 to 11, or execute the method of claim 12.

26. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to enable the computer to execute the method according to any one of claims 1 to 11, or to execute the method according to claim 12.

27. A computer program product, comprising computer instructions, which, when executed by a processor, implement the steps of the method according to any one of claims 1 to 11, or perform the steps of the method according to claim 12.