Image restoration method, device, computer equipment and storage medium

By detecting and repairing the distortion of objects during the image beautification process, and using the image repair model to restore the original shape of the object, it solves the problem of object distortion caused by image beautification processing and improves the display effect of the live broadcast.

CN113077400BActive Publication Date: 2024-09-24GUANGZHOU FANXING ENTERTAINMENT INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110383272.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-09
Publication Date
2024-09-24
Estimated Expiration
2041-04-09

AI Technical Summary

Technical Problem

During the image beautification process, objects close to the human face are easily affected, causing the objects to be distorted and deformed, causing the live broadcast image to be uncoordinated and affecting the display effect.

Method used

By detecting whether the objects within a specified range around the target object in the image are distorted, if distortion occurs, the target image is distorted and repaired, including erasing and cutout processing, and the image repair model is used to repair and restore the original state of the object.

Benefits of technology

It effectively reduces the impact of beautification processing on non-target objects, improves the display effect of the image, and eliminates the sense of dissonance in the picture.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113077400B
    Figure CN113077400B
Patent Text Reader

Abstract

The present application relates to an image restoration method, device, computer equipment and storage medium, and relates to the field of image processing technology. The method comprises: obtaining a target image, which is an image after the target object in the original image is retouched; obtaining a detection object in the target image, which is an object of a specified type within a first specified range around the target object; performing distortion detection on the detection object to obtain a detection result; in response to the detection result indicating that the detection object is distorted, performing distortion restoration on the detection object in the target image to obtain a restored target image. Through the above method, a target image including the target object obtained after the retouching process and the undistorted detection object can be obtained, thereby improving the display effect of the retouched image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] With the development of the Internet and technology, users can interact with the audience through live broadcast applications. During the live broadcast process, in order to achieve better live broadcast effects, users have the need to beautify their faces.

[0003] In the related art, when beautifying the user's face, the original image captured by the image acquisition device can be input into the image processing model to obtain the beautified image output by the image processing model, and the image can be sent to the client corresponding to the viewer user.

[0004] However, in the process of beautifying the user's face, it will have a certain impact on objects close to the face, such as causing the objects to twist and deform, making the shape of the objects appearing in the live screen different from the actual shape, causing a sense of incongruity in the picture, and making the live screen display effect poor. Summary of the invention

[0005] The embodiments of the present application provide an image restoration method, apparatus, computer device, and storage medium, which can reduce the impact on non-target objects caused by the image restoration processing of the target object in the image and improve the display effect of the image. The technical solution is as follows:

[0006] In one aspect, an image restoration method is provided, the method comprising:

[0007] Acquire a target image, wherein the target image is an image obtained by retouching a target object in an original image;

[0008] Acquire a detection object in the target image, where the detection object is an object of a specified type within a first specified range around the target object;

[0009] Performing a distortion detection on the detection object to obtain a detection result;

[0010] In response to the detection result indicating that the detection object is distorted, the detection object in the target image is repaired to obtain the repaired target image.

[0011] In a possible implementation, in response to the detection result indicating that the detection object is distorted, repairing the distortion of the detection object in the target image to obtain the repaired target image includes:

[0012] Acquire a distortion region of the detection object, where the distortion region of the detection object is used to indicate a region where deformation occurs in a region corresponding to the detection object;

[0013] Based on the distorted area of ​​the detection object, the target image is erased to obtain the target image including the erased area; the erased area includes the distorted area of ​​the detection object, and the area of ​​the erased area is greater than or equal to the area of ​​the distorted area of ​​the detection object;

[0014] The target image including the erased area is distorted and repaired to obtain the repaired target image.

[0015] In a possible implementation manner, the performing distortion repair on the target image including the erased area to obtain the repaired target image includes:

[0016] Performing a cutout process on the target image including the erased area to obtain a cutout image, wherein the cutout image includes the erased area and the area of ​​the cutout image is larger than the area of ​​the erased area;

[0017] Based on the cutout image, repairing the erased area to obtain the repaired cutout image;

[0018] Based on the repaired clipped image, the detection object in the target image is distorted and repaired to obtain the repaired target image.

[0019] In a possible implementation, the step of performing distortion repair on the detection object in the target image based on the repaired clipped image to obtain the repaired target image includes:

[0020] Based on the pixel values ​​of the pixels in the cropped image after restoration, the pixel values ​​of the pixels in the cropped image area in the target image are replaced to obtain the restored target image; the cropped image area is the position area of ​​the cropped image corresponding to the target image;

[0021] or,

[0022] The repaired cut-out image is fused with the unprocessed area of ​​the target image to obtain the repaired target image; the unprocessed area refers to the remaining area of ​​the target image after the cut-out image is cut out.

[0023] In a possible implementation, the performing repair processing on the erased area based on the extracted image to obtain the repaired extracted image includes:

[0024] Inputting the cutout image into a first image restoration model to obtain the repaired cutout image output by the first image restoration model, wherein the repaired cutout image includes the repaired erased area;

[0025] Among them, the first image restoration model is a model obtained by training based on the first sample image and the first label image; the first sample image is obtained by erasing a part of the area in the first label image; the first label image is obtained by cutting out an object of a specified type in the complete image.

[0026] In a possible implementation, inputting the cutout image into a first image restoration model to obtain the repaired cutout image output by the first image restoration model includes:

[0027] Obtaining type information of the detection object;

[0028] The cut-out image is input into the first image restoration model corresponding to the type information to obtain the restored cut-out image output by the first image restoration model.

[0029] In a possible implementation manner, the performing distortion repair on the target image including the erased area to obtain the repaired target image includes:

[0030] Inputting the target image including the erased area into a second image restoration model to obtain the restored target image output by the second image restoration model;

[0031] The second image restoration model is a model obtained by training based on a second sample image and a second labeled image; the second sample image is obtained by erasing a partial area in the second labeled image; and the second labeled image contains an object of a specified type.

[0032] In a possible implementation manner, the step of performing erasing processing on the target image based on the distorted area of ​​the detection object to obtain the target image including the erased area includes:

[0033] The pixel values ​​of the pixels within the distorted area of ​​the detection object and the pixel values ​​of the pixels within a second specified range around the distorted area of ​​the detection object are set to 0 to obtain the target image including the erased area.

[0034] In a possible implementation, in response to the detection result indicating that the detection object is distorted, repairing the distortion of the detection object in the target image to obtain the repaired target image includes:

[0035] In response to the detection result indicating that the detection object is distorted, inputting the target image into a third image restoration model to obtain the restored target image output by the third image restoration model;

[0036] Among them, the third image restoration model is a model obtained by training based on a third sample image and a third label image; the third sample image is obtained by distorting a partial area in the third label image; and the third label image is a normal image containing an object of a specified type.

[0037] In a possible implementation manner, obtaining the detection object in the target image includes:

[0038] Performing face recognition on the target image to obtain a face object or a body object in the target image as the target object;

[0039] Acquire a musical instrument within the first specified range of the face object or the body object as the detection object.

[0040] In a possible implementation manner, performing distortion detection on the detection object to obtain a detection result includes:

[0041] Inputting the target image into a distortion detection model to obtain the detection result output by the distortion detection model; the detection result is used to indicate whether the detection image in the target image is distorted;

