Action generation model training method and device, equipment, medium and program product

By introducing the training methods of prior loss and sample loss into the action generation model and combining it with technologies such as the generative diffusion model, the problems of personalized customization and retention of prior knowledge of the action generation model with a small number of samples are solved, and the generation of diversified and personalized action sequences is achieved.

CN120808429APending Publication Date: 2025-10-17TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410434183.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-10
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

In the existing technology, it is difficult for action generation models to meet personalized customization requirements with a small number of training samples. At the same time, the prior knowledge learned during pre-training is destroyed, resulting in overfitting and difficulty in generating action sequences other than the training samples.

Method used

By obtaining prior conditional representation and prior sequence, as well as sample conditional representation and sample sequence, the action generation model is trained using prior loss and sample loss, retaining prior knowledge while learning sample features, and using a generative diffusion model, adversarial network or variational autoencoder for training.

Benefits of technology

The action generation model can generate personalized action sequences with a small number of samples while retaining the diverse features learned during pre-training, avoiding overfitting and improving the generalization ability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120808429A_ABST
    Figure CN120808429A_ABST
Patent Text Reader

Abstract

The invention discloses a training method and device of an action generation model, equipment, a medium and a program product, and belongs to the field of action generation. The method comprises the following steps: acquiring a priori condition representation and a priori sequence; sample condition representation and a sample sequence with personalized features are obtained; inputting the priori condition representation into the action generation model to obtain a priori prediction sequence; inputting the sample condition representation into the action generation model to obtain a sample prediction sequence; and training an action generation model based on a priori loss and a sample loss, the priori loss being obtained based on the priori prediction sequence and the priori sequence, and the sample loss being obtained based on the sample prediction sequence and the sample sequence. According to the method disclosed by the invention, prior knowledge learned during pre-training is reserved during model training, and the situation that personalized customization of the action generation model is affected due to the fact that the action generation model obtained through training has an overfitting problem can be avoided.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of action generation, and in particular to a method and apparatus for training an action generation model, a device, a medium and a program product. BACKGROUND

[0002] An action generation model is a model capable of automatically generating natural, diverse and richly detailed action sequences. Action generation models can be widely used in the fields of games, film production, virtual reality and augmented reality, etc.

[0003] If an action generation model meeting the above requirements is to be generated, a large number of training samples are often required for training. In related technologies, a pre-trained model is usually trained using a small number of training samples to obtain an action generation model meeting the individual customization requirements. A pre-trained model refers to a neural network model that has been trained on a large-scale training sample set.

[0004] However, this method often destroys the prior knowledge learned by the pre-trained model during pre-training due to the use of a small number of training samples, resulting in overfitting, i.e., the action generation model obtained by training is difficult to generate action sequences other than the training samples. Therefore, how to design a training method for the action generation model so that the action generation model can meet both the individual customization requirements based on a small number of samples and retain the prior knowledge learned during pre-training is a problem to be solved at present. SUMMARY

[0005] The present application provides a method and apparatus for training an action generation model, a device, a medium and a program product, and the technical solutions are as follows:

[0006] According to an aspect of the present application, a method for training an action generation model is provided, and the method comprises:

[0007] obtaining a prior condition representation and a prior sequence, the prior sequence having diversified features learned by the action generation model during pre-training; and obtaining a sample condition representation and a sample sequence, the sample sequence having individualized features;

[0008] inputting the prior condition representation into the action generation model to obtain a prior prediction sequence; and inputting the sample condition representation into the action generation model to obtain a sample prediction sequence;

[0009] training the action generation model based on a prior loss and a sample loss, the prior loss being obtained based on the prior prediction sequence and the prior sequence, and the sample loss being obtained based on the sample prediction sequence and the sample sequence.

[0010] According to an aspect of the present application, a training device of an action generation model is provided, the device comprising:

[0011] an acquisition module configured to acquire a prior condition representation and a prior sequence, the prior sequence having diversified features learned by the action generation model during pre-training, and to acquire a sample condition representation and a sample sequence, the sample sequence having personalized features;

[0012] a generation module configured to input the prior condition representation into the action generation model to obtain a prior predicted sequence, and to input the sample condition representation into the action generation model to obtain a sample predicted sequence;

[0013] a training module configured to train the action generation model based on a prior loss and a sample loss, the prior loss being obtained based on the prior predicted sequence and the prior sequence, and the sample loss being obtained based on the sample predicted sequence and the sample sequence.

[0014] According to an aspect of the present application, a computer device is provided, comprising a processor and a memory, the memory storing at least one program, and the processor being configured to execute the at least one program in the memory to implement the above-mentioned training method of the action generation model.

[0015] According to an aspect of the present application, a computer readable storage medium is provided, the computer readable storage medium storing executable instructions, the executable instructions being loaded and executed by a processor to implement the above-mentioned training method of the action generation model.

[0016] According to an aspect of the present application, a computer program product is provided, the computer program product comprising computer instructions stored in a computer readable storage medium, the computer instructions being read and executed by a processor from the computer readable storage medium to implement the training method of the action generation model.

[0017] The technical solutions provided by the present application have at least the following beneficial effects:

[0018] The prior knowledge of the action generation model is protected by the prior sequence, and the prior loss can be understood as the degree of preservation of the prior knowledge during the adjustment of the model parameters. Meanwhile, the sample sequence is learned, and the sample loss can be understood as the learning degree of the action generation model on the sample sequence during the adjustment of the model parameters. The sample sequence includes personalized action features learned by the user expected action generation model. Thus, the action generation model obtained by training can learn the personalized features in the sample sequence and can preserve the prior knowledge as much as possible without being destroyed by the personalized features.

[0019] For example, a user expects the action generation model to generate a series of action instructions such as "an old man stumbles forward", "an old man trembles backward", "an old man falls down after walking a few steps", and the like. However, when the text is directly input as a condition into the action generation model, the generated action sequence may not achieve the expected effect. At this time, the user can first make a sample sequence "an old man walks forward", so that the action generation model learns the action features in the sample sequence, such as some gait features, habitual actions, and the like. The action generation model can extract the personalized action features in the sample sequence, such as some gait features, habitual actions, and the like, during training (which can also be referred to as fine-tuning). After training, the above-mentioned action instructions can be input to achieve an action sequence that is more in line with the user's expectations. That is, by learning the features included in the sample sequence, the action generation model can achieve personalized customization (generating an action sequence with the same or similar personalized action features as the sample sequence).

[0020] In addition, if the model parameters of the action generation model are adjusted only through the sample sequence, the fine-tuned action generation model may be more inclined to generate action sequences with similar features to the sample sequence during subsequent use, causing the action sequences generated by the action generation model after further fine-tuning to increasingly tend to generate the input sample sequence, thereby losing the diversified features it originally learned, i.e., it is difficult to continue personalized customization. Training the action generation model based on the sample loss and the prior loss preserves the prior knowledge as much as possible while learning the features in the sample action as much as possible, so that the action generation model can generate both the sample sequence and the prior sequence, and can also generate action sequences with both the prior sequence features and the sample sequence features. For example, if the prior sequence is "an old man stumbles forward" and the sample sequence is "a teenager makes a three-step shot", then for the trained action generation model, it is expected that the action generation model can generate both the prior sequence "an old man stumbles forward" and the sample sequence "a teenager makes a three-step shot", and can also generate action sequences of "an old man makes a three-step shot" and "a teenager stumbles forward". BRIEF DESCRIPTION OF DRAWINGS

[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0022] Figure 1 A generation principle diagram of a generative diffusion model in the related art is shown;

[0023] Figure 2A generation schematic of an adversarial network in the related art is shown;

[0024] Figure 3 A generation schematic of a variational autoencoder in the related art is shown;

[0025] Figure 4 A schematic diagram of an architecture of a computer system provided by an example embodiment of the present application is shown;

[0026] Figure 5 A flowchart of a training method of an action generation model provided by an example embodiment of the present application is shown;

[0027] Figure 6 A flowchart of a training method of an action generation model provided by an example embodiment of the present application is shown;

[0028] Figure 7 A flowchart of a training method of an action generation model provided by an example embodiment of the present application is shown;

[0029] Figure 8 A flowchart of a training method of an action generation model provided by an example embodiment of the present application is shown;

[0030] Figure 9 A flowchart of a training method of an action generation model provided by an example embodiment of the present application is shown;

[0031] Figure 10 A flowchart of a training method of an action generation model provided by an example embodiment of the present application is shown;

[0032] Figure 11 A schematic diagram of a three-dimensional human skeleton model provided by an example embodiment of the present application is shown;

[0033] Figure 12 A flowchart of a training method of an action generation model provided by an example embodiment of the present application is shown;

[0034] Figure 13 A flowchart of a training method of an action generation model provided by an example embodiment of the present application is shown;

[0035] Figure 14 A flowchart of a training method of an action generation model provided by an example embodiment of the present application is shown;

[0036] Figure 15 A schematic diagram of a space constraint provided by an example embodiment of the present application is shown;

[0037] Figure 16 A structural block diagram of a training device of an action generation model provided by an example embodiment of the present application is shown;

[0038] Figure 17 Fig. 1 shows a structural schematic diagram of a computer device according to an example embodiment of the present application. DETAILED DESCRIPTION

[0039] For the purpose of the present application, the technical solutions and advantages will be more apparent, the following will be further described in detail with the embodiments of the present application in conjunction with the accompanying drawings.

[0040] The example embodiments will be described in detail below with reference to the accompanying drawings. The following description is presented with reference to the accompanying drawings in order to provide a thorough understanding of the example embodiments. However, it will be apparent that the example embodiments can be practiced in other embodiments and can be

[0041] The terminology used in the present disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the present disclosure. As used in the present disclosure and the appended claims, the singular forms "a," "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that the term "and / or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.

[0042] It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of relevant countries and regions. For example, the information such as setting operation involved in the present application is obtained under sufficient authorization.

[0043] It should be understood that although the terms first, second, etc. can be used in this disclosure to describe various information, these information should not be limited to these terms. These terms are only used to distinguish one type of information from another type of information. For example, a first parameter can also be referred to as a second parameter without departing from the scope of the present disclosure, and similarly, a second parameter can also be referred to as a first parameter. Depending on the context, the word "if" as used herein can be interpreted as "when" or "upon" or "in response to determining".

[0044] Firstly, the related terms involved in the present application are introduced:

[0045] Artificial Intelligence (AI): is to use digital computers or digital computer controlled machine simulation, extension and expansion of human intelligence, perception of the environment, acquisition of knowledge and use of knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology of computer science, which tries to understand the essence of intelligence and produce a new intelligent machine that can react in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that machines have the functions of perception, reasoning and decision-making.

[0046] Artificial intelligence technology is a comprehensive discipline, involving a wide range of fields, both hardware and software technologies. Artificial intelligence basic technology generally includes, such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing technology, pre-training model technology, operation / interaction system, mechatronics, etc. Among them, the pre-training model is also called large model, basic model, which can be widely applied to downstream tasks in various directions of artificial intelligence after fine-tuning. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology and machine learning / deep learning, etc.

[0047] With the research and progress of artificial intelligence technology, artificial intelligence technology has been researched and applied in many fields, such as common smart home, smart wearable devices, virtual assistants, smart speakers, smart marketing, unmanned vehicles, autonomous vehicles, drones, digital twins, virtual humans, robots, artificial intelligence generated content (AIGC), conversational interaction, intelligent medical care, intelligent customer service, game AI, etc. It is believed that with the development of technology, artificial intelligence technology will be applied in more and more fields and play an increasingly important value.

[0048] Pre-training Model (PTM): also known as cornerstone model, large model, refers to a deep neural network (DNN) with large parameters, which is trained on a large amount of unlabeled data. The PTM extracts common features from the data using the function approximation capability of the large parameter DNN. Through fine tuning, parameter efficient fine tuning (PEFT), prompt tuning and other technologies, the PTM is suitable for downstream tasks. Therefore, the pre-training model can achieve ideal results in few-shot or zero-shot scenarios. PTM can be divided into language models (ELMO, BERT, GPT), visual models (swin-transformer, ViT, V-MOE), speech models (VALL-E), multi-modal models (ViBERT, CLIP, Flamingo, Gato) according to the data modalities processed, among which the multi-modal model refers to a model that establishes the feature representation of two or more data modalities. The pre-training model is an important tool for outputting artificial intelligence generated content, and can also be used as a general interface connecting multiple specific task models.

[0049] Action sequence: a sequence of actions or poses with a time sequence relationship. The unit of the action sequence can be a frame or a second.

[0050] Condition space: a set of conditions learned by a model during training, or a set of all possible conditions or factors learned and adapted by a model during training. These conditions can include features of input data, labels, constraints, or any other factors that affect the output or decision of the model. Optionally, the condition space is a discrete set, i.e., the condition space stores a limited number of conditions; or, the condition space is a continuous set, i.e., the condition space stores a range of conditions or factors. The information stored in the condition space can be referred to as a condition vector or a condition representation. The model can generate conditionally according to the condition space, for example, during model training, input values (original data or noise) and their corresponding condition vectors are input into the model, and the model will learn how to generate the expected output value according to the input value and the condition vector. It should be noted that the above conditions can also be referred to as factors, and the condition set can also be referred to as the factor set.

[0051] Conditional representation: Information stored in the conditional space, which can also be called a conditional vector. The conditional representation can instruct the model to generate the input value into the desired output value given the conditional representation. For example, in the action generation model, the training sample includes the conditional representation and the action sequence. The action sequence is the desired output value. The conditional representation is usually a feature expression of the action sequence manually or using various recognition methods. For example, if the action sequence a is about an old man walking forward, then the condition of the action sequence can be the descriptive words "old man" and "walking forward" for the action sequence a, where the word "old man" describes the characteristics of the executor (performer) of the action sequence, and the word "walking forward" describes the action content of the action sequence. Generally speaking, the above-mentioned "old man" and "walking forward" will be encoded into a feature vector through a text encoder, and the feature vector can be called the conditional representation corresponding to the action sequence.

[0052] Conditional Generative Model / Conditional Generative Network: A generative model that generates data based on a conditional representation of the input. This generative model can be a generative diffusion model, a generative adversarial network (GAN), or a variational autoencoder (VAE), etc., which are not limited to this embodiment of the present application. The following is a brief introduction to the training process of the above-mentioned generative models.

[0053] Generative diffusion model: includes forward process and reverse process, or includes diffusion process and reverse diffusion process, which can also be called forward process and reverse process. The forward process is a Markov chain, which is a process of gradually adding noise to the input value (input sample) until a pure noise is obtained. Each step here can be called a time step; the reverse process is a process of gradually denoising a noise data until the input value (input sample) is obtained. That is, the forward process is a noise-adding process, and the reverse process is a noise-denoising inference process. The generative diffusion model mainly studies the reverse process, that is, learning how to infer the input value (input sample) from a noise data. For example Figure 1 As shown, the solid arrow is the forward process, x0 is the input value (input sample), and in the embodiment of the present application, the input value is an action sequence, x T is the noise data obtained after T time steps of noise addition. The dotted arrow is the reverse process. Since the forward process and the reverse process are actually steps on the Markov chain, they both conform to the Markov property, that is, x t The probability distribution of x t-1 During the training process, you can learn gradually or as a whole.

