Video editing method based on diffusion model corresponding relation

Through the correspondence method based on the diffusion model, the latent features of the video frames are extracted and the similarity of the marks between frames is calculated, and the self-attention mechanism is used for video editing, which solves the problem of temporal consistency in video editing and achieves high-quality and efficient Video editing for resource-constrained environments.

CN118695042AActive Publication Date: 2024-09-24TSINGHUA SHENZHEN INTERNATIONAL GRADUATE SCHOOL

Patent Information

Application Number
CN202410738016.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-07
Publication Date
2024-09-24
Estimated Expiration
2044-06-07

AI Technical Summary

Technical Problem

It is difficult to ensure temporal consistency in video editing with existing technology, resulting in flicker or blur in the generated video, and training the T2V model from scratch requires a large amount of computing resources.

Method used

Using the correspondence method based on the diffusion model, the latent features of the video frames are extracted through the variational autoencoder, noise is added and input into the pre-trained T2I diffusion model for reverse denoising, the diffusion features are extracted, and the similarity recognition correspondence of inter-frame markers is calculated. relations, and video editing via self-attention mechanism.

Benefits of technology

Significantly improves the quality and time consistency of video editing, avoids flickering or blurring, allows inserting pre-trained models without additional training, reduces computing resource requirements, and is suitable for resource-constrained scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118695042A
    Figure CN118695042A
Patent Text Reader

Abstract

The invention discloses a video editing method based on a diffusion model corresponding relation. The video editing method comprises the following steps: S1, extracting potential features of each frame of an input video by using a variational auto-encoder VAE; s2, adding noise of a specific time step into the extracted potential features; s3, inputting the potential features after the noise is added into a pre-trained text-to-image T2I diffusion model; s4, executing a reverse denoising process in the T2I diffusion model, and gradually removing noise; s5, intermediate feature representation is extracted in the reverse denoising process, diffusion features are formed, and the diffusion features contain marks in each frame; s6, calculating the similarity of the diffusion feature marks between different frames to identify the corresponding relationship between the mark in each frame and the marks in other frames; and S7, according to the identified corresponding relation, performing feature fusion on the identified corresponding marks, and performing video editing operation based on a self-attention mechanism on the fused features. According to the invention, the quality and time consistency of video editing can be obviously improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to computer vision processing technology, and in particular to a video editing method based on diffusion model correspondence. Background Art

[0002] Diffusion models have demonstrated excellent performance in image generation, thus motivating their application in the field of image editing. These methods usually leverage a pre-trained text-to-image (T2I) stable diffusion model, use DDIM inversion to convert the source image into noise, and then progressively denoise it under the guidance of hints to generate the edited image.

[0003] Despite promising performance on image editing, achieving high-quality video editing remains challenging. In particular, unlike the mature open-source T2I stable diffusion models, comparable text-to-video (T2V) diffusion models are less mature due to the difficulty in modeling complex temporal dynamics, and training a T2V model from scratch requires a lot of computational resources. Therefore, there is a growing focus on applying pre-trained T2I diffusion to video editing. In this context, maintaining the temporal consistency of the edited videos is one of the biggest challenges, which requires the generated frames to be stylistically consistent and exhibit smooth temporal transitions rather than looking like a series of independent images. Many methods have been studying this problem, but still face various limitations, such as the inability to ensure fine temporal consistency (causing the generated videos to appear flickering or blurry), the need for additional components, or the need for additional training or optimization.

[0004] It should be noted that the information disclosed in the above background technology section is only used for understanding the background of the present application, and therefore may include information that does not constitute prior art known to ordinary technicians in the field. Summary of the invention

[0005] The main purpose of the present invention is to overcome the defects of the above-mentioned background technology and provide a video editing method based on the corresponding relationship of the diffusion model.

[0006] To achieve the above object, the present invention adopts the following technical solutions:

[0007] A video editing method based on diffusion model correspondence relationship comprises the following steps:

[0008] S1. Use variational autoencoder VAE to extract latent features for each frame of the input video;

[0009] S2. Add noise at a specific time step to the extracted latent features;

[0010] S3. Input the latent features after adding noise into the pre-trained text-to-image T2I diffusion model;

[0011] S4. performing a reverse denoising process in the T2I diffusion model to gradually remove noise;

[0012] S5. extracting intermediate feature representations during the inverse denoising process to form diffusion features, wherein the diffusion features contain markers in each frame;

[0013] S6. Calculate the similarity of the diffusion feature markers between different frames to identify the corresponding relationship between the markers in each frame and the markers in other frames;

[0014] S7. Based on the identified corresponding relationships, feature fusion is performed on the identified corresponding markers, and a video editing operation based on a self-attention mechanism is performed on the fused features.

[0015] A computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the video editing method based on the corresponding relationship of the diffusion model.

[0016] A computer program product comprises a computer program, wherein when the computer program is executed by a processor, the video editing method based on the diffusion model correspondence relationship is implemented.

[0017] The present invention has the following beneficial effects:

[0018] The present invention provides a video editing method based on the correspondence of a diffusion model, which uses a diffusion model to obtain the correspondence of feature tags in a video frame, significantly improving the quality and time consistency of video editing. Specifically, the present invention adds noise to the potential features extracted from the video frame and then performs the inverse denoising process of the diffusion model to extract the intermediate feature representation, forming a diffusion feature containing the tags in the frame, and using the intrinsic correspondence of the tags between frames. These correspondences are closely related to the time consistency of the video, and by calculating the self-attention mechanism between the features corresponding to different frames, the quality and time consistency of video editing can be significantly improved, and the generated video can be ensured to maintain a high degree of consistency in style and content, avoiding the flickering or blurring phenomenon commonly seen in traditional methods. In addition, the present invention has the advantage of plug-and-play, and can be inserted into a pre-trained diffusion model without additional training of the existing model, thereby improving the video editing performance. This not only reduces the demand for computing resources, but also makes the video editing process more efficient, and is particularly suitable for resource-constrained scenarios such as mobile devices.

[0019] In the preferred embodiment, the present invention also proposes a method for calculating the correspondence of labels using a sliding window, which not only effectively obtains a one-to-many correspondence, but also significantly reduces the computational overhead, reduces the computational complexity, and reduces GPU memory usage.

[0020] In summary, the present invention realizes diversified editing of video content (including background editing, foreground editing, style editing, etc.) while maintaining high-quality editing effects and superior performance, surpassing existing video editing technologies.

[0021] Other beneficial effects of the embodiments of the present invention will be further described below. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 The flowchart of the video editing method based on the diffusion model correspondence relationship according to an embodiment of the present invention.

[0023] Figure 2 An overview diagram of the algorithm architecture of an embodiment of the present invention.

[0024] Figure 3 This is a corresponding relationship between features calculated based on a sliding window in an embodiment of the present invention.

[0025] Figure 4 This is a practical effect diagram of an embodiment of the present invention.

[0026] Figure 5 The figure is a comparison diagram of the effects of the embodiment of the present invention and the existing method. DETAILED DESCRIPTION

[0027] The following is a detailed description of the embodiments of the present invention. It should be emphasized that the following description is only exemplary and is not intended to limit the scope and application of the present invention.

[0028] One goal of the present invention is to achieve highly consistent video editing by exploiting the intrinsic correspondence between inter-frame markers (i.e., tokens, which represent features at a certain position in a feature map), which is intuitively closely related to the temporal consistency of the video: if the corresponding markers across frames show high similarity, the generated video will show high temporal consistency. For example, if the marker representing a man's nose in a video has high similarity between frames, his nose is less likely to deform or flicker in the video.