[0042] The distortion detection model is a model obtained by training based on a fourth sample image and a label corresponding to the fourth sample image; the fourth sample image includes a sample image corresponding to a distorted detection object and a sample image corresponding to a non-distorted detection object.

[0043] In a possible implementation, the detection result is further used to indicate a distorted area of ​​the detection object, and the distorted area of ​​the detection object is used to indicate an area in which deformation occurs in an area corresponding to the detection object.

[0044] In a possible implementation, in response to the detection result indicating that the detection object is distorted, repairing the distortion of the detection object in the target image to obtain the repaired target image includes:

[0045] In response to the detection result indicating that the detection object is distorted, obtaining a number of consecutive frames of images in which the corresponding distortion result indicates that the detection object is distorted;

[0046] In response to the continuous frame number reaching a continuous frame number threshold, the detection object in the target image is distorted and repaired to obtain the repaired target image.

[0047] In another aspect, an image restoration device is provided, the device comprising:

[0048] An image acquisition module is used to acquire a target image, wherein the target image is an image after a target object in the original image is retouched;

[0049] A detection object acquisition module, used to acquire a detection object in the target image, wherein the detection object is an object of a specified type within a first specified range around the target object;

[0050] A distortion detection module, used to perform distortion detection on the detection object to obtain a detection result;

[0051] A repair module is used for repairing the distortion of the detection object in the target image in response to the detection result indicating that the detection object is distorted, so as to obtain the repaired target image.

[0052] In a possible implementation, the repair module includes:

[0053] A distortion region acquisition submodule, used to acquire a distortion region of the detection object, wherein the distortion region of the detection object is used to indicate a region where deformation occurs in a region corresponding to the detection object;

[0054] an erasing processing submodule, configured to perform erasing processing on the target image based on the distorted area of ​​the detection object to obtain the target image including the erasing area; the erasing area includes the distorted area of ​​the detection object, and the area of ​​the erasing area is greater than or equal to the area of ​​the distorted area of ​​the detection object;

[0055] The distortion repair submodule is used to perform distortion repair on the target image including the erased area to obtain the repaired target image.

[0056] In a possible implementation, the distortion repair submodule includes:

[0057] A cut-out image acquisition unit, configured to perform a cut-out process on the target image including the erased area to obtain a cut-out image, wherein the cut-out image includes the erased area and the area of ​​the cut-out image is larger than the area of ​​the erased area;

[0058] A cut-out image restoration unit, configured to perform restoration processing on the erased area based on the cut-out image to obtain the restored cut-out image;

[0059] A target image restoration unit is used to perform distortion restoration on the detection object in the target image based on the extracted image to obtain the restored target image.

[0060] In one possible implementation, the target image repair unit is used to replace the pixel values ​​of the pixel points in the cut-out image area of ​​the target image based on the pixel values ​​of the pixel points in the cut-out image after repair, so as to obtain the repaired target image; the cut-out image area is the position area of ​​the cut-out image corresponding to the target image; or, the target image repair unit is used to merge the cut-out image after repair with the unprocessed area of ​​the target image to obtain the repaired target image; the unprocessed area refers to the remaining area of ​​the target image after the cut-out image is removed.

[0061] In a possible implementation, the cut-out image restoration unit is used to input the cut-out image into a first image restoration model to obtain the restored cut-out image output by the first image restoration model, wherein the restored cut-out image includes the restored erased area;

[0062] Among them, the first image restoration model is a model obtained by training based on the first sample image and the first label image; the first sample image is obtained by erasing a part of the area in the first label image; the first label image is obtained by cutting out an object of a specified type in the complete image.

[0063] In a possible implementation, the cutout image restoration unit is used to obtain type information of the detection object; input the cutout image into the first image restoration model corresponding to the type information, and obtain the restored cutout image output by the first image restoration model.

[0064] In a possible implementation, the distortion repair submodule is used to input the target image including the erased area into a second image repair model to obtain the repaired target image output by the second image repair model;

[0065] The second image restoration model is a model obtained by training based on a second sample image and a second labeled image; the second sample image is obtained by erasing a partial area in the second labeled image; and the second labeled image contains an object of a specified type.

[0066] In one possible implementation, the erasing processing submodule is used to set the pixel values ​​of the pixel points within the distorted area of ​​the detection object and the pixel values ​​of the pixel points within a second specified range around the distorted area of ​​the detection object to zero, so as to obtain the target image including the erasing area.

[0067] In a possible implementation, the restoration module is configured to, in response to the detection result indicating that the detection object is distorted, input the target image into a third image restoration model to obtain the restored target image output by the third image restoration model;

[0068] Among them, the third image restoration model is a model obtained by training based on a third sample image and a third label image; the third sample image is obtained by distorting a partial area in the third label image; and the third label image is a normal image containing an object of a specified type.

[0069] In a possible implementation, the detection object acquisition module includes:

[0070] An object recognition submodule is used to perform object recognition on the target image, and obtain a face object or a body object in the target image as the target object;

[0071] The detection object acquisition submodule is used to acquire a musical instrument within the first specified range of the face object or the limb object as the detection object.

[0072] In a possible implementation, the distortion detection module is used to input the target image into a distortion detection model to obtain the detection result output by the distortion detection model; the detection result is used to indicate whether the detection image in the target image is distorted;

[0073] The distortion detection model is a model obtained by training based on a fourth sample image and a label corresponding to the fourth sample image; the fourth sample image includes a sample image corresponding to a distorted detection object and a sample image corresponding to a non-distorted detection object.

[0074] In a possible implementation, the detection result is further used to indicate a distorted area of ​​the detection object, and the distorted area of ​​the detection object is used to indicate an area in which deformation occurs in an area corresponding to the detection object.

[0075] In a possible implementation, the repair module includes:

[0076] a continuous frame number acquisition submodule, configured to, in response to the detection result indicating that the detection object is distorted, acquire the number of continuous frames of the image in which the corresponding distortion result indicates that the detection object is distorted;

[0077] The distortion repair submodule is used to perform distortion repair on the detection object in the target image in response to the continuous frame number reaching a continuous frame number threshold, so as to obtain the repaired target image.

[0078] On the other hand, a computer device is provided, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set are loaded and executed by the processor to implement the above-mentioned image restoration method.

[0079] On the other hand, a computer-readable storage medium is provided, in which at least one instruction, at least one program, a code set or an instruction set is stored, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement the above-mentioned image restoration method.

[0080] On the other hand, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the image restoration method provided in the above various optional implementations.

[0081] The technical solution provided by this application may have the following beneficial effects:

[0082] By performing distortion detection on a detection object in a target image, when the detection result indicates that the detection object is distorted, the target object in the target image is repaired to obtain a repaired target image, wherein the target image is obtained after retouching the target object in the original image, and the detection object is an object confirmed based on the target image, that is, after the distortion of the target object in the target image is repaired, a target image including the target object obtained after retouching and the undistorted detection object can be obtained, thereby improving the display effect of the retouched image. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0084] Figure 1A schematic diagram of a system structure corresponding to an image restoration method shown in an exemplary embodiment of the present application is shown;

[0085] Figure 2 A flow chart of an image restoration method shown in an exemplary embodiment of the present application is shown;

