Generation countermeasure network subspace decoupling and generation editing method, system and computer
1. A method for generating countermeasure network subspace decoupling and generating editing is characterized by comprising the following steps:
selecting a network and generating a picture;
obtaining an image label through a pre-trained classifier, and inputting the generated picture into a preset attribute classification network to obtain attribute label data of the picture;
performing rough fitting on the individual attribute subspaces, and fitting hidden space vectors with the same attribute by using a Gaussian distribution;
decoupling clustering is carried out on multiple attributes of the whole hidden space, and fitting is carried out on the whole hidden space by using Gaussian mixed distribution, so that each Gaussian component can decouple the semantic space;
and editing the generated semantics through the decoupling space.
2. The generative countermeasure network subspace decoupling and generative editing method of claim 1, wherein: the step of selecting a network and generating a picture comprises:
selecting a pre-trained generation countermeasure network, and obtaining a variable sample first code of a hidden space through sampling in a mode that the generation countermeasure network specifies the hidden space;
and sequentially inputting the first codes into a preset generation network to obtain generated images corresponding to the first codes one by one.
3. The generative countermeasure network subspace decoupling and generative editing method of claim 2, wherein: the step of obtaining image labels through the pre-trained classifier comprises:
selecting a corresponding image semantic classifier according to the image space of the training data of the classifier and the semantic space to be decoupled;
and inputting the picture into the semantic classifier to obtain a label data vector corresponding to the picture, wherein the dimension number of the label data vector is the category number of the semantic, and the value range is [0, 1 ].
4. The generative countermeasure network subspace decoupling and generative edition method of claim 3, wherein: the step of coarsely fitting the individual attribute subspaces comprises:
constructing a single Gaussian model and respectively using a Gaussian distribution model for each type of semantics to construct a normalized likelihood function;
preliminarily fitting a latent variable semantic subspace through the Gaussian model, and making a mean square error of the likelihood function value of the first code and the label data to construct a loss function;
and performing Adam algorithm optimization on the Gaussian model and the likelihood function through the loss function to obtain a group of Gaussian model groups with certain semantic information in a hidden space.
5. The generative countermeasure network subspace decoupling and generative editing method of claim 4, wherein: the step of performing decoupling clustering on the multi-attribute of the whole hidden space comprises the following steps:
taking the obtained Gaussian model group as an initial component to construct a first Gaussian mixture model;
constructing an L1 loss function by normalizing a likelihood function and a mean square error loss function of the label data and by sampling the label data and a sampling coefficient of a picture sampled and reconstructed from the first Gaussian mixture model;
performing Adam algorithm optimization on the first Gaussian mixture model through the L1 loss function to obtain a second Gaussian mixture model;
and each semantic subspace in the hidden space is in one-to-one correspondence through each Gaussian component in the second Gaussian mixture model.
6. The generative countermeasure network subspace decoupling and generative editing method of claim 5, wherein: the step of editing the generated semantics through the decoupling space comprises:
collecting attribute control vectors zs in each obtained Gaussian component of the second Gaussian mixture model;
interpolating the first code of the picture generated by any generator and the zs to obtain a second code;
and inputting the second code into the generator to obtain a picture edited by continuous attributes according to the interpolation proportion of the zs.
7. A system for generating confrontation network subspace decoupling and generating compilation, the system comprising:
the selection module is used for selecting a network and generating a picture;
the transmission module is used for obtaining image labels through a pre-trained classifier and inputting the generated pictures into a preset attribute classification network so as to obtain attribute label data of the pictures;
the first fitting module is used for carrying out rough fitting on the individual attribute subspaces and respectively fitting the hidden space vectors with the same attribute by using Gaussian distribution;
the second fitting module is used for performing decoupling clustering on multiple attributes of the whole hidden space and fitting the whole hidden space by using Gaussian mixed distribution so as to decouple each Gaussian component from the semantic space;
and the editing module is used for editing the generated semantics through the decoupling space.
8. The generative countermeasure network subspace decoupling and generative authoring system of claim 7, wherein: the selection module is specifically configured to:
selecting a pre-trained generation countermeasure network, and obtaining a variable sample first code of a hidden space through sampling in a mode that the generation countermeasure network specifies the hidden space;
and sequentially inputting the first codes into a preset generation network to obtain generated images corresponding to the first codes one by one.
9. The generative countermeasure network subspace decoupling and generative authoring system of claim 7, wherein: the transmission module is specifically configured to:
selecting a corresponding image semantic classifier according to the image space of the training data of the classifier and the semantic space to be decoupled;
and inputting the picture into the semantic classifier to obtain a label data vector corresponding to the picture, wherein the dimension number of the label data vector is the category number of the semantic, and the value range is [0, 1 ].
10. A computer comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of generating countermeasure network subspace decoupling and generation editing of any of claims 1 through 6 when executing the computer program.
Background
In recent years, generation of countermeasure networks (GANs) has enjoyed tremendous success in generating high fidelity pictures, where GANs learning can be randomly distributed and mapped into real data observations, and then generate realistic images from randomly sampled latent codes, thus having great significance in face recognition, detection, and image editing.
The existing methods for generating countermeasure network subspace decoupling and generating editing mainly comprise three types: (1) based on an unsupervised hidden space principal component analysis method, a hidden space sample is subjected to principal component analysis, and then semantic attributes corresponding to each principal component are searched through manual operation; (2) the rewriting method of the weak supervision fine tuning network finds out network parameters for controlling the attribute of the mark position through projection positioning by a small amount of sample data of the mark position, and then fits and generates a target picture by optimizing the partial parameters; (3) the method only can find linear binary attributes, and cannot control if the color attributes exceed 2 results.
However, the method can only process a single attribute in the synthesized image, and has a large use limitation, which is not suitable for large-scale popularization and use.
Disclosure of Invention
Based on this, the invention aims to provide a method, a system and a computer for generating and resisting network subspace decoupling and generating and editing, so as to solve the problem that the prior art can only process a single attribute in a composite image, which causes great use limitation.
In a first aspect, an embodiment of the present invention provides a method for generating a countermeasure network subspace decoupling and generating an edit, where the method specifically includes the following steps:
selecting a network and generating a picture;
obtaining an image label through a pre-trained classifier, and inputting the generated picture into a preset attribute classification network to obtain attribute label data of the picture;
performing rough fitting on the individual attribute subspaces, and fitting hidden space vectors with the same attribute by using a Gaussian distribution;
decoupling clustering is carried out on multiple attributes of the whole hidden space, and fitting is carried out on the whole hidden space by using Gaussian mixed distribution, so that each Gaussian component can decouple the semantic space;
and editing the generated semantics through the decoupling space.
The invention has the beneficial effects that: semantic labels with supervision information are obtained by using a pre-trained classifier, a Gaussian mixture model is used for carrying out detailed semantic decoupling on a hidden space for generating an antagonistic network, and the generated images with semantic generation are controllably edited by utilizing the strong generation capability of the antagonistic network. By the method, the image semantic characteristics can be thoroughly analyzed in the potential space, various attributes appearing in the synthesized image can be processed really without retraining the model after identifying the corresponding potential semantic subspace, and the method has the advantages of being high in speed and continuous and accurate in control, suitable for subspace decoupling, generation and editing of the confrontation generation network of various structures under the training of various data sets, eliminating use limitation and beneficial to large-scale popularization and use.
Preferably, the step of selecting a network and generating a picture includes:
selecting a pre-trained generation countermeasure network, and obtaining a variable sample first code of a hidden space through sampling in a mode that the generation countermeasure network specifies the hidden space;
and sequentially inputting the first codes into a preset generation network to obtain generated images corresponding to the first codes one by one.
Preferably, the step of obtaining the image label by the pre-trained classifier includes:
selecting a corresponding image semantic classifier according to the image space of the training data of the classifier and the semantic space to be decoupled;
and inputting the picture into the semantic classifier to obtain a label data vector corresponding to the picture, wherein the dimension number of the label data vector is the category number of the semantic, and the value range is [0, 1 ].
Preferably, the step of coarsely fitting the individual attribute subspaces comprises:
constructing a single Gaussian model and respectively using a Gaussian distribution model for each type of semantics to construct a normalized likelihood function;
preliminarily fitting a latent variable semantic subspace through the Gaussian model, and making a mean square error of the likelihood function value of the first code and the label data to construct a loss function;
and performing Adam algorithm optimization on the Gaussian model and the likelihood function through the loss function to obtain a group of Gaussian model groups with certain semantic information in a hidden space.
Preferably, the step of performing decoupled clustering on the multiple attributes of the whole hidden space includes:
taking the obtained Gaussian model group as an initial component to construct a first Gaussian mixture model;
constructing an L1 loss function by normalizing a likelihood function and a mean square error loss function of the label data and by sampling the label data and a sampling coefficient of a picture sampled and reconstructed from the first Gaussian mixture model;
performing Adam algorithm optimization on the first Gaussian mixture model through the L1 loss function to obtain a second Gaussian mixture model;
and each semantic subspace in the hidden space is in one-to-one correspondence through each Gaussian component in the second Gaussian mixture model.
Preferably, the step of editing the generated semantics through the decoupling space includes:
collecting attribute control vectors zs in each obtained Gaussian component of the second Gaussian mixture model;
interpolating the first code of the picture generated by any generator and the zs to obtain a second code;
and inputting the second code into the generator to obtain a picture edited by continuous attributes according to the interpolation proportion of the zs.
In a second aspect, an embodiment of the present invention provides a system for generating a countermeasure network subspace decoupling and generating an edit, where the system specifically includes:
the selection module is used for selecting a network and generating a picture;
the transmission module is used for obtaining image labels through a pre-trained classifier and inputting the generated pictures into a preset attribute classification network so as to obtain attribute label data of the pictures;
the first fitting module is used for carrying out rough fitting on the individual attribute subspaces and respectively fitting the hidden space vectors with the same attribute by using Gaussian distribution;
the second fitting module is used for performing decoupling clustering on multiple attributes of the whole hidden space and fitting the whole hidden space by using Gaussian mixed distribution so as to decouple each Gaussian component from the semantic space;
and the editing module is used for editing the generated semantics through the decoupling space.
In the system for generating a subspace decoupling and generating an edit of the countermeasure network, the selection module is specifically configured to:
selecting a pre-trained generation countermeasure network, and obtaining a variable sample first code of a hidden space through sampling in a mode that the generation countermeasure network specifies the hidden space;
and sequentially inputting the first codes into a preset generation network to obtain generated images corresponding to the first codes one by one.
In the above system for generating a subspace decoupling and generating an edit of an antagonistic network, the transmission module is specifically configured to:
selecting a corresponding image semantic classifier according to the image space of the training data of the classifier and the semantic space to be decoupled;
and inputting the picture into the semantic classifier to obtain a label data vector corresponding to the picture, wherein the dimension number of the label data vector is the category number of the semantic, and the value range is [0, 1 ].
In the system for generating the countermeasure network subspace decoupling and generating the edit, the first fitting module is specifically configured to:
constructing a single Gaussian model and respectively using a Gaussian distribution model for each type of semantics to construct a normalized likelihood function;
preliminarily fitting a latent variable semantic subspace through the Gaussian model, and making a mean square error of the likelihood function value of the first code and the label data to construct a loss function;
and performing Adam algorithm optimization on the Gaussian model and the likelihood function through the loss function to obtain a group of Gaussian model groups with certain semantic information in a hidden space.
In the above system for generating a subspace decoupling and generating an edit of an antagonistic network, the second fitting module is specifically configured to:
taking the obtained Gaussian model group as an initial component to construct a first Gaussian mixture model;
constructing an L1 loss function by normalizing a likelihood function and a mean square error loss function of the label data and by sampling the label data and a sampling coefficient of a picture sampled and reconstructed from the first Gaussian mixture model;
performing Adam algorithm optimization on the first Gaussian mixture model through the L1 loss function to obtain a second Gaussian mixture model;
and each semantic subspace in the hidden space is in one-to-one correspondence through each Gaussian component in the second Gaussian mixture model.
In the above system for generating a subspace decoupling and generating an edit of the countermeasure network, the edit module is specifically configured to:
collecting attribute control vectors zs in each obtained Gaussian component of the second Gaussian mixture model;
interpolating the first code of the picture generated by any generator and the zs to obtain a second code;
and inputting the second code into the generator to obtain a picture edited by continuous attributes according to the interpolation proportion of the zs.
In a third aspect, an embodiment of the present invention provides a computer, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor implements the method for generating countermeasure network subspace decoupling and generating edit described above when executing the computer program.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Drawings
Fig. 1 is a flowchart of a subspace decoupling and edit generating method for a confrontation network according to a first embodiment of the present invention;
FIG. 2 is a flowchart of a method for generating countermeasure network subspace decoupling and generating edit according to a second embodiment of the present invention;
fig. 3 is a block diagram of a system for generating countermeasure network subspace decoupling and generating edit according to a third embodiment of the present invention.
The following detailed description will further illustrate the invention in conjunction with the above-described figures.
Detailed Description
To facilitate an understanding of the invention, the invention will now be described more fully with reference to the accompanying drawings. Several embodiments of the invention are presented in the drawings. This invention may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete.
It will be understood that when an element is referred to as being "secured to" another element, it can be directly on the other element or intervening elements may also be present. When an element is referred to as being "connected" to another element, it can be directly connected to the other element or intervening elements may also be present. The terms "vertical," "horizontal," "left," "right," and the like as used herein are for illustrative purposes only.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used herein, the term "and/or" includes any and all combinations of one or more of the associated listed items.
The existing picture processing method can only process single attributes in the synthesized image, has large use limitation and is not beneficial to large-scale popularization and use.
Referring to fig. 1, a method for generating a confrontation network subspace decoupling and editing is shown, where a confrontation network model provided by the present invention is a pre-training model capable of generating a high-quality picture, an image target of the confrontation network model only has a single target object (for example, for a model for generating a face, there is only one face on a picture), a target size exceeds 60% of a pixel of the whole picture, and a background color is as monotonous as possible.
Specifically, the method comprises the following steps: the method for generating the countermeasure network subspace decoupling and generating and editing specifically comprises the following steps:
step S10, selecting a network and generating a picture;
specifically, in this embodiment, a generation countermeasure network (only a generator is needed) that is trained and capable of generating high-quality pictures is first selected.
Further, the picture is correspondingly generated in the generation network inside the generation countermeasure network through the generation countermeasure network.
Step S20, obtaining image labels through a pre-trained classifier, and inputting the generated pictures into a preset attribute classification network to obtain attribute label data of the pictures;
in this embodiment, a semantic classifier corresponding to the image space and the attribute needs to be selected to obtain the semantic label of the picture. Specifically, a trained semantic classifier f is selected according to the image space of the training data of the selected generator and the semantic space required to be decoupled.
And then obtaining an image label through a pre-trained classifier, and inputting the generated picture into a preset attribute classification network to obtain attribute label data of the picture.
Step S30, carrying out rough fitting on the individual attribute subspaces, and respectively fitting hidden space vectors with the same attribute by using Gaussian distribution;
in this embodiment, a gaussian model is used to roughly fit the individual attribute subspaces, and one gaussian distribution is used to fit the hidden space vectors with the same attribute.
Step S40, performing decoupling clustering on multiple attributes of the whole hidden space, and fitting the whole hidden space by using Gaussian mixture distribution to decouple each Gaussian component from the semantic space;
and step S50, editing the generated semantics through the decoupling space.
When the method is used, a pre-trained classifier is used for obtaining a semantic label with supervision information, a Gaussian mixture model is used for carrying out detailed semantic decoupling on a hidden space for generating the countermeasure network, and then the powerful generation capacity of the countermeasure network is utilized for carrying out controllable editing on a semantically generated picture. By the method, the image semantic characteristics can be thoroughly analyzed in the potential space, various attributes appearing in the synthesized image can be processed really without retraining the model after identifying the corresponding potential semantic subspace, and the method has the advantages of being high in speed and continuous and accurate in control, suitable for subspace decoupling, generation and editing of the confrontation generation network of various structures under the training of various data sets, eliminating use limitation and beneficial to large-scale popularization and use.
It should be noted that the implementation procedure described above is only for illustrating the applicability of the present application, but this does not represent that the method for generating the countering network subspace decoupling and generating the edit of the present application has only one implementation procedure described above, and on the contrary, the method for generating the countering network subspace decoupling and generating the edit of the present application can be incorporated into a feasible implementation scheme of the present application as long as the method can be implemented.
In summary, the method for generating the subspace decoupling and generating the edit of the confrontation network in the embodiment of the invention can thoroughly analyze the image semantic characteristics in the potential space, and can truly process various attributes appearing in the synthetic image without retraining the model after identifying the corresponding subspace of the potential semantics, and meanwhile, the method has the characteristics of high speed and continuous and accurate control, is suitable for the subspace decoupling and generating edit of the confrontation generation network of various structures under the training of various data sets, eliminates the use limitation, and is favorable for large-scale popularization and use.
Referring to fig. 2, a subspace decoupling and editing method for generating confrontation network according to a second embodiment of the present invention is shown
Step S11, selecting a pre-trained generation countermeasure network, and obtaining a first code of a variable sample of a hidden space through sampling in a mode that the generation countermeasure network specifies the hidden space; and sequentially inputting the first codes into a preset generation network to obtain generated images corresponding to the first codes one by one.
In this embodiment, it should be noted that, first, a trained generation countermeasure network capable of generating high-quality pictures is selected (only the generator is needed), and further, a variable sample first code in a hidden space is obtained by sampling in a sampling manner of the hidden space specified by the generation countermeasure network, and is represented by z;
further, the z is sequentially input into the selected generation network G to obtain a generation picture I corresponding to the z one to one, wherein I = G (z).
Step S21, selecting a corresponding image semantic classifier according to the image space of the training data of the classifier and the semantic space required to be decoupled; and inputting the picture into the semantic classifier to obtain a label data vector corresponding to the picture, wherein the dimension number of the label data vector is the category number of the semantic, and the value range is [0, 1 ].
In this embodiment, a semantic classifier corresponding to the image space and the attribute needs to be selected to obtain the semantic label of the picture, and the specific implementation process is as follows:
firstly, an already trained image semantic classifier f is selected according to the image space in the training data of the generator selected in the step S11 and the semantic space required to be decoupled.
Further, the pictures I in step S11 are input into the semantic classifier f one by one to obtain a label data vector L corresponding to the pictures, where L = f (I), specifically, the dimension of the vector is the number of semantic categories, and the value range is [0, 1 ].
Step S31, constructing a single Gaussian model and respectively using a Gaussian distribution model for each semantic to construct a normalized likelihood function; preliminarily fitting a latent variable semantic subspace through the Gaussian model, and making a mean square error of the likelihood function value of the first code and the label data to construct a loss function; and performing Adam algorithm optimization on the Gaussian model and the likelihood function through the loss function to obtain a group of Gaussian model groups with certain semantic information in a hidden space.
Specifically, in this embodiment, the tag data L of the picture in step S21 is obtained, and a gaussian model fitting is then used to fit the semantic subspace of the hidden space, where the specific implementation process is as follows:
firstly, a single Gaussian model is constructed, specifically, a Gaussian distribution model P (z) is respectively used for each type of semantics, and a normalized likelihood function | is constructed.
Further, a loss function is constructed, specifically, a hidden variable semantic subspace is preliminarily fitted by using the gaussian model, and the normalized likelihood function value | | | p (z) | | | and the label data L obtained in the step S21 are used as a mean square error to obtain the loss function.
Further, the gaussian model is optimized, specifically, the gaussian model is optimized through the loss function and by using an Adam algorithm, so that a set of gaussian model groups with certain semantic information in a hidden space can be obtained.
Step S41, the obtained Gaussian model group is used as an initial component to construct a first Gaussian mixture model; constructing an L1 loss function by normalizing a likelihood function and a mean square error loss function of the label data and by sampling the label data and a sampling coefficient of a picture sampled and reconstructed from the first Gaussian mixture model; performing Adam algorithm optimization on the first Gaussian mixture model through the L1 loss function to obtain a second Gaussian mixture model; and each semantic subspace in the hidden space is in one-to-one correspondence through each Gaussian component in the second Gaussian mixture model.
In this embodiment, it should be noted that, first, a gaussian mixture model needs to be constructed, and specifically, the gaussian model group obtained in step S31 is used as an initial component of the gaussian mixture model, and a first gaussian mixture model is constructed, where a weight parameter of the initial component is 1/n, where n is the number of components.
Further, a loss function is constructed, specifically, an L1 loss function is constructed by using the loss function of the mean square error of the normalized likelihood function and the label data L acquired in step S31, and by using the label data and the sampled coefficients of the picture sampled and reconstructed from the above-mentioned first gaussian mixture model.
Further, a gaussian mixture model is optimized, specifically, the L1 loss function is used for the first gaussian mixture model, and the first gaussian mixture model is optimized by the Adam algorithm to obtain a second gaussian mixture model.
And finally, performing semantic decoupling, specifically, respectively corresponding each Gaussian component in the acquired second Gaussian mixture model to each semantic subspace in the hidden space.
Step S51, collecting attribute control vectors zs in each obtained Gaussian component of the second Gaussian mixture model; interpolating the first code of the picture generated by any generator and the zs to obtain a second code; and inputting the second code into the generator to obtain a picture edited by continuous attributes according to the interpolation proportion of the zs.
Specifically, first, sampling of the attribute variable is performed, and the vector zs is controlled by using the sampling attribute in each gaussian component in the second gaussian mixture model obtained in step S41.
Further, performing controllable editing, specifically, for any one of the pictures generated by the generator, interpolating the first code corresponding to the picture and the zs to obtain a second code, and inputting the second code into the generator, then obtaining the picture with the edited attribute according to the interpolation ratio of the zs.
The semantic attributes of smiling, gender, Liuhai and age of the face picture can be edited by the method, and the decoupling degree between the semantic attributes is large when the method is used for semantic editing, namely when some attribute is edited, only the target attribute of the picture is changed, and other attributes are not changed.
It should be noted that, the method provided by the second embodiment of the present invention, which implements the same principle and produces some technical effects as the first embodiment, can refer to the corresponding contents in the first embodiment for the sake of brief description, where this embodiment is not mentioned.
In summary, the method for generating the subspace decoupling and generating the edit of the confrontation network in the embodiment of the invention can thoroughly analyze the image semantic characteristics in the potential space, and can truly process various attributes appearing in the synthetic image without retraining the model after identifying the corresponding subspace of the potential semantics, and meanwhile, the method has the characteristics of high speed and continuous and accurate control, is suitable for the subspace decoupling and generating edit of the confrontation generation network of various structures under the training of various data sets, eliminates the use limitation, and is favorable for large-scale popularization and use.
Referring to fig. 3, a system for generating countermeasure network subspace decoupling and generating edit according to a third embodiment of the present invention is shown, the system specifically includes:
a selection module 12 for selecting a network and generating a picture;
the transmission module 22 is configured to obtain an image tag through a pre-trained classifier, and input the generated picture to a preset attribute classification network to obtain attribute tag data of the picture;
a first fitting module 32, configured to perform rough fitting on the individual attribute subspaces, and fit hidden space vectors having the same attribute using a gaussian distribution, respectively;
the second fitting module 42 is configured to perform decoupling clustering on multiple attributes of the entire hidden space and fit the entire hidden space by using a gaussian mixture distribution, so that each gaussian component decouples the semantic space;
and the editing module 52 is used for editing the generated semantics through the decoupling space.
In the system for generating a subspace decoupling and generating an edit of the countermeasure network, the selection module 12 is specifically configured to:
selecting a pre-trained generation countermeasure network, and obtaining a variable sample first code of a hidden space through sampling in a mode that the generation countermeasure network specifies the hidden space;
and sequentially inputting the first codes into a preset generation network to obtain generated images corresponding to the first codes one by one.
In the above system for generating a subspace decoupling and generating an edit of a countermeasure network, the transmission module 22 is specifically configured to:
selecting a corresponding image semantic classifier according to the image space of the training data of the classifier and the semantic space to be decoupled;
and inputting the picture into the semantic classifier to obtain a label data vector corresponding to the picture, wherein the dimension number of the label data vector is the category number of the semantic, and the value range is [0, 1 ].
In the above system for generating a subspace decoupling and generating an edit of an antagonistic network, the first fitting module 32 is specifically configured to:
constructing a single Gaussian model and respectively using a Gaussian distribution model for each type of semantics to construct a normalized likelihood function;
preliminarily fitting a latent variable semantic subspace through the Gaussian model, and making a mean square error of the likelihood function value of the first code and the label data to construct a loss function;
and performing Adam algorithm optimization on the Gaussian model and the likelihood function through the loss function to obtain a group of Gaussian model groups with certain semantic information in a hidden space.
In the above system for generating a subspace decoupling and generating an edit of an antagonistic network, the second fitting module 42 is specifically configured to:
taking the obtained Gaussian model group as an initial component to construct a first Gaussian mixture model;
constructing an L1 loss function by normalizing a likelihood function and a mean square error loss function of the label data and by sampling the label data and a sampling coefficient of a picture sampled and reconstructed from the first Gaussian mixture model;
performing Adam algorithm optimization on the first Gaussian mixture model through the L1 loss function to obtain a second Gaussian mixture model;
and each semantic subspace in the hidden space is in one-to-one correspondence through each Gaussian component in the second Gaussian mixture model.
In the system for generating a subspace decoupling and generating an edit of the countermeasure network, the edit module 52 is specifically configured to:
collecting attribute control vectors zs in each obtained Gaussian component of the second Gaussian mixture model;
interpolating the first code of the picture generated by any generator and the zs to obtain a second code;
and inputting the second code into the generator to obtain a picture edited by continuous attributes according to the interpolation proportion of the zs.
A fourth embodiment of the present invention provides a computer, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor executes the computer program to implement the method for decoupling and editing generation countermeasure network subspace provided in the first embodiment or the second embodiment.
In summary, the method, system and computer for generating and editing the subspace of the countermeasure network according to the embodiments of the present invention can thoroughly analyze the semantic characteristics of the image in the latent space, and after identifying the corresponding subspace of the latent semantic, can truly process various attributes appearing in the synthesized image without retraining the model, and at the same time, the method, system and computer have the characteristics of high speed and continuous and accurate control, are suitable for the subspace decoupling and generation editing of the countermeasure generation network of various structures under the training of various data sets, eliminate the limitation of use, and are beneficial to large-scale popularization and use.
The logic and/or steps represented in the flowcharts or otherwise described herein, e.g., an ordered listing of executable instructions that can be considered to implement logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device.
More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
The above-mentioned embodiments only express several embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.
- 上一篇:石墨接头机器人自动装卡簧、装栓机
- 下一篇:模型训练方法及装置、图像识别方法及装置