Image generation method, medium, computer device and program product

Automatically generate image perspective conversion through text generation image model, which solves the high complexity and cost problems that traditional three-dimensional modeling relies on, and achieves efficient automation and realism improvement of image perspective conversion.

CN118747780APending Publication Date: 2024-10-08DIVINE VISION (SHENZHEN) CULTURE TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202410808767.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-20
Publication Date
2024-10-08

AI Technical Summary

Technical Problem

Traditional image perspective conversion technology relies on complex three-dimensional modeling and rendering, resulting in high complexity and cost, making it difficult to achieve efficient perspective conversion.

Method used

The text generation image model is used to automatically generate text prompt information by obtaining the characteristics of the image area, and convert the image perspective, avoiding the three-dimensional modeling step and reducing the complexity and cost.

Benefits of technology

It realizes the automation of image perspective conversion, lowers the technical threshold, improves processing efficiency and the realism of generated images, and is suitable for the needs of multiple industries.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118747780A_ABST
    Figure CN118747780A_ABST
Patent Text Reader

Abstract

The invention discloses an image generation method, a medium, computer equipment and a program product. The method comprises the following steps: acquiring an input image; the input image comprises a first image area corresponding to a first object; obtaining a first feature of the first image area, and generating first text prompt information used for describing the first feature; converting the first text prompt information into a first output image including the first object through a pre-trained text generation image model; wherein the viewing angle of the first object in the input image is different from the viewing angle of the first object in the first output image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present specification relates to the field of image processing technology, and in particular to image generation methods, media, computer devices, and program products. Background Art

[0002] In the field of modern image processing and computer vision, image perspective transformation is a research direction with broad application prospects. Image perspective transformation refers to the transformation of objects in an image from one perspective to another. Traditional image perspective transformation usually relies on complex 3D modeling and rendering technology, which is relatively complex and costly. Summary of the invention

[0003] In a first aspect, an embodiment of the present specification provides an image generation method, the method comprising: obtaining an input image; including a first image area corresponding to a first object in the input image; obtaining a first feature of the first image area, and generating first text prompt information for describing the first feature; converting the first text prompt information into a first output image including the first object through a pre-trained text generation image model; wherein a perspective of the first object in the input image is different from a perspective of the first object in the first output image.

[0004] In a second aspect, an embodiment of this specification provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in any embodiment of this specification.

[0005] In a third aspect, an embodiment of this specification provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in any embodiment of this specification when executing the program.

[0006] In a fourth aspect, an embodiment of this specification provides a computer program product, including a computer program, which implements the method described in any embodiment of this specification when executed by a processor.

[0007] In an embodiment of the present specification, after acquiring an input image, the first feature of the first image region (i.e., the image region corresponding to the first object) in the input image is first acquired, and then the first text prompt information used to describe the first feature is inferred, and then the first text prompt information is converted into a first output image using a text-generated image model, and the perspective of the first object in the first output image is different from the perspective of the first object in the input image. The above method uses a text-generated image method to convert the perspective of the first object, without the need to perform three-dimensional modeling on the first object; in addition, the above method does not require the user to manually generate prompt information for prompting the text-generated image model, but automatically infers the first text prompt information based on the first feature of the first image region to prompt the text-generated image model to automatically generate an image, thereby reducing the complexity and cost of image perspective conversion.

[0008] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present specification. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the specification and are used together with the specification to illustrate the technical solutions of the specification.

[0010] Figure 1A and Figure 1B They are schematic diagrams of application scenarios of the embodiments of this specification.

[0011] Figure 2 It is a flowchart of the image generation method of the embodiment of this specification.

[0012] Figure 3 It is a schematic diagram of a user interface of an embodiment of this specification.

[0013] Figure 4 It is a schematic diagram of the perspective conversion process of the target object in the embodiment of this specification.

[0014] Figure 5 It is a schematic diagram of the training process of the text-to-image model of the embodiment of this specification.

[0015] Figure 6 is a schematic diagram of a computer device according to an embodiment of the present specification. DETAILED DESCRIPTION