[0086] Figure 3 A schematic diagram of a target image shown in an exemplary embodiment of the present application is shown;

[0087] Figure 4 A flow chart of an image restoration method shown in an exemplary embodiment of the present application is shown;

[0088] Figure 5 A schematic diagram of an erase area shown in an exemplary embodiment of the present application is shown;

[0089] Figure 6 A flowchart of a method for restoring the shape distortion of musical instruments caused by face-slimming technology in a live broadcast scene is shown in an exemplary embodiment of the present application;

[0090] Figure 7 A logical framework diagram of image restoration shown in an exemplary embodiment of the present application is shown;

[0091] Figure 8 A block diagram of an image restoration device shown in an exemplary embodiment of the present application is shown;

[0092] Fig. 9 A structural block diagram of a computer device shown in an exemplary embodiment of the present application is shown;

[0093] Fig.10 A structural block diagram of a computer device shown in an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION

[0094] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0095] It should be understood that the "plurality" mentioned in this article refers to two or more. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.

[0096] In an application with an image acquisition function, a beautification function is usually provided to beautify the appearance of a target object in an image. The beautification function may be to perform image retouching processing on a local area of ​​the target object. Schematically, the target object may be a person object in the image, and the beautification function may be to perform image retouching processing on the face area of ​​the person object. Alternatively, the beautification function may be to perform image retouching processing on other parts of the body, such as arms, legs, etc. The processing method of the image retouching process can change the processing method of the shape of the image retouching part. For example, the image retouching process can refer to stretching, face thinning, leg thinning, etc. In the above-mentioned image retouching process, the local area in the entire image is retouched, while the image of other areas remains unchanged, so as to achieve the purpose of beautifying the target object. However, the accuracy of the above-mentioned local processing of the target object depends on the accuracy of the local processing algorithm. When the accuracy of the local processing algorithm is low, the local processing process will affect other objects in the target image except the target object. For example, when the character object in the image is playing the flute, when the face area of ​​the character object is thinned, the flute close to the face area will be subjected to the same "face thinning" processing at the same time, so that the flute in the processed target image is distorted, thereby causing a sense of incongruity in the picture and making the image display effect poor. In order to reduce the impact on non-target objects caused by the processing of local areas in the image and improve the display effect of the image, the embodiment of the present application provides an image repair method for restoring the distortion of non-target objects caused by local processing of the image, thereby improving the display effect of the image.

[0097] Among them, the image restoration method provided by this application can be applied to live broadcast scenes. Figure 1 FIG. 1 shows a schematic diagram of a system structure corresponding to an image restoration method shown in an exemplary embodiment of the present application. Figure 1 As shown, the system includes: a first terminal 110 , a server 120 and a second terminal 130 .

[0098] Among them, the server 120 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as big data and artificial intelligence platforms.

[0099] The terminal 110 can be implemented as a terminal used by a user who is performing live broadcasting. An application with a live broadcasting function is installed in the terminal. The user can perform live broadcasting through the application and interact with users who are watching the live broadcasting. The terminal 110 can be a terminal device with a network connection function and an interface display function. For example, the terminal 110 can be a smart phone, a tablet computer, an e-book reader, smart glasses, a smart watch, a smart TV, a laptop computer, a desktop computer, etc.

[0100] The terminal 130 can be implemented as a terminal used by users who watch live broadcasts. An application with a live broadcast viewing function is installed in the terminal. Users can watch the live broadcast content through the application and interact with the users who are broadcasting the live broadcast. The terminal 130 can be a terminal device with a network connection function and an interface display function. For example, the terminal 130 can be a smart phone, a tablet computer, an e-book reader, smart glasses, a smart watch, a smart TV, a laptop portable computer, a desktop computer, etc.

[0101] Among them, the application with a live broadcast function and the application with a live broadcast viewing function can be the same application or different applications, and this application does not impose any restrictions on this.

[0102] Optionally, the above system includes one or more terminals and one or more servers. The embodiment of the present application does not limit the number of terminals and servers;

[0103] In a possible implementation, the terminal and the server are connected via a communication network. Optionally, the communication network is a wired network or a wireless network.

[0104] Optionally, the above-mentioned wireless network or wired network uses standard communication technology and / or protocol. The network is usually the Internet, but it can also be any network, including but not limited to any combination of local area network (LAN), metropolitan area network (MAN), wide area network (WAN), mobile, wired or wireless network, private network or virtual private network. In some embodiments, the data exchanged through the network is represented by technology and / or format including Hyper Text Mark-up Language (HTML), Extensible Markup Language (XML), etc. In addition, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), Internet Protocol Security (IPsec) can also be used to encrypt all or some links. In other embodiments, customized and / or dedicated data communication technology can also be used to replace or supplement the above-mentioned data communication technology. This application is not limited here.

[0105] Figure 2 A flowchart of an image restoration method according to an exemplary embodiment of the present application is shown. The image restoration method can be executed by a terminal, or the method can be executed by a server, or the method can be executed interactively by a terminal and a server, wherein the terminal and the server can be implemented as follows Figure 1 The terminals and servers shown are as follows Figure 2 As shown, the image restoration method may include the following steps:

[0106] Step 210, obtaining a target image, which is an image obtained by retouching a target object in the original image.

[0107] In a possible implementation, the original image is a real image captured (e.g., captured in real time) by an image acquisition device, which may be implemented as a camera or a camera assembly. In a live broadcast scene, the image acquisition device may be an image acquisition device in a terminal corresponding to the anchor, and the original image may be an original video frame image in a live broadcast data stream.

[0108] The target image is an image after the target object in the original image is retouched. The retouching process may be to add filters, add special effects, cartoonize the original image, etc., to beautify the target image.

[0109] When retouching an original image, only a local area in the original image may be retouched, such as only the human body area in the original image, or a part of the human body area, such as face slimming, leg slimming, leg stretching, etc., to obtain a target image; however, local image processing may cause objects near the processed area to be affected by the local image processing, resulting in distortion.

[0110] Step 220 , obtaining a detection object in the target image, where the detection object is an object of a specified type within a first specified range around the target object.

[0111] In a possible implementation, the detection object partially occludes the target object, or the target object partially occludes the detection object, that is, a corresponding area of ​​the detection object and a corresponding area of ​​the target object partially overlap.

[0112] In another possible implementation, there may be no overlap between the detection object and the target object.

[0113] The object of the specified type may be a detection object set by the user according to distortion detection requirements. For example, the detection object may be an object that may block the target object or overlap with the display area of ​​the target object. For example, the object of the specified type may be implemented as a musical instrument, a microphone, a water cup, etc.

[0114] Step 230: Perform distortion detection on the detection object to obtain a detection result.

[0115] The processing of the target object may affect the detection objects around the target object, that is, the target image may include the detection object after distortion caused by the retouching of the target object; or, the processing of the target object may not affect the detection objects around the target object. Therefore, the detection result of the distortion detection of the detection object may indicate that the detection object is distorted, or may indicate that the detection object is not distorted.

[0116] Step 240 , in response to the detection result indicating that the detection object is distorted, the target object in the target image is repaired to obtain a repaired target image.

