Image generation method, electronic device, and program product

By acquiring and training an image generator to generate additional images, the problems of low efficiency and poor quality of traditional image generation methods are solved, and effective expansion of image collections and high-quality image generation are achieved.

CN118570320APending Publication Date: 2024-08-30DELL PROD LP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310183839.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-02-28
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

Traditional image generation methods are inefficient and generate poor image quality, making it difficult to meet user needs, especially when there are insufficient samples in the image collection.

Method used

By obtaining a collection of classifiable images, identifying critical situation images that are prone to misclassification, and using these images and related guidelines to train an image generator to generate additional images, using the trained image generator combined with different guidelines to generate new images, it is achieved Expansion of the image collection.

Benefits of technology

It improves the efficiency and quality of image generation, can better meet user needs, solves the problem of insufficient samples, and provides a flexible image generation method that allows an unlimited number of semantic concepts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118570320A
    Figure CN118570320A
Patent Text Reader

Abstract

The embodiment of the invention relates to an image generation method, electronic equipment and a computer program product. The method comprises the following steps: acquiring an image set, wherein the image set comprises a first plurality of images which can be classified into at least two categories; determining a critical condition image set in the image set, wherein the critical condition image set comprises a second plurality of images which are easy to be misclassified; training an image generator with at least some of the second plurality of images and a director associated with the at least some of the images; and generating, using the trained image generator, an additional image using the first image of the second plurality of images and an additional guideline, the additional guideline being different from the guideline. By using the technical scheme of the invention, the image generation efficiency can be improved, and the quality of the generated image can be enhanced, so that the user experience of a user having an image generation requirement can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure generally relate to artificial intelligence technology, and specifically to an image generation method, an electronic device, and a computer program product, which can be used in the field of customer service. Background Art

[0002] If people regard their data as an asset, then enhancing people's data means increasing their assets. By performing data augmentation on data such as images in an image collection, data in the current image collection can be augmented. For example, different data sources from within the current image collection can be utilized, and image data from external sources can be supplemented. This is especially true for most customers of current storage products. Current storage products generally use cloud technology and modern data management technology. After integrating many internal and external data sources, users may obtain augmented data sets that were previously unavailable and be able to use the augmented data sets for numerous operations. In this case, the augmented data set can help people overcome obstacles such as insufficient samples.

[0003] Therefore, it is necessary to use methods such as semantic image synthesis to generate images to expand the images in the image set. However, the image generation efficiency of traditional image generation methods is low and the quality of the generated images is often problematic, so it is difficult to guarantee the user experience of users who need to generate images. Summary of the invention

[0004] The embodiments of the present disclosure provide an image generation method, an electronic device, and a computer program product.

[0005] In a first aspect of the present disclosure, a method for generating an image is provided. The method includes: obtaining an image set, the image set including a first plurality of images that can be classified into at least two categories; determining a critical case image set in the image set, the critical case image set including a second plurality of images that are prone to being misclassified; training an image generator using at least some of the second plurality of images and guidelines associated with at least some of the images; and using the trained image generator to generate additional images using a first image in the second plurality of images and additional guidelines, the additional guidelines being different from the guidelines.

[0006] In a second aspect of the present disclosure, an electronic device is provided. The electronic device includes: at least one processing unit; and at least one memory, the at least one memory is coupled to the at least one processing unit and stores instructions for execution by the at least one processing unit, the instructions, when executed by the at least one processing unit, cause the device to perform actions, the actions including: acquiring an image set, the image set including a first plurality of images that can be used to be classified into at least two categories; determining a critical case image set in the image set, the critical case image set including a second plurality of images that are prone to being misclassified; using at least some of the second plurality of images and guidelines associated with at least some of the images to train an image generator; and using the trained image generator, generating additional images using a first image in the second plurality of images and additional guidelines, the additional guidelines being different from the guidelines.

[0007] In a third aspect of the present disclosure, a computer program product is provided. The computer program product is tangibly stored on a non-transitory computer readable medium and includes machine executable instructions, which, when executed, cause a machine to perform any step of the method described according to the first aspect of the present disclosure.

[0008] The Summary is provided to introduce a selection of concepts in a simplified form that are further described in the Detailed Description below. The Summary is not intended to identify key features or essential features of the embodiments of the present disclosure, nor is it intended to limit the scope of the embodiments of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] The above and other objects, features and advantages of the present disclosure will become more apparent through a more detailed description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, wherein like reference numerals generally represent like components throughout the exemplary embodiments of the present disclosure.

