Video generation method and apparatus, electronic device, computer-readable storage medium, and computer program product
By iteratively generating frame image sequences and utilizing film and television drama style training data, the problem of consistency and continuity in video generation in film and television drama scenes is solved, and efficient and coordinated film and television style video generation is achieved.
Patent Information
- Application Number
- PCT/CN2024/073423
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-09
- Filing Date
- 2024-01-22
- Publication Date
- 2024-09-12
AI Technical Summary
When the existing technology generates videos in film and television drama scenes, the scene consistency and content continuity between images and videos are poor, resulting in uncoordinated video effects.
By obtaining the initial image and description text, iteratively generates a frame image sequence, using diffusion models and machine learning models, combined with film and television drama style training data, to ensure the consistency and content continuity between frame images, and generate film and television style videos.
It improves the accuracy of frame images in the video and the consistency between adjacent frame images. The generated video has better film and television style and coordination, and enriches the expression content of the image.
Smart Images

Figure CN2024073423_12092024_PF_FP_ABST
Abstract
Description
Video generation method, device, electronic device, computer-readable storage medium, and computer program product
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application is based on the Chinese patent application with application number 2023102588534 and application date of March 9, 2023, and claims the priority of the Chinese patent application. The entire content of the Chinese patent application is hereby introduced into this application as a reference. Technical Field
[0003] The present application relates to the field of computer technology, and in particular to a method, device, electronic device, computer-readable storage medium, and computer program product for generating a video. Background Art
[0004] In film and television drama scenarios, when users upload an image, they often hope to use video technology to animate the image into a film and television style. That is, to make the image move and the movement performance similar to the film and television style, such as a short video showing the changes in character expressions, landscape switching, etc.
[0005] In the related art, the output image and the input image have poor consistency in scene and poor accuracy of image content, resulting in poor consistency and content continuity of the generated video.
[0006] Summary of the Invention
[0007] The embodiments of the present application provide a video generation method, device, electronic device, computer-readable storage medium, and computer program product, which can improve the accuracy of frame images in the video and the consistency between adjacent frame images.
[0008] The technical solution of the embodiment of the present application is implemented as follows:
[0009] The present invention provides a method for generating a video, including:
[0010] Acquire an initial image and acquire a plurality of description texts, each of the description texts being used to describe a frame image in a frame image sequence to be generated;
[0011] Taking the initial image as a first frame image, and iteratively generating at least one frame image following the first frame image based on the first frame image and the plurality of description texts, so as to obtain a frame image sequence consisting of the first frame image and the at least one frame image;
[0012] Perform video synthesis on each frame image in the frame image sequence to obtain a target video.
[0013] The present invention provides a video generation device, including:
[0014] An acquisition module is configured to acquire an initial image and acquire a plurality of description texts, each of the description texts being used to describe a frame image in a frame image sequence to be generated;
[0015] a generating module configured to use the initial image as a first frame image and, based on the first frame image and the plurality of description texts, iteratively generate at least one frame image subsequent to the first frame image, so as to obtain a frame image sequence consisting of the first frame image and the at least one frame image;
[0016] The synthesis module is configured to perform video synthesis on each frame image in the frame image sequence to obtain a target video.
[0017] An embodiment of the present application provides an electronic device, including:
[0018] a memory configured to store executable instructions;
[0019] The processor is configured to implement the video generation method provided in the embodiment of the present application when executing the computer executable instructions stored in the memory.
[0020] An embodiment of the present application provides a computer-readable storage medium having computer-executable instructions stored therein. When the computer-executable instructions are executed by a processor, the processor will execute the video generation method provided in the embodiment of the present application.
[0021] The present invention provides a computer program product including computer-executable instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the electronic device to perform the video generation method provided in the present invention.
[0022] The embodiments of the present application have the following beneficial effects:
[0023] In the embodiment of the present application, the acquired initial image is used as the first frame image of the frame image sequence to be generated. When generating each frame image in the frame image sequence to be generated, the frame images before the frame image, the descriptive text associated with each frame image before the frame image, and the descriptive text of the frame image itself are fully referenced. Then, based on each frame image in the frame image sequence, the target video is generated. This not only improves the accuracy of each frame image in the video, but also ensures the consistency between adjacent frame images. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] FIG1 is a schematic diagram of the architecture of a video generation system 100 provided in an embodiment of the present application;
[0025] FIG2 is a schematic structural diagram of an electronic device 500 for implementing a method for generating a video according to an embodiment of the present application;
[0026] FIG3 is a flow chart of a method for generating a video according to an embodiment of the present application;
[0027] FIG4 is a schematic diagram of a process for generating an i-th frame image provided in an embodiment of the present application;
[0028] FIG5 is a schematic diagram of a method for determining text constraint information provided in an embodiment of the present application;
[0029] FIG6 is a schematic diagram of a text feature extraction process based on a CLIP model provided in an embodiment of the present application;
[0030] FIG7 is a schematic diagram of a method for determining graphic and text constraint information provided in an embodiment of the present application;
[0031] FIG8 is a schematic diagram of a graphic feature extraction process provided by an embodiment of the present application;
[0032] FIG9 is a flow chart of a frame image generation process provided by an embodiment of the present application;
[0033] FIG10 is a diagram of the i-th frame image generation process provided in an embodiment of the present application;
[0034] FIG11 is a frame image generation method based on a machine learning model provided in an embodiment of the present application;
[0035] FIG12 is a flow chart of a serial frame image generation model provided in an embodiment of the present application;
[0036] FIG13 is a schematic diagram of a training method for a frame image generation model provided in an embodiment of the present application;
[0037] FIG14 is a schematic diagram of a video sample processing flow provided in an embodiment of the present application;
[0038] FIG15 is a flow chart of a clustering process for video samples provided in an embodiment of the present application;
[0039] FIG16 is a schematic diagram of a process for determining a distance threshold according to an embodiment of the present application;
[0040] FIG17 is another flow chart of a method for generating a video according to an embodiment of the present application;
[0041] FIG18A is a schematic diagram showing a general flow of a method for generating a video according to an embodiment of the present application;
[0042] FIG18B is a visualization diagram of multi-frame image generation provided by an embodiment of the present application;
[0043] FIG19 is a schematic structural diagram of a continuous frame generation model provided in an embodiment of the present application;
[0044] FIG20 is a schematic diagram of a standard diffusion model provided in an embodiment of the present application;
[0045] FIG21A is a schematic diagram of a U-Net process without adding constraint information provided in an embodiment of the present application;
[0046] FIG21B is a schematic diagram of a U-Net with added constraint information provided in an embodiment of the present application;
[0047] FIG22 is a schematic diagram of the structure of a BLIP-based text extraction model provided in an embodiment of the present application;
[0048] FIG23 is a schematic diagram of a training data collection process according to an embodiment of the present application;
[0049] FIG24 is a schematic diagram of a storyboard operation for a video sample provided by an embodiment of the present application;
[0050] FIG25 is a schematic diagram of the reasoning process of continuous frame images provided in an embodiment of the present application. DETAILED DESCRIPTION
[0051] In order to make the purpose, technical solutions and advantages of this application clearer, the application will be described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limiting this application. All other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0052] In the following description, reference is made to “some embodiments”, which describes a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0053] In the following description, the terms "first\second" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It is understandable that "first\second" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0054] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.
[0055] It should be pointed out that in the embodiments of the present application, data related to the attributes of the user image is involved. When the embodiments of the present application are applied to products or technologies, user permission or consent is required, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0056] Before describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.
[0057] 1) Image recognition: Category-level recognition ignores specific instances of objects and only considers the category of the object (such as human, dog, cat, bird, etc.) and gives the category to which the object belongs. A typical example is the recognition task in ImageNet, a large-scale open source dataset for general object recognition, which identifies which of 1,000 categories an object belongs to.
[0058] 2) Imagenet: A large-scale open-source dataset for general object recognition.
[0059] 3) Imagenet pre-trained model: A deep learning network model is trained based on Imagenet, and the parameter weights of the model are obtained as the Imagenet pre-trained model.
[0060] 4) Movie and TV Series Stock Images: This collects all movie and TV series videos. Since the amount of data generated after extracting frames from movie and TV series videos is enormous, data compression is necessary to avoid lengthy retrieval times. Therefore, the videos are storyboarded, and one frame of image is extracted from each storyboard and stored in the stock.
[0061] 5) Constrastive Language-Image Pretraining (CLIP) Model: The CLIP model takes as input pairs of images and text. Its architecture consists of two parts: an image encoder and a text encoder. The text branch of CLIP encodes each novel sentence using a text encoder (which can be a transform) to produce N text feature vectors (T1, T2, T3, ..., TN). The image branch of CLIP encodes each stock image of a film or TV series using an image encoder (which can be a ResNet) to produce N image feature vectors (I1, I2, I3, ..., IN).
[0062] When it is necessary to compare the similarity between images and texts, a feature vector matrix is constructed based on the text feature vector and the image feature vector. Since the diagonal part of the feature vector matrix is the image and text matching, the similarity is the largest, so the inner product of the two eigenvectors on the diagonal of the matrix can be calculated. The larger the inner product, the more similar they are.
[0063] 6) Diffusion Model: A generative image model that learns the information attenuation caused by noise and then uses the learned pattern to generate images. This concept also applies to latent variables because it attempts to learn the noise distribution rather than the data distribution. The noise distribution is modeled using the concept of Markov chains, making it a probabilistic model. The diffusion model consists of two stages: the forward process from the original image to the noise, the diffusion process, and the reverse process from the noise to the original image. Diffusion Generative Model: A generative model that converts a complex true distribution into a simple prior distribution by gradually adding noise, and generates the true distribution from the simple prior distribution by gradually removing noise.
[0064] 7) The Vision Transformer (ViT) model is a model for image classification that uses a Transformer-like structure on image patches. The input image is split into fixed-size patches, each of which is then linearly embedded. Position embeddings (vector representations) are added, and the resulting vector sequence is fed into a standard Transformer encoder for learning. For classification, an additional learnable "classification token" is added to the sequence.
[0065] Based on the above explanations of the nouns and terms involved in the embodiments of the present application, the video generation system provided by the embodiments of the present application is described below. Referring to Figure 1, Figure 1 is a schematic diagram of the architecture of the video generation system 100 provided by the embodiments of the present application. To support an exemplary application, the terminal (terminal 400-1 and terminal 400-2 are shown as examples) is connected to the server 200 via the network 300. The network 300 can be a wide area network or a local area network, or a combination of the two, using wireless or wired links to achieve data transmission.
[0066] In some embodiments, the terminal (such as terminal 400-1 and terminal 400-2) is deployed with a target application that can realize the video generation function. The target application can generate a target video with a target style (such as film and television style, animation style, etc.) based on the input initial image and the descriptive text of each frame image in the video to be generated. Based on the target application, the terminal sends a video generation request for the target video to the server, wherein the video generation request carries the initial image as the first frame image in the frame image sequence to be generated, and the descriptive text for the second frame image in the frame image sequence to be generated. The terminal also receives the target video returned by the server and performs the target operation on the target video. The target operation includes one or more of the following operations: play, download, share, etc., and the multiple operations mentioned here are at least two.
[0067] In some embodiments, the server 200 is configured to receive a video generation request for a target video sent by a terminal, parse the video generation request, and use the obtained initial image as the first frame image in the frame image sequence to be generated. At the same time, the server 200 parses the request to obtain a description text for the second frame image in the frame image sequence to be generated. Then, based on the first frame image and the description text of each frame image in the frame image sequence, the server 200 iteratively generates each frame image in the frame image sequence that is located after the first frame image; and performs video synthesis on each frame image in the frame image sequence to obtain the target video.
[0068] In actual applications, the server 200 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks (CDNs), and big data and artificial intelligence platforms. The terminal (such as terminal 400-1 and terminal 400-2) can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart TV, a smart watch, etc., but is not limited to this. The terminal (such as terminal 400-1 and terminal 400-2) and the server 200 can be directly or indirectly connected via wired or wireless communication, and this application does not limit this.
[0069] The embodiments of the present application can also be implemented with the help of cloud technology. Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and network within a wide area network or a local area network to realize data calculation, storage, processing, and sharing.
[0070] Cloud technology is a general term for network, information, integration, management platform, and application technologies used in the cloud computing business model. It can form a resource pool that can be used flexibly and conveniently on demand. Cloud computing technology will become a key support. The backend services of technical network systems require a large amount of computing and storage resources.
[0071] Next, an electronic device that implements the method for generating a video according to an embodiment of the present application will be described. Referring to FIG. 2 , FIG. 2 is a schematic diagram of the structure of an electronic device 500 that implements the method for generating a video according to an embodiment of the present application. The electronic device 500 can be the server 200 or terminal shown in FIG. 1 . Taking the electronic device 500 as the server shown in FIG. 1 as an example, the electronic device that implements the method for generating a video according to an embodiment of the present application will be described. The electronic device 500 provided in the embodiment of the present application includes: at least one processor 510, a memory 550, at least one network interface 520, and a user interface 530. The various components in the electronic device 500 are coupled together via a bus system 540. It will be understood that the bus system 540 is used to enable connections and communications between these components. In addition to a data bus, the bus system 540 also includes a power bus, a control bus, and a status signal bus. However, for clarity of description, each bus is labeled as the bus system 540 in FIG. 2 .
[0072] The processor 510 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0073] In some embodiments, the user interface 530 includes one or more output devices 531 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 530 also includes one or more input devices 532, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0074] The memory 550 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard drives, optical drives, etc. The memory 550 may optionally include one or more storage devices that are physically remote from the processor 510.
[0075] The memory 550 includes volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 550 described in the embodiments of the present application is intended to include any suitable type of memory.
[0076] In some embodiments, the memory 550 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplified below.
[0077] The operating system 551 includes system programs configured to handle various basic system services and perform hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc. The operating system is configured to implement various basic businesses and handle hardware-based tasks; a network communication module 552 is configured to reach other computing devices via one or more (wired or wireless) network interfaces 520. Exemplary network interfaces 520 include: Bluetooth, Wireless Compatibility Certification (WiFi), and Universal Serial Bus (USB); a presentation module 553 is configured to enable information to be presented (e.g., a user interface for operating peripheral devices and displaying content and information) via one or more output devices 531 associated with the user interface 530 (e.g., a display screen, a speaker, etc.); an input processing module 554 is configured to detect one or more user inputs or interactions from one or more input devices 532 and translate the detected inputs or interactions.
[0078] In some embodiments, the video generation device provided in the embodiments of the present application can be implemented in software. Figure 2 shows a video generation device 555 stored in the memory 550, which can be software in the form of programs and plug-ins, including the following software modules: an acquisition module 5551, a generation module 5552 and a synthesis module 5553. These modules are logical, and therefore can be arbitrarily combined or split according to the functions implemented. The functions of each module will be explained below.
[0079] In other embodiments, the video generation device provided in the embodiments of the present application can be implemented by a combination of software and hardware. As an example, the video generation device provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the video generation method provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components.
[0080] In some embodiments, the terminal or server can implement the method for generating the video provided in the embodiment of the present application by running a computer program. For example, the computer program can be a native program or software module in the operating system; it can be a local (Native) application (APP, Application), that is, a program that needs to be installed in the operating system to run, such as an instant messaging APP, a web browser APP; it can also be a small program, that is, a program that can be run only after being downloaded to a browser environment; it can also be a small program that can be embedded in any APP. In short, the above-mentioned computer program can be an application, module or plug-in in any form. For example, the target application deployed in the terminal shown in Figure 1 (such as terminal 400-1 and terminal 400-2) can be an application, module or plug-in in any form mentioned above, and the target application can realize the video generation function, for example, the terminal can receive the initial image and description text uploaded based on the human-computer interaction interface provided by the target application, and output the generated target video.
[0081] Based on the above description of the video generation system and electronic device provided in the embodiment of the present application, the video generation method provided in the embodiment of the present application is described below. In actual implementation, the video generation method provided in the embodiment of the present application can be implemented independently by a terminal or a server, or by a terminal and a server in collaboration. The example of the video generation method provided in the embodiment of the present application being executed independently by the server 200 in Figure 1 is used for illustration. Referring to Figure 3, Figure 3 is a schematic flow chart of the video generation method provided in the embodiment of the present application, which will be described in conjunction with the steps shown in Figure 3.
[0082] In step 101 , the server obtains an initial image and a plurality of description texts, each of which is used to describe a frame image in a frame image sequence to be generated.
[0083] In actual implementation, the server receives a video generation request for a video to be generated, parses the request, and obtains an initial image and descriptive text for each frame of the video to be generated. The video to be generated can be represented by a sequence of N consecutive frame images to be generated, where N is a positive integer ≥ 2, and N can be included in the video generation request or read by the server from a pre-set configuration file. In addition, the initial image included in the video generation request serves as the first frame image in the sequence of frame images to be generated. To ensure consistency between the frames in the sequence of frame images to be generated, the video generation request typically also includes pre-set descriptive text for each frame image in the sequence of frame images to be generated. The descriptive text associated with each frame image is used to characterize the image content of the frame image to be generated, that is, the descriptive text can describe the image content of the desired frame image to be generated. Of course, in actual applications, the descriptive text can be empty, that is, the video generation request for the video to be generated may contain descriptive text for each frame image in the video to be generated, or only for some frames.
[0084] In step 102, the initial image is taken as the first frame image, and based on the first frame image and multiple description texts, at least one frame image after the first frame image is iteratively generated to obtain a frame image sequence consisting of the first frame image and at least one frame image.
[0085] In some embodiments, the server can iteratively generate each frame image after the first frame image in the frame image sequence based on the first frame image and each descriptive text in the following manner: based on the descriptive text of the i-th frame image in the frame image sequence, each frame image before the i-th frame image in the frame image sequence, and the descriptive text of each frame image before the i-th frame image, generate the i-th frame image, where i is a positive integer greater than 1, and i is less than or equal to a preset number; traverse i to obtain each frame image after the first frame image in the frame image sequence.
[0086] Here, the preset number may be the number of frame images in the frame image sequence to be generated.
[0087] In actual implementation, the process of generating the i-th frame image is repeated to obtain each frame image in the sequence of frame images to be generated.
[0088] In actual implementation, when the server generates the i-th (i is a positive integer ≥ 2) frame image in a frame image sequence, in order to maintain content consistency with the frame image before the i-th frame image, the frame images before the i-th frame image and the description text of the frame images before the i-th frame image can be used as constraint information when generating the i-th frame image, which is used to constrain the generation process of the i-th frame image, so that the generated i-th frame image is consistent with the content of the frame image before the i-th frame image. The content consistency can include one or more of the following: consistency of characters in the image, consistency of background, and consistency of scene. The judgment of content consistency is usually to calculate the similarity between the i-th frame image and the (i-1)-th frame image for a specific content type (character, background, scene, etc.). When the similarity reaches a preset similarity threshold, it is considered that the i-th frame image is consistent with the (i-1)-th frame image.
[0089] In some embodiments, referring to FIG4 , FIG4 is a schematic diagram of the process of generating the i-th frame image provided in an embodiment of the present application. Based on FIG3 , step 102 can be implemented by steps 1021 - 1024 , which will be described in conjunction with the steps shown in FIG4 .
[0090] In step 1021 , the server generates text constraint information for the i-th frame image based on the description text of the i-th frame image in the frame image sequence and the description texts of the frame images before the i-th frame image.
[0091] In actual implementation, the constraint information constraining the generation process of the i-th frame image may include one or more of the following: text constraint information, graphic-text constraint information, image constraint information, etc., wherein text constraint information is constraint information in a purely textual mode, that is, the constraint information is described in text form to constrain the generation process of the frame image through text description; image constraint information is constraint information in a purely imageual mode, that is, the constraint information is described in an image form to constrain the generation process of the frame image through an image description; graphic-text constraint information is cross-modal constraint information, that is, the constraint information is described in an image plus text form to constrain the generation process of the frame image through an image plus text form. The server can extract features from the descriptive text of the i-th frame image and the descriptive text of each frame image preceding the i-th frame image, and generate text constraint information based on the obtained text features.
[0092] The method for determining text constraint information is described. In some embodiments, the process of determining text constraint information can be implemented independently by the terminal or the server, or by the terminal and the server in collaboration. The process of determining the text constraint information described above is described by taking the server 200 in Figure 1 as an example. See Figure 5, which is a schematic diagram of the method for determining text constraint information provided in an embodiment of the present application. The steps shown in Figure 5 are described below.
[0093] In step 201 , the server extracts features from the description text of the i-th frame image and the description texts of each frame image before the i-th frame image in the frame image sequence to obtain the description text features of each frame image.
[0094] In actual implementation, the server can extract the text features of the description text of each frame image through a machine learning model capable of text feature extraction (such as CLIP). That is, the server extracts features from the description text of each frame image before the i-th frame image to obtain the corresponding description text features, that is, the vector representation or feature vector of the description text. The description text features are used to indicate the semantic features of the description text. The CLIP model includes an image encoder and a text encoder. Through the text branch of CLIP: the description text of each frame image is encoded by a text encoder (the text encoder can be a transform) to obtain the description text features corresponding to each description text (in calculation, vector representation is used).
[0095] Step 202: Acquire a first identification feature for indicating a text modality, fuse the first identification feature with a descriptive text feature, and use the fusion result as text constraint information of the i-th frame image.
[0096] For example, refer to Figure 6, which is a schematic diagram of the text feature extraction process based on the CLIP model provided in an embodiment of the present application. For all descriptive texts associated with the frame images before the i-th frame image, the text features are extracted through the CLIP text branch to obtain a 2x1x768 three-dimensional matrix, which is then fused with the flag bit (2x1x768) representing the pure text modality to obtain the text constraint information of the i-th frame image.
[0097] Step 1022 : Generate image-text constraint information for the i-th image frame based on the image frames preceding the i-th image frame and the description texts of the image frames. Both the text constraint information and the image-text constraint information are used to constrain the image content of the i-th image frame.
[0098] In actual implementation, the server can extract image features from each frame image located before the i-th frame image to obtain corresponding image features. At the same time, it can extract text features from the description texts of each frame image located before the i-th frame image to obtain corresponding text features. Then, through the fusion operation of text features and image features, the graphic and text constraint information of the i-th frame image is obtained.
[0099] The method for determining the image and text constraint information is described. In some embodiments, the process of determining the image and text constraint information can be implemented independently by the terminal or the server, or by the terminal and the server in collaboration. The process of determining the image and text constraint information described above is described by taking the server 200 in Figure 1 as an example. See Figure 7, which is a schematic diagram of the method for determining the image and text constraint information provided in an embodiment of the present application. The steps shown in Figure 7 are described below.
[0100] In step 301 , the server extracts image features from each frame of image preceding the i-th frame of image to obtain image features of each frame of image.
[0101] In some embodiments, the image and text constraint information obtained by the server can be achieved through continuous image feature extraction and text feature extraction. For example, image feature extraction is first performed on each frame image before the i-th frame image to obtain the image features of each frame image, and then text feature extraction is performed on the descriptive text associated with each frame image before the i-th frame image to obtain the text features of each frame image. Then, for each frame image before the i-th frame image, the image features are fused separately to obtain the image and text features of each frame image, and the image and text features of each frame image are weighted summed to obtain the image and text constraint information of the i-th frame image.
[0102] In some embodiments, the server can use a machine learning model (such as BLIP) for implementing cross-modal feature extraction to extract image features of each frame image before the i-th frame image on the one hand, and on the other hand, extract text features of the descriptive text associated with each frame image before the i-th frame image using the image features as constraint information to obtain the graphic and text features of each frame image.
[0103] For example, referring to FIG8 , FIG8 is a schematic diagram of the image and text feature extraction process provided in an embodiment of the present application. In the figure, the image and text features are extracted using a BLIP model. The implementation process may include inputting each frame image located before the i-th frame image and extracting visual features, i.e., image features, through a ViT model to obtain corresponding image features.
[0104] Step 302 : Using the image features of each frame as image constraints, extract text features from the description text associated with each frame before the i-th frame to obtain initial image and text features of each frame.
[0105] Among them, the image features of each frame image are used as image constraints, and text features are extracted from the descriptive text associated with each frame image located before the i-th frame image. That is, the image features of each frame image are used to guide the text feature extraction process of the descriptive text associated with the frame image, so that the text feature extraction process is consistent with the image content, thereby improving the accuracy and effectiveness of feature extraction, that is, the initial image and text features are text features that carry image features.
[0106] Continuing from the above example, the description text associated with the frame image is input into BLIP, and the image features of the frame image extracted by ViT are used as constraint information to obtain text features carrying image constraints.
[0107] Step 303: Acquire a second identification feature for indicating the image-text modality, fuse the second identification feature with the initial image-text feature, and use the fusion result as the image-text constraint information of the i-th frame image.
[0108] Continuing with the above example, in order to facilitate calculation, the server also obtains a second identification feature for indicating the image-text modality, and fuses the second identification feature with the text feature carrying the image constraint to obtain the initial image-text feature, and uses the initial image-text feature as the image-text constraint information of the i-th frame image. Among them, the size of the text feature carrying the image constraint (1×3×768) is the same as the size of the flag bit of the image-text modality (1×3×768). In addition, the frame images in the frame image sequence have a temporal relationship. The server can also obtain the time positioning information used to characterize the current frame image, and fuse the initial image-text feature with the time positioning information to obtain the target image-text feature as the image-text constraint information of the i-th frame image. The time positioning information can be used to indicate the playback time point of the frame image in the target video. The frame images in the frame image sequence are arranged according to the corresponding time positioning information.
[0109] Step 1023 , combining the text constraint information and the graphic constraint information to obtain target constraint information.
[0110] In actual implementation, the server obtains text constraint information for the i-th image frame using the aforementioned method for determining text constraint information, and then obtains image-text constraint information for the i-th image frame using the aforementioned method for determining image-text constraint information. The size of the text constraint information for the i-th image frame is the same as the size of the image-text constraint information for the i-th image frame. The text constraint information and the image-text constraint information are merged to obtain the target constraint information for the i-th image frame.
[0111] Step 1024 : Using the frames of image preceding the i-th frame of image as references and based on the target constraint information, constrain the generation process of the i-th frame of image to obtain the i-th frame of image.
[0112] In actual implementation, the server performs diffusion sampling on each frame image before the i-th frame image to obtain a corresponding noise image, and then denoises the noise image based on the target constraint information to generate the i-th frame image.
[0113] In some embodiments, the frame image generation process can be implemented independently by the terminal or the server, or can be implemented jointly by the terminal and the server. The above-mentioned frame image generation process is illustrated by taking the server 200 in Figure 1 as an example to be executed independently. See Figure 9, which is a flow chart of the frame image generation process provided in an embodiment of the present application, and is illustrated in combination with the steps shown in Figure 9.
[0114] In step 401 , the server extracts features from each frame of image preceding the i-th frame of image to obtain image features of each frame of image.
[0115] Step 402: perform feature fusion on the image features of each frame image to obtain fused features.
[0116] Here, performing feature fusion on the image features of each frame of image may be feature splicing or feature superposition on the image features of each frame of image, and the obtained splicing feature is used as the above-mentioned fusion feature.
[0117] In actual implementation, when generating the i-th frame, to ensure consistency with the images preceding the i-th frame, the server extracts features from each frame preceding the i-th frame to obtain image features for each frame. Image feature extraction can also be implemented based on a machine learning model.
[0118] For example, referring to FIG10, FIG10 is a diagram of the generation process of the i-th frame image provided by an embodiment of the present application. In the diagram, the server first inputs the frame image before the i-th frame image into the encoder for encoding, that is, the frame image before the i-th frame image is feature extracted to generate the image feature z (represented by a vector) corresponding to the latent space. After diffusion sampling (which can be achieved through a diffusion model), the latent space representation of z at time T is obtained. After denoising at time T, the latent space representation at time T-1 is predicted. The representation predictions from time T-1 to time T-2 are continued by analogy until the prediction at time T=0. The final prediction is passed through the decoder D to obtain the generated i-th frame image.
[0119] Step 403: Perform a first number of noise additions on the fused features to obtain noisy fused features.
[0120] For example, referring to Figure 10 , diffuse sampling of image features in the latent space is actually performed by adding noise to the fused features (i.e., the image features of multiple frames) for a first number T (T is a positive integer greater than 1) to obtain the noisy fused features. In practical applications, when performing noise addition, the types of noise added include, but are not limited to, Gaussian noise, salt and pepper noise, Poisson noise, etc. The choice of noise type can be determined based on actual needs. Gaussian noise adds noise that follows a Gaussian distribution to the image features, and the degree of noise addition can be controlled by adjusting the standard deviation of the Gaussian distribution. Salt and pepper noise adds black and white noise to the image, where pepper refers to black noise (0, 0, 0) and salt refers to white noise (255, 255, 255). The ratio of noise addition is controlled by setting a parameter value. A larger value adds more noise, resulting in more severe image damage. The first number here refers to the number of noise additions, i.e., the number of noise additions pre-set for the image. Each noise addition produces a noisy image. After completing n noise additions, the final noisy image is obtained and used as the noisy image for subsequent processing.
[0121] Step 404: Based on the target constraint information, perform a second denoising operation on the noisy fusion feature to obtain a denoised fusion feature.
[0122] Continuing with the above example, after obtaining the corresponding denoised fusion features, the denoised fusion features are obtained after denoising the second time. In practical applications, the first and second times can be the same or different. When the first and second times are equal, the first time is set to T, and the first time is denoised to obtain the denoised fusion features at time T. Then, after denoising, the fused features at time T are predicted for the fusion features at time T-1 (i.e., the denoised image corresponding to the noisy image at time T-1). Similarly, the prediction of the denoised images at times T-1 to T-2 is continued until the prediction at time T=0, that is, the image features of the denoised image at time T=0 are obtained.
[0123] In actual application, when performing a second denoising on the noise fusion feature, the target constraint information is used to limit the prediction of the image during the denoising process, that is, to guide the denoising process so that the image features obtained by denoising meet the image features indicated by the target constraint information.
[0124] Step 405: Generate the i-th frame image based on the denoising and fusion features.
[0125] Continuing with the above example, the server will perform the denoising fusion feature obtained by the second denoising to reconstruct the image and obtain the i-th frame image. That is, the server obtains the i-th frame image by decoding the denoising fusion feature.
[0126] In some embodiments, the frame image generation process based on the machine learning model can be implemented independently by the terminal or the server, or can be implemented jointly by the terminal and the server. The example of the server 200 in Figure 1 independently executing the above-mentioned frame image generation process based on the machine learning model is used for illustration. See Figure 11. Figure 11 is a frame image generation method based on the machine learning model provided in an embodiment of the present application, which is explained in combination with the steps shown in Figure 11.
[0127] In step 501 , the server obtains a frame image generation model sequence, where the frame image generation model sequence includes a plurality of serially connected frame image generation models.
[0128] Among them, the frame image generation model has a one-to-one correspondence with other frame images except the initial image (i.e., the first frame image);
[0129] In actual implementation, the server can generate corresponding frame images based on a machine learning model, where the machine learning model can be called a frame image generation model. Since all frame images before the i-th frame image and the corresponding description text are required when generating the i-th frame image, the server uses multiple serially connected frame image generation models to generate corresponding frame images. That is, there is a one-to-one correspondence between the number of frame image generation models and the other frame images in the frame image sequence to be generated except the initial image. For example, if the number of frame images in the frame image sequence to be generated is N, then N-1 serially connected frame image generation models can be used to generate the remaining N-1 frame images except the first frame image.
[0130] For example, see Figure 12, which is a flow chart of a serial frame image generation model provided in an embodiment of the present application. The figure shows two serial frame image generation models, with the input information being an initial image and the output information being a frame image sequence comprising three frame images. The generation process of image 1 is obtained by predicting the initial image and description text 1 used to describe the image content of image 1 through frame image generation model 1. The generation process of image 2 is obtained by predicting the initial image, the generated image 1, description text 1 associated with image 1, and description text 2 associated with image 2 through frame image generation model 2. Finally, the initial image, image 1, and image 2 are synthesized into the target video.
[0131] Step 502: Using the (i-1)th frame image model, based on the description text of the i-th frame image in the frame image sequence, the frame images before the i-th frame image in the frame image sequence, and the description text of the frame images before the i-th frame image, the i-th frame image is predicted to obtain the i-th frame image.
[0132] Continuing with the above example, the description text of the i-th frame image in the frame image sequence, the frame images before the i-th frame image in the frame image sequence, and the description text of the frame images before the i-th frame image can be processed by the (i-1)-th frame image model to predict the i-th frame image and obtain the i-th frame image.
[0133] In some embodiments, the training process of the frame image generation model can be implemented independently by the terminal or the server, or can be implemented collaboratively by the terminal and the server. The training process of the above-mentioned frame image generation model is illustrated by taking the server 200 in Figure 1 as an example. See Figure 13, which is a schematic diagram of the training method of the frame image generation model provided in an embodiment of the present application, and is illustrated in combination with the steps shown in Figure 13.
[0134] In step 601 , the server obtains a plurality of serially connected initial frame image generation models and obtains a reference frame image sequence including a plurality of continuous frame image samples.
[0135] Here, the frame image sample carries description text for describing the next adjacent frame image sample.
[0136] For example, referring to the multiple serially connected frame image generation models shown in FIG12 , the server first obtains an initial frame image generation model that has not yet been trained, and obtains a reference frame image sequence used to train the initial frame image generation model. The reference frame image sequence includes multiple consecutive frame image samples, and each frame image sample carries descriptive text describing the next adjacent frame image sample. For example, if the first frame image sample is person A standing, the second frame image sample is person A in a running-ready posture, and the third frame image sample is person A running, then the first frame image sample may carry the descriptive text "person A in a running-ready posture."
[0137] In some embodiments, referring to FIG14 , FIG14 is a schematic diagram of a video sample processing flow provided by an embodiment of the present application, and the steps shown in FIG14 are described below.
[0138] Step 6011: The server obtains a video sample and a frame sampling interval for the video sample.
[0139] In actual implementation, in order to be able to generate multiple frames of continuous images with the style of film and television works for the input image through a series of frame image generation models, thereby obtaining a corresponding video with the style of film and television works, video samples can be collected from massive film and television dramas, and the initial frame image generation model can be trained with video samples with the style of film and television dramas to make the characteristics of the input image close to the feature space of film and television dramas.
[0140] Step 6012: based on the frame extraction interval, extract frames from the video sample to obtain multiple frame images.
[0141] In actual implementation, in order to reduce the consumption of computing resources, the server first extracts frames for each video sample according to a preset frame extraction interval, such as 1 frame per second, or 1 frame every 2 seconds, etc. The frame extraction interval can be adjusted according to actual conditions.
[0142] Step 6013: cluster the multiple frame images to obtain multiple clusters.
[0143] In some embodiments, the clustering process for video samples can be implemented independently by the terminal or the server, or can be implemented collaboratively by the terminal and the server. The example of the server 200 in Figure 1 independently executing the above-mentioned clustering process for video samples is used for illustration. See Figure 15, which is a flow chart of the clustering process for video samples provided in an embodiment of the present application, and is explained in conjunction with the steps shown in Figure 15.
[0144] In step 701, the server divides each frame image into shots to obtain a plurality of storyboards, and the similarity between the frame images in each storyboard reaches a similarity threshold.
[0145] In actual implementation, the server divides the multiple frames obtained by frame extraction into multiple shots, where the content of the images in the same shot is almost the same (with only slight changes in lighting, action, and object perspective). In other words, the similarity between the frame images in each shot reaches a similarity threshold.
[0146] Step 702: Select a target frame image from the frame images of each storyboard. The target frame image can be used to identify the storyboard.
[0147] In actual implementation, since the similarity between frame images in each storyboard reaches a similarity threshold, in order to reduce the consumption of computing resources, a target frame image can be selected in each storyboard, and the target frame image can be used to identify the storyboard to which it belongs.
[0148] Step 703 : extract features from each target frame image to obtain multiple frame image features.
[0149] In actual implementation, there is a one-to-one correspondence between the frame image features and the target frame image.
[0150] Step 704: cluster the features of the multiple frame images to obtain multiple clusters.
[0151] In actual implementation, the server randomly selects a frame image from each storyboard to represent it. It then uses the image branch of the cross-modal CLIP model to extract features from each target frame image, obtaining multiple frame image features. K-means clustering is then performed on all frame image features to obtain the cluster centers of K clusters. The cluster center to which each frame image belongs is then determined.
[0152] Step 6014: Determine the Euclidean distance between each frame image in each cluster and the corresponding cluster center.
[0153] In actual implementation, the server calculates the Euclidean distance between the frame image in each cluster and the corresponding cluster center.
[0154] Step 6015: determine the distance threshold corresponding to each cluster, and for each frame image in each cluster, determine the frame image with a Euclidean distance less than the distance threshold as a frame image sample, and obtain a reference frame image sequence including multiple continuous frame image samples.
[0155] In actual implementation, the server obtains each corresponding distance threshold and, for each cluster, retains frame image samples whose Euclidean distance is less than the distance threshold, so that each of the K clusters obtained contains relatively clean images.
[0156] In some embodiments, the process of determining the distance threshold can be implemented independently by the terminal or the server, or can be implemented jointly by the terminal and the server. The process of determining the distance threshold performed independently by the server 200 in Figure 1 is used as an example for explanation. See Figure 16, which is a schematic diagram of the process of determining the distance threshold provided in an embodiment of the present application, and is explained in combination with the steps shown in Figure 16.
[0157] Step 801: The server determines, for each cluster, the Euclidean distance between each frame image in the cluster and the cluster center of the cluster.
[0158] In actual implementation, for each cluster, the Euclidean distance between each frame image in the cluster and the cluster center of the cluster is determined.
[0159] Step 802: Determine the maximum value of the Euclidean distance and the minimum value of the Euclidean distance from each Euclidean distance.
[0160] In actual implementation, the server determines the maximum value of the Euclidean distance in each cluster, as well as the minimum and maximum distances of the Euclidean distance, and records the threshold value thr = (max-min) / 2+min.
[0161] Step 803: Obtain the difference between the maximum value and the minimum value, and sum half of the difference with the minimum value, and use the summed result as the distance threshold corresponding to the cluster.
[0162] In actual implementation, the server determines the difference between the maximum and minimum values (max-min), and sums half of the difference (max-min) / 2 with the minimum value min, (max-min) / 2+min. The resulting sum is then used as the distance threshold for the cluster, which can be denoted as thr. That is, thr = (max-min) / 2+min.
[0163] Step 602: Using the first frame image in the reference frame image sequence as the first frame image in the target frame image sequence, generating the i-th frame image in the target frame image sequence through the (i-1)th initial frame image generation model based on the description text of the i-th frame image sample in the target frame image sequence, each frame image sample located before the i-th frame image sample in the target frame image sequence, and the description text of each frame image sample located before the i-th frame image sample, generates the i-th frame image in the target frame image sequence; wherein i is a positive integer greater than 1, and i is less than or equal to the number of frame image samples in the target frame image sequence.
[0164] In actual implementation, the server uses the first frame image in the reference frame image sequence as the first frame image in the target frame image sequence, and generates the i-th frame image through the (i-1)th initial frame image generation model. In the process of generating the i-th frame image, based on the description text of the i-th frame image in the target frame image sequence, the frame images before the i-th frame image in the target frame image sequence, and the description text of the frame images before the i-th frame image, target constraint information for the i-th frame image in the target frame image sequence is generated, and based on the target constraint information, the generation process of the (i-1)th initial frame image generation model for the i-th frame image in the target frame image sequence is constrained.
[0165] Step 603: traverse i to predict each frame image in the target frame image sequence.
[0166] In actual implementation, the server traverses i, that is, it iteratively executes the above-mentioned generation process for the i-th frame image in the target frame image sequence for different values of i, thereby predicting each frame image in the target frame image sequence.
[0167] Step 604 : Obtain the difference between the target frame image sequence and the reference frame image sequence, and based on the difference, update the model parameters of each initial frame image generation model to obtain a series of frame image generation models.
[0168] In actual implementation, for the other frame images in the target frame image sequence except the first frame image, the differences between the current frame image and the frame image sample at the current position in the reference frame image sequence are determined in turn. Based on the corresponding differences, the model parameters of the corresponding initial frame image generation model are updated to obtain multiple trained serial frame image generation models.
[0169] Exemplarily, the MSE loss can be used to calculate the difference between the current frame image and the frame image sample at the current position in the reference frame image sequence, that is, the mean square error of the pixel value at the same position of the current frame image in the target frame image sequence and the frame image sample at the corresponding position in the reference frame image sequence is used as the difference between the current frame image and the frame image sample at the current position in the reference frame image sequence.
[0170] Step 103 : Perform video synthesis on each frame image in the frame image sequence to obtain a target video.
[0171] During actual implementation, the server performs video synthesis on each frame image in the generated frame image sequence to obtain the target video.
[0172] In some embodiments, the server can also determine the attribute information of the target video in the following manner: the server obtains the frame rate of the target video, and the frame rate is used to indicate the number of continuous frame images played per second in the target video; determines the ratio of the number of frame images in the frame image sequence to the frame rate as the duration of the target video, and determines the duration as the attribute information of the target video.
[0173] In actual implementation, the video synthesis method can be that the server obtains a preset frame rate, and based on the frame rate, synthesizes each frame image in the frame image sequence into a target video with a target duration, and the target duration is equal to the ratio of the number of frame images in the frame image sequence to the preset frame rate.
[0174] For example, the number of frame images in the frame image sequence is 120, and the preset frame rate is 15fps (Frames Per Second), then the target duration of the generated target video is 120 / 15=8 seconds; if the preset frame rate is 20fps, then the target duration of the generated target video is 120 / 20=6 seconds.
[0175] By applying the above-mentioned embodiment of the present application, when generating each frame image in the frame image sequence to be generated, the frame images preceding the frame image and the descriptive text associated with the frame images preceding the frame image are used as target constraint information to constrain the generation process of each frame image. In this way, the generated frame image can maintain content consistency with the frame images preceding the frame image. In addition, by training a frame image generation model with video samples having a film and television style, a plurality of continuous frame images with a corresponding film and television style can be generated from an initial image, thereby generating a target video with a film and television style. In this way, it can be used to imitate and generate a film and television work for an image, thereby enriching the expressive content of the image. In addition, a method for predicting the current frame image based on the corresponding constraint information generated by the frame image preceding the current frame image can decompose the video generation process into the prediction task of the next frame image, thereby achieving efficient and fast generation of continuous frame images.
[0176] Next, we will continue to introduce the video generation method provided in the embodiment of the present application. Figure 17 is another flow chart of the video generation method provided in the embodiment of the present application. Here, taking multiple serial frame image generation models running on the server as an example, see Figure 17. The video generation method provided in the embodiment of the present application is implemented collaboratively by the terminal and the server.
[0177] In step 901 , the terminal sends a video generation request to the server in response to a video generation operation based on an initial image and a description text of each frame of the video to be generated.
[0178] Exemplarily, the video to be generated is the target video to be generated. The video to be generated is composed of a sequence of frame images to be generated. The video generation request carries an initial image which is the first frame image in the sequence of frame images to be generated, and a description text for each frame image in the sequence of frame images to be generated.
[0179] Step 902: The server parses the video generation request to obtain an initial image and a description text for each frame image in the frame image sequence to be generated.
[0180] In step 903 , the server inputs the initial image and the description text for each frame image in the frame image sequence to be generated into a plurality of serially connected frame image generation models.
[0181] For example, the frame image generation model has a one-to-one correspondence with the frame images other than the initial image. The server determines the obtained initial image as the first frame image in the frame image sequence to be generated, and obtains description text for each frame image in the frame image sequence. Before using multiple serially connected frame image generation models, the server can train the multiple serially connected frame image generation models in the following manner: obtain multiple serially connected initial frame image generation models and a reference frame image sequence including multiple continuous frame image samples, where the frame image samples carry description text for describing the next adjacent frame image sample; use the first frame image sample in the reference frame image sequence as the first frame image in the target frame image sequence, and generate the i-th frame image in the target frame image sequence through the (i-1)th initial frame image generation model based on the description text of the i-th frame image in the target frame image sequence, the frame images before the i-th frame image in the target frame image sequence, and the description text of the frame images before the i-th frame image; traverse i to predict each frame image in the target frame image sequence; obtain the difference between the target frame image sequence and the reference frame image sequence, and based on the difference, update the model parameters of each initial frame image generation model to obtain a serially connected frame image generation model.
[0182] In step 904, the server uses the (i-1)th frame image model to extract features of the description text of the i-th frame image in the frame image sequence and the description texts of the frame images before the i-th frame image to obtain the description text features of each frame image.
[0183] Step 905 : Acquire a first identification feature for indicating a text modality, fuse the first identification feature with the descriptive text feature, and use the fusion result as text constraint information of the i-th frame image.
[0184] Step 906 : extract image features from each frame of image preceding the i-th frame of image to obtain image features of each frame of image.
[0185] Step 907 , using the image features of each frame as image constraints, extracting text features from the description text associated with each frame before the i-th frame to obtain initial image and text features of each frame.
[0186] Step 908 : Acquire a second identification feature for indicating the image-text modality, fuse the second identification feature with the initial image-text feature, and use the fusion result as the image-text constraint information of the i-th frame image.
[0187] Step 909 : Combine the text constraint information and the graphic constraint information to obtain target constraint information.
[0188] Step 910 : Taking each frame image before the i-th frame image as a reference and based on the target constraint information, constraining the generation process of the i-th frame image to obtain the i-th frame image.
[0189] Step 911: traverse i to obtain each frame image in the frame image sequence.
[0190] Step 912: Perform video synthesis on each frame image in the frame image sequence to obtain a target video, and send the target video to the terminal.
[0191] Step 913: The terminal receives the target video returned by the server and performs a target operation on the target video.
[0192] The target operation includes one or more of the following: play, download, share, etc.
[0193] By applying the embodiments of the present application, a method for predicting the current frame image is performed based on the corresponding constraint information generated by the frame image located before the current frame image. This method can not only decompose the video generation process into the prediction task of the next frame image, thereby achieving efficient and fast generation of continuous frame images, but also maintain content consistency between the generated frame image and the frame images before the current frame image.
[0194] It should be noted that the multiple and multiple mentioned in this article refer to at least two or at least two.
[0195] Below, an exemplary application of the embodiment of the present application in a practical application scenario will be described.
[0196] In film and television scenarios, when users upload an image, they often want to use video technology to animate it into a film-style animation. This means animating the image in a way that evokes the same motion as in film and television, such as creating short videos showing a character's expression or changing scenery. While text-to-image technology works well for generating cartoons and artistic landscapes, it struggles with generating images of film-style scenes and characters. In addition, image-to-text technology cannot guarantee consistency between the output image and the input image due to random noise, often resulting in inconsistent results, such as inconsistent characters, backgrounds, or scenes.
[0197] Based on this, an embodiment of the present application provides a video generation method, which is based on the diffusion model latent space image generation technology, designs a continuous frame generation model for film and television works (also known as a sequence model, that is, the frame image generation model connected in series in the previous article), and converts video generation into continuous frame image generation, that is, by inputting an image to generate the next frame image consistent with it, completing the prediction task of the next frame image of the current image; at the same time, in order to improve the correlation between adjacent frame images, when generating the next frame image of the image, the process of generating the next frame image by the continuous frame generation model is constrained by referring to the historical frame information (that is, the relevant information of the frame image before the current frame image), so that the generated next frame image is consistent with the current image; at the same time, through the collection of training sets from massive film and television dramas, the latent space mapping module of the continuous frame generation model is trained with the training sets of film and television drama works so that the features of the input image are close to the feature space of the film and television drama.
[0198] The video generation method provided in the embodiment of the present application: not only collects training sets based on massive film and television dramas as supervision information for image generation; but also designs a continuous frame generation framework to generate the next frame image based on the input image, thereby forming a continuous frame generation model (i.e., the frame image generation model mentioned above); in addition, it also improves the scene and content relevance between adjacent frame images of the video through the accumulation input of historical frame image information, thereby making the generated video adjacent frame images more coordinated.
[0199] For example, referring to FIG18A, FIG18A is a schematic diagram of a general flow of a method for generating a video provided by an embodiment of the present application. First, given an initial image, a continuous frame generation model is used to continuously generate multiple subsequent frame images that conform to the data space of a film and television drama; then, the continuous frame images are executed for video synthesis to obtain a target video. In actual implementation, the user uploads the initial image and a prompt word related to the video to be generated (such as "cute", etc.). The electronic device (server or terminal) equipped with the continuous frame generation model selects a corresponding continuous frame generation model based on the initial image uploaded by the user (such as uploading a person, selecting a continuous frame generation model trained by the person; if uploading a landscape image, selecting a continuous frame generation model trained by the landscape image); the continuous frame image is generated by the selected continuous frame generation model, and the generated continuous frame image and the initial image are merged into the target video and returned to the user. For example, see Figure 18B, which is a visual schematic diagram of multi-frame image generation provided by an embodiment of the present application. In the figure, the user inputs an image and predicts 4 new frame images. The synthesized video includes 5 frames of images. Except for the first frame image, the other frame images are generated based on other frame images before themselves and the corresponding descriptive text.
[0200] The generation process of continuous frame images is explained, referring to Figure 12. The generation process is as follows: 1) Generate one result for the initial image and prompt word uploaded by the user (i.e., description text 1 in the previous text), which contains multiple images; 2) Select one image from multiple images as the current moment image (i.e., image 1 in the previous text); 3) Use historical moment images, historical prompt words, and current moment prompt words (when the user does not enter a prompt word at the current moment, the current moment prompt word is set to empty) as model input to generate one result; 4) Repeat steps 2) to 3) until N images are generated. For example, a user uploads an initial image 0 and description text 1, and after the continuous frame generation model, image 1 is generated. Then, the initial image 0, description text 1, image 1, and description text 2 are input into the continuous frame generation model again to generate image 2. This process is repeated to generate image 3, image 4, ..., image N in sequence, where N is the number of generated frame images. When N is known, target videos of different lengths can be synthesized according to different frame rates. For example, if 75 frame images are generated, a video of 75 / 15 = 5 seconds can be generated at a frame rate of 15fps.
[0201] The continuous frame generation model for generating continuous frame images is described. Referring to Figure 19, Figure 19 is a structural diagram of the continuous frame generation model provided by an embodiment of the present application. After the text features of the historical description text are extracted, and after the image features of the historical image are extracted, the historical text features and image features are fused to obtain historical information. For the user's current input information, if there is no description text, the description text is input into the continuous frame generation model using the default value (empty). After the text features of the description text at the current moment (such as text 3 in the figure) are extracted, they are spliced with the historical information to finally form the constraint information generated by the continuous frame generation model at the current moment. The overall process of the continuous frame generation model is implemented using a generative model based on a latent space diffusion (SSD) algorithm. First, a 256x256 noisy image x is generated using Gaussian random noise as the overall input. This image is passed through the encoder to obtain a latent space representation. The latent space diffusion model samples the latent space representation of the noisy image x at time T (note that T is not related to the current time in the sequence frame generation process. The T time moments here can be understood as T restoration operations, and the overall video sequence generation can be understood as each frame in the video frame sequence being generated by a generative model with T steps). This latent space representation at time T is passed through a denoising U-Net module (which includes historical information constraints) to predict the latent space representation at time T-1. The representation at time T-1 is then fed into the U-Net input to predict the representation at time T-2. This process repeats for T steps, resulting in a predicted representation at time T = 0. This representation at time T = 0 is passed through the decoder to produce the generated image y. This completes the generation of a single frame, i.e., the process of generating image 1 from the initial image.
[0202] For an explanation of the open source stable-diffusion, see Figure 20, which is a schematic diagram of the standard diffusion model provided by the embodiment of the present application. Assuming that each noise image is obtained through T steps of noise sampling, and performing T steps of denoising on this process, the original noise image can be predicted. The generation process of the model refers to the figure below: first randomly generate a noise image x, generate a latent space representation z through the encoder ε, and obtain the latent space representation of z at time T through the diffusion model sampling. At time T, the latent space representation of time T-1 is predicted through the u-net module, and the representation prediction from time T-1 to time T-2 is continued in this way until the prediction at time T=0. The final prediction is passed through the decoder D to obtain the generated image. During training, in order to ensure that the generated image is related to the text under the specified text, the text encoding (or other such as image, etc.) is used as the attention feature in the denoising U-Net module, so that the denoising process is subject to the text attention constraint. At the same time, the generated image uses the image in the image-text annotation sample pair as supervision information, thereby ensuring that the image generated by the model is related to the text under the input of the specified text. In some embodiments, a user image may be provided, and the text in the above process may be replaced with the image as a constraint, and the next image may be generated through the above process (also referred to as an img2img process).
[0203] For the denoising U-Net module, see Figure 21A. Figure 21A is a schematic diagram of the U-Net process without adding constraint information provided by an embodiment of the present application. The latent space features at time T are passed through U-Net to obtain a representation prediction at time T-1. In an application scenario where historical image and text information is required as constraint information to predict a new image, new constraints that can process historical information can be added on the basis of the U-Net structure shown in Figure 21A. See Figure 21B. Figure 21B is a schematic diagram of the U-Net with added constraint information provided by an embodiment of the present application. In the figure, IGTE is a BLIP-based text extraction model. The image and text constraint information is determined by IGTE. For the BLIP-based text extraction model, see Figure 22. Figure 22 is a structural schematic diagram of the BLIP-based text extraction model provided by an embodiment of the present application. In Figure 22, image 1 is subjected to image feature extraction by ViT to obtain image features. The corresponding description text is subjected to text feature extraction by BLIP, and the image features extracted by ViT are combined to generate image constraint text. In actual implementation, IGTE directly uses the open source model weights, and the model parameters of the model do not need to be updated subsequently. In actual implementation, as shown in Figure 21B, for all historical texts (texts 1 and 2), text feature 0 (i.e., the descriptive text feature mentioned above) is extracted through the CLIP text branch. Text feature 0 is a matrix feature of size 2×1×768 composed of multiple text vectors. Then, a flag bit 0 representing the text modality is added (using a vector representation of size 2×1×768) to obtain text feature 1. Text feature 1 is also a matrix feature of size 2×1×768 composed of multiple text vectors. The flag bit represents a 2×1×768 three-dimensional matrix with all elements being 0. For all historical and current image-text information, the image-text feature extraction is performed through the IGTE model to obtain the text feature with image constraint (i.e., the image-text feature in the previous article) 0. The text feature with image constraint is a matrix feature of size 1x3x768. In order to align the first dimension of text feature 0, the text feature 0 with image constraint is copied once along the first dimension to obtain the text feature 1 with image constraint. The size of the text feature 1 with image constraint is a 2x3x768 matrix. Then, the flag bit representing the image-text modality is added (the flag bit size is 2×3×768) to obtain the text feature 2 with image constraint. The text feature 2 with image constraint is a matrix feature of size 2×3×768. Then, the time series flag bit is combined to obtain the text feature 3 with image constraint (the matrix feature of size 2×3×768) (2x3x768). Finally, the text feature 1 and the text feature 3 with image constraint are spliced to obtain the final historical constraint information (the matrix feature of size 2×4×768). Where “+” represents vector addition and “C” represents vector concatenation.The historical constraint information is input into the denoising U-Net. After T denoising cycles with constraint information, the noisy latent representations of the historical Figures 1 and 2 are subjected to the final noise prediction at time 0. That is, the latent representations of Figures 1 and 2 are restored by subtracting the noise prediction at time 0 from the noisy representation. In actual implementation, the image branch of the cross-modal CLIP model is used to extract image features, and the text branch to extract text features. Open-source model weights are directly used, eliminating the need to update the CLIP model parameters later.
[0204] The collection of training data (i.e., the reference frame image sequence obtained based on the video sample in the previous text) is explained. In some embodiments, for the sample data required for the training sequence model, see Figure 23, which is a schematic diagram of the training data collection process provided by an embodiment of the present application. The collection of training data (i.e., the video sample in the previous text) includes at least the following four steps: 1) frame extraction from film and television works; 2) cross-modal model representation; 3) data clustering and cleaning; 4) labeling of image and text sample pairs. Among them, the implementation of frame extraction from film and television works may include: extracting 1 frame per second for movies and TV series videos (the frame extraction interval can be adjusted as needed, such as extracting 1 frame every 2 seconds, etc.). The extracted frames are divided into shots to obtain multiple storyboards, each of which includes multiple frame images. See Figure 24, which is a schematic diagram of the storyboard operation for video samples provided by an embodiment of the present application. In the figure, numbers 1 and 2 correspond to different adjacent storyboards, wherein the image content in the same storyboard is almost the same (there are only slight changes in lighting, action, and object perspective). At this time, the sequence images in each storyboard can be used as supervision information for the generation of sequence images. Supervisory information such as sequence diagram 1 shown in number 1 is used as a constraint input model, and the model needs to generate a result close to sequence diagram 2. At this time, sequence diagram 2 is the generation supervisory information of sequence diagram 1.
[0205] In actual implementation, the realization method of cross-modal model representation is: for each storyboard, one image is randomly selected to represent the storyboard, and the image extracts cross-module feature representation. This article uses the image branch of the open source cross-modal CLIP model to extract video frame representation.
[0206] In practice, the data clustering and cleaning process involves: 1) performing k-means clustering on all representations (i.e., the frame image features mentioned above) to obtain K cluster centers (e.g., cluster 2); 2) finding the cluster center for each frame; 3) calculating the Euclidean distance between the frame and the center in each cluster, obtaining the minimum and maximum distances (max and min) within the cluster, and recording a threshold (thr = (max - min) / 2 + min); 4) for each cluster, only saving samples whose distance from the center is less than the threshold (thr). This results in K clusters, each containing a relatively clean image.
[0207] In practice, the process of labeling image-text pairs is as follows: For all clustered images, the image description is annotated. For example, if an image shows someone speaking, the corresponding description is labeled as "A man in a suit speaking, half-length portrait." This results in labeled image-text pairs. Since each image represents a storyboard, the sequence diagrams within that storyboard share the same textual information as the image.
[0208] The training process of the continuous frame generation model is explained. Figure 20 shows a stable-diffusion-based sequence model, including the CLIP model for extracting prompt text features, the VAE model for decoding and generating images, the diffusion model (diffusers) for generating random noise, and the U-Net for denoising. Among them, the VAE, CLIP, BLIP, and U-Net modules are all initialized with the open source model weights, and the VAE, CLIP, and BLIP retain the open source model weights. This model does not learn, and only the U-Net model is trained. The dataset (the video sample in the previous article) collects x images for each storyboard. Since different storyboards have different numbers of images, in order to avoid data volume differences, the model specifies every 3 images as a sequence data group. Therefore, each storyboard has 3 pictures. For storyboards with more than 3 pictures, all consecutive 3 pictures are traversed (for example, for 5 pictures: Picture 123, Picture 234, Picture 345 form 3 sequence data groups. For the N sequence data groups in the full training, each bs sequence data is a batch input into the model to learn and update the model parameters once, and a total of N / bs batches of data are learned as one round of model training. When learning each batch of data, the U-Net network in Figure 21B is used as the parameter to be learned according to the above process: 1) forward calculation of the input data to obtain noise prediction; 2) calculate the MSE loss of the noise prediction; 3) backward calculation to obtain the updated gradient of the model parameters; 4) use the SGD gradient update method to update the model band learning parameters to complete one batch training. Repeat the above steps to complete all (N / bs) batch training and end one iteration. Initially, a learning rate of 0.0005 can be used. After every 10 rounds of learning, the learning rate is reduced to 0.1 times the original rate. Whether to continue training is determined based on whether the loss decreases. If the loss no longer decreases, training is stopped; or when a specified number of iterations is reached, such as 100 epochs, the training is stopped.
[0209] The prediction loss of the noise image during model training is explained. The MSE loss is calculated by the mean square error of the input noise image and the output noise prediction image. The calculation formula of the MSE loss is as follows: Among them, y is the pixel value of each point in the image, and p represents the pixel of the noise prediction map. The difference in the values of pixels at the same position.
[0210] The reasoning process of the continuous frame generation model is explained, referring to Figure 25, which is a schematic diagram of the reasoning process of the continuous frame image provided by the embodiment of the present application. First, adapt to various user inputs: 1) The user inputs text (i.e., the descriptive text in the previous text) 1. When there is no image 1, Figure 1 is generated through the process shown in the figure number 1; 2) The user inputs an image 1 but no text 1, then text 1 is set to empty; 3) The user inputs image 1 and text 1, and no processing is required. Then, the input data is organized in the form of <Figure 1, text 1>, <Figure 2, text 2> shown in the figure number 2, where, by default, if the user does not enter text, text 2 is empty. When the user enters text at this moment, text 2 is the user-entered text. Figure 2 is generated with the help of a sequence model, where the noise map x0 needs to be the same as the input image in the process shown in the figure number 1. Then, Figure 3 is generated according to the process shown in the figure number 3. Finally, Figures 1, 2, and 3 are synthesized in sequence to obtain the target video. It should be noted that in order to simplify the process, the process of generating three consecutive frames during inference is introduced. You can also continue to generate more frames to form a longer video.
[0211] Applying the above embodiments of the present application has the following beneficial effects:
[0212] 1) It can generate film and television works imitating an image uploaded by the user, thereby enriching the expressive content of the user's image. For example, if a user uploads an image of a smile, a video of a gradually laughing person will be generated, making the information expressed by the image richer.
[0213] 2) An image can also be animated. For example, for an illustration in a book, the model can generate subsequent frame images to form a small video, so that the image can change dynamically and become a moving picture.
[0214] 3) Design a continuous frame generation system. This allows users to input an image and generate a new image in the style of a film or television work. By applying continuous frame constraints, the resulting video is a sequence of images, ensuring consistent information between frames. This system can generate a film or television-like image from a user's uploaded image, enriching the user's image's expressive content. For example, if a user uploads an image of a smile, a video of a gradual laugh will be generated, enriching the information conveyed by the image.
[0215] 4) Establish a next-frame prediction method based on historical frame constraints, including how to organize historical frame information and the data process during application, so as to effectively decompose video generation into the next-frame prediction task and achieve efficient and fast image sequence.
[0216] The following further describes an exemplary structure of the video generation device 555 provided in an embodiment of the present application implemented as a software module. In some embodiments, as shown in FIG2 , the software modules stored in the video generation device 555 in the memory 550 may include:
[0217] The acquisition module 5551 is configured to determine the acquired initial image as the first frame image in the frame image sequence to be generated, and obtain description text of each frame image in the frame image sequence;
[0218] a generating module 5552 configured to iteratively generate each frame image in the frame image sequence that is located after the first frame image based on the first frame image and the description text of each frame image in the frame image sequence;
[0219] The synthesis module is configured to perform video synthesis on each frame image in the frame image sequence to obtain a target video.
[0220] In some embodiments, the generating module is further configured to generate the i-th frame image based on the description text of the i-th frame image in the frame image sequence, each frame image in the frame image sequence that is located before the i-th frame image, and the description text of each frame image that is located before the i-th frame image; wherein i is a positive integer greater than 1, and i is less than or equal to the number of frame images in the frame image sequence; traversing i to obtain each frame image in the frame image sequence;
[0221] In some embodiments, the generation module is further configured to generate text constraint information of the i-th frame image based on the description text of the i-th frame image in the frame image sequence and the description text of each frame image located before the i-th frame image; generate graphic and text constraint information of the i-th frame image based on each frame image located before the i-th frame image and the description text of each frame image; wherein the text constraint information and the graphic and text constraint information are both used to constrain the image content of the i-th frame image; the text constraint information and the graphic and text constraint information are fused to obtain target constraint information; with the frame images located before the i-th frame image as a reference, the generation process of the i-th frame image is constrained based on the target constraint information to obtain the i-th frame image.
[0222] In some embodiments, the generation module is further configured to perform feature extraction on the description text of the i-th frame image in the frame image sequence and the description text of each frame image located before the i-th frame image, respectively, to obtain the description text features of each frame image; obtain a first identification feature for indicating the text modality, and fuse the first identification feature with the description text feature, and use the fusion result as the text constraint information of the i-th frame image.
[0223] In some embodiments, the generation module is further configured to perform image feature extraction on each frame image located before the i-th frame image to obtain the image features of each frame image; use the image features of each frame image as image constraints, perform text feature extraction on the descriptive text associated with each frame image located before the i-th frame image to obtain the initial image and text features of each frame image; obtain a second identification feature for indicating the image and text modality, and fuse the second identification feature with the image and text feature, and use the fusion result as the image and text constraint information of the i-th frame image.
[0224] In some embodiments, the generation module is further configured to perform feature extraction on each frame image located before the i-th frame image to obtain image features of each frame image; perform feature fusion on the image features of each frame image to obtain fusion features; perform a first number of noise addition on the fusion features to obtain noisy fusion features; based on the target constraint information, perform a second number of denoising on the noisy fusion features to obtain denoised fusion features; and generate the i-th frame image based on the denoised fusion features.
[0225] In some embodiments, the generation module is further configured to obtain a plurality of serially connected frame image generation models, wherein the frame image generation models have a one-to-one correspondence with other frame images except the initial image; through the (i-1)th frame image model, based on the description text of the i-th frame image in the frame image sequence, the frame images before the i-th frame image in the frame image sequence, and the description text of the frame images before the i-th frame image, the i-th frame image is predicted to obtain the i-th frame image.
[0226] In some embodiments, the generation module is further configured to obtain a plurality of serially connected initial frame image generation models and a reference frame image sequence comprising a plurality of continuous frame image samples, wherein the frame image samples carry description text for describing the next adjacent frame image; using the first frame image sample in the reference frame image sequence as the first frame image in the target frame image sequence, and generating the i-th frame image in the target frame image sequence through the (i-1)th initial frame image generation model based on the description text of the i-th frame image in the target frame image sequence, the frame images before the i-th frame image in the target frame image sequence, and the description text of the frame images before the i-th frame image; wherein i is a positive integer greater than 1, and i is less than or equal to the number of frame image samples in the target frame image sequence; traversing i to predict each frame image in the target frame image sequence; obtaining the difference between the target frame image sequence and the reference frame image sequence, and updating the model parameters of each of the initial frame image generation models based on the difference to obtain the serially connected frame image generation model.
[0227] In some embodiments, the generation module is further configured to obtain video samples and a frame sampling interval for the video samples; based on the frame sampling interval, the video samples are frame sampled to obtain multiple frame images; the multiple frame images are clustered to obtain multiple clusters; the Euclidean distance between each frame image in each cluster and the corresponding cluster center is determined; the distance threshold corresponding to each cluster is determined, and for each frame image in each cluster, the frame image whose Euclidean distance is less than the distance threshold is determined as a frame image sample, and a reference frame image sequence including multiple continuous frame image samples is obtained.
[0228] In some embodiments, the generation module is further configured to perform shot division on each of the frame images to obtain a plurality of storyboards, wherein the similarity between the frame images in each storyboard reaches a similarity threshold; select a target frame image from the frame images of each storyboard, wherein the target frame image can be used to identify the storyboard; perform feature extraction on each of the target frame images to obtain a plurality of frame image features; and cluster the plurality of frame image features to obtain the plurality of clusters.
[0229] In some embodiments, the generation module is further configured to determine, for each cluster, the Euclidean distance between each frame image in the cluster and the cluster center of the cluster; determine the maximum value of the Euclidean distance and the minimum value of the Euclidean distance from each of the Euclidean distances; obtain the difference between the maximum value and the minimum value, and sum half of the difference with the minimum value, and use the summed result as the distance threshold corresponding to the cluster.
[0230] In some embodiments, the synthesis module is further configured to obtain the frame rate of the target video, where the frame rate is used to indicate the number of consecutive frame images played per second in the target video; determine the ratio of the number of frame images in the frame image sequence to the frame rate as the duration of the target video, and determine the duration as the attribute information of the target video.
[0231] The present invention provides a computer program product including computer-executable instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the electronic device to perform the video generation method described in the present invention.
[0232] An embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions, wherein computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, the processor will execute the video generation method provided by an embodiment of the present application, for example, the video generation method shown in Figure 3.
[0233] In some embodiments, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory, a magnetic surface memory, an optical disk, or a CD-ROM; or various devices including one or any combination of the above memories.
[0234] In some embodiments, computer-executable instructions may be in the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.
[0235] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinating files (e.g., files storing one or more modules, subroutines, or code portions).
[0236] By way of example, computer-executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed across multiple sites and interconnected by a communication network.
[0237] In summary, the embodiments of the present application have the following beneficial effects: when generating each frame image in the frame image sequence to be generated, the frame images before the frame image and the descriptive text associated with the frame images before the frame image are used as target constraint information to constrain the generation process of each frame image. In this way, the generated frame image can maintain content consistency with the frame images before the frame image. In addition, a frame image generation model is obtained by training video samples with film and television styles, and an initial image can be generated into multiple continuous frame images with corresponding film and television styles, thereby generating a target video with film and television styles. In this way, it can be used to imitate and generate film and television works for an image, thereby enriching the expression content of the image. In addition, a method for predicting the current frame image based on the corresponding constraint information generated by the frame image before the current frame image can decompose the video generation process into the prediction task of the next frame image, thereby achieving efficient and fast generation of continuous frame images.
[0238] The above description is merely an embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modifications, equivalent replacements, and improvements made within the spirit and scope of the present application are included in the scope of protection of the present application.
Claims
1. A method for generating a video, the method being performed by an electronic device, the method comprising: Acquire an initial image and acquire a plurality of description texts, each of the description texts being used to describe a frame image in a frame image sequence to be generated; Taking the initial image as the first frame image, iteratively generating at least one frame image after the first frame image based on the first frame image and the plurality of description texts, so as to obtain a frame image sequence consisting of the first frame image and the at least one frame image; Perform video synthesis on each frame image in the frame image sequence to obtain a target video.
2. The method of claim 1, wherein: The method of taking the initial image as the first frame image and iteratively generating at least one frame image after the first frame image based on the first frame image and the plurality of description texts comprises: Generate the i-th frame image based on the first frame image, the multiple description texts, each frame image before the i-th frame image in the frame image sequence, and the description texts of each frame image before the i-th frame image; Wherein, i is a positive integer greater than 1, and i is less than or equal to a preset number; The i is traversed to obtain each frame image after the first frame image in the frame image sequence.
3. The method of claim 2, wherein: The step of generating the i-th frame image based on the first frame image, the plurality of description texts, each frame image before the i-th frame image in the frame image sequence, and the description texts of each frame image before the i-th frame image comprises: Generate text constraint information of the i-th frame image based on the description text of the i-th frame image in the frame image sequence and the description texts of each frame image before the i-th frame image; Generate image-text constraint information of the i-th frame image based on each frame image including the first frame image and the description text of each frame image; wherein the text constraint information and the image-text constraint information are both used to constrain the image content of the i-th frame image; The text constraint information and the graphic constraint information are merged to obtain target constraint information; The i-th frame image is generated based on the target constraint information.
4. The method of claim 3, wherein: The generating of the text constraint information of the i-th frame image based on the description text of the i-th frame image in the frame image sequence and the description texts of each frame image before the i-th frame image comprises: Extracting features of the description text of the i-th frame image in the frame image sequence and the description texts of each frame image before the i-th frame image to obtain the description text features of each frame image; A first identification feature for indicating a text modality is acquired, and the first identification feature is fused with the descriptive text feature, and the fusion result is used as text constraint information of the i-th frame image.
5. The method of claim 3, wherein: The step of generating the image-text constraint information of the i-th frame image based on the frame images including the first frame image and the description texts of the frame images includes: Extracting image features of each frame of image before the i-th frame of image to obtain image features of each frame of image; Taking the image features of each frame of image as image constraints, extracting text features of the description text associated with each frame of image before the i-th frame of image, and obtaining initial image and text features of each frame of image; A second identification feature for indicating a graphic mode is obtained, the second identification feature is fused with the initial graphic feature, and the fusion result is used as the graphic constraint information of the i-th frame image.
6. The method of claim 3, wherein: The step of generating the i-th frame image based on the target constraint information includes: Extract features of each frame image before the i-th frame image to obtain image features of each frame image; Performing feature fusion on the image features of each of the frame images to obtain fused features; Performing a first number of noise additions on the fused features to obtain noisy fused features; Based on the target constraint information, performing a second denoising operation on the noisy fusion feature to obtain a denoised fusion feature; Based on the denoising and fusion features, the i-th frame image is generated.
7. The method of claim 2, wherein: The generating the i-th frame image based on the first frame image, the description text of the i-th frame image in the frame image sequence, each frame image before the i-th frame image in the frame image sequence, and the description text of each frame image before the i-th frame image comprises: Acquire a frame image generation model sequence, wherein the frame image generation model sequence includes a plurality of frame image generation models connected in series, wherein the frame image generation models have a one-to-one correspondence with other frame images except the first frame image; The i-th frame image is predicted by the (i-1)th frame image model based on the description text of the i-th frame image in the frame image sequence, the frame images before the i-th frame image in the frame image sequence, and the description text of the frame images before the i-th frame image, so as to obtain the i-th frame image.
8. The method of claim 7, wherein: Before acquiring the frame image generation model sequence, the method further includes: Acquire multiple series-connected initial frame image generation models, and acquire a reference frame image sequence including multiple continuous frame image samples, wherein the frame image samples carry description text for describing the next adjacent frame image sample; Taking the first frame image sample in the reference frame image sequence as the first frame image in the target frame image sequence, generating the i-th frame image in the target frame image sequence through the (i-1)th initial frame image generation model based on the description text of the i-th frame image in the target frame image sequence, the frame images before the i-th frame image in the target frame image sequence, and the description texts of the frame images before the i-th frame image; Wherein, i is a positive integer greater than 1, and i is less than or equal to the number of frame image samples in the target frame image sequence; Traversing the i to predict each frame image in the target frame image sequence; The difference between the target frame image sequence and the reference frame image sequence is obtained, and based on the difference, the model parameters of each of the initial frame image generation models are updated to obtain the frame image generation model sequence.
9. The method of claim 8, wherein: The obtaining of a reference frame image sequence including a plurality of continuous frame image samples comprises: Obtaining a video sample and a frame extraction interval for the video sample; Based on the frame extraction interval, extract frames of the video sample to obtain multiple frame images; Clustering the multiple frame images to obtain multiple clusters; Determine the Euclidean distance between each frame image in each cluster and the corresponding cluster center; For the frame images in each cluster, the frame images whose Euclidean distance is less than the distance threshold are determined as frame image samples, and a reference frame image sequence including a plurality of continuous frame image samples is obtained.
10. The method of claim 9, wherein: The clustering of the plurality of frame images to obtain a plurality of clusters includes: Performing shot division on each of the frame images to obtain a plurality of split shots, wherein the similarity between the frame images in each split shot reaches a similarity threshold; A target frame image is selected from each of the frame images of the split mirror, and the target frame image can be used to identify the Describe the storyboard; Extracting features from each of the target frame images respectively to obtain a plurality of frame image features; The plurality of frame image features are clustered to obtain the plurality of clusters.
11. The method of claim 9, wherein: Before determining, for each frame image in each cluster, the frame image whose Euclidean distance is less than the distance threshold as a frame image sample, the method further includes: For each cluster, respectively determining the Euclidean distance between each of the frame images in the cluster and the cluster center of the cluster; Determine the maximum value of the Euclidean distance and the minimum value of the Euclidean distance from each of the Euclidean distances; The difference between the maximum value and the minimum value is obtained, and half of the difference is summed with the minimum value, and the summed result is used as the distance threshold corresponding to the cluster.
12. The method of claim 1, wherein: After performing video synthesis on each frame image in the frame image sequence to obtain a target video, the method further includes: Acquire the frame rate of the target video, where the frame rate is used to indicate the number of consecutive frame images played per second in the target video; A ratio of the number of frame images in the frame image sequence to the frame rate is determined as the duration of the target video, and the duration is determined as the attribute information of the target video.
13. A video generation device, the device comprising: An acquisition module, configured to acquire an initial image and acquire a plurality of description texts, each of which is used to describe a frame image in a frame image sequence to be generated; A generating module, configured to use the initial image as a first frame image, and iteratively generate at least one frame image after the first frame image based on the first frame image and the plurality of description texts, so as to obtain a frame image sequence consisting of the first frame image and the at least one frame image; The synthesis module is configured to perform video synthesis on each frame image in the frame image sequence to obtain a target video.
14. An electronic device, comprising: a memory configured to store executable instructions; The processor is configured to implement the video generation method described in any one of claims 1 to 12 when executing the computer executable instructions stored in the memory.
15. A computer-readable storage medium storing computer-executable instructions, wherein when the computer-executable instructions are executed by a processor, the method for generating a video according to any one of claims 1 to 12 is implemented.
16. A computer program product, comprising computer executable instructions, wherein when the computer executable instructions are executed by a processor, the method for generating a video according to any one of claims 1 to 12 is implemented.
Citation Information
Patent Citations
Video classification method and device, computer and readable storage medium
CN110837579A
Video generation method and related device
CN111669515A
Voice synthesis method and device, storage medium and electronic equipment
CN111916050A
Image processing method and system and electronic equipment
CN114356084A
Scene library establishment method and device, vehicle, storage medium and chip
CN114756700A
Cited By
Image fusion method and device based on constraint alignment, equipment and storage medium
CN119168887A
Video generation method, device and equipment and storage medium thereof
CN119255066A
Optimization method for long video generation based on tree coding
CN119277106A
Video generation system and method based on intelligent agent
CN119420994A
Video generation method and device, electronic equipment, storage medium and program product
CN119421016A
