Method, apparatus and device, and storage medium for generating images
An image generation method, apparatus, and device, and a medium are provided. The method includes: acquiring a first image, keeping a target attribute in the first image unchanged, and editing other attributes in the first image; on the basis of the target attribute and the edited other attributes, generating a second image.
1 . An image generation method, comprising:
acquiring a plurality of first images with a same attribute;
keeping the same attribute in each of the plurality of first images unchanged while editing at least one other attribute in each of the plurality of first images, wherein the editing the at least one other attribute while keeping the same attribute in each of the plurality of images unchanged comprises:
editing semantic vectors corresponding to the at least one other attribute in each of the plurality of first images to obtain edited semantic vectors, and
carrying out weighted average processing on the edited semantic vectors to obtain a semantic vector; and
generating, based on the same attribute and the semantic vector, a second image.
2 . The method according to claim 1 further comprising:
processing each of the plurality of first images to obtain the semantic vectors corresponding to the at least one other attribute in each of the plurality of first images.
3 . The method according to claim 1 , wherein the generating, based on the same attribute and the semantic vector, the second image comprises:
generating, based on a semantic vector corresponding to the same attribute and the semantic vector, the second image.
4 . The method according to claim 1 , wherein the determining the same attribute in the first image that is to remain unchanged and editing the at least one other attribute in the first image comprises:
processing, based on the plurality of first images, to obtain feature vectors of the plurality of first images; and
performing weighted average processing on the feature vectors of the plurality of first images to obtain a feature vector.
5 . The method according to claim 4 , wherein the generating, based on the same attribute and the semantic vector, the second image comprises:
generating, based on the feature vector, the second image.
6 . The method according to claim 4 , wherein after the performing the weighted average processing on the feature vectors of the plurality of first images to obtain the feature vector, the method further comprises:
processing, based on the feature vector, to obtain a corresponding semantic vector;
editing, based on the semantic vector, a semantic vector corresponding to the other attribute.
7 . A computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and upon the computer program being executed by a processor, the image generation method according to claim 1 is implemented.
8 . An image generation apparatus, comprising:
a first image acquiring module, configured to acquire a plurality of first images with a same attribute;
an attribute editing module, configured to keep the same attribute in each of the plurality of first images unchanged while editing at least one other attribute in each of the plurality of first images, wherein the editing the at least one other attribute while keeping the same attribute in each of the plurality of images unchanged comprises:
editing semantic vectors corresponding to the at least one other attribute in each of the plurality of first images to obtain edited semantic vectors, and
carrying out weighted average processing on the edited semantic vectors to obtain a semantic vector; and
a second image generation module, configured to generate, based on the same attribute and the semantic vector, a second image.
9 . The image generation apparatus according to claim 8 , wherein the attribute editing module is further configured to:
process each of the plurality of first images to obtain the semantic vectors corresponding to the at least one other attribute in each of the plurality of first images.
10 . The image generation apparatus according to claim 8 , wherein the second image generation module is further configured to:
generate, based on a semantic vector corresponding to the same attribute and the target semantic vector, the second image.
11 . The image generation apparatus according to claim 8 , wherein the attribute editing module is further configured to:
process, based on the plurality of first images, to obtain feature vectors of the plurality of first images; and
perform weighted average processing on the feature vectors of the plurality of first images to obtain a feature vector.
12 . The image generation apparatus according to claim 11 , wherein the second image generation module is further configured to:
generate, based on the feature vector, the second image.
13 . An image generation device, comprising:
a memory and a processor, wherein a computer program is stored on the memory, and the computer program upon being executed by the processor causes the processor to implement operations the operations comprise:
acquiring a plurality of first images with a same attribute;
keeping the same attribute in each of the plurality of first images unchanged while editing at least one other attribute in each of the plurality of first images, wherein the editing the at least one other attribute while keeping the same attribute in each of the plurality of images unchanged comprises:
editing semantic vectors corresponding to the at least one other attribute in each of the plurality of first images to obtain edited semantic vectors, and
carrying out weighted average processing on the edited semantic vectors to obtain a semantic vector; and
generating, based on the same attribute and the semantic vector, a second image.