[0029] How to obtain accurate correspondence information between markers remains a less explored problem in existing research, although the intrinsic characteristics of video editing tasks (i.e., the source video and the edited video are expected to share similar actions and semantic layouts) determine that such correspondence naturally exists in the source video. Some previous methods utilize pre-trained optical flow models to obtain the flow trajectory of each marker between frames, which can be regarded as a rough correspondence information. Although the self-attention mechanism of markers in the same trajectory can enhance the temporal consistency of the edited video, it still faces two major limitations: First, these methods heavily rely on highly accurate pre-trained optical flow models to obtain the correspondence of markers, which is not available in many scenarios. Second, assuming that an extremely accurate optical flow model is accessible, it can still only obtain a rough one-to-one correspondence between markers in different frames, which may lead to information loss because in most cases, a marker is likely to correspond to multiple markers in other frames.

[0030] To address these issues, the inventors noticed that inherent diffusion features naturally contain precise correspondence information. For example, corresponding points between two images can be easily found by extracting their diffusion features and computing the cosine similarity between the markers. However, to date, no existing work has successfully exploited this property to handle more complex and challenging tasks, such as video editing. The present invention proposes a video editing method based on diffusion model correspondences, which is the first solution to exploit the potential of inherent diffusion feature correspondences to significantly improve the quality and temporal consistency of video editing.

[0031] See also Figure 1 The embodiment of the present invention provides a video editing method based on the corresponding relationship of the diffusion model, comprising the following steps:

[0032] S1. Use variational autoencoder VAE to extract latent features for each frame of the input video;

[0033] S2. Adding noise of the selected specific time step to the extracted latent features;

[0034] S3. Input the latent features after adding noise into the pre-trained text-to-image T2I diffusion model;

[0035] S4. performing a reverse denoising process in the T2I diffusion model to gradually remove noise;

[0036] S5. extracting intermediate feature representations during the inverse denoising process to form diffusion features, wherein the diffusion features contain markers in each frame;

[0037] S6. Calculate the similarity of the diffusion feature markers between different frames to identify the corresponding relationship between the markers in each frame and the markers in other frames;

[0038] S7. Based on the identified corresponding relationships, feature fusion is performed on the identified corresponding markers, and a video editing operation based on a self-attention mechanism is performed on the fused features.

[0039] In the video editing method based on the correspondence of the diffusion model in the embodiment of the present invention, the diffusion model is used to obtain the correspondence of the feature markers in the video frame, which significantly improves the quality and temporal consistency of video editing. Specifically, the present invention adds noise to the potential features extracted from the video frame and then performs the inverse denoising process of the diffusion model to extract the intermediate feature representation, forming a diffusion feature containing the markers in the frame, and uses the intrinsic correspondence of the markers between frames. These correspondences are closely related to the temporal consistency of the video, and by calculating the self-attention mechanism between the features corresponding to different frames, the quality and temporal consistency of video editing can be significantly improved, and the generated video can be ensured to maintain a high degree of consistency in style and content, avoiding the flickering or blurring phenomenon commonly seen in traditional methods.

[0040] In a preferred embodiment, step S3 further includes inputting the user's prompt words into the T2I diffusion model to guide the video editing process.

[0041] In a preferred embodiment, the T2I diffusion model includes a U-net decoder, and in step S5, an intermediate feature representation output by the U-net decoder is extracted during the reverse denoising process to form a diffusion feature.

[0042] In one embodiment, step S6 specifically includes: for each marker in each frame, calculating its cosine similarity with the markers in other frames; for each marker in each frame, selecting the top K markers with the highest similarity based on the cosine similarity to form a one-to-many correspondence. More specifically, it includes: normalizing the diffusion features; performing a dot product operation on the normalized diffusion features, that is, evaluating the similarity between markers in different frames by matrix multiplication; and using the obtained similarity matrix to determine the coordinates of the top K markers with the highest similarity to a given marker in each frame.