[0117] In one possible implementation, when the detection result indicates that the detection object is distorted, it means that the detection object corresponds to a distorted area, which makes the detection object display abnormally. Therefore, the distortion repair of the detection object in the target image can be reflected in the repair of the distorted area corresponding to the detection object to obtain a target image in which the detection object displays normally, that is, the repaired target image.

[0118] In summary, the object repair method provided in the embodiment of the present application performs distortion detection on the detection object in the target image, and when the detection result indicates that the detection object is distorted, performs distortion repair on the detection object in the target image to obtain a repaired target image, wherein the target image is obtained after retouching the target object in the original image, and the detection object is an object confirmed based on the target image; that is, after the distortion repair is performed on the detection object in the target image, a target image including the target object obtained after retouching and the undistorted detection object can be obtained, thereby improving the display effect of the retouched image.

[0119] The image repair method provided by the embodiment of the present application can be applied to live broadcast scenes. In live broadcast scenes, in order to improve the live broadcast effect, the anchor will use the beauty function in the live broadcast software, or other beauty software outside the live broadcast software to perform beauty operations, such as face slimming, leg slimming, leg lengthening, etc. However, when performing beauty operations, it usually affects the pixels in areas other than those that require beauty processing. For example, when performing a face slimming operation, the pixels close to the face will also be subjected to a "face slimming" operation, causing the object close to the face to be distorted and deformed, causing the object to display abnormally, thereby causing a sense of incongruity in the live broadcast screen. Taking the target object as the face area as an example, Figure 3 A schematic diagram of a target image shown in an exemplary embodiment of the present application is shown. Figure 3 As shown, the target image is an image after a face slimming operation is performed on the face area in the original image. A detection object 320 (shown as a flute) is included around the face area 310 of the target image. After the face slimming operation is performed on the face area 310, the flute 320 is also affected by the face slimming operation and becomes distorted. A distorted area 321 appears in the area where the flute 320 is close to the face area 310, while other areas remain normal. As a result, the flute appears abnormal in the displayed image, causing a discordant image and affecting the image display effect.

[0120] In order to eliminate the distortion of non-target objects caused by local image processing and improve the image display effect, Figure 4A flowchart of an image restoration method according to an exemplary embodiment of the present application is shown. The image restoration method can be executed by a terminal, or the method can be executed by a server, or the method can be executed interactively by a terminal and a server, wherein the terminal and the server can be implemented as follows Figure 1 The terminals and servers shown are as follows Figure 4 As shown, the image restoration method may include the following steps:

[0121] Step 410, obtaining a target image, which is an image obtained by retouching a target object in the original image.

[0122] In a possible implementation, the target image is a video frame image obtained by retouching the target object in the original video frame image in the live video stream. The currently acquired target image is the latest generated video frame image in the live video stream.

[0123] Step 420 , performing object recognition on the target image, and obtaining a face object or a body object in the target image as a target object.

[0124] Since the detection object is an object of a specified type within a first specified range around the target object, in order to obtain the detection object, the detection object can be preliminarily located based on the position of the target object in the target image, and then the position of the detection object in the target image can be further confirmed based on the position of the target object.

[0125] In one possible implementation, the target image may contain one target object, or the target image may contain multiple target objects; at the same time, the target image may contain one detection object, or the target image may contain multiple target objects; this application does not limit the number of target objects and detection objects contained in a target image.

[0126] In one possible implementation, a first specified range around a target object may include one detection object, or a first specified range around a target object may include multiple detection objects; this application does not limit the number of detection objects corresponding to a target object in the target image.

[0127] The target object may be a face object or a limb object after image retouching, such as a face after face slimming, or a leg after leg slimming, or a leg after elongation, etc. In the embodiment of the present application, the image restoration method provided by the present application is described by taking the target object as a target face as an example. Schematically, the target image contains multiple target faces. When performing local image processing on the target object in the target image, such as beautification processing, the multiple target faces may be beautified, which may affect the pixel points within the first specified range corresponding to the multiple target faces, thereby causing the detection object within the first specified range to be distorted.

[0128] When there are multiple target objects for local image processing, the processing methods for retouching the multiple target objects may be different. Schematically, when the retouching is a beauty process, the beauty effects on different target faces (target objects) may be different. For example, when the target image contains three target faces, filter 1 may be added to target face 1, filter 2 may be added to target face 2, and filter 3 may be added to target face 3. Different filters cause different processing effects on the corresponding target faces, and thus cause different effects on the pixels within a certain range around different face areas. When the same test object is simultaneously in the first specified range corresponding to the target objects obtained after different retouching processes, different display effects of the same test object in different areas will be caused, so that the test object will be distorted to different degrees in different areas.

[0129] In the embodiment of the present application, the image restoration method provided by the present application is described by taking the case where a target image contains a target object and a first specified range around the target object contains a detection object as an example. It should be noted that when the target image contains a detection object, the image restoration method provided by the present application can be used to perform image restoration on each detection object separately.

[0130] In a possible implementation, in response to the target object being a target human face, face recognition may be performed on the target image to obtain the target human face in the target image.

[0131] In a possible implementation, face recognition may be performed on the target image based on a face recognition model to obtain a target face in the target image;

[0132] The face recognition model is a model obtained by training based on sample face images and face region labels corresponding to the sample face images.

[0133] Step 430, obtaining musical instruments within a first specified range of the face object or the body object as detection objects.

[0134] The object of the specified type may be a musical instrument or a microphone.

[0135] Among them, the first specified range can be set by the developer based on actual needs. Schematically, the first specified range can be a range of a specified distance from the boundary of the face area, or the first specified range is a range determined based on the minimum adjacent rectangle of the target object.

[0136] Step 440: Perform distortion detection on the detection object to obtain a detection result.

[0137] In a possible implementation, the target image is input into a distortion detection model to obtain a detection result output by the distortion detection model; the detection result is used to indicate whether a detection image in the target image is distorted;

[0138] The distortion detection model is a model obtained by training based on a fourth sample image and a label corresponding to the fourth sample image; the fourth sample image includes a sample image corresponding to a distorted detection object and a sample image corresponding to a non-distorted detection object.

[0139] In a possible implementation, the distortion detection model can detect whether the detection object is distorted on the basis of realizing the face recognition function to obtain a detection result; at this time, the fourth sample image is a face image, and at the same time, the detection object is included in the first specified range corresponding to the face area of ​​the face image.

[0140] The label corresponding to the fourth sample image is used to indicate whether the detection object in the fourth sample image is distorted.

[0141] In a possible implementation, the label of the sample image corresponding to the distorted detection object in the fourth sample image is also used to indicate the distorted area contained in the sample image, and the position of the distorted area in the sample image is marked. The distortion detection model obtained by training can determine whether the detection object in the current sample image is distorted, and can also output the distorted area corresponding to the detection object. That is, the detection result is also used to indicate the distorted area of ​​the detection object, and the distorted area is used to indicate the area where the deformation occurs in the area corresponding to the detection object, such as Figure 3 Area 321 is shown.

[0142] Step 450 , in response to the detection result indicating that the detection object is distorted, the detection object in the target image is repaired to obtain a repaired target image.

[0143] In an embodiment of the present application, a possible distortion repair method can be implemented as follows:

[0144] Obtaining a distortion region of the detection object, where the distortion region of the detection object is used to indicate a region where deformation occurs in a region corresponding to the detection object;

[0145] Based on the distorted area of ​​the detection object, erasing the target image to obtain a target image including the erased area; the erased area includes the distorted area of ​​the detection object, and the area of ​​the erased area is greater than or equal to the area of ​​the distorted area of ​​the detection object;

[0146] The target image including the erased area is distorted and repaired to obtain a repaired target image.

[0147] The distortion region of the detection object may be obtained from the detection result of the distortion detection model in step 440 .

[0148] In an embodiment of the present application, based on the distorted area of ​​the detection object, the target image is erased to obtain a target image including the erased area, which can be achieved by setting the pixel values ​​of the pixel points within the distorted area of ​​the detection object and the pixel values ​​of the pixel points within a second specified range around the distorted area of ​​the detection object to 0 to obtain a target image including the erased area.

[0149] Among them, the second specified range can be a range of a specified distance from the boundary of the distorted area of ​​the detection object. Schematically, the value of the specified distance can be 0, that is, only the pixel values ​​of the pixels within the distorted area of ​​the determined detection object can be set to 0; or, the size of the erasing area can be adjusted by adjusting the value of the specified distance, and the pixel values ​​of the pixels within the erasing area can be set to 0, so as to avoid poor image restoration effect due to deviation in the position determination of the distorted area of ​​the detection object.

[0150] Alternatively, in a possible implementation, the minimum adjacent rectangle of the distorted area of ​​the detected object may be obtained as the erasing area, and the pixel values ​​of the pixels in the erasing area are set to 0; taking the erasing of the pixels in the distorted area as an example, Figure 5 FIG. 1 shows a schematic diagram of an erase area shown in an exemplary embodiment of the present application. Figure 5 As shown, the target image 500 includes a distorted area 510, and after the pixel values ​​of the pixels in the distorted area are set to 0, an erased area 520 is obtained. The erased area 520 includes a partial area (distorted area) of the detection object and a partial face area.

[0151] In order to improve the restoration effect of the target image, when the target image including the erased area is distorted and restored to obtain the restored target image, the target image including the erased area can be input into the second image restoration model to obtain the restored target image output by the second image restoration model;

[0152] The second image restoration model is a model obtained by training based on a second sample image and a second label image; the second sample image is obtained by erasing a partial area in the second label image; and the second label image contains an object of a specified type.

[0153] The second sample image may be obtained by erasing a portion of a region corresponding to an object of a specified type in the second label image.

[0154] Performing distortion repair on the detection object in the target image is actually performing distortion repair on the distorted area of ​​the detection object in the target image, that is, performing image repair on the erased area. Image repair, also known as image interpolation or video interpolation, refers to reconstructing the lost or damaged parts of an image or video, using complex algorithms to replace the lost or damaged image data, and when repairing the missing parts, it mainly relies on the existing information in the image to restore the missing parts in the image. In an embodiment of the present application, image repair on the erased area mainly relies on the pixel values ​​of the pixels close to the erased area. Therefore, when performing distortion repair on the target image containing the erased area to obtain the repaired target image, the target image containing the erased area can be first subjected to a cutout processing to obtain a cutout image, the cutout image contains the erased area, and the area of ​​the cutout image is larger than the area of ​​the erased area;

[0155] Based on the cutout image, the erased area is repaired to obtain a repaired cutout image;

[0156] Based on the repaired clipped image, the detection object in the target image is distorted and repaired to obtain a repaired target image.

[0157] In a possible implementation, the erasing area is located at the center of the extracted image;

[0158] In one possible implementation, the area of ​​the cropped image is determined based on the area of ​​the erased area. Schematically, the area of ​​the cropped image is four times the area of ​​the erased area, the length of the cropped image is twice the length of the erased area, and the width of the cropped image is twice the width of the erased area.

[0159] In a possible implementation, the process of repairing the erased area based on the cutout image can be implemented as follows: inputting the cutout image into a first image repair model to obtain a repaired cutout image output by the first image repair model, wherein the repaired cutout image includes the repaired erased area;

[0160] Among them, the first image restoration model is a model obtained by training based on the first sample image and the first label image; the first sample image is obtained by erasing a partial area in the first label image; and the first label image is obtained by cutting out an object of a specified type in the complete image.

[0161] The first sample image may be an image obtained by erasing a portion of a region corresponding to an object of a specified type included in the first label image.

[0162] In order to improve the restoration effect of the first image restoration model, targeted model training can be performed. In a possible implementation method, when training the first image restoration model, first image restoration models corresponding to different types of detection objects can be trained separately based on the type of detection object. Schematically, a first image restoration model corresponding to a violin can be trained based on a first sample image containing a violin (detection object) after partial erasure, and an image containing a complete violin corresponding to the first sample image; or, a first image restoration model corresponding to a flute can be trained based on a first sample image containing a flute after partial erasure, and an image containing a complete flute corresponding to the first sample image.

[0163] When the cutout image is input into the first image restoration model to obtain the restored cutout image output by the first image restoration model, the type information of the detection object may be obtained first;

[0164] The cutout image is input into a first image restoration model corresponding to the type information to obtain a restored cutout image output by the first image restoration model.

[0165] For example, when the detected object is a flute, its corresponding extracted image is input into the first image restoration model corresponding to the flute; when the detected object is a harmonica, its corresponding extracted image is input into the first image restoration model corresponding to the harmonica.

[0166] In a possible implementation, based on the repaired clipped image, the detection object in the target image is distorted and repaired, and the process of obtaining the repaired target image is implemented as follows:

[0167] The repaired clipped image is fused with the unprocessed area of ​​the target image to obtain the repaired target image; the unprocessed area refers to the remaining area of ​​the target image after the clipped image is clipped.

[0168] That is to say, when repairing the target image based on the cutout image, only the part corresponding to the cutout image needs to be repaired, and the remaining area of ​​the target image after removing the cutout image does not need to be repaired. After obtaining the cutout image, the cutout image is spliced ​​and fused with the remaining area of ​​the target image, so that the target object in the target image remains in the state after the retouching processing, while the distorted detection object is restored to a normal display state.

[0169] Alternatively, in another possible implementation, based on the repaired cutout image, the detection object in the target image is distorted and repaired, and the process of obtaining the repaired target image is implemented as follows:

[0170] Based on the pixel values ​​of the pixels in the restored clipped image, the pixel values ​​of the pixels in the clipped image area in the target image are replaced to obtain the restored target image; the clipped image area is the position area corresponding to the clipped image in the target image.

[0171] That is, after obtaining the repaired cutout image, the pixel values ​​of the pixels in the area of ​​the target image corresponding to the cutout image are replaced with the pixel values ​​in the repaired cutout image to complete the repair of the target image.

[0172] Another possible distortion repair method provided by the embodiment of the present application can be based on a target image containing a distorted detection object, and use a machine model to perform image repair on the target image. The process can be implemented as follows:

[0173] In response to the detection result indicating that the detection object is distorted, the target image is input into a third image restoration model to obtain a restored target image output by the third image restoration model;

[0174] Among them, the third image restoration model is a model obtained by training based on a third sample image and a third label image; the third sample image is obtained by distorting a partial area in the third label image; the third label image is a normal image containing an object of a specified type.