[0010] Figure 1 A schematic diagram illustrating an example image generation environment 100 in which devices and / or methods according to embodiments of the present disclosure may be implemented;

[0011] Figure 2 A flowchart of an image generating method 200 according to an embodiment of the present disclosure is shown;

[0012] Figure 3 A schematic diagram showing a critical case image determination process 300 according to an embodiment of the present disclosure is shown;

[0013] Figure 4 A schematic diagram showing an entity-based semantic alignment process 400 according to an embodiment of the present disclosure; and

[0014] Figure 5A schematic block diagram of an example device 500 that may be used to implement embodiments of the present disclosure is shown.

[0015] In the various drawings, the same or corresponding reference numerals represent the same or corresponding parts. DETAILED DESCRIPTION

[0016] The preferred embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the preferred embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.

[0017] As used herein, the term "including" and its variations represent open inclusion, for example, "including but not limited to". Unless otherwise stated, the term "or" means "and / or". The term "based on" means "based at least in part on". The terms "an example embodiment" and "an embodiment" mean "at least one embodiment". The term "another embodiment" means "at least one additional embodiment". The terms "first", "second", etc. may refer to different or the same objects. Other explicit and implicit definitions may also be included below.

[0018] As mentioned above, the image generation efficiency of traditional image generation methods is low and the quality of the generated images is often problematic, so it is difficult to guarantee the user experience of users who have the need to generate images.

[0019] Specifically, the goal of semantic image synthesis is to create realistic images based on semantic descriptions. To this end, a system based on conditional generative adversarial networks (GANs) has been proposed for different image-to-image translation tasks, such as semantically labeled images, edge photos, day-night, etc. In order to combat the instability of adversarial training, a modified perceptual loss can be used to generate high-resolution image patches. A unique adversarial loss and a new multi-scale generator and discriminator architecture have been provided for generating high-resolution images with realistic textures and fine details. A spatially adaptive normalization layer has also been proposed to adjust activations using the input semantic layout and effectively transfer semantic information across the network.

[0020] In order to at least partially solve one or more of the above problems and other potential problems, an embodiment of the present disclosure proposes an image generating method.

[0021] Unlike traditional semantic image synthesis work that allows users to synthesize images with a certain number of semantic ideas related to semantic tags, the technical solution according to the embodiments of the present disclosure focuses on modifying the input image according to input guidelines and prompts including input words. More importantly, another problem to be solved by the embodiments of the present disclosure is to train the model from scratch instead of fine-tuning StyleGAN, which is common in current data synthesis algorithms.

[0022] Figure 1 A schematic block diagram of an example image generation environment 100 in which the image generation method in some embodiments of the present disclosure may be implemented is shown. According to an embodiment of the present disclosure, the image generation environment 100 may be a cloud environment.

[0023] like Figure 1 As shown in , the image generation environment 100 includes a computing device 110. In the image generation environment 100, for example, an image set including an initial image or referred to as image data to be expanded can be provided to the computing device 110 as input data 120. At the same time, guidance associated with generating an image can also be provided to the computing device 110 as input data 120. At this time, the converter-based module 111 included in the computing device 110 can generate a generated image 130 as an output based on the received image set and guidance.

[0024] According to some embodiments of the present disclosure, prompts associated with generating an image may also be provided to the computing device 110 as input data 120. Therefore, the computing device 110 may further include an optional semantic alignment module 112, and the converter-based module 111 and the semantic alignment module 112 included in the computing device 110 generate a generated image 130 as an output based on the received image set, guidance, and prompts.

[0025] According to some embodiments of the present disclosure, instructions and prompts may be in the form of images and texts.

[0026] Studying the activity of neurons according to a specific deep learning (DL) model is an effective way to evaluate the quality of artificial intelligence (AI) test data. Generally speaking, the greater the diversity of neuronal activity, the higher the quality of the test data. In deep learning models, there are multiple ways to interpret neuronal activity. For example, the activation states covered by a neuron can be interpreted as the behavior in response to the test data points of the deep learning model. Similarly, both the value and the sign of the neuron output can be used to characterize the activation characteristics of the neuron.

[0027] An interesting concept can be introduced to characterize the difference between the behavior of the test set and the entire training set. To implement this concept, we must first specify the activation state of the neurons in the deep learning model. Suppose a set of inputs X = {x1, x2, ...} and a trained deep learning model M consisting of a set of neurons N = {n1, n2, ...}. For a given test data x∈XX and an ordered (sub)set of neurons The activation behavior of x on N (also called the activation trajectory) is represented by the activation value vector, and it is expressed as:

[0028] α N (x)=[a1(x), a2(x),...,a |N| (x)] T (1)

[0029] Each element a n (x) corresponds to the activation value of x relative to a single neuron n in N. Therefore, the set of activation traces of X is denoted as A N (X) = {α N (x)|x∈X}.

[0030] Then, A is calculated based on the training data set Tr N (Tr), A N (Tr) records the activation behavior of the neuron for all samples in Tr. Subsequently, the activation behavior of the test data Te is also obtained as A N (Te). Finally, combined with A N (Tr) and A N (Te), surprise adequacy (SA) is defined to describe the relative novelty of the test input with respect to the training data. It is actually expressed as A N (Tr) and A N A quantitative similarity measure between (Te) is of the form:

[0031] SA = SimilarityMeasure(A N (Te),A N (Tr)) (2)

[0032] Two types of similarity assessment can be used to formalize the surprise sufficiency SA. The first is likelihood-based SA (LSA), while the second is distance-based SA (DSA). The feasibility of verifying that these two SAs can capture the relative surprise of test data and explain the behavior of test data in deep learning systems shows that surprise sufficiency SA is valuable for assessing the quality of test data.

[0033] For example, a vision transformer based on the transformer module 111 in the computing device 110 typically takes a series of vectors as input and calls them tags. The transformer is built for sequence modeling, which is completely based on the attention mechanism on the tags and completely abandons loops and convolutions. Due to its great success in the field of natural language processing, transformers are increasingly being extended by common sense for computer vision tasks. For example, the iGPT neural network shows promising results in image classification by pre-training a sequence transformer with auto-regressive next pixel prediction and masked pixel prediction tasks. The image can be divided into small pieces, and these small pieces are fed into a standard transformer (such as ViT) for image classification. ViT, which has been trained on a large scale, can outperform a convolutional neural network (CNN) equipped with inductive biases. In order to alleviate the high computational complexity problem associated with long sequences caused by high-resolution images, lightweight transformers for visual tasks (e.g., Deformable DETR) can also be used. At the same time, transformers can also play a big role in low-level visual tasks. However, due to autoregressive prediction, image transformers may be affected by secondary computational costs and long inference times. Therefore, according to some embodiments of the present disclosure, the converter can adopt a hybrid convolutional neural network (CNN) converter architecture, which consists of a CNN head for feature extraction, a converter encoder-decoder backbone, and a CNN tail for feature decoding. For example, an image processing converter (IPT) can fully utilize the converter architecture through large-scale pre-training, and can achieve good results in multiple image restoration tasks.

[0034] In addition, a bisection structure can also be used to maintain the linear efficiency computation of cross-image long-range interactions based on the convolution backbone. According to some embodiments of the present disclosure, the marker-based embedder inherits the network architecture of the converter, which does not have any convolutional layers and can produce good results for high-resolution image synthesis.

[0035] According to an embodiment of the present disclosure, a corner case detection problem can be formally defined. In addition to the execution of traditional software, a risk condition in artificial intelligence system testing is data processing for corner cases, which often leads to inaccurate and unexpected behavior. For example, when a deep learning-based autonomous driving system is dealing with edge cases such as wet weather or obvious reflections, it may make wrong choices, resulting in accidents with loss of life and property. Therefore, detecting corner case samples is crucial for artificial intelligence testing. Based on the above explanation of corner cases, the corner case set can be defined as follows:

[0036] Cornercaseset:{x|DL(x+perturbation)≠label(x)} (3)

[0037] Where x is a sample in the critical case, and its true label is denoted as label(x); DL(*) is the output class based on a given deep learning model. By this definition, we can see that when a small perturbation is added to the critical case data x, where the perturbation is a small value such that for a constant ε, 0 < |perturbation| ≤ ε, the class identified by the deep learning system will be different from its actual label. Therefore, the critical case set may contain inaccurate and unexpected behaviors, such as boundary adversarial data and misclassified data.

[0038] The following Figure 1 As an example, referring to the computing device 110 and input data 120 included in Figure 2 The image generation method 200 shown in FIG. 1 is used to describe in detail the specific operations performed by the computing device 110 after receiving the input data 120 .