[0016] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with this specification. Instead, they are merely examples of devices and methods consistent with some aspects of this specification as detailed in the appended claims.

[0017] The terms used in this specification are only for the purpose of describing specific embodiments and are not intended to limit this specification. The singular forms of "a", "said" and "the" used in this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in this article refers to and includes any or all possible combinations of one or more associated listed items. In addition, the term "at least one" herein means any combination of at least two of any one or more of a plurality of.

[0018] It should be understood that although the terms first, second, third, etc. may be used in this specification to describe various information, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of this specification, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0019] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of this specification and to make the above-mentioned purposes, features and advantages of the embodiments of this specification more obvious and understandable, the technical solutions in the embodiments of this specification are further described in detail below in conjunction with the accompanying drawings.

[0020] In related technologies, it is necessary to transform an object in an image from one perspective to another. This image processing method is called image perspective transformation. Figure 1A In the embodiment shown, the object in the image is a human face. By transforming the image perspective, the frontal face image can be transformed into a side face image, such as a 45° side face image, a 90° side face image, etc., or a side face image (such as a 45° side face image) can be transformed into another side face image at a different angle (such as a 90° side face image) and / or a frontal face image. For another example, in Figure 1BIn the illustrated embodiment, the object in the image is the whole body of a person. By transforming the image perspective, the front full-body image of the person can be transformed into a side full-body image and / or a back full-body image of the person, or the side full-body image of the person can be transformed into a front full-body image and / or a back full-body image of the person, or the back full-body image of the person can be transformed into a side full-body image and / or a front full-body image of the person.

[0021] In the related art, when performing image perspective transformation, it is first necessary to perform 3D modeling on the object to be transformed to obtain the 3D model of the object, then determine the parameters of the camera, perform perspective transformation on the 3D model obtained by 3D modeling based on the parameters of the camera, and then render the 3D model under the camera perspective to obtain the image of the object under a specific perspective. The above method is highly complex and requires a lot of time and computing resources, and is costly.

[0022] Based on this, the embodiment of this specification provides an image generation method, which transforms the image perspective by generating an image through text. The specific implementation method of the embodiment of this specification is described below by example.

[0023] like Figure 2 As shown, the image generation method of the embodiment of this specification includes:

[0024] Step S2: acquiring an input image; the input image includes a first image area corresponding to a first object;

[0025] Step S4: obtaining a first feature of the first image area, and generating first text prompt information for describing the first feature;

[0026] Step S6: converting the first text prompt information into a first output image including a first object through a pre-trained text-to-image model; wherein a viewing angle of the first object in the input image is different from a viewing angle of the first object in the first output image.

[0027] The embodiment of the present specification automatically infers the first text prompt information based on the first feature of the first image area, and then uses the first text prompt information as the prompt information of the text generation image model to prompt the text generation image model to generate the first output image under different perspectives. Since the first prompt information is automatically inferred based on the first feature of the first image area, and no three-dimensional modeling is required during the perspective transformation process, the image generation method of the embodiment of the present specification can effectively reduce the complexity and cost of image perspective conversion.

[0028] In step S12, an input image may be obtained. The input image may be an image obtained in real time, or an image obtained and stored in advance. The input image may be an image actually collected by an image acquisition device, a synthesized digital image, or a hand-drawn image. In different application scenarios, the input image may be obtained in different ways. For example, in a game scenario, a screenshot of the game screen may be taken to obtain an input image; in an animation scenario, the screen in the animation may be obtained by hand-drawing, screenshots, etc., and the obtained screen may be used as an input image; in an architectural design scenario, the input image may be drawn by drawing software. In other examples, the input image may also have other types and acquisition methods, which are not listed here one by one. The number of input images may be greater than or equal to 1. When the number of input images is greater than 1 (for example, the input image includes multiple video frames in a video stream), each input image may be processed in the same processing manner. Therefore, the following description takes the processing process of a single input image as an example.