[0054] 1) Step-by-step learning: At the t-th time step, the data corresponding to the t-th time step and the data of the t-1-th time step are obtained, and the prediction data of the t-1-th time step is obtained according to the data corresponding to the t-th time step, and the model is trained according to the difference between the data of the t-1-th time step and the prediction data of the t-1-th time step.

[0055] 2) Overall learning: There are T time steps in total, and the prediction data is obtained by T-step denoising of a noise data, and the model is trained according to the difference between the prediction data and the input value.

[0056] GAN: including a generator (generative network) and a discriminator (discriminative network). As shown in Figure 2 , the generator G(z) is used to generate similar data x' similar to the input value (input sample) x according to the noise data z; the discriminator is used to judge the difference between the similar data x' generated by the generator and the input value x.

[0057] In training, usually first train the discriminator, label the input value as "true", and label the similar data generated by the generator as "false", and input the above two data into the discriminator, and in loss calculation, make the discriminator's judgment of the input value tend to be true (1), and the discrimination result of the similar data tend to be false (0); during the training of the discriminator, the parameters of the generator are fixed and unchanged, and only the parameters of the discriminator are changed. Then train the generator, the generator generates similar data according to the noise data, and labels the similar data as "true" and inputs it into the discriminator, and according to the discrimination loss of the discriminator on the similar data, the parameters of the generator are changed, and at this time the parameters of the discriminator are not changed. In this way, the discriminator and the generator are alternately trained in an adversarial manner until the training termination condition is met.

[0058] VAE: including an encoder and a decoder. As shown in Figure 3 , the encoder q Φ (z|x) is used to encode the input value (input sample) x to obtain the feature z corresponding to the input value, and the dimension of the feature z is usually smaller than that of the input value (input sample) x, and the decoder P θ (x|z) is used to restore the similar data x' similar to the input value according to the feature z.

[0059] In the training process, the parameters of the encoder and the decoder are updated according to the error between the similar data and the input value.

[0060] Markov Chain (MC): A stochastic process with Markov Property existing in discrete index set and state space.

[0061] Markov Property: The probability distribution of the current state of a stochastic process only relates to the previous state, and is irrelevant to the sequence of previous states.

[0062] Overfitting: The problem that the machine learning model tends to generate similar data to the training samples after training, and is difficult to generate new data. That is, the trained machine learning model loses the generalization ability, or in other words, loses the creativity. The intuitive manifestation of overfitting is that the prediction ability on the training sample set is very strong, but the prediction ability on the new sample set drops significantly compared to the training sample set. When the training sample is too small or the sample distribution of the training sample set is too single or there is noise in the training sample, overfitting phenomenon is easy to occur.

[0063] Action generation model: A model capable of generating action sequences. A well-trained action generation model can quickly and automatically generate natural and diverse action sequences with rich details. In order to better control the action generation model to generate action sequences that meet the requirements, a conditional variable is input to the action generation model, so that the action generation model generates personalized actions based on the conditional variable. According to different use scenarios of the action generation model, the conditional variable can be a conditional variable of each modality. Next, various modal conditional variable control action generation models will be briefly illustrated.

[0064] (1) Text: Text is the most extensive type of conditional variable. Controlling the action generation model through text usually uses text to describe the action features of the action sequence expected to be generated, such as the execution subject (or performer) features (also known as role features) of the action sequence, and the features of the action content. For example, “an old man walks like a zombie”, which describes both the role feature “old man” and the action content feature “walks like a zombie”.

[0065] (2) Image / video: Describe the action features of the action sequence expected to be generated through video or image. A set of images is usually used, which are video frames extracted from the video. This type of conditional variable is usually used to specify the initial state and / or terminal state of the action sequence through a set of images or videos, and the intermediate process is completed by the action generation sequence to generate a complete action sequence.

[0066] (3) Audio: This is used to instruct the action generation model to generate an action sequence that corresponds to the beat of the audio. This is usually used to generate dance moves that correspond to the audio.

[0067] (4) Trajectory / spatial constraints: The trajectory can be a two-dimensional trajectory or a three-dimensional trajectory, which is used to indicate that the generated action sequence must move along the trajectory.

[0068] Figure 4 FIG1 shows an architecture diagram of a computer system provided by an exemplary embodiment of the present application. The computer system includes: a computer device 110 .

[0069] Optionally, the computer device 110 is a server or a terminal.

[0070] Optionally, the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides cloud computing services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and basic cloud computing services such as big data and artificial intelligence platforms. Optionally, the terminal can be an electronic device such as a mobile phone, tablet computer, vehicle-mounted terminal (vehicle computer), wearable device, PC (Personal Computer), unmanned reservation terminal, etc.

[0071] The computer device 110 is used to obtain a priori conditional representation and a priori sequence, where the priori sequence is an action sequence with diverse features learned by the action generation model during pre-training; and to obtain a sample conditional representation and a sample sequence with personalized features; the computer device 110 is also used to input the priori conditional representation into the action generation model to generate a priori sequence; the computer device 110 is also used to input the priori conditional representation into the action generation model to obtain a priori prediction sequence; and input the sample conditional representation into the action generation model to obtain a sample prediction sequence; the computer device 110 is also used to train the action generation model based on a priori loss and a sample loss, where the prior loss is obtained based on the prior prediction sequence and the prior sequence, and the sample loss is obtained based on the sample prediction sequence and the sample sequence.

[0072] Exemplarily, the training method includes a pre-training stage 50 and a fine-tuning stage 60. In the pre-training stage 50, the action generation model needs to be pre-trained according to the input conditions (which can be directly input by the user or extracted by the action generation model based on the action sequence), i.e., the text prompt 51 and the spatial constraint 52. The text prompt 51 includes the role feature and the action content. The role feature is used to indicate the characteristics of the performer, i.e., the executor of the action. The action content is the text content for the action sequence. For example, for the action sequence "an old man is walking", the corresponding role feature can be summarized as "old man", and the action content can be summarized as "walking". The spatial constraint is used to indicate the motion trajectory (or action trajectory) of the performer in the action sequence. The spatial constraint can be a set of two-dimensional trajectory points or a set of three-dimensional trajectory points. For the text prompt 51, a text encoder such as the text encoder in CLIP (Contrastive Language-Image Pre-training, a pre-training method or model based on contrastive text-image pairs) can be used for encoding to obtain a text prompt feature representation. For the spatial constraint 52, the spatial constraint feature representation can be extracted by the action generation model itself. In the pre-training, two parallel conditional spaces 53 are constructed based on the text prompt feature representation and the spatial constraint feature representation, respectively. The two parallel conditional spaces 53 are used to guide the conditional training of the action generation model. Optionally, an MLP (Multi-Layer Perceptron) can be used to compress the data of the conditional space 53. In the pre-training process, if a generative diffusion model is used, a noise action 54 (also referred to as noise data) is randomly sampled and input into a neural network for generation 55 to obtain a prediction value 56, which can also be referred to as a predicted sequence. It should be noted that the neural network for generation 55 used here can be any architecture of neural network, such as an MLP model, a Transformer model, a Convolutional Network model, etc. In the pre-training process based on the generative diffusion model, the noise action 54 is continuously cycled to obtain the prediction value 56, and the prediction value 56 is added with noise t times to obtain the noise action 54 until the training termination condition is reached. The training termination condition includes the convergence of the loss function of the action generation model. After the pre-training of the action generation model is completed, different action sequences 57 can be generated by inputting different conditions.

[0073] Exemplarily, in the fine-tuning stage 60, mainly includes reverse optimization 70 and fine-tuning 80. The reverse optimization 70 is to obtain the sample sequence 75 to the prior style identifier 71, and the style identifier 71 is essentially the role feature or the style feature extracted from the sample sequence 75 by the action generation model. The reverse optimization 70 needs to fix the sample condition representation 72 of the sample sequence, and input the style identifier 71 and the sample condition representation 72 into the action generation model 73 with fixed model parameters, so as to obtain the predicted sequence 74. According to the loss between the predicted sequence 74 and the sample sequence 75, the style identifier 71 is updated, and finally the style identifier that meets the iteration termination condition and makes the loss minimum is calculated. After obtaining the style identifier 71, fine-tuning 80 can be entered. The fine-tuning 80 needs to fine-tune the action generation model 83 based on the sample condition representation 81 and the prior condition representation 82 randomly sampled from the condition space. The sample condition representation 81 is input into the action generation model 83 to generate the sample predicted sequence 84, and the prior condition representation 82 is input into the action generation model 83 to generate the prior predicted sequence 85. And the model parameters of the action generation model 83 are fine-tuned based on the prior loss and the sample loss. The sample loss is the loss between the sample predicted sequence 84 and the sample sequence 86, and the prior loss is the loss between the prior predicted sequence 85 and the prior sequence 87.

[0074] After the fine-tuning 80 ends, inference 90 can be performed, which refers to a way of verifying the prediction ability of the model by using a new condition representation to make a prediction. In the inference 90 stage, the style identifier used in the fine-tuning 80, that is, the style identifier finally generated for the sample sequence in the reverse optimization 70, is used to indicate the style that the action generation model is expected to generate. In the inference 90 stage, the style identifier and the condition input by the user are combined into the user condition 91, which is input into the fine-tuned action generation model 92. The action generation model 92 will perform feature extraction on the style identifier and the condition input by the user to obtain the user condition representation, and then generate a new action sequence 93 that retains the role feature (which can also be said to be the style) of the sample action indicated by the style identifier. It should be noted that this is an example of using the style identifier extracted by the action generation model to indicate the personalized style of the sample sequence, but in fact, the action content identifier, the emotion identifier and the like of the sample sequence can also be extracted by the action generation model. These identifiers can be collectively referred to as identifiers, and the embodiments of the present application do not limit them.

[0075] Figure 5 A flowchart of a training method of an action generation model provided by an example embodiment of the present application is shown. The method is executed by a computer device, which can be the computer device in the above Figure 4 The method includes the following steps.

[0076] Step 210: obtaining a prior condition representation and a prior sequence, the prior sequence having diversified features learned by the action generation model during pre-training; and obtaining a sample condition representation and a sample sequence, the sample sequence having personalized features.

[0077] Optionally, the action generation model is a conditional generation model. The condition representation is a feature representation or a feature vector extracted by the action generation model from at least one of input features, labels, and constraint conditions. The prior condition representation and the sample condition representation can be collectively referred to as a condition representation.

[0078] Optionally, the condition representation can be single-modal or multi-modal. For example, the condition representation is any one of a text feature, an image feature, a music feature, a video feature, and a trajectory feature; or the condition representation includes at least two of the text feature, the image feature, the music feature, the video feature, and the trajectory feature.

[0079] Optionally, the prior sequence is an action sequence having diversified features learned by the action generation model during pre-training. That is, the prior sequence can be an action sequence in a pre-training sample set of the action generation model, or an action sequence generated by the action generation model after pre-training according to the prior condition representation.

[0080] Optionally, the diversified features refer to at least two personalized features learned by the action generation model during pre-training from training samples; or the diversified features refer to different styles learned by the action generation model during pre-training; or the diversified features refer to different action contents learned by the action generation model during pre-training; or the diversified features refer to different styles and action contents learned by the action generation model during pre-training.

[0081] Optionally, the sample sequence is an action sequence having personalized features to be learned by the action generation model, that is, the sample sequence is an action sequence including personalized features expected to be learned by the action generation model, or the sample sequence is an action sequence including personalized features. For example, a user expects the action generation model to be able to generate a series of action instructions such as “an old man stumbles forward”, “an old man shakily retreats”, and “an old man walks a few steps forward and falls down”, but when the text is directly input into the action generation model as a condition, the generated action sequence cannot achieve the expected effect. At this time, the user can first make a sample sequence “an old man walks forward” to make the action generation model learn the personalized features in the sample sequence, such as some gait features and habitual actions.

[0082] Step 220: inputting the prior condition representation into the action generation model to obtain a prior prediction sequence; and inputting the sample condition representation into the action generation model to obtain a sample prediction sequence.

[0083] Optionally, the action generation model generates a prior prediction sequence as a constraint condition based on the prior condition representation, and generates a sample prediction sequence as a constraint condition based on the sample condition representation.

[0084] Step 230: training the action generation model based on the prior loss and the sample loss, the prior loss being obtained based on the prior prediction sequence and the prior sequence, and the sample loss being obtained based on the sample prediction sequence and the sample sequence.

[0085] The training target of the action generation model is to make the prior loss and the sample loss as small as possible, that is, to make the generated prior prediction sequence as similar as possible to the prior sequence, and to make the generated sample prediction sequence as similar as possible to the sample sequence. Alternatively, it can also be understood that the features in the sample action are learned as much as possible while the prior knowledge is preserved as much as possible, so that the action generation model can generate the sample sequence, the prior sequence, and an action sequence with both the features of the prior sequence and the sample sequence.

[0086] In summary, the method provided by the embodiments of the present application protects the prior knowledge of the action generation model through the prior sequence, and the prior loss can be understood as the degree of preservation of the prior knowledge in the adjustment process of the model parameters. At the same time, the sample sequence is learned, and the sample loss can be understood as the learning degree of the action generation model for the sample sequence in the adjustment process of the model parameters. The sample sequence includes the personalized action features learned by the user expected action generation model. Thus, the action generation model trained can learn the personalized features in the sample sequence and preserve the prior knowledge as much as possible without being destroyed by the personalized features.

[0087] For example, the user expects the action generation model to generate a series of action instructions such as “an old man stumbles forward”, “an old man trembles and retreats”, “an old man walks a few steps and falls down”, but when the text is directly input into the action generation model as a condition, the generated action sequence may not achieve the expected effect. At this time, the user can first make a sample sequence “an old man walks forward”, so that the action generation model learns the action features in the sample sequence, such as some gait features and habitual actions. The action generation model can extract the personalized action features in the sample sequence, such as some gait features and habitual actions, during training (which can also be referred to as fine-tuning). After training, the above-mentioned action instructions can achieve an action sequence that is more consistent with the user's expectations. That is, by learning the features included in the sample sequence, the action generation model can achieve personalized customization (generating an action sequence with the same or similar personalized action features as the sample sequence).