[0039] Figure 2 FIG. 2 shows a flow chart of an image generation method 200 according to an embodiment of the present disclosure. The image generation method 200 may be Figure 1 It is implemented by the computing device 110 shown in , and may also be implemented by other appropriate devices. It should be understood that the image generation method 200 may also include additional steps not shown and / or may omit the steps shown, and the scope of the embodiments of the present disclosure is not limited in this respect.

[0040] At block 202, the computing device 110 acquires an image collection. According to an embodiment of the present disclosure, the image collection includes a first plurality of images that can be classified into at least two categories, and can be provided to the computing device 110 as input data 120, for example, by a user. The categories into which the first plurality of images in the image collection can be classified are various, for example, whether the image includes a specific entity, such as a bird, whether the image has a special state, such as fog, and so on.

[0041] At block 204 , computing device 110 determines (either manually or algorithmically) a set of borderline case images in the set of images, wherein the set of borderline case images includes a second plurality of images that are susceptible to being misclassified (including having been misclassified or having a high probability of being misclassified).

[0042] According to some embodiments of the present disclosure, the computing device 110 may determine a second plurality of images in the image collection based on a user input as the input data 120 .

[0043] According to some other embodiments of the present disclosure, the computing device 110 may determine the second plurality of images in the image set using a likelihood-based surprise sufficiency method.

[0044] According to yet other embodiments of the present disclosure, the computing device 110 may determine the second plurality of images in the image collection using a distance-based surprise sufficiency method.

[0045] Figure 3 A schematic diagram of a critical case image determination process 300 according to an embodiment of the present disclosure is shown.

[0046] like Figure 3 As shown in , the training data set 310 may include a collection of images and is input to the deep learning model 320 for training. At the same time, the trained deep learning model 320 and the test data set 330 are input together to the critical case detector 340. The test data set 330 includes a classification boundary line 331, and its left and right sides represent two different classifications. It can be seen that a triangle that should be on the left side of the classification boundary line 331 is misclassified to the right side of the classification boundary line 331, and a circle that should be on the right side of the classification boundary line 331 is misclassified to the left side of the classification boundary line 331.

[0047] The critical situation detector 340 can determine the critical situation data set 350. It can be seen that the critical situation data set 350 is basically the same as the test data set 330, which also includes the classification boundary line 351, but the critical situation data set 350 additionally includes two auxiliary lines 352 and 353, and the area between the auxiliary lines 352 and 353 is the critical situation area, and the image in the critical situation area is the critical situation image.

[0048] Therefore, images close to the classification boundary line are more likely to belong to critical case images, which include images that have been misclassified or images that are likely to be misclassified.

[0049] Returning to block 204 , determining the set of borderline case images using the distance-based surprise sufficiency method may include determining, based on the set of images, an image classification space for at least two classes. Figure 3 The test data set 330 and the data set 350 for determining the critical case may be embodiments of the image classification space. After determining the image classification space, the computing device 110 may determine, for a first image in the first plurality of images, a first Euclidean distance between the first image and other images belonging to the same category in the image classification space and a second Euclidean distance between the first image and images belonging to other categories in the image classification space, and may determine whether the first image belongs to the critical case image set based on the first Euclidean distance and the second Euclidean distance.

[0050] According to an embodiment of the present disclosure, determining whether the first image belongs to the critical case image set based on the first Euclidean distance and the second Euclidean distance may include determining whether the first image belongs to the critical case image set based on a ratio of the first Euclidean distance to the second Euclidean distance.

[0051] Another alternative embodiment of the above steps is described in detail below.

[0052] According to an embodiment of the present disclosure, considering that the unexpected sufficiency method can be used to capture the behavior of test data, the unexpected sufficiency method can be used to represent the behavior of critical case data. Take distance-based unexpected sufficiency (DSA) as an example, which specifies the relationship between test data and classification boundaries. For example, a deep learning model M composed of a group of neurons N is learned based on a training data set Tr with C classes. According to the representation of unexpected sufficiency, the activation trajectory of Tr can be calculated as A based on the trained M. N (Tr). Then, for class c x ∈C, which is a new test input x in c x The nearest neighbor in is denoted as x a Finally, x is of class c x The surprise can be calculated as their activation trajectory α N (*) The distance between them is as follows:

[0053]

[0054] dist a =||α N (x)-α N (x a )|| (4)

[0055] where ||*|| is the Euclidean distance. Then, with x a As the reference point, and at the same time as c x Find its nearest neighbor x in different classes b , then x a With x b The accident between can also be calculated as:

[0056]

[0057] dist b =||α N (x a )-α N (x b )|| (5)

[0058] Combining the above two definitions, the unexpected sufficiency of the test data x for the training data can be defined as dista and dist b The ratio is as follows

[0059]

[0060] According to this definition, if the numerator is larger and the denominator is smaller, the value of distance-based accidental sufficiency DSA will be larger, indicating that the test data x is relatively close to the training data c. x The data of the class is an accident. It can be seen that the distance-based accident sufficiency DSA method can characterize the accidental method of data related to training data by distance, and it is also helpful to describe the activation behavior of data related to the provided deep learning model. According to some embodiments of the present disclosure, the distance-based accident sufficiency DSA for critical case detection can also be formalized to evaluate its ability to identify critical case data.

[0061] For example, the novelty can be calculated using the test data itself. In the original distance-based surprise sufficiency DSA formula, the denominator is used to calculate x a (the nearest neighbor of the test data in the same class) relative to the surprise of data in other classes. Therefore, the distance-based surprise sufficiency DSA is a comparison of the novelty of x in its own class and the novelty of its class relative to other classes, which can help describe the surprise of the test data relative to the entire training data. If you want to determine whether a data sample is a critical case data, its novelty relative to all classes can also be more critical. Therefore, it can be modified by only dist b The definition of is used to change the original distance-based accidental sufficiency DSA as follows:

[0062]

[0063] dist b =||α N (x)-α N (x b )|| (7)

[0064] In formula (7), the calculation of distance-based surprise sufficiency DSA remains unchanged. This modification enables distance-based surprise sufficiency DSA to consider the surprise of the test data x for all categories independently, and can help reflect the behavior of the data in critical cases.

[0065] It should be understood that the embodiments of the present disclosure are not limited to determining whether the first image belongs to the critical case image set based on the ratio of the first Euclidean distance to the second Euclidean distance. Instead, it can be determined whether the first image belongs to the critical case image set by, for example, determining whether at least one of the two distances satisfies a threshold value.

[0066] Returning to the image generation method 200 , at block 206 , the computing device 110 trains the image generator using at least some of the second plurality of images and the guidelines associated with the at least some of the images.

[0067] According to an embodiment of the present disclosure, the guidance may include, for example, entities included in the image, such as a bird, and a detailed description of the bird, whether the image has a special state, such as fog, etc. At the same time, the guidance may include at least one of image guidance and text guidance. Since the guidance associated with at least some of the images is used to train the image generator, the guidance associated with at least some of the images is a true and accurate description of the at least some of the images.

[0068] At block 208 , computing device 110 generates additional images using the trained image generator using the first image in the second plurality of images and the additional guidelines, the additional guidelines being different from the guidelines.

[0069] According to an embodiment of the present disclosure, the additional guidance is introduced to generate new images not included in the image set based on the images in the image set, so the additional guidance may not be a true description of the images in the image set. For example, when training an image generator, an image including a black bird is input, then the corresponding guidance may be "the bird is black", and when using the trained image generator to generate an additional image, although the input may still be an image including a black bird, the corresponding additional guidance may be "the bird is white", at this time the trained image generator can generate an image including a white bird as an additional image, and this additional image is different from the images in the image set, and therefore is an expansion of the image set.

[0070] According to some embodiments of the present disclosure, method 200 may include an additional step, namely, computing device 110 obtains a prompt associated with a first image in the second plurality of images, and uses the first image and the prompt to generate a processed first image. In this case, block 208 may be adjusted so that computing device 110 generates an additional image using the processed first image and the additional guidance. Using the first image and the prompt to generate the processed first image may also be referred to as semantic alignment.

[0071] According to an embodiment of the present disclosure, the prompt may be expert knowledge, which may be a special image selected from the image set, or an image outside the image set. At the same time, similar to the guidance, the prompt may include at least one of an image prompt and a text prompt.

[0072] According to an embodiment of the present disclosure, the first image may include an entity, and the prompt may be associated with the entity. At this time, using the first image and the prompt to generate the processed first image may include removing the entity from the first image based on the prompt.

[0073] Figure 4 A schematic diagram of an entity-based semantic alignment process 400 according to an embodiment of the present disclosure is shown.

[0074] like Figure 4 As shown in , the first image 410 includes a sphere as a solid, and the first image 410 is processed by solid segmentation 420 to generate a solid segmented first image 430. It can be seen that the first image 410 has been segmented into a plurality of small blocks (i.e., markers), and the sphere in the first image 410 is included in several small blocks.

