Target image acquisition method, storage medium and electronic device
By responding to the target makeup instructions in the target image and using the substructure of the target image structure for processing, the problem of low accuracy in the acquisition of target images in the prior art is solved, and targeted processing of various element types and makeup events is realized. , improves the accuracy of the overall makeup effect.
Patent Information
- Application Number
- CN202111679948.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-31
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2041-12-31
AI Technical Summary
In the prior art, the acquisition accuracy of the target image is low, and it cannot meet the diverse makeup-up events, resulting in poor makeup-up accuracy of the output target image.
By acquiring the target image to be identified, in response to the target makeup instruction, an area image containing the target portrait element is obtained from the target image, and determined from at least two substructures of the target image structure according to the type of the target portrait element and the type of the makeup element and the type of the target image structure. The target substructure is output, the area image is input to the target substructure, and the area image of the target portrait element of the makeup type is obtained, and the second target image is finally obtained based on the area image and the original target image.
The makeup event of images of various element types is handled in the sub-structure, which satisfies the targeted processing of various makeup events of images of various element types, overcomes the problem of overall makeup effect caused by structural dispersion, and improves the problem of poor overall makeup effect. Accuracy of the target image.
Smart Images

Figure CN114332730B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular to a method for acquiring a target image, a storage medium and an electronic device. Background Art
[0002] In industries such as live streaming and short videos, technologies such as beauty and makeup are indispensable. In particular, the technology of applying targeted makeup to portrait elements in a specific area on a facial image to obtain the target image is deeply loved by users.
[0003] However, in the related art, the method of applying makeup to elements in a specific area on a facial image is relatively general. The usually adopted method is to use a single general model to apply makeup to portrait elements. However, due to the diversity of element types and makeup types of portrait elements, the events corresponding to the makeup processing have also become diversified. In this way, the general model naturally cannot meet the diverse makeup events, and thus cannot guarantee the makeup accuracy of the output target image. If multiple scattered non-general models are used to perform makeup operations of each makeup type on portrait elements of each element type, it is too scattered and it is difficult to guarantee the overall makeup effect of the target image.
[0004] It can be seen that there is a large deviation between the acquisition of the target image in the related art and the target image ideally desired by the user, or the acquisition accuracy of the target image is low. That is, there is a problem of low acquisition accuracy of the target image.
[0005] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0006] The embodiments of the present invention provide a method for acquiring a target image, a storage medium, and an electronic device, so as to at least solve the technical problem of low accuracy in acquiring the target image.
[0007] According to one aspect of an embodiment of the present invention, a method for acquiring a target image is provided, comprising: acquiring a first target image to be identified, wherein the first target image includes at least one portrait element of a target object; in response to a target makeup request for a target portrait element and the at least one portrait element includes the target portrait element, acquiring a first area image including the target portrait element from the first target image in response to the target makeup instruction, wherein the target makeup instruction is used to instruct the target portrait element to be adjusted to a portrait element of a target makeup type; and according to the target element type of the target portrait element and the target makeup type, acquiring a first area image including the target portrait element from the target image. A target substructure is determined from at least two substructures of the image structure, wherein the target substructure is used to adjust the portrait element of the target element type in the input image to the portrait element of the target makeup type; the first area image is input into the target substructure as the input image to obtain a second area image, wherein the makeup type of the target portrait element in the second area image is the target makeup type; a second target image is obtained according to the second area image and the first target image, wherein the second target image contains the at least one portrait element, and the makeup type of the target portrait element in the second target image is the target makeup type.
[0008] According to another aspect of an embodiment of the present invention, a device for acquiring a target image is further provided, comprising: a first acquisition unit, for acquiring a first target image to be identified, wherein the first target image includes at least one portrait element of a target object; a second acquisition unit, for, upon acquiring a target makeup request for the target portrait element and the target portrait element is included in the at least one portrait element, responding to the target makeup instruction, and acquiring a first area image including the target portrait element from the first target image, wherein the target makeup instruction is used to instruct the target portrait element to be adjusted to a portrait element of a target makeup type; a determination unit, for determining, based on the target element type of the target portrait element and the target makeup type, , determining a target substructure from at least two substructures of the target image structure, wherein the target substructure is used to adjust the portrait element of the target element type in the input image to the portrait element of the target makeup type; a first input unit, used to input the first area image as the input image into the target substructure to obtain a second area image, wherein the makeup type of the target portrait element in the second area image is the target makeup type; a third acquisition unit, used to acquire a second target image according to the second area image and the first target image, wherein the second target image contains the at least one portrait element, and the makeup type of the target portrait element in the second target image is the target makeup type.
[0009] As an optional scheme, the above-mentioned determination unit includes: a first acquisition module, used to obtain the target code corresponding to the above-mentioned target element type and the above-mentioned target makeup type, wherein the above-mentioned target code is used to identify the element type and makeup type corresponding to each substructure of the above-mentioned at least two substructures; a first determination module, used to determine the above-mentioned target substructure that matches the above-mentioned target code from the above-mentioned at least two substructures.
[0010] As an optional scheme, the above-mentioned first determination module includes: a first determination submodule, which is used to determine the substructure corresponding to the above-mentioned target code as the above-mentioned target substructure when the above-mentioned target code is included in the target code set, wherein the above-mentioned target code set includes at least two codes, and each of the above-mentioned at least two codes corresponds one-to-one to each of the above-mentioned substructures; or, a second determination submodule, which is used to determine the target alternative code from the above-mentioned target code set when the above-mentioned target code is not included in the above-mentioned target code set, wherein the similarity between the element type corresponding to the above-mentioned target alternative code and the above-mentioned target element type reaches a first threshold, and / or the similarity between the makeup type corresponding to the above-mentioned target alternative code and the above-mentioned target makeup type reaches a second threshold; and determine the substructure corresponding to the above-mentioned target alternative code as the above-mentioned target code.
[0011] As an optional solution, the above-mentioned determination unit includes: a second determination module, used to determine at least one first candidate substructure matching the above-mentioned target element type from the above-mentioned at least two substructures; a third determination module, used to determine the above-mentioned target substructure matching the above-mentioned target makeup type from the above-mentioned at least one first candidate substructure.
[0012] As an optional solution, the above-mentioned determination unit includes: a fourth determination module, used to determine at least one second candidate substructure matching the above-mentioned target makeup type from the above-mentioned at least two substructures; a fifth determination module, used to determine the above-mentioned target substructure matching the above-mentioned target element type from the above-mentioned at least one second candidate substructure.
[0013] As an optional scheme, the above-mentioned second acquisition unit includes: a first recognition module, used to identify the approximate display area of the above-mentioned target portrait element in the above-mentioned first target image from the above-mentioned first target image; a second acquisition module, used to acquire the above-mentioned first area image from the above-mentioned first target image according to the above-mentioned approximate display area, wherein the image area of the above-mentioned first area image is greater than or equal to the image area of the above-mentioned approximate display area.
[0014] As an optional scheme, the above-mentioned input unit includes: a second recognition module, used to use the above-mentioned target substructure to perform image recognition on the above-mentioned target portrait element in the above-mentioned first area image to obtain a target area image, wherein the above-mentioned target area image includes the above-mentioned target portrait element, and the image area of the above-mentioned target area image is less than or equal to the image area of the above-mentioned first area image.
[0015] As an optional solution, it includes: a fourth acquisition unit, used to acquire the above-mentioned multiple sample portrait data before the above-mentioned acquisition of the first target image to be identified; a marking unit, used to mark the element type and makeup type of the portrait element in each of the above-mentioned sample portrait data before the above-mentioned acquisition of the first target image to be identified, so as to obtain the above-mentioned multiple sample portrait data after marking; and a second input unit, used to input the above-mentioned multiple sample portrait data after marking into the initial target image structure before the above-mentioned acquisition of the first target image to be identified, so as to train and obtain the above-mentioned target image structure.
[0016] According to another aspect of the embodiments of the present application, 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 executes the above target image acquisition method.
[0017] According to another aspect of an embodiment of the present invention, there is provided an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes a method for acquiring a target image through the computer program.
[0018] In an embodiment of the present invention, a first target image to be identified is obtained, wherein the first target image contains at least one portrait element of the target object; when a target makeup request for the target portrait element is obtained and the at least one portrait element includes the target portrait element, in response to the target makeup instruction, a first area image containing the target portrait element is obtained from the first target image, wherein the target makeup instruction is used to instruct to adjust the target portrait element to a portrait element of a target makeup type; according to the target element type of the target portrait element and the target makeup type, a target substructure is determined from at least two substructures of the target image structure, wherein the target substructure is used to adjust the portrait element of the target element type in the input image to the portrait element of the target makeup type; the first area image is input as the input image into the target substructure to obtain a second area image, wherein the second The makeup type of the target portrait element in the regional image is the target makeup type; the second target image is obtained according to the second regional image and the first target image, wherein the second target image contains at least one portrait element, and the makeup type of the target portrait element in the second target image is the target makeup type, and the makeup events of each makeup type of images of each element type are processed in a substructure manner, thereby meeting the targeted processing of various makeup events of images of various element types; furthermore, since the substructures are trained and used as a whole in the same target image structure, the problem of poor overall makeup effect of the target image caused by structural dispersion is overcome, thereby achieving the purpose of taking into account both the type targeting in the image processing process and the overall makeup effect finally presented, thereby achieving the technical effect of improving the accuracy of target image acquisition, and thereby solving the technical problem of low target image acquisition accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0020] Figure 1 is a schematic diagram of an application environment of an optional method for acquiring a target image according to an embodiment of the present invention;
[0021] Figure 2 is a schematic diagram of a process of an optional method for acquiring a target image according to an embodiment of the present invention;
[0022] Figure 3 is a schematic diagram of an optional method for acquiring a target image according to an embodiment of the present invention;
[0023] Figure 4 is a schematic diagram of another optional method for acquiring a target image according to an embodiment of the present invention;
[0024] Figure 5 is a schematic diagram of another optional method for acquiring a target image according to an embodiment of the present invention;
[0025] Figure 6 is a schematic diagram of another optional method for acquiring a target image according to an embodiment of the present invention;
[0026] Figure 7 is a schematic diagram of another optional method for acquiring a target image according to an embodiment of the present invention;
[0027] Figure 8 is a schematic diagram of an optional target image acquisition device according to an embodiment of the present invention;
[0028] Fig. 9 It is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0029] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0030] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0031] According to one aspect of an embodiment of the present invention, a method for acquiring a target image is provided. Optionally, as an optional implementation, the method for acquiring a target image can be applied to, but is not limited to, Figure 1In the environment shown, it may include but is not limited to a user device 102, a network 110 and a server 112, wherein the user device 102 may include but is not limited to a display 108, a processor 106 and a memory 104.
[0032] The specific process can be as follows:
[0033] Step S102: A first target image 1022 is displayed on the user device 102, wherein the first target image 1022 includes a target portrait element 1024 (eye); further, it is assumed that a target makeup request triggered by the first target image 1022 is obtained, wherein the target makeup request is used to request that the target portrait element 1024 be processed into a portrait element with a makeup type of “eye C”;
[0034] Steps S104-S106, the user device 102 sends the target makeup request to the server 112 via the network 110;
[0035] Step S108, the server 112 searches the database 114 for the makeup type carried by the target makeup request and the image data of the first target image 1022, and processes the image data through the processing engine 116 to identify the element type of the target portrait element 1024, thereby generating a response result of the target makeup request, i.e., the second target image 1026, using the element type and the makeup type;
[0036] In steps S110-S114, the server 112 sends the second target image 1026 to the user device 102 via the network 110, and the processor 106 in the user device 102 displays the second target image 1026 on the display 108 and stores the second target image 1026 in the memory 104. The adjustment determination result may be stored in the server 112 or the user device 102, but is not limited to it.
[0037] remove Figure 1 In addition to the examples shown, the above steps can be completed independently by the user device 102, that is, the user device 102 performs steps such as identifying the element type of the target portrait element 1024 and generating the second target image 1026, thereby reducing the processing pressure of the server. The user device 102 includes but is not limited to a handheld device (such as a mobile phone), a laptop computer, a desktop computer, a vehicle-mounted device, etc., and the present invention does not limit the specific implementation of the user device 102.
[0038] Optionally, as an optional implementation, as Figure 2 As shown, the method for acquiring the target image includes:
[0039] S202, obtaining a first target image to be identified, wherein the first target image contains at least one portrait element of a target object;
[0040] S204, in response to a target makeup instruction, obtaining a first region image including the target portrait element from the first target image when a target makeup request for the target portrait element is obtained and at least one portrait element includes the target portrait element, wherein the target makeup instruction is used to instruct to adjust the target portrait element to a portrait element of a target makeup type;
[0041] S206, determining a target substructure from at least two substructures of the target image structure according to the target element type and the target makeup type of the target portrait element, wherein the target substructure is used to adjust the portrait element of the target element type in the input image to the portrait element of the target makeup type;
[0042] S208, inputting the first region image as an input image into the target substructure to obtain a second region image, wherein the makeup type of the target portrait element in the second region image is the target makeup type;
[0043] S210, acquiring a second target image according to the second region image and the first target image, wherein the second target image includes at least one portrait element, and a makeup type of a target portrait element in the second target image is a target makeup type.
[0044] Optionally, in this embodiment, the target image acquisition method can be, but is not limited to, applied to video application scenarios such as live broadcast and short video. Taking the target video being played as an example, assuming that a target makeup request for applying makeup to a portrait in the target video has been obtained, the target makeup request is further responded to, and one or more frames of face images at the current moment or time period in the target video are obtained as the first target image to execute the target image acquisition method.
[0045] Optionally, in this embodiment, the portrait element may be, but is not limited to, various elements on a human face, such as a nose element, an ear element, an eyebrow element, a mouth element, etc. The type of the portrait element may be, but is not limited to, an element type, such as a nose element of a nose type, an ear element of an ear type, an eyebrow element of an eyebrow type, a mouth element of a mouth type, etc.
[0046] Optionally, in this embodiment, the first region image may be, but is not limited to, a sub-image containing a target portrait element in the first target image.
[0047] Optionally, in this embodiment, the target image structure may be, but is not limited to, a model for recognizing images obtained after training using multiple sample portrait data; the target image structure may be, but is not limited to, including a neural network model, such as a convolutional neural network, a residual shrinkage network, a generative adversarial network, etc.; each of the at least two substructures of the target image structure may be, but is not limited to, a portrait element corresponding to one element type.
[0048] Optionally, in this embodiment, the makeup type may be, but is not limited to, a type of makeup operation, such as a zoom-in operation, a zoom-out operation, a whitening operation, a tanning operation, a blush adding operation, etc.; in addition, the makeup type may also be, but is not limited to, divided into a general makeup type and a non-general makeup type, wherein the makeup operation of the general makeup type may be, but is not limited to, performed on any portrait element, while the makeup operation of the non-general makeup type may be, but is not limited to, performed on a single or multiple portrait elements. For example, the eyebrow drawing type in the non-general makeup type may be, but is not limited to, performed only on the eyebrows in the portrait element, and the nose straightening type in the non-general makeup type may be, but is not limited to, performed only on the nose in the portrait element, etc.
[0049] Optionally, in this embodiment, the target image structure is a model for recognizing images obtained after training with multiple sample portrait data, wherein each substructure can be trained individually, such as training the target substructure with sample data of the target element type and the target makeup type; however, in the overall training process, the target image structure also needs to be trained as a whole to ensure the overall makeup effect of the target image output by the target image structure.
[0050] To further illustrate, for example, in order to ensure that the output image of the target image structure can have a better performance in the overall makeup effect, the target image structure can also be but not limited to separately setting one or more output layer structures to output a target image with a better overall makeup effect; specifically, when the second region image output by the target substructure is obtained, the second region image and the first target image are input into the output layer structure. Normally, the output layer structure will simply replace the first region image in the first target image with the second region image. However, in this embodiment, in order to ensure the overall makeup effect, other sub-images in the first target image except the first region image may also be but not limited to adaptively processing the second region image. The second target image finally output includes the second region image and optimized other sub-images in the first target image except the first region image.
[0051] It should be noted that processing makeup events of various makeup types of images of various element types in a substructure manner satisfies the targeted processing of various makeup events of images of various element types; furthermore, since the above-mentioned substructures are trained and used as a whole in the same target image structure, this also overcomes the problem of poor overall makeup effect of the target image caused by structural dispersion.
[0052] To further illustrate, the optional Figure 3 As shown, a first target image 302 to be identified is obtained, wherein the first target image 302 includes at least one portrait element of a target object; when a target makeup request for a target portrait element 304 is obtained and at least one portrait element includes the target portrait element 304, a first area image including the target portrait element 304 is obtained from the first target image 302 in response to a target makeup instruction, wherein the target makeup instruction is used to instruct to adjust the target portrait element to a portrait element of a target makeup type; according to the target element type and the target makeup type of the target portrait element 304, a target substructure ( Such as substructure 306-2), wherein the target image structure 306 is a model for recognizing images obtained after training with multiple sample portrait data, and the target substructure (such as substructure 306-2) is used to adjust the portrait elements of the target element type in the input image to the portrait elements of the target makeup type; the first area image is input as the input image to the target substructure (such as substructure 306-2) to obtain a second area image, wherein the makeup type of the target portrait element in the second area image is the target makeup type; the second target image 308 is obtained according to the second area image and the first target image 302, wherein the second target image 308 contains at least one portrait element, and the makeup type of the target portrait element in the second target image is the target makeup type.
[0053] Through the embodiments provided by the present application, a first target image to be identified is obtained, wherein the first target image contains at least one portrait element of the target object; when a target makeup request for the target portrait element is obtained and at least one portrait element includes the target portrait element, a first area image containing the target portrait element is obtained from the first target image in response to a target makeup instruction, wherein the target makeup instruction is used to instruct to adjust the target portrait element to a portrait element of a target makeup type; according to the target element type and the target makeup type of the target portrait element, a target substructure is determined from at least two substructures of the target image structure, wherein the target image structure is obtained after training using multiple sample portrait data for A model for recognizing an image, wherein a target substructure is used to adjust a portrait element of a target element type in an input image to a portrait element of a target makeup type; a first area image is input as an input image into the target substructure to obtain a second area image, wherein the makeup type of the target portrait element in the second area image is the target makeup type; a second target image is obtained according to the second area image and the first target image, wherein the second target image contains at least one portrait element, and the makeup type of the target portrait element in the second target image is the target makeup type, thereby achieving the purpose of taking into account both the type targeting in the image processing process and the overall makeup effect ultimately presented, thereby realizing the technical effect of improving the accuracy of acquiring the target image.
[0054] As an optional solution, according to the target element type and the target makeup type of the target portrait element, a target substructure is determined from at least two substructures of the target image structure, including:
[0055] S1, obtaining a target code corresponding to a target element type and a target makeup type, wherein the target code is used to identify the element type and the makeup type corresponding to each substructure of at least two substructures;
[0056] S2, determining a target substructure matching the target encoding from at least two substructures.
[0057] Optionally, in this embodiment, the target image structure may include, but is not limited to, a generative adversarial network (GAN). The generative adversarial network may include, but is not limited to, a relatively good output through the mutual game learning of at least two modules in the network: a generative model and a discriminative model. Further utilizing the encoding function of the generative adversarial network, various element types and makeup types are encoded in advance (for example, the generative adversarial network generates a 1x1024 vector from a selected one or a pair of types and inputs it into the target image structure), and obtains at least two codes corresponding to each substructure in at least two substructures. Then, when a code to be matched (target code) is obtained, a matching query can be performed in the at least two codes to obtain the target substructure matched by the target code.
[0058] It should be noted that the target code corresponding to the target element type and the target makeup type is obtained, wherein the target code is used to identify the element type and the makeup type corresponding to each substructure in at least two substructures; and the target substructure matching the target code is determined from the at least two substructures.
[0059] To further illustrate, the optional Figure 3 The scenario shown, continuing with e.g. Figure 4 As shown, the coding information 402 of the target element type and the target makeup type is obtained, such as the element type is eyes and the makeup type is C; further obtain the target code 404 corresponding to the coding information 402; and then determine the target substructure (such as substructure 306-2) that matches the target code 404 from at least two substructures (such as substructure 306-1, substructure 306-2, and substructure 306-3).
[0060] Through the embodiments provided in the present application, target codes corresponding to target element types and target makeup types are obtained, wherein the target codes are used to identify the element types and makeup types corresponding to each of at least two substructures; a target substructure matching the target code is determined from at least two substructures, thereby achieving the purpose of efficiently determining the target substructure with the highest matching degree, and realizing the effect of improving the efficiency of determining the target substructure.
[0061] As an optional solution, determining a target substructure matching the target encoding from at least two substructures includes:
[0062] S1, when the target coding set includes the target coding, determining the substructure corresponding to the target coding as the target substructure, wherein the target coding set includes at least two codings, and each of the at least two codings corresponds to each substructure one-to-one; or,
[0063] S2. When the target code is not included in the target code set, determine a target alternative code from the target code set, wherein the similarity between the element type corresponding to the target alternative code and the target element type reaches a first threshold, and / or the similarity between the makeup type corresponding to the target alternative code and the target makeup type reaches a second threshold; determine the substructure corresponding to the target alternative code as the target code.
[0064] Optionally, in this embodiment, various types of element types and makeup types are encoded in advance to obtain a target code set consisting of at least two codes corresponding to each substructure in at least two substructures. Then, when a code to be matched (target code) is obtained, a matching query can be performed in the target code set, and when the query result is that the target code is found, the target substructure corresponding to the target code is directly obtained; but there is also an optional situation, that is, the query result is that the target code is not found, and then in this case, a matching query needs to be performed again in the target code set, and the matching target is another code existing in the target code set whose similarity with the target code meets the matching condition, and it is used as the code corresponding to the target substructure to determine the target substructure, thereby avoiding the problem that the above-mentioned target image acquisition method cannot be executed due to the lack of some codes.
[0065] Through the embodiments provided by the present application, when the target code is included in the target code set, the substructure corresponding to the target code is determined as the target substructure, wherein the target code set includes at least two codes, and each of the at least two codes corresponds one-to-one to each substructure; or, when the target code is not included in the target code set, a target candidate code is determined from the target code set, wherein the similarity between the element type corresponding to the target candidate code and the target element type reaches a first threshold, and / or the similarity between the makeup type corresponding to the target candidate code and the target makeup type reaches a second threshold; the substructure corresponding to the target candidate code is determined as the target code, thereby achieving the purpose of avoiding the problem that the above-mentioned target image acquisition method cannot be executed due to the lack of some codes, and realizing the effect of improving the success rate of acquiring the target image.
[0066] As an optional solution, determining a target substructure matching the target encoding from at least two substructures includes:
[0067] S1, determining at least one first candidate substructure matching the target element type from at least two substructures;
[0068] S2: Determine a target substructure matching the target makeup type from at least one first candidate substructure.
[0069] It should be noted that at least one first candidate substructure matching the target element type is determined from the at least two substructures; and a target substructure matching the target makeup type is determined from the at least one first candidate substructure.
[0070] To further illustrate, the optional Figure 3 The scenario shown, continuing with e.g. Figure 5 As shown, at least one first candidate substructure 504 matching the target element type 502 is determined from at least two substructures (such as substructure 306-1, substructure 306-2, and substructure 306-3); and a target substructure 508 matching the target makeup type 506 is determined from at least one first candidate substructure 504.
[0071] As an optional solution, determining a target substructure matching the target encoding from at least two substructures includes:
[0072] S1, determining at least one second candidate substructure matching the target makeup type from at least two substructures;
[0073] S2: Determine a target substructure matching the target element type from at least one second candidate substructure.
[0074] It should be noted that at least one second candidate substructure matching the target makeup type is determined from the at least two substructures; and a target substructure matching the target element type is determined from the at least one second candidate substructure.
[0075] To further illustrate, the optional Figure 3 The scenario shown, continuing with e.g. Figure 6 As shown, at least one second candidate substructure 604 matching the target makeup type 602 is determined from at least two substructures (such as substructure 306-1, substructure 306-2, and substructure 306-3); and a target substructure 608 matching the target element type 606 is determined from at least one second candidate substructure 604.
[0076] As an optional solution, obtaining a first region image containing a target portrait element from a first target image includes:
[0077] S1, identifying a rough display area of a target portrait element in a first target image from a first target image;
[0078] S2, acquiring a first region image from the first target image according to the schematic display region, wherein an image area of the first region image is greater than or equal to an image area of the schematic display region.
[0079] Optionally, in this embodiment, the schematic display area may be understood, but is not limited to, as a relatively large area including the location of the first target image.
[0080] It should be noted that, usually, it is necessary to optimize the region, that is, to reduce the area of the region to improve the accuracy of subsequent image recognition, but this approach will have a certain probability of losing the original information of the image, which will lead to inaccurate image recognition in the future; taking the target portrait element as lips as an example, if the optimized rough display area is smaller than the actual lip area, then the related technology will result in only part of the lips having makeup after imitation makeup, and the boundary between makeup and no makeup will be more obvious, which generally leads to user dissatisfaction; in this embodiment, not only the area of the rough display area is not reduced, but the area of the rough display area can also be expanded but is not limited to it. In this case, the image area of the first area image is larger than the image area of the rough display area. In this way, the original information of the image can be guaranteed to be not lost to the greatest extent, thereby improving the accuracy of obtaining subsequent target images.
[0081] As an optional solution, the first region image is input as an input image to the target substructure to obtain a second region image, including:
[0082] The target substructure is used to perform image recognition on the target portrait element in the first region image to obtain a target region image, wherein the target region image includes the target portrait element and the image area of the target region image is less than or equal to the image area of the first region image.
[0083] It should be noted that if no optimization is performed, there is often a risk of misidentification in the related technology. For example, if the target portrait element is lips, if the unoptimized approximate display area is larger than the actual lip area, the lips will become larger after makeup is applied, causing distortion. However, in this embodiment, on the basis of retaining the original image information to the maximum extent, secondary image recognition will be performed, that is, the target substructure is used to perform image recognition on the target portrait element in the first area image to obtain the target area image. In this way, this embodiment retains the original image information and also uses secondary recognition to improve the recognition accuracy of the image.
[0084] As an optional solution, before acquiring the first target image to be identified, the method includes:
[0085] S1, obtaining multiple sample portrait data;
[0086] S2, marking the element type and makeup type of the portrait element in each sample portrait data to obtain a plurality of marked sample portrait data;
[0087] S3, inputting the labeled multiple sample portrait data into the initial target image structure to train and obtain the target image structure.
[0088] Optionally, in this embodiment, the target image structure is a model for recognizing images obtained after training with multiple sample portrait data, wherein each substructure can be trained individually, such as training the target substructure with sample data of the target element type and the target makeup type; however, in the overall training process, the target image structure also needs to be trained as a whole to ensure the overall makeup effect of the target image output by the target image structure.
[0089] To further illustrate, for example, in order to ensure that the output image of the target image structure can have a better performance in the overall makeup effect, the target image structure can also be but not limited to separately setting one or more output layer structures to output a target image with a better overall makeup effect; specifically, when the second region image output by the target substructure is obtained, the second region image and the first target image are input into the output layer structure. Normally, the output layer structure will simply replace the first region image in the first target image with the second region image. However, in this embodiment, in order to ensure the overall makeup effect, other sub-images in the first target image except the first region image may also be but not limited to adaptively processing the second region image. The second target image finally output includes the second region image and optimized other sub-images in the first target image except the first region image.
[0090] As an optional solution, for the convenience of explanation, the above target image acquisition method is applied to the beauty makeup scene during live broadcast as an example:
[0091] Optionally, in this embodiment, it is first necessary to input a face image at each moment during the live broadcast process, and determine the type of imitation makeup to be applied, and then encode the imitation makeup type as the input of the network, determine the imitation makeup area in the face image, and expand it to ensure the integrity of the imitation makeup area, and then send it as input to the Face Generative Adversarial Network (FaceGAN for short) for generation, and finally replace the original image with the generated makeup and output it. The specific steps are as follows: Figure 7 As shown, the content is as follows:
[0092] Step S702, the face input module inputs the face image of the person to be imitated in each frame obtained from the camera;
[0093] Step S704, the imitation makeup area division module determines the imitation makeup area according to the face image using feature points or a segmentation algorithm;
[0094] Step S706, since the imitation makeup area in the imitation makeup area determined by using feature points or segmentation algorithms based on the face image is generally not accurate enough, for example, lips will always contain more or less parts. If the area output by the algorithm is larger than the actual lip area, the lips will become larger after imitation makeup in the prior art, causing distortion. If the area output by the algorithm is smaller than the actual lip area, only part of the lips will have makeup after imitation makeup in the prior art, and the boundary between makeup and no makeup will be more obvious, which generally causes user dissatisfaction. However, FaceGAN does not have such problems, because the FaceGAN generation network generates imitation makeup areas such as lips and other skin areas in different ways, so this embodiment only needs to expand the area output by the imitation makeup area to ensure that the area to be generated must be completely included;
[0095] Step S708, the eyebrows, eyes, nose, lips, ears, hair, cheeks, forehead, chin and other areas of the face can all be imitated by FaceGAN, and there are many types of imitation makeup, such as eye color change, eye enlargement, willow-shaped eyebrows, sword-shaped eyebrows and other eyebrow makeup, lip color fullness, lip color change, thickening, thinning, nose straightening, sharpening, three-dimensional effect, etc., which can be selected during the use of FaceGAN and realized by selecting the makeup generation type module;
[0096] Step S710: The makeup type encoding module encodes the selected makeup type. FaceGAN needs to generate a 1x1024 vector of the selected makeup type and input it into the network. This algorithm has already been set during model training. When using it, you only need to match the selected type with the set type.
[0097] Step S712, the FaceGAN generation module performs model inference according to the makeup content encoded vector and the imitation makeup area;
[0098] Step S714, using the generated imitation makeup image output by the FaceGAN generation module to replace the corresponding area of the original image;
[0099] Step S716, outputting the image output by the makeup replacement module.
[0100] Through the embodiments provided in the present application, the following effects are achieved: using the encoding of the generative adversarial network as the feature representation of the imitation makeup type; expanding the imitation makeup area to ensure the integrity of the imitation makeup area; using the generator of the generative adversarial network to generate various imitation makeup effects for the imitation makeup area; using the generator of the generative adversarial network to generate non-imitation makeup effects for the non-imitation makeup area.
[0101] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0102] According to another aspect of the embodiments of the present invention, a device for acquiring a target image for implementing the above target image acquisition method is also provided. Figure 8 As shown, the device comprises:
[0103] A first acquisition unit 802 is used to acquire a first target image to be identified, wherein the first target image contains at least one portrait element of a target object;
[0104] The second acquisition unit 804 is used for, when a target makeup request for a target portrait element is acquired and at least one portrait element includes the target portrait element, responding to the target makeup instruction, acquiring a first region image including the target portrait element from the first target image, wherein the target makeup instruction is used to instruct to adjust the target portrait element to a portrait element of a target makeup type;
[0105] a determining unit 806, configured to determine a target substructure from at least two substructures of the target image structure according to a target element type and a target makeup type of the target portrait element, wherein the target image structure is a model for recognizing an image obtained after training using a plurality of sample portrait data, and the target substructure is used to adjust a portrait element of the target element type in the input image to a portrait element of the target makeup type;
[0106] A first input unit 808 is used to input the first region image as an input image into the target substructure to obtain a second region image, wherein the makeup type of the target portrait element in the second region image is the target makeup type;
[0107] The third acquisition unit 810 is used to acquire a second target image according to the second area image and the first target image, wherein the second target image includes at least one portrait element, and the makeup type of the target portrait element in the second target image is the target makeup type.
[0108] Optionally, in this embodiment, the target image acquisition device can be applied to, but not limited to, video application scenarios such as live broadcast and short video. Taking the target video being played as an example, assuming that a target makeup request for applying makeup to a portrait in the target video has been obtained, the target makeup request is further responded to, and one or more frames of face images at the current moment or time period in the target video are obtained as the first target image to execute the target image acquisition device.
[0109] Optionally, in this embodiment, the portrait element may be, but is not limited to, various elements on a human face, such as a nose element, an ear element, an eyebrow element, a mouth element, etc. The type of the portrait element may be, but is not limited to, an element type, such as a nose element of a nose type, an ear element of an ear type, an eyebrow element of an eyebrow type, a mouth element of a mouth type, etc.
[0110] Optionally, in this embodiment, the first region image may be, but is not limited to, a sub-image containing a target portrait element in the first target image.
[0111] Optionally, in this embodiment, the target image structure may be, but is not limited to, a model for recognizing images obtained after training using multiple sample portrait data; the target image structure may be, but is not limited to, including a neural network model, such as a convolutional neural network, a residual shrinkage network, a generative adversarial network, etc.; each of the at least two substructures of the target image structure may be, but is not limited to, a portrait element corresponding to one element type.
[0112] Optionally, in this embodiment, the makeup type may be, but is not limited to, a type of makeup operation, such as a zoom-in operation, a zoom-out operation, a whitening operation, a tanning operation, a blush adding operation, etc.; in addition, the makeup type may also be, but is not limited to, divided into a general makeup type and a non-general makeup type, wherein the makeup operation of the general makeup type may be, but is not limited to, performed on any portrait element, while the makeup operation of the non-general makeup type may be, but is not limited to, performed on a single or multiple portrait elements. For example, the eyebrow drawing type in the non-general makeup type may be, but is not limited to, performed only on the eyebrows in the portrait element, and the nose straightening type in the non-general makeup type may be, but is not limited to, performed only on the nose in the portrait element, etc.
[0113] Optionally, in this embodiment, the target image structure is a model for recognizing images obtained after training with multiple sample portrait data, wherein each substructure can be trained individually, such as training the target substructure with sample data of the target element type and the target makeup type; however, in the overall training process, the target image structure also needs to be trained as a whole to ensure the overall makeup effect of the target image output by the target image structure.
[0114] To further illustrate, for example, in order to ensure that the output image of the target image structure can have a better performance in the overall makeup effect, the target image structure can also be but not limited to separately setting one or more output layer structures to output a target image with a better overall makeup effect; specifically, when the second region image output by the target substructure is obtained, the second region image and the first target image are input into the output layer structure. Normally, the output layer structure will simply replace the first region image in the first target image with the second region image. However, in this embodiment, in order to ensure the overall makeup effect, other sub-images in the first target image except the first region image may also be but not limited to adaptively processing the second region image. The second target image finally output includes the second region image and optimized other sub-images in the first target image except the first region image.
[0115] For a specific embodiment, reference may be made to the example shown in the above-mentioned method for acquiring the target image, which will not be described in detail in this example.
[0116] It should be noted that processing makeup events of various makeup types of images of various element types in a substructure manner satisfies the targeted processing of various makeup events of images of various element types; furthermore, since the above-mentioned substructures are trained and used as a whole in the same target image structure, this also overcomes the problem of poor overall makeup effect of the target image caused by structural dispersion.
[0117] Through the embodiments provided by the present application, a first target image to be identified is obtained, wherein the first target image contains at least one portrait element of the target object; when a target makeup request for the target portrait element is obtained and at least one portrait element includes the target portrait element, a first area image containing the target portrait element is obtained from the first target image in response to a target makeup instruction, wherein the target makeup instruction is used to instruct to adjust the target portrait element to a portrait element of a target makeup type; according to the target element type and the target makeup type of the target portrait element, a target substructure is determined from at least two substructures of the target image structure, wherein the target image structure is obtained after training using multiple sample portrait data for A model for recognizing an image, wherein a target substructure is used to adjust a portrait element of a target element type in an input image to a portrait element of a target makeup type; a first area image is input as an input image into the target substructure to obtain a second area image, wherein the makeup type of the target portrait element in the second area image is the target makeup type; a second target image is obtained according to the second area image and the first target image, wherein the second target image contains at least one portrait element, and the makeup type of the target portrait element in the second target image is the target makeup type, thereby achieving the purpose of taking into account both the type targeting in the image processing process and the overall makeup effect ultimately presented, thereby realizing the technical effect of improving the accuracy of acquiring the target image.
[0118] As an optional solution, the determining unit 806 includes:
[0119] A first acquisition module is used to acquire a target code corresponding to a target element type and a target makeup type, wherein the target code is used to identify the element type and the makeup type corresponding to each substructure of at least two substructures;
[0120] The first determination module is used to determine a target substructure matching the target code from at least two substructures.
[0121] For a specific embodiment, reference may be made to the example shown in the above-mentioned method for acquiring the target image, which will not be described in detail in this example.
[0122] As an optional solution, the first determination module includes:
[0123] A first determining submodule is configured to determine a substructure corresponding to the target code as a target substructure when the target code set includes the target code, wherein the target code set includes at least two codes, and each of the at least two codes corresponds to each substructure in a one-to-one manner; or
[0124] The second determination submodule is used to determine a target alternative code from the target code set when the target code is not included in the target code set, wherein the similarity between the element type corresponding to the target alternative code and the target element type reaches a first threshold, and / or the similarity between the makeup type corresponding to the target alternative code and the target makeup type reaches a second threshold; and determine the substructure corresponding to the target alternative code as the target code.
[0125] For a specific embodiment, reference may be made to the example shown in the above-mentioned method for acquiring the target image, which will not be described in detail in this example.
[0126] As an optional solution, the determining unit 806 includes:
[0127] A second determination module, configured to determine at least one first candidate substructure matching the target element type from the at least two substructures;
[0128] The third determination module is used to determine a target substructure matching the target makeup type from the at least one first candidate substructure.
[0129] For a specific embodiment, reference may be made to the example shown in the above-mentioned method for acquiring the target image, which will not be described in detail in this example.
[0130] As an optional solution, the determining unit 806 includes:
[0131] a fourth determination module, configured to determine at least one second candidate substructure matching the target makeup type from the at least two substructures;
[0132] The fifth determining module is used to determine a target substructure matching the target element type from at least one second candidate substructure.
[0133] For a specific embodiment, reference may be made to the example shown in the above-mentioned method for acquiring the target image, which will not be described in detail in this example.
[0134] As an optional solution, the second obtaining unit 804 includes:
[0135] A first recognition module, used to recognize a rough display area of a target portrait element in the first target image from the first target image;
[0136] The second acquisition module is used to acquire a first region image from the first target image according to the schematic display region, wherein the image area of the first region image is greater than or equal to the image area of the schematic display region.
[0137] For a specific embodiment, reference may be made to the example shown in the above-mentioned method for acquiring the target image, which will not be described in detail in this example.
[0138] As an optional solution, the input unit includes:
[0139] The second recognition module is used to use the target substructure to perform image recognition on the target portrait element in the first area image to obtain a target area image, wherein the target area image includes the target portrait element and the image area of the target area image is less than or equal to the image area of the first area image.
[0140] For a specific embodiment, reference may be made to the example shown in the above-mentioned method for acquiring the target image, which will not be described in detail in this example.
[0141] As an optional solution, it includes:
[0142] A fourth acquisition unit, used for acquiring a plurality of sample portrait data before acquiring a first target image to be identified;
[0143] a marking unit, used for marking the element type and the makeup type of the portrait element in each sample portrait data before acquiring the first target image to be identified, so as to obtain a plurality of marked sample portrait data;
[0144] The second input unit is used to input the labeled multiple sample portrait data into the initial target image structure before acquiring the first target image to be identified, so as to train and obtain the target image structure.
[0145] For a specific embodiment, reference may be made to the example shown in the above-mentioned method for acquiring the target image, which will not be described in detail in this example.
[0146] According to another aspect of the embodiments of the present invention, an electronic device for implementing the above-mentioned target image acquisition method is also provided. Fig. 9 As shown, the electronic device includes a memory 902 and a processor 904. The memory 902 stores a computer program, and the processor 904 is configured to execute the steps in any of the above method embodiments through the computer program.
[0147] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.
[0148] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0149] S1, obtaining a first target image to be identified, wherein the first target image contains at least one portrait element of a target object;
[0150] S2, in response to a target makeup instruction, obtaining a first region image including the target portrait element from the first target image, when a target makeup request for the target portrait element is obtained and at least one portrait element includes the target portrait element, wherein the target makeup instruction is used to instruct to adjust the target portrait element to a portrait element of a target makeup type;
[0151] S3, determining a target substructure from at least two substructures of the target image structure according to a target element type and a target makeup type of the target portrait element, wherein the target image structure is a model for recognizing an image obtained after training using a plurality of sample portrait data, and the target substructure is used to adjust a portrait element of the target element type in the input image to a portrait element of the target makeup type;
[0152] S4, inputting the first region image as an input image into the target substructure to obtain a second region image, wherein the makeup type of the target portrait element in the second region image is the target makeup type;
[0153] S5, acquiring a second target image according to the second region image and the first target image, wherein the second target image includes at least one portrait element, and the makeup type of the target portrait element in the second target image is the target makeup type.
[0154] Alternatively, a person skilled in the art may understand that: Fig. 9 The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, MID), a PAD, or other terminal devices. Fig. 9 The structure of the electronic device is not limited. Fig. 9 More or fewer components (such as network interfaces, etc.) as shown in, or with Fig. 9 Different configurations are shown.
[0155] Among them, the memory 902 can be used to store software programs and modules, such as the program instructions / modules corresponding to the method and device for acquiring the target image in the embodiment of the present invention. The processor 904 executes various functional applications and data processing by running the software programs and modules stored in the memory 902, that is, to realize the above-mentioned method for acquiring the target image. The memory 902 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 902 may further include a memory remotely arranged relative to the processor 904, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 902 may be specifically used, but not limited to, to store information such as the first target image, the target image structure, and the second target image. As an example, if Fig. 9 As shown, the memory 902 may include, but is not limited to, the first acquisition unit 802, the second acquisition unit 804, the determination unit 806, the first input unit 808, and the third acquisition unit 810 in the target image acquisition device. In addition, other module units in the target image acquisition device may also be included but are not limited to, which will not be described in detail in this example.
[0156] Optionally, the transmission device 906 is used to receive or send data via a network. Specific examples of the above-mentioned network may include a wired network and a wireless network. In one example, the transmission device 906 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 906 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0157] In addition, the electronic device further comprises: a display 908 for displaying information such as the first target image, the target image structure and the second target image; and a connection bus 910 for connecting various module components in the electronic device.
[0158] In other embodiments, the terminal device or server may be a node in a distributed system, wherein the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the multiple nodes through network communication. Among them, the nodes may form a peer-to-peer (P2P) network, and any form of computing device, such as a server, terminal or other electronic device, may become a node in the blockchain system by joining the peer-to-peer network.
[0159] According to one aspect of the present application, a computer-readable storage medium is provided, and 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 executes the above-mentioned method for acquiring the target image.
[0160] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0161] S1, obtaining a first target image to be identified, wherein the first target image contains at least one portrait element of a target object;
[0162] S2, in response to a target makeup instruction, obtaining a first region image including the target portrait element from the first target image, when a target makeup request for the target portrait element is obtained and at least one portrait element includes the target portrait element, wherein the target makeup instruction is used to instruct to adjust the target portrait element to a portrait element of a target makeup type;
[0163] S3, determining a target substructure from at least two substructures of the target image structure according to a target element type and a target makeup type of the target portrait element, wherein the target image structure is a model for recognizing an image obtained after training using a plurality of sample portrait data, and the target substructure is used to adjust a portrait element of the target element type in the input image to a portrait element of the target makeup type;
[0164] S4, inputting the first region image as an input image into the target substructure to obtain a second region image, wherein the makeup type of the target portrait element in the second region image is the target makeup type;
[0165] S5, acquiring a second target image according to the second region image and the first target image, wherein the second target image includes at least one portrait element, and the makeup type of the target portrait element in the second target image is the target makeup type.
[0166] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0167] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0168] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the relevant technology, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which can be personal computers, servers or network devices, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
[0169] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0170] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0171] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0172] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0173] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for acquiring a target image, characterized in that: include: Acquire a first target image to be identified, wherein the first target image contains at least one portrait element of a target object; In a case where a target makeup request for a target portrait element is obtained and the at least one portrait element includes the target portrait element, in response to the target makeup request, a first region image including the target portrait element is obtained from the first target image, wherein the target makeup request is used to instruct to adjust the target portrait element to a portrait element of a target makeup type; According to the target element type of the target portrait element and the target makeup type, determining a target substructure from at least two substructures of the target image structure, wherein the target substructure is used to adjust the portrait element of the target element type in the input image to the portrait element of the target makeup type; Inputting the first region image as the input image into the target substructure to obtain a second region image, wherein the makeup type of the target portrait element in the second region image is the target makeup type; Acquire a second target image according to the second region image and the first target image, and perform adaptive processing on the second region image on other sub-images of the first target image except the first region image to acquire a second target image, wherein the second target image includes the at least one portrait element, and the makeup type of the target portrait element in the second target image is the target makeup type; The determining a target substructure from at least two substructures of a target image structure according to the target element type of the target portrait element and the target makeup type includes: Obtaining a target code corresponding to the target element type and the target makeup type, wherein the target code is used to identify the element type and the makeup type corresponding to each of the at least two substructures; Determining the target substructure matching the target encoding from the at least two substructures; The step of determining the target substructure matching the target encoding from the at least two substructures comprises: In a case where the target coding set includes the target coding, determining the substructure corresponding to the target coding as the target substructure, wherein the target coding set includes at least two codings, and each of the at least two codings corresponds to each substructure one-to-one; or, In the case that the target code is not included in the target code set, a target alternative code is determined from the target code set, wherein the similarity between the element type corresponding to the target alternative code and the target element type reaches a first threshold, and / or the similarity between the makeup type corresponding to the target alternative code and the target makeup type reaches a second threshold; and the substructure corresponding to the target alternative code is determined as the target code.
2. The method according to claim 1, characterized in that: The step of determining the target substructure matching the target encoding from the at least two substructures comprises: Determine at least one first candidate substructure matching the target element type from the at least two substructures; The target substructure matching the target makeup type is determined from the at least one first candidate substructure.
3. The method according to claim 1, characterized in that The step of determining the target substructure matching the target encoding from the at least two substructures comprises: Determining at least one second candidate substructure matching the target makeup type from the at least two substructures; The target substructure matching the target element type is determined from the at least one second candidate substructure.
4. The method according to claim 1, characterized in that: The step of acquiring a first region image containing the target portrait element from the first target image includes: Identifying a rough display area of the target portrait element in the first target image from the first target image; The first region image is acquired from the first target image according to the schematic display region, wherein an image area of the first region image is greater than or equal to an image area of the schematic display region.
5. The method according to claim 4, characterized in that The step of inputting the first region image as the input image into the target substructure to obtain a second region image comprises: The target substructure is used to perform image recognition on the target portrait element in the first region image to obtain a target region image, wherein the target region image includes the target portrait element and an image area of the target region image is less than or equal to an image area of the first region image.
6. The method according to any one of claims 1 to 5, characterized in that Before acquiring the first target image to be identified, the method includes: Obtain multiple sample portrait data; Marking the element type and the makeup type of the portrait element in each of the sample portrait data to obtain the marked plurality of sample portrait data; The labeled plurality of sample portrait data are input into an initial target image structure to obtain the target image structure through training.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method described in any one of claims 1 to 5 when executed.
8. An electronic device, comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 5 through the computer program.