[0088] In addition, if the model parameters of the action generation model are adjusted only through the example sequence, the fine-tuned action generation model may tend to generate action sequences with similar characteristics to the example sequence in subsequent use, that is, the action generation model has the overfitting problem in small sample fine-tuning when fine-tuned according to the example sequence. Overfitting refers to the fact that the fine-tuned action generation model tends to generate action sequences similar to the example sequence used for fine-tuning and is difficult to generate new action sequences (i.e., loses the generalization ability or the creativity). At this time, if the fine-tuned action generation model continues to input the example sequence for fine-tuning, if the new example sequence is too small to improve the overfitting problem, the action generation model generated by the continued fine-tuning will tend to generate the input example sequence, and will lose its original learned diversified features, that is, it will be difficult to continue to achieve personalized customization. Training the action generation model based on the example loss and the prior loss can preserve the prior knowledge as much as possible while learning the features in the example action as much as possible, so that the action generation model can generate example sequences, prior sequences, and action sequences with both prior sequence features and example sequence features. For example, if the prior sequence is "an old man shuffles forward", and the example sequence is "a teenager makes a three-step shot", then for the trained action generation model, it is expected that the action generation model can generate the prior sequence "an old man shuffles forward", the prior sequence "a teenager makes a three-step shot", and the action sequence "an old man makes a three-step shot" and "a teenager shuffles forward".

[0089] Next, the specific calculation method of the model loss is shown.

[0090] In the optional embodiment based on Figure 5 , the training method of the action generation model provided by the embodiment of the present application is shown. Figure 6 The flowchart of the training method of the action generation model provided by the embodiment of the present application is shown.

[0091] Step 231: Calculate the model loss of the action generation model, the model loss being the sum of the first intermediate value and the second intermediate value, the first intermediate value being the product of the prior loss and the prior weight, and the second intermediate value being the product of the example loss and the example weight.

[0092] Optionally, the prior weights are determined based on expert experience; or, the prior weights are set by the user; or, the prior weights are dynamically adjusted during the training process based on the desired training effect, where the training process refers to the training process for the same batch of sample sequences. For example, for the first batch of sample sequences, it is desirable to retain more prior knowledge, so the prior weight is set to 1; for the second batch of sample sequences, it is desirable to learn more about the characteristics of the sample sequences in that batch, so the prior weight is set to 0.8. A batch refers to the grouping of training samples during model training. Each batch of training samples (sample sequences) is input into the action generation model simultaneously or sequentially. The action generation model calculates the total model loss corresponding to a batch of training samples, typically using the mean or median of these model losses as the total model loss corresponding to the training samples in that batch. The action generation model updates the model parameters based on the total model loss until the action generation model converges for the training samples in that batch. Training for the next batch is then performed. It should be noted that the embodiment of the present application does not limit the training batches of the action generation model, and can be adjusted during training according to the number and characteristics of the training samples.

[0093] Optionally, the sample weights are determined based on expert experience; or, the sample weights are user-defined; or, the sample weights are dynamically adjusted during training based on training results, where the training process refers to the training process for the same batch of sample sequences. The dynamic adjustment of sample weights during training based on expected training results is similar to the dynamic adjustment of a priori weights during training based on expected training results, and will not be further described here.

[0094] Optionally, the prior loss includes at least a priori generation loss, and the sample loss includes at least a sample generation loss. The priori generation loss is the generation loss between the priori prediction sequence and the prior sequence, and the sample generation loss is the generation loss between the sample prediction sequence and the sample sequence. Generation loss is used to indicate the degree of similarity or difference between the predicted sequence (i.e., the priori prediction sequence and the sample prediction sequence) and the true sequence (i.e., the prior sequence and the sample sequence). That is, during the training of the action generation model, the prior sequence and the sample sequence are regarded as the true sequence or the sequence that the action generation model is expected to generate. At the beginning of the training of the action generation model, since the model parameters of the action generation model have not yet been adjusted, the generated priori prediction sequence is the same or similar to the prior sequence generated using the action generation model before the start of training; but since the sample sequence is usually an action sequence that the action generation model has not yet learned, there may be a large difference between the sample prediction sequence and the sample sequence. The training goal of the action generation model is to continuously adjust the model parameters to balance the prior loss and sample loss, so that the action generation model can learn the sample sequence as much as possible while retaining the prior knowledge as much as possible.

[0095] Optionally, the prior loss further comprises a prior geometric loss, and the instance loss further comprises an instance geometric loss. The prior geometric loss is a geometric loss between the prior predicted sequence and the prior sequence, and the instance geometric loss is a geometric loss between the instance predicted sequence and the instance sequence. The geometric loss is used to indicate a similarity or a difference degree or a retention degree of geometric characteristics of the joints in the predicted sequence relative to the joints in the real sequence. The geometric characteristics of the joints include positions, rotational poses, velocities, friction forces, etc. of the joints.

[0096] Optionally, the prior loss comprises a prior generation loss and a prior geometric loss, the prior loss is a sum of the prior generation loss and a first intermediate loss, and the first intermediate loss is a product of the prior geometric loss and a first geometric weight; the instance loss comprises an instance generation loss and an instance geometric loss, and the instance loss is a sum of the instance generation loss and a second intermediate loss, and the second intermediate loss is a product of the instance geometric loss and a second geometric weight. The first geometric loss and the second geometric loss have the same or different values.

[0097] Step 232: training the action generation model based on the model loss.

[0098] Optionally, according to the model loss, the model parameters of the action generation model are updated by using a back propagation algorithm. That is, according to the model loss, a gradient vector of each parameter in the model parameters is calculated by using the back propagation algorithm, and the model parameters are updated in the opposite direction of the gradient vector to train the action generation model.

[0099] Optionally, the prior sequence is one or more, and the sample sequence is one or more. When training the action generation model, the training is based on a sample loss corresponding to a sample sequence and a prior loss corresponding to a prior sequence; or, the training is based on a sample loss corresponding to a sample sequence and prior losses corresponding to multiple prior sequences; or, the training is based on sample losses corresponding to multiple sample sequences and prior losses corresponding to multiple prior sequences, and the multiple sample sequences and the multiple prior sequences can be combined in any manner, for example, there are multiple sample sequences {a1, a2} and multiple prior sequences {b1, b2, b3}, and in the training process of the action generation model, a model loss of the action generation model can be calculated based on a sample loss corresponding to the sample sequence a1 and a prior loss corresponding to the prior sequence b1, a model loss of the action generation model can be calculated based on a sample loss corresponding to the sample sequence a1 and a prior loss corresponding to the prior sequence b2, a model loss of the action generation model can be calculated based on a sample loss corresponding to the sample sequence a1 and a prior loss corresponding to the prior sequence b3, a model loss of the action generation model can be calculated based on a sample loss corresponding to the sample sequence a2 and a prior loss corresponding to the prior sequence b1, a model loss of the action generation model can be calculated based on a sample loss corresponding to the sample sequence a2 and a prior loss corresponding to the prior sequence b2, and a model loss of the action generation model can be calculated based on a sample loss corresponding to the sample sequence a2 and a prior loss corresponding to the prior sequence b3; and the action generation model is trained based on at least one of the above model losses. The embodiments of the present application are exemplified by one sample sequence and one prior sequence, but this is not limited thereto.

[0100] In summary, the method provided by the embodiments of the present application shows how to update the model parameters of the action generation model based on the sample loss and the prior loss. First, the model loss is calculated based on the sample loss and the prior loss, and the final model loss is determined according to the desired degree of retention of prior knowledge and the degree of learning of new knowledge (sample sequence). The action generation model obtained by training can have the desired prior knowledge and new knowledge, thereby achieving personalized fine-tuning of the action generation model. The action generation model obtained by training can generate both the prior sequence learned in the pre-training stage and the sample sequence learned in the fine-tuning stage, and can also generate a new action sequence combining the features of the prior sequence and the sample sequence. Moreover, since the prior knowledge is retained, the action generation model does not overfit after the current round of fine-tuning, and can continue to be fine-tuned according to the requirements in the actual application process, thereby realizing the personalized requirements of action generation.

[0101] Further, during the training of the action generation model, only one example sequence and one prior sequence are used. Because the data amount of one example sequence and one prior sequence is small, the action generation model can quickly learn the individualized features in the example sequence while retaining the prior knowledge. This method has low requirements for the performance of the computer device used, and can be widely used in small computer devices, such as mobile phones, vehicle-mounted terminals, etc. Using one example sequence and multiple prior sequences can reduce the overfitting risk caused by the similarity between the example sequence and the prior sequence (if the example sequence is similar to the prior sequence, the action generation model has a high probability of generating a similar action sequence), and improve the protection degree of the action generation model for prior knowledge. Using multiple example sequences and multiple prior sequences can reduce the probability of overfitting because of the large number of samples (example sequences and prior sequences) used in training, and enable the action generation model to learn multiple individualized features, thereby achieving batch learning and greatly improving the training efficiency of the action generation model in use scenarios that require learning of multiple individualized features.

[0102] In order to achieve better training effect, the action generation model usually needs to be trained for multiple rounds. The specific training method is as follows.

[0103] In the optional embodiment based on Figure 6 , as shown in Figure 7 , step 231 can be implemented as step 2311, and step 232 can be implemented as step 2321 and step 2322.

[0104] In some embodiments, the 0th round action generation model is an initial action generation model, and the initial action generation model is a pre-trained action generation model capable of generating diversified action sequences. The initial action generation model can also be referred to as the 0th round action generation model, or the action generation model trained for 0 rounds, or the action generation model trained for the 0th round.

[0105] Step 2311: In the i-th round of training, the i-th round model loss is calculated, the i-th round model loss is the sum of the i-th round first intermediate value and the i-th round second intermediate value, the i-th round first intermediate value is the product of the i-th round prior loss and the prior weight, and the i-th round second intermediate value is the product of the i-th round example loss and the example weight, i is a positive integer.

[0106] Wherein, the i-th round prior loss is the loss between the i-th round prior prediction sequence and the prior sequence, the i-th round prior prediction sequence is generated by inputting the prior condition representation into the action generation model trained for the (i-1)th round, and the i-th round example loss is the loss between the i-th round example prediction sequence and the example sequence, the i-th round example prediction sequence is generated by inputting the example condition representation into the action generation model trained for the (i-1)th round.

[0107] That is, in the i-th round of training, the prior condition representation is input into the action generation model trained in the (i-1)-th round to generate an i-th round of prior prediction sequence; and the sample condition representation is input into the action generation model trained in the (i-1)-th round to generate an i-th round of sample prediction sequence. An i-th round of prior loss is calculated, which is the loss between the i-th round of prior prediction sequence and the prior sequence; and an i-th round of sample loss is calculated, which is the loss between the i-th round of sample prediction sequence and the sample sequence. An i-th round of model loss is calculated, which is the sum of an i-th round of first intermediate value and an i-th round of second intermediate value, the i-th round of first intermediate value is the product of the i-th round of prior loss and the prior weight, and the i-th round of second intermediate value is the product of the i-th round of sample loss and the sample weight.

[0108] Optionally, inputting the prior condition representation into the action generation model trained in the (i-1)-th round to generate an i-th round of prior prediction sequence can be understood as that the action generation model trained in the (i-1)-th round generates the i-th round of prior prediction sequence based on the prior condition representation. Inputting the sample condition representation into the action generation model trained in the (i-1)-th round to generate an i-th round of sample prediction sequence can be understood as that the action generation model trained in the (i-1)-th round generates the i-th round of sample prediction sequence based on the sample condition representation.

[0109] Optionally, the action generation model trained in the (i-1)-th round generates the i-th round of prior prediction sequence based on the prior condition representation, including: the action generation model trained in the (i-1)-th round generates the i-th round of prior prediction sequence based on the prior condition representation and noise data, the noise data being noise with the same dimension or dimension randomness as the sample sequence collected by the action generation model, the noise data being sampled from at least one of Gaussian distribution, uniform distribution, multinomial distribution or exponential distribution by the action generation model; or, the action generation model trained in the (i-1)-th round generates the i-th round of prior prediction sequence based on the prior condition representation and latent representation, the latent representation being a corresponding latent feature representation of a training sample learned by the action generation model during pre-training.

[0110] Optionally, the action generation model trained in the (i-1)-th round generates the i-th round of prior prediction sequence based on the prior condition representation and noise data, including: the action generation model trained in the (i-1)-th round denoises the noise data T times according to the prior condition representation to obtain the i-th round of prior prediction sequence, T being a positive integer; or, the action generation model trained in the (i-1)-th round uses a generator to generate the noise data according to the prior condition representation to obtain the i-th round of prior prediction sequence.

[0111] Optionally, the action generation model trained in the i-1th round generates the i th round of prior prediction sequence based on the prior condition representation and the latent representation, including: the action generation model trained in the i-1th round decodes the latent representation using the decoder to obtain the i th round of prior prediction sequence based on the prior condition representation.

[0112] Optionally, the action generation model trained in the i-1th round generates the i th round of sample prediction sequence based on the sample condition representation, including: the action generation model trained in the i-1th round generates the i th round of sample prediction sequence based on the sample condition representation and noise data, the noise data being noise of the same dimension as the sample sequence collected by the action generation model, the noise data being sampled by the action generation model from at least one of Gaussian distribution, uniform distribution, multinomial distribution or exponential distribution; or, the action generation model trained in the i-1th round generates the i th round of sample prediction sequence based on the sample condition representation and the latent representation, the latent representation being a corresponding latent feature representation of the training sample learned by the action generation model during pre-training.

[0113] Optionally, the action generation model trained in the i-1th round generates the i th round of sample prediction sequence based on the sample condition representation and the noise data, including: the action generation model trained in the i-1th round denoises the noise data T times to obtain the i th round of sample prediction sequence according to the sample condition representation, T being a positive integer; or, the action generation model trained in the i-1th round generates the i th round of sample prediction sequence using the generator to generate the noise data according to the sample condition representation.

[0114] Optionally, the action generation model trained in the i-1th round generates the i th round of sample prediction sequence based on the sample condition representation and the latent representation, including: the action generation model trained in the i-1th round decodes the latent representation using the decoder to obtain the i th round of sample prediction sequence based on the sample condition representation.

[0115] Step 2321: determining the i th round of model parameters that reduce the i th round of model loss.

[0116] Optionally, according to the model loss, the gradient information corresponding to the model loss is calculated using the back propagation algorithm, and the i th round of model parameters is determined according to the gradient information, the i th round of model parameters being the model parameters that reduce the model loss of the action generation model.

[0117] Optionally, an optimization algorithm is used to determine the i-th round model parameters that reduce the model loss of the action generation model. Optimization algorithms include gradient descent, stochastic gradient descent, and Adam optimization. Gradient descent is an iterative optimization algorithm that updates model parameters by calculating the gradient of the model loss with respect to the model parameters. At each iteration, the model parameters are updated in the negative direction of the gradient (i.e., the direction in which the loss function decreases most rapidly), in the hope of minimizing the model loss. Gradient descent can be batch gradient descent, where all samples are used to calculate the gradient to update the parameters. Stochastic gradient descent is a variant of gradient descent that uses the gradient of only one sample to update the parameters at each iteration. It has fast computational speed and can update model parameters online, making it suitable for large-scale datasets and real-time applications. Adam optimization is an adaptive learning rate optimization algorithm that combines the concepts of momentum and adaptive gradient algorithms. It dynamically adjusts the learning rate of each parameter by calculating first-order moment estimates (similar to momentum) and second-order moment estimates (similar to adaptive gradient algorithms). The Adam optimization method adaptively balances the learning speed of different parameters during training, and performs well for sparse gradients or non-stationary objective functions. Furthermore, the Adam optimization method typically converges quickly and performs well in many deep learning applications.