[0043] In a preferred embodiment, in step S6, the one-to-many correspondence relationship of the tags is calculated based on the sliding window strategy, which specifically includes the following sub-steps:

[0044] S61. For each frame in the video, extract diffusion features and determine the position of the marker;

[0045] S62. For each mark in the diffusion feature, determine the center of the small window as the position of the mark in the current frame, and set the window length to limit the local range for calculating the similarity;

[0046] S63. Using the small window determined in step S62, select a marker in the small window in the next frame corresponding to the small window as a candidate corresponding marker;

[0047] S64. For each tag in the current frame, only the similarity between it and the candidate corresponding tag in the small window is calculated, and the dot product operation is used to evaluate the similarity;

[0048] S65. According to the result of the dot product operation, select the first K tags in the small window with the highest similarity to the current frame tag to determine the corresponding relationship;

[0049] S66. Repeat steps S62 to S65 to process all the marks in the current frame and determine the position of the corresponding mark for each frame.

[0050] In step S64, the dot product operation is performed by matrix multiplication of the normalized diffusion features.

[0051] The preferred embodiment uses a sliding window to calculate the corresponding relationship of the markers, which not only effectively obtains a one-to-many corresponding relationship, but also significantly reduces the calculation overhead, reduces the calculation complexity, and reduces the GPU memory usage.

[0052] In a preferred embodiment, step S7 specifically includes:

[0053] S71. Using the correspondence determined in step S6, sampling features for each marker in each frame from the noise potential layer;

[0054] S72. Fusing the sampled features to reduce GPU memory usage and speed up the video editing process;

[0055] S73. Apply the self-attention mechanism to the fused features, and perform calculations by the following operations: initialize the query Q, key K, and value V matrices, where Q is the input, and K and V are the fused features; calculate the dot product between Q and K, and normalize them through the Softmax function to obtain the attention weights; use the obtained attention weights to perform weighted summation on V to obtain a weighted value vector;

[0056] S74. Edit the video frame using the result of the self-attention operation.

[0057] The method of the embodiment of the present invention can not only significantly improve the quality and time consistency of video editing, but also has the advantage of plug-and-play, and can be inserted into the pre-trained diffusion model without additional training of the existing model, thereby improving the video editing performance. This not only reduces the demand for computing resources, but also makes the video editing process more efficient, especially suitable for resource-constrained scenarios such as mobile devices.

[0058] The specific embodiments of the present invention are further described below.

[0059] In some embodiments, the video editing method includes: obtaining a source video and a prompt word; inputting the source video and the prompt word into a pre-trained diffusion model to obtain an edited video; wherein the diffusion model includes a self-attention mechanism based on a correspondence relationship. First, the correspondence relationship between features of different frames is obtained by a calculation method based on a sliding window, and then in the inversion and denoising process, the self-attention mechanism is calculated based on this correspondence relationship, thereby achieving high-quality and highly temporally consistent video editing.

[0060] Given a source video, diffusion features are first extracted for each frame. Then, for each marker in the diffusion features, the corresponding markers in other frames are obtained based on their similarity. In this process, a sliding window based method is proposed to ensure computational efficiency. In the sliding window method, each marker only needs to calculate its similarity with the markers within a small window in the next frame, and the top K (K>1) markers with the highest similarity are identified. After the correspondence calculation process, the coordinates of the K corresponding markers of each marker in each other frame can be obtained. During the inversion and denoising process, the noisy latent markers are sampled according to the obtained coordinates. In order to reduce redundancy and speed up the editing process, marker merging is applied in the temporal dimension, followed by self-attention. The method can be seamlessly integrated into the off-the-shelf T2I diffusion model without additional training or optimization. Extensive experiments show that COVE significantly improves the quality and temporal consistency of the generated videos, surpassing a wide range of existing methods and achieving state-of-the-art results.