[0029] The input image may include a first image area corresponding to a first object. The first object may be an object of any category, such as a human face, a human body, an animal body part, a plant, a game prop, a container, a packaging bag, etc. For ease of understanding and explanation, the following example is taken as an example where the first object is a human face. The number of first objects in the input image may be greater than or equal to 1. When the number of first objects in the input image is greater than 1, the categories of different first objects may be the same or different. In some embodiments, an object in a specified area (e.g., a central area) in the input image, an object of a specified category, or an object specified by a user may be determined as a first object. Other methods may also be used to determine the first object from the input image, and this specification does not limit this.

[0030] In step S14, a first feature of the first image area can be obtained. The first feature may include but is not limited to the color, brightness, size, material, style, shape, position, perspective, quantity, action, expression, texture, age, gender, etc. of the first object in the input image. The first image area can be feature extracted by a feature extraction model to obtain the first feature of the first image area. The feature extraction model can be a neural network of the type of Convolutional Neural Network (CNN), Recurrent Neural Network (RNN), Transformer model, etc. Furthermore, before the first image area is feature extracted, the first image area can be cropped out from the first image.

[0031] After obtaining the first feature of the first image area, a first text prompt information for describing the first feature can be generated. In some embodiments, the first text prompt information can be generated by using an image captioning (IC) technology. Specifically, the first feature can be input into an image captioning generation model, and the first feature can be converted into the first text prompt information by using the above image captioning generation model. The image captioning generation model can be trained based on a sample image and its corresponding sample text information, wherein the sample text information corresponding to the sample image is used to describe the features of the object in the sample image. The image captioning generation model can include an encoder and a decoder, and the encoder is used to convert the features of the sample image into a sample feature vector, and the sample feature vector is input into the decoder. The decoder is used to predict the output text information based on the sample feature vector. During the training process, the parameters of the encoder and the decoder can be adjusted so that the output text information predicted by the decoder is as close as possible to the sample text information. After the image captioning generation model is trained, the image captioning generation model can be used to convert the first feature into the first text prompt information. The above process uses the image captioning generation model to automatically infer the first feature of the first image area into the first text prompt information, without the need for the user to manually generate the first text prompt information, thereby reducing the user's operation complexity and improving the processing efficiency.

[0032] In step S16, intelligent perspective reasoning (i.e., reasoning about the appearance changes of the first object under different perspectives) can be performed through the text generation image model, so as to convert the first text prompt information into a first output image including the first object. The generated first output image can be applied to multiple fields such as game development, virtual reality, augmented reality, e-commerce, industrial design, etc. to meet the needs of different industries. For example, in the field of e-commerce, e-commerce platforms can display products from multiple perspectives to enhance the user's shopping experience, thereby increasing the user's willingness to buy; in the field of game development, game and VR / AR developers can use the image generation method of this manual to quickly obtain multi-perspective materials and improve development efficiency.

[0033] The embodiment of this specification first converts the input image into text prompt information, and then converts the prompt information into the first output image, realizing the image perspective conversion based on the image-text-image processing flow. Compared with the method of using three-dimensional modeling to realize image perspective conversion in the related art, the user only needs to input the image to realize the one-key conversion of the image perspective, realizing the automated workflow, without the need for complex three-dimensional modeling operations, reducing the technical threshold of image perspective conversion, reducing the dependence on professional three-dimensional modelers and complex modeling software, and effectively reducing the complexity and cost of image perspective conversion. Further, the input image can also be input into the text generation image model so that the text generation image model converts the first text prompt information into a first output image including the first object based on the input image. In this way, the input image can be used as a reference, so as to better retain the details and structure of the input image, improve the realism of the generated first output image and the consistency between the first output image and the input image. In addition, since the process of text generation image refers to the input image, the first output image can also be generated more quickly, improving the efficiency of text generation image, thereby improving the efficiency of image perspective conversion.