[0118] Step 2322: Update the model parameters of the action generation model to the i-th round model parameters to obtain the action generation model that has undergone the i-th round of training.

[0119] In summary, the method shown in the present application, in each round of training, inputs the prior condition representation into the action generation model that has been trained in the previous round to obtain a priori prediction sample; and inputs the sample condition representation into the action generation model that has been trained in the previous round to obtain a sample prediction sample. The prior loss is the loss between the prior prediction sample and the prior sample, and the sample loss is the loss between the sample prediction sample and the sample sample. In the training process of the action generation model, in addition to training based on the sample loss, training is also based on the prior loss, thereby preserving the prior knowledge of the action generation model during pre-training, and preventing the overfitting problem in small sample fine-tuning. If the model parameters of the action generation model are adjusted only through the sample sequence, the fine-tuned action generation model may be more inclined to generate action sequences with similar features to the sample sequence during subsequent use, resulting in the action sequence generated by the action generation model after continued fine-tuning tending to generate the input sample sequence more and more, and losing its originally learned diverse features, that is, it is difficult to continue to achieve personalized customization. Retaining prior knowledge during the training process can avoid overfitting problems, thereby ensuring that the fine-tuned action generation model can continue to meet personalized customization needs.

[0120] Generally, the fine-tuning stage is to enable the action generation model to learn the features in the example sequence and generate an action sequence similar to the example sequence based on part of the features. For example, the example sequence is "an old man is walking forward", the animator or user may expect the action generation model to learn some features about "old man" in the example sequence, and then generate new action sequences such as "an old man is staggering forward" and "an old man makes a three-step layup" based on the feature "old man". Therefore, in order to guide the action generation model to generate based on part of the features in the example sequence later, the features need to be identified, and then a conditional representation is added to the action generation model according to the identification for the generation of a new action sequence. In related technologies, identifiers are usually used for identification. However, the identifiers in related technologies are usually manually set, for example, the identifier of the example sequence "an old man is walking forward" is "old man". At this time, if the action generation model has learned some features a about "old man" before, but the feature of the old man shown in the example sequence is feature b, when generating according to the identifier "old man" actually, the action generation model may generate based on feature a, or may generate based on feature b, or may generate based on feature a and feature b. At this time, the language drift problem occurs, that is, the feature described by the user using the identifier "old man" is different from the feature related to the identifier "old man" saved in the action generation model, and the language drift occurs for the identifier "old man". Language drift refers to the difference or change between the language or data distribution of the action generation model and the language or data distribution of the actual application environment (it can be understood that for the same action sequence, the conditional representation of the action sequence in the fine-tuned action generation model is different from the manually identified conditional representation). However, the user actually only expects to generate based on feature b, that is, the prior knowledge in the identifier interferes with the user's personalized customization demand for the action generation model. Next, the identifier design method in the present application is shown.

[0121] In some embodiments, the example conditional representation includes a first conditional representation and a second conditional representation, the second conditional representation being a conditional representation corresponding to the identifier, the identifier being used to identify the personalized feature of the example sequence.

[0122] Optionally, the example conditional representation is used to instruct the action generation model to generate the example sequence based on the example conditional representation, or in other words, the example conditional representation is used to instruct the action generation model to generate an example prediction sequence based on the example conditional representation, the example prediction sequence and the example sequence being used to train the action generation model.

[0123] Optionally, the identifier is used to identify the sample sequence; or, the identifier is used to uniquely identify the sample sequence; or, the identifier is used to identify part of the feature representation in the sample sequence; or, the identifier is used to identify part of the feature representation that needs to be identified in the sample sequence; or, the identifier is used to identify the feature representation to be retained in the sample sequence; or, the identifier is used to identify the action style in the sample sequence, where the action style refers to the characteristics of the performer in the sample sequence; or, the identifier is used to identify the personalized characteristics of the sample sequence.

[0124] Optionally, the first conditional representation is used to indicate the features to be learned in the sample condition other than the features corresponding to the identifier; or, the first conditional representation is the conditional representation other than the identifier in the sample conditional representation; or, the identifier is a part of the conditional representation in the sample conditional representation, which is used to identify the sample sequence; the first conditional representation is another part of the conditional representation in the sample conditional representation; the first conditional representation is the feature to be fused in the sample sequence.

[0125] Based on Figure 5 In an optional embodiment, Figure 8 A flowchart of a method for training an action generation model provided by an exemplary embodiment of the present application is shown, where “obtaining sample conditional representation” in step 210 can be implemented as steps 211 to 213 .

[0126] Step 211: Obtain a first conditional representation, which is a constraint condition to be replaced in a sample sequence; and obtain a second conditional representation, which is obtained by performing feature extraction on the identifier by the action generation model.

[0127] The second conditional representation is a conditional representation corresponding to the identifier, and is obtained by performing feature extraction on the identifier by the action generation model.

[0128] Optionally, the first conditional representation is extracted by the action generation model from the conditions or labels input by the user or developer; or, the first conditional representation is extracted by the action generation model based on the sample sequence; or, the first conditional representation is extracted by the computer device based on the sample sequence and input into the action generation model. For example, the first conditional representation includes a feature representation corresponding to a segment of audio input by the user; or, the first conditional representation includes a feature representation corresponding to a spatial constraint, which is used to indicate the movement trajectory of the performer in the sample sequence, and the feature representation corresponding to the spatial constraint is obtained by the action generation model performing feature extraction on the input sample sequence; or, the first conditional representation includes a feature representation corresponding to the action content, which is extracted by the computer device using a preset action recognition method and input into the action generation model.

[0129] Step 212: input the first conditional representation and the second conditional representation into the pre-trained action generation model to obtain a predicted sequence.

[0130] Optionally, the action generation model is a pre-trained action generation model; or, the action generation model is an action generation model that has not started the training method of the action generation model; or, the action generation model is an action generation model trained according to other sample sequences; or, the action generation model is an action generation model that has not been trained according to the sample sequence. That is, the action generation model is not in the training process.

[0131] Step 213: update the identifier based on the loss between the predicted sequence and the sample sequence.

[0132] Optionally, based on the loss between the predicted sequence and the sample sequence, the model parameters of the action generation model are fixed, and the identifier is updated. Specifically, the identifier is updated in the direction of reducing the loss between the predicted sequence and the sample sequence.

[0133] In summary, the method provided by the embodiments of the present application sets an identifier for the sample sequence, so that the identifier can identify part of the features in the sample sequence. In the application process of the motion generation model, the user or the animation producer can instruct the motion generation model to generate a motion sequence with similar or identical features to the features reserved by the identifier. For example, for the sample sequence "an old man walks forward", the identifier reserved for the character feature "old man" can be determined according to the character feature (or the motion generation model determines the identifier according to the first conditional representation, i.e., the motion feature "walks forward", and the feature representation of the character feature extracted from the sample sequence). When the motion generation model is used, the motion about "old man" can be generated based on the identifier reserved for the character feature. Since the identifier is not directly specified as "old man" or other information with priori such as "old man 111" or "old 1231", but is generated by the motion generation model itself, that is, the identifier is the information that best represents the feature representation to be reserved in the sample sequence and does not have priori information. Therefore, when personalized customization is performed based on the identifier, the reserved features in the sample sequence can be completely reserved and will not be disturbed by the priori knowledge in the motion generation model, that is, a series of new motions about "old man" can be generated, such as "an old man is walking" and "an old man is pacing". If the motion feature "walks forward" in the sample sequence is expected to be reserved, the identifier reserved for the motion feature can be determined according to the motion feature "walks forward" (or the motion generation model determines the identifier according to the first conditional representation, i.e., the character feature "old man", and the feature representation of the motion feature extracted from the sample sequence). The user can define the features expected to be reserved (set as the identifier) and the features expected to be diversified or replaced (set as the first conditional representation) in the input sample sequence to perform personalized customization.

[0134] Similarly, in order to achieve better de-priori effect, the generation of the identifier also needs multiple iterations.

[0135] In the optional embodiment based on Figure 8 , as shown in Figure 9 , the above step 212 can be implemented as step 2121, and step 213 can be implemented as steps 2131 to 2133.

[0136] Optionally, the identifier is a number; or the identifier is a sequence composed of numbers and letters.

[0137] Optionally, the initial value of the identifier is 0. That is, in the first iteration process, the second conditional representation of the 0th round is obtained by performing feature extraction by the motion generation model based on the identifier "0".

[0138] Step 2121: In the jth iteration, input the first conditional representation and the (j-1)th round of the second conditional representation into the action generation model to obtain the jth round of the predicted sequence, j being a positive integer.

[0139] Optionally, inputting the (j-1)th round of the second conditional representation and the first conditional representation into the action generation model to obtain the jth round of the predicted sequence can be understood as that the action generation model generates the jth round of the predicted sequence based on the (j-1)th round of the second conditional representation and the first conditional representation as constraint conditions.

[0140] Optionally, the action generation model generates the jth round of the predicted sequence based on the (j-1)th round of the second conditional representation and the first conditional representation as constraint conditions includes that the action generation model generates the jth round of the predicted sequence based on the (j-1)th round of the second conditional representation, the first conditional representation as constraint conditions, and noise data as an initial value, the noise data being noise of the same dimension as the sample sequence collected by the action generation model, the noise data being sampled by the action generation model from at least one of a Gaussian distribution, a uniform distribution, a multinomial distribution, or an exponential distribution; or, the action generation model generates the jth round of the predicted sequence based on the (j-1)th round of the second conditional representation, the first conditional representation as constraint conditions, and a latent representation as an initial value, the latent representation being a corresponding latent feature representation of a training sample learned by the action generation model during pre-training.

[0141] Optionally, the action generation model generates the jth round of the predicted sequence based on the (j-1)th round of the second conditional representation and the first conditional representation as constraint conditions and noise data as an initial value includes that the action generation model takes the (j-1)th round of the second conditional representation and the first conditional representation as constraint conditions, and performs T times of denoising on the noise data to obtain the jth round of the predicted sequence, T being a positive integer; or, the action generation model takes the (j-1)th round of the second conditional representation and the first conditional representation as constraint conditions, and uses a generator to generate the noise data to obtain the jth round of the predicted sequence.

[0142] Optionally, the action generation model generates the jth round of the predicted sequence based on the (j-1)th round of the second conditional representation and the first conditional representation as constraint conditions and a latent representation as an initial value includes that the action generation model takes the (j-1)th round of the second conditional representation and the first conditional representation as constraint conditions, and uses a decoder to decode the latent representation to obtain the jth round of the predicted sequence.

[0143] Step 2131: Based on the loss between the jth round of the predicted sequence and the sample sequence, update the (j-1)th round of the identifier to obtain the jth round of the identifier.

[0144] In the jth iteration, based on the loss between the jth round of the predicted sequence and the sample sequence, obtain the jth round of the identifier loss, and update the (j-1)th round of the identifier according to the identifier loss.

[0145] The identifier is updated using the back propagation algorithm. That is, according to the identification loss, a gradient vector corresponding to the identifier is calculated using the back propagation algorithm, and the (j-1)th identifier is updated in the opposite direction of the gradient vector to obtain the jth identifier.

[0146] Step 2132: obtaining the jth second conditional representation, which is obtained by performing feature extraction on the jth identifier by the action generation model.

[0147] Optionally, the action generation model comprises a feature extraction module configured to extract the user input condition into a conditional representation. The feature extraction module is configured to perform feature extraction on the conditions of each modality to obtain the corresponding conditional representation.

[0148] Step 2133: updating j to j+1, and continuing to perform the jth iteration process until the jth identifier satisfies an iteration termination condition.

[0149] Optionally, the iteration termination condition is that the identification loss corresponding to the jth identifier reaches a minimum value; or, the iteration termination condition is that the identifier corresponding to the jth identifier reaches a minimum value; or, the iteration termination condition is that the identification loss corresponding to the jth identifier converges.

[0150] In summary, the method provided by the embodiments of the present application shows a method for an action generation model to extract an identifier, which obtains an identifier that minimizes or minimizes the loss between a predicted sequence generated based on a second conditional representation and a first conditional representation and a sample sequence through continuous iteration optimization. It can be understood that the continuous iteration is to obtain the conditional representation related to the identifier in the sample sequence, and the conditional representation is taken as the second conditional representation in the next iteration process until the identifier that minimizes the loss between the predicted sequence and the sample sequence is obtained, and the identifier can identify the individualized feature in the sample sequence. The identifier extracted in this way is not directly input by the user, but is extracted by the action generation model for the sample sequence, which can avoid the user introducing prior information that will affect the judgment of the action generation model. For example, the user sets the identifier for the sample sequence of "an old man walking forward" as "old man", and the action generation model has learned some features a about "old man" before, but the features of the old man shown in the sample sequence are features b, so when generating according to the identifier "old man", the action generation model may generate based on features a, or may generate based on features b, or may generate based on features a and features b. The identifier obtained by the action generation model based on the sample sequence is equivalent to letting the action generation model judge how to describe the individualized feature in the sample sequence by itself, which is the most representative of the individualized feature in the sample sequence, so as to completely and accurately extract the individualized feature in the sample sequence, thereby ensuring the implementation of individualized customization; according to the different types of individualized features corresponding to the identifier (such as role features or action features), the individualized customization can also be more diverse, that is, the type of individualized feature in the sample sequence can be reserved for self-definition, thereby further meeting the individualized customization needs of the user.

[0151] Optionally, the prior sequence is generated by the action generation model that has not started training. That is, obtaining the prior condition representation and the prior sequence comprises: obtaining any prior condition representation from a condition space of the action generation model, the condition space being a set of condition representations learned by the action generation model during pre-training; inputting the prior condition representation into the action generation model to generate the prior sequence. It should be noted that the condition space is a set of condition representations learned by the action generation model during pre-training, but the prior condition representation is not necessarily a condition representation of a training sample used during pre-training, and the prior condition representation can also be a random combination of condition representations of multiple training samples used during pre-training; the prior sequence generated based on the prior condition representation is also not necessarily an action sequence of a training sample used during pre-training, and the prior sequence can also be a random combination of action sequences of multiple training samples used during pre-training. For example, the condition representation is a matrix, the condition representations during pre-training of the action generation model include c1, c2 and c3, the prior condition representation can be c1 or c2 or c3, or a combination of part of the parameters in c1 and c2, or a combination of part of the parameters in c2 and c3, or a combination of part of the parameters in c1 and c3, or a combination of part of the parameters in c1, c2 and c3, and the embodiments of the present application do not limit this. During the training of the action generation model, the prior sequence is used as a real sequence or a sequence that the action generation model is expected to generate. At the beginning of the training of the action generation model, since the model parameters of the action generation model have not been adjusted, the prior prediction sequence generated is the same as or similar to the prior sequence generated before the training of the action generation model starts; however, since the sample sequence is usually an action sequence that the action generation model has not learned, there can be a large difference between the sample prediction sequence and the sample sequence. The training target of the action generation model is to continuously adjust the model parameters to balance the prior loss and the sample loss, so that the action generation model learns the sample sequence while retaining as much prior knowledge as possible. The prior sequence is generated before the training starts, and the retention of the prior knowledge of the action generation model is measured by the loss between the prior prediction sequence and the prior sequence during the training, so as to learn the sample sequence on the basis of retaining the prior knowledge.

