Model optimization method and device
By grading and adjusting the animation video generation model in multi-dimensionality, the motion distortion and flickering artifact problems in animation video generation are solved, and the generation quality and optimization efficiency are improved.
Patent Information
- Application Number
- CN202510475578.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-15
- Publication Date
- 2025-07-25
AI Technical Summary
The existing video generation model has problems such as motion distortion and flickering artifacts when generating anime videos. The generation quality is far from human expectations and the optimization efficiency is low.
By obtaining the target initial frame picture and text prompts, a preset video generation model is used to generate multiple training videos, and the training video is scored from multiple dimensions such as visual appearance and consistency, the reward score gap is determined, and the model is adjusted using the gap to improve the generation quality.
It improves the speed and effect of the model optimization process, alleviates the problems of motion distortion and flickering artifacts in the generation of anime videos, and makes the generated video more in line with human preferences.
Smart Images

Figure CN120373391A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the field of computer technology, and in particular, to a model optimization method, device, computer device, computer-readable storage medium, and computer program product. Background Art
[0002] With the rapid development of deep learning and generative model technologies, video generation models have shown great application potential in multiple fields. However, video generation technology still faces many challenges in dealing with some fields (such as anime video generation). For example, the optimization efficiency of video generation models is low, and the quality of videos generated by the optimized models is not high. For example, there are significant motion distortions and flicker artifacts when generating based on anime videos, which cannot meet human needs.
[0003] It should be noted that the above content is not necessarily prior art and is not used to limit the patent protection scope of the present application. Summary of the Invention
[0004] Embodiments of the present application provide a model optimization method, device, computer device, computer-readable storage medium, and computer program product to solve or alleviate one or more of the above technical problems.
[0005] One aspect of the embodiments of the present application provides a model optimization method, the method including: Obtain a target initial frame image and a target text prompt; Use the target initial frame image and the target text prompt as model inputs, and output multiple training videos through a preset video generation model; Score the multiple training videos to obtain a reward score corresponding to each training video; According to the reward score corresponding to each training video, determine the reward score gap between the highest reward score and the lowest reward score; Adjust the preset video generation model according to the reward score gap to obtain a target video generation model.
[0006] Optionally, obtaining a target initial frame image and a target text prompt includes: Obtain a video to be extracted; According to the video to be extracted, obtain the target initial frame image; Use the video to be extracted as a model input, and output the target text prompt through a pre-trained vision-language model.
[0007] Optionally, the multiple training videos include a target training video; scoring the multiple training videos to obtain a reward score corresponding to each training video includes: Obtain multiple preset scoring items, and one of the preset scoring items corresponds to one video scoring model; Score the target training video through the multiple video scoring models to obtain multiple item scores corresponding to the target training video, and one of the preset scoring items corresponds to one of the item scores; Determine the reward score corresponding to the target training video according to the multiple item scores and the preset weight array.
[0008] Optionally, the multiple preset scoring items include a target preset scoring item, and the target preset scoring item corresponds to a target video scoring model; the target video scoring model is obtained through the following operations: Obtain multiple guiding frame images and multiple guiding texts, and one of the guiding frame images corresponds to one of the guiding texts; Generate multiple groups of scoring training videos through the preset video generation model according to the multiple guiding frame images and the multiple guiding texts; wherein, one of the guiding frame images corresponds to one group of the scoring training videos, the number of videos in each group of the scoring training videos is multiple, and each of the scoring training videos is labeled with an artificial labeling result; Obtain multiple labeled training samples according to the multiple guiding frame images, the multiple guiding texts, and the multiple groups of labeled scoring training videos; Perform multiple rounds of training on the initial video scoring model according to the multiple labeled training samples to obtain the target video scoring model.
[0009] Optionally, the scoring item type of the target preset scoring item includes an appearance type and a consistency type; In each round of training: When the target preset scoring item is of the appearance type, score the multiple scoring training videos through the current video scoring model to obtain multiple appearance scoring results, and one of the scoring training videos corresponds to one of the appearance scoring results; wherein, the current video scoring model is the video scoring model obtained after the previous round of training; Adjust the current video scoring model according to the appearance scoring result and the artificial labeling result corresponding to each scoring training video to obtain the video scoring model after this round of training.
[0010] Optionally, the scoring item type of the target preset scoring item includes an appearance type and a consistency type; In each round of training: When the target preset scoring item is of the consistency type, based on the multiple scoring training videos, the guiding frame picture, and the guiding text, use the current video scoring model to score the multiple scoring training videos to obtain multiple consistency scoring results, where one scoring training video corresponds to one consistency scoring result; wherein, the current video scoring model is the video scoring model obtained after the previous round of training; Adjust the current video scoring model according to the consistency scoring result corresponding to each scoring training video and the manual annotation result to obtain the video scoring model after this round of training.
[0011] Optionally, the preset scoring item of the consistency type includes a role consistency scoring item, the consistency scoring result includes a role consistency scoring result, and the multiple scoring training videos include a target scoring training video; based on the multiple scoring training videos, the guiding frame picture, and the guiding text, use the current video scoring model to score the multiple scoring training videos to obtain multiple consistency scoring results, including: Determine multiple target roles according to the guiding frame picture; For each target role, extract multiple target role mask pictures from the target scoring training video; Based on the multiple target role mask pictures, use a preset role encoder to extract multiple picture features corresponding to each target role, where one target role mask picture corresponds to one picture feature; Obtain the role feature corresponding to each target role according to the guiding text and the guiding frame picture; Determine multiple picture consistency values corresponding to each target role according to the role feature and multiple picture features corresponding to each target role, where one picture feature corresponds to one picture consistency value; Determine multiple role consistency values based on the multiple picture consistency values corresponding to each of the multiple target roles, where one target role corresponds to multiple picture consistency values and one role consistency value; Determine the role consistency scoring result corresponding to the target scoring training video according to the multiple role consistency values.
[0012] Optionally, the method further includes: Determine a target video picture according to the target scoring training video; Extract a training role mask picture corresponding to the training role according to the target video picture, where the training role is any one of the multiple target roles; Extract the training role picture feature corresponding to the training role through the preset role encoder according to the training role mask picture; Obtain the character description text corresponding to the training character; According to the character description text, extract the training character text features corresponding to the training character through a preset text encoder; According to the training character text features and the training character picture features, obtain the character recognition loss value; According to the character recognition loss value, adjust the preset character encoder.
[0013] Another aspect of the embodiments of the present application provides a model optimization device, and the device includes: A first acquisition module, configured to acquire a target initial frame image and a target text prompt; An output module, configured to use the target initial frame image and the target text prompt as model inputs, and output a plurality of training videos through a preset video generation model; A second acquisition module, configured to score the plurality of training videos and obtain the reward score corresponding to each training video; A determination module, configured to determine the reward score gap between the highest reward score and the lowest reward score according to the reward score corresponding to each training video; An adjustment module, configured to adjust the preset video generation model according to the reward score gap to obtain a target video generation model.
[0014] Another aspect of the embodiments of the present application provides a computer device, including: At least one processor; and A memory communicatively connected to the at least one processor; Wherein: the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method as described above.
[0015] Another aspect of the embodiments of the present application provides a computer-readable storage medium, in which computer instructions are stored, and when the computer instructions are executed by a processor, the method as described above is implemented.
[0016] Another aspect of the embodiments of the present application provides a computer program product, including a computer program, and when the computer program is executed by a processor, the method as described above is implemented.
[0017] The embodiments of the present application adopting the above technical solutions may include the following advantages: determining the maximum reward score gap of a set of training videos generated according to the same target initial frame image and target text prompt, and using the reward score gap as the basis for adjusting the preset video generation model can enhance the influence of the training videos with a large reward score gap on the model optimization process, thereby improving the speed and effect of the model optimization process, and further improving the quality of the videos generated by the optimized target video generation model. For example, the optimized target video generation model can alleviate problems such as motion distortion and flicker artifacts when generating based on anime videos, thus meeting human needs. BRIEF DESCRIPTION OF THE DRAWINGS The drawings exemplarily illustrate the embodiments and form a part of the specification, and are used together with the written description of the specification to explain the exemplary embodiments. The illustrated embodiments are for illustrative purposes only and do not limit the scope of the claims. In all the drawings, the same reference numerals refer to similar but not necessarily identical elements.
[0018] Figure 1 Schematically shows the operating environment diagram of the model optimization method according to Embodiment 1 of the present application; Figure 2 Schematically shows the flowchart of the model optimization method according to Embodiment 1 of the present application; Figure 3 Schematically shows Figure 2 The sub-step flowchart of step S200 in; Figure 4 Schematically shows Figure 2 The sub-step flowchart of step S204 in; Figure 5 Schematically shows the newly added flowchart of the model optimization method according to Embodiment 1 of the present application; Figure 6 Schematically shows another newly added flowchart of the model optimization method according to Embodiment 1 of the present application; Figure 7 Schematically shows another newly added flowchart of the model optimization method according to Embodiment 1 of the present application; Figure 8 Schematically shows Figure 7 The sub-step flowchart of step S700 in; Figure 9 Schematically shows another newly added flowchart of the model optimization method according to Embodiment 1 of the present application; Figure 10 Schematically shows the exemplary application flowchart of the model optimization method according to Embodiment 1 of the present application; Figure 11 Schematically shows the optimization process schematic diagram of the model optimization method according to Embodiment 1 of the present application; Figure 12 Schematically shows a schematic diagram of the training and application of the role consistency evaluation model for the model optimization method according to Embodiment 1 of the present application; Figure 13 Schematically shows a block diagram of the model optimization device according to Embodiment 2 of the present application; and Figure 14 Schematically shows a schematic diagram of the hardware architecture of a computer device according to Embodiment 3 of the present application Figure 15 Schematically shows a set of anime video pictures generated using three models; Figure 16 Schematically shows another set of anime video pictures generated using three models; and Figure 17 Schematically shows yet another set of anime video pictures generated using three models. Detailed implementation manners
[0019] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts shall fall within the protection scope of the present application.
[0020] It should be noted that the descriptions involving "first", "second", etc. in the embodiments of the present application are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include at least one of such features. In addition, the technical solutions between various embodiments may be combined with each other, but it must be based on the fact that those of ordinary skill in the art can implement them. When the combination of technical solutions appears to be contradictory or unable to be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the protection scope required by the present application.
[0021] In the description of the present application, it should be understood that the numerical labels before the steps do not identify the order of execution of the steps, but are only used to facilitate the description of the present application and distinguish each step, and thus cannot be understood as a limitation to the present application.
[0022] First, provide the term explanations involved in the present application: Diffusion Model: A generative model based on deep learning. The core idea is to gradually add noise to the data (diffusion process), and then train a neural network to reverse this process (denoising process) to generate new data.
[0023] Generative Adversarial Network (GAN): A deep learning model composed of two parts, a Generator and a Discriminator. The Generator is used to generate as realistic data as possible (such as images, videos, etc.), while the Discriminator is used to distinguish between the generated data and the real data.
[0024] Transformer: A deep learning model architecture for processing sequence data, capable of handling long-range dependencies.
[0025] GroundingDINO: A pioneering open-set object detection model that combines DINO (Detection Transformer) and a text encoder to achieve open-vocabulary object detection and natural language object localization.
[0026] SAM (Segment Anything Model): A large image segmentation model open-sourced by Meta that can segment any object in any image without any annotation.
[0027] Tracking tool: A computer vision technology used to identify and track the motion trajectories of one or more specific objects in a video sequence.
[0028] VideoSAM: A general-purpose vision foundation model for video segmentation tasks, used to handle object tracking and segmentation tasks in complex dynamic scenes.
[0029] Mask2Former: A Transformer-based image segmentation model whose overall architecture integrates mask prediction technology, self-attention mechanism, and multi-scale feature extraction. It mainly includes three core parts: a backbone feature extractor, a pixel decoder, and a Transformer decoder.
[0030] DPO (Direct Preference Optimization): A method for aligning generative models that directly optimizes the output probability difference of the model between "human preference samples" and "rejected samples".
[0031] IPO (Identity-preference Optimization): An optimization method that is stable and effective in handling deterministic preferences by directly optimizing the regularized version of the total preference instead of relying on the Bradley-Terry model.
[0032] KTO (Kahneman-Tversky Optimization): A model alignment method that optimizes the output preferences of language models through cognitive biases such as "loss aversion" in human behavior.
[0033] Secondly, to facilitate the understanding of the technical solutions provided in the embodiments of the present application by those skilled in the art, the related technologies are described below: With the emergence of various powerful video generation models, both the industrial and academic communities are eagerly anticipating the arrival of the one-button video creation era. As an important visual expression form in video media, anime plays an indispensable role in human daily life and entertainment. However, due to the scarcity of anime data and the differences in motion patterns, when current video generation models are applied to anime video generation, significant motion distortion and flicker artifacts often occur, and the generated quality far from meets human expectations. Moreover, the reward models used to align video models with human preferences are mainly designed for real-world videos and cannot capture the unique appearance and consistency requirements of anime.
[0034] For this reason, the embodiments of the present application provide a technical solution for model optimization. In this technical solution, (1) a dedicated vision-language model is used to score training videos from different dimensions (including visual appearance and visual consistency), which can improve the accuracy and multi-dimensionality of the reward scores, and further improve the comprehensiveness and scientificity of the scoring process; (2) the reward score gap is used as the basis for adjusting the training loss, which can increase the influence of training video combinations (training sample pairs) with a large reward score gap on the model optimization process and reduce the influence of training video combinations (training sample pairs) with a small reward score gap on the model optimization process. See the following text for details.
[0035] Finally, for the convenience of understanding, an exemplary operating environment is provided below.
[0036] As Figure 1 shown, the schematic diagram of the environment may include a service platform 2, one or more clients 4, and a network 6.
[0037] The service platform 2 and one or more clients 4 can be coupled through the network 6 to achieve information transmission and interaction.
[0038] The service platform 2, the client 4, and the network 6 are elaborated in detail below.
[0039] The service platform 2 can be composed of a single or multiple computing devices. The one or more computing devices can include virtualized computing instances. The virtualized computing instances can include virtual machines, such as emulations of computer systems, operating systems, servers, etc. The computing devices can load virtual machines based on virtual images and / or other data that define specific software (e.g., operating systems, dedicated applications, servers) for emulation. As the demand for different types of processing services changes, different virtual machines can be loaded and / or terminated on the one or more computing devices. A hypervisor can be implemented to manage the use of different virtual machines on the same computing device. The service platform 2 can run to enable model training, optimization, and running usage according to the methods described in this application. The service platform 2 can also provide other services or software applications, which can include non-virtual environments and virtual environments. In some embodiments, these services can be provided as web-based services or cloud services, for example, provided to users of the client 4 under the software as a service (SaaS) model.
[0040] The service platform 2 can include one or more components that implement the functions performed by the service platform 2. These components can include software components, hardware components, or a combination thereof that can be executed by one or more processors. In some embodiments, the service platform 2 can provide services such as model training, video generation, etc. In other embodiments, users operating the client 4 can sequentially utilize one or more client applications to interact with the service platform 2 to utilize the services provided by these components.
[0041] The client 4 can include various types of computer devices, such as portable handheld devices, general-purpose computers (such as personal computers and laptop computers), workstation computers, smart screen devices, self-service terminal devices, service robots, thin clients, various messaging devices, or other electronic devices, etc. These computer devices can run various types and versions of software applications and operating systems, such as MICROSOFT Windows, APPLE iOS, UNIX-like operating systems, Linux or Linux-like operating systems (such as GOOGLE Chrome OS); or include various mobile operating systems, such as MICROSOFT Windows, Mobile OS, iOS, Windows Phone, Android. Portable handheld devices can include cellular phones, smartphones, tablets, personal digital assistants, etc. The client device is capable of executing various different applications, such as various Internet-related applications, communication applications (such as email applications), short message service (SMS) applications, and can use various communication protocols.
[0042] Based on the operating system described above, the client 4 can also install one or more application programs, such as Input training Training instructions, video generation instructions .
[0043] The network 6 can be used as a transmission medium between the service platform 2 and the client 4. The network 6 includes various network devices, such as routers, switches, multiplexers, hubs, modems, bridges, repeaters, firewalls, proxy devices, and / or the like. The network can include physical links, such as coaxial cable links, twisted pair cable links, fiber optic links, and combinations thereof, or wireless links, such as cellular links, satellite links, Wi-Fi links, etc.
[0044] It should be noted that the above devices are exemplary, and the number and types of devices can be adjusted in different scenarios or according to different requirements.
[0045] Hereinafter, taking the service platform 2 as the execution entity, the technical solutions of the present application will be introduced through multiple embodiments. It should be noted that these embodiments can be implemented in various different forms and should not be construed as being limited only to the embodiments described herein.
[0046] Embodiment 1 Figure 2 The flowchart of the model optimization method according to Embodiment 1 of the present application is schematically shown.
[0047] As Figure 2 shown, the model optimization method may include steps S200 to S208, where: Step S200, obtaining a target initial frame image and a target text prompt; Step S202, taking the target initial frame image and the target text prompt as model inputs, and outputting a plurality of training videos through a preset video generation model; Step S204, scoring the plurality of training videos to obtain a reward score corresponding to each training video; Step S206, determining the reward score gap between the highest reward score and the lowest reward score according to the reward score corresponding to each training video; Step S208, adjusting the preset video generation model according to the reward score gap to obtain a target video generation model.
[0048] The model optimization method provided in this embodiment determines the maximum reward score gap of a set of training videos generated based on the same target initial frame image and target text prompt, and uses the reward score gap as the basis for adjusting the preset video generation model. Using the reward score gap to guide model optimization can increase the impact of training videos with a large reward score gap on the model optimization process, thereby improving the speed and effect of the model optimization process, and further improving the quality of videos generated by the optimized target video generation model.
[0049] The following will elaborate on each step in steps S200 to S208 and optional other steps in combination with Figure 2 , respectively.
[0050] Step S200 , obtain the target initial frame image and the target text prompt.
[0051] In some embodiments, the target initial frame image can be a specific frame extracted from a real video (such as an anime video), for example, the third frame of an anime video, etc. In other embodiments, the target initial frame image can also be uploaded by the user or selected from a pre-configured image library. Before subsequent processing, the obtained target initial frame image can also be pre-processed (such as cropping, scaling, enhancing, etc.) to improve the quality.
[0052] In some embodiments, the target text prompt can be a natural language description input by the user, including a character description, action description, or scene description of the target initial frame image, etc. In other embodiments, it can also be a scene description extracted from the target initial frame image through a vision-language model. It is also possible to extract subtitles, dialogues, video descriptions, etc. from the anime video, etc. used to obtain the target initial frame image through a vision-language model, etc., to generate the target text prompt.
[0053] As mentioned above, the target initial frame image and the target text prompt can be obtained through various methods. The following provides the specific process of an exemplary acquisition method.
[0054] In an optional embodiment, as Figure 3 shown, step S200 includes: S300, obtain the video to be extracted.
[0055] S302, obtain the target initial frame image according to the video to be extracted.
[0056] S304, use the video to be extracted as the model input, and output the target text prompt through a pre-trained vision-language model.
[0057] The video to be extracted can be a locally stored video uploaded by the user, or an online video obtained from an authorized video website, etc. After obtaining the video to be extracted, preprocessing can be performed on the video, such as denoising, enhancing contrast, adjusting resolution, etc. Video segmentation technology can also be used to split a long video into multiple short video segments. In some embodiments, the video to be extracted can also carry action tags, which can be summarized from various common actions through human annotation, and each action tag corresponds to a certain number (such as 30 - 50) of videos to be extracted.
[0058] The obtained target initial frame image can be a specific frame (such as the third frame or the fifth frame, etc.) of the video to be extracted, or a representative frame automatically selected based on key frame detection algorithms (such as motion detection, saliency detection, etc.). When selecting the target initial frame image, quality assessment of the image can also be performed, such as clarity, brightness, contrast, etc., or a machine learning model can be used to score the frame.
[0059] In some embodiments, the visual language model can be used to recognize the images of the video to be extracted to generate a description of the images of the video to be extracted as the target text prompt. In other embodiments, multi-modal information such as the audio and subtitles of the video to be extracted can also be combined to generate the target text prompt. After the visual language model outputs the target text prompt, the generated target text prompt can be optimized, such as grammar checking, keyword extraction, semantic enhancement, etc., or human feedback can be used to fine-tune the text prompt to ensure that it conforms to human expression habits.
[0060] In this embodiment, the target initial frame image and the target text prompt are obtained from a real and complete video. This can improve the quality of the obtained target initial frame image and target text prompt, as well as the relevance between the target initial frame image and the target text prompt, thereby improving the quality of the training videos generated subsequently based on the target initial frame image and the target text prompt.
[0061] Step S202 , using the target initial frame image and the target text prompt as model inputs, and outputting multiple training videos through a preset video generation model.
[0062] Before inputting the target initial frame image and the target text prompt, preprocessing can be performed on the target initial frame image and the target text prompt, such as normalization, feature extraction, or data augmentation.
[0063] The preset video generation model can be a diffusion model, a generative adversarial network (GAN), or other generative models. In some embodiments, a diffusion model can be used as the preset video generation model, and diverse training videos can be generated by adjusting the sampling steps or injecting different noises. In other embodiments, the computational complexity can also be reduced through model pruning to improve the generation efficiency, or the generation process of training videos can be accelerated through parallel computing.
[0064] Use the preset video generation model to generate multiple training videos based on the target initial frame image and the target text prompt. The generated multiple training videos have different video qualities. Based on these training videos with different video qualities, the adjustment of the preset video generation model can be guided so that the adjusted preset video generation model can generate videos with higher quality.
[0065] Step S204 , score the multiple training videos to obtain the reward score corresponding to each training video.
[0066] The training videos can be scored from multiple scoring dimensions. In some embodiments, the visual appearance of the training videos can be scored, such as the visual fluency of the training videos (whether the actions are coherent, whether the visual dynamics are natural, whether there are motion distortions or artifacts, etc., VS), visual motion (dynamic amplitude, whether the actions meet the expectations, VM), or visual attractiveness (the aesthetic quality of the video, etc., VA), etc.
[0067] In other embodiments, the visual consistency of the training videos can also be scored, such as the text-video consistency of the training videos (i.e., whether the training video is consistent with the target prompt text, TC), image-video consistency (i.e., whether the training video is consistent with the target initial frame image, IC), or character consistency (i.e., whether the characters in the training video are consistent with the characters described in the target initial frame and the target prompt text, CC), etc.
[0068] In other embodiments, the semantic consistency, temporal coherence, dynamic degree, etc. of the training videos can also be scored.
[0069] In some embodiments, the multiple scoring dimensions of the training videos can be scored simultaneously through the same vision-language model to obtain the reward score. In other embodiments, different vision-language models can also be used to score different scoring dimensions of the video, and then the scores of different scoring dimensions are regressed to obtain the reward score of the training video.
[0070] In this embodiment, the reward scores of the generated training videos are obtained through scoring. The reward scores can quantitatively reflect the video quality of the training videos, thereby more precisely guiding the adjustment direction of the initial video generation model.
[0071] As mentioned above, there are multiple options for the method of scoring training videos. An exemplary scoring method is provided below.
[0072] In an alternative embodiment, the multiple training videos include a target training video. As Figure 4 shown, step S204 includes: S400, obtain multiple preset scoring items, where one preset scoring item corresponds to one video scoring model.
[0073] S402, score the target training video through the multiple video scoring models to obtain multiple item scores corresponding to the target training video, where one preset scoring item corresponds to one item score.
[0074] S404, determine the reward score corresponding to the target training video according to the multiple item scores and a preset weight array.
[0075] The multiple preset scoring items can correspond to different dimensions. At the same time, different video scoring models can adopt the same or different model structures, such as based on convolutional neural network (CNN), Transformer, or vision-language model (VLM), and are trained using corresponding datasets and training methods according to specific preset scoring items.
[0076] For example, for the visual motion scoring item, a motion scoring model can be trained using a model of a video action recognition framework based on multi-modal learning to evaluate the main motion amplitude in the training video. Another example is that for the visual attraction scoring item, a key frame extraction method can be used to extract key frames from the video, and the extracted key frames can be used to train a regression model to learn the aesthetic standards of humans to evaluate the visual attraction of the training video.
[0077] In some embodiments, the preset weight array can be a fixed weight array, such as the weights of each item score being the same, etc. In other embodiments, the weight array can also be dynamically adjusted according to the specific use or specific task requirements of the preset video generation model. The weight array can also be automatically learned through machine learning methods (such as reinforcement learning) for different task requirements and video features. For example, for videos mainly featuring character actions, the weight of the motion-related scoring item can be increased; for videos mainly featuring scene rendering, the weight of the visual effect-related scoring item can be increased.
[0078] Adopting different video scoring models for different preset scoring items and integrating the scoring results of each video scoring model to obtain the reward score of the training video. Using dedicated video scoring models to score the training video from different dimensions can improve the accuracy and multi-dimensionality of the reward score, and thus can improve the comprehensiveness and scientificity of the scoring process.
[0079] As described above, there can be multiple types of preset scoring items used in the video scoring process. The following introduces an exemplary classification of preset scoring items.
[0080] In an alternative embodiment, the multiple preset scoring items include an appearance type scoring item and a consistency type scoring item. Step S404 includes: Obtain a first item score corresponding to the appearance type scoring item and a second item score corresponding to the consistency type scoring item; Determine the reward score according to the first item score, the second item score, and the preset weight array.
[0081] In some embodiments, the appearance type can be a visual appearance type, and the appearance type scoring item can include the visual smoothness, visual motion, and visual attractiveness of the target training video. In other embodiments, the appearance type scoring item can also include the visual creativity, color matching, or prop lighting combination of the target training video, etc.
[0082] In some embodiments, the consistency type can be a visual consistency type, and the visual consistency type scoring item can include text-video consistency, image-video consistency, and character consistency of the target training video. In other embodiments, the consistency type scoring item can also include temporal consistency, object integrity, or video style consistency of the target training video, etc.
[0083] In this embodiment, scoring the target training video from two aspects of the appearance and consistency of the training video can enable the reward score to more comprehensively and accurately reflect the quality of the target training video, so that the video generated by the optimized target video generation model is both beautiful and coherent.
[0084] As mentioned above, the video scoring model can be trained using a corresponding training method according to specific preset scoring items. The following provides a specific training method.
[0085] In an alternative embodiment, the multiple preset scoring items include target preset scoring items, and the target preset scoring items correspond to a target video scoring model. As Figure 5 shown, the target video scoring model is obtained through the following operations: S500, obtain a plurality of guiding frame images and a plurality of guiding texts, where one guiding frame image corresponds to one guiding text.
[0086] S502. Generate multiple sets of scored training videos through the preset video generation model according to the multiple guiding frame images and the multiple guiding texts. Among them, one guiding frame image corresponds to one set of scored training videos. The number of videos in each set of scored training videos is multiple, and each scored training video is labeled with an artificial annotation result.
[0087] S504. Obtain multiple labeled training samples according to the multiple guiding frame images, the multiple guiding texts, and the multiple sets of labeled scored training videos.
[0088] S506. Perform multiple rounds of training on the initial video scoring model according to the multiple labeled training samples to obtain the target video scoring model.
[0089] For the acquisition methods of the guiding frame images and the guiding texts, reference can be made to the acquisition methods of the "target initial frame image" and the "target text prompt" introduced above, which will not be elaborated here.
[0090] In some embodiments, in addition to the videos generated according to the guiding frame images and the guiding texts, the scored training videos may further include multiple real videos, such as anime videos, etc.
[0091] In some embodiments, the number of videos in each set of scored training videos may be fixed, such as 4, 6, etc. In other embodiments, the number of videos in each set of scored training videos may also be dynamically adjusted according to the scoring difficulty of the target preset scoring items or specific requirements. The generated scored training videos can also be evaluated for diversity to ensure coverage of different visual features and motion patterns.
[0092] In some embodiments, when manually annotating the scored training videos, multiple human annotators can be used to evaluate the same scored training video to cross-validate the annotation results. In other embodiments, an annotation consistency analysis tool can also be used to automatically detect and correct inconsistent annotations.
[0093] The number of training rounds can be fixed or determined dynamically according to the training effect. After the training is completed, multiple test samples can also be used to test the target video scoring model, and whether to continue training can be determined according to the test results. In some embodiments, the test samples can be obtained in the same way as the labeled training samples and do not overlap with the labeled training samples used for training.
[0094] In this embodiment, training with manually annotated scoring training videos can enable the target video scoring model to more accurately obtain human preferences related to the videos. In this way, the target video scoring model can accurately evaluate the quality of the training videos and obtain reward scores consistent with human preferences. Further, the alignment degree between the adjusted target video generation model and human preferences can be improved, such that the videos generated by the target video generation model are more in line with human preferences.
[0095] In specific implementation, there can be multiple types of target preset scoring items, such as appearance type and consistency type. For different types of target preset scoring items, different training methods can be used to train the corresponding target video scoring models. Two exemplary training methods are provided below.
[0096] Method 1: As Figure 6 shown, in each round of training: S600, when the target preset scoring item is of the appearance type, score multiple scoring training videos through the current video scoring model to obtain multiple appearance scoring results, where one scoring training video corresponds to one appearance scoring result; wherein, the current video scoring model is the video scoring model obtained after the previous round of training.
[0097] S602, adjust the current video scoring model according to the appearance scoring result and the manually annotated result corresponding to each scoring training video, so as to obtain the video scoring model after this round of training.
[0098] In some embodiments, multi-scale analysis can be performed on the scoring training videos, and scoring can be performed from different levels (such as local features, global features, time series features, etc.). For example, the single-frame images, consecutive-frame images, and the entire video sequence of the scoring training videos can be scored respectively, and then the appearance scoring result can be obtained by integrating these scoring results.
[0099] In some embodiments, when adjusting the current video scoring model, an adaptive learning rate adjustment strategy (such as adaptive optimization algorithms like Adam, RMSprop, etc.) can be adopted, and the learning rate can be dynamically adjusted according to the training progress of the target video scoring model and the magnitude of the scoring error.
[0100] In other embodiments, a regularization term, such as L1 regularization, L2 regularization, or elastic net regularization, can also be added during the adjustment process of the target video scoring model to prevent the model from overfitting and improve the generalization ability of the target video scoring model.
[0101] In this embodiment, by using the difference between the appearance scoring results and the manual annotation results of the scoring training videos, the adjustment direction of the current video scoring model can be guided. After adjustment, the appearance scoring results obtained by the video scoring model can be made more aligned with the manual annotation results, and further, the appearance scoring results of the target video scoring model for the training videos can be made more in line with human preferences, thereby improving the scoring quality of the target video scoring model.
[0102] Method 2: As Figure 7 shown, in each round of training: S700, when the target preset scoring item is of the consistency type, based on multiple scoring training videos, the guiding frame images, and / or the guiding texts, score the multiple scoring training videos through the current video scoring model to obtain multiple consistency scoring results, where one scoring training video corresponds to one consistency scoring result; wherein, the current video scoring model is the video scoring model obtained after the previous round of training.
[0103] S702, adjust the current video scoring model according to the consistency scoring result and the manual annotation result corresponding to each scoring training video to obtain the video scoring model after this round of training.
[0104] In some embodiments, the scoring training videos, the guiding frame images, and the guiding texts can be used as model inputs at the same time, and the scoring training videos are scored through the current video scoring model. In other embodiments, different combinations of model inputs can also be selected according to the specific items of the target preset scoring item, and the corresponding scoring result calculation methods can be selected.
[0105] For example, when the target preset scoring item is the text-video consistency scoring item in the consistency type, the scoring training video and the guiding text can be used as model inputs, and the feature consistency between the scoring training video and the guiding text is used as the consistency scoring result of this scoring. For another example, when the target preset scoring item is the image-video consistency scoring item in the consistency type, the scoring training video and the guiding frame images can be used as model inputs, and the feature consistency between the scoring training video and the guiding frame images is used as the consistency scoring result of this scoring.
[0106] It should be noted that the implementation details of the video scoring model and the training steps in Method 2 can refer to Method 1 and will not be elaborated here.
[0107] In this embodiment, by combining the characteristics of the guiding frame image and the guiding text to obtain the consistency scoring result of the scoring training video, the performance of the scoring training video in video generation consistency can be judged more accurately. At the same time, by comparing with the manual annotation result and adjusting the video scoring model according to the comparison result, the target video scoring model can make a judgment on video generation consistency more in line with human preferences, thereby improving the scoring accuracy of the training video, and further improving the optimization effect of the target video generation model.
[0108] As described above, different scoring result calculation methods can be selected according to different target preset scoring items. The following provides an exemplary situation.
[0109] In an alternative embodiment, the preset scoring item of the consistency type includes a character consistency scoring item, the consistency scoring result includes a character consistency scoring result, and the multiple scoring training videos include a target scoring training video. As Figure 8 shown, step S700 includes: S800, determining a plurality of target characters according to the guiding frame image.
[0110] S802, for each of the target characters, extracting a plurality of target character mask images from the target scoring training video.
[0111] S804, according to the plurality of target character mask images, extracting a plurality of image features corresponding to each target character through a preset character encoder, and one target character mask image corresponds to one image feature.
[0112] S806, obtaining the character feature corresponding to each target character according to the guiding text and the guiding frame image.
[0113] S808, determining a plurality of image consistency values corresponding to each target character according to the character feature and the plurality of image features corresponding to each target character, and one image feature corresponds to one image consistency value.
[0114] S810, determining a plurality of character consistency values according to the plurality of image consistency values respectively corresponding to the plurality of target characters, and one target character corresponds to a plurality of image consistency values and one character consistency value.
[0115] S812, determining the character consistency scoring result corresponding to the target scoring training video according to the plurality of character consistency values.
[0116] In some embodiments, multimodal features can be used, such as combining color histograms, texture features, and shape features for character detection to determine the target character, and using tools like GroundingDINO, SAM, and tracking tools to extract the target character mask image.
[0117] In other embodiments, a dynamic character detection algorithm (such as a tracking-based detection method) can also be used to determine the target character, and a segmentation model like VideoSAM or Mask2Former can be used to extract the target character mask image.
[0118] After the target character mask image is extracted, it can be optimized through operations such as morphological operations or GAN-based mask optimization to improve the accuracy and integrity of the target character mask image.
[0119] In some embodiments, the character feature can be the visual feature of the pre-stored target character, and this visual feature can be associated with the name of the target character, etc. For example, if the guiding text contains the keyword "Doraemon", the character feature can be the pre-stored visual feature of the target character "Doraemon" (such as blue and white, cat-shaped robot, etc.), and it can be stored in the form of a mask image.
[0120] In other embodiments, the character feature can also be the text feature and image feature of the target character extracted from the guiding text and the guiding frame image respectively through a text encoder and an image encoder, etc.
[0121] The image consistency value can be calculated by computing the cosine similarity value between the character feature and the image feature. An attention mechanism can also be introduced during the calculation process to automatically focus on the key parts of the character (such as the face, clothing, etc.) to improve the accuracy of the image consistency value.
[0122] In some embodiments, the same or different fixed weights can be pre-configured for the character consistency values of different target characters to calculate the character consistency score result. In other embodiments, methods such as machine learning can also be used to dynamically assign weights to different target characters by identifying and judging the importance of the target characters, etc., to calculate the character consistency score result.
[0123] In this embodiment, the character consistency score result of the video is obtained by tracking and calculating the feature change situation of different target characters in the entire target scoring training video. The method of tracking and calculating can improve the accuracy, comprehensiveness, and credibility of the character consistency score result, thereby improving the optimization effect on the target video generation model and helping to improve the quality of video generation.
[0124] In the specific implementation process, the preset role encoder can also be trained. The following provides an exemplary training method.
[0125] In an alternative embodiment, as Figure 9 shown, the method further includes: S900, determining a target video frame according to the target-scored training video.
[0126] S902, extracting a training role mask image corresponding to the training role according to the target video frame, where the training role is any one of the multiple target roles.
[0127] S904, extracting training role image features corresponding to the training role through the preset role encoder according to the training role mask image.
[0128] S906, obtaining a role description text corresponding to the training role.
[0129] S908, extracting training role text features corresponding to the training role through a preset text encoder according to the role description text.
[0130] S910, obtaining a role recognition loss value according to the training role text features and the training role image features.
[0131] S912, adjusting the preset role encoder according to the role recognition loss value.
[0132] The role description text can be extracted from the guiding text or input additionally. In some embodiments, the training role image features and the training role text features can be represented in the form of distributed feature vectors. In other embodiments, the training role image features and the training role text features can also be displayed visually through visualization techniques.
[0133] Multiple different role recognition loss values can be calculated through various loss functions such as ITM (Image-Text Matching, used to determine whether the generated role matches the text prompt), ITA (Image-Text Association, used to evaluate the relevance between the generated role and the text prompt), and the LM loss function (i.e., the language model loss function), and different adjustments can be made to the preset role encoder.
[0134] In this embodiment, adjusting the preset role encoder according to the role recognition loss value between the training role image features extracted by the preset role encoder and the training role text features extracted from the role description text can improve the fitting degree between the role features and the text features extracted by the preset role encoder, thereby improving the accuracy of the preset role encoder.
[0135] Step S206 , determine the reward score gap between the highest reward score and the lowest reward score according to the reward scores corresponding to each of the training videos.
[0136] In some embodiments, before calculating the reward score gap, the reward scores of all training videos can be normalized so that the reward scores are distributed within a predetermined range, such as [0, 1], etc. In other embodiments, a gain parameter can also be set for the reward score gap, such as a fixed value of 2, etc.
[0137] The reward score gap can also be visualized through visualization techniques, such as plotting a curve of the change of the reward score gap with the number of training rounds, so as to facilitate real-time monitoring of the training process and analysis of the convergence of the preset video generation model.
[0138] Calculating the difference between the highest reward score and the lowest reward score can more precisely quantify the video quality gap between the training videos, so as to more accurately and efficiently guide the subsequent adjustment of the preset video generation model to improve the optimization effect of the preset video generation model.
[0139] Step S208 , adjust the preset video generation model according to the reward score gap to obtain a target video generation model.
[0140] In some embodiments, the reward score gap can directly act as a weighted term, etc. in the DPO algorithm. In other embodiments, the learning rate can also be dynamically adjusted according to the reward score gap. For example, when the reward score gap is large, the learning rate can be appropriately increased to accelerate the convergence speed of the model; when the reward score gap is small, the learning rate can be appropriately decreased for more refined adjustment.
[0141] During the model adjustment process, a regularization term, such as L1 or L2 regularization, can also be introduced to prevent the target video generation model from overfitting.
[0142] When aligning a video generation model with human preferences, the models or algorithms used only focus on the probabilities of the video generation model generating "good videos" that match human preferences and "bad videos" that do not match human preferences. For example, for preference pairs A with reward scores of 90 and 20 (good video and bad video) and preference pair B with reward scores of 70 and 60, when the probabilities of the video generation model generating their respective good videos and bad videos are both 3:2, the two preference pairs will have the same degree of influence on the optimization process of the video generation model. However, the inventor has found that this simple dichotomy ignores the degree of difference between preference pairs, resulting in an inefficient model optimization process. The preference gap between preference pairs actually contains richer optimization information. Preference pairs with a larger preference gap represent stronger preference contrasts and should have a greater impact on the preference optimization process to make the video generation model more accurately aligned with human preferences. Preference pairs with a smaller preference gap represent weaker preference contrasts and should have a smaller impact on the preference optimization process to speed up the model optimization speed.
[0143] In view of this, in this embodiment, using the reward score gap as the basis for adjusting the preset video generation model can increase the influence of training video combinations with a larger reward score gap (i.e., "good video - bad video" pairs) on the model optimization process and reduce the influence of training video pairs with a smaller reward score gap on the model optimization process, thereby improving the effectiveness and efficiency of the model optimization process and enabling the target video generation model to better align with human preferences.
[0144] As mentioned above, the preset video generation model can be adjusted using the reward score gap in various ways. The following provides an exemplary adjustment method.
[0145] In an alternative embodiment, step S208 includes: Determine a gap preference optimization algorithm according to the reward score gap and a preset preference optimization algorithm; Adjust the preset video generation model according to the gap preference optimization algorithm to obtain the target video generation model.
[0146] In some embodiments, the preset preference optimization algorithm can be the DPO algorithm. In other embodiments, the preset preference optimization algorithm can also be other preference optimization algorithms specifically selected according to the usage scenario or task type of the target video generation model, such as IPO, KTO, etc.
[0147] In some embodiments, the reward score gap can be directly added as a weighting term to the preset preference optimization algorithm. In other embodiments, a weight can also be set for the reward score gap to adjust the influence of the reward score gap on model optimization as needed.
[0148] In this embodiment, the reward score gap is used as part of the gap preference optimization algorithm to adjust the preset video generation model. During the process of adjusting the preset video generation model, the gap preference optimization algorithm can adjust the influence degree of the preference pair on model optimization according to the reward score gap of the preference pair, so as to improve the alignment degree and optimization speed of model optimization.
[0149] The target video generation model obtained by using the model optimization method of the embodiments of the present application can generate videos of higher quality. Figures 15 - 17 The figure shows anime video pictures generated by the unmodified CogVideoX model (the first row), the CogVideoX model after supervised fine-tuning (SFT) (the second row), and the CogVideoX model optimized by the model optimization method of the present application (the third row) respectively. It can be clearly seen that the anime videos generated by the CogVideoX model optimized by the model optimization method of the embodiments of the present application do not have the problems of picture distortion or motion blur existing in the other two models, and the picture quality is higher and more in line with human preferences.
[0150] To make the present application easier to understand, the following provides an exemplary application in combination with Figure 10 、 11 、12. Wherein: S11, collect 5,000 original anime images (i.e., guiding frame pictures, InitialFrame) and their corresponding prompts (i.e., guiding texts, Prompt) from real anime videos; S12, use multiple models such as CogVideoX-5B (i.e., the preset video generation model) to generate 5 anime videos (i.e., scored training videos, Genetared Videos) for each original anime image-text pair; CogVideoX-5B is one of the I2VModel; S13, obtain the annotated videos (i.e., the annotated scored training videos, Annotated Data) after the artificial annotation and evaluation (Human Annotation) of the generated anime videos and the collected real anime videos; S14, use the annotated videos to perform multiple rounds of training on multiple vision-language models (i.e., the initial video scoring models, VLM). Among them, when the scoring item in the training is of the visual appearance type, step S14A is entered, and when the scoring item in the training is of the visual consistency type, step S14B is entered: S14A. Use the labeled videos obtained in S13 to train a partial vision-language model. Adjust this partial vision-language model according to the evaluation results of this partial vision-language model on the visual appearance (i.e., the target preset scoring item of the appearance type, Appearance) of the labeled videos and the manual annotation results. S14B. Use the labeled videos obtained in S13 to train another part of the vision-language model. Adjust this part of the vision-language model according to the evaluation results of this part of the vision-language model on the visual consistency (i.e., the target preset scoring item of the consistency type, Consistency) of the labeled videos and the manual annotation results. Among them, when evaluating the character consistency of the labeled video using the labeled video A: S14B1. Detect two characters (i.e., target characters) from the original anime images corresponding to the labeled video A through a character detection tool (CharacterDetector). S14B2. Extract multiple character mask images (i.e., target character mask images) corresponding to the two characters from the labeled video A through tools such as SAM2. S14B3. Extract the features of the characters (i.e., image features) from the corresponding character mask images through a character encoder (i.e., the preset character encoder, Character Encoder). S14B4. Compare the features of the characters extracted from the character mask images with the features of the corresponding characters (i.e., character features) extracted from the pre-saved character mask images (Gallery Masks) to obtain the character consistency results (i.e., image consistency values) of the two characters in each character mask image from the labeled video A. S14B5. Calculate the character consistency results (i.e., character consistency values) of the two characters in the labeled video A to be 0.9 and 0.8 respectively according to the character consistency results in each character mask image. S14B6. Take the average of the character consistency results of the two characters in the labeled video A to obtain the character consistency result (i.e., character consistency scoring result) of the labeled video A as 0.85. S15. Evaluate each of the 4 videos (i.e., training videos) generated by the CogVideoX-5B model according to 2000 newly collected image-text pairs (i.e., target initial frame images and target text prompts) through multiple vision-language models trained in the foregoing steps to obtain the reward scores of each anime video. S16. Use the preset gain parameter α = 2 to determine the video (v) with the highest reward score in each group of anime videos. w) and the video with the lowest reward score (v l ) the reward score gap between; S17. Using the reward score gap as a gap factor and combining it with the DPO formula, adjust the CogVideoX-5B model to obtain the optimized CogVideoX-5B model (i.e., the target video generation model).
[0151] Example Two Figure 13 Schematically shows a block diagram of a model optimization device according to Example Two of the present application. The device can be divided into one or more program modules. One or more program modules are stored in a storage medium and executed by one or more processors to complete the embodiments of the present application. The program modules referred to in the embodiments of the present application refer to a series of computer program instruction segments that can complete specific functions. The following description will specifically introduce the functions of each program module in this embodiment. As Figure 13 shown, the device 1000 may include: a first acquisition module 1100, an output module 1200, a second acquisition module 1300, a determination module 1400, an adjustment module 1500, where: The first acquisition module 1100 is configured to acquire a target initial frame image and a target text prompt; The output module 1200 is configured to use the target initial frame image and the target text prompt as model inputs and output multiple training videos through a preset video generation model; The second acquisition module 1300 is configured to score multiple training videos and obtain the reward score corresponding to each training video; The determination module 1400 is configured to determine the reward score gap between the highest reward score and the lowest reward score according to the reward score corresponding to each training video; The adjustment module 1500 is configured to adjust the preset video generation model according to the reward score gap to obtain a target video generation model.
[0152] As an optional embodiment, the first acquisition module 1100 is further configured to: Acquire a video to be extracted; According to the video to be extracted, acquire the target initial frame image; Use the video to be extracted as a model input and output the target text prompt through a pre-trained vision-language model.
[0153] As an optional embodiment, the multiple training videos include a target training video. The second acquisition module 1300 is further configured to: Acquire multiple preset scoring items, and one preset scoring item corresponds to one video scoring model; Score the target training video through multiple of the video scoring models to obtain multiple item scores corresponding to the target training video, where one of the preset scoring items corresponds to one of the item scores; Determine the reward score corresponding to the target training video according to the multiple item scores and a preset weight array.
[0154] As an optional embodiment, multiple of the preset scoring items include a target preset scoring item, and the target preset scoring item corresponds to a target video scoring model. The apparatus 1000 further includes a target video scoring model training module, configured to: Obtain multiple guiding frame images and multiple guiding texts, where one of the guiding frame images corresponds to one of the guiding texts; Generate multiple sets of scoring training videos through the preset video generation model according to the multiple guiding frame images and the multiple guiding texts; where one of the guiding frame images corresponds to one set of the scoring training videos, the number of videos in each set of the scoring training videos is multiple, and each of the scoring training videos is labeled with an artificial annotation result; Obtain multiple labeled training samples according to the multiple guiding frame images, the multiple guiding texts, and the multiple sets of labeled scoring training videos; Perform multiple rounds of training on the initial video scoring model according to the multiple labeled training samples to obtain the target video scoring model.
[0155] As an optional embodiment, the scoring item type of the target preset scoring item includes an appearance type and a consistency type. The target video scoring model training module is further configured to, in each round of training: In the case where the target preset scoring item is of the appearance type, score the multiple scoring training videos through the current video scoring model to obtain multiple appearance scoring results, where one of the scoring training videos corresponds to one of the appearance scoring results; where the current video scoring model is the video scoring model obtained after the previous round of training; Adjust the current video scoring model according to the appearance scoring result and the artificial annotation result corresponding to each scoring training video to obtain the video scoring model after this round of training.
[0156] As an optional embodiment, the scoring item type of the target preset scoring item includes an appearance type and a consistency type. The target video scoring model training module is further configured to, in each round of training: When the target preset scoring item is of the consistency type, based on the multiple scoring training videos, the guiding frame image, and the guiding text, use the current video scoring model to score the multiple scoring training videos to obtain multiple consistency scoring results, where one scoring training video corresponds to one consistency scoring result; wherein, the current video scoring model is the video scoring model obtained after the previous round of training; Adjust the current video scoring model according to the consistency scoring result corresponding to each scoring training video and the manual annotation result to obtain the video scoring model after this round of training.
[0157] As an optional embodiment, the preset scoring item of the consistency type includes a character consistency scoring item, the consistency scoring result includes a character consistency scoring result, the multiple scoring training videos include a target scoring training video, and the target video scoring model training module is further configured to: Determine multiple target characters according to the guiding frame image; For each target character, extract multiple target character mask images from the target scoring training video; According to the multiple target character mask images, use a preset character encoder to extract multiple image features corresponding to each target character, where one target character mask image corresponds to one image feature; Obtain the character feature corresponding to each target character according to the guiding text and the guiding frame image; According to the character feature corresponding to each target character and the multiple image features, determine multiple image consistency values corresponding to each target character, where one image feature corresponds to one image consistency value; According to the multiple image consistency values respectively corresponding to the multiple target characters, determine multiple character consistency values, where one target character corresponds to multiple image consistency values and one character consistency value; Determine the character consistency scoring result corresponding to the target scoring training video according to the multiple character consistency values.
[0158] As an optional embodiment, the apparatus 1000 further includes a preset character encoder training module, configured to: Determine a target video image according to the target scoring training video; According to the target video image, extract a training character mask image corresponding to the training character, where the training character is any one of the multiple target characters; According to the training character mask image, use the preset character encoder to extract the training character image feature corresponding to the training character; Obtain the character description text corresponding to the training character; According to the character description text, extract the training character text features corresponding to the training character through a preset text encoder; Obtain a character recognition loss value according to the training character text features and the training character image features; Adjust the preset character encoder according to the character recognition loss value.
[0159] Embodiment III Figure 14 Schematically shows a hardware architecture diagram of a computer device 10000 suitable for implementing the model optimization method according to Embodiment III of the present application. In some embodiments, the computer device 10000 may be a terminal device such as a smart phone, a wearable device, a tablet computer, a personal computer, a vehicle-mounted terminal, a game console, a virtual device, a workbench, a digital assistant, a set-top box, a robot, etc. In other embodiments, the computer device 10000 may be a rack-mounted server, a blade server, a tower server, or a cabinet server (including an independent server or a server cluster composed of multiple servers), etc. As Figure 14 shown, the computer device 10000 includes, but is not limited to: a memory 10010, a processor 10020, and a network interface 10030 that can be communicatively linked to each other through a system bus. Among them: The memory 10010 includes at least one type of computer-readable storage medium. The readable storage medium includes flash memory, a hard disk, a multimedia card, a card-type memory (such as an SD or DX memory), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 10010 may be an internal storage module of the computer device 10000, such as the hard disk or memory of the computer device 10000. In other embodiments, the memory 10010 may also be an external storage device of the computer device 10000, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc., equipped on the computer device 10000. Of course, the memory 10010 may also include both the internal storage module of the computer device 10000 and its external storage device. In this embodiment, the memory 10010 is generally used to store the operating system and various application software installed on the computer device 10000, such as the program code of the model optimization method. In addition, the memory 10010 may also be used to temporarily store various data that have been output or will be output.
[0160] In some embodiments, the processor 10020 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other chips. The processor 10020 is generally used to control the overall operation of the computer device 10000, such as performing control and processing related to data interaction or communication with the computer device 10000. In this embodiment, the processor 10020 is used to run the program code stored in the memory 10010 or process data.
[0161] The network interface 10030 may include a wireless network interface or a wired network interface, and the network interface 10030 is generally used to establish a communication link between the computer device 10000 and other computer devices. For example, the network interface 10030 is used to connect the computer device 10000 to an external terminal through a network, and establish a data transmission channel and a communication link between the computer device 10000 and the external terminal. The network may be an enterprise intranet (Intranet), the Internet, the Global System of Mobile communication (GSM for short), Wideband Code Division Multiple Access (WCDMA for short), 4G network, 5G network, Bluetooth, Wi-Fi and other wireless or wired networks.
[0162] It should be noted that Figure 14 Only the computer device with components 10010 - 10030 is shown, but it should be understood that it is not required to implement all the shown components, and more or fewer components may be alternatively implemented.
[0163] In this embodiment, the model optimization method stored in the memory 10010 may also be divided into one or more program modules and executed by one or more processors (such as the processor 10020) to complete the embodiments of the present application.
[0164] Embodiment 4 The embodiments of the present application further provide a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the model optimization method in the embodiments are implemented.
[0165] In this embodiment, the computer-readable storage medium includes flash memory, hard disks, multimedia cards, card-type memories (e.g., SD or DX memories, etc.), random access memories (RAM), static random access memories (SRAM), read-only memories (ROM), electrically erasable programmable read-only memories (EEPROM), programmable read-only memories (PROM), magnetic memories, magnetic disks, optical discs, etc. In some embodiments, the computer-readable storage medium may be an internal storage unit of a computer device, such as the hard disk or memory of the computer device. In other embodiments, the computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc., equipped on the computer device. Of course, the computer-readable storage medium may also include both the internal storage unit and the external storage device of the computer device. In this embodiment, the computer-readable storage medium is generally used to store the operating system installed on the computer device and various application software, such as the program code of the model optimization method in the embodiment. In addition, the computer-readable storage medium may also be used to temporarily store various data that have been output or will be output.
[0166] Embodiment 5 The embodiment of the present application further provides a computer program product, including a computer program, which implements the method in the above embodiment when executed by a processor.
[0167] Obviously, those skilled in the art should understand that the above-mentioned modules or steps of the embodiments of the present application can be implemented by a general computer device. They can be concentrated on a single computer device or distributed on a network composed of multiple computer devices. Optionally, they can be implemented by program codes executable by the computer device. Thus, they can be stored in a storage device and executed by the computer device. And in some cases, the steps shown or described can be executed in a different order from here, or they can be separately fabricated into individual integrated circuit modules, or multiple modules or steps among them can be fabricated into a single integrated circuit module to implement. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.
[0168] It should be noted that the above are only the preferred embodiments of the present application, and do not limit the patent protection scope of the present application. Any equivalent structure or equivalent process transformation made by using the content of the specification and drawings of the present application, or directly or indirectly applied in other related technical fields, shall be equally included in the patent protection scope of the present application.
Claims
1. A model optimization method, characterized in that, The method includes: Obtaining a target initial frame image and a target text prompt; Using the target initial frame image and the target text prompt as model inputs, and outputting multiple training videos through a preset video generation model; Scoring the multiple training videos to obtain a reward score corresponding to each training video; Determining the reward score gap between the highest reward score and the lowest reward score according to the reward score corresponding to each training video; Adjusting the preset video generation model according to the reward score gap to obtain a target video generation model.
2. The method according to claim 1, wherein Obtaining a target initial frame image and a target text prompt includes: Obtaining a video to be extracted; Obtaining the target initial frame image according to the video to be extracted; Using the video to be extracted as a model input, and outputting the target text prompt through a pre-trained vision-language model.
3. The method according to claim 1, wherein The multiple training videos include a target training video; Scoring the multiple training videos to obtain a reward score corresponding to each training video includes: Obtaining multiple preset scoring items, where one preset scoring item corresponds to one video scoring model; Scoring the target training video through the multiple video scoring models to obtain multiple item scores corresponding to the target training video, where one preset scoring item corresponds to one item score; Determining the reward score corresponding to the target training video according to the multiple item scores and a preset weight array.
4. The method according to claim 3, wherein The multiple preset scoring items include an appearance type scoring item and a consistency type scoring item; determining the reward score corresponding to the target training video according to the multiple item scores and a preset weight array includes: Obtaining a first item score corresponding to the appearance type scoring item and a second item score corresponding to the consistency type scoring item; Determining the reward score according to the first item score, the second item score, and the preset weight array.
5. The method according to claim 3, characterized in that, The multiple preset scoring items include a target preset scoring item, and the target preset scoring item corresponds to a target video scoring model; the target video scoring model is obtained through the following operations: Obtaining multiple guiding frame images and multiple guiding texts, where one guiding frame image corresponds to one guiding text; Generating multiple groups of scoring training videos through the preset video generation model according to the multiple guiding frame images and the multiple guiding texts; where one guiding frame image corresponds to one group of scoring training videos, the number of videos in each group of scoring training videos is multiple, and each scoring training video is labeled with an artificial labeling result; Obtaining multiple labeled training samples according to the multiple guiding frame images, the multiple guiding texts, and the multiple groups of labeled scoring training videos; Performing multiple rounds of training on an initial video scoring model according to the multiple labeled training samples to obtain the target video scoring model.
6. The method according to claim 5, characterized in that, The scoring item type of the target preset scoring item includes an appearance type and a consistency type; In each round of training: When the target preset scoring item is of the appearance type, score multiple scoring training videos through the current video scoring model to obtain multiple appearance scoring results, where one scoring training video corresponds to one appearance scoring result; wherein, the current video scoring model is the video scoring model obtained after the previous round of training; Adjust the current video scoring model according to the appearance scoring result and the manual annotation result corresponding to each scoring training video to obtain the video scoring model after this round of training.
7. The method according to claim 5, characterized in that, The scoring item types of the target preset scoring item include appearance type and consistency type; In each round of training: When the target preset scoring item is of the consistency type, score multiple scoring training videos through the current video scoring model according to multiple scoring training videos, the guiding frame picture, and / or the guiding text to obtain multiple consistency scoring results, where one scoring training video corresponds to one consistency scoring result; wherein, the current video scoring model is the video scoring model obtained after the previous round of training; Adjust the current video scoring model according to the consistency scoring result and the manual annotation result corresponding to each scoring training video to obtain the video scoring model after this round of training.
8. The method according to claim 7, wherein The preset scoring item of the consistency type includes a character consistency scoring item, the consistency scoring result includes a character consistency scoring result, and multiple scoring training videos include a target scoring training video; score multiple scoring training videos through the current video scoring model according to multiple scoring training videos, the guiding frame picture, and / or the guiding text to obtain multiple consistency scoring results, including: Determine multiple target characters according to the guiding frame picture; For each target character, extract multiple target character mask pictures from the target scoring training video; According to multiple target character mask pictures, extract multiple picture features corresponding to each target character through a preset character encoder, where one target character mask picture corresponds to one picture feature; Obtain the character feature corresponding to each target character according to the guiding text and the guiding frame picture; Determine multiple picture consistency values corresponding to each target character according to the character feature and multiple picture features corresponding to each target character, where one picture feature corresponds to one picture consistency value; Determine multiple character consistency values according to multiple picture consistency values respectively corresponding to multiple target characters, where one target character corresponds to multiple picture consistency values and one character consistency value; Determine the character consistency scoring result corresponding to the target scoring training video according to multiple character consistency values.
9. The method according to claim 7, wherein The method further includes: Determine a target video picture according to the target scoring training video; Extract a training character mask picture corresponding to the training character according to the target video picture, where the training character is any one of multiple target characters; According to the training role mask picture, extract the training role picture features corresponding to the training role through the preset role encoder; Obtain the role description text corresponding to the training role; According to the role description text, extract the training role text features corresponding to the training role through a preset text encoder; According to the training role text features and the training role picture features, obtain the role recognition loss value; According to the role recognition loss value, adjust the preset role encoder.
10. The method according to claim 1, characterized in that, According to the reward score gap, adjust the preset video generation model to obtain a target video generation model, including: According to the reward score gap and a preset preference optimization algorithm, determine a gap preference optimization algorithm; According to the gap preference optimization algorithm, adjust the preset video generation model to obtain the target video generation model.
11. A model optimization device, characterized in that, The device includes: A first acquisition module, configured to acquire a target initial frame picture and a target text prompt; An output module, configured to use the target initial frame picture and the target text prompt as model inputs, and output multiple training videos through a preset video generation model; A second acquisition module, configured to score the multiple training videos and obtain the reward score corresponding to each training video; A determination module, configured to determine the reward score gap between the highest reward score and the lowest reward score according to the reward score corresponding to each training video; An adjustment module, configured to adjust the preset video generation model according to the reward score gap to obtain a target video generation model.
12. A computer device, characterized in that, Includes: At least one processor; And A memory communicatively connected to the at least one processor; wherein: The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method according to any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method according to any one of claims 1 to 10 is implemented.
14. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.
Citation Information
Patent Citations
Video generation method, electronic equipment and computer readable storage medium
CN117668297A
Video generation method, motion video generation method of virtual object, video editing method, video generation model training method and information processing method based on video generation model
CN119031208A
Multi-dimensional generative framework for video generation
US20240193412A1
Cited By
Model training method, video generation method, electronic equipment and storage medium
CN120953453A
Model training method, video generation method, electronic device, and storage medium
CN120953453B
Video generation method and device for picture story, medium and computer program product
CN121099083A