[0175] The third image restoration model can adjust the pixel values ​​of the pixels in the distorted area based on the detection result indicating that the target image contains a distorted area, restore the image in the distorted area to a normal image, and thereby obtain a normally displayed target image.

[0176] In order to prevent the occurrence of distorted areas in the target image as an accidental situation and avoid wasting image restoration resources, in a possible implementation, in response to the detection result indicating that the detected object is distorted, the number of consecutive frames of the image in which the corresponding distortion result indicates that the detected object is distorted is obtained;

[0177] In response to the continuous frame number reaching a continuous frame number threshold, the detection object in the target image is distorted and repaired to obtain a repaired target image.

[0178] That is to say, in order to avoid wasting image restoration resources, when the number of consecutive image frames containing a distorted area in the area corresponding to the detected object reaches a consecutive frame number threshold, it is determined that the distorted area in the target image is caused by retouching the target object, and then the image restoration method is executed based on the target image to obtain a restored target image.

[0179] When the target image is a video frame image generated in real time in a live broadcast scene, after obtaining the repaired target image, the repaired target image is pushed to the terminal corresponding to the audience user watching the live broadcast, so that the terminal interface corresponding to the audience user displays the target image after photo editing and the live broadcast image of the detection object displayed normally.

[0180] In summary, the object repair method provided in the embodiment of the present application performs distortion detection on the detection object in the target image, and when the detection result indicates that the detection object is distorted, performs distortion repair on the detection object in the target image to obtain a repaired target image, wherein the detection object is an object confirmed based on the target object that has been processed by photo editing, that is, after the distortion repair is performed on the detection object in the target image, a target image including the target object after photo editing and the detection object that has not been distorted can be obtained, thereby improving the display effect of the image that has been processed by photo editing.

[0181] based on Figure 2 or Figure 4 The image restoration method provided by the illustrated embodiment, Figure 6 The flowchart of an exemplary embodiment of the present application provides a method for restoring the shape distortion of musical instruments caused by face-slimming technology in a live broadcast scene. The method can be executed by a terminal, or the method can be executed by a server, or the method can be executed interactively by a terminal and a server, wherein the terminal and the server can be implemented as follows Figure 1 The terminals and servers shown are as follows Figure 6 As shown, the method includes:

[0182] Step 610, acquiring real-time video images.

[0183] The real-time video image is an image obtained by performing local image processing on the original image collected by the image acquisition device. For example, the video image is an image obtained by performing beauty processing on the face in the video image. The face area in the target image partially overlaps with the musical instrument area, that is, the musical instrument partially blocks the face.

[0184] Step 620: Identify the face area from the video image using a face recognition model.

[0185] Step 630, determine whether the specified range around the face area contains a musical instrument area; if so, execute step 640, otherwise end.

[0186] Step 640, determine whether the musical instrument area is distorted by using the distortion detection model, if so, execute step 650, otherwise end.

[0187] Step 650: Erasing the distorted area in the musical instrument area to obtain a video image including the erased area.

[0188] The area in the musical instrument area where distortion occurs may be an area that blocks the human face area.

[0189] Step 660: Acquire a cutout image based on the erased area, wherein the cutout image includes the erased area.

[0190] Step 670: input the cutout image into the image restoration model to obtain the cutout image output by the image restoration model that includes the restored erased area.

[0191] The image restoration model is a model obtained by training based on a first sample image and a first label image; the first sample image is obtained by erasing a partial area in the first label image; the first label image is obtained by cutting out an object of a specified type in a complete image.

[0192] Step 680, the cut-out image including the restored erased area is merged with the video image, so that the musical instrument returns to a normal state, while the face area maintains the state after the face-slimming processing.

[0193] After performing the image restoration processing of steps 610 to 680 on each frame of the target image in the video data stream in sequence, the video data streams corresponding to the restored target images are pushed to the terminals of the viewer users in sequence.

[0194] Figure 7 A logical framework diagram of image restoration shown in an exemplary embodiment of the present application is shown. Figure 7 As shown, the target image 710 is an image after the target object (target face 711) in the original image is retouched. The target image 710 is input into a distortion detection model 720 with a face recognition function to obtain a detection result of the distortion detection model 720. When the detection result indicates that the detection object in the target image is distorted, the position of the distorted area is output, such as Figure 7As shown, the distorted area can be framed out; when the detection result indicates that the detection correspondence in the target image is not distorted, the process ends; the pixels in the distorted area in the target image of the detection object determined to be distorted are set to 0 to obtain a target image 730 including the erased area, and a cutout image 740 is obtained by performing a cutout operation on the target image 730 including the erased area; the cutout image 740 is input into the first image restoration model 750 to obtain a repaired cutout image 760 output by the first image restoration model 750, and the repaired cutout image 760 is fused with the target image 710, that is, the pixels in the cutout image 760 are replaced with the corresponding positions in the target image 710 to obtain a repaired target image 770.

[0195] Figure 8 FIG. 4 shows a block diagram of an image restoration device shown in an exemplary embodiment of the present application, as shown in FIG. Figure 8 As shown, the image restoration device comprises:

[0196] An image acquisition module 810 is used to acquire a target image, where the target image is an image after a target object in an original image is retouched;

[0197] A detection object acquisition module 820 is used to acquire a detection object in the target image, where the detection object is an object of a specified type within a first specified range around the target object;

[0198] A distortion detection module 830 is used to perform distortion detection on the detection object to obtain a detection result;

[0199] The repair module 840 is used for repairing the distortion of the detection object in the target image in response to the detection result indicating that the detection object is distorted, so as to obtain the repaired target image.

[0200] In a possible implementation, the repair module 840 includes:

[0201] A distortion region acquisition submodule, used to acquire a distortion region of the detection object, wherein the distortion region of the detection object is used to indicate a region where deformation occurs in a region corresponding to the detection object;

[0202] an erasing processing submodule, configured to perform erasing processing on the target image based on the distorted area of ​​the detection object to obtain the target image including the erasing area; the erasing area includes the distorted area of ​​the detection object, and the area of ​​the erasing area is greater than or equal to the area of ​​the distorted area of ​​the detection object;

[0203] The distortion repair submodule is used to perform distortion repair on the target image including the erased area to obtain the repaired target image.

[0204] In a possible implementation, the distortion repair submodule includes:

[0205] A cut-out image acquisition unit, configured to perform a cut-out process on the target image including the erased area to obtain a cut-out image, wherein the cut-out image includes the erased area and the area of ​​the cut-out image is larger than the area of ​​the erased area;

[0206] A cut-out image restoration unit, configured to perform restoration processing on the erased area based on the cut-out image to obtain the restored cut-out image;

[0207] A target image restoration unit is used to perform distortion restoration on the detection object in the target image based on the extracted image to obtain the restored target image.

[0208] In one possible implementation, the target image repair unit is used to replace the pixel values ​​of the pixel points in the cut-out image area of ​​the target image based on the pixel values ​​of the pixel points in the cut-out image after repair, so as to obtain the repaired target image; the cut-out image area is the position area of ​​the cut-out image corresponding to the target image; or, the target image repair unit is used to merge the cut-out image after repair with the unprocessed area of ​​the target image to obtain the repaired target image; the unprocessed area refers to the remaining area of ​​the target image after the cut-out image is removed.