[0075] Then, semantic alignment 440 is performed on the entity segmented first image 430 and the inputted instruction 450, wherein the instruction 450 may indicate that the entity is to be removed, or simply indicates the entity. After semantic alignment 440, it can be seen that the small block including the sphere in the entity segmented first image 430 has been removed or blackened, thereby generating a semantically aligned first image 460, which is the processed first image mentioned above.

[0076] Since the small blocks including entities have been removed from the semantically aligned first image 460 (i.e., the processed first image), when generating an additional image using the processed first image and additional guidelines, there is no need to use a converter to operate on the removed small blocks, but only needs to operate on the small blocks that have not been removed.

[0077] Another alternative embodiment of the above steps is described in detail below.

[0078] According to an embodiment of the present disclosure, only image tags related to text can be changed. A converter can be used to generate a model, using input text tags and visual guidance tags (gray / sketch images derived from input images) to automatically regress and create image tags. In addition to the classification loss for each tag, the framework according to an embodiment of the present disclosure can also adopt semantic losses in the training phase to enable the model to capture the visual semantic alignment between the input text and the changed image. The framework according to an embodiment of the present disclosure uses a semantic alignment module to identify text-related tags to be changed during the reasoning phase, and the generation model only manipulates these image tags.

[0079] The autoencoder model according to an embodiment of the present disclosure is responsible for downsampling and quantizing the input image into discrete tags, while the transformer model is responsible for fitting the joint distribution of image tags. These two models together constitute a transformer-based image processing model.

[0080] The autoencoder-based converter model consists of three parts: a convolutional encoder E, a convolutional decoder G, and a convolutional neural network consisting of K n z Codebook of dimensional latent variables These are all learnable. Given an image The convolutional encoder E encodes the image into a two-dimensional latent feature map The codebook is used to quantize the latent feature map by embedding each pixel into its closest latent variable element-wise in the codebook as follows:

[0081]

[0082] For reconstruction, the decoder G converts the quantized latent feature map As input, it returns a generated image that is close to the original image. Right now

[0083] For image generation, the quantized feature map can be modeled as a sequence of discrete labels and represented as a series of discrete label indices I∈{0,...,K-1} h×w Each marker corresponds roughly to a The prediction of the labeled sequence is therefore equivalent to synthesizing the image. In practice, a unidirectional transformer can be used to self-regressively predict the image sequence as follows:

[0084]

[0085] where T is the sequence of text tokens for the captions paired with image X.

[0086] In order to introduce the position information of two modalities in the transformer, two sets of position embeddings can be used. One is the axial position embedding of visual sequences from spatial grids. The other is sequence embedding as BERT for text sequences.

[0087] The autoregressive task minimizes the cross entropy loss applied to the reconstruction of text and image tags, respectively.

[0088]

[0089]

[0090] At the top level, the transformer model is responsible for determining basic image tags, and at the bottom level, the autoencoder model is responsible for preserving the convolutional decoder that complements the texture with details. In order to train these two models independently, the generation stream needs to be strictly separated. To achieve this goal, a semantic loss for tag prediction can be included in the Mani component of the system. This loss not only takes into account downstream decoding, but also makes it easier to capture the connection between text and images. CLIP is a visual and language representation learning model that is trained using 400 million image-text pairs. It demonstrates strong visual semantic alignment capabilities by achieving excellent performance on the objective of zeroshot image classification. It is optimized by a symmetric cross entropy loss performed across cosine similarities of multiple different images and text embeddings. The CLIP model can be used to guide tag prediction, for example through the following formula:

[0091]

[0092] where D is the cosine similarity between the CLIP embeddings of two parameters of CLIP, where gradient backpropagation is implemented through the straight-through estimator.

[0093] According to an embodiment of the present disclosure, a semantic alignment module can be used in the reasoning stage to locate image blocks that will be automatically changed by the input text. The semantic alignment module can be a two-step module, the first step is to locate the tag of each entity, and the second step is to select the text-related entities to be changed.

[0094] In the first step, entity segmentation can be used to identify each entity present in the initial image X. The segmentation is performed on the full size of the original image, where the purpose of using bilinear interpolation is to shrink the binary mask map of each entity to the same size as the latent feature map Q. Marks at the same position are considered to be part of the entity if the corresponding pixel has a value greater than zero.

