The method, apparatus and electronic equipment of target object are removed in a kind of image
Technical field
The present invention relates to the method, apparatus that target object is removed in technical field of image processing more particularly to a kind of image
And electronic equipment.
Background technique
With the raising of image acquisition technology, people require the display effect of image higher and higher.For example, when in scape
When area shoots an image, since the people being located in scenic spot is more, and people during being shot in scenic spot can come
In the image for returning and walking about, therefore shoot may comprising other people for interfering, need at this time by other people image from this
It is removed away in image, obtains the image that user wants.
It is in the prior art to remove some specified object from image, it is to remove object in each channel of image
Body, and synthesize after each channel removes as a result, finally being removed the image of object.But the method for this removing objects
It has some limitations, the image effect after removing object is poor.
Summary of the invention
The embodiment of the invention provides method, apparatus and electronic equipment that target object is removed in a kind of image, to solve
The poor problem of image effect after certainly removing object in the prior art.
The embodiment of the invention provides a kind of methods that target object is removed in image, which comprises
By the first image of the first subgraph comprising target object to be removed, and first subgraph obtained in advance exists
Target position information in the first image is input in the network model that training is completed in advance, and it is defeated to obtain the network model
The second image of first subgraph is removed at the target position information in the first image out.
Further, the training process of the network model includes:
Each third image that training sample is concentrated is obtained, wherein the second son in each third image comprising object to be removed
Image;
For each third image, by the third image, and object to be removed in the third image that obtains in advance second
First location information of the subgraph in the third image is input in the network model, obtains the network model output
The 4th image of second subgraph is removed at the first location information in the third image;By the described 4th
Image is input in the discriminator network model that training is completed in advance, obtains the discrimination results of the discriminator network model output
Information, wherein the discrimination results information is true picture or Vitua limage;
According to each discrimination results information, the network model is trained.
Further, the training process of the network model includes:
The 5th image of each of training sample concentration is obtained, wherein third in each 5th image comprising object to be removed
Image;
For each 5th image, third of object to be removed in the 5th image that obtains by the 5th image and in advance
Second location information of the image in the 5th image is input in the network model, obtain network model output
The 6th image of the third subgraph is removed at the second location information in 5th image, and includes the object
7th image of body;By the 6th image, the 7th image and the second location information are input to the network model
Reversed network model in, obtain the reversed network model output at the second location information of the 6th image
It is added to the 8th image of the object in the 7th image;
According to the similarity of each 5th image and the 8th image, the network model is trained.
Further, the training process of the network model includes:
Each of training sample concentration the 9th image and each tenth image are obtained, wherein comprising to be added in each tenth image
Object the 4th subgraph;
For each 9th image, any tenth image is chosen, the 9th image and obtains described the tenth image in advance
The third place information input in 9th image obtains the reversed network mould into the reversed network model of the network model
The third place information in the 9th image of type output is added to the 11st image of the 4th subgraph;By institute
The 11st image and the third place information input are stated into the network model, obtain network model output in institute
State the tenth of the 4th subgraph in the third place information removing of the 11st image the third place information
Two images;
According to the similarity of each 9th image and the 12nd image, the network model is trained.
Further, the training process of the reversed network model includes:
Each of training sample concentration the 13rd image and each 14th image are obtained, wherein including in each 14th image
5th subgraph of object to be added;
For each 13rd image, any 14th image is chosen, the 13rd image and obtains the 14th image in advance
The 4th location information in the 13rd image taken is input in the reversed network model, obtains the reversed network mould
The 4th location information in the 13rd image of type output is added to the 15th image of the 5th subgraph;It will
15th image is input in the discriminator network model that training is completed in advance, obtains the discriminator network model output
Discrimination results information, wherein the discrimination results information be true picture or Vitua limage;
According to each discrimination results information, the reversed network model is trained.
Further, the training process of the discriminator network model includes:
Sample image is obtained, wherein be labelled with the corresponding discrimination identification information of the sample image in the sample image, wherein institute
It states and distinguishes that identification information includes true picture and Vitua limage;
Each sample image is input in the discriminator network model, each sample graph is directed to according to discriminator network model
As output discrimination results information and the corresponding discrimination identification information of each sample image, to the discriminator network model into
Row training, wherein the image of discrimination results message identification input is true picture or Vitua limage.
The embodiment of the invention provides the device for removing target object in a kind of image, described device includes:
Input module, network model module;
The input module, for will include target object to be removed the first subgraph the first image, and in advance obtain
Target position information of first subgraph in the first image be input to the network mould that training is completed in advance
In type;
The network model module, for removing first subgraph at the target position information in the first image
Picture exports the second image that first subgraph is removed at the target position information in the first image.
Further, described device further include:
First training module, for obtain training sample concentration each third image, wherein in each third image comprising to
Second subgraph of the object of removal;For each third image, by the third image, and in the third image that obtains in advance
First location information of second subgraph of object to be removed in the third image is input in the network model, is obtained
What the network model exported removes second subgraph at the first location information in the third image
4th image;4th image is input in the discriminator network model that training is completed in advance, obtains the discriminator net
The discrimination results information of network model output, wherein the discrimination results information is true picture or Vitua limage;It is distinguished according to each
Other result information, is trained the network model.
Further, described device further include:
Second training module, for obtain training sample concentrate each of the 5th image, wherein in each 5th image comprising to
The third subgraph of the object of removal;For each 5th image, in the 5th image that obtains by the 5th image and in advance
Second location information of the third subgraph of object to be removed in the 5th image is input in the network model, is obtained
The network model output removes the third subgraph at the second location information in the 5th image
6th image, and the 7th image comprising the object;By the 6th image, the 7th image and the second confidence
Breath is input in the reversed network model of the network model, obtain the reversed network model output in the 6th image
The second location information at be added to the 8th image of object in the 7th image;According to each 5th image and
The similarity of eight images is trained the network model.
Further, described device further include:
Third training module each of concentrates the 9th image and each tenth image for obtaining training sample, wherein each the
It include the 4th subgraph of object to be added in ten images;For each 9th image, choose any tenth image, by this
The third place information input in nine images, the tenth image and the 9th image obtained in advance is to the network model
In reversed network model, the third place information in the 9th image for obtaining the reversed network model output is added
11st image of the 4th subgraph;By the 11st image and the third place information input to the network
In model, the third place information removing in the 11st image of the network model output third is obtained
12nd image of the 4th subgraph in location information;According to the similarity of each 9th image and the 12nd image,
The network model is trained.
Further, described device further include:
4th training module, for obtaining each of training sample concentration the 13rd image and each 14th image, wherein often
It include the 5th subgraph of object to be added in a 14th image;For each 13rd image, any 14th is chosen
Image, by the 13rd image, the 4th location information in the 14th image and the 13rd image obtained in advance is defeated
Enter into the reversed network model, obtains described 4th in the 13rd image of the reversed network model output
Confidence ceases the 15th image for being added to the 5th subgraph;15th image is input to distinguishing for training completion in advance
In other device network model, the discrimination results information of the discriminator network model output is obtained, wherein the discrimination results information
For true picture or Vitua limage;According to each discrimination results information, the reversed network model is trained.
Further, described device further include:
5th training module, for obtaining sample image, wherein being labelled in the sample image, the sample image is corresponding to be distinguished
Other identification information, wherein the discrimination identification information includes true picture and Vitua limage;Each sample image is input to institute
It states in discriminator network model, the discrimination results information of each sample image output is directed to according to discriminator network model, and every
The corresponding discrimination identification information of a sample image, is trained the discriminator network model, wherein discrimination results information mark
The image for knowing input is true picture or Vitua limage.
The embodiment of the invention provides a kind of electronic equipment, comprising: processor, communication interface, memory and communication bus,
Wherein, processor, communication interface, memory complete mutual communication by communication bus;
It is stored with computer program in the memory, when described program is executed by the processor, so that the processor
The step of executing any of the above-described the method.
The embodiment of the invention provides method, apparatus and electronic equipment that target object is removed in a kind of image, the sides
Method includes: and first subgraph obtained in advance by the first image of the first subgraph comprising target object to be removed
It is input to as the target position information in the first image in the network model that training is completed in advance, obtains the network mould
The second image of first subgraph is removed at the target position information in the first image of type output.By
In in embodiments of the present invention, by using the network model that preparatory training is completed, the target position in the first image is believed
The first subgraph in breath removes, and obtains the second image.Second image effect exported according to the network model is preferable.
Detailed description of the invention
To describe the technical solutions in the embodiments of the present invention more clearly, make required in being described below to embodiment
Attached drawing is briefly introduced, it should be apparent that, drawings in the following description are only some embodiments of the invention, for this
For the those of ordinary skill in field, without creative efforts, it can also be obtained according to these attached drawings other
Attached drawing.
Fig. 1 is the training process schematic diagram for the network model that the embodiment of the present invention 2 provides;
Fig. 2 is the training process schematic diagram for the network model that the embodiment of the present invention 3 provides;
Fig. 3 is the training process schematic diagram for the reversed network model that the embodiment of the present invention 5 provides;
The apparatus structure schematic diagram of target object is removed in a kind of image that Fig. 4 provides for the embodiment of the present invention 7;
Fig. 5 is a kind of electronic equipment structural schematic diagram that the embodiment of the present invention 8 provides.
Specific embodiment
The present invention will be describe below in further detail with reference to the accompanying drawings, it is clear that described embodiment is only this
Invention a part of the embodiment, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art exist
All other embodiment obtained under the premise of creative work is not made, shall fall within the protection scope of the present invention.
Embodiment 1:
The embodiment of the invention provides a kind of methods that target object is removed in image, which comprises
By the first image of the first subgraph comprising target object to be removed, and first subgraph obtained in advance exists
Target position information in the first image is input in the network model that training is completed in advance, and it is defeated to obtain the network model
The second image of first subgraph is removed at the target position information in the first image out.
In order to guarantee that the display effect of the image after removed target object, the embodiment of the present invention are completed using training in advance
Network model, the image comprising target object to be removed is handled.Specifically, the network model can be depth mind
Through any one network model in metanetwork model, for example, the network model can be depth residual error network model, U-shaped volume
Product neural network model or the network model of designer's designed, designed etc..
In the specific implementation process, target object can be obtained in first figure by the image detecting program being pre-designed
Target position information as in, the specific can be that the artificial mode for marking box in first image in advance, the wherein party
The target object is completely included in frame, the position that box is marked in first image is obtained by image detecting program, thus really
Set the goal location information, in embodiments of the present invention, to obtain target position information process with no restriction.
In order to get the second image for removing the first subgraph, in embodiments of the present invention, by first image, and
Target position information of first subgraph obtained in advance in first image is input to the network mould that training is completed in advance
In type, based on the network model that the preparatory training is completed, first son is removed at the target position information in the first image
Image, thus the second image of output, wherein the region being removed after the first subgraph in the first image is filled out naturally by background
It fills, so that the second image display effect of output is preferable.In the specific implementation process, which can not only export
The second image that the first subgraph is removed at the target position information in one image, can also export comprising first subgraph
Image.
Due in embodiments of the present invention, by using the network model that preparatory training is completed, by the first image should
The first subgraph in target position information removes, and obtains the second image.Second image according to network model output is aobvious
Show that effect is preferable.
Embodiment 2:
In order to improve the display effect of the image after removing target object, on the basis of the above embodiments, implement in the present invention
In example, the training process of the network model includes:
Each third image that training sample is concentrated is obtained, wherein the second son in each third image comprising object to be removed
Image;
For each third image, by the third image, and object to be removed in the third image that obtains in advance second
First location information of the subgraph in the third image is input in the network model, obtains the network model output
The 4th image of second subgraph is removed at the first location information in the third image;By the described 4th
Image is input in the discriminator network model that training is completed in advance, obtains the discrimination results of the discriminator network model output
Information, wherein the discrimination results information is true picture or Vitua limage;
According to each discrimination results information, the network model is trained.
The image display effect after removal target object in order to make network model output is preferable, in the embodiment of the present invention
In, the network model is trained in conjunction with the discriminator network model that preparatory training is completed.Specifically, the discriminator network mould
Type can be any one network model in deep neural network model.The effect of the discriminator network model is to differentiate one
Image is true picture or Vitua limage, which always exaggerates the image of network model output as far as possible
Difference between true picture, to make the image of network model output true nature as far as possible.
In embodiments of the present invention, to training sample concentrate each third image include in perhaps type etc. do not limit
System.When obtaining training sample set, training sample set can be chosen from existing image data base, it can also be by user voluntarily
The image construction training sample set of shooting.It wherein, include an object in each third image, which can be animal, people
Or article etc..
Fig. 1 is the training process schematic diagram of network model provided in an embodiment of the present invention, specifically, being directed to each third figure
Picture, by the third image, and object to be removed in the third image that obtains in advance the second subgraph in the third image
In first location information be input in network model, convolution operation of the network model Jing Guo several layers and pondization operation obtain
Take the 4th image that second subgraph is removed at the first location information in the third image.Later, by the 4th
Image is input to the discriminator network model that training is completed in advance, which can identify that the 4th image is true
Image or Vitua limage, specifically, the 4th image the discriminator network model by several layers convolution sum pondization operation after,
Output is directed to the discrimination results information of the 4th image, and wherein the discrimination results information is for identifying the identification of discriminator network model
The 4th image be true picture or Vitua limage.According to each discrimination results information, which is trained.
Embodiment 3:
In order to improve the display effect of the image after removing target object, on the basis of the various embodiments described above, of the invention real
It applies in example, the training process of the network model includes:
The 5th image of each of training sample concentration is obtained, wherein third in each 5th image comprising object to be removed
Image;
For each 5th image, third of object to be removed in the 5th image that obtains by the 5th image and in advance
Second location information of the image in the 5th image is input in the network model, obtain network model output
The 6th image of the third subgraph is removed at the second location information in 5th image, and includes the object
7th image of body;By the 6th image, the 7th image and the second location information are input to the network model
Reversed network model in, obtain the reversed network model output at the second location information of the 6th image
It is added to the 8th image of the object in the 7th image;
According to the similarity of each 5th image and the 8th image, the network model is trained.
The image display effect after removal target object in order to make network model output is preferable, in the embodiment of the present invention
In, the network model is trained in conjunction with the reversed network model of the network model, wherein the function of the network model with should
The function of reversed network model is just the opposite.The function of the network model is by the object in input picture at designated location information
Image remove;And the function of the reversed network model is that the figure of an object is added at the designated location information of input picture
Picture.According to the different function of each model of foregoing description, which can also be known as disjunctive model, the reversed network mould
Type can also be known as pooled model.
Being trained the principle followed to the network model in conjunction with reversed network model is image reconstruction principle, i.e., reversed net
The 5th image that 8th image of network model output needs to input with network model is as identical as possible.
In embodiments of the present invention, to training sample concentrate each of the 5th image include in perhaps type etc. do not limit
System.When obtaining training sample set, training sample set can be chosen from existing image data base, it can also be by user voluntarily
The image construction training sample set of shooting.It wherein, include an object in each 5th image, which can be animal, people
Or article etc..
Fig. 2 is the training process schematic diagram of network model provided in an embodiment of the present invention, specifically, being directed to each 5th figure
Picture, the third subgraph of object to be removed is in the 5th image in the 5th image obtained by the 5th image and in advance
Second location information be input in the network model, obtain the network model output the second in the 5th image
The 6th image of the third subgraph is removed at confidence breath, and the 7th image comprising the object.Later, by the 6th figure
Picture, the 7th image and the second location information are input in the reversed network model, obtain the 6th image this second
The 8th image of the object in the 7th image is added at location information.According to the similar of each 5th image and the 8th image
Degree, is trained the network model.
Wherein, the process for calculating the similarity of the 5th image and the 8th image is the prior art, in embodiments of the present invention,
The process is not repeated.
Embodiment 4:
In order to improve the display effect of the image after removing target object, on the basis of the various embodiments described above, of the invention real
It applies in example, the training process of the network model includes:
Each of training sample concentration the 9th image and each tenth image are obtained, wherein comprising to be added in each tenth image
Object the 4th subgraph;
For each 9th image, any tenth image is chosen, the 9th image and obtains described the tenth image in advance
The third place information input in 9th image obtains the reversed network mould into the reversed network model of the network model
The third place information in the 9th image of type output is added to the 11st image of the 4th subgraph;By institute
The 11st image and the third place information input are stated into the network model, obtain network model output in institute
State the tenth of the 4th subgraph in the third place information removing of the 11st image the third place information
Two images;
According to the similarity of each 9th image and the 12nd image, the network model is trained.
Being trained another principle that needs follow to the network model in conjunction with reversed network model is network model output
The 12nd image the 9th image that needs to input with reversed network model it is as identical as possible.
In embodiments of the present invention, in including in the 9th image of each of training sample concentration and each tenth image
Perhaps type etc. is with no restriction.When obtaining training sample set, training sample set can be chosen from existing image data base,
It can also be by image construction training sample set that user voluntarily shoots.It wherein, include one to be added in each tenth image
4th subgraph of object, the object can be animal, people or article etc..Preferably, each tenth image is comprising to be added
Object without background image, the i.e. single image of background, if the tenth image is not no background image, the prior art can be used
The background in the tenth image is removed, therefore not to repeat here.
Specifically, being directed to each 9th image, to be added object of the tenth image as the 9th image is randomly selected
The image of body.By the 9th image, the third place information input in the tenth image and the 9th image obtained in advance is arrived
In reversed network model, acquisition is added to the 11st figure of the 4th subgraph in the third place information of the 9th image
Picture.Later, it by the 11st image and the third place information input into the network model, exports in the 11st image
The 12nd image of the 4th subgraph in the third place information is removed at the third place information.According to each 9th
The similarity of image and the 12nd image is trained the network model.
Wherein, the process for calculating the similarity of the 9th image and the 12nd image is the prior art, in the embodiment of the present invention
In, which is not repeated.
Embodiment 5:
In order to improve the display effect of the image after removing target object, on the basis of the various embodiments described above, of the invention real
It applies in example, the training process of the reversed network model includes:
Each of training sample concentration the 13rd image and each 14th image are obtained, wherein including in each 14th image
5th subgraph of object to be added;
For each 13rd image, any 14th image is chosen, the 13rd image and obtains the 14th image in advance
The 4th location information in the 13rd image taken is input in the reversed network model, obtains the reversed network mould
The 4th location information in the 13rd image of type output is added to the 15th image of the 5th subgraph;It will
15th image is input in the discriminator network model that training is completed in advance, obtains the discriminator network model output
Discrimination results information, wherein the discrimination results information be true picture or Vitua limage;
According to each discrimination results information, the reversed network model is trained.
In the specific implementation process, network model and reversed network model can be individually trained, in training network mould
Discriminator network model is based respectively on when type and reversed network model to be trained, it can also be by network model and reversed network mould
Type is trained together, is specifically compared according to the image of the image of network model input and the output of reversed network model,
To be trained to two models, or according to the image of reversed network model input and the image progress of network model output
Comparison, to be trained to two models, such as the training method of above-described embodiment 3 and the offer of embodiment 4.
In order to keep the image display effect for being added to object of reversed network model output preferable, in the embodiment of the present invention
In, the reversed network model is trained in conjunction with the discriminator network model that preparatory training is completed.Specifically, the discriminator net
Network model can be any one network model in deep neural network model.The effect of the discriminator network model is to differentiate
One image is true picture or Vitua limage, and it is defeated which always exaggerates reversed network model as far as possible
The difference between image and true picture out, to make the image of reversed network model output true nature as far as possible.
In embodiments of the present invention, training sample each of is concentrated in the 13rd image and each 14th image and includes
Interior perhaps type etc. with no restriction.When obtaining training sample set, training sample can be chosen from existing image data base
This collection, can also be by image construction training sample set that user voluntarily shoots.Wherein, in each 14th image comprising one to
5th subgraph of the object of addition, the object can be animal, people or article etc..
Fig. 3 is the training process schematic diagram of reversed network model provided in an embodiment of the present invention, specifically, for each the
13 images randomly select image of the 14th image as the object to be added of the 13rd image.By the 13rd
The 4th location information in image, the 14th image and the 13rd image obtained in advance is input to reversed network model
In, acquisition is added to the 15th image of the 5th subgraph in the 4th location information of the 13rd image.Later, by this
15th image is input in the discriminator network model that training is completed in advance, which can identify the 14th
Image is true picture or Vitua limage, specifically, the 14th image is rolled up in the discriminator network model by several layers
After the operation of long-pending and pondization, output is directed to the discrimination results information of the 14th image, and wherein the discrimination results information is for identifying
14th image of discriminator network model identification is true picture or Vitua limage.According to each discrimination results information,
The reversed network model is trained.
Embodiment 6:
In order to improve the display effect of the image after removing target object, on the basis of the various embodiments described above, of the invention real
It applies in example, the training process of the discriminator network model includes:
Sample image is obtained, wherein be labelled with the corresponding discrimination identification information of the sample image in the sample image, wherein institute
It states and distinguishes that identification information includes true picture and Vitua limage;
Each sample image is input in the discriminator network model, each sample graph is directed to according to discriminator network model
As output discrimination results information and the corresponding discrimination identification information of each sample image, to the discriminator network model into
Row training, wherein the image of discrimination results message identification input is true picture or Vitua limage.
Due to the purpose of the discriminator network model be in order to identify that image is true picture or Vitua limage,
Before being trained to the discriminator network model, it is also necessary to obtain sample image, and be labeled to each sample image, be had
Body, when being labeled in advance to each sample image, whether user is true according to each sample image, gives each sample graph
As one identification information of mark, it is true picture or Vitua limage which, which can identify sample image,.
It can be first the sample graph of true picture by the discrimination identification information of mark in the training discriminator network model
As being separately input in the discriminator network model, according to the discrimination results information that discriminator network model exports, this can be made
Discriminator network model identifies true picture;Secondly the sample image that the discrimination identification information of mark is Vitua limage is input to
In the discriminator network model, according to the discrimination results information that discriminator network model exports, the discriminator network mould can be made
Type identifies Vitua limage.Specifically, each sample image is input in the discriminator network model, each sample image is exported
Corresponding discrimination results information, wherein discrimination results information is true picture or Vitua limage for identifying the sample image;
According to the discrimination results information of the discrimination identification information of each sample image and each sample image, to the discriminator network mould
Type is trained.
Below with a detailed embodiment, the training process of each network model is introduced.
Firstly, it is necessary to obtain training sample set, specific user by image capture device shoot a natural background or
Then the image A for specifying model B to shoot one under the scene of image A comprising model B is arranged in the image A of room background+, mould
Special B shoots an image C under single scene.
In order to be trained to discriminator network model, a large amount of true picture and Vitua limage are needed.Due to above-mentioned sample
The sample image of this concentration is obtained by image capture device, i.e. image A, image A+, image C, therefore above-mentioned sample graph
As being true picture.Above-mentioned sample image is separately input in discriminator network model, it is defeated according to discriminator network model
Discrimination results information out can make the discriminator network model identify true picture;Additionally by merging in the prior art
Method, the image that above-mentioned image A and image C are synthesized, or by target object minimizing technology in the prior art will be from
Above-mentioned image A+Image after above-mentioned synthesis and/or separation is separately input to distinguish by the image isolated as Vitua limage
The discrimination results information exported in other device network model according to discriminator network model can be such that the discriminator network model identifies
Vitua limage.
It, can be based on discriminator network model to network model and the network after the training for completing discriminator network model
The reversed network model of model is trained.Specifically, reversed network model is properly termed as pooled model, network model can claim
For disjunctive model.Be based on training process of the discriminator network to reversed network model, by the image A of above-mentioned acquisition, image C with
And the subgraph of the object in image C to be added is input in reversed network model together in the location information in image A, it should
Location information in image A of reversed network model output is added to the image A of subgraph1;Later by image A1Input
In the discriminator network model completed to training, the discrimination results information of discriminator network model output is obtained;According to discrimination
Result information is trained the reversed network model.
It is based on training process of the discriminator network model to network model, in advance in the image A of above-mentioned acquisition+Middle label
One box includes object to be removed in the box, records the box in image A+In location information.By image A+With
And the location information is input in network model together, network model is exported in image A+The location information at remove this
The image A of object2, by image A2It is input in the discriminator network model of training completion, it is defeated to obtain the discriminator network model
Discrimination results information out is trained the network model according to discrimination results information.
The process of unified training network model and reversed network model needs to follow image reconstruction principle and is not destroyed, i.e., instead
The image that the image exported to network model needs to input with network model is as identical as possible;The image of network model output needs
It is as identical as possible as the image of reversed network model input.
Firstly, the subgraph of image C and the object in image C to be added is in image A by the image A of above-mentioned acquisition
In location information be input in reversed network model together, the position letter in image A of reversed network model output
Breath is added to the image A of subgraph3, later, by image A3It is input in network model together with the location information, the network
Model is exported in image A3In the location information at remove the image A of the object for including at the location information4, according to figure
As A and image A4Similarity, network model and reversed network model are trained.
Alternatively, in advance in the image A of above-mentioned acquisition+One box of middle label includes object to be removed, note in the box
The box is recorded in image A+In location information.By image A+And the location information is input in network model together, network
Model is exported in image A+The location information at remove the image A of the object5, and the image A comprising the object6, by this
Image A5, image A6And the location information is input to together in reversed network model, the reversed network model output is in image A5
In the location information at be added to image A6Image A7, according to image A7With image A+Similarity, to network model and anti-
It is trained to network model.
Embodiment 7:
Fig. 4 is the apparatus structure schematic diagram that target object is removed in a kind of image provided in an embodiment of the present invention, which includes:
Input module 401, network model module 402;
The input module 401, for will include target object to be removed the first subgraph the first image, and obtain in advance
Target position information of first subgraph taken in the first image is input to the network that training is completed in advance
In model;
The network model module 402, for removing described first at the target position information in the first image
Subgraph exports the second figure that first subgraph is removed at the target position information in the first image
Picture.
Further, described device further include:
First training module 403, for obtaining each third image of training sample concentration, wherein including in each third image
Second subgraph of object to be removed;For each third image, by the third image, and the third image obtained in advance
In first location information of second subgraph in the third image of object to be removed be input in the network model, obtain
Take the network model output removes second subgraph at the first location information in the third image
The 4th image;4th image is input in the discriminator network model that training is completed in advance, obtains the discriminator
The discrimination results information of network model output, wherein the discrimination results information is true picture or Vitua limage;According to each
Discrimination results information is trained the network model.
Further, described device further include:
Second training module 404, for obtaining the 5th image of each of training sample concentration, wherein including in each 5th image
The third subgraph of object to be removed;For each 5th image, the 5th image that obtains by the 5th image and in advance
In second location information of the third subgraph in the 5th image of object to be removed be input in the network model, obtain
Take the network model output removes the third subgraph at the second location information in the 5th image
The 6th image, and the 7th image comprising the object;By the 6th image, the 7th image and the second position
Information input into the reversed network model of the network model, obtain the reversed network model output in the 6th figure
The 8th image of the object in the 7th image is added at the second location information of picture;According to each 5th image and
The similarity of 8th image is trained the network model.
Further, described device further include:
Third training module 405, for obtaining each of training sample concentration the 9th image and each tenth image, wherein each
It include the 4th subgraph of object to be added in tenth image;For each 9th image, any tenth image is chosen, by this
The third place information input in 9th image, the tenth image and the 9th image obtained in advance is to the network model
Reversed network model in, the third place information in the 9th image for obtaining the reversed network model output adds
The 11st image of the 4th subgraph is added;By the 11st image and the third place information input to the net
In network model, the third place information removing in the 11st image of network model output described the is obtained
12nd image of the 4th subgraph in three location informations;According to the similar of each 9th image and the 12nd image
Degree, is trained the network model.
Further, described device further include:
4th training module 406, for obtaining each of training sample concentration the 13rd image and each 14th image, wherein
It include the 5th subgraph of object to be added in each 14th image;For each 13rd image, any tenth is chosen
Four images, the 4th location information by the 13rd image, in the 14th image and the 13rd image obtained in advance
Be input in the reversed network model, obtain the reversed network model output the described 4th of the 13rd image
Location information is added to the 15th image of the 5th subgraph;15th image is input to what training in advance was completed
In discriminator network model, the discrimination results information of the discriminator network model output is obtained, wherein the discrimination results are believed
Breath is true picture or Vitua limage;According to each discrimination results information, the reversed network model is trained.
Further, described device further include:
5th training module 407, for obtaining sample image, wherein it is corresponding to be labelled with the sample image in the sample image
Identification information is distinguished, wherein the discrimination identification information includes true picture and Vitua limage;Each sample image is input to
In the discriminator network model, the discrimination results information of each sample image output is directed to according to discriminator network model, and
The corresponding discrimination identification information of each sample image, is trained the discriminator network model, wherein discrimination results information
The image of mark input is true picture or Vitua limage.
Embodiment 8:
On the basis of the various embodiments described above, the embodiment of the invention also provides a kind of electronic equipment 500, as shown in figure 5, packet
It includes: processor 501, communication interface 502, memory 503 and communication bus 504, wherein processor 501, communication interface 502 are deposited
Reservoir 503 completes mutual communication by communication bus 504;
It is stored with computer program in the memory 503, when described program is executed by the processor 501, so that described
Processor 501 executes following steps:
By the first image of the first subgraph comprising target object to be removed, and first subgraph obtained in advance exists
Target position information in the first image is input in the network model that training is completed in advance, and it is defeated to obtain the network model
The second image of first subgraph is removed at the target position information in the first image out.
Further, the training process of the network model includes:
Each third image that training sample is concentrated is obtained, wherein the second son in each third image comprising object to be removed
Image;
For each third image, by the third image, and object to be removed in the third image that obtains in advance second
First location information of the subgraph in the third image is input in the network model, obtains the network model output
The 4th image of second subgraph is removed at the first location information in the third image;By the described 4th
Image is input in the discriminator network model that training is completed in advance, obtains the discrimination results of the discriminator network model output
Information, wherein the discrimination results information is true picture or Vitua limage;
According to each discrimination results information, the network model is trained.
Further, the training process of the network model includes:
The 5th image of each of training sample concentration is obtained, wherein third in each 5th image comprising object to be removed
Image;
For each 5th image, third of object to be removed in the 5th image that obtains by the 5th image and in advance
Second location information of the image in the 5th image is input in the network model, obtain network model output
The 6th image of the third subgraph is removed at the second location information in 5th image, and includes the object
7th image of body;By the 6th image, the 7th image and the second location information are input to the network model
Reversed network model in, obtain the reversed network model output at the second location information of the 6th image
It is added to the 8th image of the object in the 7th image;
According to the similarity of each 5th image and the 8th image, the network model is trained.
Further, the training process of the network model includes:
Each of training sample concentration the 9th image and each tenth image are obtained, wherein comprising to be added in each tenth image
Object the 4th subgraph;
For each 9th image, any tenth image is chosen, the 9th image and obtains described the tenth image in advance
The third place information input in 9th image obtains the reversed network mould into the reversed network model of the network model
The third place information in the 9th image of type output is added to the 11st image of the 4th subgraph;By institute
The 11st image and the third place information input are stated into the network model, obtain network model output in institute
State the tenth of the 4th subgraph in the third place information removing of the 11st image the third place information
Two images;
According to the similarity of each 9th image and the 12nd image, the network model is trained.
Further, the training process of the reversed network model includes:
Each of training sample concentration the 13rd image and each 14th image are obtained, wherein including in each 14th image
5th subgraph of object to be added;
For each 13rd image, any 14th image is chosen, the 13rd image and obtains the 14th image in advance
The 4th location information in the 13rd image taken is input in the reversed network model, obtains the reversed network mould
The 4th location information in the 13rd image of type output is added to the 15th image of the 5th subgraph;It will
15th image is input in the discriminator network model that training is completed in advance, obtains the discriminator network model output
Discrimination results information, wherein the discrimination results information be true picture or Vitua limage;
According to each discrimination results information, the reversed network model is trained.
Further, the training process of the discriminator network model includes:
Sample image is obtained, wherein be labelled with the corresponding discrimination identification information of the sample image in the sample image, wherein institute
It states and distinguishes that identification information includes true picture and Vitua limage;
Each sample image is input in the discriminator network model, each sample graph is directed to according to discriminator network model
As output discrimination results information and the corresponding discrimination identification information of each sample image, to the discriminator network model into
Row training, wherein the image of discrimination results message identification input is true picture or Vitua limage.
The communication bus that above-mentioned electronic equipment is mentioned can be Peripheral Component Interconnect standard (Peripheral Component
Interconnect, PCI) bus or expanding the industrial standard structure (Extended Industry Standard
Architecture, EISA) bus etc..The communication bus can be divided into address bus, data/address bus, control bus etc..For just
It is only indicated with a thick line in expression, figure, it is not intended that an only bus or a type of bus.
Communication interface 502 is for the communication between above-mentioned electronic equipment and other equipment.
Memory may include random access memory (Random Access Memory, RAM), also may include non-easy
The property lost memory (Non-Volatile Memory, NVM), for example, at least a magnetic disk storage.Optionally, memory may be used also
To be storage device that at least one is located remotely from aforementioned processor.
Above-mentioned processor can be general processor, including central processing unit, network processing unit (Network
Processor, NP) etc.;It can also be digital command processor (Digital Signal Processing, DSP), dedicated collection
At circuit, field programmable gate array or other programmable logic device, discrete gate or transistor logic, discrete hard
Part component etc..
The present invention be referring to according to the method for the embodiment of the present invention, the process of equipment (system) and computer program product
Figure and/or block diagram describe.It should be understood that every one stream in flowchart and/or the block diagram can be realized by computer program instructions
The combination of process and/or box in journey and/or box and flowchart and/or the block diagram.It can provide these computer programs
Instruct the processor of general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to produce
A raw machine, so that being generated by the instruction that computer or the processor of other programmable data processing devices execute for real
The function of now being specified in one box or multiple boxes in a process or multiple processes and/or block diagram in flow charts
Device.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy
Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates,
The manufacture of device is enabled, which realizes a side in a process in flow charts or multiple processes and/or block diagram
The function of being specified in frame or multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting
Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or
The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one
The step of function of being specified in a box or multiple boxes.
Although preferred embodiments of the present invention have been described, it is created once a person skilled in the art knows basic
Property concept, then additional changes and modifications may be made to these embodiments.So it includes excellent that the following claims are intended to be interpreted as
It selects embodiment and falls into all change and modification of the scope of the invention.
Obviously, various changes and modifications can be made to the invention without departing from essence of the invention by those skilled in the art
Mind and range.In this way, if these modifications and changes of the present invention belongs to the range of the claims in the present invention and its equivalent technologies
Within, then the present invention is also intended to include these modifications and variations.