Video synthesis method and device based on classification model, storage medium and program product
Through the video synthesis method based on the classification model, the problem of low correlation between the avatar and the spoken content is solved. By matching candidate actions and time periods with text and audio, the correlation between the avatar and the spoken content is improved, and the expressiveness of the video is enhanced. .
Patent Information
- Application Number
- CN202410733022.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-06
- Publication Date
- 2024-10-11
AI Technical Summary
Existing avatars have low correlation with spoken content in videos and cannot effectively match multiple trigger words and actions, resulting in random or conditional action selection.
Using a video synthesis method based on the classification model, the text and audio to be recognized are obtained, input into the target classification model to output candidate actions, and the time period is determined based on the candidate actions, and the action video and the video to be processed are synthesized to improve the avatar and speech Content relevance.
It improves the correlation between the virtual image and the spoken content in the video, ensures that the actions match the semantic content, and enhances the expressiveness and authenticity of the video.
Smart Images

Figure CN118764575A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of artificial intelligence, and in particular to a video synthesis method, device, storage medium and program product based on a classification model. Background Art
[0002] In recent years, with the development of artificial intelligence, virtual images have been widely used in various fields. When existing virtual images speak, they generally use algorithms that trigger head movements based on keywords, but they are all one-to-one action triggers. When there are multiple trigger words and multiple groups of actions, they can only be judged by various conditions or randomly selected, so they cannot be related to the semantic content, which leads to the problem of low correlation between virtual images and spoken content in videos. Summary of the invention
[0003] The embodiments of the present application provide a video synthesis method, device, storage medium and program product based on a classification model to solve the problem in the prior art that the virtual image in the video has a low correlation with the speech content.
[0004] To solve the above problems, this application is implemented as follows:
[0005] In a first aspect, an embodiment of the present application provides a video synthesis method based on a classification model, the method comprising:
[0006] Acquire a text to be recognized and an audio to be recognized, wherein the audio to be recognized corresponds to the text to be recognized;
[0007] Inputting the text to be recognized and the audio to be recognized into a target classification model, and outputting at least one candidate action, where the candidate action is a head action of the virtual image;
[0008] Determine at least one time period according to the at least one candidate action, the at least one time period being a time period in which the at least one candidate action is inserted into a video to be processed, the video to be processed including the virtual image;
[0009] Based on the at least one time period, at least one action video corresponding to the at least one candidate action is synthesized with the video to be processed to obtain a target video.
[0010] Optionally, the step of inputting the to-be-recognized text and the to-be-recognized audio into a target classification model and outputting at least one candidate action includes:
[0011] Segmenting the text to be recognized to obtain a plurality of first segmented words;
[0012] Combining the plurality of first participles according to a preset rule to generate a plurality of first short sentences, each of the first short sentences including at least two of the first participles;
[0013] Convert the plurality of first word segments into a plurality of third vectors, and convert the plurality of first short sentences into a plurality of fourth vectors;
[0014] The multiple third vectors, the multiple fourth vectors and the audio to be recognized are input into the target classification model for similarity matching, and at least one candidate action is output.
[0015] Optionally, determining at least one time period according to the at least one candidate action includes:
[0016] generating a plurality of action paths according to the plurality of first participles, the plurality of first short sentences and the at least one candidate action, wherein the action paths are used to represent connection relationships between different candidate actions;
[0017] Calculating the confidences of the multiple action paths respectively to obtain multiple confidence scores, wherein the multiple confidence scores correspond to the multiple action paths one by one;
[0018] Screening the at least one candidate action according to a target action path to determine at least one target candidate action, wherein the target action path is an action path with the highest confidence score among the multiple action paths;
[0019] At least one target time period is determined according to the at least one target candidate action, where the target time period is a time period in the at least one time period corresponding to the target candidate action.
[0020] Optionally, synthesizing at least one action video corresponding to the at least one candidate action with the video to be processed based on the at least one time period to obtain a target video includes:
[0021] Determine a basic action according to the video to be processed, where the basic action is an action of the virtual image in the video to be processed;
[0022] Determine, according to the at least one candidate action, at least one action video matching the at least one candidate action;
[0023] Based on the at least one target time period, the at least one action video is synthesized with the action video corresponding to the basic action to obtain the target video.
[0024] Optionally, before inputting the to-be-recognized text and the to-be-recognized audio into the target classification model and outputting at least one candidate action, the method further includes:
[0025] Generate a training data set, the training data set including a training text, first audio data corresponding to the training text, and first image data corresponding to the training text;
[0026] Annotating the first image data to obtain at least one action label, where the at least one action label corresponds to a plurality of candidate actions;
[0027] The classification model is trained using the training data set and the at least one action label to obtain a target classification model, wherein the target classification model is used to match at least one candidate action to input target data, wherein the target data includes text and audio.
[0028] Optionally, generating a training data set includes:
[0029] Acquire data information, wherein the data information includes a target text, second audio data corresponding to the target text, and second image data corresponding to the target text;
[0030] Performing word segmentation processing on the plurality of target texts to obtain a plurality of second word segmentations;
[0031] Combining the plurality of second participles according to a preset rule to generate a plurality of second short sentences, each of the short sentences including at least two of the second participles;
[0032] Determine the plurality of second word segments and the plurality of second short sentences as the training texts, determine the second audio data as the first audio data, and determine the second image data as the first image data;
[0033] The step of labeling the first image data to obtain at least one action label includes:
[0034] Performing action recognition on the first image data to obtain a plurality of first actions and a plurality of action time periods, wherein the plurality of action time periods correspond to the plurality of first actions one by one, and the plurality of action time periods are time periods in which the plurality of first actions appear in the image data;
[0035] The multiple first actions and the multiple action time periods are labeled to obtain the at least one action label.
[0036] Optionally, the using the training data set and the at least one action label to train the classification model to obtain a target classification model includes:
[0037] Convert the multiple second participles into vectors to obtain multiple first vectors, where the multiple first vectors correspond one-to-one to the multiple second participles;
[0038] Convert the plurality of second short sentences into vectors to obtain a plurality of second vectors, wherein the plurality of second vectors correspond one-to-one to the plurality of second short sentences;
[0039] respectively calculating the matching degrees of the plurality of first vectors, the plurality of second vectors and the at least one action label to obtain a plurality of matching results;
[0040] The classification model is trained according to the training data set, the at least one action label and the multiple matching results to obtain the target classification model.
[0041] In a second aspect, an embodiment of the present application further provides a video synthesis device based on a classification model, which is applied to a target classification model, and the device includes:
[0042] An acquisition module, used for acquiring a text to be recognized and an audio to be recognized, wherein the audio to be recognized corresponds to the text to be recognized;
[0043] An input module, used for inputting the text to be recognized and the audio to be recognized into the target classification model, and outputting at least one candidate action, wherein the candidate action is a head action of the virtual image;
[0044] a determination module, configured to determine at least one time period according to the at least one candidate action, wherein the at least one time period is a time period in which the at least one candidate action is inserted into a video to be processed, wherein the video to be processed includes the virtual image;
[0045] A synthesis module is used to synthesize at least one action video corresponding to the at least one candidate action with the video to be processed based on the at least one time period to obtain a target video.
[0046] In a third aspect, an embodiment of the present application further provides a communication device, comprising: a transceiver, a memory, a processor, and a program stored in the memory and executable on the processor; the processor is used to read the program in the memory to implement the steps in the method described in the first aspect above.
[0047] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium for storing a program, which, when executed by a processor, implements the steps in the method described in the first aspect above.
[0048] In a fifth aspect, an embodiment of the present application further provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the steps in the method described in the first aspect.
[0049] The present application provides a video synthesis method, device, storage medium and program product based on a classification model, the method comprising: obtaining a text to be recognized and an audio to be recognized, the audio to be recognized corresponding to the text to be recognized; inputting the text to be recognized and the audio to be recognized into a target classification model, outputting at least one candidate action, the candidate action being the head action of a virtual image; determining at least one time period according to the at least one candidate action, the at least one time period being the time period in which the at least one candidate action is inserted into a video to be processed, the video to be processed including the virtual image; based on the at least one time period, synthesizing at least one action video corresponding to the at least one candidate action with the video to be processed to obtain a target video. The present application inputs the text to be recognized and the audio to be recognized into a trained target classification model, outputs at least one matching candidate action, and synthesizes the candidate action with the video to be processed through the candidate action and the time period corresponding to the candidate action to obtain a target video, thereby improving the correlation between the virtual image and the speech content in the video. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0051] Figure 1 It is a flow chart of a video synthesis method based on a classification model provided in an embodiment of the present application;
[0052] Figure 2 This is a schematic diagram of audio splitting provided in an embodiment of the present application;
[0053] Figure 3 is a schematic diagram of path calculation provided by an embodiment of the present application;
[0054] Figure 4 is a schematic diagram of video synthesis provided by an embodiment of the present application;
[0055] Figure 5 It is a structural schematic diagram of a video synthesis method device based on a classification model provided in an embodiment of the present application;
[0056] Figure 6 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0057] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0058] The terms "first", "second" etc. in the embodiments of the present application are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. In addition, the terms "include" and "have" and any variation thereof are intended to cover non-exclusive inclusions, for example, the process, method, system, product or equipment comprising a series of steps or units need not be limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or equipment. In addition, "and / or" is used in the present application to represent at least one of connected objects, such as A and / or B and / or C, representing the inclusion of separate A, separate B, separate C, and A and B all exist, B and C all exist, A and C all exist, and 7 situations that A, B and C all exist.
[0059] See also Figure 1 , Figure 1 FIG. 1 is a flow chart of a video synthesis method based on a classification model provided in an embodiment of the present application. Figure 1 As shown, the video synthesis method based on the classification model is applied to the target classification model, including:
[0060] Step 101: Obtain text to be recognized and audio to be recognized, wherein the audio to be recognized corresponds to the text to be recognized.
[0061] In this embodiment, the classification model-based video synthesis method provided by the present application extracts the text and audio of the virtual image in the video to obtain the text to be recognized and the audio to be recognized. When the relevant semantic content is read for the video to be processed including the virtual image, the relevant actions are matched for the virtual image, so that the virtual image has a low correlation with the spoken content.
[0062] Step 102: input the text to be recognized and the audio to be recognized into a target classification model, and output at least one candidate action, where the candidate action is a head action of the virtual image.
[0063] In this embodiment, the target classification model is a trained classification model, and its main function is to identify the input audio and text, so as to match the candidate actions corresponding to the audio and text. It should be noted that the candidate actions are the actions in the action library, where the action library includes multiple candidate actions, and the text content and audio content corresponding to each candidate action are different. Specifically, the action is the head action of the virtual image. Exemplarily, for example, it can be the nodding action, shaking action or other actions of the virtual image, etc.
[0064] It should be noted that when using different classification models, the actor style can be selected, and the models corresponding to different actor styles are different. Specifically, obtain the voice-driven data and set the actor style. It includes the pronunciation phoneme category sequence and phoneme duration sequence corresponding to the audio. The corpus information corresponding to the audio. Segment the text, and assume that the segmentation generates z1 word units, and the result is Match the pronunciation interval of each word. Among them, word list is the word unit set, represents the i-th word unit in the word unit set.
[0065] Among them: Through a piece of audio, identify the category and pronunciation time of each phoneme in the audio. This is an existing phoneme-level speech recognition algorithm. The voice-driven part provides pronunciation timestamp information, and the text provides semantic information.
[0066] Such as Figure 2 shown, among them, a piece of audio can be split into a phoneme category sequence and a phoneme duration sequence according to the pinyin-like things. For example, the phoneme v1, the pronunciation interval is Among them, t str1 is the start time point of pronunciation, is the end time point of pronunciation. The corpus corresponding to this piece of audio is also corresponding to the phonemes of the audio. Among them, the phonemes v1 and v2 constitute the pronunciation interval of the segmented "hen" (very), for example Figure 2 in it is for Similarly, the pronunciation interval of "happy" can also be matched through phonemes.
[0067] Step 103: Determine at least one time period according to the at least one candidate action, where the at least one time period is the time period when the at least one candidate action is inserted into the video to be processed, and the video to be processed includes the virtual image.
[0068] In this embodiment, the at least one candidate action corresponds one-to-one to the at least one time period, and each candidate action corresponds to a different time period, which is the time period for inserting the candidate action into the video to be processed. For example, the time period corresponding to the nodding action is 1 minute 11 seconds to 1 minute 12 seconds. During this time period, the virtual image needs to nod in the video to be processed.
[0069] Step 104: Based on the at least one time period, synthesize at least one action video corresponding to the at least one candidate action with the video to be processed to obtain a target video.
[0070] In this embodiment, a digital human nodding animation is synthesized based on multiple candidate actions. The head posture sequence is imported into a 3D tool such as blender, UE, Maya, etc. to synthesize the animation. Usually, the head posture sequence drives the head-bone or neck-bone of the digital human to rotate the corresponding bone to generate the head posture.
[0071] Thus, the semantic content in the text and audio can be more accurately matched to the semantic content information of the avatar when it is broadcasting. When expressing opinions, emphasis actions can be generated based on semantics to improve the relevance between the avatar and the spoken content in the video.
[0072] The present application inputs the text to be recognized and the audio to be recognized into a trained target classification model, outputs at least one matching candidate action, and synthesizes the candidate action and the time period corresponding to the candidate action with the video to be processed to obtain the target video, thereby improving the correlation between the virtual image and the spoken content in the video.
[0073] In some feasible implementations, optionally, inputting the to-be-recognized text and the to-be-recognized audio into a target classification model and outputting at least one candidate action includes:
[0074] Segmenting the text to be recognized to obtain a plurality of first segmented words;
[0075] Combining the plurality of first participles according to a preset rule to generate a plurality of first short sentences, each of the first short sentences including at least two of the first participles;
[0076] Convert the plurality of first word segments into a plurality of third vectors, and convert the plurality of first short sentences into a plurality of fourth vectors;
[0077] The multiple third vectors, the multiple fourth vectors and the audio to be recognized are input into the target classification model for similarity matching, and at least one candidate action is output.
[0078] In this embodiment, the text to be recognized is first segmented to obtain a plurality of first segmented words, and the plurality of first segmented words are combined by a preset segmentation method to generate a plurality of first short sentences, wherein each short sentence is composed of at least two segmented words, thereby generating a plurality of first short sentences, wherein the plurality of first segmented words correspond one-to-one to the plurality of third vectors, and the plurality of first short sentences correspond one-to-one to the plurality of fourth vectors. The similarity matching is used to perform semantic similarity matching on the plurality of third vectors, the plurality of fourth vectors, and the audio to be recognized.
[0079] Perform action matching on words and short sentences. Suppose the word sequence is Further generate a list of short sentences based on preset rules
[0080] Among them, phrase list is a list of short sentences, is the i-th short sentence in the short sentence list set.
[0081] Specifically, the words and phrases that match the action are combined into a unified trigger event list. Suppose the trigger event list has a total of z3 elements, set as event list ={(node i ,start i ,duration i ,score i )|i=1,2,..,z3}. wherenode i Represents the annotation data of the action, start i Represents the start time of the action, provided by the start event of the pronunciation interval of a word or short sentence. i is the duration of the action, provided by the difference between the end time and the start time of the annotated action. i is the confidence score.
[0082] For multiple first participles, among them, for word list The word segmentation results are traversed. If a word is directly in the WordSetTrigger set, it is considered that the word can trigger the corresponding marked action and is added to the trigger event list. The confidence of this type of action is 1.0. list The word segmentation results are traversed. If there is no match in the above steps, they are converted into vectors through word2vec. The labeled data are classified and matched by the classifier. The confidence of this type of action is the confidence of the classifier classification and is added to the trigger event list.
[0083] For multiple first phrases, wherelist The word segmentation results are traversed. If a phrase is directly in the set PhraseSetTrigger, it is considered that the phrase can trigger the corresponding annotated action and is added to the trigger event list. The confidence of this type of action is 1.0. list The word segmentation results are traversed. If there is no match in the above steps, it is converted into a vector through Sentence-Bert. The labeled data is classified and matched by the classifier. The confidence of this type of action is the confidence of the classifier classification and is added to the trigger event list.
[0084] Optionally, determining at least one time period according to the at least one candidate action includes:
[0085] generating a plurality of action paths according to the plurality of first participles, the plurality of first short sentences and the at least one candidate action, wherein the action paths are used to represent connection relationships between different candidate actions;
[0086] Calculating the confidences of the multiple action paths respectively to obtain multiple confidence scores, wherein the multiple confidence scores correspond to the multiple action paths one by one;
[0087] Screening the at least one candidate action according to a target action path to determine at least one target candidate action, wherein the target action path is an action path with the highest confidence score among the multiple action paths;
[0088] At least one target time period is determined according to the at least one target candidate action, where the target time period is a time period in the at least one time period corresponding to the target candidate action.
[0089] In this embodiment, if Figure 3 As shown, a directed acyclic graph is constructed for the triggered candidate actions and the action path is solved. It should be noted that in graph theory, if a directed graph cannot return to a certain vertex through several edges, then the graph is a directed acyclic graph (DAG). Directed means that all edges contain a starting point and an end point, and can only be traversed from the starting point to the end point. Acyclic means that after passing a certain vertex, it is impossible to return to the traversed edge point. Therefore, the DAG graph, by setting time for the start and end points of the edges, has its own time constraint logic and can be converted into a combinatorial optimization problem with time constraints, and each path is a possible solution.
[0090] Specifically, the event list event will be triggered listConvert to event edges, connect different event edges in pairs, and require that the end time of any two event edges is at least delta frames earlier than the start time of the latter, where delta frames refer to the difference frames between two consecutive video frames. Connect the virtual start point and the virtual end point. Rule: For any event edge, if the number of incoming edges corresponding to the start node is less than K, it is connected to the virtual start point to form a virtual edge. For any event edge, if the number of outgoing edges corresponding to the end node is less than K, it is connected to the virtual end point to form a virtual edge, where K is greater than or equal to 1.
[0091] Traverse from the virtual starting point to the virtual end point, generate multiple action paths, calculate the confidence of all event edges on each path, and add them up as the path score. The path with the highest path score among all paths is the target to solve the optimal path. Specifically, the event edges on this path correspond to event one by one. list An event in the event dispatching task is completed.
[0092] Optionally, synthesizing at least one action video corresponding to the at least one candidate action with the video to be processed based on the at least one time period to obtain a target video includes:
[0093] Determine a basic action according to the video to be processed, where the basic action is an action of the virtual image in the video to be processed;
[0094] Determine, according to the at least one candidate action, at least one action video matching the at least one candidate action;
[0095] Based on the at least one target time period, the at least one action video is synthesized with the action video corresponding to the basic action to obtain the target video.
[0096] In this embodiment, the length of the synthesized action is set according to the total duration of the audio, and an action sequence with a similar length at one end is selected from the no-nod actions, so as to extend the length to be consistent with the total duration of the audio. Figure 4 As shown in FIG. 1 , according to the attributes of the events in the result, the corresponding action fragment sequences are extracted from the labeled data and fused using the blending algorithm.
[0097] For an event action, let the action transition interval be p1 and p2, the length be t frames (fixed to about 5 frames), and the action subject be p. Directly replace the interval corresponding to the basic action with the action subject p. For the transition interval, the event action and the basic action are mixed using linear blending (quaternion):
[0098]
[0099] Where a represents the event action, t represents the number of frames included in the event action, and k represents the distance between the transition interval frame and the action body. v1 is the action frame (quaternion) in the corresponding action transition interval, and v2 is the action frame (quaternion) in the corresponding interval of the basic action. (Linear blending is because quaternions are used, which can be directly linearly interpolated)
[0100] All actions on the path are synthesized in the above way to form an action sequence. Let the frame length be L, and the final action sequence is a 2D vector with L rows and 4 columns.
[0101] Optionally, before inputting the to-be-recognized text and the to-be-recognized audio into the target classification model and outputting at least one candidate action, the method further includes:
[0102] Generate a training data set, the training data set including a training text, first audio data corresponding to the training text, and first image data corresponding to the training text;
[0103] Annotating the first image data to obtain at least one action label, where the at least one action label corresponds to a plurality of candidate actions;
[0104] The classification model is trained using the training data set and the at least one action label to obtain a target classification model, wherein the target classification model is used to match at least one candidate action to input target data, wherein the target data includes text and audio.
[0105] In this embodiment, the training data set can be obtained by collecting text and audio content of the actors, wherein each actor collects data separately, and the collected data is generally required to meet the following conditions: Before recording: the actor is required to face the camera directly, and in the initial state, the head posture is correct, without any turning or tilting of the head. During recording: the actor is required to look straight ahead to read the manuscript, and the manuscript is required to be read accurately and completely without missing a word. The video needs to collect the complete upper body part including the face, with only one actor in the background, and collect at a fixed frame rate of fps=30. For some semantics, nod according to the actor's own habits. The actor can adjust the head movement according to his own habits. A manuscript needs to be read completely, and pause in the middle according to habit. After recording: the actor is required to return to the state of facing the camera directly, and at the end state, return to the state of having a correct head posture, without any turning or tilting of the head.
[0106] Suppose there are m actors in total, and the actor set is A = {a i |i=1,2…,m}. Each actor has different number of performances. i Contains performance set P i ={p ij |j=1,2…,nj}. That is, p ij represents the jth performance of the ith actor. Each performance p ij Corresponding to a text ij , corresponding to an audio audio ij , corresponding to a video video ij .
[0107] In this embodiment, the image data in the video is annotated and numerically calculated to match at least one action label, wherein the at least one action label corresponds to multiple candidate actions, and the candidate actions are actions in the action library, wherein the action library includes multiple candidate actions, and each candidate action corresponds to different text content and audio content. Specifically, the action is a head action of the virtual image, and exemplary, for example, it can be a nodding action, a shaking action, or other actions of the virtual image.
[0108] In this embodiment, the obtained training data set and at least one marked action label are used to train the classification model to obtain a target classification model. Specifically, the classification model classifier is used to perform action prediction on words and short sentences.
[0109] The present application inputs the text to be recognized and the audio to be recognized into a trained target classification model, outputs at least one matching candidate action, and synthesizes the candidate action and the time period corresponding to the candidate action with the video to be processed to obtain the target video, thereby improving the correlation between the virtual image and the spoken content in the video.
[0110] In some feasible implementations, optionally, generating a training data set includes:
[0111] Performing word segmentation processing on the plurality of target texts to obtain a plurality of second word segmentations;
[0112] Combining the plurality of second participles according to a preset rule to generate a plurality of second short sentences, each of the short sentences including at least two of the second participles;
[0113] Determine the plurality of second word segments and the plurality of second short sentences as the training texts, determine the second audio data as the first audio data, and determine the second image data as the first image data;
[0114] The step of labeling the first image data to obtain at least one action label includes:
[0115] Performing action recognition on the first image data to obtain a plurality of first actions and a plurality of action time periods, wherein the plurality of action time periods correspond to the plurality of first actions one by one, and the plurality of action time periods are time periods in which the plurality of first actions appear in the image data;
[0116] The multiple first actions and the multiple action time periods are labeled to obtain the at least one action label.
[0117] In this embodiment, the acquired data information is processed, wherein the data information includes a target text, second audio data corresponding to the target text, and second image data corresponding to the target text. First, multiple target texts are segmented to obtain multiple segmented words. Specifically, the acquired manuscripts are segmented and converted into a series of words and attributes, wherein the word content is set as WordSet. Each performance p ij Corresponding to a text ij , corresponding to an audio audio ij . ij Word segmentation, mark the parts of speech of these words. ij Mark the start time and end time of each word. The part-of-speech tagging comes from the Chinese word segmentation tool, and the time information is marked according to the time axis of the audio playback. For details, refer to the vocabulary processing example shown in Table 1.
[0118] Table 1 Lexical Processing
[0119]
[0120] Parts of speech are classified by mainstream part of speech, such as n nouns, v verbs, u auxiliary words, q quantifiers, qv action quantifiers, qt time quantifiers, etc. (Among them: the parts of speech come from word segmentation tools, such as jieba word segmentation). For each performance pij, through word segmentation, the corresponding vocabulary, part of speech, and vocabulary performance time interval information can be obtained. In addition, time can be converted into frames to correspond to the video screen.
[0121] WordSet = {San Francisco, the, trip, global, attention, this trip, achieved, many, positive, results, China, advocated, obtained, recognized by all walks of life, ...}, etc. Phrase information is further generated based on the rules.
[0122] Furthermore, short sentence information is generated based on multiple word segments, and is set as PhraseSet. The maximum number of combined words is set as LCW (Limit Combine Word, set to 4 in the experiment). The proprietary vocabulary is set as Glossary. The word combination rule set is set as CR (Combine Rule).
[0123] LCW: Each word can be combined in order. Each word is combined into a short sentence one by one, such as the word combination logic shown in Table 2:
[0124] Table 2 Word Group (LCW=4)
[0125]
[0126] Glossary: Collects recent hot words. It can be user-specified hot words or hot word sets in some public corpora, such as "San Francisco trip", "global attention", "positive results", etc.
[0127] CR: stands for word combination rules. Use the rules to filter out combinations that meet the requirements and delete words that do not meet the requirements. For example, u-based auxiliary words cannot be used at the beginning or end, and nv short sentences can be directly used for subject-predicate structures. Use CR to control the number of short sentences generated.
[0128] Finally, we get PhraseSet = {trip to San Francisco, global attention, many positive results, positive results, China’s proposition, …}.
[0129] In addition, in the video data, the actor's performance can be converted into head posture sequence data frame by frame. The present invention uses quaternion as head posture data, and can use motion capture equipment to collect data.
[0130] In this embodiment, for data annotation, the performance actions are annotated and numerically calculated. In the action mark, each performance p ij , corresponding to video ij , annotate the actor's nodding and raising movements. The specific annotation contents are as follows:
[0131] Type: nod or raise head;
[0132] Interval: the start and end time of the action (approximate interval);
[0133] Depth: within 5 degrees, about 5-10 degrees, 10-15 degrees, 15-20 degrees, and more than 20 degrees, a total of 5 categories (when nodding multiple times, the maximum amplitude is used for calculation);
[0134] Frequency: single nod, double nod, triple nod, four or more nods, 4 categories in total.
[0135] For the numerical calculation part, the actor's movements in the video are converted frame by frame into a head posture sequence. The motion capture software is used to estimate the Euler angles of the actor's head posture during the performance. Assuming that K segments of movements are finally marked, with a total of L frames (corresponding to the duration frame rate), then a performance video ij A set of labeled dataset nodes will be generated ij ={nodijk |k=1,2,..K} and a piece of action data At the same time, the data without nodding annotations are the data outside these annotations, corresponding to the regular head posture movements, set as base z .
[0136] Optionally, the using the training data set and the at least one action label to train the classification model to obtain a target classification model includes:
[0137] Convert the multiple second participles into vectors to obtain multiple first vectors, where the multiple first vectors correspond one-to-one to the multiple second participles;
[0138] Convert the plurality of second short sentences into vectors to obtain a plurality of second vectors, wherein the plurality of second vectors correspond one-to-one to the plurality of second short sentences;
[0139] respectively calculating the matching degrees of the plurality of first vectors, the plurality of second vectors and the at least one action label to obtain a plurality of matching results;
[0140] The classification model is trained according to the training data set, the at least one action label and the multiple matching results to obtain the target classification model.
[0141] In this embodiment, multiple word segments and multiple short sentences are converted to obtain multiple first vectors and multiple second vectors, respectively, and matching actions are performed. Specifically, the words in WordSet are converted into word vectors through the Chinese word2vec model to obtain a set of vector mappings WordVec = {vec(w)|w∈WordSet}. For phrases in PhraseSet, they are converted into sentence vectors through the Chinese Sentence-Bert model to obtain a set of vector mappings PhraseVec = {vec(w)|w∈PhraseSet}. Among them: word2vec is an existing technology that converts words into vectors of fixed length; Sentence-Bert is an existing technology that converts sentences into vectors of fixed length.
[0142] Match the words and the annotation actions, and calculate the matching degree. Set the matching threshold to threshold.
[0143] For the words in WordSet, each word can correspond to the corresponding actor a i and performances ij , and interval (the start and end time of the actor's reading). Traverse the labeled dataset node ij Chinese label data nod ijkIf the intersection and union ratio of the vocabulary interval and the annotation data interval is a match and reaches the threshold, then the short sentence is considered to have triggered the action. The trigger word constitutes a subset WordSetTrigger = {word k :node k}, corresponding to the vocabulary word k Corresponding label node k The corresponding action.
[0144] For the short sentences in PhraseSet, each short sentence can correspond to the corresponding actor a i and performances ij , and interval (the start and end time of the actor's reading). Traverse the labeled dataset node ij Chinese label data nod ijk If the intersection and union ratio of the vocabulary interval and the annotation data interval is a match and reaches the threshold, then the phrase is considered to have triggered the action. The trigger phrases constitute the subset PhraseSetTrigger.
[0145] If the vocabulary and the short sentence do not match, the corresponding annotation data is no action, depth 0, and frequency 0.
[0146] When training the model, the input is the actor ID embedding, word vector or phrase vector. The predicted output is the action type, action depth, and action frequency. (Note: This contains an assumption. We assume that the same actor has similar head movements during dialogue. Different actors have different head movement styles corresponding to their speaking styles.)
[0147] The prediction method is as follows:
[0148] type pred ,freq pred ,depth pred =classifier(a i ,vec)vec
[0149] ∈WordVec or PhraseVec
[0150] According to the actor ID, the predicted type, frequency, depth and other information are matched to the closest annotated dataset {node ij ,j=1,2,…,n j}. At the same time, each match has a corresponding confidence level. If the predicted type is no action, or 0 frequency, or 0 depth, etc., it is identified as a non-triggering action. If the corresponding confidence level of the predicted matching action is less than the threshold, it is also identified as a non-triggering action.
[0151] The present application inputs the text to be recognized and the audio to be recognized into a trained target classification model, outputs at least one matching candidate action, and synthesizes the candidate action and the time period corresponding to the candidate action with the video to be processed to obtain the target video, thereby improving the correlation between the virtual image and the spoken content in the video.
[0152] See also Figure 5 , Figure 5 is a structural diagram of a video synthesis device based on a classification model provided in an embodiment of the present application. Figure 5 As shown, the classification model-based video synthesis device 500 is applied to a target classification model, including:
[0153] An acquisition module 510 is used to acquire a text to be recognized and an audio to be recognized, wherein the audio to be recognized corresponds to the text to be recognized;
[0154] An input module 520, configured to input the text to be recognized and the audio to be recognized into a target classification model, and output at least one candidate action, wherein the candidate action is a head action of the avatar;
[0155] A determination module 530, configured to determine at least one time period according to the at least one candidate action, wherein the at least one time period is a time period in which the at least one candidate action is inserted into a video to be processed, wherein the video to be processed includes the virtual image;
[0156] The synthesis module 540 is used to synthesize at least one action video corresponding to the at least one candidate action with the video to be processed based on the at least one time period to obtain a target video.
[0157] Optionally, the input module 520 includes:
[0158] A word segmentation submodule, used for segmenting the text to be recognized to obtain a plurality of first word segments;
[0159] a combining submodule, configured to combine the plurality of first participles according to a preset rule to generate a plurality of first short sentences, each of which includes at least two of the first participles;
[0160] A first conversion submodule, configured to convert the plurality of first word segmentations into a plurality of third vectors, and convert the plurality of first short sentences into a plurality of fourth vectors;
[0161] The input submodule is used to input the multiple third vectors, the multiple fourth vectors and the audio to be recognized into the target classification model for similarity matching, and output at least one candidate action.
[0162] Optionally, the determination module 530 includes:
[0163] a generating submodule, configured to generate a plurality of action paths according to the plurality of first word segmentations, the plurality of first short sentences and the at least one candidate action, wherein the action paths are used to represent connection relationships between different candidate actions;
[0164] A first calculation submodule, configured to calculate the confidences of the plurality of action paths respectively to obtain a plurality of confidence scores, wherein the plurality of confidence scores correspond one-to-one to the plurality of action paths;
[0165] a screening submodule, configured to screen the at least one candidate action according to a target action path, and determine at least one target candidate action, wherein the target action path is an action path having the highest confidence score among the multiple action paths;
[0166] The first determination submodule is configured to determine at least one target time period according to the at least one target candidate action, wherein the target time period is a time period in the at least one time period corresponding to the target candidate action.
[0167] Optionally, the synthesis module 540 includes:
[0168] A second determination submodule is used to determine a basic action according to the video to be processed, wherein the basic action is an action of the virtual image in the video to be processed;
[0169] A third determination submodule is used to determine at least one action video matching the at least one candidate action according to the at least one candidate action;
[0170] The synthesis submodule is used to synthesize the at least one action video with the action video corresponding to the basic action based on the at least one target time period to obtain the target video.
[0171] Optionally, also include:
[0172] A generating module, configured to generate a training data set, wherein the training data set includes a training text, first audio data corresponding to the training text, and first image data corresponding to the training text;
[0173] a labeling module, configured to label the first image data to obtain at least one action label, wherein the at least one action label corresponds to a plurality of candidate actions;
[0174] A training module is used to train a classification model using the training data set and the at least one action label to obtain a target classification model, wherein the target classification model is used to match at least one candidate action to input target data, wherein the target data includes text and audio.
[0175] Optionally, the generation module includes:
[0176] An acquisition submodule, used to acquire data information, wherein the data information includes a target text, second audio data corresponding to the target text, and second image data corresponding to the target text;
[0177] A processing submodule, used for performing word segmentation processing on the plurality of target texts to obtain a plurality of second word segmentations;
[0178] A combining submodule, configured to combine the plurality of second participles according to a preset rule to generate a plurality of second short sentences, each of which includes at least two of the second participles;
[0179] a fourth determination submodule, configured to determine the plurality of second word segmentations and the plurality of second short sentences as the training texts, determine the second audio data as the first audio data, and determine the second image data as the first image data;
[0180] The annotation module includes:
[0181] an identification submodule, configured to perform action identification on the first image data to obtain a plurality of first actions and a plurality of action time periods, wherein the plurality of action time periods correspond to the plurality of first actions one by one, and the plurality of action time periods are time periods in which the plurality of first actions appear in the image data;
[0182] The labeling submodule is used to label the multiple first actions and the multiple action time periods to obtain the at least one action label.
[0183] Optional training modules include:
[0184] A second conversion module, configured to convert the plurality of second participles into vectors to obtain a plurality of first vectors, wherein the plurality of first vectors correspond one-to-one to the plurality of second participles;
[0185] A third conversion module, configured to convert the plurality of second short sentences into vectors to obtain a plurality of second vectors, wherein the plurality of second vectors correspond one-to-one to the plurality of second short sentences;
[0186] A second calculation submodule, used to respectively calculate the matching degree of the plurality of first vectors, the plurality of second vectors and the at least one action label to obtain a plurality of matching results;
[0187] A training submodule is used to train the classification model according to the training data set, the at least one action label and the multiple matching results to obtain the target classification model.
[0188] The present application inputs the text to be recognized and the audio to be recognized into a trained target classification model, outputs at least one matching candidate action, and synthesizes the candidate action and the time period corresponding to the candidate action with the video to be processed to obtain the target video, thereby improving the correlation between the virtual image and the spoken content in the video.
[0189] The present application also provides an electronic device. Figure 6 , the electronic device may include a processor 601, a memory 602, and a program 6021 stored in the memory 602 and executable on the processor 601.
[0190] When the program 6021 is executed by the processor 601, it can achieve Figure 1 Any step in the corresponding method embodiment:
[0191] Acquire a text to be recognized and an audio to be recognized, wherein the audio to be recognized corresponds to the text to be recognized;
[0192] Inputting the text to be recognized and the audio to be recognized into a target classification model, and outputting at least one candidate action, where the candidate action is a head action of the virtual image;
[0193] Determine at least one time period according to the at least one candidate action, the at least one time period being a time period in which the at least one candidate action is inserted into a video to be processed, the video to be processed including the virtual image;
[0194] Based on the at least one time period, at least one action video corresponding to the at least one candidate action is synthesized with the video to be processed to obtain a target video.
[0195] Optionally, the step of inputting the to-be-recognized text and the to-be-recognized audio into a target classification model and outputting at least one candidate action includes:
[0196] Segmenting the text to be recognized to obtain a plurality of first segmented words;
[0197] Combining the plurality of first participles according to a preset rule to generate a plurality of first short sentences, each of the first short sentences including at least two of the first participles;
[0198] Convert the plurality of first word segments into a plurality of third vectors, and convert the plurality of first short sentences into a plurality of fourth vectors;
[0199] The multiple third vectors, the multiple fourth vectors and the audio to be recognized are input into the target classification model for similarity matching, and at least one candidate action is output.
[0200] Optionally, determining at least one time period according to the at least one candidate action includes:
[0201] generating a plurality of action paths according to the plurality of first participles, the plurality of first short sentences and the at least one candidate action, wherein the action paths are used to represent connection relationships between different candidate actions;
[0202] Calculating the confidences of the multiple action paths respectively to obtain multiple confidence scores, wherein the multiple confidence scores correspond to the multiple action paths one by one;
[0203] Screening the at least one candidate action according to a target action path to determine at least one target candidate action, wherein the target action path is an action path with the highest confidence score among the multiple action paths;
[0204] At least one target time period is determined according to the at least one target candidate action, where the target time period is a time period in the at least one time period corresponding to the target candidate action.
[0205] Optionally, synthesizing at least one action video corresponding to the at least one candidate action with the video to be processed based on the at least one time period to obtain a target video includes:
[0206] Determine a basic action according to the video to be processed, where the basic action is an action of the virtual image in the video to be processed;
[0207] Determine, according to the at least one candidate action, at least one action video matching the at least one candidate action;
[0208] Based on the at least one target time period, the at least one action video is synthesized with the action video corresponding to the basic action to obtain the target video.
[0209] Optionally, before inputting the to-be-recognized text and the to-be-recognized audio into the target classification model and outputting at least one candidate action, the method further includes:
[0210] Generate a training data set, the training data set including a training text, first audio data corresponding to the training text, and first image data corresponding to the training text;
[0211] Annotating the first image data to obtain at least one action label, where the at least one action label corresponds to a plurality of candidate actions;
[0212] The classification model is trained using the training data set and the at least one action label to obtain a target classification model, wherein the target classification model is used to match at least one candidate action to input target data, wherein the target data includes text and audio.
[0213] Optionally, generating a training data set includes:
[0214] Acquire data information, wherein the data information includes a target text, second audio data corresponding to the target text, and second image data corresponding to the target text;
[0215] Performing word segmentation processing on the plurality of target texts to obtain a plurality of second word segmentations;
[0216] Combining the plurality of second participles according to a preset rule to generate a plurality of second short sentences, each of the short sentences including at least two of the second participles;
[0217] Determine the plurality of second word segments and the plurality of second short sentences as the training texts, determine the second audio data as the first audio data, and determine the second image data as the first image data;
[0218] The step of labeling the first image data to obtain at least one action label includes:
[0219] Performing action recognition on the first image data to obtain a plurality of first actions and a plurality of action time periods, wherein the plurality of action time periods correspond to the plurality of first actions one by one, and the plurality of action time periods are time periods in which the plurality of first actions appear in the image data;
[0220] The multiple first actions and the multiple action time periods are labeled to obtain the at least one action label.
[0221] Optionally, the using the training data set and the at least one action label to train the classification model to obtain a target classification model includes:
[0222] Convert the multiple second participles into vectors to obtain multiple first vectors, where the multiple first vectors correspond one-to-one to the multiple second participles;
[0223] Convert the plurality of second short sentences into vectors to obtain a plurality of second vectors, wherein the plurality of second vectors correspond one-to-one to the plurality of second short sentences;
[0224] respectively calculating the matching degrees of the plurality of first vectors, the plurality of second vectors and the at least one action label to obtain a plurality of matching results;
[0225] The classification model is trained according to the training data set, the at least one action label and the multiple matching results to obtain the target classification model.
[0226] The present application inputs the text to be recognized and the audio to be recognized into a trained target classification model, outputs at least one matching candidate action, and synthesizes the candidate action and the time period corresponding to the candidate action with the video to be processed to obtain the target video, thereby improving the correlation between the virtual image and the spoken content in the video.
[0227] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the above-mentioned video synthesis method embodiment based on the classification model is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0228] An embodiment of the present application further provides a computer program product, which is stored in a storage medium. The computer program product is executed by at least one processor to implement the various processes of the above-mentioned classification model-based video synthesis method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0229] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0230] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0231] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A video synthesis method based on a classification model, characterized in that: The method comprises: Acquire a text to be recognized and an audio to be recognized, wherein the audio to be recognized corresponds to the text to be recognized; Inputting the text to be recognized and the audio to be recognized into a target classification model, and outputting at least one candidate action, where the candidate action is a head action of the virtual image; Determine at least one time period according to the at least one candidate action, the at least one time period being a time period in which the at least one candidate action is inserted into a video to be processed, the video to be processed including the virtual image; Based on the at least one time period, at least one action video corresponding to the at least one candidate action is synthesized with the video to be processed to obtain a target video.
2. The method according to claim 1, characterized in that: The step of inputting the to-be-recognized text and the to-be-recognized audio into a target classification model and outputting at least one candidate action comprises: Segmenting the text to be recognized to obtain a plurality of first segmented words; Combining the plurality of first participles according to a preset rule to generate a plurality of first short sentences, each of the first short sentences including at least two of the first participles; Convert the plurality of first word segments into a plurality of third vectors, and convert the plurality of first short sentences into a plurality of fourth vectors; The multiple third vectors, the multiple fourth vectors and the audio to be recognized are input into the target classification model for similarity matching, and at least one candidate action is output.
3. The method according to claim 2, characterized in that The determining at least one time period according to the at least one candidate action comprises: generating a plurality of action paths according to the plurality of first participles, the plurality of first short sentences and the at least one candidate action, wherein the action paths are used to represent connection relationships between different candidate actions; Calculating the confidences of the multiple action paths respectively to obtain multiple confidence scores, wherein the multiple confidence scores correspond to the multiple action paths one by one; Screening the at least one candidate action according to a target action path to determine at least one target candidate action, wherein the target action path is an action path with the highest confidence score among the multiple action paths; At least one target time period is determined according to the at least one target candidate action, where the target time period is a time period in the at least one time period corresponding to the target candidate action.
4. The method according to claim 3, characterized in that The synthesizing, based on the at least one time period, at least one action video corresponding to the at least one candidate action and the video to be processed to obtain a target video includes: Determine a basic action according to the video to be processed, where the basic action is an action of the virtual image in the video to be processed; Determine, according to the at least one candidate action, at least one action video matching the at least one candidate action; Based on the at least one target time period, the at least one action video is synthesized with the action video corresponding to the basic action to obtain the target video.
5. The method according to claim 1, characterized in that Before inputting the text to be recognized and the audio to be recognized into the target classification model and outputting at least one candidate action, the method further includes: Generate a training data set, the training data set including a training text, first audio data corresponding to the training text, and first image data corresponding to the training text; Annotating the first image data to obtain at least one action label, where the at least one action label corresponds to a plurality of candidate actions; The classification model is trained using the training data set and the at least one action label to obtain a target classification model, wherein the target classification model is used to match at least one candidate action to input target data, wherein the target data includes text and audio.
6. The method according to claim 5, characterized in that The generating of the training data set comprises: Acquire data information, wherein the data information includes a target text, second audio data corresponding to the target text, and second image data corresponding to the target text; Performing word segmentation processing on the plurality of target texts to obtain a plurality of second word segmentations; Combining the plurality of second participles according to a preset rule to generate a plurality of second short sentences, each of the short sentences including at least two of the second participles; Determine the plurality of second word segments and the plurality of second short sentences as the training texts, determine the second audio data as the first audio data, and determine the second image data as the first image data; The step of labeling the first image data to obtain at least one action label includes: Performing action recognition on the first image data to obtain a plurality of first actions and a plurality of action time periods, wherein the plurality of action time periods correspond to the plurality of first actions one by one, and the plurality of action time periods are time periods in which the plurality of first actions appear in the image data; The multiple first actions and the multiple action time periods are labeled to obtain the at least one action label.
7. The method according to claim 6, characterized in that The step of training the classification model using the training data set and the at least one action label to obtain a target classification model includes: Convert the multiple second participles into vectors to obtain multiple first vectors, where the multiple first vectors correspond one-to-one to the multiple second participles; Convert the plurality of second short sentences into vectors to obtain a plurality of second vectors, wherein the plurality of second vectors correspond one-to-one to the plurality of second short sentences; respectively calculating the matching degrees of the plurality of first vectors, the plurality of second vectors and the at least one action label to obtain a plurality of matching results; The classification model is trained according to the training data set, the at least one action label and the multiple matching results to obtain the target classification model.
8. An electronic device comprising: A memory, a processor, and a program stored in the memory and executable on the processor; wherein the processor is used to read the program in the memory to implement the steps in the classification model-based video synthesis method as described in any one of claims 1 to 7.
9. A computer-readable storage medium for storing a program, characterized in that: When the program is executed by a processor, the steps in the classification model-based video synthesis method according to any one of claims 1 to 7 are implemented.
10. A computer program product, characterized in that The computer program product is stored in a storage medium, and the computer program product is executed by at least one processor to implement the steps in the classification model-based video synthesis method according to any one of claims 1 to 7.