[0095] The entity markers can be located by comparing the bilinear interpolation algorithm and the maximum pooling algorithm.

[0096] According to one embodiment of the present disclosure, the maximum pooling algorithm expands the signature of the bilinear interpolation.

[0097] According to another embodiment of the present disclosure, in order to obtain more accurate alignment, bilinear interpolation mapping of the segment mask and the marker mask may be used.

[0098] In the second step, appropriate entities can be selected based on the textual hints that will be set. In order to determine how well the image tags and text tags compare to each other, FILIP can be used, which is a CLIP-style model optimized by tag-level similarity. Entities with similarity scores greater than can be considered as entities related to the text.

[0099] References Figures 1 to 4 The following describes the example image generation 100 in which the device and / or method according to the embodiments of the present disclosure can be implemented, the image generation method 200 according to the embodiments of the present disclosure, the critical case image determination process 300 according to the embodiments of the present disclosure, and the entity-based semantic alignment process 400 according to the embodiments of the present disclosure. It should be understood that the above description is for better illustrating the contents recorded in the embodiments of the present disclosure, but is not limited in any way.

[0100] It should be understood that the numbers and sizes of various elements used in the embodiments of the present disclosure and in the various drawings are only examples, and are not intended to limit the protection scope of the embodiments of the present disclosure. The above numbers and sizes can be arbitrarily set as needed without affecting the normal implementation of the embodiments of the present disclosure.

[0101] Through the above reference Figures 1 to 4 According to the description of the embodiment of the present invention, a method for generating an image is proposed.

[0102] Specifically, the technical solution according to the embodiment of the present disclosure has many advantages over the traditional solution.

[0103] For example, unlike previous semantic image synthesis work that allows users to synthesize images with a certain number of semantic ideas associated with semantic tags, the technical solution of the present disclosure focuses on modifying the input image based on the input data 120, which can be more flexible and allow an unlimited number of semantic concepts.

[0104] In addition, another problem to be solved by the embodiments of the present disclosure is to train the model from scratch, rather than fine-tuning StyleGAN which is common in current data synthesis algorithms, which can make the whole process more flexible.

[0105] Figure 5 FIG. 5 shows a schematic block diagram of an example device 500 that can be used to implement an embodiment of the present disclosure. According to an embodiment of the present disclosure, Figure 1 The computing device 110 in the embodiment of the present invention can be implemented by the device 500. As shown in the figure, the device 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) 502 or computer program instructions loaded from a storage unit 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the device 500 can also be stored. The CPU 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0106] A number of components in the device 500 are connected to the I / O interface 505, including: an input unit 506, such as a keyboard, a mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 508, such as a disk, an optical disk, etc.; and a communication unit 509, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 509 allows the device 500 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0107] The various processes and processing described above, such as method 200, may be performed by processing unit 501. For example, in some embodiments, method 200 may be implemented as a computer software program, which is tangibly contained in a machine-readable medium such as storage unit 508. In some embodiments, part or all of the computer program may be loaded and / or installed on device 500 via ROM 502 and / or communication unit 509. When the computer program is loaded into RAM 503 and executed by CPU 501, one or more actions of method 200 described above may be performed.

[0108] Embodiments of the present disclosure may be directed to methods, devices, systems and / or computer program products. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for executing various aspects of the embodiments of the present disclosure.

[0109] Computer readable storage medium can be a tangible device that can keep and store the instructions used by the instruction execution device. Computer readable storage medium can be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples of computer readable storage medium as a non-exhaustive list include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, for example, a punch card or a convex structure in a groove on which instructions are stored, and any suitable combination thereof. The computer readable storage medium used here is not interpreted as an instantaneous signal itself, such as a radio wave or other freely propagating electromagnetic waves, for example, an electromagnetic wave propagated by a waveguide or other transmission medium of a light pulse of an optical fiber cable, or an electrical signal transmitted by a wire.

[0110] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.

[0111] The computer program instructions for performing the operation of the embodiments of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer via an Internet connection, for example, using an Internet service provider. In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be personalized by utilizing the state information of a computer-readable program instruction, and the electronic circuit may execute a computer-readable program instruction, thereby realizing various aspects of the embodiments of the present disclosure.

[0112] Various aspects of the embodiments of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices / systems, and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.

[0113] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0114] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0115] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the specified logical function. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or action, or can be implemented with a combination of special hardware and computer instructions.

[0116] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.

Claims