[0061] In this setting, the source video V contains IV frames, and a variational autoencoder (VAE) is used to extract latent features z = {x1, ...x N}, where z∈R N×H×W×d Here H and W represent the height and width of the potential features, and d represents the dimension of each tag. For each frame in z, add the noise at a specific time step t to get the noisy frame Then input them into the pre-trained text-to-image (T2I) model f θ Through the single-step operation of denoising, the diffusion features (i.e., the intermediate features of the U-net decoder) can be extracted.

[0062]

[0063] One-to-many correspondence calculation

[0064] For each mark in the diffusion feature F, its corresponding mark in other frames is determined according to the cosine similarity. Without loss of generality, we can consider the i-th frame F i With coordinates [h i , wi ]feature Unlike previous methods, which can only determine one corresponding marker per frame, this method simply obtains a one-to-many correspondence by selecting the top K markers with the highest similarity in each frame. Their coordinates are recorded and used to sample the markers in the subsequent inversion and denoising process. The most direct way to achieve this process is through matrix multiplication of the normalized diffusion feature F.

[0065] s=F·F T

[0066] Features The similarity between all IV×H×W tags is given by S[i, h i , w Then, by selecting the first K features with the highest similarity in the j-th frame (j∈{1,...,Ⅳ}), the coordinates of the corresponding features in the j-th frame are obtained.

[0067]

[0068] Here The operation represents finding the coordinates of the largest K values ​​in the matrix, where k∈{1,...,K}. Indicates the jth frame with The coordinates of the marker with the highest similarity. A similar process can be performed for each feature in F to obtain their correspondence between frames.

[0069] Sliding Window Strategy

[0070] Although the one-to-many correspondence between tags can be effectively obtained through the above process, it requires a lot of computing resources because IV×H×W is always a huge number, especially in long videos. Therefore, the computational complexity of this process is extremely high, which can be expressed as O(IV 2 ×H 2 ×W 2 ×d). At the same time, the multiplication between these two huge matrices consumes a lot of GPU memory in practice. These limitations severely restrict its application in many practical scenarios, such as on mobile devices.

[0071] In order to solve the above problems, a sliding window-based strategy is further proposed as an alternative, which not only effectively obtains the one-to-many correspondence but also significantly reduces the computational overhead. Just calculate its difference with the next frame F i+1 , rather than the labels of all frames, i.e.

[0072]

[0073] in represents the similarity of each feature between the i-th frame and the i+1-th frame. The overall similarity matrix is ​​S = {S i}, i∈{1, 2, ..., N-1} is obtained by the following formula The corresponding features in the i+1th frame:

[0074]

[0075] Similarly, the corresponding features in the i+2th frame can be obtained:

[0076]

[0077] Through the same process, the position of the corresponding feature in each frame can be obtained. Through the above process, the computational complexity is reduced to It is further noted that each frame in the video is continuous, so for It is only necessary to calculate the similarity within a small window of adjacent frames, rather than calculating the similarity for all features in adjacent frames.

[0078]

[0079] Represents the features within a window of length l. By only calculating the similarity within this window, the computational complexity is further reduced to In the actual operation process, the GPU memory usage is also significantly reduced. Figure 3 shown.

[0080] In the inversion and denoising process of video editing, the corresponding markers are sampled from the noise latent layer for each marker according to the coordinates obtained in the above process. The corresponding feature set in other frames at time step t is

[0081]

[0082] These features are combined to speed up the video editing process and reduce GPU memory usage.

[0083]

[0084] Then, the self-attention operation is performed on the fused features

[0085]

[0086] Through the above operations, the quality and timing consistency of video editing can be significantly improved.

[0087] The embodiment of the present invention can significantly improve the quality and timing consistency of video editing by calculating the self-attention mechanism between the features corresponding to different frames. In the experiment, the method can perform various edits on the video content according to the prompt words provided by the user, including background editing, foreground editing, style editing, etc. For different types of prompt words, the present invention shows high editing quality. Some effects are as follows Figure 4 shown.

[0088] At the same time, the performance of the present invention exceeds that of many previous baseline methods, showing superior performance. Figure 5 shown.

[0089] In summary, the present invention proposes an innovative video editing method, which effectively solves some key problems in traditional video editing by utilizing the correspondence information contained in the diffusion model features, and significantly improves the quality and timing consistency of video editing.

[0090] Compared with the traditional method, the technical advantages of the present invention are mainly:

[0091] Compared with the previous video editing methods that had difficulty in ensuring the temporal consistency of the generated video, this method improves the video quality and temporal consistency: by utilizing the feature correspondence in the diffusion model, it effectively improves the quality and temporal consistency of video editing, and solves problems such as video flickering.

[0092] Plug and Play: No additional model training is required, and it can be directly inserted into the pre-trained diffusion model to quickly improve video editing performance.

[0093] Efficient performance: Compared with existing similar methods, this method shows superior video editing performance.

[0094] Resource Optimization: Ability to run efficiently in resource-constrained environments, such as mobile devices, enabling high-quality video editing without requiring extensive computing resources.

[0095] The present invention has a wide range of application scenarios and high practical value, for example:

[0096] Film and television production: In the production of films and television programs, the present invention can be used to edit original filming materials, add special effects, adjust colors, and synchronize audio and video to enhance the coherence and visual appeal of the story.

[0097] Advertising Production: Video editing is used in the advertising industry to create eye-catching commercials that appeal to the target audience and effectively communicate product information through precise editing and visual enhancement.

[0098] Social media content creation: With the popularity of social media, the present invention supports content creators in producing short videos and live broadcast content, helping them optimize video formats, add creative elements, and meet the needs of different platforms.

[0099] Education and Training: In the field of education, the invention can be used to create teaching videos and online courses, transforming complex concepts into easy-to-understand visual content and enhancing teaching effectiveness.

[0100] Video Game Development: In video game development, the invention is used to create promotional trailers and in-game plot animations, involving video editing, special effects production, and sound effects synchronization to enhance the immersion of the gaming experience.

[0101] An embodiment of the present invention further provides a storage medium for storing a computer program, which at least performs the above method when executed.

[0102] An embodiment of the present invention further provides a control device, comprising a processor and a storage medium for storing a computer program; wherein the processor is configured to execute at least the method described above when executing the computer program.

[0103] An embodiment of the present invention further provides a processor, wherein the processor executes a computer program and at least executes the method described above.

[0104] The storage medium can be implemented by any type of non-volatile storage device, or a combination thereof. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a ferromagnetic random access memory (Flash Memory), a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a disk memory or a tape memory. The storage medium described in the embodiments of the present invention is intended to include, but is not limited to, these and any other suitable types of memory.

[0105] In the several embodiments provided by the present invention, it should be understood that the disclosed systems and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0106] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the scheme of this embodiment.

