Panorama processing method, server, storage medium and program product
By deforming the image and stretching and filling in the panorama generation technology, combined with the image generation model, the problem of poor controllability in existing panorama generation is solved, and the generation results are more closely matched to user needs.
Patent Information
- Application Number
- CN202410516822.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-26
- Publication Date
- 2024-09-06
AI Technical Summary
Existing panorama generation solutions have poor controllability, and the generated results often do not meet user needs. Even if users repeatedly adjust the text description, it is difficult to obtain satisfactory results.
By obtaining the reference image and description text, the image is deformed, stretched and filled, and the transformed image and mask image are generated, and input into the image generation model to generate a panorama that meets the user's needs.
The controllability of the panorama is significantly improved, making the generated image more consistent with the reference image content and description text description given by the user, and meeting the user's specific needs.
Smart Images

Figure CN118608653A
Abstract
Description
Technical Field
[0001] The present application relates to computer technology, and in particular to a method, server, storage medium and program product for panoramic image processing. Background Art
[0002] In recent years, with the rapid development of artificial intelligence (AIGC) technology, the digital industry has been booming, and the intelligent generation of image content has greatly improved the work efficiency of related industries. Compared with conventional images, 360 panoramas contain more image content and have key uses in virtual reality / augmented reality (VA / AR), game production, interior / garden design and other fields.
[0003] The current panorama generation scheme generates panoramas based on text descriptions provided by users. The generation results only depend on the text descriptions and have poor controllability. The generated panoramas are often far from user needs. Even if users repeatedly adjust and improve the text descriptions, they may not be able to generate panoramas that meet user needs. Summary of the invention
[0004] The present application provides a method, server, storage medium and program product for processing a panoramic image, so as to solve the problem that the controllability of the panoramic image generation is poor and the generation result does not meet the user's requirements.
[0005] In a first aspect, the present application provides a panoramic image processing method, comprising:
[0006] Get the given reference image and description text;
[0007] Deforming and stretching the reference image to obtain a transformed image of the reference image, and obtaining a mask image corresponding to the transformed image;
[0008] The description text, the transformation image and the mask image are input into an image generation model, and a panoramic image is generated according to the description text, the transformation image and the mask image by the image generation model.
[0009] The second aspect is a panoramic image processing method, including:
[0010] A panoramic image generation request sent by a receiving end-side device, wherein the panoramic image generation request includes a given reference image and a description text;
[0011] Deforming and stretching the reference image to obtain a transformed image of the reference image, and obtaining a mask image corresponding to the transformed image;
[0012] Inputting the description text, the transformation image and the mask image into an image generation model, and generating a panoramic image according to the transformation image and the mask image through the image generation model;
[0013] The panoramic image is output to the terminal device.
[0014] In a third aspect, the present application provides a server, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the server executes a method provided in any of the preceding aspects.
[0015] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the method provided in any of the aforementioned aspects is implemented.
[0016] In a fifth aspect, the present application provides a computer program product, including a computer program, which implements the method provided in any of the above aspects when executed by a processor.
[0017] The method, server, storage medium and program product for processing a panoramic image provided by the present application obtain a given reference image and a description text of a panoramic image to be generated, deform and stretch and fill the reference image to obtain a transformed image of the reference image, and obtain a mask image corresponding to the transformed image, input the description text, the transformed image and the mask image into an image generation model, and generate a panoramic image according to the transformed image and the mask image through the image generation model. The panoramic image is generated based on the given reference image and the description text, so that the generated panoramic image is based on the content of the reference image given by the user and conforms to the description of the description text given by the user, and the controllability of generating the panoramic image is greatly improved, which better meets the needs of users. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0019] Figure 1 A schematic diagram of an exemplary system architecture applicable to the present application;
[0020] Figure 2 A flowchart of a panoramic image processing method provided by an exemplary embodiment of the present application;
[0021] Figure 3 A framework diagram for generating a panoramic image provided by an exemplary embodiment of the present application;
[0022] Figure 4 A flowchart of deformation and stretching filling of a reference image provided by an exemplary embodiment of the present application;
[0023] Figure 5A An example diagram of a cubemap provided for an exemplary embodiment of the present application;
[0024] Figure 5B An example diagram of the effect of filling a cube map with a square reference image provided by an exemplary embodiment of the present application;
[0025] Figure 5C An example diagram of the effect of filling a cube map with a reference image whose width is greater than its height provided by an exemplary embodiment of the present application;
[0026] Figure 5D An example diagram of the effect of filling a cube map with a reference image whose width is smaller than its height provided by an exemplary embodiment of the present application;
[0027] Fig. 6A An example diagram of an equirectangular projection image transformed from a cubemap projection provided by an exemplary embodiment of the present application;
[0028] Figure 6B An example diagram of an equirectangular projection image corresponding to a cube map filled with a square reference image provided by an exemplary embodiment of the present application;
[0029] Figure 6C An example diagram of a transformed image provided by an exemplary embodiment of the present application;
[0030] Fig. 7A An example diagram of a cubemap filled with a single-value image provided for an exemplary embodiment of the present application;
[0031] Figure 7B An example diagram of an equirectangular projection image corresponding to a cube map filled with a single-value image provided by an exemplary embodiment of the present application;
[0032] Figure 8 A flowchart of an image generation model training method provided for an exemplary embodiment of the present application;
[0033] Fig. 9 A flowchart of generating a reference image sample provided by an exemplary embodiment of the present application;
[0034] Fig.10 An example diagram of generating a reference image sample provided by an exemplary embodiment of the present application;
[0035] Fig.11An interactive flow chart of a panoramic image generation method provided by an exemplary embodiment of the present application;
[0036] Fig.12 A schematic diagram of the structure of a server provided in an embodiment of the present application.
[0037] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0038] 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, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0039] It should be noted that the user information (including but not limited to user device information, user attribute information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0040] First, the terms involved in this application are explained:
[0041] Variational Autoencoder (VAE): A probabilistic model used for generative models and unsupervised learning that can learn the latent feature representation of input data.
[0042] Diffusion Model (DM): a model for adding noise and denoising images.
[0043] Latent Diffusion Model (LDM): A model that uses VAE to convert images into a latent feature space with smaller dimensions, and then performs traditional diffusion model reasoning and optimization.
[0044] Stable Diffusion (SD): is a text-to-image generation model based on the Latent Diffusion Model (LDM).
[0045] ControlNet: A controllable generative network based on stable diffusion (SD) that can generate corresponding images according to different control conditions.
[0046] Image Outpainting: A technique for expanding an input image. It can fill the blank area with image content based on a given image and the blank area outside the image.
[0047] Mask: A representation method that indicates useful and useless areas of an image.
[0048] Cube Map: It is a texture mapping technology that uses 6 two-dimensional (2D) texture maps (including front, back, left, right, top and bottom) to form a cube texture set centered on the origin. Each 2D texture map constitutes a face of the cube (respectively as the front, back, left side, right side, top and bottom).
[0049] Currently, panoramas are generated based on text descriptions provided by users. The generated panoramas only rely on the text descriptions, which are often far from user needs. Even if users repeatedly adjust and improve the text descriptions, it may not be possible to generate panoramas that meet user needs. The generated panoramas have poor controllability and do not meet user needs.
[0050] In order to solve the problems that the controllability of panorama generation is poor and the generation results do not meet the user's needs, the present application provides a panorama processing method, which obtains a given reference image and description text, deforms and stretches the reference image to obtain a transformed image of the reference image, and obtains a mask image corresponding to the transformed image, inputs the description text, the transformed image and the mask image into an image generation model, and generates a panorama according to the transformed image and the mask image through the image generation model. The panorama is generated based on the given reference image and description text, so that the generated panorama is based on the content of the reference image given by the user and meets the description of the description text given by the user, and the controllability of the generated panorama is greatly improved, which better meets the user's needs.
[0051] The image generation model may adopt a control network (ControlNet) for image generation, or other image generation models based on diffusion models, such as a T2I-adapter, etc., which is not specifically limited in this embodiment.
[0052] Figure 1 FIG. 1 is a schematic diagram of an exemplary system architecture applicable to the present application. Figure 1 As shown, the system architecture includes a server and a terminal device. There is a communication link between the server and the terminal device, which can realize the communication connection between the server and the terminal device.
[0053] The server is a device with computing capabilities deployed in the cloud or locally, such as a cloud cluster. The server stores an image generation model. The server is responsible for generating a panorama matching the reference image and the description text based on a given reference image and the description text of the panorama to be generated using the image generation model.
[0054] The end-side device can be an electronic device running downstream application software / system, specifically a hardware device with network communication function, computing function and information display function, including but not limited to smart phones, tablet computers, desktop computers, local servers, cloud servers, etc. For example, the end-side device can be an electronic device running various software applications / systems such as game design, film and television animation production, industrial design, architectural design, interior design, product design, etc. The downstream application software / system provides the function of generating a matching panorama based on a given reference image and description text, and can continue to execute subsequent processing logic such as panorama display, game design, film and television animation production, etc. based on the generated panorama.
[0055] When a panorama needs to be generated, the user submits a reference image and description text through the end-side device, and the end-side device sends the reference image and description text given by the user to the server. The server receives the reference image and description text sent by the end-side device, deforms and stretches the reference image to obtain a transformed image of the reference image, and obtains a mask image corresponding to the transformed image; the description text, transformed image and mask image are input into the image generation model, and the panorama is generated according to the transformed image and mask image through the image generation model.
[0056] Furthermore, the server returns the panoramic image to the end-side device, which can continue to execute subsequent processing logic such as panoramic image display, game design, film and television animation production, etc. according to the requirements of downstream application software / system.
[0057] The solution of this embodiment can be applied to the generation of 360-degree panoramic images or other types of panoramic images. The type of the panoramic image to be generated is not specifically limited here.
[0058] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0059] Figure 2 This is a flowchart of a panoramic image processing method provided by an exemplary embodiment of the present application. The execution subject of this embodiment is the server in the aforementioned system architecture. Figure 2 As shown, the specific steps of this method are as follows:
[0060] Step S201: Obtain a given reference image and a description text of a panorama to be generated.
[0061] The panorama to be generated may be a 360 panorama or other types of panorama. The given reference image may be an ordinary image provided by the user, specifically an image taken with a camera, an image produced / drawn with mapping software, or a photo of a user's own hand-drawn image, etc., which is not specifically limited in this embodiment. The reference image for generating the panorama may be a square image with a width equal to the height, a rectangular image with a width not equal to the height, or an image with an irregular shape, which is not specifically limited in this embodiment.
[0062] The description text is used to describe the content, style, and other aspects of the generated panorama. In actual applications, the description text can be a detailed description text or keywords written by the user according to the content, style, and other aspects of the panorama that the user wants to generate. If the user does not provide a description text, the server can generate a description text of the reference image based on the reference image, or use a pre-configured default description text.
[0063] In an example scenario, a user submits a panoramic image generation request to a terminal device, and the request includes a given reference image and description text. In response to the panoramic image generation request, the terminal device sends the reference image and description text given by the user to the server. The server receives the reference image and description text sent by the terminal device, and generates a panoramic image that conforms to the description text and matches the reference image based on the reference image and description text given by the user. Further, the server sends the generated panoramic image to the terminal device.
[0064] In another example scenario, a user submits a panoramic image generation request to the end-side device, which includes a given reference image but no description text. In response to the panoramic image generation request, the end-side device sends the reference image given by the user to the server. The server receives the given reference image sent by the end-side device, generates a description text of the reference image based on the given reference image (or obtains a default description text), and then generates a panoramic image that conforms to the description text and matches the reference image based on the reference image and the description text. Further, the server sends the generated panoramic image to the end-side device.
[0065] Among them, generating a description text of a reference image according to a reference image can be implemented using any pre-trained model for generating description text of an image, for example, a large language model (LLM) applied to image description tasks, a long short-term memory network (Long Short-Term Memory, abbreviated as LSTM), a BLIP-2 (Bootstrapping Language-Image Pre-training) model, etc., which is not specifically limited in this embodiment.
[0066] Step S202: deform, stretch and fill the reference image to obtain a transformed image of the reference image, and obtain a mask image corresponding to the transformed image.
[0067] In this step, the reference image is deformed and stretched to obtain a transformed image of the reference image. The transformed image has an aspect ratio and a panoramic Figure 1 The image that meets the aspect ratio requirement of the panorama to be generated (such as the current 360 panorama with an aspect ratio of 2:1) is converted to a new image. The generated panorama will maintain the size of the transformed image. The transformed image contains a reserved area and an area to be expanded. Among them, the reserved area represents an area that does not need to be changed. The image in the generated panorama within the reserved area is consistent with the transformed image. The area to be expanded is filled with the stretched image of the reference image and is the image area that needs to be expanded in the subsequent processing. Based on the description text and the transformed image, the area to be expanded in the transformed image is expanded and improved to obtain a panorama.
[0068] Optionally, the mask image corresponding to the transformed image is a binary image of the same size as the transformed image, including a reserved area and a to-be-expanded area corresponding to the transformed image, wherein the reserved area can be marked as 1, and the to-be-expanded area can be marked as 0.
[0069] Optionally, the mask image corresponding to the transformed image is a Boolean image of the same size as the transformed image, including a reserved area and a to-be-expanded area corresponding to the transformed image, wherein the reserved area can be marked as True, and the to-be-expanded area can be marked as False.
[0070] It should be noted that for different types of panoramas, the mapping relationship between the reference image and the panorama is different. Different deformation and stretching filling processes can be used to obtain a transformed image with the same size as the panorama to be generated, and the transformed image contains a reserved area and an area to be expanded. The reserved area represents an area that does not need to be changed. The image of the generated panorama in the reserved area is consistent with the transformed image. The area to be expanded is filled with the stretched image of the reference image, and is the image area that needs to be expanded in the subsequent processing. Based on the description text and the transformed image, the area to be expanded in the transformed image is expanded and improved to obtain a panorama.
[0071] Step S203: input the description text, the transformed image and the mask image into the image generation model, and generate a panoramic image according to the transformed image and the mask image through the image generation model.
[0072] After obtaining the transformed image and mask image of the reference image, the description text, the transformed image and the mask image are input into the image generation model. The image generation model expands and improves the area to be expanded in the transformed image according to the description text and the mask image to generate a panoramic image that conforms to the description text and matches the reference image.
[0073] Among them, the image generation model is pre-trained, and the input is the description text, and the transformed image and mask image obtained by deformation, stretching and filling based on the reference image. It can generate a panoramic image that conforms to the description text and matches the reference image based on the description text, and the transformed image and mask image obtained by deformation, stretching and filling based on the reference image.
[0074] The image generation model is obtained by fine-tuning a pre-trained model with image generation capability. The pre-trained model may be a pre-trained control network (ControlNet) based on image generation, a T2I-adapter, or other image generation models based on a diffusion model, which is not specifically limited in this embodiment.
[0075] Exemplarily, the image generation model may include a control network (ControlNet) and a decoder (such as a VAE decoder). In this step, the input of the control network (ControlNet) is an image and a text description, and the output is an image. In this embodiment, the input channel of the control network (ControlNet) is expanded from the conventional 3 channels to 4 channels. The 4-channel tensor after the transformation image and the mask image are cascaded (i.e., spliced) in the channel dimension is input into the control network (ControlNet) together with the description text, and the feature representation of the panorama is generated by the control network. Further, the feature representation of the panorama is decoded by the decoder to obtain the panorama.
[0076] Assuming that the resolution of the reference image is 512*512*3, the resolution of its transformed image is 512*1024*3, and the resolution of the mask image is 512*1024*1, the transformed image and the mask image are concatenated in the channel dimension to obtain a 512*1024*4 tensor. The resolution of the panorama output by the image generation model is 512*1024*3.
[0077] Exemplarily, the image generation model may include a T2I-adapter and a VAE decoder. In this step, the 4-channel tensor after the transformation image and the mask image are cascaded (i.e., spliced) in the channel dimension is input into the T2I-adapter together with the description text, and the feature representation of the panorama is generated by the T2I-adapter. Further, the feature representation of the panorama is decoded by the VAE decoder to obtain the panorama.
[0078] Figure 3 This is a framework diagram for generating the panoramic image provided in this embodiment. Figure 3 As shown in , the panorama generation process is as follows: the reference image is deformed and stretched to obtain a transformed image, and a mask image corresponding to the transformed image is obtained, wherein the mask image is used to mark the retained area and the area to be expanded in the transformed image. The retained area is the key area of the reference image that does not need to be changed. The area to be expanded is filled with the stretched image of the reference image, which is the image area that needs to be expanded in the subsequent processing. The transformed image and the mask image are spliced in the channel dimension to obtain a 4-channel tensor, and the 4-channel tensor and the description text (content as shown in Figure 3 The “Times Square” shown in the figure is input into the image generation model, and a panoramic image is generated through the image generation model.
[0079] After generating the panoramic image, the server may output the panoramic image. For example, the server may return the panoramic image to the end-side device that provides the reference image. The end-side device outputs the panoramic image to the user.
[0080] In addition, the server can output the panoramic image to a specified device according to a pre-configured output method; or, output the panoramic image through a front-end visualization interface. The output method of the panoramic image is not specifically limited here.
[0081] The method of this embodiment obtains a given reference image and description text, deforms and stretches the reference image to obtain a transformed image of the reference image, and obtains a mask image corresponding to the transformed image; the description text, the transformed image and the mask image are input into an image generation model, and a panorama is generated according to the description text, the transformed image and the mask image through the image generation model; the panorama is generated based on the given reference image and description text, so that the generated panorama matches the content of the reference image given by the user and conforms to the description of the description text given by the user, and the controllability of the generated panorama is greatly improved, which better meets the needs of users.
[0082] Figure 4 The flowchart of deformation and stretching filling of the reference image provided in this embodiment. In an optional embodiment, as Figure 4As shown, in the aforementioned step S202, the reference image is deformed and stretched and filled to obtain a transformed image of the reference image, which can be specifically implemented by the following steps:
[0083] Step S2021: fill the reference image into the cube map according to the configured filling rule.
[0084] Among them, the cube map includes 6 faces of a cube, each of which can represent a texture map. Figure 5A As shown, the six faces of the cube map are the left face (marked as Left), the front face (marked as Front), the right face (marked as Right), the back face (marked as Back), the top face (marked as Top) and the bottom face (marked as Down). Figure 5A The cubemap shown in is illustrative as an example with a marker and a box drawn on each face.
[0085] In this step, the reference image is filled into the cube map based on the pre-configured filling rule, that is, the reference image is pasted into the cube map. For reference images of different shapes, the rules for pasting (filling) the reference image into the cube map are different. Specifically, the filling rule can be configured for reference images of different shapes according to actual application scenarios. The specific content of the filling rule is not specifically limited here.
[0086] For example, for a square reference image with equal width and height, a cubemap with a side length equal to the height (or width) of the reference image can be initialized, and the square reference image can be attached to one of the left side, front side, right side, and back side of the cubemap. Figure 3 The square reference image shown in Figure 5A The effect after the left side of the cube map is shown as Figure 5B In addition, for the square reference image, the square reference image can also be pasted to any position in the area where the four faces of the left side, front side, right side and back side are located in the initialized cube map.
[0087] For example, for a rectangular reference image whose width is greater than its height, a cube map with a side length equal to the height of the reference image can be initialized, and the rectangular reference image can be pasted to any position within the area where the left side, front side, right side, and back side of the cube map are located. Figure 5A The cubemap effect is shown below Figure 5C As shown, Figure 5C The striped rectangular frame represents the pasted rectangular reference image.
[0088] For example, for a rectangular reference image whose width is less than its height, a cubemap with a side length equal to the width of the reference image can be initialized, and the rectangular reference image can be pasted to any position within the region where the top, front, and bottom surfaces of the cubemap are located. Figure 5A The cubemap effect is shown below Figure 5D As shown, Figure 5D The striped rectangular frame represents the pasted rectangular reference image.
[0089] In addition, for non-square and rectangular reference images, the circumscribed rectangular frame of the reference image can be determined according to the outline of the reference image, and the reference image is filled in a blank rectangular image of the same size as the circumscribed rectangular frame to obtain a corrected rectangular reference image, and the corrected rectangular reference image is mapped into the cube map.
[0090] It should be noted that when initializing the cubemap, the side length of the cubemap needs to be determined based on the reference image, but there is no restriction on the texture of the cubemap, which can be a blank image, a solid color image, or an image with any texture.
[0091] In an optional embodiment, this step can be implemented in the following manner:
[0092] Based on the filling rule, if the width of the current reference image is greater than or equal to the height of the reference image, a cube map with a side length equal to the height of the reference image is initialized, and the reference image is filled into a first specified area of the initialized cube map, wherein the first specified area includes a left side, a front side, a right side, and a back side.
[0093] If the width of the current reference image is less than the height of the reference image, a cube map with a side length equal to the width of the reference image is initialized, and the reference image is filled into a second specified area of the initialized cube map, wherein the second specified area includes a top surface, a front surface, and a bottom surface.
[0094] In a preferred embodiment, if the width of the current reference image is equal to the height of the reference image, that is, when the reference image is square, the reference image is filled to the left side of the initialized cube map so that after the first projection transformation, the area of the reference image is retained at the center of the transformed image.
[0095] Step S2022: Perform a first projection transformation on the cube map filled with the reference image to obtain a corresponding equirectangular projection image.
[0096] The first projection transformation refers to transforming the cubemap into an equirectangular projection image, which can be implemented using a tool with the projection transformation function, and is not specifically limited in this embodiment. The equirectangular projection image refers to an image in an equirectangular projection format.
[0097] After the reference image is filled into the cube map, in this step, the cube map filled with the reference image is subjected to a first projection transformation by using a projection transformation tool to obtain a corresponding equirectangular projection image.
[0098] For example, Figure 5A After the first projection transformation of the cube map shown in Fig. 6A The equirectangular projection is shown. Figure 5B After the first projection transformation of the cube map shown in Figure 6B The equirectangular projection shown is from Figure 6B It can be seen that the reserved area in the center of the equirectangular projection image retains the reference image.
[0099] Step S2023: Use the stretched image of the reference image to fill the area in the equirectangular projection image that is not covered by the reference image, so as to obtain a transformed image of the reference image.
[0100] In this step, the reference image is stretched to the same size as the equirectangular projection image according to the size of the equirectangular projection image obtained in step S2022, so as to obtain a stretched image of the reference image. For the area in the equirectangular projection image not covered by the reference image, the corresponding area of the stretched image of the reference image is filled, so as to obtain a transformed image of the reference image.
[0101] For example, based on Figure 6B The equidistant cylindrical projection shown in FIG. 1 is filled with the stretched image of the reference image in the area not covered by the reference image, and the result is as follows: Figure 6C Transformed image shown.
[0102] The method of this embodiment fills the reference image into the cube map according to the configured filling rule, performs a first projection transformation on the cube map filled with the reference image to obtain a corresponding equirectangular projection image, and uses the stretched image of the reference image to fill the area not covered by the reference image in the equirectangular projection image to obtain a transformed image of the reference image, so that the key area in the transformed image retains the reference image, and the other area is the area to be expanded, and the area to be expanded is filled with the stretched image of the reference image. Furthermore, based on the description text, the area to be expanded in the transformed image is expanded and improved to obtain a panoramic image that meets the description text, and the retained area of the panoramic image accurately retains the information of the reference image, and the expanded area also matches the reference image well.
[0103] Furthermore, the mask image corresponding to the transformed image can be obtained by the following steps:
[0104] Step S1, obtaining a single-valued image which has the same size as a reference image and in which all pixel values are first values.
[0105] In this step, a single-value image with the same size as the reference image is constructed by removing all color information of the reference image.
[0106] Exemplarily, a single-value image with the same size as the reference image and all pixel values are the first value may be constructed, where the first value may be 1. Optionally, a Boolean image with the same size as the reference image may also be constructed, in which all pixels are marked as True.
[0107] Step S2: according to the filling rule, fill the single-value image into a cube map whose pixel values are all the second value.
[0108] After obtaining the single-value image corresponding to the reference image, a cube map whose pixel values are all second values is initialized based on the filling rule, and the single-value image corresponding to the reference image is filled into the cube map, wherein the second value corresponds to the first value in step S1, if the first value is 1, the second value is 0, and if the first value is True, the second value is False.
[0109] The filling rule used in this step is consistent with the filling rule used in step S2021 in the process of generating the transformed image, except that the cube map initialized in this step is required to be a cube map with pixel values of each face being the second value, which will not be repeated here. Of course, when a skybox map is used in the process of generating the transformed image, the skybox map is also used in this step, and the pixel values in the initialized skybox map are required to be the second value.
[0110] Step S3: Perform a first projection transformation on the cube map filled with the single-value image to obtain a mask image corresponding to the transformed image.
[0111] In this step, the first projection transformation refers to transforming the cube map into an equirectangular projection map, which can be implemented using a tool with the projection transformation function, and is not specifically limited in this embodiment.
[0112] After the single-value image corresponding to the reference image is filled into the cube map, in this step, the cube map filled with the single-value image is subjected to a first projection transformation by using a projection transformation tool, so as to obtain a mask image corresponding to the transformed image. The mask image includes two regions, where the region with the first pixel value represents the reserved region, and the region with the second pixel value represents the region to be expanded. The mask image indicates the positions of the reserved region and the region to be expanded in the transformed image.
[0113] For example, Figure 3Taking the square reference image in as an example, a single-value image (a blank image) with the same size as the reference image and pixel values of 1 can be obtained. Figure 5B The same filling rule is used to fill the single-value image into a cube map with all pixel values 0 (completely black), and we can get Fig. 7A Further, Fig. 7A After the first projection transformation of the cube map shown in Figure 7B The equirectangular projection shown in Figure 7B The equirectangular projection shown is Figure 6C Mask image of the transformed image shown. Figure 7B The white area in the middle indicates the reserved area, and the black area indicates the area to be expanded. Fig. 7A The dashed box in the middle is intended to show the filling position of a single-value image (a blank image) in the cube map, and all pixel values in the filling position are 1.
[0114] The method of this embodiment fills the single-value image whose pixel value is the first value corresponding to the reference image into the cube map whose pixel value is the second value according to the same filling rule, performs a first projection transformation on the cube map filled with the single-value image, and obtains a mask image corresponding to the transformed image. The mask image accurately indicates the positions of the retained area and the area to be expanded in the transformed image, and provides position information for expanding and improving the area to be expanded in the transformed image to generate a panoramic image.
[0115] In another optional embodiment, a skybox map may be used instead of a cube map. According to a configured filling rule, a reference image is filled into the skybox map. A first projection transformation is performed on the skybox map filled with the reference image to obtain a corresponding equirectangular projection image. A stretched image of the reference image is used to fill the area in the equirectangular projection image not covered by the reference image to obtain a transformed image of the reference image.
[0116] Correspondingly, when obtaining the mask image corresponding to the transformed image, the skybox map is also used to replace the cube map. According to the filling rule, the single-value image with the same size as the reference image and the pixel values of which are all the first value is filled into the skybox map with the pixel values of which are all the second value; the skybox map filled with the single-value image is subjected to the first projection transformation to obtain the mask image corresponding to the transformed image. The implementation principle of using the skybox map to obtain the transformed image and the mask image is consistent with the implementation principle of using the cube map to obtain the transformed image and the mask image. For details, please refer to the relevant content of the aforementioned embodiment, which will not be repeated here.
[0117] Figure 8 The following is a flow chart of an image generation model training method provided by an exemplary embodiment of the present application. Figure 8As shown, the specific steps of this method are as follows:
[0118] Step S801: construct a training set, which includes panoramic image samples, and mask image samples, reference image samples and description text samples corresponding to the panoramic image samples.
[0119] In this embodiment, in order to train and obtain the image generation model used in the above-mentioned embodiments, a training set including panoramic samples, and mask image samples, reference image samples, and description text samples corresponding to the panoramic samples is constructed, wherein the panoramic samples serve as supervisory information. Among them, the panoramic samples in the training set are consistent with the type of panoramas generated by the image generation model. For example, in order to train and obtain an image generation model for generating a 360-degree panorama, the constructed training set includes 360-degree panoramic samples, and mask image samples, reference image samples, and description text samples corresponding to the 360-degree panoramic samples.
[0120] Specifically, when constructing a training set, a large number of panoramas are obtained as panorama samples in the training set. The panorama samples in the training set can cover a variety of different scenes (such as indoor, outdoor, landscape, architecture, etc.), different styles (such as realistic, cartoon, simple, oil painting, watercolor, sketch, etc.), different shooting conditions, etc.
[0121] A plurality of mask image samples are obtained in advance. Specifically, according to the possible shapes of the reference image and the configured filling rules, corresponding mask images are generated based on the filling rules for the possible shapes of the various reference images, and a plurality of different mask images can be obtained, which are used as mask image samples.
[0122] Further, according to the panoramic image samples and the mask image samples, reference image samples corresponding to the panoramic image samples are generated, and corresponding description text samples are generated based on each panoramic image sample. Based on each panoramic image sample and the configured mask image samples, as well as the reference image samples and description text samples corresponding to each panoramic image sample, a training set is constructed.
[0123] Optionally, when generating reference image samples corresponding to the panoramic samples based on the panoramic samples and the mask image samples, for each panoramic sample, one is randomly selected from the mask image samples to be combined with the panoramic sample, and based on the combination of the panoramic sample and the mask image sample, corresponding reference image samples and description text samples are generated, and a training data is constructed.
[0124] Optionally, when generating reference image samples corresponding to the panoramic image samples based on the panoramic image samples and the mask image samples, each panoramic image sample can be combined with each mask image sample, and corresponding reference image samples and description text samples can be generated based on the combination of each panoramic image sample and the mask image sample, and a piece of training data can be constructed. In this way, more training data can be obtained.
[0125] The corresponding description text samples are generated based on each panoramic image sample, and any pre-trained model for generating description text of an image can be used, for example, a large language model (LLM), LSTM, BLIP-2 model, etc. applied to image description tasks, which is not specifically limited in this embodiment. In addition, some panoramic image samples are extracted, and the configured default description text is used as the description text sample corresponding to the panoramic image sample.
[0126] Optionally, some panoramic image samples may be extracted, and description text of the reference image may be generated according to the reference image corresponding to the panoramic image sample, and the reference image description text may be used as the description text sample corresponding to the panoramic image sample.
[0127] In an optional embodiment, a panorama of a corresponding style can be obtained according to the style requirements of downstream applications to construct a training set for the style. Fine-tuning the pre-trained model based on the style training set can obtain a panorama generation scene that is more suitable for the style requirements. In this way, image generation models for different styles can be obtained.
[0128] Step S802: Obtain a pre-trained model for image generation, and use the training set to fine-tune the pre-trained model to obtain an image generation model.
[0129] Among them, the pre-trained model for image generation can adopt a control network (ControlNet) for image generation, or other image generation models based on diffusion models, such as a T2I-adapter, etc., which is not specifically limited in this embodiment.
[0130] In this step, for any training data in the training set (including reference image samples, mask image samples, description text and panoramic image samples), the reference image samples in the training data are deformed and stretched and filled to obtain the transformed image of the reference image samples, and the mask image samples in the training data are used as the mask image corresponding to the transformed image of the reference image samples; the description text samples in the training data, as well as the transformed image and mask image samples of the reference image samples are input into the pre-trained model, and the pre-trained model generates a first feature representation of the panoramic image according to the description text samples, the transformed image of the reference image samples and the mask image samples; the panoramic image samples corresponding to the reference image samples in the training data are encoded to obtain the second feature representation of the panoramic image samples; and the pre-trained model is trained according to the difference between the first feature representation and the second feature representation to obtain an image generation model.
[0131] Among them, the reference image samples are deformed and stretched and filled to obtain the transformed image of the reference image samples, which is consistent with the implementation principle of deforming and stretching and filling the reference image to obtain the transformed image of the reference image. For details, please refer to the relevant content of the aforementioned embodiment, which will not be repeated here.
[0132] Exemplarily, the pre-trained model may include a pre-trained control network (ControlNet) and a decoder (such as a VAE decoder). In this step, the input of the control network (ControlNet) is an image and a text description, and the output is an image. In this embodiment, the input channel of the control network (ControlNet) is expanded from the conventional 3 channels to 4 channels. During training, the 4-channel tensor of the transformed image of the reference image sample and the mask image sample after cascading (i.e., splicing) in the channel dimension is input into the control network (ControlNet) together with the description text sample, and the first feature representation of the panorama is generated by the control network. Furthermore, the generated panorama can be obtained by decoding the first feature representation of the panorama through the decoder.
[0133] Furthermore, when training the pre-trained model, only the parameters of the control network (ControlNet) may be adjusted, and the parameters of the fixed decoder may remain unchanged. In other optional embodiments, when training the pre-trained model, the parameters of the control network (ControlNet) and the decoder may also be adjusted.
[0134] Exemplarily, the pre-trained model may include a pre-trained T2I-adapter and a VAE decoder. In this step, the 4-channel tensor of the transformed image of the reference image sample and the mask image sample after cascading (i.e., splicing) in the channel dimension is input into the T2I-adapter together with the description text sample, and the first feature representation of the panorama is generated by the T2I-adapter. Further, the first feature representation of the panorama is decoded by the VAE decoder to obtain the generated panorama.
[0135] Furthermore, when training the pre-trained model, only the parameters of the T2I-adapter can be adjusted, and the parameters of the VAE decoder can be fixed unchanged. In other optional embodiments, when training the pre-trained model, the parameters of the T2I-adapter and the VAE decoder can also be adjusted.
[0136] In addition, the training strategy used for fine-tuning the pre-trained model in this embodiment, including but not limited to the selection of the optimization algorithm, learning rate, batch size, number of training steps, etc., can be configured according to empirical values in combination with the actual application scenario. For example, the learning rate can be 0.0001, the batch size (batch size) is 4, the number of training steps is 20000 steps, etc., which are not specifically limited here.
[0137] The method in this embodiment constructs a training set including panoramic samples, mask image samples, reference image samples and description text samples corresponding to the panoramic samples, and uses the training set to fine-tune the pre-trained model to obtain an image generation model. The image generation model can generate a panoramic image that conforms to the description text and matches the reference image based on the description text, as well as the transformed image and mask image obtained by deformation and stretching filling based on the reference image, so that the generated panorama is more controllable and more in line with user needs.
[0138] Fig. 9 A flowchart of generating a reference image sample provided by an exemplary embodiment of the present application; Fig.10 This is an example diagram of generating reference image samples provided in this embodiment. Fig. 9 As shown, in the process of constructing the training set, reference image samples corresponding to each panoramic image sample are generated according to each panoramic image sample and mask image sample, which is specifically achieved through the following steps:
[0139] Step S901: for any panoramic image sample, mask processing is performed on the panoramic image sample based on the configured mask image sample to obtain a masked image, where the mask image sample includes a reserved area and an area to be expanded.
[0140] For any panorama sample, any mask image sample can be selected from multiple configured mask image samples, and mask processing is performed on the panorama sample based on the mask image sample to obtain a masked image. The mask image sample includes a reserved area and an area to be expanded. The pixel values of the reserved area in the masked image remain unchanged, and the pixels of the area to be expanded are all set to 0.
[0141] Specifically, Fig.10 As shown in the figure, the values in the reserved area (white area) of the mask image sample are all 1, and the values in the area to be expanded (black area) are all 0. By multiplying the panorama sample and the mask image sample pixel by pixel, the pixel values in the panorama sample that fall into the area to be expanded can be set to 0 (turned black), and the pixel values in the reserved area are kept unchanged, thus obtaining the masked image.
[0142] Step S902: Perform a second projection transformation on the masked image to obtain a cube map corresponding to the masked image.
[0143] The second projection transformation is the inverse transformation of the first projection transformation. The second projection transformation refers to transforming the equirectangular projection image into a cubic map. Specifically, it can be implemented using a tool with the projection transformation function, and this embodiment does not make any specific limitations here.
[0144] In this step, the masked image is subjected to a second projection transformation (eg, Fig.10 , and obtain the corresponding cubemap.
[0145] Step S903: extract the image in the reserved area from the cube map corresponding to the masked image to obtain a reference image sample corresponding to the panoramic image sample.
[0146] After obtaining the masked image, a second projection transformation is performed (such as Fig.10 After obtaining the corresponding cube map, the image in the reserved area can be cut out from the cube map corresponding to the masked image as the reference image sample corresponding to the panorama sample.
[0147] For example, Fig.10 As shown, the mask image sample can be subjected to the same second projection transformation (such as Fig.10 The inverse transform shown in the figure) is used to obtain a cube map corresponding to the mask image sample, and the cube map corresponding to the mask image sample can be used as a mask for the cube map corresponding to the masked image. Based on the mask, the image in the reserved area can be extracted from the cube map corresponding to the masked image to obtain a reference image sample corresponding to the panorama sample.
[0148] The method of this embodiment performs mask processing on any panoramic sample based on the configured mask image sample to obtain a masked image, wherein the mask image sample includes a reserved area and an area to be expanded, performs a second projection transformation on the masked image to obtain a cube map corresponding to the masked image, extracts the image in the reserved area from the cube map corresponding to the masked image, and obtains a reference image sample corresponding to the panoramic sample. The reference image sample corresponding to the panoramic sample can be automatically generated to provide key sample data for constructing a training set.
[0149] The method of this embodiment provides a controllable image generation model based on an image filling strategy. By using the image filling mechanism, the mask image representing the area to be expanded and the transformed image to be expanded are cascaded to form a 4-channel input, and by fine-tuning on a small amount of data, the effect of generating a panoramic image by image expansion based on multi-modal input of text and reference images is achieved. This method can be applied to a variety of different pre-trained models to achieve panoramic image expansion in different styles.
[0150] Fig.11 This is an interactive flow chart of a panoramic image generation method provided by an exemplary embodiment of the present application. The execution subject of this embodiment is the server in the aforementioned system architecture. Fig.11 As shown, the specific interaction process of this method is as follows:
[0151] Step S1101: The terminal device sends a panoramic image generation request to the server, where the panoramic image generation request includes a given reference image and description text.
[0152] In this embodiment, when a user needs to generate a panoramic image, he or she may submit a reference image through a terminal device and provide a description text of the panoramic image to be generated.
[0153] The reference image submitted by the user may be an image taken by the user, an image produced / drawn by a mapping software, or a photo of a hand-drawn image taken by the user, etc., which is not specifically limited here. The description text is used to constrain the content, style, and other aspects of the generated panorama. In actual applications, the description text may be a detailed description text or keywords written by the user according to the content, style, etc. of the panorama that the user wants to generate.
[0154] In some application scenarios, when the user does not provide a description text, the description text carried in the panoramic image generation request is empty or default information.
[0155] Step S1102: The server receives a panoramic image generation request sent by the terminal device, and obtains a reference image and a description text.
[0156] The server receives the panoramic image generation request sent by the terminal device, and extracts the reference image and description text given by the user from the panoramic image generation request.
[0157] When the description text provided by the user is empty or default information, the server can generate the description text according to the reference image, or the server can use the configured default description text. The description text of the reference image can be generated according to the reference image, and any pre-trained model for generating image description text can be used, for example, a large language model (LLM), LSTM, BLIP-2 model, etc., which is not specifically limited in this embodiment.
[0158] Step S1103: The server deforms and stretches the reference image to obtain a transformed image of the reference image, and obtains a mask image corresponding to the transformed image.
[0159] The specific implementation principle and technical effect of this step refer to the relevant content of step S202 in the above embodiment, which will not be repeated here.
[0160] Step S1104: The server inputs the description text, the transformed image and the mask image into the image generation model, and generates a panoramic image according to the transformed image and the mask image through the image generation model.
[0161] The specific implementation principle and technical effect of this step refer to the relevant content of step S203 in the above embodiment, which will not be repeated here.
[0162] Step S1105: The server sends the panoramic image to the terminal device.
[0163] Step S1106: The terminal device receives the panoramic image sent by the server.
[0164] Step S1107: The terminal-side device outputs the panoramic image.
[0165] For example, taking the interior design scene as an example, the user can be a designer using interior design software, and the designer can use the interior design software to design and produce a design drawing of the interior scene. The designer needs to convert the design drawing of the interior scene into a panoramic image to show the panoramic effect of the interior scene design to the customer. The end-side device can be an electronic device running the interior design software. The designer can submit a panoramic image generation request to the end-side device and edit a description text of the desired panoramic image, such as "realistic style interior design plan". The end-side device sends a panoramic image generation request to the server. The request carries the design drawing of the interior scene and the description text "realistic style interior design plan".
[0166] Furthermore, the server uses the design drawing of the indoor scene as a reference image, generates a panoramic image based on the design drawing of the indoor scene and the description text expansion, and returns the panoramic image to the terminal device.
[0167] Furthermore, the terminal device outputs the panoramic image generated by the server for the designer to view and use.
[0168] The method of this embodiment can be applied to various application scenarios such as game design, film and television animation production, industrial design, architectural design, interior design, product design, etc., and can deform and stretch the reference image based on the reference image and description text given by the user to obtain a transformed image of the reference image, and obtain a mask image corresponding to the transformed image. The description text, the transformed image and the mask image are input into the image generation model, and a panorama is generated according to the transformed image and the mask image through the image generation model, so that the generated panorama conforms to the description text given by the user and matches the reference image given by the user. The controllability of generating the panorama is greatly improved, which better meets the needs of users.
[0169] Fig.12 A schematic diagram of the structure of a server provided in an embodiment of the present application. Fig.12 As shown, the server includes: a memory 1201 and a processor 1202. The memory 1201 is used to store computer-executable instructions and can be configured to store various other data to support operations on the server. The processor 1202 is connected to the memory 1201 in communication and is used to execute the computer-executable instructions stored in the memory 1201 to implement the technical solution provided by any of the above method embodiments. The specific functions and technical effects that can be achieved are similar and will not be repeated here.
[0170] Optional, such as Fig.12 As shown, the server also includes: a firewall 1203, a load balancer 1204, a communication component 1205, a power supply component 1206 and other components. Fig.12 Only some components are shown schematically, which does not mean that the server only includes Fig.12 Components shown. Fig.12 In the description, the server is only taken as a cloud server deployed in the cloud as an example for exemplary description. The server can also be deployed locally, and this embodiment is not specifically limited here.
[0171] An embodiment of the present application also provides a computer-readable storage medium, in which computer execution instructions are stored. When a processor executes the computer execution instructions, the method of any of the aforementioned embodiments is implemented. The specific functions and technical effects that can be achieved are not repeated here.
[0172] The present application also provides a computer program product, including a computer program, which implements the method of any of the above embodiments when executed by a processor. The computer program is stored in a readable storage medium, and at least one processor of the server can read the computer program from the readable storage medium. At least one processor executes the computer program so that the server executes the technical solution provided by any of the above method embodiments. The specific functions and technical effects that can be achieved are not repeated here.
[0173] The embodiment of the present application provides a chip, including: a processing module and a communication interface, the processing module can execute the technical solution of the server in the aforementioned method embodiment. Optionally, the chip also includes a storage module (such as a memory), the storage module is used to store instructions, the processing module is used to execute the instructions stored in the storage module, and the execution of the instructions stored in the storage module enables the processing module to execute the technical solution provided by any of the aforementioned method embodiments.
[0174] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the methods of various embodiments of the present application.
[0175] It should be understood that the above processor can be a central processing unit (CPU), a graphics processing unit (GPU), or other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the application can be directly embodied as being executed by a hardware processor, or can be executed by a combination of hardware and software modules in at least one processor.
[0176] The memory may include high-speed random access memory (RAM), and may also include non-volatile storage, such as at least one disk storage, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a disk or an optical disk, etc.
[0177] The above storage may be an object storage service (OSS).
[0178] The above-mentioned memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.
[0179] The above-mentioned communication component is configured to facilitate wired or wireless communication between the device where the communication component is located and other devices. The device where the communication component is located can access a wireless network based on a communication standard, such as a mobile hotspot (WiFi), a second-generation mobile communication system (2G), a third-generation mobile communication system (3G), a fourth-generation mobile communication system (4G) / Long Term Evolution (LongTerm Evolution, referred to as LTE), a fifth-generation mobile communication system (5G) and other mobile communication networks, or a combination thereof. In an exemplary embodiment, the communication component receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component also includes a near field communication (Near Field Communication, referred to as NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (Radio Frequency Identification, referred to as RFID) technology, infrared technology, ultra-wideband (Ultra Wide Band, referred to as UWB) technology, Bluetooth technology and other technologies.
[0180] The power supply assembly provides power to various components of the device where the power supply assembly is located. The power supply assembly may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device where the power supply assembly is located.
[0181] The above storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The storage medium can be any available medium that can be accessed by a general or special purpose computer.
[0182] An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in a dedicated integrated circuit. Of course, the processor and the storage medium can also exist as discrete components in an electronic device or a main control device.
[0183] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0184] The order of the above-mentioned embodiments of the present application is only for description and does not represent the advantages and disadvantages of the embodiments. In addition, in some of the processes described in the above-mentioned embodiments and the accompanying drawings, multiple operations that appear in a specific order are included, but it should be clearly understood that these operations may not be executed or executed in parallel in the order in which they appear in this article, and are only used to distinguish between different operations, and the sequence number itself does not represent any execution order. In addition, these processes may include more or less operations, and these operations may be executed in sequence or in parallel. It should be noted that the descriptions of "first", "second", etc. in this article are used to distinguish different messages, devices, modules, etc., do not represent the order of precedence, and do not limit "first" and "second" to different types. The meaning of "multiple" is more than two, unless otherwise clearly and specifically defined.
[0185] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods of each embodiment of the present application.
[0186] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary technical means in the art that are not disclosed in the present application.
[0187] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A panoramic image processing method, characterized in that: include: Get the given reference image and the description text of the panorama to be generated; Deforming and stretching the reference image to obtain a transformed image of the reference image, and obtaining a mask image corresponding to the transformed image; The description text, the transformation image and the mask image are input into an image generation model, and a panoramic image is generated according to the description text, the transformation image and the mask image by the image generation model.
2. The method according to claim 1, characterized in that: The step of deforming and stretching the reference image to obtain a transformed image of the reference image includes: Filling the reference image into a cube map according to a configured filling rule; Performing a first projection transformation on the cube map filled with the reference image to obtain a corresponding equirectangular projection image; The stretched image of the reference image is used to fill the area in the equirectangular projection image that is not covered by the reference image, so as to obtain a transformed image of the reference image.
3. The method according to claim 2, characterized in that The obtaining of the mask image corresponding to the transformed image comprises: Acquire a single-valued image having the same size as the reference image and pixel values all being the first value; According to the filling rule, filling the single-value image into a cube map in which all pixel values are the second value; The first projection transformation is performed on the cube map filled with the single-value image to obtain a mask image corresponding to the transformed image.
4. The method according to claim 2, characterized in that: The step of filling the reference image into the cube map according to the configured filling rule comprises: If the width of the reference image is greater than or equal to the height of the reference image, initializing a cube map with a side length equal to the height of the reference image; The reference image is filled into a first specified area of the initialized cube map, where the first specified area includes a left side, a front side, a right side, and a back side.
5. The method according to claim 2, characterized in that: The step of filling the reference image into the cube map according to the configured filling rule comprises: If the width of the reference image is less than the height of the reference image, initializing a cube map with a side length equal to the width of the reference image; The reference image is filled into a second specified area of the initialized cube map, where the second specified area includes a top surface, a front surface, and a bottom surface.
6. The method according to any one of claims 1 to 5, characterized in that Also includes: Constructing a training set, wherein the training set includes a panoramic image sample, and a mask image sample, a reference image sample, and a description text sample corresponding to the panoramic image sample; A pre-trained model for image generation is obtained, and the pre-trained model is fine-tuned using the training set to obtain the image generation model.
7. The method according to claim 6, characterized in that The constructing of the training set comprises: Acquire multiple panorama image samples and multiple mask image samples; Generate reference image samples corresponding to each of the panoramic image samples according to each of the panoramic image samples and the mask image samples, and generate corresponding description text samples based on each of the panoramic image samples; A training set is constructed based on the panoramic image samples and the configured mask image samples, as well as the reference image samples and the description text samples corresponding to the panoramic image samples.
8. The method according to claim 7, characterized in that The step of generating reference image samples corresponding to each of the panoramic image samples and the mask image samples comprises: For any of the panoramic image samples, mask processing is performed on the panoramic image sample based on a configured mask image sample to obtain a masked image, wherein the mask image sample includes a reserved area and an area to be expanded; Performing a second projection transformation on the masked image to obtain a cube map corresponding to the masked image; An image covered by a reserved area is extracted from the cubic map corresponding to the masked image to obtain a reference image sample corresponding to the panoramic image sample.
9. The method according to claim 6, characterized in that The fine-tuning training of the pre-trained model using the training set to obtain the image generation model includes: Deform and stretch the reference image samples in the training set to obtain a transformed image of the reference image samples; use the mask image samples as mask images corresponding to the transformed image of the reference image samples; Inputting the description text sample, the transformed image of the reference image sample and the mask image sample into a pre-trained model, and generating a first feature representation of the panoramic image according to the description text sample, the transformed image of the reference image sample and the mask image sample through the pre-trained model; Encoding the panoramic image samples corresponding to the reference image samples to obtain a second feature representation of the panoramic image samples; According to the difference between the first feature representation and the second feature representation, the pre-trained model is trained to obtain the image generation model.
10. The method according to any one of claims 1 to 5, characterized in that The obtaining of a given reference image and description text comprises: The reference image and description text sent by the receiving device; Alternatively, a reference image sent by a receiving device, and a description text is generated according to the reference image; After generating the panoramic image, the method further includes: The generated panoramic image is returned to the end-side device.
11. A panoramic image processing method, characterized in that: include: A panoramic image generation request sent by a receiving end-side device, wherein the panoramic image generation request includes a given reference image and a description text; Deforming and stretching the reference image to obtain a transformed image of the reference image, and obtaining a mask image corresponding to the transformed image; Inputting the description text, the transformation image and the mask image into an image generation model, and generating a panoramic image according to the transformation image and the mask image through the image generation model; The panoramic image is output to the terminal device.
12. The method according to claim 11, characterized in that The step of deforming and stretching the reference image to obtain a transformed image of the reference image includes: Filling the reference image into a cube map according to a configured filling rule; Performing a first projection transformation on the cube map filled with the reference image to obtain a corresponding equirectangular projection image; The stretched image of the reference image is used to fill the area in the equirectangular projection image that is not covered by the reference image, so as to obtain a transformed image of the reference image.
13. A server, characterized in that: include: at least one processor; as well as a memory communicatively coupled to the at least one processor; The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the server to execute the method described in any one of claims 1-12.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the method according to any one of claims 1 to 12 is implemented.
15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 12 is implemented.
Citation Information
Cited By
Geographic positioning method and device based on multi-modal large model, equipment and medium
CN120256489A