[0152] In addition to the above training method of the action generation model, the pre-training method of the action generation model is also shown in the embodiments of the present application. Next, the pre-training method provided by the embodiments of the present application is further introduced. It should be noted that the action generation model in the above training method of the action generation model is a pre-trained action generation model, and the pre-training method used can be the pre-training method shown in the present application or any pre-training method in the related art, and the embodiments of the present application do not limit this.

[0153] Figure 10A flowchart of a method for training an action generation model is shown, the method comprising:

[0154] At step 310, at least one training sample is obtained, each training sample comprising an action sequence and a set of condition representations corresponding to the action sequence, the set of condition representations comprising at least two condition representations.

[0155] Optionally, the action sequence is continuous and has a time sequence relationship. The action sequence can be split into multiple frames, and each frame of the action sequence comprises pose information of a performer, i.e., the action sequence can be abstracted as the pose information of the performer in each frame. The performer is the doer or performer of the action in the action sequence. The performer can be a human, an animal, a plant, or other living beings, or a robot, a table, or other man-made objects, and the embodiments of the present application do not limit this.

[0156] Optionally, the pose information of the performer is model pose information. For example, the performer is a human, and the human model corresponding to the performer can be a skeleton model comprising only part of the skeleton, or the human model can be a skeleton model comprising all the skeleton of the human body, or the human model can be a model comprising skin and skeleton, or the human model can be a model wearing clothes; or the performer is an animal, and the animal model corresponding to the performer can be a skeleton model comprising only part of the skeleton, or the animal model can be a skeleton model comprising all the skeleton, or the animal model can be a model comprising fur and skeleton, or the animal model can be a model wearing clothes; or the performer is a robot, and the robot model corresponding to the performer can be a skeleton model comprising part of the skeleton, or the robot model can be a skeleton model comprising all the skeleton, and the embodiments of the present application do not limit this. Next, the representation form of the action sequence of the performer as a human is further introduced.

[0157] For example, in the action sequence, only the skeleton of the human is represented, and when the skeleton model needs to be abstracted into feature representation, the skeleton model can be represented as a tree structure, and a plurality of joint nodes in the skeleton model are extracted, each joint node corresponding to a respective parent node, and there is a root node in the plurality of joint nodes of the skeleton, and the parent node of the root node can be a certain point on the world coordinate system of the virtual space. For example, Figure 11To determine a skeleton model 100 by using a three-dimensional human skeleton model, the skeleton model 100 splits the human skeleton into 24 joint nodes, and the root node 0 is the joint node corresponding to the center of the human pelvis. Among them, the parent nodes of the joint node 1, the joint node 2 and the joint node 3 are all the root node 0, the parent node of the joint node 4 is the joint node 1, the parent node of the joint node 5 is the joint node 2, the parent node of the joint node 6 is the joint node 3, …, the parent node of the joint node 23 is the joint node 21, and so on. Optionally, according to the different selected skeleton model, the root node is the joint node corresponding to the center of the human pelvis, or the root node is a node with a height value approximately equal to the average of the height values of a plurality of joint nodes.

[0158] If there are N frames in the action sequence and J joint nodes in the skeleton model, since the human action can be understood as the hinge movement of each joint node in practice, when describing the pose of the skeleton model in a frame in the action sequence, it can be described as the rotation pose of each joint node relative to its parent node. The rotation pose of the joint node relative to its parent node can be described by using a rotation feature. If the number of rotation features is Q, the skeleton model in a frame in the action sequence can be described as wherein G represents the matrix corresponding to the rotation pose of the skeleton model in a frame in the action sequence, which indicates a real set, that is, all the parameters in the matrix are real numbers. In the case of knowing the rotation pose of the skeleton model, the world coordinates of the skeleton model, that is, the absolute position of the skeleton model, or the physical coordinates, or the world coordinates, etc. need to be known. The absolute position of the skeleton model can be represented by the absolute position of the root node, which can be represented as P represents the matrix corresponding to the absolute position of the root node, which indicates a real set, that is, all the parameters in the matrix are real numbers. Therefore, an N-frame action sequence can be represented as x represents the matrix corresponding to the N-frame action sequence, and the matrix has N×(J×Q+3) real number parameters, and each frame has (J×Q+3) real number parameters.

[0159] Among them, the number of rotation features depends on the selected rotation representation, such as rotation matrix, Euler angle, Quaternion rotation representation, etc. The rotation matrix is a matrix used to describe the rotation between two coordinate systems. The Euler angle is a three independent angle parameter used to uniquely determine the position of a rotating rigid body, which consists of nutation angle θ, precession angle (i.e. precession angle) ψ and rotation angle φ. The quaternion is a linear equation including a real number and three imaginary numbers (which can be represented as i, j, k respectively), and the quaternion can be used as a rotation representation in three dimensions. For example, take Figure 11The skeleton model shown as an initial state constructs a three-dimensional coordinate system for each joint, records the initial state of these three-dimensional coordinate systems, and the rotation posture of the skeleton model in each frame of the action sequence is the rotation posture of the joint in the frame relative to the corresponding joint in the initial state. The rotation feature is a feature used to describe the rotation posture.

[0160] Optionally, the action generation model includes a feature extraction module configured to extract the user input conditions into condition representations. The feature extraction module is configured to perform feature extraction on the conditions of each modality to obtain the corresponding condition representations. Alternatively, the computer device includes a feature extraction module configured to extract the user input conditions into condition representations.

[0161] Optionally, the at least two condition representations are extracted from the conditions or labels input by the user or the developer into the action generation model; or, the at least two condition representations are extracted based on the action sequence by the action generation model; or, the at least two condition representations are extracted based on the action sequence by the computer device and input into the action generation model; or, a part of the at least two condition representations are extracted from the conditions or labels input by the user or the developer into the action generation model, and another part of the at least two condition representations are extracted based on the action sequence by the action generation model; or, a part of the at least two condition representations are extracted from the conditions or labels input by the user or the developer into the action generation model, and another part of the at least two condition representations are extracted based on the action sequence by the computer device and input into the action generation model; or, a part of the at least two condition representations are extracted based on the action sequence by the action generation model, and another part of the at least two condition representations are extracted based on the action sequence by the computer device and input into the action generation model. It should be noted that the extraction methods of the at least two condition representations are only some of the extraction methods, and the method is also applicable to extracting the sample condition representations for the sample sequence, and the embodiments of the present application do not limit this.

[0162] Step 320: pre-training the initial model based on the at least one training sample to obtain a pre-trained action generation model, wherein the initial model is a neural network model for generating an action sequence based on a set of condition representations.

[0163] Optionally, the initial model is any conditional generation model or conditional generation network. The conditional generation model is a generation model based on input condition representations; or, the conditional generation model is a neural network model based on input condition representations.

[0164] In an optional embodiment, each training sample includes at least two condition representations corresponding to respective condition types, such asFigure 12 As shown, step 320 can be implemented as steps 321 to 324.

[0165] Step 321: based on a set of condition representations corresponding to each training sample, at least two parallel condition spaces are constructed, each condition space includes condition representations belonging to a same condition type, and the condition types corresponding to each of the at least two condition spaces are different, and the at least two parallel condition spaces are used to indicate that the initial model learns different condition types respectively.

[0166] Optionally, in the pre-training process, at least two condition representations included in each training sample are added to the corresponding condition space as the training sample is obtained. Or, in the pre-training process, the initial model adds the condition representations included in a batch of training samples to the corresponding condition space as the batch of training samples is obtained. Batch refers to the grouping of training samples in the model training process. Each batch of training samples (example sequence) is input into the initial model at the same time or in sequence, the initial model calculates the total loss corresponding to the batch of training samples, usually the mean or median of these losses is used as the total loss corresponding to the batch of training samples, and the initial model updates the model parameters according to the total loss until the initial model converges for the batch of training samples. Then the next batch of training is performed. Or, in the pre-training process, the initial model obtains at least one training sample, and at least two condition spaces are constructed based on at least two condition representations included in each training sample.

[0167] Optionally, one condition type corresponds to one condition space; or, multiple condition types correspond to one condition space. For example, the condition types include {role features, action content, spatial constraints, music features}, at least two condition spaces can be constructed, such as [role features], [action content], [spatial constraints], [music features], or [role features, action content], [spatial constraints], [music features], or [role features, action content], [spatial constraints, music features], or [role features, action content, spatial constraints], [music features], etc. Wherein, the square brackets [] represent a condition space, and one condition space includes condition representations corresponding to one or more condition types.

[0168] Optionally, the at least two parallel conditional spaces are used to indicate that the pre-trained action generation model learns different conditional types respectively, and the at least two parallel conditional spaces refer to at least two independent sets of conditions or condition dimensions. That is, the parallel conditional spaces support the pre-trained action generation model to generate a new action sequence based on the combination of the condition representations in each of the at least two parallel conditional spaces. For example, the at least two parallel conditional spaces include [role features] and [action content], the condition representations included in the conditional space [role features] are {“old man”, “child”, “patient”}, and the condition representations included in the conditional space [action content] are {“staggering”, “crawling”, “walking with a drip”}. Then, the pre-trained action generation model can at least generate the following action sequences corresponding to the condition representations: {“old man staggering”, “old man crawling”, “old man walking with a drip”, “child staggering”, “child crawling”, “child walking with a drip”, “patient staggering”, “patient crawling”, “patient walking with a drip”}. Mapping the condition representations of different conditional types into parallel conditional spaces can realize the decoupling of the pre-trained action generation model to the condition representations of different conditional types, or in other words, realize the decoupling of the conditional spaces.

[0169] Step 322: For each training sample in the at least one training sample, the condition representation of the training sample in the at least two conditional spaces is taken as a constraint condition in the initial model generation process to generate a first prediction sequence.

[0170] Optionally, for each training sample in the at least one training sample, the condition representation of the training sample in the at least two conditional spaces is taken as a constraint condition in the initial model generation process to generate a first prediction sequence, including: for each training sample in the at least one training sample, the initial model obtains a first prediction sequence based on the condition representation of the training sample in the at least two conditional spaces as a constraint condition in the initial model generation process.

[0171] Optionally, for each of the at least one training sample, the initial model generates the first prediction sequence based on the condition representation of the training sample in the at least two condition spaces as a constraint condition in the initial model generation process, including: the initial model generates the first prediction sequence based on the condition representation of the training sample in the at least two condition spaces as a constraint condition in the initial model generation process, and noise data as an initial value, the noise data being noise of the same dimension or dimension randomly collected by the initial model and the action sequence in the training sample, the noise data being sampled from at least one of a Gaussian distribution, a uniform distribution, a polynomial distribution or an exponential distribution; or, the initial model generates the first prediction sequence based on the condition representation of the training sample in the at least two condition spaces as a constraint condition in the initial model generation process, and a latent representation as an initial value, the latent representation being a latent feature representation of the action sequence in the training sample encoded by the initial model using an encoder, the latent feature representation being understood as an important feature in the action sequence, that is, the encoding of the action sequence is to extract the latent feature representation in the action sequence, and the latent feature representation is used to identify all features in the action sequence.

[0172] Optionally, the initial model generates the first prediction sequence based on the condition representation of the training sample in the at least two condition spaces as a constraint condition in the initial model generation process, and noise data as an initial value, including: the initial model takes the condition representation of the training sample in the at least two condition spaces as a constraint condition in the initial model generation process, and performs T times of denoising on the noise data to obtain the first prediction sequence, T being a positive integer; or, the initial model takes the condition representation of the training sample in the at least two condition spaces as a constraint condition in the initial model generation process, and uses a generator to generate the noise data to obtain the first prediction sequence.

[0173] Optionally, the initial model generates the first prediction sequence based on the condition representation of the training sample in the at least two condition spaces as a constraint condition in the initial model generation process, and a latent representation as an initial value, including: the initial model takes the condition representation of the training sample in the at least two condition spaces as a constraint condition in the initial model generation process, and uses a decoder to decode the latent representation to obtain the first prediction sequence.

[0174] Step 323: training the initial model based on the loss between the first prediction sequence and the action sequence.

[0175] Optionally, based on the loss between the first prediction sequence and the action sequence, the model parameters in the initial model are updated to obtain a pre-trained initial model. The method of updating the model parameters based on the loss is similar to steps 2321 and 2322 described above, and will not be described here.

[0176] In an optional embodiment, the pre-training of the action generation model comprises conditional training and unconditional training, the conditional training is that the action generation model is trained according to the predicted sequence generated according to the conditional representation, and the unconditional training is that the action generation model is trained by directly generating the predicted sequence, as shown in formula (3). Figure 12 Step 323 can be implemented as step 3231 and step 3232.

[0177] Step 3231: For each action sequence in the at least one training sample, a second predicted sequence is generated without using the constraint condition in the generation process of the initial model.

[0178] Optionally, for each action sequence in the at least one training sample, the second predicted sequence is generated without using the constraint condition in the generation process of the initial model, comprising: the initial model generates the second predicted sequence based on noise data as an initial value without using the constraint condition in the generation process, the noise data being noise of the same dimension or random dimension as the action sequence in the training sample collected by the initial model, the noise data being sampled by the initial model from at least one of a Gaussian distribution, a uniform distribution, a multinomial distribution or an exponential distribution; or, the initial model generates the second predicted sequence based on a latent representation as an initial value without using the constraint condition in the generation process, the latent representation being a latent feature representation of the action sequence in the training sample encoded by the initial model using an encoder, the latent feature representation being understood as an important feature in the action sequence, that is, the encoding of the action sequence is to extract the latent feature representation in the action sequence, and the latent feature representation is used to identify all features in the action sequence.

[0179] Optionally, the initial model generates the first predicted sequence based on the noise data as the initial value without using the constraint condition in the generation process, comprising: the initial model generates the second predicted sequence by denoising the noise data T times without using the constraint condition in the generation process, T being a positive integer; or, the initial model generates the second predicted sequence by using a generator to generate the noise data without using the constraint condition in the generation process.

[0180] Optionally, the initial model generates the first predicted sequence based on the latent representation as the initial value without using the constraint condition in the generation process, comprising: the initial model generates the second predicted sequence by using a decoder to decode the latent representation without using the constraint condition in the generation process.