[0034] In some embodiments, the number of first output images may be greater than or equal to 1. When the number of first output images is greater than 1, the first objects in different first output images may have different perspectives. A text generation image model capable of outputting one or more perspectives may be trained according to actual needs, and at least one first output image may be output through the above text generation image model. For example, in the case where the first object is a face, a text generation image model capable of outputting a frontal face image, a 45° left face image, a 90° left face image, a 45° right face image, and a 90° right face image may be trained. Assuming that the input image is a frontal face image, at least one of a 45° left face image, a 90° left face image, a 45° right face image, and a 90° right face image may be used as the first output image. This embodiment can quickly generate multiple first output images of different perspectives based on one input image, effectively improving the efficiency of image generation and processing. In addition, since multiple first output images are generated based on the same input image, it is possible to maintain style uniformity, ensure coherent and beautiful visual effects, reduce the need for manual adjustment and correction, and be applicable to various artistic creation and design scenarios while ensuring that the content in the multiple first output images is consistent.

[0035] Optionally, a preset number of first output images may be obtained, and the image model may output the preset number of first output images. The preset number may be set by a user. Figure 3As shown, a user interface 10 can be provided, and the user can input or select the preset number of first output images on the user interface 10. The above method allows the user to independently select the number of first output images according to actual needs, thereby improving the adaptability of the image perspective conversion result to the user's needs. In addition, the user only needs to input an image to realize the conversion of one input image into multiple first output images, which effectively improves the efficiency of image perspective conversion.

[0036] In some embodiments, the user may also select the viewing angle of the first object in the first output image. Figure 3 , options 20 corresponding to multiple candidate perspectives of images that can be generated by the text generation image model can be displayed, at least one target option selected by the user from the options 20 corresponding to the above multiple candidate perspectives can be obtained, and the candidate perspective corresponding to at least one target option can be determined as the perspective of the first object in the first output image. Assuming that the input image is a 45° left-side face image, and the images that can be generated by the text generation image include a front face image, a 90° left-side face image, a 45° right-side face image, and a 90° right-side face image, then options corresponding to the front face image, options corresponding to the 90° left-side face image, options corresponding to the 45° right-side face image, and options corresponding to the 90° right-side face image can be provided on the user interface 10. Assuming that the target option selected by the user includes an option corresponding to the front face image, a first output image including the front face image can be generated.

[0037] It is understood that the method for determining the first output image described in the above embodiment is only an exemplary description. In other embodiments, at least one first output image may be randomly selected from the images output by the text generation image model, or the first output image may be determined in other ways, which will not be listed one by one in this specification.

[0038] In some embodiments, the first object may be a sub-object on the target object. That is, the first object is a local area on another object (i.e., the target object). For example, the target object is the whole body of a person, and the first object is the face of the person; or the target object is a tree, and the first object is a branch; or the target object is a watch, and the first object is a dial. The target object and the first object may also be objects of other categories, which are not listed one by one in this specification. On this basis, a second output image of the target object including a second preset viewing angle may also be generated, and then the image area corresponding to the first object in the second output image may be replaced with the image area corresponding to the first object in the first output image.

[0039] See also Figure 4, the second output image can be directly obtained by text generation. Specifically, the second text prompt information for describing the second feature of the target object can be obtained first (step S22), and then the second text prompt information can be converted into a second output image of the target object including a second preset perspective and having the second feature through a pre-trained text generation image model (step S24). The text generation model used to obtain the second output image can be the same model as the text generation model used to obtain the first output image, or it can be a different model. The second text prompt information can be input by the user. See more Figure 3 , a user interface 10 may be provided, and the user interface 10 may include an input component 30, in which the user may input the second text prompt information. The second feature described by the second text prompt information may include but is not limited to the color, brightness, size, material, style, shape, position, quantity, action, expression, texture, age, gender, etc. of the target object. The second feature described by the second text prompt information may also include the above-mentioned second preset viewing angle. In other words, the user can directly specify the second preset viewing angle of the target object by inputting the second text prompt information. Of course, this is only one way to determine the second preset viewing angle. In addition, the second preset viewing angle can also be selected by the user from multiple candidate viewing angles, or a default viewing angle is used as the second preset viewing angle, or determined in other ways. In this embodiment, a second output image including the target object is generated directly by generating an image through text, so that the generated second output image is only restricted by the second text prompt information, but not by the input image, thereby improving the diversity and flexibility of the generated second output image.

[0040] In some embodiments, the number of second output images may be greater than or equal to 1. When the number of second output images is greater than 1, the target object in different second output images may have different perspectives. For example, in the case where the target object is the whole body of a person, the second output image may include a front full-body image, a side full-body image, and a back full-body image of the person. A preset number of second output images may be obtained, and the text generation image model outputs a preset number of second output images. The user may also select the perspective of the target object in the second output image. The method of obtaining multiple second output images is similar to the method of obtaining multiple first output images, and will not be repeated here.

[0041] Continue to see Figure 4, after acquiring the second output image, the image area corresponding to the first object in the second output image can be replaced with the image area corresponding to the first object in the first output image (step S26). Specifically, the second output image can be segmented to determine the image area corresponding to the first object in the second output image. Then, the image area corresponding to the first object in the first output image is subjected to image processing such as cropping, scaling and / or rotation, and the processed image area is replaced with the image area corresponding to the first object in the second output image. The embodiment of this specification adopts the method of generating an image by text to acquire the second output image including the target object, so that the global features of the target object in the second output image can be determined quickly and flexibly. However, the angle of the first object in the above-mentioned second output image may not be accurate enough. Therefore, this specification adopts the image area corresponding to the first object in the first output image to locally replace the image area corresponding to the first object in the second output image, so that the perspective of the first object on the target object can be more accurately transformed to the perspective desired by the user.

[0042] Further, after the image area corresponding to the first object in the second output image is replaced with the image area corresponding to the first object in the first output image, the perspective of the first object in the replaced second output image may not match the perspective of the target object in the replaced second output image, resulting in the overall perspective of the target object not looking reasonable. For example, when the target object is the whole body of a person and the first object is a face, the face may face left while the whole body of the person faces right. To solve the above problem, a constraint relationship between the perspective of the first object in the replaced second output image and the perspective of the target object in the replaced second output image may be preset. For example, the constraint relationship may be that the difference between the perspective of the first object in the replaced second output image and the perspective of the target object in the replaced second output image is less than a preset angle threshold. If the perspective of the first object in the replaced second output image and the perspective of the target object in the replaced second output image do not satisfy the above constraint relationship, a prompt message may be output to prompt the user to adjust the second preset perspective of the target object in the second output image and / or adjust the perspective of the first object in the first output image.

[0043] In some embodiments, the text generation image model can be trained in advance. Figure 5The training method of the text generation image model is illustrated. First, a sample image set can be obtained (step S32), which includes multiple sample images of the same sample object, and the sample objects in different sample images are at different perspectives. For the convenience of description, the multiple sample images are divided into a first sample image and at least one second sample image. At least one output sample image output by the initial text generation image model based on the first sample image can be obtained, and the at least one output sample image corresponds to the at least one second sample image. Then, a first loss can be determined based on the feature similarity between the at least one second sample image and the corresponding output sample image (step S34), a second loss can be determined based on the authenticity of the at least one output sample image (step S36), and a third loss can be determined based on the perspective similarity between the sample object in the at least one second sample image and the sample object in the corresponding output sample image (step S38), and based on the first loss, the second loss and the third loss, the initial text generation image model is trained to obtain a text generation image model (step S40).

[0044] In the above embodiment, by obtaining the first loss, the similarity between the output sample image and the corresponding second sample image in the feature space can be ensured, which helps the output sample image generated by the text generation image model to be as close to the second sample image as possible in content, thereby maintaining the accuracy and consistency of the generated image. By obtaining the second loss, the image generated by the text generation image can be made more realistic and real. Optionally, the text generation image model can be a generative adversarial network (GAN), including a generator and a discriminator, the generator can be used to generate the output sample image, and the discriminator can be used to discriminate the authenticity of the output sample image generated by the generator. The effect of the second loss can be to make the discriminator's discriminant accuracy of the authenticity of the output sample image generated by the generator as close to 0.5 as possible (that is, the discriminator cannot tell whether the output sample image generated by the generator is a real image). By obtaining the third loss, it can be ensured that the output sample image generated by the text generation image model is similar to the object perspective in the second sample image in terms of perspective. For example, each of at least one output sample image is similar to the object perspective in the second sample image of the corresponding perspective. By using the above-mentioned first loss, second loss and third loss to train the initial text generation image model (i.e., the untrained text generation image model), the trained text generation image model can generate multiple relatively realistic multi-view images. Among them, the specific forms of the first loss, the second loss and the third loss can be selected as needed and are not limited here.

[0045] In some embodiments, the first object includes multiple sub-objects, and the first text prompt information includes text prompt information corresponding to the multiple sub-objects and text prompt information corresponding to the first object. Each sub-object may be an object in a local area on the first object. For example, when the first object is a human face, the multiple sub-objects may be facial features (such as eyes, lips, nose, and ears). For another example, when the first object is a branch, the multiple sub-objects may be multiple leaves on the branch. When the first object is a car, the multiple sub-objects may include wheels, body, windows, lights, front and rear bumpers, and other parts. When the first object is a building, the multiple sub-objects may include structural components such as windows, doors, roofs, pillars, and balconies. The first object and the multiple sub-objects may also be other categories, which are not listed here one by one. The text prompt information corresponding to the first object may describe the global features of the first object, and the text prompt information corresponding to the multiple sub-objects may describe the local features of each sub-object. For example, when the first object is a human face and the multiple sub-objects include eyes and a nose, the text prompt information corresponding to the first object may describe the face shape, skin color, chin and cheekbones, beard, moles or spots, and age of the human face; the text prompt information corresponding to the eyes may describe the shape of the eyes, pupil size, eye color, the position of the eyes on the face, eyelash length, whether the eyelids are single, the depth of the eye sockets, the distance between the eyebrows and the eyes, etc.; the text prompt information corresponding to the nose may describe the overall shape of the nose, the shape of the nose bridge, the size of the nostrils, the thickness of the nose wings, etc. By using the text prompt information corresponding to the first object and the text prompt information corresponding to the multiple sub-objects respectively, the first object can be accurately described both in the whole and in the part, thereby improving the accuracy and vividness of the first object in the first output image.

[0046] An object model corresponding to the perspective of the first object in the first output image (hereinafter referred to as the first preset perspective) can be pre-generated, and the object model is used to describe the perspective information of multiple sub-objects on the first object when the first object is at the first preset perspective. For example, when the first object is a face and the multiple sub-objects are facial features on the face, object models such as a frontal face model, a 45° side face model, and a 90° side face model can be pre-generated. Taking the frontal face model as an example, the frontal face model is used to describe the perspective information of the facial features on the face when the face is a frontal face. In some embodiments, the object model is a set of angle information, such as {θ1, θ2, θ3, ...}, where θ1 represents the angle of the face, and θ2, θ3, ... represent the angles of the facial features. Compared with the three-dimensional model of the face, which needs to describe the geometric information and normal information of each vertex on the face, the above object model only needs to describe the angle information of the entire face and the angle information of each facial feature, and the complexity is relatively low.

[0047] When performing image perspective conversion, an object model corresponding to the first preset perspective can be obtained, an image area corresponding to the first object can be generated based on the text prompt information corresponding to the first object, and image areas corresponding to multiple sub-objects can be generated based on the text prompt information corresponding to the multiple sub-objects. Based on the object model corresponding to the first preset perspective, the image area corresponding to the first object and the image areas corresponding to the multiple sub-objects can be adjusted for perspective, so as to obtain a first output image of the first object including the first preset perspective. Continuing with the previous example, a face area can be generated based on the text prompt information corresponding to the face, an image area corresponding to the eyes can be generated based on the text prompt information corresponding to the eyes, and an image area corresponding to the nose can be generated based on the text prompt information corresponding to the nose. Based on the object model corresponding to the first preset perspective, the face area, the image area corresponding to the eyes, and the image area corresponding to the nose can be adjusted for perspective. Specifically, the angle information corresponding to the face in the object model can be obtained, and the perspective of the face can be adjusted based on the angle information corresponding to the face; the angle information corresponding to each facial feature in the object model can also be obtained, and the perspective of each facial feature can be adjusted based on the angle information corresponding to each facial feature. See more Figure 3 For the convenience of user processing, the visualization images corresponding to each object model can be displayed on the user interface 10, and the user can select the object model corresponding to the first preset perspective by selecting the visualization image. For example, if the user selects the visualization image of the object model corresponding to the 45° side face, the face area, the image area corresponding to the eyes, and the image area corresponding to the nose can be adjusted to the perspective corresponding to the 45° side face.

[0048] In some embodiments, after obtaining the first output image, the first output image can also be input into a pre-trained super-resolution reconstruction model to obtain a super-resolution output image. The resolution of the super-resolution output image is higher than the resolution of the first output image. Through the above method, the clarity and detail of the first output image can be improved, making the first output image look more realistic and detailed, and it is also convenient to enlarge the image to a larger size while maintaining the image quality, so as to facilitate high-quality printing, display, advertising design and other processing of the image.

[0049] In some embodiments, the image parameters selected by the user can also be obtained, and the first text prompt information is converted into a first output image including the first object and having the image parameters through a pre-trained text generation image model. The image parameters may include but are not limited to at least one of the following: style, resolution, quantity, aspect ratio, and viewing angle of the first object in the first output image. A user interface 10 can be provided, and the user can select or input the corresponding image parameters in the user interface 10. In this way, the diversity of the generated first output image can be improved, so that the first output image better meets the needs of users.

[0050] An embodiment of the present specification also provides a computer device, which at least includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method described in any of the above embodiments is implemented.

[0051] Figure 6 A more specific hardware structure diagram of a computer device provided in an embodiment of this specification is shown, and the device may include: a processor 202, a memory 204, an input / output interface 206, a communication interface 208, and a bus 210. The processor 202, the memory 204, the input / output interface 206, and the communication interface 208 are connected to each other through the bus 210 in the device.

[0052] The processor 202 can be implemented by a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, etc., for executing relevant programs to implement the technical solutions provided in the embodiments of this specification. The processor 202 can also include a graphics card, which can be a Nvidia titan X graphics card or a 1080Ti graphics card, etc.

[0053] The memory 204 can be implemented in the form of a read-only memory (ROM), a random access memory (RAM), a static storage device, a dynamic storage device, etc. The memory 204 can store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program codes are stored in the memory 204 and are called and executed by the processor 202.

[0054] The input / output interface 206 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.

[0055] The communication interface 208 is used to connect a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).

[0056] The bus 210 comprises a pathway for transmitting information between the various components of the device, such as the processor 202 , the memory 204 , the input / output interface 206 , and the communication interface 208 .

[0057] It should be noted that, although the above device only shows the processor 202, the memory 204, the input / output interface 206, the communication interface 208 and the bus 210, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include the components necessary for implementing the embodiments of the present specification, and does not necessarily include all the components shown in the figure.

[0058] An embodiment of the present specification provides a computer program product, including a computer program. When the computer program is executed by a processor, the method described in any embodiment of the present specification is implemented.

[0059] The embodiments of the present specification also provide a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method described in any of the above embodiments is implemented.

[0060] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computer device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0061] Each embodiment in this specification is described in a progressive manner, and the same and similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described above is merely schematic, wherein the modules described as separate components may or may not be physically separated, and the functions of each module can be implemented in the same one or more software and / or hardware when implementing the embodiment scheme of this specification. It is also possible to select some or all of the modules according to actual needs to achieve the purpose of the embodiment scheme. A person of ordinary skill in the art can understand and implement it without paying creative labor.

[0062] The above is only a specific implementation of the embodiments of this specification. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the embodiments of this specification. These improvements and modifications should also be regarded as the protection scope of the embodiments of this specification.

Claims

1. A method for generating an image, the method comprising: Get the input image; The input image includes a first image area corresponding to a first object; Acquire a first feature of the first image area, and generate first text prompt information for describing the first feature; The first text prompt information is converted into a first output image including the first object through a pre-trained text-to-image model; wherein a perspective of the first object in the input image is different from a perspective of the first object in the first output image.

2. The method according to claim 1, wherein the first object is a sub-object of a target object; the method further comprises: generating a second output image of the target object including a second preset viewing angle; An image region in the second output image corresponding to the first object is replaced by an image region in the first output image corresponding to the first object.

3. The method according to claim 2, wherein generating a second output image of the target object at a second preset viewing angle comprises: Acquire second text prompt information for describing a second feature of the target object; The second text prompt information is converted into a second output image of the target object including a second preset viewing angle and having the second feature through a pre-trained text-to-image model.

4. The method according to claim 1, further comprising: Displaying options corresponding to multiple candidate perspectives of an image that can be generated by the text-generated image model; Obtaining at least one target option selected by a user from the options respectively corresponding to the multiple candidate perspectives; The candidate viewing angles respectively corresponding to the at least one target option are determined as the viewing angles of the first object in the first output image.

5. The method according to claim 4, wherein the text-to-image model is used to convert the first text prompt information into a plurality of first output images including the first object, wherein: The perspectives of the first object in different first output images are different; and the method further includes: Acquire a sample image set, wherein the sample image set includes multiple sample images of the same sample object, the sample object in different sample images is at different viewing angles, and the multiple sample images include a first sample image and at least one second sample image; Obtain at least one output sample image output by the initial text generation image model based on the first sample image; the at least one output sample image corresponds one-to-one to the at least one second sample image; determining a first loss based on a feature similarity between the at least one second sample image and the corresponding output sample image; determining a second loss based on the authenticity of the at least one output sample image; determining a third loss based on a perspective similarity between the sample object in the at least one second sample image and the sample object in the corresponding output sample image; Based on the first loss, the second loss and the third loss, the initial text-to-image model is trained to obtain the text-to-image model.

6. The method according to claim 1, wherein the first object includes a plurality of sub-objects, the first text prompt information includes text prompt information corresponding to the plurality of sub-objects and text prompt information corresponding to the first object; and the text generation image model converts the first text prompt information into a first output image including the first object based on the following method: Acquire an object model corresponding to a first preset viewing angle, where the object model is used to describe viewing angle information of a plurality of sub-objects on the first object when the first object is at the first preset viewing angle; The first preset viewing angle is a viewing angle of the first object in the first output image; generating an image region corresponding to the first object based on the text prompt information corresponding to the first object, and generating image regions corresponding to the plurality of sub-objects based on the text prompt information corresponding to the plurality of sub-objects; Based on the object model corresponding to the first preset viewing angle, the viewing angle of the image area corresponding to the first object and the image areas corresponding to the multiple sub-objects are adjusted to obtain a first output image of the first object including the first preset viewing angle.

7. The method according to claim 6, wherein the first object is a human face, and the multiple sub-objects included in the first object are facial features of the human face.

8. The method according to claim 1, further comprising: Inputting the first output image into a pre-trained super-resolution reconstruction model to obtain a super-resolution output image; The resolution of the super-resolution output image is higher than the resolution of the first output image.

9. The method according to claim 1, wherein converting the first text prompt information into a first output image including the first object by using a pre-trained text-to-image model comprises: Get the image parameters selected by the user; The first text prompt information is converted into a first output image including the first object and having the image parameters through a pre-trained text-to-image model.

10. The method according to claim 1, wherein converting the first text prompt information into a first output image including the first object by using a pre-trained text-to-image model comprises: Obtaining a preset number of the first output images; The first text prompt information is converted into the preset number of first output images through a pre-trained text-to-image model, wherein the first object in different first output images has different viewing angles.

11. A computer-readable storage medium having a computer program stored thereon, wherein when the program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.

12. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 10 when executing the program.

13. A computer program product, comprising a computer program, which implements the method according to any one of claims 1 to 10 when executed by a processor.

Citation Information

Patent Citations

  • Image processing method and device, mobile terminal and storage medium

    CN110266926A

  • Image generation method and device, electronic equipment and storage medium

    CN117115306A

  • Semantic perception multi-view three-dimensional human body reconstruction method and device and medium

    CN117292041A

  • NeRF model construction method and device, equipment and storage medium

    CN117592511A

  • Three-dimensional image generation method, three-dimensional figure image generation method and computing device

    CN118115706A