[0209] In a possible implementation, the cut-out image restoration unit is used to input the cut-out image into a first image restoration model to obtain the restored cut-out image output by the first image restoration model, wherein the restored cut-out image includes the restored erased area;

[0210] Among them, the first image restoration model is a model obtained by training based on the first sample image and the first label image; the first sample image is obtained by erasing a part of the area in the first label image; the first label image is obtained by cutting out an object of a specified type in the complete image.

[0211] In a possible implementation, the cutout image restoration unit is used to obtain type information of the detection object; input the cutout image into the first image restoration model corresponding to the type information, and obtain the restored cutout image output by the first image restoration model.

[0212] In a possible implementation, the distortion repair submodule is used to input the target image including the erased area into a second image repair model to obtain the repaired target image output by the second image repair model;

[0213] The second image restoration model is a model obtained by training based on a second sample image and a second labeled image; the second sample image is obtained by erasing a partial area in the second labeled image; and the second labeled image contains an object of a specified type.

[0214] In one possible implementation, the erasing processing submodule is used to set the pixel values ​​of the pixel points within the distorted area of ​​the detection object and the pixel values ​​of the pixel points within a second specified range around the distorted area of ​​the detection object to zero, so as to obtain the target image including the erasing area.

[0215] In a possible implementation, the restoration module 840 is configured to, in response to the detection result indicating that the detection object is distorted, input the target image into a third image restoration model to obtain the restored target image output by the third image restoration model;

[0216] Among them, the third image restoration model is a model obtained by training based on a third sample image and a third label image; the third sample image is obtained by distorting a partial area in the third label image; and the third label image is a normal image containing an object of a specified type.

[0217] In a possible implementation, the detection object acquisition module 820 includes:

[0218] An object recognition submodule is used to perform object recognition on the target image, and obtain a face object or a body object in the target image as the target object;

[0219] The detection object acquisition submodule is used to acquire a musical instrument within the first specified range of the face object or the limb object as the detection object.

[0220] In a possible implementation, the distortion detection module 830 is used to input the target image into a distortion detection model to obtain the detection result output by the distortion detection model; the detection result is used to indicate whether the detection image in the target image is distorted;

[0221] The distortion detection model is a model obtained by training based on a fourth sample image and a label corresponding to the fourth sample image; the fourth sample image includes a sample image corresponding to a distorted detection object and a sample image corresponding to a non-distorted detection object.

[0222] In a possible implementation, the detection result is further used to indicate a distorted area of ​​the detection object, and the distorted area of ​​the detection object is used to indicate an area in which deformation occurs in an area corresponding to the detection object.

[0223] In a possible implementation, the repair module 840 includes:

[0224] a continuous frame number acquisition submodule, configured to, in response to the detection result indicating that the detection object is distorted, acquire the number of continuous frames of the image in which the corresponding distortion result indicates that the detection object is distorted;

[0225] The distortion repair submodule is used to perform distortion repair on the detection object in the target image in response to the continuous frame number reaching a continuous frame number threshold, so as to obtain the repaired target image.

[0226] In summary, the object repair device provided in the embodiment of the present application performs distortion detection on the detection object in the target image, and when the detection result indicates that the detection object is distorted, performs distortion repair on the detection object in the target image to obtain a repaired target image, wherein the target image is obtained after retouching the target object in the original image, and the detection object is an object confirmed based on the target image, that is, after the distortion repair of the detection object in the target image, a target image including the target object obtained after retouching and the undistorted detection object can be obtained, thereby improving the display effect of the retouched image.

[0227] Fig. 9 is a block diagram of a computer device 900 according to an exemplary embodiment. The computer device 900 may be Figure 1 The terminal shown is, for example, a smart phone, a tablet computer, or a desktop computer. The computer device 900 may also be called a target user device, a portable terminal, a laptop terminal, a desktop terminal, or other names.

[0228] Typically, the computer device 900 includes a processor 901 and a memory 902 .

[0229] The processor 901 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 901 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 901 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 901 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 901 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0230] The memory 902 may include one or more computer-readable storage media, which may be non-transitory. The memory 902 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 902 is used to store at least one instruction, which is used to be executed by the processor 901 to implement the method provided in the method embodiment of the present application.

[0231] In some embodiments, the computer device 900 may also optionally include: a peripheral device interface 903 and at least one peripheral device. The processor 901, the memory 902 and the peripheral device interface 903 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 903 via a bus, a signal line or a circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 904, a display screen 905, a camera assembly 906, an audio circuit 907, a positioning assembly 908 and a power supply 909.

[0232] In some embodiments, the computer device 900 further includes one or more sensors 910 , including but not limited to: an acceleration sensor 911 , a gyroscope sensor 912 , a pressure sensor 913 , a fingerprint sensor 914 , an optical sensor 915 , and a proximity sensor 916 .

[0233] Those skilled in the art will understand that Fig. 9 The structure shown in the figure does not constitute a limitation on the computer device 900, and the computer device 900 may include more or less components than those shown in the figure, or combine some components, or adopt a different arrangement of components.

[0234] Fig.10 The structural block diagram of a computer device 1000 shown in an exemplary embodiment of the present application is shown. The computer device can be implemented as a server in the above-mentioned solution of the present application. The computer device 1000 includes a central processing unit (CPU) 1001, a system memory 1004 including a random access memory (RAM) 1002 and a read-only memory (ROM) 1003, and a system bus 1005 connecting the system memory 1004 and the central processing unit 1001. The computer device 1000 also includes a large-capacity storage device 1006 for storing an operating system 1009, an application program 1010 and other program modules 1011.

[0235] The mass storage device 1006 is connected to the central processing unit 1001 via a mass storage controller (not shown) connected to the system bus 1005. The mass storage device 1006 and its associated computer readable medium provide non-volatile storage for the computer device 1000. That is, the mass storage device 1006 may include a computer readable medium (not shown) such as a hard disk or a compact disc read-only memory (CD-ROM) drive.

[0236] Without loss of generality, the computer-readable medium may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules or other data. Computer storage media include RAM, ROM, Erasable Programmable Read Only Memory (EPROM), Electronically-Erasable Programmable Read-Only Memory (EEPROM) flash memory or other solid-state storage devices, CD-ROM, Digital Versatile Disc (DVD) or other optical storage, cassettes, tapes, disk storage or other magnetic storage devices. Of course, those skilled in the art will appreciate that the computer storage media is not limited to the above. The above-mentioned system memory 1004 and mass storage device 1006 can be collectively referred to as memory.

[0237] According to various embodiments of the present disclosure, the computer device 1000 can also be connected to a remote computer on a network through a network such as the Internet. That is, the computer device 1000 can be connected to the network 1008 through the network interface unit 1007 connected to the system bus 1005, or the network interface unit 1007 can be used to connect to other types of networks or remote computer systems (not shown).

[0238] The memory also includes at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is stored in the memory. The central processing unit 1001 implements all or part of the steps in the image restoration method shown in the above-mentioned embodiments by executing the at least one instruction, at least one program, code set or instruction set.