[0181] Step 3232: training the initial model based on the first loss and the second loss, the first loss being a loss between the first predicted sequence and the action sequence, and the second loss being a loss between the second predicted sequence and the action sequence.

[0182] Optionally, in the pre-training process, the first loss is calculated based on the manner corresponding to step 322, and the initial model is conditionally trained; meanwhile, the second loss is calculated based on the manner corresponding to step 3231, and the initial model is unconditionally trained.

[0183] In the conditional and unconditional fusion training of the initial model, a null probability is set for the initial model, and the null probability is used to indicate a probability that the conditional representation is nullified when the initial model generates a prediction sequence according to the conditional representation in the training process; the null probability can also be understood as a probability that the initial model is unconditionally trained. For example, the null probability is 10%.

[0184] In the training process of the initial model, the initial model is trained based on the first loss when the conditional representation is not nullified, and the initial model is trained based on the second loss when the conditional representation is nullified.

[0185] Step 324: obtaining the pre-trained action generation model based on the initial model.

[0186] Optionally, the initial model is the pre-trained action generation model; or, in the inference stage, the action generation model is obtained by adjusting the hyperparameters in the initial model.

[0187] In summary, the method provided by the embodiments of the present application shows a pre-training method of the action generation model, which is trained based on the training sample including the action sequence and at least two conditional representations, so as to obtain the pre-trained action generation model. Through the conditional training, the action generation model obtained by training can generate based on different input conditional representations, and the generated new action sequence can conform to the conditional representation, which lays a foundation for using the action generation model for personalized customization.

[0188] Further, it is also shown that at least two conditional representations are mapped into at least two parallel conditional spaces, and the pre-training is based on the at least two parallel conditional spaces. The parallel conditional spaces are one or more independent conditional sets or conditional dimensions. That is, the parallel conditional spaces support the pre-trained action generation model to generate new action sequences based on the combination of the conditional representations in the at least two parallel conditional spaces. For example, the at least two parallel conditional spaces include [character feature] and [action content], the conditional representations included in the conditional space [character feature] are {“old man”, “child”, “patient”}, and the conditional representations included in the conditional space [action content] are {“staggering”, “crawling”, “walking with a drip bottle”}. Then, the pre-trained action generation model can at least generate the following action sequences {“old man staggering”, “old man crawling”, “old man walking with a drip bottle”, “child staggering”, “child crawling”, “child walking with a drip bottle”, “patient staggering”, “patient crawling”, “patient walking with a drip bottle”}. Mapping the conditional representations of different conditional types into parallel conditional spaces can realize the decoupling of the pre-trained action generation model to the conditional representations of different conditional types, or the decoupling of the conditional spaces. Thus, the pre-trained action generation model can at least generate various new action sequences according to the combination of the conditions in the conditional spaces, and further improve the individual customization capability of the pre-trained action generation model.

[0189] Further, in addition to conditional training, the initial model is also unconditionally trained, that is, the initial model can also generate the action sequences in the training samples in the scene without the guidance or constraint of the conditional representation. The implementation of the conditional and unconditional fusion training can prevent the model from overfitting, that is, the model can only generate according to the learned conditional representation, and also improve the generalization capability of the model, so that the model can learn the method of unconditional generation.

[0190] Next, the use process of the action generation model after training is shown. Figure 13 A flowchart of a training method of an action generation model provided by an example embodiment of the present application is shown. The method includes:

[0191] Step 410: obtaining the trained action generation model, the trained action generation model is used to generate n styles of action sequences.

[0192] Optionally, the training of the action generation model is performed using at least n example sequences, and the training method of the action generation model is as shown in the optional embodiment of the above Figures 5 to 12 The at least n example sequences have n individual styles.

[0193] Step 420: obtaining an identifier of a desired style and a user condition, the desired style being one of n styles, and the user condition being used to describe a user desired action sequence.

[0194] Optionally, the user condition can be empty, that is, the generation of the action sequence is only based on the identifier of the desired style.

[0195] Step 430: inputting the user condition and the identifier into the trained action generation model to generate an action sequence with the desired style.

[0196] Optionally, the action generation model performs feature extraction on the user condition and the identifier to obtain a user condition representation, and generates the action sequence with the desired style based on the user condition representation as a constraint condition. The generated action sequence not only has the desired style, but also meets the user condition.

[0197] In an optional embodiment based on Figure 13 , as shown in Figure 14 , step 430 can be implemented as step 431 and step 432.

[0198] Step 431: generating a first output sequence, the first output sequence being generated by the action generation model based on the user condition and the identifier as constraint conditions; and generating a second output sequence, the second output sequence being generated by the action generation model without constraint conditions.

[0199] In the generation process of the action generation model, the action generation model generates the second output sequence based on the sampled noise data without constraint conditions, and generates the first output sequence based on the user condition representation as a constraint condition; or, the action generation model generates the second output sequence based on the sampled latent representation without constraint conditions; and generates the first output sequence based on the input condition representation as a constraint condition.

[0200] Step 432: obtaining an action sequence with the desired style based on the first output sequence and the second output sequence.

[0201] Optionally, the first output sequence and the second output sequence are fused to obtain the action sequence with the desired style.

[0202] Optionally, the action sequence with the personalized feature is the sum of the first output sequence and the second output sequence.

[0203] Optionally, the first output sequence and the second output sequence are interpolated to obtain the action sequence with the desired style. For example, the finally obtained action sequence with the desired style is the sum of the conditional sequence and the unconditional sequence, the conditional sequence is the product of the first output sequence and the conditional weight, and the unconditional sequence is the product of the second output sequence and the unconditional weight.

[0204] In summary, the method provided by the embodiments of the present application shows the specific use process of the trained action generation model, or the prediction process of the action generation model. The user can customize the personalized action with the desired feature by inputting the identifier corresponding to the desired feature. This enables the user to quickly obtain the personalized action with the desired feature, improving the interaction efficiency. Moreover, the desired feature is represented by an identifier, which can be determined according to the sample sequence input by the user in the training process, i.e., the user only needs to provide a sample sequence to enable the action generation model to effectively learn the desired feature and retain the generation mode of the desired feature. Thus, the personalized customization demand of the user for the action sequence with the desired feature is met.

[0205] Further, the above method enables the action sequence finally output by the action generation model to fuse the features corresponding to the conditional generation and the unconditional generation, so that the action sequence finally output by the action generation model can have more diversity on the basis of the conditional representation. When fusing, the weight values corresponding to the first output sequence and the second output sequence can be set, and then the output action sequence is adjusted to be more in line with the condition or more diversified, thereby improving the generation capability of the action generation model and better meeting the personalized customization demand.

[0206] The training of the action generation model mainly includes two stages of model pre-training and personalized fine-tuning. Next, taking the structure of the action generation model as a generative diffusion model (also referred to as a diffusion generation model), the conditions that can be input into the action generation model include character features, action content, and motion trajectories (also referred to as action trajectories and root trajectories), and the two stages will be described in detail.

[0207] 1. Model pre-training

[0208] Step 1, at least one training sample is obtained, and the training sample includes an action sequence, a text prompt, and a spatial constraint.

[0209] The action sequence is a preprocessed sequence. Each frame of the action sequence can be represented as the absolute coordinates of the root node and the rotation information of each joint with respect to the parent joint. The action sequence is used to describe the pose of the skeleton in the virtual space, i.e., the position and posture of the skeleton in the virtual space. When extracting or encoding the features of the skeleton, the skeleton can be represented as a tree structure, and a plurality of joint nodes in the skeleton are extracted, each joint node corresponds to a respective parent node, and there is a root node in the plurality of joint nodes of the skeleton, and the parent node of the root node can be a certain point on the world coordinate system of the virtual space. Depending on the adopted skeletal model, the extracted joint nodes and determined root node in the skeleton are different.

[0210] The text prompt includes a role feature and an action content. The role feature is used to indicate a feature of a performer, i.e., an executor of the action. The action content is text content corresponding to the action sequence. The role feature and the action content can be included in the same text prompt or can be performed separately. For example, the text prompt is "an obese person is walking forward", "obese person" is the role feature, and "walking forward" is the action content; or, the text prompt is "[obese person], [walks forward with hands on hips]".

[0211] Optionally, the text prompt is manually input; or, the text prompt is determined by the action generation model using an action recognition method; or, the text prompt is determined by the server using an action recognition method and added to the training sample.

[0212] The spatial constraint is used to indicate a motion trajectory of a performer in the action sequence corresponding to the training sample. The spatial constraint is a sparse spatial sample (which can also be referred to as a world coordinate / ground plane coordinate) that is uniformly sampled on a root trajectory based on a root node of the action sequence. The root trajectory is a two-dimensional trajectory line formed by each projection point after the root node of the skeleton in the action sequence is projected onto the ground plane. The ground plane is a coordinate plane in a spatial coordinate system. For example, for an action sequence a including 20 frames, the root node of the skeleton in the action sequence a is projected to obtain a root trajectory as shown in (1) of FIG. 6, which includes 20 projection points, i.e., projection point 1 to projection point 20; the root trajectory is uniformly sampled to obtain the projection points of the spatial sample in the spatial constraint corresponding to the action sequence a as shown in (2) of FIG. 6. The sampled points include trajectory point 2, trajectory point 8, trajectory point 11, trajectory point 16, and trajectory point 20, and the purpose of uniform sampling is to obtain sparse points that can represent the trend of the motion trajectory. Optionally, the spatial constraint is constructed according to the coordinates of the sampled trajectory points on the ground plane, or the spatial constraint is constructed according to the coordinates of the sampled trajectory points in the world coordinate system. Figure 15 Figure 15

[0213] Step 2, based on the at least one training sample, at least two conditional spaces are constructed.

[0214] The conditional space includes a conditional representation corresponding to the at least one training sample. The conditional representation includes at least one of a feature representation corresponding to the text prompt in the training sample and a feature representation corresponding to the spatial constraint. The corresponding feature representation can be a feature vector, a feature matrix, a feature tensor, etc., which is not limited by the embodiments of the present application.

[0215] Optionally, feature extraction is performed on the text prompt included in each of the at least one training sample to obtain a text feature c v ,c t , where c v ​​is the feature representation corresponding to the character feature in the feature representation corresponding to the text prompt; c t It is the feature representation corresponding to the action content in the feature representation corresponding to the text prompt.

[0216] Exemplarily, character features in the text prompts included in the training samples are obtained. The character features are pre-processed using methods such as denoising, word segmentation, and standardization. Denoising (also known as text cleaning) is used to remove noise in character features, such as special words and words without semantic information. Word segmentation is used to divide the text into characters, subwords, or words. Characters refer to the basic components of the text, such as each word and punctuation mark in Chinese text or each letter and punctuation mark in English text; subwords refer to the results obtained after dividing long words, unknown words, or unknown phrases in the text. For example, the word "natural" may be divided into the subword unit "natura" and the subword unit "l" during subword division; words refer to meaningful lexical units in the text. For example, in the sentence "I have a cat", "a" is usually divided into one word. Text encoding is performed on the pre-processed character features to obtain the original feature representation corresponding to the character features. Text encoding can be implemented using any text encoder. Optionally, the original feature representation corresponding to the character feature is directly output as the feature representation c corresponding to the character feature. v ; Or, select the feature whose contribution is higher than the contribution threshold from the original feature representation corresponding to the role feature as the feature representation c corresponding to the role feature v , the contribution is used to indicate the degree of influence caused by the feature in the training process; or, the original feature representation corresponding to the role feature is reduced in dimension to obtain the feature representation c corresponding to the role feature v .

[0217] For example, the action content in the text prompt included in the training sample is obtained. The action content is preprocessed by methods such as denoising, word segmentation, and standardization. The preprocessed action content is text-encoded to obtain the original feature representation corresponding to the action content. Optionally, the original feature representation corresponding to the action content is directly output as the feature representation c corresponding to the action content. t ; Or, select the feature whose contribution is higher than the contribution threshold from the original feature representation corresponding to the action content as the feature representation c corresponding to the action content t , the contribution is used to indicate the degree of influence caused by the feature in the training process; or, the original feature representation corresponding to the action content is reduced in dimension to obtain the feature representation c corresponding to the action content t .

[0218] Optionally, feature extraction is performed on the spatial constraint included in each training sample in at least one training sample to obtain a feature representation c corresponding to the spatial constraint. rThe spatial constraint includes the horizontal plane coordinates or absolute coordinates (also referred to as world coordinates) of each projection point, and feature extraction is performed on the spatial constraint to obtain a feature representation c corresponding to the spatial constraint r .

[0219] The at least two conditional spaces are parallel conditional spaces, and the at least two conditional spaces can guide the action generation model to generate actions in parallel.

[0220] The at least two conditional spaces include a text prompt conditional space and a spatial constraint conditional space, and the target of the action generated by the action generation model is to meet both the text prompt and the spatial constraint.

[0221] According to the text prompt in the training sample, a feature representation corresponding to a role feature and a feature representation corresponding to action content are obtained, and the feature representation corresponding to the role feature and the feature representation corresponding to the action content of each training sample are spliced to obtain a text prompt conditional space.

[0222] The text prompt conditional space and the spatial constraint conditional space (splicing the at least two conditional spaces) are spliced to obtain a conditional space corresponding to the action generation model.

[0223] Step 3, training the action generation model according to the at least two conditional spaces and the training sample to obtain a pre-trained action generation model.

[0224] According to the at least two conditional spaces and the training sample, the action generation model is trained conditionally and unconditionally to obtain a pre-trained action generation model.

[0225] Random noise is obtained, and the random noise and the feature representation corresponding to the text prompt and the feature representation corresponding to the spatial constraint in the training sample are input into the action generation model to obtain a predicted sequence; the action generation model is trained according to the loss between the predicted sequence and the action sequence, the loss between the predicted sequence and the action sequence includes a generation loss and a geometric loss, the generation loss (also referred to as a reconstruction loss) is used to measure the difference between the predicted value and the true value, and the geometric loss is used to indicate the error or inconsistency of the predicted sequence in the geometric space. The geometric loss of the action generation model includes a rotation position loss, which is used to indicate the difference between the rotation posture and position of each joint in the predicted sequence and the rotation posture and position of each joint in the action sequence. The loss function of the action generation model may be expressed as follows.

[0226]

[0227] In the formula, represents the generation loss, represents the rotation position loss, and λ posIt is a hyperparameter, that is, a parameter that can be manually set according to the expected effect.

[0228] Among them, the generation loss The calculation formula is as follows.

[0229]

[0230] Where t represents the current time step; T represents the total number of time steps; t~[1:T] represents the value of t from 1 to T; x0 represents the action sequence; x0~q(x0|c) represents that the action sequence obeys the conditional distribution q(x0|c); represents the prediction sequence, That is, the predicted sequence refers to the sequence x at time step t t Predicted by the action generation model under the constraint of condition c; Represents mathematical expectation (Expectation); Indicates the expected calculation of the sampled time step t and action sequence x0.

[0231] The calculation formula for rotational position loss is shown below.

[0232]

[0233] Where, represents the prediction sequence, That is, the predicted sequence refers to the sequence x at time step t t It is predicted by the action generation model under the constraint of condition c; x0 represents the action sequence; s represents the skeleton; FK is the forward kinematics function (also called forward kinematics function) that converts joint rotation into joint position.

[0234] Optionally, during the pre-training phase of the action generation model, the conditional space c is cleared with a probability of 10%, allowing the action generation model to undergo unconditional generation training. That is, the training of the action generation model includes conditional training (obtaining random noise, and inputting the random noise and feature representations corresponding to the text prompts in the training samples and the feature representations corresponding to the spatial constraints into the action generation model to obtain a predicted sequence; training the action generation model based on the loss between the predicted sequence and the action sequence) and unconditional training (obtaining random noise, and inputting the random noise into the action generation model to obtain a predicted sequence; training the action generation model based on the loss between the predicted sequence and the action sequence). The conditional training and unconditional training correspond to a first probability of 0.9 and a second probability of 0.1, respectively.

[0235] Optionally, after the pre-training phase is completed, the action generation model can make conditional and unconditional predictions. In order to make the action generation model obtain more conditional or more diverse actions, the output of the action generation model can be set to fuse the prediction sequence of conditional generation and the prediction sequence of unconditional generation in the inference phase, and the action generation model can be further optimized. The inference phase can be set after the personalized fine-tuning is completed, or the inference phase can be set after the model pre-training and the personalized fine-tuning are completed.

[0236] The prediction sequence finally output by the action generation model is calculated according to the following formula.

[0237]

[0238] In the formula, t represents the t-th time step, x t represents the action sequence at the t-th time step, c represents the spliced at least two condition spaces. γ is a hyperparameter, that is, a parameter that can be manually adjusted by a worker. The larger γ is, the more the prediction sequence finally output by the action generation model conforms to the input condition; the smaller γ is, the more diverse the prediction sequence finally output by the action generation model is.

[0239] 2. Personalized fine-tuning

[0240] Step 1, obtaining at least one example sequence.

[0241] Based on the at least one example sequence, the feature representation corresponding to the action content and the space constraint condition space corresponding to each example sequence are obtained. The obtaining method is as shown in the above pre-training phase, and will not be repeated here.

[0242] Step 2, based on the feature representation corresponding to the action content and the space constraint condition space corresponding to the at least one example sequence, calculating the unique identifier corresponding to the example sequence.

[0243] The unique identifier is used to identify the personalized features of the example sequence, that is, the unique identifier is used to uniquely identify the personalized features corresponding to the example sequence in the action generation model. The unique identifier can also be called a style identifier or an identifier. The unique identifier is the feature representation corresponding to the role feature. The unique identifier is calculated in the following manner.

[0244]

[0245] In the formula, t is a time step; represents an example sequence; represents that the action generation model predicts the sequence based on the condition ; represents the parameter corresponding to the minimum value in the brackets (i.e. the unique identifier that needs to be obtained).

[0246] When performing calculations, Assign an initial value, which can be 0 or other numbers or letters or a combination of numbers and letters. Then iterate and calculate to get the value. The smallest value Serves as a unique identifier for the sample sequence.

[0247] Step 3: determining at least one sample sample based on at least one sample sequence and a unique identifier of each sample sequence; and determining at least one prior sample based on a training sample set of the action generation model.

[0248] Based on each sample sequence in at least one sample sequence and its corresponding unique identifier, determine the sample sample corresponding to the sample sequence, for example, the sample sample is represented as According to the training sample set of the action generation model, at least one training sample in the training sample set is obtained, and a priori sample is determined based on each training sample. The priori sample can be expressed as

[0249] According to the conditional space saved by the action generation model (formed in the pre-training stage), a set of random conditional representations is obtained; the random conditional representations are input into the action generation model to obtain a priori sequence; according to the random conditional representations and the priori sequence, a priori samples are obtained.

[0250] Step 4: fine-tune the action generation model based on at least one example sample and at least one prior sample.

[0251] Obtain an i-th sample sample from at least one sample sample and randomly obtain a prior sample from at least one prior sample; use the i-th sample sample and the randomly obtained prior sample as inputs of an action generation model, respectively, to predict an i-th sample prediction sequence and a prior prediction sequence; adjust model parameters of the action generation model based on a loss between the i-th sample prediction sequence and the sample sequence in the i-th sample sample and a loss between the prior prediction sequence and the action sequence in the prior sample.

[0252] The model parameters of the action generation model are calculated as follows.

[0253]

[0254] Where, θ* is the target model parameter; θ is the original model parameter; represents the conditional space in the sample; represents the sequence of examples in the sample set; represents at least one example sample; represents conditional space in prior samples; represents action sequence in prior samples; represents at least one prior sample; t is a time step; represents example prediction sequence; represents prior prediction sequence; λ gen is a prior weight.

[0255] After the action generation model training is completed, the action generation model can be used for personalized customization of actions. In personalized customization, there are two cases:

[0256] 1. Personalized features have been learned

[0257] Personalized features have been learned means that the personalized features expected to be generated have been trained as example sequences during training. At this time, new actions can be generated based on the identifiers corresponding to the example sequences, or the identifiers corresponding to the personalized features, combined with any conditions.

[0258] 2. Personalized features have not been learned

[0259] Personalized features have not been learned means that the personalized features expected to be generated do not appear in the trained example sequences. At this time, an action sequence with the personalized features can be made as an example sequence, and the training method of the action generation model described above is executed, so as to obtain the identifier corresponding to the personalized features, and then new actions are generated based on the identifier combined with any conditions.

[0260] Specifically, the training method of the action generation model can be applied to the game field. The generated action sequence can be applied to game characters. For example, in order to increase the immersion of game players, game developers usually set different styles of action sequences for different personality NPCs (Non-Player Character, non-player character) in the game. In order to improve the development efficiency of the game, the training method of the action generation model shown in the present application can be used to train an action generation model that can meet the personalized customization requirements. In the pre-training stage, any training sample set including action sequences can be used; in the training stage / fine-tuning stage, a segment of action sequence of the to-be-generated character made by the game developer is used to generate the character identifier of the to-be-generated character; in the inference stage, the to-be-generated identifier and the action description information are used to generate a new action sequence of the to-be-generated character that meets the action description information. The specific implementation process is as follows.

[0261] Step 1, at least one training sample is obtained, each training sample including an action sequence and a set of condition representations corresponding to the action sequence, and the set of condition representations including at least two condition representations.

[0262] Optionally, the training samples are obtained from a public training sample set; or, the training samples are obtained based on a training sample set designed for the game.

[0263] Step 2, pre-training the initial model based on the at least one training sample to obtain a pre-trained action generation model, the initial model being a neural network model for generating an action sequence based on a set of condition representations.

[0264] In some embodiments, based on a set of condition representations corresponding to each training sample, at least two parallel condition spaces are constructed, each condition space including condition representations belonging to a same condition type, the condition types corresponding to respective condition spaces in the at least two condition spaces being different, the at least two parallel condition spaces being used to indicate that the initial model learns different condition types respectively.

[0265] In some embodiments, for each training sample in the at least one training sample, the condition representations of the training sample in the at least two condition spaces are taken as constraint conditions in the generation process of the initial model to generate a first prediction sequence.

[0266] In some embodiments, the initial model is trained based on a loss between the first prediction sequence and the action sequence.

[0267] In some embodiments, the pre-trained action generation model is obtained based on the initial model.

[0268] In some embodiments, the initial model is trained based on a loss between the first prediction sequence and the action sequence, including: for each action sequence in the at least one training sample, generating a second prediction sequence without using constraint conditions in the generation process of the initial model; training the initial model based on a first loss and a second loss, the first loss being a loss between the first prediction sequence and the action sequence, the second loss being a loss between the second prediction sequence and the action sequence.

[0269] Step 3, obtaining prior condition representations and a prior sequence, the prior sequence having diversified features learned by the action generation model in pre-training; and obtaining sample condition representations and a sample sequence, the sample sequence having personalized role features corresponding to a virtual role.

[0270] The sample sequence is an action sequence designed by a game developer for a virtual role, the action sequence having personalized role features corresponding to the virtual role. That is, the sample sequence is an action sequence corresponding to the virtual role. Optionally, the sample sequence is an action sequence designed by the game developer for a new role.

[0271] In some embodiments, obtaining the prior condition representation and the prior sequence comprises: obtaining any prior condition representation from a condition space of the action generation model, the condition space being a set of condition representations learned by the action generation model during pre-training; and inputting the prior condition representation into the action generation model to generate the prior sequence.

[0272] In some embodiments, the sample condition representation comprises a first condition representation and a second condition representation, the second condition representation being a condition representation corresponding to a role identifier used to identify a personalized role feature of the sample sequence; obtaining the sample condition representation comprises: obtaining the first condition representation, the first condition representation being a constraint condition to be replaced in the sample sequence; and obtaining the second condition representation, the second condition representation being obtained by performing feature extraction on the role identifier by the action generation model; inputting the first condition representation and the second condition representation into the pre-trained action generation model to obtain a predicted sequence; and updating the role identifier based on a loss between the predicted sequence and the sample sequence.

[0273] In some embodiments, inputting the first condition representation and the second condition representation into the pre-trained action generation model to obtain the predicted sequence comprises: in a jth iteration process, inputting the first condition representation and a (j-1)th round of the second condition representation into the action generation model to obtain a jth round of the predicted sequence, j being a positive integer; and updating the role identifier based on a loss between the predicted sequence and the sample sequence comprises: updating the (j-1)th round of the role identifier based on a loss between the jth round of the predicted sequence and the sample sequence to obtain a jth round of the role identifier; obtaining a jth round of the second condition representation, the jth round of the second condition representation being obtained by performing feature extraction on the jth round of the role identifier by the action generation model; and updating j to j+1 and continuing to perform the jth iteration process until the jth round of the role identifier satisfies an iteration termination condition.

[0274] Step 4, inputting the prior condition representation into the action generation model to obtain a prior predicted sequence; and inputting the sample condition representation into the action generation model to obtain a sample predicted sequence.

[0275] Step 5, training the action generation model based on a prior loss and a sample loss, the prior loss being obtained based on the prior predicted sequence and the prior sequence, and the sample loss being obtained based on the sample predicted sequence and the sample sequence.

[0276] In some embodiments, a model loss of the action generation model is calculated, the model loss being a sum of a first intermediate value and a second intermediate value, the first intermediate value being a product of the prior loss and a prior weight, and the second intermediate value being a product of the sample loss and a sample weight; and the action generation model is trained based on the model loss.

[0277] In some embodiments, the model loss of the action generation model is calculated, the model loss being a sum of a first intermediate value and a second intermediate value, the first intermediate value being a product of the prior loss and the prior weight, and the second intermediate value being a product of the instance loss and the instance weight, including: in the i-th round of training process, the i-th round of model loss is calculated, the i-th round of model loss being a sum of the i-th round of first intermediate value and the i-th round of second intermediate value, the i-th round of first intermediate value being a product of the i-th round of prior loss and the prior weight, and the i-th round of second intermediate value being a product of the i-th round of instance loss and the instance weight, i being a positive integer; based on the model loss, the action generation model is trained, including: determining the i-th round of model parameters that reduce the i-th round of model loss; and updating the model parameters of the action generation model to the i-th round of model parameters to obtain the action generation model trained in the i-th round.

[0278] In step 6, the trained action generation model is obtained, and the trained action generation model is used to generate the action sequence of the n characters.

[0279] In step 7, the character identifier and the action description information of the to-be-generated character are obtained, the to-be-generated character being one of the n characters, and the action description information being used to describe the action content of the to-be-generated character expected by the user.

[0280] In step 8, the action description information and the character identifier are input into the trained action generation model to generate the action sequence corresponding to the to-be-generated character.

[0281] In some embodiments, the first output sequence is generated, the first output sequence being generated by the action generation model based on the action description information and the character identifier as constraint conditions; and the second output sequence is generated, the second output sequence being generated by the action generation model without constraint conditions.

[0282] In some embodiments, based on the first output sequence and the second output sequence, the action sequence corresponding to the to-be-generated character is obtained. The action sequence is the action sequence of the to-be-generated character satisfying the action description information.

[0283] Please refer to Figure 16 which shows the structure block diagram of the training device of the action generation model provided by an example embodiment of the present application. The device has the function of implementing the example of the above-mentioned training method of the action generation model, which can be realized by hardware or corresponding software executed by hardware. The device can be the computer device introduced above, or can be arranged in the computer device. As Figure 16 shown, the device can include an obtaining module 510, a generating module 520 and a training module 530.

[0284] The acquisition module 510 is configured to acquire a prior condition representation and a prior sequence, the prior sequence having diversified features learned by the action generation model during pre-training, and acquire a sample condition representation and a sample sequence, the sample sequence having personalized features.

[0285] The generation module 520 is configured to input the prior condition representation into the action generation model to obtain a prior predicted sequence, and input the sample condition representation into the action generation model to obtain a sample predicted sequence.

[0286] The training module 530 is configured to train the action generation model based on a prior loss and a sample loss, the prior loss being obtained based on the prior predicted sequence and the prior sequence, and the sample loss being obtained based on the sample predicted sequence and the sample sequence.

[0287] In some embodiments, the training module 530 includes a first calculation submodule and a first training submodule.

[0288] The first calculation submodule is configured to calculate a model loss of the action generation model, the model loss being a sum of a first intermediate value and a second intermediate value, the first intermediate value being a product of the prior loss and a prior weight, and the second intermediate value being a product of the sample loss and a sample weight.

[0289] The first training submodule is configured to train the action generation model based on the model loss.

[0290] In some embodiments, the first calculation submodule is further configured to, in an i-th round of training process, calculate an i-th round of model loss, the i-th round of model loss being a sum of an i-th round of first intermediate value and an i-th round of second intermediate value, the i-th round of first intermediate value being a product of an i-th round of prior loss and the prior weight, and the i-th round of second intermediate value being a product of an i-th round of sample loss and the sample weight, i being a positive integer; the first training submodule is further configured to determine an i-th round of model parameter that reduces the i-th round of model loss; update a model parameter of the action generation model to the i-th round of model parameter to obtain the action generation model after i-th round of training; wherein the i-th round of prior loss is a loss between an i-th round of prior predicted sequence and the prior sequence, the i-th round of prior predicted sequence being generated by inputting the prior condition representation into the action generation model after (i-1)-th round of training, and the i-th round of sample loss is a loss between an i-th round of sample predicted sequence and the sample sequence, the i-th round of sample predicted sequence being generated by inputting the sample condition representation into the action generation model after (i-1)-th round of training.

[0291] In some embodiments, the apparatus further includes a sample acquisition module and a pre-training module.

