CN113850716A - Model training method, image processing method, device, electronic device and medium - Google Patents

Model training method, image processing method, device, electronic device and medium Download PDF

Info

Publication number
CN113850716A
CN113850716A CN202111175983.9A CN202111175983A CN113850716A CN 113850716 A CN113850716 A CN 113850716A CN 202111175983 A CN202111175983 A CN 202111175983A CN 113850716 A CN113850716 A CN 113850716A
Authority
CN
China
Prior art keywords
image
model
training
conversion
trained
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111175983.9A
Other languages
Chinese (zh)
Inventor
张朋
周思宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Zitiao Network Technology Co Ltd
Original Assignee
Beijing Zitiao Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Zitiao Network Technology Co Ltd filed Critical Beijing Zitiao Network Technology Co Ltd
Priority to CN202111175983.9A priority Critical patent/CN113850716A/en
Publication of CN113850716A publication Critical patent/CN113850716A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/04Context-preserving transformations, e.g. by using an importance map
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30196Human being; Person
    • G06T2207/30201Face

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Medical Informatics (AREA)
  • Evolutionary Computation (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Mathematical Physics (AREA)
  • Artificial Intelligence (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

The embodiment of the disclosure discloses a model training method, an image processing device, an electronic device and a medium, wherein the model training method comprises the following steps: training a conversion model according to a first image of a source type and a second image of a target type, and converting the first image into a third image of the target type based on the trained conversion model; according to the object contained in the first image, adjusting a corresponding object in the third image to obtain an adjusted image; and training a special effect model according to the first image and the adjusting image. By adjusting the third image generated by the conversion model and training the special effect model based on the adjusted image, the model training speed can be improved on the basis of ensuring the conversion effect.

Description

Model training method, image processing method, device, electronic device and medium
Technical Field
The embodiment of the disclosure relates to the technical field of machine learning, in particular to a model training method, an image processing device, electronic equipment and a medium.
Background
Nowadays, special effect playing methods for human face images are widely applied to various application software, such as image/video editing software, shooting software and the like. The special effect playing method of the face image can comprise face conversion, such as age conversion, gender conversion and the like.
In the prior art, face conversion in a face image can be realized based on a trained model. The disadvantages of the prior art at least include that in order to ensure the face conversion effect, the model needs to be trained in a long time, which results in a slow model training speed.
Disclosure of Invention
The embodiment of the disclosure provides a model training method, an image processing device, an electronic device and a medium, which can improve the model training speed on the basis of ensuring the conversion effect.
In a first aspect, an embodiment of the present disclosure provides a model training method, including:
training a conversion model according to a first image of a source type and a second image of a target type, and converting the first image into a third image of the target type based on the trained conversion model;
according to the object contained in the first image, adjusting a corresponding object in the third image to obtain an adjusted image;
and training a special effect model according to the first image and the adjusting image.
In a second aspect, an embodiment of the present disclosure provides an image processing method, including:
inputting the source type image to be converted into a special effect model;
outputting a target image of a target type through the special effect model;
the special effect model is obtained by training based on any one of the model training methods in the embodiments of the disclosure.
In a third aspect, an embodiment of the present disclosure further provides a model training apparatus, including:
the conversion model training module is used for training a conversion model according to a first image of a source type and a second image of a target type so as to convert the first image into a third image of the target type based on the trained conversion model;
the adjusting module is used for adjusting a corresponding object in the third image according to the object contained in the first image to obtain an adjusted image;
and the special effect model training module is used for training the special effect model according to the first image and the adjusting image.
In a fourth aspect, an embodiment of the present disclosure provides an image processing apparatus, including:
the input module is used for inputting the source type image to be converted into the special effect model;
the output module is used for outputting a target image of a target type through the special effect model;
the special effect model is obtained by training based on any one of the model training methods in the embodiments of the disclosure.
In a fifth aspect, an embodiment of the present disclosure further provides an electronic device, where the electronic device includes:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement a model training method as in any of the embodiments of the present disclosure, or an image processing method as in any of the embodiments of the present disclosure.
In a sixth aspect, the embodiments of the present disclosure further provide a storage medium containing computer-executable instructions, which when executed by a computer processor, are used to perform the model training method according to any one of the embodiments of the present disclosure, or to implement the image processing method according to any one of the embodiments of the present disclosure.
According to the technical scheme of the embodiment of the disclosure, the model training method comprises the following steps: training a conversion model according to the first image of the source type and the second image of the target type, and converting the first image into a third image of the target type based on the trained conversion model; according to the object contained in the first image, adjusting a corresponding object in the third image to obtain an adjusted image; and training the special effect model according to the first image and the adjusting image.
After the first image of the source type is converted into the third image of the target type based on the trained conversion model, the corresponding object in the third image is adjusted according to the object contained in the first image, so that an adjusted image with a better conversion effect can be obtained. By training the special effect model based on the adjusting image, the conversion effect of the special effect model can be ensured, the phenomenon that the model is repeatedly trained to achieve the expected conversion effect is avoided, and the model training speed is increased.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and features are not necessarily drawn to scale.
Fig. 1 is a schematic flow chart of a model training method according to a first embodiment of the present disclosure;
fig. 2 is a schematic diagram of special effect model training in a model training method according to a first embodiment of the disclosure;
fig. 3 is a schematic flowchart of a model training method according to a second embodiment of the disclosure;
fig. 4 is a schematic diagram of generating model training in a model training method according to a second embodiment of the present disclosure;
FIG. 5 is a schematic diagram illustrating an encoder training in a model training method according to a second embodiment of the disclosure;
fig. 6 is a schematic diagram of conversion model training in a model training method according to a second embodiment of the present disclosure;
fig. 7 is a schematic flowchart of an image processing method according to a third embodiment of the disclosure;
fig. 8 is a schematic structural diagram of a model training apparatus according to a fourth embodiment of the present disclosure;
fig. 9 is a schematic structural diagram of an image processing apparatus according to a fifth embodiment of the disclosure;
fig. 10 is a schematic structural diagram of an electronic device according to a sixth embodiment of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "based, at least in part, on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
Example one
Fig. 1 is a schematic flow chart of a model training method according to a first embodiment of the present disclosure. The embodiment of the disclosure is suitable for the case of training the model of image conversion, for example, the case of training the model of face image conversion. The method may be performed by a model training apparatus, which may be implemented in software and/or hardware, which may be configured in an electronic device, such as a computer.
As shown in fig. 1, the model training method provided in this embodiment includes:
s110, training a conversion model according to the first image of the source type and the second image of the target type, and converting the first image into a third image of the target type based on the trained conversion model.
The model trained based on the model training method disclosed by the embodiment of the disclosure can be used for converting images among different types. The type of the image can be classified according to different factors according to specific scenes. For example, assuming that the image is a human face image, if the image is classified by age factors, the types of the image may include a baby, a child, a teenager, a young adult, a middle aged adult, an old aged adult, and the like; if the images are classified by gender factors, the types of images may include male and female; if the images are classified by drawing style factors, the types of the images may include handwriting, abstraction, oil painting, ink painting, comics, simple strokes, and the like.
The source type may refer to a type of an image before conversion, the target type may refer to a type of an image after conversion, and the source type and the target type may be of different types classified by the same factor. For example, when the source type is an infant type, the target type may be a child type; as another example, when the source type is a male type, the target type may be a female type; further, for example, when the source type is a reality-on-write type, the target type may be a caricature type, or the like. It can be considered that, for image conversion between different source types and target types, corresponding models can be trained according to the model training method provided by the present disclosure.
Before model training, a large number of first images of a source type and second images of a target type may be acquired by means of acquisition, virtual rendering, and/or network generation with user authorization. Wherein the first image and the second image may be unpaired data. If the first image and the second image belonging to the same individual can be paired pairwise, the first image and the second image can be considered as paired data; on the contrary, if there is a first image and a second image that cannot be paired, the first image and the second image may be regarded as unpaired data.
In the model training process, the conversion model can be trained according to the first image and the second image; wherein the transformation model may be considered a machine learning model, such as a neural network model. The step of training the transformation model may comprise: and taking the first image as the input of the conversion model, and training the conversion model according to the output image of the conversion model and the second image.
Wherein, training the conversion model according to the output image of the conversion model and the second image may include: training the conversion model according to the probability that the output image of the conversion model and the second image are judged to be the same type; and when the probability judged to be the same type is greater than the preset probability, the conversion model can be considered to be trained completely.
In order to improve the model training speed, a relatively loose training finishing condition can be set at the stage of training the conversion model. For example, when it is determined whether training is completed according to the probability that the output image and the second image are determined to be the same type and the preset probability, the preset probability may be set to a smaller value. Therefore, the trained conversion model can realize the conversion of the image from the source type to the target type, namely the first image can be converted into the third image of the target type, but the conversion result may be rough.
In some optional implementations, in the training of the transformation model, the method may further include: screening a second image of the target type; correspondingly, training the conversion model according to the first image of the source type and the second image of the target type comprises the following steps: and training a conversion model according to the first image of the source type and the screened second image.
In these optional implementation manners, a screening manner may be preset according to a specific scene, and the second image is screened based on the preset screening manner, so as to obtain the second image with good image quality and beneficial to model training. Wherein, the screening mode can include but is not limited to: the screening method is based on at least one factor of image focusing, exposure, definition, white balance and interest area ratio in the image. The conversion model is trained according to the first image and the screened second image, so that the generation effect of the third image can be improved to a certain extent.
In some further implementations, the filtering of the second image of the target type includes: detecting face key points and hair regions in a second image of the target type; determining a forehead area according to the key points of the face, and determining an overlapping area of the forehead area and a hair area; and screening the second image according to the proportion of the overlapping area to the forehead area.
When the image is a face image, the screening mode of the second image may include a face area ratio in the image, and the screening process may include: firstly, detecting key points of the face (such as key points of objects such as eyebrows, eyes, noses, mouths, ears and the like) and hair areas in a second image; then, predicting the forehead area of the face according to key points of the face, such as key points of eyebrows and ears; then, determining the proportion of the overlapping area of the forehead area and the hair area in the forehead area; and finally, screening out second images with the occupation ratio smaller than the preset occupation ratio for training the conversion model.
In these further implementations, face region occlusion is avoided by deleting the second image having a larger bang region to forehead region. And performing conversion model training by using the screened second image, thereby being beneficial to generating a face region in the third image. In addition, when the image is a face image, the second image screening can be performed in other screening modes, for example, screening can be performed according to the color value, and model conversion training is performed by using the image with the high color value, so that the color value of the third image is higher, and the user experience can be improved.
And S120, adjusting the corresponding object in the third image according to the object contained in the first image to obtain an adjusted image.
And after the training of the conversion model is finished, adjusting a third image generated by the conversion model. Wherein, the object to be adjusted can be preset according to a specific scene. For example, when the image is a human face image, the objects to be adjusted may include, but are not limited to, eyebrows, eyes, nose, mouth, ears, and hair. If the object to be adjusted is included in both the first image and the third image, the object may be considered to have a correspondence relationship between the first image and the third image. At this time, the corresponding object to be adjusted in the third image may be adjusted according to the object to be adjusted included in the first image.
The adjusting of the corresponding object in the third image according to the object included in the first image may include, but is not limited to: and adjusting the corresponding contour, texture, color and the like in the third image according to the characteristics of the contour, texture, color and the like of the object in the first image.
By adjusting the object in the third image based on the first image, the third image and the first image can be made to have similarity, for example, the face image after the age and sex conversion and the original face image can be made to look like the same person. And the beautification adjustment can be carried out on the object in the third image to a certain extent, so that the third image has better presentation effect.
In some optional implementations, adjusting the corresponding object in the third image according to the object included in the first image includes at least one of: adjusting corresponding face key points in the third image according to the face key points contained in the first image; and superposing the image of the hair area contained in the first image to the hair area in the third image.
When the image is a face image, adjusting the third image may include: detecting key points, namely face key points, of an object to be adjusted in the first image and the third image; based on an image deformation method (such as a TPS deformation method), the face key points in the third image are adjusted according to the position corresponding relation of the face key points in the first image. Therefore, the local deformation of facial features can be finely adjusted, and the similarity of the third image and the first image is improved.
In addition, when the image is a face image, adjusting the third image may further include: an image of the hair region in the first image (which may be a mask of the hair region, for example) is extracted, and the image of the hair region is superimposed on the hair region in the third image. In the third image generated by the transformation model, messy or redundant hairs are easily generated, and the overall effect is poor. By converting the face of the third image while retaining the hair region in the first image, not only the similarity between the third image and the first image can be improved, but also the effect of generating the third image can be optimized. In addition, before the third image is superposed with the image of the hair area of the first image, the beautification adjustment can be performed on the image of the hair area of the first image, so that the generation effect of the third image is further improved.
In these alternative implementations, by flexibly adjusting different objects such as five sense organs, hair, etc. in the third image according to the first image, the third image can be adjusted to a state with the best presentation effect.
And S130, training the special effect model according to the first image and the adjusting image.
A large amount of paired data, i.e., the first image and the adjustment image, can be generated based on the above adjustment. Further, the special effects model may be trained through paired data. The special effect model may be considered a machine learning model, such as a neural network model. The step of training the transformation model may comprise: and taking the first image as the input of the conversion model, and training the special effect model according to the output image and the adjusting image of the special effect model. Specific examples may include: and calculating a first loss value of an output image and an adjustment image of the special effect model, and training the special effect model according to the first loss value. Wherein the loss value is calculated based on a preset loss function, and the preset loss function may include, but is not limited to, a logarithmic loss function, an exponential loss function, a cross-entropy loss function, a squared error loss function, and the like. When the first loss value is smaller than the first preset value, the training of the special effect model can be considered to be finished, and the first preset value can be set to be a small value so as to improve the training effect of the special effect model.
The adjusted image can be an image which is adjusted based on the first image, has a good conversion effect and a better presentation effect. Training the special effect model based on the paired adjustment images and the first images, and repeatedly training the conversion model based on unpaired data compared with the traditional training mode of outputting the expected effect images by the conversion model, on the basis of ensuring the conversion effect of the model, the training time consumption is reduced, and the model training efficiency is improved.
In addition, after the model training is finished to obtain the special effect model, the special effect model can be integrated into application software of a server or a client and installed on the electronic equipment along with the application software. When the electronic equipment runs application software, the image conversion special effect can be realized based on the special effect model in the software, and the user experience is improved.
Fig. 2 is a schematic diagram illustrating special effect model training in a model training method according to a first embodiment of the present disclosure. Referring to fig. 2, the first image of the source type may be a baby image a and the second image of the target type may be a child image B. In the training process of the special effect model, the method can comprise the following steps: firstly, training a conversion model M1 according to a baby image A and a child image B; converting the baby image A into a child image A' based on the trained conversion model M1; according to the object in the baby image A, adjusting the object in the child image A '(such as fine adjustment of five sense organs, image superposition of hair regions and the like) to obtain an adjusted image A'; the special effects model M2 is trained from the paired baby image a and adjustment image a ".
The image A' can be adjusted to be an image which has similarity with the image A of the baby and has good presentation effect. Compared with the traditional training mode of repeatedly training the conversion model M1 based on the unpaired baby image A and child image B, the training special effect model M2 is trained based on the paired adjustment image A' and baby image A, so that the conversion model M1 outputs the expected effect image, the training time consumption can be reduced on the basis of ensuring the conversion effect, and the training efficiency of the special effect model is improved. And the trained special effect model M2 can be applied to a server or a client to perform face conversion from a baby image to a child image.
According to the technical scheme of the embodiment of the disclosure, a conversion model is trained according to a first image of a source type and a second image of a target type, so that the first image is converted into a third image of the target type based on the trained conversion model; according to the object contained in the first image, adjusting a corresponding object in the third image to obtain an adjusted image; and training the special effect model according to the first image and the adjusting image.
After the first image of the source type is converted into the third image of the target type based on the trained conversion model, the corresponding object in the third image is adjusted according to the object contained in the first image, so that an adjusted image with a better conversion effect can be obtained. By training the special effect model based on the adjusting image, the conversion effect of the special effect model can be ensured, the phenomenon that the model is repeatedly trained to achieve the expected conversion effect is avoided, and the model training speed is increased.
Example two
The embodiments of the present disclosure and various alternatives in the model training method provided in the above embodiments may be combined. The model training method provided by this embodiment describes in detail the training steps of the conversion model. Firstly, training a generative model based on a first image enables the generative model to generate an image of a source type; secondly, training an encoder based on a first image by taking the generated model as a priori, so that the encoder can extract image features; and thirdly, before the encoder is connected to the conversion model, the initial parameters of the conversion model are configured by using the parameters of the trained generation model, and the conversion model is trained on the basis of the first image and the second image, so that the conversion model can realize the image conversion from the source type to the target type.
The encoder can extract the first image characteristics by training the encoder based on the generated model, thereby being beneficial to training the encoder with different functions including the conversion model and the subsequent model, improving the universality of model training and realizing the conversion of the image from the source type to different target types. In addition, the generated third image effect can be more real and natural by training the generation model and the conversion model based on the generation countermeasure network.
Fig. 3 is a schematic flow chart of a model training method according to a second embodiment of the present disclosure. As shown in fig. 3, the model training method provided in this embodiment includes:
and S310, training and generating a model according to the first image of the source type.
In this embodiment, the generative model may be used as a generator for generating the countermeasure network, and is trained along with the generation of the countermeasure network. The generative model may be caused to generate an image of the source type by training the generative model from the first image of the source type.
Fig. 4 is a schematic diagram of generating model training in a model training method according to a second embodiment of the present disclosure.
Referring to fig. 4, in some alternative implementations, training the generative model G1 from the first image a of the source type may include: inputting a white noise image N into the generation model G1, and inputting an output image G1(N) of the generation model G1 and a first image a of a source type into the first discriminator D1; the generation model G1 is trained based on the discrimination result of the first discriminator D1.
The training of the generative model G1 according to the result of the first discriminator D1 may include two stages: first, when training the first discriminator D1, that is, when the generated model G1 parameters are fixed, the first discriminator D1 discriminates whether the output image G1(N) and the first image a belong to the original image or the image generated by the generated model G1, and can train the first discriminator D1 with the aim of improving the accuracy of the discrimination result. Second, training the generative model G1, i.e., training the generative model G1 with the goal that the first discriminator D1 cannot correctly discriminate the output image G1(N) from the first image a, when the parameters of the first discriminator D1 are fixed. The two-stage training process for generating the countermeasure network can be sequentially and circularly trained, the generation model can be trained firstly, the first discriminator can be trained firstly, and the training can be stopped by circulating to a preset condition. The preset conditions may include, but are not limited to, cycling for a preset number of times, the accuracy of the first discriminator reaching a certain precision, and the like, which are not exhaustive herein.
In these alternative implementations, the training of the mutual game between the generative model and the first discriminator can make the trained generative model generate the source type image more effectively.
And S320, training an encoder according to the first image and the trained generative model.
In this embodiment, the encoder may be configured to encode the image to extract the image features. In order to enable the encoder to accurately extract the image features, the trained generation model can be used as prior experience to train the encoder. The process of training the encoder may be to ensure that the generative model can still generate the source type image by adjusting the parameters of the encoder after the generative model is connected to the encoder under the condition that the parameters of the generative model are fixed.
For example, fig. 5 is a schematic diagram of encoder training in a model training method according to a second embodiment of the present disclosure.
Referring to fig. 5, in some alternative implementations, training the encoder E based on the first image a and the trained generative model G1 may include: processing the first image A sequentially by an encoder E and a trained generative model G1 to obtain an output image G1(E (A)) of a generative model G1; the encoder E is trained on the output image G1(E (a)) of the generative model G1 and the first image a.
Wherein the training of the encoder E according to the output image G1(E (a)) of the generative model G1 and the first image a may include: a second loss value between the output image G1(E (a)) of the generative model G1 and the first image a is calculated, from which the encoder E is trained. The second loss value may also be calculated based on a predetermined loss function, and the predetermined loss function may be the same as or different from the function for calculating the first loss value. And when the second loss value is smaller than the second preset value, the encoder E can be considered to be trained completely.
In these alternative implementations, the encoder is connected to the generative model, and the trained generative model is used as a priori (for example, parameters of the fixed generative model), so that the encoder can extract image features by training the encoder based on the first image.
S330, training a conversion model according to the trained encoder, the first image and the second image of the target type.
In this embodiment, the conversion model may also be used as a generator for generating the countermeasure network, and training is performed along with the generation of the countermeasure network. Since the encoder can accurately extract the image features, the encoder can be connected before the conversion model, and the extracted image features of the first image are input into the conversion model, so that the conversion model can learn the logic rule of generating the image of the target type from the image features. And when the target type comprises a plurality of different types, a plurality of conversion models can be connected in parallel behind the encoder, so that the training of the encoder post-connected models with different functions is facilitated, the universality of model training is improved, and the conversion of the image from the source type to the different target types is realized.
Before training the conversion model, the initial parameters of the conversion model may be configured based on the parameters of the trained generation model. Therefore, parameters of the conversion model can be finely adjusted on the basis, and the training speed of the conversion model can be accelerated to a certain extent. It can be considered that the image generated by the first image in the initial training stage through the encoder and the conversion model is the image of the source type. However, as the training process time increases, the conversion model is trained from the second image, which may enable the conversion model to perform the conversion of the source type image to the target type image.
Fig. 6 is a schematic diagram of conversion model training in a model training method according to a second embodiment of the present disclosure.
Referring to fig. 6, in some alternative implementations, training the transformation model G2 according to the trained encoder E, the first image a, and the second image B of the target type may include: processing the first image A by a trained encoder E and a conversion model G2 in sequence to obtain an output image G2(E (A)) of the conversion model; inputting an output image G2(e (a)) of the conversion model and a second image B of the target type into a second discriminator D2; the conversion model G2 is trained based on the discrimination result of the second discriminator D2.
Wherein, training the conversion model G2 according to the result of the first discriminator D2 may include two stages: first, when training second discriminator D2, that is, when conversion model G2 parameters are fixed, second discriminator D2 discriminates whether output image G2 (e) (a)) and second image B belong to the original image or the image generated by conversion model G2, and can train second discriminator D2 with the goal of improving the accuracy of the discrimination result. And a stage of training the conversion model G2, namely training the conversion model G2 aiming at the problem that the second discriminator D2 cannot correctly distinguish the output image G2(E (A)) from the second image B under the condition that the parameters of the second discriminator D2 are fixed. The two-stage training process for generating the countermeasure network can be sequentially and circularly trained, the conversion model can be trained firstly, the second discriminator can be trained firstly, and the training can be stopped by circulating to a preset condition. The preset conditions may include, but are not limited to, cycling for a preset number of times, the accuracy of the second discriminator reaching a certain precision, and the like, which are not exhaustive herein.
In addition, the output image of the conversion model and the screened second image can be input into the second discriminator to train the conversion model, so that the presentation effect of the third image generated by the conversion model can be improved.
In these optional implementations, the training of the mutual game between the conversion model and the second discriminator can make the trained conversion model generate the image of the target type better.
In some optional implementations, training the conversion model according to the trained encoder, the first image, and the second image of the target type further includes: expanding the second image of the target type; and training a conversion model according to the trained encoder, the first image and the expanded second image.
The expanding the second image of the target type may include, but is not limited to, cropping, mirroring, rotating, etc. the second image to obtain more second images. By increasing the number of second images, the conversion effect of the conversion model can be improved to some extent.
The second images can be expanded after being screened, so that the problem of poor training effect of the conversion model caused by less training data is avoided, and the conversion effect of the conversion model is improved. In addition, whether the second image is expanded or not can be determined according to the judgment result of the second judgment device, so that the expansion at any time can be avoided, model training is carried out based on the expansion data, and the efficiency of converting the model training is improved.
Wherein, according to the result of the second discriminator, determining whether to expand the second image may be: and adaptively adjusting the probability p according to the judgment result of the second discriminator, and determining whether to expand the second image according to the probability p. For example, under the condition that the accuracy of the discrimination result is always high, the training degree of the conversion model is considered to be not strong enough, at this time, the probability p can be increased, and when the probability p is greater than the third preset value, the second image can be determined to be expanded.
In these optional implementation manners, the second image is expanded, so that the training data enhancement can be realized, the training data of the conversion model is enriched, and the training effect of the conversion model can be improved.
And S340, converting the first image into a third image of the target type based on the trained conversion model.
And S350, adjusting the corresponding object in the third image according to the object contained in the first image to obtain an adjusted image.
And S360, training the special effect model according to the first image and the adjusting image.
According to the technical scheme of the embodiment of the disclosure, the training steps of the conversion model are described in detail. Firstly, training a generative model based on a first image enables the generative model to generate an image of a source type; secondly, training an encoder based on a first image by taking the generated model as a priori, so that the encoder can extract image features; and thirdly, before the encoder is connected to the conversion model, the initial parameters of the conversion model are configured by using the parameters of the trained generation model, and the conversion model is trained on the basis of the first image and the second image, so that the conversion model can realize the image conversion from the source type to the target type.
The encoder can extract the first image characteristics by training the encoder based on the generated model, thereby being beneficial to training the encoder with different functions including the conversion model and the subsequent model, improving the universality of model training and realizing the conversion of the image from the source type to different target types. In addition, the generated third image effect can be more real and natural by training the generation model and the conversion model based on the generation countermeasure network.
In addition, the model training method provided by the embodiment of the present disclosure and the model training method provided by the above embodiment belong to the same public concept, and the technical details that are not described in detail in the embodiment can be referred to the above embodiment, and the same technical features have the same beneficial effects in the embodiment and the above embodiment.
EXAMPLE III
Fig. 7 is a flowchart illustrating an image processing method according to a third embodiment of the disclosure. The embodiment of the present disclosure is applicable to the case of performing face conversion on a face image, for example, the case of performing age conversion, gender conversion, and the like. The method can be executed by an image processing device, the device can be realized in the form of software and/or hardware, the device can be integrated into application software, and can be installed into electronic equipment along with the application software, such as a server, a mobile phone, a computer and the like.
As shown in fig. 7, the image processing method provided by the present embodiment includes:
and S710, inputting the source type image to be converted into the special effect model.
And S720, outputting a target image of the target type through the special effect model.
The special effect model is obtained by training based on any model training method in the embodiment of the disclosure.
The device for executing the image processing method provided by the embodiment of the disclosure can be integrated into application software supporting the image processing function, and can be installed in electronic equipment such as a server, a mobile phone, a computer and the like along with the application software. The application software may be multimedia application software related to images/videos, such as image/video editing software, shooting software, multimedia sharing software, multimedia communication software, and the like, which is not exhaustive herein.
When the electronic equipment runs the application software, the special effect triggering instruction can be received through a user interface provided by the application software. And the application software can call the image processing device to execute the image processing method after receiving the special effect triggering instruction. The special effect triggering instruction may be regarded as an instruction for triggering execution of a special effect on an image/video. The special effect triggering instruction can carry special effect marks with special effects, and each special effect mark can uniquely represent a corresponding special effect. The special effect may include a face conversion special effect, such as age conversion, gender conversion, and the like.
The image to be converted can be an image acquired through application software or an image in a storage space of the electronic device read by the application software. When the application software acquires the image to be converted and receives the special effect triggering instruction, the image processing device can be called to convert the image to be converted into the target image through the special effect model in the image processing device.
According to the technical scheme of the embodiment of the disclosure, the trained special effect model is used for processing the face image, so that a special effect playing method for face conversion can be realized, and the user experience is improved. The image processing method provided by the embodiment of the present disclosure and the model training method provided by the above embodiment belong to the same disclosure concept, and the technical details that are not described in detail in the embodiment can be referred to the above embodiment, and the same technical features have the same beneficial effects in the embodiment and the above embodiment.
Example four
Fig. 8 is a schematic structural diagram of a model training apparatus according to a fourth embodiment of the present disclosure. The embodiment of the disclosure is suitable for the case of training the model of image conversion, for example, the case of training the model of face image conversion.
As shown in fig. 8, the model training apparatus provided in the embodiment of the present disclosure includes:
a conversion model training module 810, configured to train a conversion model according to the first image of the source type and the second image of the target type, so as to convert the first image into a third image of the target type based on the trained conversion model;
an adjusting module 820, configured to adjust a corresponding object in the third image according to an object included in the first image, to obtain an adjusted image;
the special effect model training module 830 is configured to train the special effect model according to the first image and the adjusted image.
In some optional implementations, the conversion model training module includes:
the generating model training unit is used for training a generating model according to the first image of the source type;
the encoder training unit is used for training an encoder according to the first image and the trained generation model;
the conversion model training unit is used for training a conversion model according to the trained encoder, the first image and a second image of the target type;
and the initial parameters of the conversion model are configured based on the parameters of the trained generation model.
In some optional implementations, the generative model training unit may be specifically configured to:
inputting a white noise image into a generating model, and inputting an output image of the generating model and a first image of a source type into a first discriminator;
and training the generation model according to the judgment result of the first discriminator.
In some alternative implementations, the encoder training unit may be specifically configured to:
processing the first image by an encoder and a trained generated model in sequence to obtain an output image of the generated model;
the encoder is trained based on the output image and the first image of the generative model.
In some optional implementations, the conversion model training unit may be specifically configured to:
processing the first image by the trained encoder and the trained conversion model in sequence to obtain an output image of the conversion model;
inputting an output image of the conversion model and a second image of the target type into a second discriminator;
and training the conversion model according to the judgment result of the second discriminator.
In some optional implementations, the conversion model training unit may be specifically configured to:
expanding the second image of the target type;
and training a conversion model according to the trained encoder, the first image and the expanded second image.
In some optional implementations, the adjustment module may be configured to at least one of:
adjusting corresponding face key points in the third image according to the face key points contained in the first image;
and superposing the image of the hair area contained in the first image to the hair area in the third image.
In some optional implementations, the conversion model training module further includes:
the screening unit is used for screening the second image of the target type;
accordingly, the conversion model training module may be configured to: and training a conversion model according to the first image of the source type and the screened second image.
In some optional implementations, the screening unit may be specifically configured to:
detecting face key points and hair regions in a second image of the target type;
determining a forehead area according to the key points of the face, and determining an overlapping area of the forehead area and a hair area;
and screening the second image according to the proportion of the overlapping area to the forehead area.
The model training device provided by the embodiment of the disclosure can execute the model training method provided by any embodiment of the disclosure, and has corresponding functional modules and beneficial effects of the execution method.
It should be noted that, the units and modules included in the apparatus are merely divided according to functional logic, but are not limited to the above division as long as the corresponding functions can be implemented; in addition, specific names of the functional units are only used for distinguishing one functional unit from another, and are not used for limiting the protection scope of the embodiments of the present disclosure.
EXAMPLE five
Fig. 9 is a schematic structural diagram of an image processing apparatus according to a fifth embodiment of the present disclosure. The embodiment of the present disclosure is applicable to the case of performing face conversion on a face image, for example, the case of performing age conversion, gender conversion, and the like.
As shown in fig. 9, the model training apparatus provided in the embodiment of the present disclosure includes:
an input module 910, configured to input the source type image to be converted into the special effect model;
an output module 920, configured to output a target image of a target type through the special effect model;
the special effect model is obtained by training based on any model training method of the embodiment of the disclosure.
The model training device provided by the embodiment of the disclosure can execute the image processing method provided by any embodiment of the disclosure, and has corresponding functional modules and beneficial effects of the execution method.
It should be noted that, the units and modules included in the apparatus are merely divided according to functional logic, but are not limited to the above division as long as the corresponding functions can be implemented; in addition, specific names of the functional units are only used for distinguishing one functional unit from another, and are not used for limiting the protection scope of the embodiments of the present disclosure.
EXAMPLE six
Referring now to fig. 10, a schematic diagram of an electronic device (e.g., the terminal device or the server in fig. 10) 1000 suitable for implementing embodiments of the present disclosure is shown. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 10 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 10, the electronic device 1000 may include a processing means (e.g., central processing unit, graphics processor, etc.) 1001 that may perform various appropriate actions and processes according to a program stored in a Read-Only Memory (ROM) 1002 or a program loaded from a storage means 1006 into a Random Access Memory (RAM) 1003. In the RAM 1003, various programs and data necessary for the operation of the electronic apparatus 1000 are also stored. The processing device 1001, the ROM1002, and the RAM 1003 are connected to each other by a bus 1004. An input/output (I/O) interface 1005 is also connected to bus 1004.
Generally, the following devices may be connected to the I/O interface 1005: input devices 1006 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 1007 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage devices 1008 including, for example, magnetic tape, hard disk, and the like; and a communication device 1009. The communication device 1009 may allow the electronic device 1000 to communicate with other devices wirelessly or by wire to exchange data. While fig. 10 illustrates an electronic device 1000 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication device 1009, or installed from the storage device 1006, or installed from the ROM 1002. When executed by the processing apparatus 1001, the computer program performs the above-described functions defined in the model training method or the image processing method of the embodiment of the present disclosure.
The electronic device provided by the embodiment of the disclosure and the model training method or the image processing method provided by the embodiment belong to the same disclosure concept, and technical details which are not described in detail in the embodiment can be referred to the embodiment, and the embodiment has the same beneficial effects as the embodiment.
EXAMPLE seven
The embodiments of the present disclosure provide a computer storage medium on which a computer program is stored, which when executed by a processor implements the model training method or the image processing method provided by the above-described embodiments.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a Read-Only Memory (ROM), an Erasable Programmable Read-Only Memory (EPROM) or FLASH Memory (FLASH), an optical fiber, a portable compact disc Read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network Protocol, such as HTTP (Hyper Text Transfer Protocol), and may interconnect with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to:
training a conversion model according to the first image of the source type and the second image of the target type, and converting the first image into a third image of the target type based on the trained conversion model; according to the object contained in the first image, adjusting a corresponding object in the third image to obtain an adjusted image; and training the special effect model according to the first image and the adjusting image.
Alternatively, the one or more programs, when executed by the electronic device, cause the electronic device to:
inputting the source type image to be converted into a special effect model; outputting a target image of a target type through the special effect model; the special effect model is obtained by training based on any model training method of the embodiment of the disclosure.
Computer program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including but not limited to an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. The names of the units and the modules do not limit the units and the modules in some cases.
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Part (ASSP), a System On Chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
According to one or more embodiments of the present disclosure, [ example one ] there is provided a model training method, the method comprising:
training a conversion model according to a first image of a source type and a second image of a target type, and converting the first image into a third image of the target type based on the trained conversion model;
according to the object contained in the first image, adjusting a corresponding object in the third image to obtain an adjusted image;
and training a special effect model according to the first image and the adjusting image.
According to one or more embodiments of the present disclosure, [ example two ] there is provided a model training method, further comprising:
in some alternative implementations, training a transformation model from a first image of a source type and a second image of a target type includes:
training and generating a model according to a first image of the source type;
training an encoder according to the first image and the trained generation model;
training a conversion model according to the trained encoder, the first image and a second image of the target type;
and the initial parameters of the conversion model are configured based on the parameters of the trained generation model.
According to one or more embodiments of the present disclosure, [ example three ] there is provided a model training method, further comprising:
in some alternative implementations, training the generative model from the first image of the source type includes:
inputting a white noise image into a generation model, and inputting an output image of the generation model and a first image of a source type into a first discriminator;
and training the generated model according to the discrimination result of the first discriminator.
According to one or more embodiments of the present disclosure, [ example four ] there is provided a model training method, further comprising:
in some optional implementations, training an encoder according to the first image and the trained generative model includes:
processing the first image by an encoder and a trained generation model in sequence to obtain an output image of the generation model;
and training the encoder according to the output image of the generated model and the first image.
According to one or more embodiments of the present disclosure, [ example five ] there is provided a model training method, further comprising:
in some optional implementations, training a transformation model based on the trained encoder, the first image, and a second image of the target type includes:
processing the first image by a trained encoder and a conversion model in sequence to obtain an output image of the conversion model;
inputting an output image of the conversion model and a second image of the target type into a second discriminator;
and training the conversion model according to the judgment result of the second discriminator.
According to one or more embodiments of the present disclosure, [ example six ] there is provided a model training method, further comprising:
in some optional implementations, training a transformation model based on the trained encoder, the first image, and a second image of the target type, further includes:
expanding the second image of the target type;
and training a conversion model according to the trained encoder, the first image and the expanded second image.
According to one or more embodiments of the present disclosure, [ example seven ] there is provided a model training method, further comprising:
in some optional implementations, adjusting the corresponding object in the third image according to the object included in the first image includes at least one of:
adjusting corresponding face key points in the third image according to the face key points contained in the first image;
and superposing the image of the hair area contained in the first image to the hair area in the third image.
According to one or more embodiments of the present disclosure, [ example eight ] there is provided a model training method, further comprising:
in some alternative implementations, the second image of the target type is filtered;
correspondingly, training the conversion model according to the first image of the source type and the second image of the target type comprises the following steps: and training a conversion model according to the first image of the source type and the screened second image.
According to one or more embodiments of the present disclosure, [ example nine ] there is provided a model training method, further comprising:
in some optional implementations, the filtering the second image of the target type includes:
detecting face key points and hair regions in a second image of the target type;
determining a forehead area according to the face key points, and determining an overlapping area of the forehead area and a hair area;
and screening the second image according to the occupation ratio of the overlapping area to the forehead area.
According to one or more embodiments of the present disclosure, [ example ten ] there is provided an image processing method comprising:
in some optional implementations, the source type of image to be transformed is input into the special effect model;
outputting a target image of a target type through the special effect model;
the special effect model is obtained by training based on any one of the model training methods in the embodiments of the disclosure.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims (14)

1. A method of model training, comprising:
training a conversion model according to a first image of a source type and a second image of a target type, and converting the first image into a third image of the target type based on the trained conversion model;
according to the object contained in the first image, adjusting a corresponding object in the third image to obtain an adjusted image;
and training a special effect model according to the first image and the adjusting image.
2. The method of claim 1, wherein training a transformation model from a first image of a source type and a second image of a target type comprises:
training and generating a model according to a first image of the source type;
training an encoder according to the first image and the trained generation model;
training a conversion model according to the trained encoder, the first image and a second image of the target type;
and the initial parameters of the conversion model are configured based on the parameters of the trained generation model.
3. The method of claim 2, wherein training a generative model from the first image of the source type comprises:
inputting a white noise image into a generation model, and inputting an output image of the generation model and a first image of a source type into a first discriminator;
and training the generated model according to the discrimination result of the first discriminator.
4. The method of claim 2, wherein training an encoder based on the first image and the trained generative model comprises:
processing the first image by an encoder and a trained generation model in sequence to obtain an output image of the generation model;
and training the encoder according to the output image of the generated model and the first image.
5. The method of claim 2, wherein training a transformation model based on the trained encoder, the first image, and a second image of the target type comprises:
processing the first image by a trained encoder and a conversion model in sequence to obtain an output image of the conversion model;
inputting an output image of the conversion model and a second image of the target type into a second discriminator;
and training the conversion model according to the judgment result of the second discriminator.
6. The method of claim 2, wherein training a transformation model based on the trained encoder, the first image, and a second image of the target type, further comprises:
expanding the second image of the target type;
and training a conversion model according to the trained encoder, the first image and the expanded second image.
7. The method according to claim 1, wherein the adjusting the corresponding object in the third image according to the object included in the first image comprises at least one of:
adjusting corresponding face key points in the third image according to the face key points contained in the first image;
and superposing the image of the hair area contained in the first image to the hair area in the third image.
8. The method of claim 1, further comprising:
screening a second image of the target type;
correspondingly, training the conversion model according to the first image of the source type and the second image of the target type comprises the following steps: and training a conversion model according to the first image of the source type and the screened second image.
9. The method of claim 8, wherein the filtering the second image of the target type comprises:
detecting face key points and hair regions in a second image of the target type;
determining a forehead area according to the face key points, and determining an overlapping area of the forehead area and a hair area;
and screening the second image according to the occupation ratio of the overlapping area to the forehead area.
10. An image processing method, comprising:
inputting the source type image to be converted into a special effect model;
outputting a target image of a target type through the special effect model;
wherein the special effect model is obtained by training based on the model training method of any one of claims 1 to 9.
11. A model training apparatus, comprising:
the conversion model training module is used for training a conversion model according to a first image of a source type and a second image of a target type so as to convert the first image into a third image of the target type based on the trained conversion model;
the adjusting module is used for adjusting a corresponding object in the third image according to the object contained in the first image to obtain an adjusted image;
and the special effect model training module is used for training the special effect model according to the first image and the adjusting image.
12. An image processing apparatus characterized by comprising:
the input module is used for inputting the source type image to be converted into the special effect model;
the output module is used for outputting a target image of a target type through the special effect model;
wherein the special effect model is obtained by training based on the model training method of any one of claims 1 to 9.
13. An electronic device, characterized in that the electronic device comprises:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the model training method of any one of claims 1-9, or the image processing method of claim 10.
14. A storage medium containing computer executable instructions for performing the model training method of any one of claims 1-9, or implementing the image processing method of claim 10, when executed by a computer processor.
CN202111175983.9A 2021-10-09 2021-10-09 Model training method, image processing method, device, electronic device and medium Pending CN113850716A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111175983.9A CN113850716A (en) 2021-10-09 2021-10-09 Model training method, image processing method, device, electronic device and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111175983.9A CN113850716A (en) 2021-10-09 2021-10-09 Model training method, image processing method, device, electronic device and medium

Publications (1)

Publication Number Publication Date
CN113850716A true CN113850716A (en) 2021-12-28

Family

ID=78977740

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111175983.9A Pending CN113850716A (en) 2021-10-09 2021-10-09 Model training method, image processing method, device, electronic device and medium

Country Status (1)

Country Link
CN (1) CN113850716A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114445301A (en) * 2022-01-30 2022-05-06 北京字跳网络技术有限公司 Image processing method, image processing device, electronic equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114445301A (en) * 2022-01-30 2022-05-06 北京字跳网络技术有限公司 Image processing method, image processing device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN109816589B (en) Method and apparatus for generating cartoon style conversion model
CN112989904B (en) Method for generating style image, method, device, equipment and medium for training model
CN111368685A (en) Key point identification method and device, readable medium and electronic equipment
CN114331820A (en) Image processing method, image processing device, electronic equipment and storage medium
WO2022037602A1 (en) Expression transformation method and apparatus, electronic device, and computer readable medium
CN109754464B (en) Method and apparatus for generating information
CN114419300A (en) Stylized image generation method and device, electronic equipment and storage medium
CN111833242A (en) Face transformation method and device, electronic equipment and computer readable medium
WO2023232056A1 (en) Image processing method and apparatus, and storage medium and electronic device
CN115965840A (en) Image style migration and model training method, device, equipment and medium
WO2023273697A1 (en) Image processing method and apparatus, model training method and apparatus, electronic device, and medium
CN112581635A (en) Universal quick face changing method and device, electronic equipment and storage medium
CN111967397A (en) Face image processing method and device, storage medium and electronic equipment
CN112785669B (en) Virtual image synthesis method, device, equipment and storage medium
CN114937192A (en) Image processing method, image processing device, electronic equipment and storage medium
CN114004905A (en) Method, device and equipment for generating character style image and storage medium
CN113850716A (en) Model training method, image processing method, device, electronic device and medium
CN113902838A (en) Animation generation method, animation generation device, storage medium and electronic equipment
CN110619602B (en) Image generation method and device, electronic equipment and storage medium
CN110059739B (en) Image synthesis method, image synthesis device, electronic equipment and computer-readable storage medium
WO2023143118A1 (en) Image processing method and apparatus, device, and medium
WO2023071694A1 (en) Image processing method and apparatus, and electronic device and storage medium
CN115880526A (en) Image processing method, image processing device, electronic equipment and storage medium
CN114187173A (en) Model training method, image processing method and device, electronic device and medium
CN114422698A (en) Video generation method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination