Video generation method and device, electronic equipment, storage medium and program product
By obtaining the initial image and description text, the diffusion model and machine learning technology are used to generate a video with a film and television style, which solves the problem of poor image scene consistency in the existing technology and achieves highly accurate and consistent video generation.
Patent Information
- Application Number
- CN202310258853.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-09
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2043-03-09
Smart Images

Figure CN118632070A
Abstract
Description
Technical Field
[0001] 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
[0002] In film and television drama scenes, when a user uploads an image, he or she often hopes to use video technology to animate the image into a film and television drama style, that is, to make the image move and the action performance similar to the film and television style, such as a short video showing the changes in character expressions, landscape switching, etc.
[0003] The related text-to-image technology is good for generating cartoons, artistic landscapes, etc., but it is not effective for generating images related to film and television scenes and characters. Or, due to the influence of random noise, the output image of the image-to-text technology has poor consistency with the input image in terms of scene, and the accuracy of the image content is poor. Summary of the invention
[0004] 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 a video and the consistency between adjacent frame images.
[0005] The technical solution of the embodiment of the present application is implemented as follows:
[0006] The present application provides a method for generating a video, including:
[0007] Determine the acquired initial image as the first frame image in the frame image sequence to be generated, and acquire description text of each frame image in the frame image sequence;
[0008] Generate the i-th frame image 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 texts of the frame images before the i-th frame image;
[0009] 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;
[0010] Traversing the i to obtain each frame image in the frame image sequence;
[0011] Perform video synthesis on each frame image in the frame image sequence to obtain a target video.
[0012] The present application provides a video generation device, including:
[0013] An acquisition module, used to determine the acquired initial image as the first frame image in the frame image sequence to be generated, and to acquire description texts of each frame image in the frame image sequence;
[0014] A generating module, configured to generate the i-th frame image based on a description text of the i-th frame image in the frame image sequence, each frame image in the frame image sequence located before the i-th frame image, and each frame image 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;
[0015] A traversal module, used for traversing the i to obtain each frame image in the frame image sequence;
[0016] The synthesis module is used 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 for storing executable instructions;
[0019] The processor is used 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, which stores computer-executable instructions. When the computer-executable instructions are executed by a processor, the processor will execute the video generation method provided by the embodiment of the present application.
[0021] The embodiment of the present application provides a computer program product, which includes computer executable instructions, and the computer executable instructions are stored in a computer readable storage medium. The processor of the electronic device reads the computer executable instructions from the computer readable storage medium, and the processor executes the computer executable instructions, so that the electronic device executes the video generation method provided in the embodiment of the present application.
[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, and when generating other frame images in the frame image sequence to be generated, the frame images before the frame image, the description texts associated with the frame images before the frame image, and the description text of the frame image itself are fully referenced, and then the target video is generated based on the frame images in the frame image sequence. In this way, not only the accuracy of each frame image in the video can be improved, but also the consistency between adjacent frame images can be guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 1 is a schematic diagram of the architecture of a video generation system 100 provided in an embodiment of the present application;
[0025] Figure 2 is a structural diagram of an electronic device 500 for implementing a method for generating a video provided in an embodiment of the present application;
[0026] Figure 3 It is a flowchart of a method for generating a video provided in an embodiment of the present application;
[0027] Figure 4 is a schematic diagram of a process for generating an i-th frame image provided in an embodiment of the present application;
[0028] Figure 5 It is a schematic diagram of a method for determining text constraint information provided in an embodiment of the present application;
[0029] Figure 6 Schematic diagram of the text feature extraction process based on the CLIP model provided in the embodiment of the present application;
[0030] Figure 7 It is a schematic diagram of a method for determining graphic and text constraint information provided in an embodiment of the present application;
[0031] Figure 8 It is a schematic diagram of the image and text feature extraction process provided by the embodiment of the present application;
[0032] Fig. 9 is a flow chart of a frame image generation process provided by an embodiment of the present application;
[0033] Fig.10 is a diagram of the i-th frame image generation process provided by an embodiment of the present application;
[0034] Fig.11 It is a frame image generation method based on a machine learning model provided in an embodiment of the present application;
[0035] Fig.12 is a flow chart of a serial frame image generation model provided in an embodiment of the present application;
[0036] Fig.13 It is a schematic diagram of a training method for a frame image generation model provided in an embodiment of the present application;
[0037] Fig.14 is a schematic diagram of the video sample processing flow provided in an embodiment of the present application;
[0038] Fig.15 is a flow chart of a clustering process for video samples provided in an embodiment of the present application;
[0039] Fig.16is a schematic diagram of a process for determining a distance threshold provided in an embodiment of the present application;
[0040] Fig.17 is another flowchart of the method for generating a video provided in an embodiment of the present application;
[0041] Fig.18A It is a schematic diagram of a general flow chart of a method for generating a video provided in an embodiment of the present application;
[0042] Fig.18B It is a visualization schematic diagram of multi-frame image generation provided in an embodiment of the present application;
[0043] Fig.19 It is a structural diagram of a continuous frame generation model provided in an embodiment of the present application;
[0044] Fig. 20 is a schematic diagram of a standard diffusion model provided in an embodiment of the present application;
[0045] Fig.21A This is a schematic diagram of the U-Net process without adding constraint information provided in an embodiment of the present application;
[0046] Fig.21B This is a schematic diagram of U-Net with added constraint information provided in an embodiment of the present application;
[0047] Fig. 22 It is a structural diagram of a BLIP text extraction model provided in an embodiment of the present application;
[0048] Fig.23 It is a schematic diagram of the training data collection process provided by an embodiment of the present application;
[0049] Fig.24 is a schematic diagram of a storyboard operation for a video sample provided in an embodiment of the present application;
[0050] Fig.25 It 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 the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the 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 describe 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\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.
[0054] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application 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's image is involved. When the embodiments of the present application are applied to specific products or technologies, the user's permission or consent is required, and the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0056] Before further 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, which does not consider the specific instance of the object, but only considers the category of the object (such as people, dogs, cats, birds, etc.) to identify the category to which the object belongs. A typical example is the recognition task in the large-scale general object recognition open source dataset ImageNet, which identifies which of the 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: Train a deep learning network model based on imagenet, and the parameter weights of the model are the imagenet pre-trained model.
[0060] 4) Text-generated images: Taking text as input, the model outputs images related to it.
[0061] 5) Image-generated image: Taking an image as input, the model outputs images related to it.
[0062] 6) Movie and TV drama stock images: Collect all movie and TV drama videos. Since the amount of data after extracting frames from movie and TV drama videos is huge, the data needs to be compressed to avoid retrieval taking too long. Therefore, the video is divided into sections, and one frame of image is extracted from each section and saved in the inventory.
[0063] 7) Constrastive Language-Image Pretraining (CLIP) model: The input of the CLIP model is a sample pair consisting of images and texts. The architecture is divided into two parts: image encoder and text encoder. Among them, the text branch of CLIP: for each novel sentence, it is encoded by the text encoder (text encoder, specifically transform) to obtain N text feature vectors (T1, T2, T3, ..., TN); the image branch of CLIP: for each movie and TV drama stock image, it is encoded by the image encoder (image encoder, specifically resnet) to obtain N image feature vectors (I1, I2, I3, ..., IN);
[0064] 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.
[0065] 8) Diffusion Model, an image generation model, 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 tries to learn the noise distribution instead of the data distribution. The noise distribution is modeled using the concept of Markov chain, which makes it a probabilistic model. The diffusion model consists of two stages, the forward process from the original image to the noise, the diffusion process (forward, diffusion process) and the reverse process from the noise to the original image. Diffusion generation model: a generation model that converts a complex true distribution into a simple prior distribution by gradually adding noise, and generates a true distribution from a simple prior distribution by gradually denoising.
[0066] 9) Pure Vision Transformer model (ViT, Vision Transformer) is a model for image classification, which uses a Transformer-like structure on image patches for image classification tasks. The input image is divided into fixed-size patches, and then each patch is linearly embedded, and a position embedding representation (using a vector representation) is added, called Position Embedding, and the resulting vector sequence is sent to the standard Transformer encoder for learning. For classification, an additional learnable "classification token" is added to the sequence.
[0067] 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. Figure 1 , Figure 1 It is a schematic diagram of the architecture of the video generation system 100 provided in an embodiment 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 a network 300. The network 300 can be a wide area network or a local area network, or a combination of the two, and wireless or wired links are used to realize data transmission.
[0068] In some embodiments, a terminal (such as terminal 400-1 and terminal 400-2) is deployed with a target application that can realize the video generation function, and the target application can generate a target video with a target style (such as film style, animation style, etc.) based on the input initial image and the description text of each frame image in the video to be generated. It is used to send a video generation request for the target video to the server based on the target application, wherein the video generation request carries the initial image as the first frame image in the frame image sequence to be generated, and the description text for the second frame image in the frame image sequence to be generated. The terminal is also used to receive the target video returned by the server and perform a target operation on the target video, and the target operation includes at least one of the following: play, download, share, etc.
[0069] In some embodiments, the server 200 is used to receive a video generation request for a target video sent by a terminal, parse the video generation request, and obtain an initial image as the first frame image in the frame image sequence to be generated, and at the same time parse to obtain a description text for the second frame image in the frame image sequence to be generated, and then generate the i-th frame image 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; 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; i is traversed to obtain each frame image in the frame image sequence; and video synthesis is performed on each frame image in the frame image sequence to obtain the target video.
[0070] In practical applications, 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 (CDN, Content Delivery Network), and big data and artificial intelligence platforms. Terminals (such as terminals 400-1 and 400-2) can be smart phones, tablet computers, laptops, desktop computers, smart speakers, smart TVs, smart watches, etc., but are not limited to this. Terminals (such as terminals 400-1 and 400-2) and server 200 can be directly or indirectly connected via wired or wireless communication, and this application is not limited here.
[0071] The embodiments of the present application may also be implemented with the aid of cloud technology, which refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or a local area network to achieve data computing, storage, processing, and sharing.
[0072] Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, and application technology based on the cloud computing business model. It can form a resource pool that can be used on demand and is flexible and convenient. Cloud computing technology will become an important support. The background services of the technical network system require a large amount of computing and storage resources.
[0073] Next, an electronic device that implements the video generation method provided in the embodiment of the present application is described. Figure 2 , Figure 2 is a schematic diagram of the structure of an electronic device 500 for implementing a method for generating a video according to an embodiment of the present application. The electronic device 500 may be Figure 1 The server 200 or terminal shown is an electronic device 500. Figure 1 Taking the server shown as an example, an electronic device that implements the method for generating a video according to an embodiment of the present application is 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 through a bus system 540. It can be understood that the bus system 540 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 540 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, in Figure 2 Various buses are labeled as bus system 540 .
[0074] 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.
[0075] 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.
[0076] The memory 550 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, etc. The memory 550 may optionally include one or more storage devices that are physically remote from the processor 510.
[0077] The memory 550 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. 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.
[0078] 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 exemplarily described below.
[0079] An operating system 551 includes system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic businesses and processing hardware-based tasks; a network communication module 552, for reaching 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), etc.; a presentation module 553, for enabling information to be presented (for example, a user interface for operating peripheral devices and displaying content and information) via one or more output devices 531 (for example, display screens, speakers, etc.) associated with a user interface 530; an input processing module 554, for detecting one or more user inputs or interactions from one of the one or more input devices 532 and translating the detected inputs or interactions.
[0080] In some embodiments, the video generation device provided in the embodiments of the present application can be implemented in software. Figure 2 A video generation device 555 stored in a memory 550 is shown, which may be software in the form of a program or plug-in, including the following software modules: an acquisition module 5551, a generation module 5552, a traversal module 5553, and a synthesis module 5554. These modules are logical, and therefore may be arbitrarily combined or further split according to the functions implemented. The functions of each module will be described below.
[0081] In other embodiments, the video generation device provided in the embodiments of the present application can be implemented in 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.
[0082] In some embodiments, the terminal or server can implement the video generation method provided in the embodiments 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 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 only needs to be downloaded to a browser environment to run; it can also be a small program that can be embedded in any APP. In short, the above-mentioned computer program can be any form of application, module or plug-in. For example, Figure 1 The target application deployed in the terminals shown in the figure (such as terminal 400-1 and terminal 400-2) can be any form of application, module or plug-in mentioned above. The target application can realize the video generation function. Specifically, 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.
[0083] Based on the above description of the video generation system and electronic device provided by the embodiment of the present application, the video generation method provided by the embodiment of the present application is described below. In actual implementation, the video generation method provided by the embodiment of the present application can be implemented by the terminal or the server alone, or by the terminal and the server in collaboration, so that Figure 1 The server 200 in the embodiment of the present application alone executes the video generation method provided by the embodiment of the present application as an example for explanation. Figure 3 , Figure 3 is a flow chart of the method for generating a video provided in an embodiment of the present application, which will be combined with Figure 3 The steps shown are explained.
[0084] In step 101, the server determines the acquired initial image as the first frame image in the frame image sequence to be generated, and acquires description text of each frame image in the frame image sequence.
[0085] In actual implementation, the server receives a video generation request for a video to be generated, parses the video generation request, obtains an initial image, and a description text for each frame image of the video to be generated. The video to be generated can be represented by a sequence of frame images to be generated including N consecutive frame images, where N is a positive integer of ≥ 2, and N can be carried in the video generation request or read by the server from a preset configuration file. In addition, the initial image carried in the video generation request is used as the first frame image in the sequence of frame images to be generated. In order to ensure the consistency between the frame images in the sequence of frame images to be generated, the video generation request can usually also carry a description text for each frame image in the sequence of frame images to be generated, and the description text associated with the frame image is used to characterize the image content of the frame image to be generated. The content of the description text can be empty.
[0086] In step 102, an i-th frame image is generated 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, where 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.
[0087] In actual implementation, when the server generates the i-th (i is a positive integer of 2) frame image in the frame image sequence, in order to maintain the 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 the i-th frame image is generated, 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, and the content consistency may include the consistency of the characters, the background and the scene in the image. 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.
[0088] The generation of the i-th frame image is described. In some embodiments, see Figure 4 , Figure 4 is a schematic diagram of the generation process of the i-th frame image provided in the embodiment of the present application, based on Figure 3 , step 102 can be implemented by steps 1021-1024, combined with Figure 4 The steps shown are explained.
[0089] Step 1021: The server generates 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 the frame images before the i-th frame image.
[0090] In actual implementation, the constraint information constraining the generation process of the i-th frame image may at least include: text constraint information, image-text constraint information, image constraint information, etc., wherein the text constraint information is the constraint information of the pure text mode, the image constraint information is the constraint information of the pure image mode, and the image-text constraint information is the constraint information of the image-text cross-modality. The server may extract features from the description text of the i-th frame image and the description text of each frame image before the i-th frame image, and generate text constraint information based on the obtained text features.
[0091] The text constraint information determination method is described below. In some embodiments, the text constraint information determination process can be implemented by the terminal or the server alone, or by the terminal and the server in collaboration. Figure 1 The server 200 in the example performs the above text constraint information determination process alone. Figure 5 , Figure 5 is a schematic diagram of a method for determining text constraint information provided in an embodiment of the present application, combined with Figure 5 The steps shown are explained.
[0092] Step 201 : The server extracts 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.
[0093] In actual implementation, the server can be used to implement a machine learning model for text feature extraction (such as CLIP) to extract text features of the description text of each frame image. 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 (text encoder, specifically transform) to obtain the description text features corresponding to each description text (in calculation, vector representation is used).
[0094] Step 202, obtaining identification features for indicating text modality, and fusing the identification features with descriptive text features, and using the fusion result as text constraint information of the i-th frame image.
[0095] For example, see Figure 6 , Figure 6 This 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, 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 mode to obtain the text constraint information of the i-th frame image.
[0096] Step 1022, based on each frame image located before the i-th frame image and the description text of each frame image, generate the image and text constraint information of the i-th frame image; wherein the text constraint information and the image and text constraint information are both used to constrain the image content of the i-th frame image.
[0097] In actual implementation, the server can obtain corresponding image features by extracting image features from each frame image located before the i-th frame image, and at the same time, extracting text features from the description texts of each frame image located before the i-th frame image to obtain corresponding text features; then, by fusing the text features and image features, the graphic and text constraint information of the i-th frame image is obtained.
[0098] In some embodiments, the process of determining the image and text constraint information can be implemented by the terminal or the server alone, or by the terminal and the server in collaboration. Figure 1 The server 200 in the embodiment performs the above-mentioned process of determining the image and text constraint information separately as an example, see Figure 7 , Figure 7 is a schematic diagram of a method for determining graphic and text constraint information provided in an embodiment of the present application, combined with Figure 7 The steps shown are explained.
[0099] Step 301: The server extracts image features from each image frame before the i-th image frame to obtain image features of each image frame.
[0100] In actual implementation, the server can be used to implement a machine learning model for cross-modal feature extraction (such as BLIP). On the one hand, the image features of each frame image before the i-th frame image are extracted. On the other hand, the text features of the descriptive text associated with each frame image before the i-th frame image are extracted using the image features as constraint information to obtain the graphic and text features of each frame image.
[0101] For example, see Figure 8 , Figure 8 It 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 the BLIP model. In the specific implementation process, each frame image before the i-th frame image is input and the visual features, i.e., image features, are extracted through the ViT model to obtain the corresponding image features.
[0102] Step 302 , using 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.
[0103] Among them, the initial image features are text features that carry image features.
[0104] Continuing with 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.
[0105] Step 303: Obtain identification features for indicating the image-text modality, fuse the identification features with the initial image-text features, and use the fusion result as the image-text constraint information of the i-th frame image.
[0106] Continuing from the above example, in order to facilitate calculation, the server also obtains the identification feature used to indicate the image-text mode, and fuses the 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 mode (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, and the frame images in the frame image sequence are arranged according to the corresponding time positioning information.
[0107] Step 1023, concatenate the text constraint information and the graphic constraint information to obtain target constraint information.
[0108] In actual implementation, the server obtains the text constraint information for the i-th frame image through the aforementioned method for determining the text constraint information, and then obtains the image-text constraint information for the i-th frame image through the aforementioned method for determining the image-text constraint information. The size of the text constraint information for the i-th frame image is the same as the size of the image-text constraint information for the i-th frame image, and the text constraint information and the image-text constraint information are merged to obtain the target constraint information for the i-th frame image.
[0109] Step 1024 , taking the frames of images before the i-th frame of image as reference and based on the target constraint information, constraining the generation process of the i-th frame of image to obtain the i-th frame of image.
[0110] 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 through target constraint information to generate the i-th frame image.
[0111] In some embodiments, the frame image generation process can be implemented by the terminal or the server alone, or by the terminal and the server in collaboration. Figure 1The server 200 in the embodiment performs the above frame image generation process alone as an example. Fig. 9 , Fig. 9 is a flowchart of the frame image generation process provided by the embodiment of the present application, combined with Fig. 9 The steps shown are explained.
[0112] Step 401 : The server extracts features from each frame of image before the i-th frame of image to obtain image features of each frame of image.
[0113] Step 402, performing feature fusion on the image features of each frame image to obtain fused features.
[0114] In actual implementation, when generating the i-th frame image, in order to ensure consistency with the image before the i-th frame image, the server extracts features from each frame image before the i-th frame image to obtain image features of each frame image. The extraction of image features can also be implemented based on a machine learning model.
[0115] For example, see Fig.10 , Fig.10 This is a diagram of the i-th frame image generation process 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) of the corresponding latent space, and the latent space representation of z at time T is obtained through diffusion sampling (which can be achieved through a diffusion model), and the latent space representation of time T is predicted after denoising, and the representation prediction from time T-1 to time T-2 is 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.
[0116] Step 403, performing a first order noise addition process on the fused features to obtain a noisy fused feature.
[0117] For example, see Fig.10, for the diffusion sampling processing of image features in latent space, it is actually to perform the first number T (T is a positive integer greater than 1) of noise processing on the fusion feature (i.e., the image features of multiple frame images are fused) to obtain the noise fusion feature. In practical applications, when performing noise processing, the types of noise added include but are not limited to Gaussian noise, salt and pepper noise, Poisson noise, etc. The specific type of noise to be added can be determined according to actual needs. Among them, Gaussian noise is to add a noise that obeys Gaussian distribution to the image feature, and the degree of noise addition can be controlled by adjusting the size of the standard deviation of the Gaussian distribution; salt and pepper noise is to add black and white noise to the image, pepper refers to black noise (0, 0, 0) and salt refers to white noise (255, 255, 255). The proportion of noise addition is controlled by setting the parameter value. The larger the value, the more noise is added, and the more serious the image damage. The first number here is the number of noise processing, that is, the number of noise processing for the image set in advance. Each noise processing can obtain a noisy image. After completing n noise processing, the final noise image is obtained as the noisy image for subsequent processing.
[0118] Step 404: Based on the target constraint information, a second denoising process is performed on the noisy fused features to obtain denoised fused features.
[0119] Continuing from the above example, after obtaining the corresponding noise-added fusion features, the denoising process of the second number is performed to obtain the denoised fusion features. In practical applications, the first number and the second number can be the same or different. When the first number and the second number are equal, the first number is set to T, and the noise-added fusion features of the first number are obtained by performing the noise-added process at time T. Then, after the denoising process, the fusion features of the noise-added fusion features at time T are predicted at time T-1 (i.e., the denoised image corresponding to the noise-added image at time T-1). By analogy, the denoised images at times T-1 to T-2 are predicted, until the prediction at time T=0, i.e., the image features of the denoised image at T=0 are obtained.
[0120] Step 405: Generate the i-th frame image based on the denoising and fusion features.
[0121] Continuing with the above example, the server will perform the denoising fusion feature obtained by the second denoising process to reconstruct the image and obtain the i-th frame image.
[0122] In some embodiments, the frame image generation process based on the machine learning model can be implemented by the terminal or the server alone, or by the terminal and the server in collaboration. Figure 1 The server 200 in the embodiment performs the frame image generation process based on the machine learning model alone as an example for explanation, see Fig.11 , Fig.11The frame image generation method based on the machine learning model provided in the embodiment of the present application is combined with Fig.11 The steps shown are explained.
[0123] Step 501: The server obtains 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;
[0124] In actual implementation, the server can generate corresponding frame images based on the 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 to generate the i-th frame image, the server uses multiple serially connected frame image generation models to generate corresponding frame images. That is to say, 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 frame. 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.
[0125] For example, see Fig.12 , Fig.12 This is a flow chart of a serial frame image generation model provided by an embodiment of the present application. The figure shows two serial frame image generation models, the input information is an initial image, and the output information is a frame image sequence including three frame images, wherein the generation process of image 1 is to predict image 1 by using 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 to predict image 2 by using the initial image, 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 a target video.
[0126] 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.
[0127] 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.
[0128] In some embodiments, the training process of the frame image generation model can be implemented by the terminal or the server alone, or by the terminal and the server in collaboration. Figure 1 The server 200 in the example performs the training process of the frame image generation model alone. Fig.13 , Fig.13 is a schematic diagram of a training method for a frame image generation model provided in an embodiment of the present application, combined with Fig.13 The steps shown are explained.
[0129] Step 601: The server obtains a plurality of serially connected initial frame image generation models and a reference frame image sequence including a plurality of continuous frame image samples, wherein the frame image samples carry description text for describing the next adjacent frame image sample.
[0130] For example, see Fig.12 In the multiple serially connected frame image generation models shown, the server first obtains an initial frame image generation model that has not yet been trained, and obtains a reference frame image sequence for training the initial frame image generation model, wherein the reference frame image sequence includes multiple continuous frame image samples, and the frame image samples carry description text for describing the next adjacent frame image sample. For example, if the first frame image sample is a person A standing, the second frame image sample is a person A in a running-ready posture, and the third frame image sample is a person A running, then the first frame image sample may carry the description text "person A in a running-ready posture".
[0131] The method for obtaining the reference frame image sequence is described below. Fig.14 , Fig.14 is a schematic diagram of the video sample processing flow provided in the embodiment of the present application, combined with Fig.14 The steps shown are explained.
[0132] Step 6011: The server obtains video samples and frame sampling intervals for the video samples.
[0133] 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.
[0134] Step 6012: based on the frame sampling interval, perform frame sampling on the video sample to obtain multiple frame images.
[0135] 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.
[0136] Step 6013, clustering is performed on the multiple frame images to obtain multiple clusters.
[0137] In some embodiments, the clustering process for the video samples can be implemented by the terminal or the server alone, or by the terminal and the server in collaboration. Figure 1 The server 200 in the example performs the above clustering process for the video sample alone. Fig.15 , Fig.15 is a flow chart of the clustering process for video samples provided in the embodiment of the present application, combined with Fig.15 The steps shown are explained.
[0138] Step 701: the server divides each frame image into shots to obtain a plurality of split shots, and the similarity between the frame images in each split shot reaches a similarity threshold.
[0139] In actual implementation, the server divides the multiple frames obtained by frame extraction into multiple shots, wherein the contents of the images in the same shot are almost the same (there may be only slight changes in lighting, action, and object perspective), that is, the similarity between the frame images in each shot reaches the similarity threshold.
[0140] 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.
[0141] 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.
[0142] Step 703 , extracting features from each target frame image to obtain multiple frame image features.
[0143] In actual implementation, there is a one-to-one correspondence between the frame image features and the target frame image.
[0144] Step 704: clustering the features of the multiple frame images to obtain multiple clusters.
[0145] In actual implementation, the server can randomly extract one frame image from each storyboard to represent the storyboard, and use the image branch of the cross-modal CLIP model to extract features from each target frame image to obtain multiple frame image features. K-means clustering is performed on all frame image features to obtain the cluster centers of K clusters, and the cluster center to which each frame image belongs is found.
[0146] Step 6014, determining the Euclidean distance between each frame image in each cluster and the corresponding cluster center.
[0147] In actual implementation, the server calculates the Euclidean distance between the frame image in each cluster and the corresponding cluster center.
[0148] Step 6015, determine the distance threshold corresponding to each cluster, and for each frame image in each cluster, determine the frame image whose Euclidean distance is less than the distance threshold as the frame image sample, and obtain a reference frame image sequence including multiple continuous frame image samples.
[0149] 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 obtained K clusters contains a relatively clean image.
[0150] In some embodiments, the process of determining the distance threshold may be implemented by the terminal or the server alone, or by the terminal and the server in collaboration. Figure 1 The server 200 in the embodiment performs the above distance threshold determination process alone as an example for explanation, see Fig.16 , Fig.16 is a schematic diagram of the process of determining the distance threshold provided in the embodiment of the present application, combined with Fig.16 The steps shown are explained.
[0151] Step 801: For each cluster, the server determines the Euclidean distance between each frame image in the cluster and the cluster center of the cluster.
[0152] 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.
[0153] Step 802: Determine the maximum value of the Euclidean distance and the minimum value of the Euclidean distance from each Euclidean distance.
[0154] 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 thr = (max-min) / 2+min.
[0155] 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 sum result as the distance threshold corresponding to the cluster.
[0156] In actual implementation, the server determines the difference between the maximum value and the minimum value (max-min), and sums half of the difference (max-min) / 2 with the minimum value min (max-min) / 2+min, and then uses the sum result as the distance threshold corresponding to the cluster, which can be recorded as thr. That is, thr = (max-min) / 2+min.
[0157] Step 602, taking 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 before the i-th frame image sample in the target frame image sequence, and the description text of each frame image sample before the i-th frame image sample, 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.
[0158] 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.
[0159] Step 603, traverse i to predict each frame image in the target frame image sequence.
[0160] 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.
[0161] Step 604 , obtaining the difference between the target frame image sequence and the reference frame image sequence, and based on the difference, updating the model parameters of each initial frame image generation model to obtain a series of frame image generation models.
[0162] In actual implementation, for the 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, and 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.
[0163] 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.
[0164] Step 103, traverse i to obtain each frame image in the frame image sequence.
[0165] In actual implementation, the above-mentioned process of generating the i-th frame image is repeated to obtain each frame image in the sequence of frame images to be generated.
[0166] Step 104, performing video synthesis on each frame image in the frame image sequence to obtain a target video.
[0167] In actual implementation, the server performs video synthesis on each frame image in the generated frame image sequence to obtain the target video.
[0168] 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, where the frame rate is used to indicate the number of consecutive 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.
[0169] In actual implementation, the specific video synthesis method can be that the server obtains a preset frame rate, and according to 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.
[0170] 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.
[0171] By using the above-mentioned embodiment of the present application, when generating each frame image in the frame image sequence to be generated, the frame images before the frame image and the description text associated with the frame images before the frame image are used as the target constraint information to constrain the generation process of each frame image, so that the generated frame image can maintain the consistency of content with the frame images before the frame image; in addition, by training the frame image generation model with video samples with film and television style, 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 style, so that 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, based on the corresponding constraint information generated by the frame image before the current frame image, a method for predicting the current frame image can be used to decompose the video generation process into the prediction task of the next frame image, so as to achieve efficient and fast generation of continuous frame images.
[0172] Next, the method for generating a video provided by the embodiment of the present application will be described. Fig.17 is another flow chart of the method for generating a video provided in an embodiment of the present application. Here, a plurality of serially connected frame image generation models are taken as an example to be run on a server. Fig.17 The video generation method provided in the embodiment of the present application is implemented collaboratively by the terminal and the server.
[0173] Step 901 : In response to a video generation operation based on an initial image and a description text of each frame of an image in a video to be generated, the terminal sends a video generation request to a server.
[0174] Exemplarily, the video to be generated is the target video to be generated, and the video to be generated is composed of a frame image sequence to be generated. The video generation request carries an initial image which is the first frame image in the frame image sequence to be generated, and a description text for each frame image in the frame image sequence to be generated.
[0175] 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.
[0176] 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.
[0177] Exemplarily, there is a one-to-one correspondence between the frame image generation model and other frame images except the initial image. The server determines the acquired initial image as the first frame image in the frame image sequence to be generated, and acquires the description text of each frame image in the frame image sequence. Before using the multiple serially connected frame image generation models, the server may train the multiple serially connected frame image generation models in the following manner: obtaining multiple serially connected initial frame image generation models and a reference frame image sequence including multiple continuous frame image samples for the server, wherein the frame image samples carry description text for describing the next adjacent frame image sample; using the first frame image sample in the reference frame image sequence as the first frame image in the target frame image sequence, and using the (i-1)th initial frame image generation model to generate the i-th frame image in the target frame image sequence based on the description text of the i-th frame image in the target frame image sequence, each frame image in the target frame image sequence located before the i-th frame image, and the description text of each frame image located before the i-th frame image; 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 based on the difference, updating the model parameters of each initial frame image generation model to obtain the serially connected frame image generation model.
[0178] 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.
[0179] Step 905: Acquire identification features for indicating text modality, fuse the identification features with descriptive text features, and use the fusion result as text constraint information of the i-th frame image.
[0180] Step 906 , extracting image features from each image frame before the i-th image frame to obtain image features of each image frame.
[0181] Step 907 , using 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.
[0182] Step 908: Obtain identification features for indicating the image-text modality, fuse the identification features with the initial image-text features, and use the fusion result as the image-text constraint information of the i-th frame image.
[0183] Step 909: Combine the text constraint information and the graphic constraint information to obtain target constraint information.
[0184] 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.
[0185] Step 911, traverse i to obtain each frame image in the frame image sequence.
[0186] Step 912, performing video synthesis on each frame image in the frame image sequence to obtain a target video, and sending the target video to the terminal.
[0187] Step 913: The terminal receives the target video returned by the server and performs a target operation on the target video, where the target operation includes at least one of the following: play, download, share, etc.
[0188] 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 before the current frame image. This 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 consistency in content between the generated frame image and the frame images before the current frame image.
[0189] The following is an explanation of an exemplary application of an embodiment of the present application in a practical application scenario.
[0190] In film and television scenes, when users upload an image, they often hope to use video technology to animate the image in the style of film and television, that is, to make the image move and the action performance is similar to the film and television style, such as a short video showing the changes in character expressions, landscape switching, etc. Related text-to-image technology is good for generating cartoons, artistic landscapes, etc., but it is not good for generating images related to film and television scenes and characters with film and television styles, or the image-to-text technology cannot guarantee the consistency of the output image and the input image in the scene due to random noise problems, and often there are inconsistent generation results, such as inconsistent characters, inconsistent backgrounds, and inconsistent scenes.
[0191] Based on this, an embodiment of the present application provides a method for generating a video. The method is based on the diffusion model latent space image generation technology, and designs a continuous frame generation model for film and television works (also known as a sequence model, i.e., the frame image generation model connected in series in the previous text), and converts video generation into continuous frame image generation, that is, by inputting an image to generate the next frame image consistent with it, the prediction task of the next frame image of the current image is completed; 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 (i.e., 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, a training set is collected through a large number of film and television dramas, and the latent space mapping module of the continuous frame generation model is trained with the training set 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.
[0192] 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, the scene and content correlation between adjacent frame images of the video is improved by accumulating input of historical frame image information, thereby making the pictures of adjacent frame images of the generated video more coordinated.
[0193] For example, see Fig.18A , Fig.18A This is a schematic diagram summarizing the process flow of the video generation method provided in 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 or TV series; then, the continuous frame images are used for video synthesis to obtain a target video. In actual implementation, the user uploads the initial image and prompt words related to the video he wants to generate (such as "cute", etc.), and an electronic device (server or terminal) equipped with a continuous frame generation model selects a suitable continuous frame generation model according to the initial image uploaded by the user (for example, if a person is uploaded, a continuous frame generation model trained by a person is selected; if a landscape image is uploaded, a continuous frame generation model trained by a landscape image is selected); continuous frame images are generated through the selected continuous frame generation model, and the generated continuous frame images and the initial image are merged into a target video and returned to the user. For example, see Fig.18B , Fig.18B This is a visual schematic diagram of multi-frame image generation provided in an embodiment of the present application. In the figure, the user inputs an image and predicts 4 new frame images. The synthetic video includes 5 frame images. Except for the first frame image, the other frame images are generated based on other frame images before themselves combined with corresponding description texts.
[0194] For an explanation of the generation process of continuous frame images, see Fig.12 , the specific generation process is as follows: 1) Generate a result for the initial image and prompt word (i.e., description text 1 in the previous text) uploaded by the user, 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 the historical moment image, historical prompt word, and current moment prompt word (when the user does not enter the prompt word at the current moment, the current moment prompt word is set to empty) as the model input to generate a result; 4) Repeat steps 2) to 3) until N images are generated. For example, the user uploads the 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. In this way, the execution 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, 75 frame images can be generated. When the frame rate is 15fps, a video of 75 / 15=5 seconds can be generated.
[0195] The following describes a continuous frame generation model for generating continuous frame images. Fig.19 , Fig.19It is a structural diagram of the continuous frame generation model provided by the embodiment of the present application. After the historical description text extracts the text features, and after the historical image extracts the image features, the historical text features are fused with the image features to obtain the historical information. For the user's current input information, if there is only an image and no description text, the description text is input into the continuous frame generation model using the default value (empty). After the text features are extracted from the description text at the current moment (such as text 3 in the figure), it is spliced with the historical information to finally form the constraint information generated by the continuous frame generation model at the current moment. Among them, in the overall processing of the continuous frame generation model, it is implemented based on the generation model of latent space diffusion (stable-diffusion). First, a 256x256 noise image x is generated as the overall input using Gaussian random noise, and the latent space representation is obtained through the encoder. The latent space diffusion model samples the noise image x at the time T. The latent space representation (it should be noted that T at this time is not related to the current moment in the sequence frame generation process. The T moments here can be understood as T restoration operations, and the overall video sequence generation can be understood as a picture generated by a generation model containing T steps for each frame in the video frame sequence). The latent space representation at the time T is predicted by the denoising U-Net module (the denoising module includes historical information constraints) to predict the latent space representation at the time T-1. The representation at the time T-1 is continuously input to the input end of the U-Net to predict the representation at the time T-2. By analogy, T steps of prediction are completed to obtain the representation prediction at the time T=0. The representation at the time T=0 is passed through the decoder to obtain the generated image y. In this way, the generation of a frame image is completed, that is, the process of generating image 1 from the initial image.
[0196] For an explanation of open source stable-diffusion, see Fig. 20 , Fig. 20It is a schematic diagram of a standard diffusion model provided in an 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. The latent space representation of time T is predicted through the u-net module at time T, and the representation prediction from time T-1 to time T-2 is continued by analogy until the prediction at time T=0. The final prediction is obtained by the decoder D to obtain the generated image. In 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 images) is used as the attention feature in the denoising U-Net module, so that the denoising process is subject to the text attention constraint, and the generated image uses the image in the image-text annotation sample pair as the supervision information, thereby ensuring that the image generated by the model is related to the text under the condition of inputting the specified text. In some embodiments, an image of the user may be given, and the image may be used to replace the text in the above process as a constraint, and the next image may be generated through the above process (also called an img2img process).
[0197] For an explanation of the denoising U-Net module, see Fig.21A , Fig.21A This is a schematic diagram of the U-Net process without adding constraint information provided by the embodiment of the present application. The latent spatial features at time T are passed through U-Net to obtain the representation prediction at time T-1. In the application scenario where historical image information is needed as constraint information to predict new images, it can be Fig.21A Based on the U-Net structure shown in Figure 2, new constraints are added to process historical information. Fig.21B , Fig.21B IGTE is a schematic diagram of adding constraint information to a U-Net provided in 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. The BLIP-based text extraction model is described. Fig. 22 , Fig. 22 is a structural diagram of a BLIP text extraction model provided in an embodiment of the present application, Fig. 22 In the example, image 1 is subjected to image feature extraction by ViT to obtain image features, and the corresponding description text is subjected to text feature extraction by BLIP, and combined with the image features extracted by ViT to generate image constraint text. In actual implementation, IGTE directly uses the open source model weights, and there is no need to update the model parameters of the model later. Fig.21BFor all historical texts (text 1, 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 (the size of the vector representation is 2x1x768) to obtain text feature 1. Text feature 1 is also a matrix feature of size 2×1×768 composed of multiple text vectors. Among them, the flag bit represents a 2x1x768 three-dimensional matrix, and all elements in the matrix are 0. For all historical and current image and text information, the image and text features are extracted through the IGTE model to obtain the text feature with image constraints (i.e., the image and text features in the previous article) 0. The text feature with image constraints is a matrix feature of size 1x3x768. In order to align the first dimension of text feature 0, the text feature 0 with image constraints is copied once along the first dimension to obtain the text feature 1 with image constraints. The size of the text feature 1 with image constraints is a 2x3x768 matrix. Then, the flag bit representing the image and text modality is added (the flag bit size is 2×3×768) to obtain the text feature 2 with image constraints. The text feature 2 with image constraints 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 constraints (the matrix feature of size 2×3×768) (2x3x768). Finally, the text feature 1 and the text feature 3 with image constraints are spliced to obtain the final historical constraint information (the matrix feature of size 2×4×768). The “+” represents vector addition and the “C” represents concatenation. The historical constraint information is input into the denoised U-Net. Figure 1 , 2 The noisy latent representation is subjected to T denoising processes with constraint information to obtain the final noise prediction at time 0, that is, the noise representation minus the noise prediction at time 0 can be restored Figure 1 , 2 Hidden representation. In actual implementation, when extracting image or text features, the image branch of the cross-modal CLIP model is used to extract image features, and the text branch is used to extract text features. The open source model weights are directly used, and there is no need to update the model parameters of the CLIP model later.
[0198] The collection of training data (i.e., the reference frame image sequence obtained based on the video sample in the previous text) is described. In some embodiments, for the sample data required for the training sequence model, see Fig.23 , Fig.23This is a flowchart of the training data collection process provided by the embodiment of the present application. The collection of training data (i.e., the video samples mentioned above) includes at least the following four steps: 1) frame extraction of 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 specific implementation of frame extraction of film and television works is: 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 Fig.24 , Fig.24 1 is a schematic diagram of the storyboard operation for a video sample provided by an embodiment of the present application. In the figure, number 1 and number 2 correspond to different adjacent storyboards, where the image content in the same storyboard is almost the same (only slight changes in lighting, action, and object perspective exist). At this time, the sequence images in each storyboard can be used as supervision information for the generation of sequence images. Supervision information such as: the sequence shown in number 1 Figure 1 As a constraint input model, the model needs to generate a sequence close to Figure 2 As a result, the sequence Figure 2 That is the sequence Figure 1 Generate supervision information.
[0199] 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 paper uses the image branch of the open source cross-modal CLIP model to extract video frame representation.
[0200] In actual implementation, the implementation of data clustering cleaning includes: 1) performing k-means clustering on all representations (i.e., the frame image features mentioned above) to obtain K cluster centers (such as cluster 2); 2) finding the cluster center to which each frame belongs; 3) calculating the Euclidean distance between the frame and the center in each cluster, obtaining the minimum and maximum distances max and min in the cluster, and recording the threshold thr = (max-min) / 2+min; 4) for each cluster, only saving samples whose distance from the center is less than the threshold thr. Thus, K clusters are obtained, and each cluster has a relatively clean image.
[0201] In actual implementation, the specific implementation of annotating image-text sample pairs is as follows: for all clustered images, annotate the image description text. For example, if the image content is someone speaking, the corresponding description text is annotated as "a man in a suit speaking, half-length photo", etc. Finally, annotated image-text sample pairs are obtained. Since an image represents a storyboard at this time, the sequence diagrams in the storyboard share the same text information with the image.
[0202] The training process of the continuous frame generation model is explained. Fig. 20The stable-diffusion-based sequence model shown includes a CLIP model for extracting prompt text features, a VAE model for decoding and generating images, a diffusion model (diffusers) for generating random noise, and a U-Net for denoising. Among them, the VAE, CLIP, BLIP, and U-Net modules are all initialized with the weights of the open source model, and the VAE, CLIP, and BLIP keep the weights of the open source model. This model does not learn, and only the U-Net model is trained. The x images of each storyboard collected by the data set (the video sample in the previous article) are used. 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, we take 3 pictures for each storyboard. For storyboards with more than 3 pictures, we traverse all 3 consecutive pictures (for example, for 5 pictures: pictures 123, 234, and 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, follow the above process to Fig.21B The U-Net network is the parameter to be learned: 1) Forward calculation of input data to obtain noise prediction; 2) Calculate the MSE loss of noise prediction; 3) Backward calculation to obtain the updated gradient of model parameters; 4) Use the SGD gradient update method to update the model with learning parameters to complete a batch training. Repeat the above steps to complete all (N / bs) batch training and end an iteration. Initially, a learning rate of 0.0005 can be used. After every 10 rounds of learning, the learning rate becomes 0.1 times the original. Whether to continue training depends on whether the loss has decreased. If it no longer decreases, stop training; or stop when a specified round of iterations is reached, such as 100 epochs.
[0203] The prediction loss of the noise image during the model training process 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. is the difference in the values of pixels at the same position.
[0204] For an explanation of the inference process of the continuous frame generation model, see Fig.25 , Fig.25 This is a schematic diagram of the reasoning process of continuous frame images provided by the embodiment of the present application. First, adapt to various user inputs: 1) User input text (i.e., the description text in the previous text) 1, when there is no image 1, the process shown in the figure number 1 generates Figure 1 ; 2) The user inputs an image 1 but no text 1, then set text 1 to blank; 3) The user inputs Figure 1and text 1, no processing is required. Then, according to the number 2 shown in the figure < Figure 1 、text1>、< Figure 2 , Text2> form to organize input data. By default, if the user does not enter text, Text2 is empty. If the user enters text at this moment, Text2 is the user input text. Figure 2 , where the noise image x0 needs to be the same as the input image in the process shown in No. 1 in the figure. Then, generate according to the process shown in No. 3 in the figure Figure 3 Finally, Figure 1 , 2 , 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, and more frames can also be generated to form a longer video.
[0205] Applying the above embodiments of the present application has the following beneficial effects:
[0206] 1) It is possible to generate film and television works imitating an image uploaded by a user, thereby enriching the expression content of the user's image. For example, if a user uploads an image of a smile, a video of a gradual laugh is generated, making the information expressed by the image richer.
[0207] 2) An image can also be animated, such as 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.
[0208] 3) Design a continuous frame generation system so that when a user inputs an image, a new image with the style of a film or TV work can be generated based on this image and through continuous frame constraints, a sequence of images is finally generated as a video, so that the information of the previous and next frames in the video is more consistent. It is possible to simulate the generation of film or TV works for an image uploaded by a user, thereby enriching the expression content of the user's image. For example, if a user uploads an image of a smile, a video of a gradual laugh is generated, so that the information expressed by the image is richer.
[0209] 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 realize efficient and fast image sequence.
[0210] The following is a description of an exemplary structure of a video generation device 555 provided in an embodiment of the present application implemented as a software module. In some embodiments, Figure 2 As shown, the software modules stored in the video generation device 555 of the memory 550 may include:
[0211] The acquisition module 5551 is used to determine the acquired initial image as the first frame image in the frame image sequence to be generated, and to acquire the description text of each frame image in the frame image sequence;
[0212] A generating module 5552, 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 located before 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; 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;
[0213] A traversal module 5553, used for traversing the i to obtain each frame image in the frame image sequence;
[0214] The synthesis module 5554 is used to perform video synthesis on each frame image in the frame image sequence to obtain a target video.
[0215] In some embodiments, the generation module is further used 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 merged to obtain target constraint information; with the frame images located before the i-th frame image as a reference, based on the target constraint information, the generation process of the i-th frame image is constrained to obtain the i-th frame image.
[0216] In some embodiments, the generation module is also used 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 an identification feature for indicating the text modality, and fuse the identification feature with the description text feature, and use the fusion result as the text constraint information of the i-th frame image.
[0217] In some embodiments, the generation module is also used to extract image features of each frame of image located before the i-th frame of image to obtain the image features of each frame of image; using the image features of each frame of image as image constraints, perform text feature extraction on the descriptive text associated with each frame of image located before the i-th frame of image to obtain the initial image and text features of each frame of image; obtain an identification feature for indicating the image and text modality, and fuse the 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 of image.
[0218] In some embodiments, the generation module is also used to extract features from each frame image 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 fused features; perform a first number of noise addition processing on the fused features to obtain noisy fused features; based on the target constraint information, perform a second number of denoising processing on the noisy fused features to obtain denoised fused features; and generate the i-th frame image based on the denoised fused features.
[0219] In some embodiments, the generation module is also used to obtain multiple 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.
[0220] In some embodiments, the generation module is further used to obtain a plurality of serially connected initial frame image generation models and a reference frame image sequence including 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, each frame image in the target frame image sequence located before the i-th frame image, and the description text of each frame image 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 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 based on the difference, updating the model parameters of each of the initial frame image generation models to obtain the serially connected frame image generation model.
[0221] In some embodiments, the generation module is also used to obtain video samples and a frame sampling interval for the video samples; based on the frame sampling interval, the video samples are subjected to frame sampling processing to obtain multiple frame images; the multiple frame images are subjected to clustering processing 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.
[0222] In some embodiments, the generation module is further used to divide each of the frame images into shots to obtain multiple storyboards, and 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, and the target frame image can be used to identify the storyboard; perform feature extraction on each of the target frame images to obtain multiple frame image features; and perform clustering processing on the multiple frame image features to obtain the multiple clusters.
[0223] In some embodiments, the generation module is also used to determine, for each cluster, 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; 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.
[0224] In some embodiments, the synthesis module is also used to obtain 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; 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.
[0225] The embodiment of the present application provides a computer program product, including computer executable instructions, which are 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 the processor executes the computer executable instructions, so that the electronic device executes the video generation method described in the embodiment of the present application.
[0226] The embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, the processor will be caused to execute the video generation method provided by the embodiment of the present application, for example, Figure 3 The video generation method is shown.
[0227] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface storage, optical disk, or CD-ROM; or it may be various devices including one or any combination of the above memories.
[0228] 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.
[0229] 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 storing 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 coordinated files (e.g., files storing one or more modules, subroutines, or code portions).
[0230] As an 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 at multiple sites and interconnected by a communication network.
[0231] 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 description text associated with the frame images before the frame image are used as the target constraint information to constrain the generation process of each frame image, so that the generated frame image can maintain the consistency of content 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, so that 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 realizing efficient and fast generation of continuous frame images.
[0232] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.
Claims
1. A method for generating a video, characterized in that: The method comprises: Determine the acquired initial image as the first frame image in the frame image sequence to be generated, and acquire description text of each frame image in the frame image sequence; Generate the i-th frame image 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 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 images in the frame image sequence; Traversing the i to obtain each frame image in the frame image sequence; Perform video synthesis on each frame image in the frame image sequence to obtain a target video.
2. The method according to claim 1, characterized in that The generating the i-th frame image 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 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 before the i-th 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; splicing the text constraint information and the graphic constraint information to obtain target constraint information; Taking the frames of image before the i-th frame of image as reference and based on the target constraint information, constraining the generation process of the i-th frame of image to obtain the i-th frame of image.
3. The method according to claim 2, characterized in that 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; An identification feature for indicating a text modality is obtained, and the identification feature is fused with the descriptive text feature, and the fusion result is used as the text constraint information of the i-th frame image.
4. The method according to claim 2, characterized in that The step of generating the image-text constraint information of the i-th frame image based on the frame images before the i-th frame image and the description texts of the frame images comprises: 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; An identification feature for indicating a graphic mode is obtained, and the 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.
5. The method according to claim 2, characterized in that The step of constraining the generation process of the i-th frame image based on the target constraint information and taking the frame images before the i-th frame image as reference to obtain the i-th frame image includes: Perform feature extraction on 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 addition processes on the fused features to obtain a noisy fused feature; Based on the target constraint information, performing a second denoising process 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.
6. The method according to claim 1, characterized in that The generating the i-th frame image 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 comprises: Acquire 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; 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.
7. The method according to claim 6, characterized in that Before acquiring a plurality of series-connected frame image generation models, the method further includes: Acquire a plurality of series-connected initial frame image generation models and a reference frame image sequence including a plurality of 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 series frame image generation model.
8. The method according to claim 7, characterized in that The step of acquiring 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, the video sample is subjected to frame extraction processing to obtain a plurality of frame images; Performing clustering processing on the multiple frame images to obtain multiple clusters; Determine the Euclidean distance between each frame image in each cluster and the corresponding cluster center; A distance threshold corresponding to each cluster is determined, and for each frame image in each cluster, a 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 a plurality of continuous frame image samples is obtained.
9. The method according to claim 8, characterized in that The clustering process is performed on the plurality of frame images to obtain a plurality of clusters, including: 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; Selecting a target frame image from the frame images of each storyboard, wherein the target frame image can be used to identify the storyboard; Extracting features from each of the target frame images respectively to obtain a plurality of frame image features; Clustering is performed on the multiple frame image features to obtain the multiple clusters.
10. The method according to claim 8, characterized in that The determining of the distance threshold corresponding to each cluster 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.
11. The method according to claim 1, characterized in that 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 continuous 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.
12. A video generation device, characterized in that: The device comprises: An acquisition module, used to determine the acquired initial image as the first frame image in the frame image sequence to be generated, and to acquire description texts of each frame image in the frame image sequence; A generating module, configured to generate the i-th frame image based on a description text of the i-th frame image in the frame image sequence, each frame image in the frame image sequence located before the i-th frame image, and each frame image 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; A traversal module, used for traversing the i to obtain each frame image in the frame image sequence; The synthesis module is used to perform video synthesis on each frame image in the frame image sequence to obtain a target video.
13. An electronic device, characterized in that: include: A memory for storing executable instructions; A processor, configured to implement the video generation method described in any one of claims 1 to 11 when executing the computer executable instructions stored in the memory.
14. A computer-readable storage medium storing computer-executable instructions, characterized in that: When the computer executable instructions are executed by a processor, the video generation method described in any one of claims 1 to 11 is implemented.
15. A computer program product comprising computer executable instructions, characterized in that: When the computer executable instructions are executed by a processor, the video generation method described in any one of claims 1 to 11 is implemented.
Citation Information
Patent Citations
Video generation method and related device
CN111669515A
Video generation method and device, server and storage medium
CN112235516A
Driving stability experimental apparatus for capsule train
KR102252316B1
Method, System, and Apparatus for Generating Video Content
US20180075879A1
Cited By
Video retrieval method and system based on large language model semantic driving
CN119397057A
Figure generation method, device, system and equipment and storage medium
CN119810259A