[0292] The sample obtaining module is configured to obtain at least one training sample, each of the training samples including an action sequence and a set of condition representations corresponding to the action sequence, the set of condition representations including at least two condition representations.

[0293] The pre-training module is configured to pre-train an initial model based on the at least one training sample to obtain a pre-trained action generation model, the initial model being a neural network model configured to generate the action sequence based on the set of condition representations.

[0294] In some embodiments, each of the training samples includes the at least two condition representations corresponding to a respective condition type; and the pre-training module includes a constructing submodule, a first generating submodule, a second training submodule, and a determining submodule.

[0295] The constructing submodule is configured to construct at least two parallel condition spaces based on the set of condition representations corresponding to each of the training samples, each of the condition spaces including condition representations belonging to a same condition type, and the condition types corresponding to the respective condition spaces in the at least two parallel condition spaces being different, the at least two parallel condition spaces being configured to indicate that the initial model learns different condition types respectively.

[0296] The first generating submodule is configured to generate a first predicted sequence by taking, as a constraint condition in a generation process of the initial model, the condition representations of each of the training samples in the at least two condition spaces.

[0297] The second training submodule is configured to train the initial model based on a loss between the first predicted sequence and the action sequence.

[0298] The determining submodule is configured to obtain the pre-trained action generation model based on the initial model.

[0299] In some embodiments, the apparatus further includes a second generating submodule. The second generating submodule is configured to generate a second predicted sequence by not taking a constraint condition in the generation process of the initial model for each of the action sequences in the at least one training sample. The second training submodule is configured to train the initial model based on a first loss and a second loss, the first loss being a loss between the first predicted sequence and the action sequence, and the second loss being a loss between the second predicted sequence and the action sequence.

[0300] In some embodiments, the sample condition representation includes a first condition representation and a second condition representation, the second condition representation being a condition representation corresponding to an identifier, the identifier being used to identify a personalized feature of the sample sequence; the obtaining module 510 includes an obtaining sub-module, a third generation sub-module, and an updating sub-module.

[0301] The obtaining sub-module is configured to obtain the first condition representation, the first condition representation being a constraint condition to be replaced in the sample sequence; and obtain the second condition representation, the second condition representation being obtained by performing feature extraction on the identifier by the action generation model;

[0302] The third generation sub-module is configured to input the first condition representation and the second condition representation into the pre-trained action generation model to obtain a predicted sequence.

[0303] The updating sub-module is configured to update the identifier based on a loss between the predicted sequence and the sample sequence.

[0304] In some embodiments, the third generation sub-module is further configured to, in the jth iteration process, input the first condition representation and a (j-1)th round of second condition representations into the action generation model to obtain a jth round of predicted sequences, j being a positive integer; the updating sub-module is further configured to update the (j-1)th round of identifiers based on a loss between the jth round of predicted sequences and the sample sequence to obtain a jth round of identifiers; obtain a jth round of second condition representations, the jth round of second condition representations being obtained by performing feature extraction on the jth round of identifiers by the action generation model; update j to j+1, and continue to perform the jth iteration process until the jth round of identifiers satisfy an iteration termination condition.

[0305] In some embodiments, the obtaining module 510 is further configured to obtain any prior condition representation from a condition space of the action generation model, the condition space being a set of condition representations learned by the action generation model during pre-training; and input the prior condition representation into the action generation model to generate the prior sequence.

[0306] In some embodiments, the apparatus further includes a model obtaining module, a condition obtaining module, and a sequence generation module.

[0307] The model obtaining module is configured to obtain a trained action generation model, the trained action generation model being used to generate action sequences of n styles;

[0308] The condition obtaining module is configured to obtain an identifier of a desired style and a user condition, the desired style being one of the n styles, and the user condition being used to describe an action sequence desired by a user.

[0309] The sequence generation module is configured to input the user condition and the identifier into the trained action generation model to generate an action sequence with a desired style.

[0310] In some embodiments, the sequence generation module is further configured to generate a first output sequence, the first output sequence being generated by the action generation model based on the user condition and the identifier as constraint conditions, and generate a second output sequence, the second output sequence being generated by the action generation model without constraint conditions; and obtain the action sequence with the desired style based on the first output sequence and the second output sequence.

[0311] It should be noted that the apparatus provided in the above embodiments is only used as an example to illustrate the division of the above functional modules, and in actual applications, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the above described functions. In addition, the apparatus and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process is described in detail in the method embodiments, which will not be described here.

[0312] Figure 17 A structural block diagram of a computer device provided in an example embodiment of the present application is shown.

[0313] The computer device 600 includes a central processing unit (CPU) 601, a system memory 604 including a random access memory (RAM) 602 and a read-only memory (ROM) 603, and a system bus 605 connecting the system memory 604 and the central processing unit 601. The computer device 600 also includes a basic input / output system (I / O system) 606 to help transfer information between various devices in the computer device, and a mass storage device 607 for storing an operating system 613, application programs 614, and other program modules 615.

[0314] The basic input / output system 606 includes the display 608 to display information and input devices 609 such as a mouse, keyboard, etc. to input information by a user. The display 608 and the input devices 609 are connected to the central processing unit 601 through the input / output controller 610 connected to the system bus 605. The basic input / output system 606 can further include the input / output controller 610 to receive and process input from a number of other devices, including a keyboard, mouse, or electronic stylus. Similarly, the input / output controller 610 provides output to the display screen, a printer, or other type of output device.

[0315] The mass storage device 607 is connected to the central processing unit 601 through a mass storage controller (not shown) connected to the system bus 605. The mass storage device 607 and its associated computer readable storage medium provide non-volatile storage for the computer device 600. That is, the mass storage device 607 can include a computer readable storage medium (not shown) such as a hard disk or a Compact Disc Read-Only Memory (CD-ROM) drive.

[0316] Without loss of generality, the computer readable storage medium can include computer storage media and communication media. Computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable storage instructions, data structures, program modules or other data. Computer storage media includes RAM, ROM, Erasable Programmable Read Only Memory (EPROM), Electrically-Erasable Programmable Read-Only Memory (EEPROM), flash memory or other solid state memory technology, CD-ROM, Digital Versatile Disc (DVD), or other optical storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices. Of course, those skilled in the art will recognize that the computer storage media described above can be different from that described above. The system memory 604 and the mass storage device 607 described above can be collectively referred to as memory.

[0317] The memory stores one or more programs configured to be executed by the one or more central processing units 601, and the one or more programs contain instructions for implementing the above-mentioned method embodiments. The central processing unit 601 executes the one or more programs to implement the method provided by each of the above-mentioned method embodiments.

[0318] According to various embodiments of the present application, the computer device 600 may also be connected to a remote computer device on a network such as the Internet for operation. That is, the computer device 600 may be connected to a network 612 via a network interface unit 611 connected to the system bus 605, or the network interface unit 611 may be used to connect to other types of networks or remote computer device systems (not shown).

[0319] The memory also includes one or more programs, which are stored in the memory and include steps executed by a computer device in the method provided in the embodiment of the present application.

[0320] In an exemplary embodiment, a non-transitory computer-readable storage medium is further provided, on which a computer program is stored. When the computer program is executed by a processor, it implements the above-mentioned training method of the action generation model.

[0321] In an exemplary embodiment, a computer program product is also provided. When the computer program product is executed by a processor, it is used to implement the training method of the above-mentioned action generation model.

[0322] It should be understood that the "multiple" mentioned in this article refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent three situations: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and subsequent associated objects are in an "or" relationship. In addition, the step numbers described in this article only illustrate a possible execution sequence between the steps. In some other embodiments, the above steps may not be executed in the order of the numbers, such as two steps with different numbers are executed at the same time, or two steps with different numbers are executed in the opposite order to the diagram. The embodiments of the present application do not limit this.

[0323] The above description is merely an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A training method for an action generation model, characterized in that: The method comprises: Acquire a priori conditional representation and a priori sequence, wherein the priori sequence has diverse features learned by the action generation model during pre-training; and acquire a sample conditional representation and a sample sequence, wherein the sample sequence has personalized features; Inputting the prior condition representation into the action generation model to obtain a prior prediction sequence; and inputting the sample condition representation into the action generation model to obtain a sample prediction sequence; The action generation model is trained based on a priori loss and a sample loss, wherein the priori loss is obtained based on the priori prediction sequence and the prior sequence, and the sample loss is obtained based on the sample prediction sequence and the sample sequence.

2. The method according to claim 1, characterized in that The step of training the action generation model based on the prior loss and the sample loss includes: Calculating a model loss of the action generation model, where the model loss is the sum of a first intermediate value and a second intermediate value, where the first intermediate value is the product of the prior loss and the prior weight, and the second intermediate value is the product of the sample loss and the sample weight; The action generation model is trained based on the model loss.

3. The method according to claim 2, characterized in that The calculating the model loss of the action generation model includes: During the i-th round of training, the i-th round model loss is calculated, where the i-th round model loss is the sum of the i-th round first intermediate value and the i-th round second intermediate value, the i-th round first intermediate value is the product of the i-th round prior loss and the prior weight, the i-th round second intermediate value is the product of the i-th round sample loss and the sample weight, and i is a positive integer; The step of training the action generation model based on the model loss includes: Determining an i-th round model parameter that reduces the i-th round model loss; Updating the model parameters of the action generation model to the i-th round model parameters to obtain the action generation model trained after the i-th round; Among them, the i-th round prior loss is the loss between the i-th round prior prediction sequence and the prior sequence, and the i-th round prior prediction sequence is generated by inputting the prior condition representation into the action generation model trained for the i-1th round. The i-th round sample loss is the loss between the i-th round sample prediction sequence and the sample sequence, and the i-th round sample prediction sequence is generated by inputting the sample condition representation into the action generation model trained for the i-1th round.

4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: Acquire at least one training sample, each of the training samples comprising an action sequence and a set of conditional representations corresponding to the action sequence, wherein the set of conditional representations comprises at least two conditional representations; Based on the at least one training sample, an initial model is pre-trained to obtain a pre-trained action generation model, where the initial model is a neural network model that generates the action sequence based on the set of conditional representations.

5. The method according to claim 4, characterized in that The at least two condition representations included in each training sample have respective condition types in a one-to-one correspondence; The pre-training of the initial model based on the at least one training sample to obtain a pre-trained action generation model includes: Based on a set of conditional representations corresponding to each training sample, construct at least two parallel conditional spaces, each of the conditional spaces including conditional representations belonging to the same conditional type, the conditional types corresponding to each of the at least two conditional spaces being different, and the at least two parallel conditional spaces being used to instruct the initial model to learn different conditional types respectively; For each of the at least one training sample, a conditional representation of the training sample being located in the at least two conditional spaces is used as a constraint in the initial model generation process to generate a first prediction sequence; training the initial model based on a loss between the first prediction sequence and the action sequence; A pre-trained action generation model is obtained based on the initial model.

6. The method according to claim 5, characterized in that The training of the initial model based on the loss between the first prediction sequence and the action sequence includes: For each of the action sequences in the at least one training sample, generating a second prediction sequence without using constraints in the process of generating the initial model; The initial model is trained based on a first loss and a second loss, wherein the first loss is the loss between the first prediction sequence and the action sequence, and the second loss is the loss between the second prediction sequence and the action sequence.

7. The method according to any one of claims 1 to 6, characterized in that: The sample conditional representation includes a first conditional representation and a second conditional representation, wherein the second conditional representation is a conditional representation corresponding to an identifier, and the identifier is used to identify the personalized feature of the sample sequence; The sample acquisition condition representation includes: Obtaining the first conditional representation, where the first conditional representation is a constraint condition to be replaced in the sample sequence; and obtaining the second conditional representation, where the second conditional representation is obtained by performing feature extraction on the identifier by the action generation model; Inputting the first conditional representation and the second conditional representation into the pre-trained action generation model to obtain a prediction sequence; The identifier is updated based on the loss between the predicted sequence and the sample sequence.

8. The method according to claim 7, characterized in that Inputting the first conditional representation and the second conditional representation into the pre-trained action generation model to obtain a prediction sequence includes: In the j-th iteration process, the first conditional representation and the j-1-th round second conditional representation are input into the action generation model to obtain the j-th round prediction sequence, where j is a positive integer; The updating of the identifier based on the loss between the predicted sequence and the sample sequence includes: Based on the loss between the j-th round prediction sequence and the sample sequence, updating the j-1-th round identifier to obtain the j-th round identifier; Obtaining a second conditional representation of the jth round, where the second conditional representation of the jth round is obtained by performing feature extraction on the jth round identifier by the action generation model; Update j to j+1 and continue the j-th iteration process until the j-th round identifier meets the iteration termination condition.

9. The method according to any one of claims 1 to 8, characterized in that: The obtaining of the prior condition representation and the prior sequence includes: Obtaining any prior conditional representation from the conditional space of the action generation model, where the conditional space is a set of conditional representations learned by the action generation model during pre-training; The prior condition representation is input into the action generation model to generate the prior sequence.

10. The method according to claim 7 or 8, characterized in that The method further comprises: Obtaining a trained action generation model, wherein the trained action generation model is used to generate action sequences of n styles; Obtaining an identifier of a desired style and a user condition, wherein the desired style is one of the n styles, and the user condition is used to describe an action sequence desired by the user; The user condition and the identifier are input into the trained action generation model to generate an action sequence with a desired style.

11. The method according to claim 10, characterized in that The step of inputting the user condition and the identifier into the trained action generation model to generate an action sequence with a desired style includes: generating a first output sequence, where the first output sequence is generated by the action generation model based on the user condition and the identifier as constraints; and generating a second output sequence, where the second output sequence is generated by the action generation model without using the constraints; Based on the first output sequence and the second output sequence, an action sequence with a desired style is obtained.

12. A training device for an action generation model, characterized in that: The device comprises: an acquisition module, configured to acquire a priori condition representation and a priori sequence, wherein the priori sequence has diverse features learned by the action generation model during pre-training; and acquire a sample condition representation and a sample sequence, wherein the sample sequence has personalized features; a generation module, configured to input the prior condition representation into the action generation model to obtain a prior prediction sequence; and input the sample condition representation into the action generation model to obtain a sample prediction sequence; A training module is used to train the action generation model based on a priori loss and a sample loss, wherein the priori loss is obtained based on the priori prediction sequence and the prior sequence, and the sample loss is obtained based on the sample prediction sequence and the sample sequence.

13. A computer device, characterized in that: The computer device includes: a processor and a memory, wherein the memory stores at least one program; the processor is used to execute the at least one program in the memory to implement the training method of the action generation model as described in any one of claims 1 to 11.

14. A computer-readable storage medium, characterized in that The computer-readable storage medium stores executable instructions, which are loaded and executed by a processor to implement the training method of the action generation model described in any one of claims 1 to 11.

15. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium. The processor reads and executes the computer instructions from the computer-readable storage medium to implement the training method of the action generation model as described in any one of claims 1 to 11.