[0107] In addition, all functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0108] A person skilled in the art can understand that: all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), disks or optical disks, etc. Various media that can store program codes.

[0109] Alternatively, if the above-mentioned integrated unit of the present invention is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention can be essentially or partly reflected in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.

[0110] The methods disclosed in the several method embodiments provided by the present invention can be arbitrarily combined without conflict to obtain new method embodiments.

[0111] The features disclosed in several product embodiments provided by the present invention can be arbitrarily combined without conflict to obtain new product embodiments.

[0112] The features disclosed in several method or device embodiments provided by the present invention can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.

[0113] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For those skilled in the art of the present invention, several equivalent substitutions or obvious variations can be made without departing from the concept of the present invention, and the performance or use is the same, which should be regarded as belonging to the protection scope of the present invention.

Claims

1. A video editing method based on diffusion model correspondence, characterized in that: The following steps are involved: S1. Use variational autoencoder VAE to extract latent features for each frame of the input video; S2. Add noise at a specific time step to the extracted latent features; S3. Input the latent features after adding noise into the pre-trained text-to-image T2I diffusion model; S4. performing a reverse denoising process in the T2I diffusion model to gradually remove noise; S5. extracting intermediate feature representations during the inverse denoising process to form diffusion features, wherein the diffusion features contain markers in each frame; S6. Calculate the similarity of the diffusion feature markers between different frames to identify the corresponding relationship between the markers in each frame and the markers in other frames; S7. Based on the identified corresponding relationships, feature fusion is performed on the identified corresponding markers, and a video editing operation based on a self-attention mechanism is performed on the fused features.