1. A method for generating an image, include: obtaining a collection of images, the collection of images comprising a first plurality of images usable for classification into at least two categories; determining a critical case image set among the image set, the critical case image set comprising a second plurality of images susceptible to being misclassified; training an image generator using at least some of the second plurality of images and guidelines associated with the at least some of the images; as well as Using the trained image generator, additional images are generated using a first image in the second plurality of images and additional guidelines, the additional guidelines being different from the guidelines.

2. The image generation method according to claim 1, wherein the critical case image set is determined in the image set include: The set of critical case images is determined using a distance-based surprise sufficiency method.

3. The image generation method according to claim 2, wherein the set of critical case images is determined using the distance-based unexpected sufficiency method. include: Based on the image set, determining an image classification space for the at least two categories; For a first image in the first plurality of images, determining a first Euclidean distance between the first image and other images belonging to the same category in the image classification space and a second Euclidean distance between the first image and images belonging to other categories in the image classification space; as well as It is determined whether the first image belongs to the critical case image set based on the first Euclidean distance and the second Euclidean distance.

4. The image generation method according to claim 3, wherein whether the first image belongs to the critical case image set is determined based on the first Euclidean distance and the second Euclidean distance. include: Whether the first image belongs to the critical case image set is determined based on a ratio of the first Euclidean distance to the second Euclidean distance.

5. The image generation method according to claim 1, wherein the guideline comprises at least one of the following: Graphical instructions; and Text instructions.

6. The image generation method according to claim 1, further comprising: include: obtaining a cue associated with the first image in the second plurality of images; generating a processed first image using the first image and the prompt; and Generating the additional image using the first image in the second plurality of images and the additional guidance includes: The additional image is generated using the processed first image and the additional guidelines.

7. The image generation method according to claim 6, wherein the prompt comprises at least one of the following: Graphical prompts; and Text prompt.

8. The image generation method of claim 6, wherein the first image includes an entity, and wherein the prompt is associated with the entity.

9. The image generation method of claim 8, wherein the first image and the hint are used to generate a processed first image. include: The entity is removed from the first image based on the hint.

10. An electronic device, include: at least one processing unit; as well as at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions, when executed by the at least one processing unit, causing the apparatus to perform actions comprising: obtaining a collection of images, the collection of images comprising a first plurality of images usable for classification into at least two categories; determining a critical case image set among the image set, the critical case image set comprising a second plurality of images susceptible to being misclassified; training an image generator using at least some of the second plurality of images and guidelines associated with the at least some of the images; and Using the trained image generator, additional images are generated using a first image in the second plurality of images and additional guidelines, the additional guidelines being different from the guidelines.

11. The electronic device according to claim 10, wherein the critical case image set is determined in the image set include: The set of critical case images is determined using a distance-based surprise sufficiency method.

12. The electronic device of claim 11, wherein the set of critical case images is determined using the distance-based surprise sufficiency method. include: Based on the image set, determining an image classification space for the at least two categories; For a first image in the first plurality of images, determining a first Euclidean distance between the first image and other images belonging to the same category in the image classification space and a second Euclidean distance between the first image and images belonging to other categories in the image classification space; as well as It is determined whether the first image belongs to the critical case image set based on the first Euclidean distance and the second Euclidean distance.

13. The electronic device according to claim 12, wherein whether the first image belongs to the critical case image set is determined based on the first Euclidean distance and the second Euclidean distance. include: Whether the first image belongs to the critical case image set is determined based on a ratio of the first Euclidean distance to the second Euclidean distance.

14. The electronic device according to claim 10, wherein the instruction comprises at least one of the following: Graphical instructions; and Text instructions.

15. The electronic device according to claim 10, further comprising: include: obtaining a cue associated with the first image in the second plurality of images; generating a processed first image using the first image and the prompt; and Generating the additional image using the first image in the second plurality of images and the additional guidance includes: The additional image is generated using the processed first image and the additional guidelines.

16. The electronic device according to claim 15, wherein the prompt comprises at least one of the following: Graphical prompts; and Text prompt.

17. The electronic device of claim 15, wherein the first image comprises an entity, and wherein the prompt is associated with the entity.

18. The electronic device of claim 17, wherein the first image and the hint are used to generate a processed first image. include: The entity is removed from the first image based on the hint.

19. A computer program product tangibly stored on a non-transitory computer readable medium and comprising machine executable instructions which, when executed, cause a machine to perform the steps of the method according to any one of claims 1 to 9.