[0239] Those skilled in the art will appreciate that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented with hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein the communication media include any media that facilitates the transmission of a computer program from one place to another. The storage medium can be any available medium that a general or special-purpose computer can access.

[0240] In an exemplary embodiment, a computer-readable storage medium is also provided, which is used to store at least one instruction, at least one program, code set or instruction set, and the at least one instruction, the at least one program, the code set or instruction set is loaded and executed by a processor to implement all or part of the steps in the above-mentioned image restoration method. For example, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.

[0241] In an exemplary embodiment, a computer program product or a computer program is also provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the above-mentioned Figure 2 or Figure 4 All or part of the steps of the method shown in any embodiment.

[0242] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0243] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. An image restoration method, characterized in that: The method comprises: Acquire a target image, where the target image is an image obtained by retouching a target object in an original image, where the original image is an original video frame image in a live data stream; Acquire a detection object in the target image, where the detection object is an object of a specified type within a first specified range around the target object; Performing a distortion detection on the detection object to obtain a detection result; In response to the detection result indicating that the detection object is distorted, obtaining a number of consecutive frames of images in which the corresponding distortion result indicates that the detection object is distorted; In response to the continuous frame number reaching a continuous frame number threshold, performing distortion repair on the detection object in the target image to obtain the repaired target image; Among them, the distorted area of ​​the detection object is obtained, and the distorted area of ​​the detection object is used to indicate the area where deformation occurs in the area corresponding to the detection object; based on the distorted area of ​​the detection object, the target image is erased to obtain the target image including the erased area; the erased area includes the distorted area of ​​the detection object, and the area of ​​the erased area is greater than or equal to the area of ​​the distorted area of ​​the detection object; the target image including the erased area is distorted and repaired to obtain the repaired target image, and the repaired target image includes the detection object displayed normally.

2. The method according to claim 1, characterized in that: The step of performing distortion repair on the target image including the erased area to obtain the repaired target image includes: Performing a cutout process on the target image including the erased area to obtain a cutout image, wherein the cutout image includes the erased area and the area of ​​the cutout image is larger than the area of ​​the erased area; Based on the cutout image, repairing the erased area to obtain the repaired cutout image; Based on the repaired clipped image, the detection object in the target image is distorted and repaired to obtain the repaired target image.

3. The method according to claim 2, characterized in that The step of performing distortion repair on the detection object in the target image based on the repaired clipped image to obtain the repaired target image comprises: Based on the pixel values ​​of the pixels in the restored clipped image, the pixel values ​​of the pixels in the clipped image area in the target image are replaced to obtain the restored target image; the clipped image area is the position area of ​​the clipped image corresponding to the target image; or, The repaired cut-out image is fused with the unprocessed area of ​​the target image to obtain the repaired target image; the unprocessed area refers to the remaining area of ​​the target image after the cut-out image is cut out.

4. The method according to claim 2, characterized in that: The step of performing a repair process on the erased area based on the cutout image to obtain the repaired cutout image comprises: Inputting the cutout image into a first image restoration model to obtain the repaired cutout image output by the first image restoration model, wherein the repaired cutout image includes the repaired erased area; Among them, the first image restoration model is a model obtained by training based on the first sample image and the first label image; the first sample image is obtained by erasing a part of the area in the first label image; the first label image is obtained by cutting out an object of a specified type in the complete image.

5. The method according to claim 4, characterized in that The step of inputting the cutout image into a first image restoration model to obtain the repaired cutout image output by the first image restoration model comprises: Obtaining type information of the detection object; The cut-out image is input into the first image restoration model corresponding to the type information to obtain the restored cut-out image output by the first image restoration model.

6. The method according to claim 1, characterized in that The step of performing distortion repair on the target image including the erased area to obtain the repaired target image includes: Inputting the target image including the erased area into a second image restoration model to obtain the restored target image output by the second image restoration model; The second image restoration model is a model obtained by training based on a second sample image and a second label image; the second sample image is obtained by erasing a partial area in the second label image; and the second label image contains an object of a specified type.

7. The method according to claim 1, characterized in that The step of performing erasing processing on the target image based on the distorted area of ​​the detection object to obtain the target image including the erased area includes: The pixel values ​​of the pixels within the distorted area of ​​the detection object and the pixel values ​​of the pixels within a second specified range around the distorted area of ​​the detection object are set to 0 to obtain the target image including the erased area.

8. The method according to claim 1, characterized in that After obtaining the number of consecutive frames of images in which the corresponding distortion result indicates that the detected object is distorted in response to the detection result indicating that the detected object is distorted, the method further includes: In response to the detection result indicating that the detection object is distorted, inputting the target image into a third image restoration model to obtain the restored target image output by the third image restoration model; Among them, the third image restoration model is a model obtained by training based on a third sample image and a third label image; the third sample image is obtained by distorting a partial area in the third label image; and the third label image is a normal image containing an object of a specified type.

9. The method according to claim 1, characterized in that: Acquiring a detection object in the target image includes: Performing object recognition on the target image to obtain a face object or a body object in the target image as the target object; Acquire a musical instrument within the first specified range of the face object or the body object as the detection object.

10. The method according to claim 1, characterized in that The performing distortion detection on the detection object to obtain the detection result includes: Inputting the target image into a distortion detection model to obtain the detection result output by the distortion detection model; the detection result is used to indicate whether the detection image in the target image is distorted; The distortion detection model is a model obtained by training based on a fourth sample image and a label corresponding to the fourth sample image; the fourth sample image includes a sample image corresponding to a distorted detection object and a sample image corresponding to a non-distorted detection object.

11. The method according to claim 10, characterized in that The detection result is also used to indicate a distorted area of ​​the detection object, and the distorted area of ​​the detection object is used to indicate an area where deformation occurs in an area corresponding to the detection object.

12. An image restoration device, characterized in that: The device comprises: An image acquisition module is used to acquire a target image, wherein the target image is an image after a target object in the original image is retouched; A detection object acquisition module, used to acquire a detection object in the target image, wherein the detection object is an object of a specified type within a first specified range around the target object; A distortion detection module, used to perform distortion detection on the detection object to obtain a detection result; a continuous frame number acquisition submodule, configured to, in response to the detection result indicating that the detection object is distorted, acquire the number of continuous frames of the image in which the corresponding distortion result indicates that the detection object is distorted; a distortion repair submodule, configured to, in response to the continuous frame number reaching a continuous frame number threshold, repair the distortion of the detection object in the target image to obtain the repaired target image; The distortion region acquisition submodule is used to acquire the distortion region of the detection object, where the distortion region of the detection object indicates the region where deformation occurs in the region corresponding to the detection object; an erasing processing submodule, configured to perform erasing processing on the target image based on the distorted area of ​​the detection object to obtain the target image including the erasing area; the erasing area includes the distorted area of ​​the detection object, and the area of ​​the erasing area is greater than or equal to the area of ​​the distorted area of ​​the detection object; The distortion repair submodule is further used to perform distortion repair on the target image including the erased area to obtain the repaired target image.

13. A computer device, characterized in that: The computer device includes a processor and a memory, the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the image restoration method as described in any one of claims 1 to 11.

14. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the image restoration method as described in any one of claims 1 to 11.