2. The video editing method according to claim 1, characterized in that: Step S3 also includes inputting the user's prompt words into the T2I diffusion model to guide the video editing process.

3. The video editing method according to claim 1 or 2, characterized in that: The T2I diffusion model includes a U-net decoder. In step S5, the intermediate feature representation output by the U-net decoder is extracted in the reverse denoising process to form a diffusion feature.

4. The video editing method according to any one of claims 1 to 3, characterized in that: Step S6 specifically includes: for each tag in each frame, calculating its cosine similarity with tags in other frames; for each tag in each frame, selecting the top K tags with the highest similarity based on the cosine similarity to form a one-to-many correspondence.

5. The video editing method according to claim 4, characterized in that: Step S6 specifically includes: normalizing the diffusion features; performing dot product operations on the normalized diffusion features, that is, evaluating the similarity between markers in different frames by matrix multiplication; and using the obtained similarity matrix to determine the coordinates of the top K markers with the highest similarity to a given marker in each frame.

6. The video editing method according to any one of claims 1 to 3, characterized in that: In step S6, the one-to-many correspondence relationship of the tags is calculated based on the sliding window strategy, which specifically includes the following sub-steps: S61. For each frame in the video, extract diffusion features and determine the position of the marker; S62. For each mark in the diffusion feature, determine the center of the small window as the position of the mark in the current frame, and set the window length to limit the local range for calculating the similarity; S63. Using the small window determined in step S62, select a marker in the small window in the next frame corresponding to the small window as a candidate corresponding marker; S64. For each tag in the current frame, only the similarity between it and the candidate corresponding tag in the small window is calculated, and the dot product operation is used to evaluate the similarity; S65. According to the result of the dot product operation, select the first K tags in the small window with the highest similarity to the current frame tag to determine the corresponding relationship; S66. Repeat steps S62 to S65 to process all the marks in the current frame and determine the position of the corresponding mark for each frame.

7. The video editing method according to claim 6, characterized in that: In step S64, the dot product operation is performed by matrix multiplication of the normalized diffusion features.

8. The video editing method according to any one of claims 1 to 7, characterized in that: Step S7 specifically includes: S71. Using the correspondence determined in step S6, sampling features for each marker in each frame from the noise potential layer; S72. Fusing the sampled features to reduce GPU memory usage and speed up the video editing process; S73. Apply the self-attention mechanism to the fused features, and perform calculations by the following operations: initialize the query Q, key K, and value V matrices, where Q is the input, and K and V are the fused features; calculate the dot product between Q and K, and normalize them through the Softmax function to obtain the attention weights; use the obtained attention weights to perform weighted summation on V to obtain a weighted value vector; S74. Edit the video frame using the result of the self-attention operation.

9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the video editing method based on the diffusion model correspondence relationship as described in any one of claims 1 to 8 is implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the video editing method based on the diffusion model correspondence relationship as described in any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Video editing method based on improved pre-training diffusion model

    CN117834987A

  • Video generation with latent diffusion probabilistic models

    US20240087179A1

Cited By

  • Multi-text long video generation method without fine tuning

    CN119697443A

  • Zero sample text driven video editing method based on diffusion model

    CN120091182A

  • Video detection method and device based on implicit representation of generative model

    CN120635761A