CN115240099A - Model training method and device based on multi-mode associated data - Google Patents
Model training method and device based on multi-mode associated data Download PDFInfo
- Publication number
- CN115240099A CN115240099A CN202210704027.3A CN202210704027A CN115240099A CN 115240099 A CN115240099 A CN 115240099A CN 202210704027 A CN202210704027 A CN 202210704027A CN 115240099 A CN115240099 A CN 115240099A
- Authority
- CN
- China
- Prior art keywords
- video
- training
- loss function
- modal
- model
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V20/00—Scenes; Scene-specific elements
- G06V20/40—Scenes; Scene-specific elements in video content
- G06V20/46—Extracting features or characteristics from the video content, e.g. video fingerprints, representative shots or key frames
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/77—Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
- G06V10/774—Generating sets of training patterns; Bootstrap methods, e.g. bagging or boosting
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Artificial Intelligence (AREA)
- Health & Medical Sciences (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Computing Systems (AREA)
- Databases & Information Systems (AREA)
- Evolutionary Computation (AREA)
- General Health & Medical Sciences (AREA)
- Medical Informatics (AREA)
- Software Systems (AREA)
- Image Analysis (AREA)
Abstract
The invention discloses a model training method and a device based on multi-mode associated data, wherein the method comprises the following steps: determining associated data of a training video and a corresponding at least one modality for training a model; inputting the training video and the associated data into a video reconstruction prediction model for training, and calculating a video loss function value between a prediction video output by the video reconstruction prediction model and the input training video and a modal loss function value between the prediction video and at least one input associated data in the training process; and optimizing the model parameters of the video reconstruction prediction model according to the video loss function value and the modal loss function value until convergence, so as to obtain the trained video reconstruction prediction model. Therefore, the method and the device can enable the model to learn the relation between the video and the associated data in the training process, and further enable the model obtained through final training to repair or even rebuild the video according to the associated data.
Description
Technical Field
The invention relates to the technical field of algorithm model training, in particular to a model training method and device based on multi-mode associated data.
Background
With the development of algorithm technology, more and more enterprises begin to use algorithm models to perform video-related data prediction tasks, such as video reconstruction, which requires that algorithm models be able to fully extract the features of videos and learn. However, in the prior art, when training such a model, it is not considered that training data can be constructed based on associated data of different modalities corresponding to a video, nor is it considered that difference loss calculation between different associated data and a video is considered in training at the same time, so that the trained model cannot achieve the effect of video reconstruction according to an image of a certain frame and associated data of a specific modality. Therefore, the prior art has defects and needs to be solved urgently.
Disclosure of Invention
The technical problem to be solved by the invention is to provide a method and a device for determining model training based on multi-mode associated data, which can enable a model to learn the relation between a video and the associated data in the training process, and further enable the model obtained by final training to repair or even rebuild the video according to the associated data.
In order to solve the technical problem, a first aspect of the present invention discloses a model training method based on multi-modal associated data, including:
determining a training video for training the model;
determining associated data of at least one modality corresponding to the training video;
inputting the training video and the associated data into a video reconstruction prediction model for training, and calculating a video loss function value between a prediction video output by the video reconstruction prediction model and the input training video and a modal loss function value between the prediction video and at least one input associated data in the training process;
and optimizing the model parameters of the video reconstruction prediction model according to the video loss function values and the modal loss function values until convergence, so as to obtain the trained video reconstruction prediction model.
As an alternative embodiment, in the first aspect of the present invention, the modality includes at least one of an audio modality, a text modality, and an image modality; and/or the associated data comprises at least one of descriptive audio data, descriptive text data and characterizing image data.
As an alternative implementation, in the first aspect of the present invention, the training of the training video and the associated data input into the video reconstruction prediction model, and the calculating of the video loss function value between the input training video and the prediction video output by the video reconstruction prediction model and the modal loss function value between the input at least one associated data and the prediction video in the training includes:
performing frame extraction operation on the training video to obtain a plurality of training video frames corresponding to the training video;
inputting the plurality of training video frames and the associated data into a video reconstruction prediction model for training;
calculating, in the training, video loss function values between a plurality of predicted video frames output by the video reconstruction prediction model and the plurality of training video frames input, and modal loss function values between the predicted video and at least one of the associated data input.
As an optional implementation manner, in the first aspect of the present invention, the determining the association data of at least one modality corresponding to the training video is performed by:
determining a target representation frame image from the plurality of training video frames, and copying the target representation frame image to obtain a plurality of copied representation frame images;
and determining the plurality of copied representation frame images as representation image data corresponding to the training video.
As an optional implementation manner, in the first aspect of the present invention, the performing a frame extraction operation on the training video to obtain a plurality of training video frames corresponding to the training video includes:
determining a frame extraction interval corresponding to the training video according to the video parameters of the training video;
and performing frame extraction operation on the training video according to the frame extraction interval to obtain a plurality of training video frames corresponding to the training video.
As an alternative implementation, in the first aspect of the present invention, the video reconstruction prediction model includes a video reconstruction network and a modal reconstruction network; the video reconstruction network is used for receiving the training video and the associated data and reconstructing the prediction video; the modal reconstruction network is used for extracting the associated data characteristics of the modal corresponding to the prediction video; the correlation data characteristics are used for comparing with the correlation data to calculate the modal loss function value; the modal reconstruction network is obtained by training convergence of a training data set comprising a plurality of training videos and corresponding training associated data of the modal;
and optimizing the model parameters of the video reconstruction prediction model according to the video loss function value and the modal loss function value until convergence to obtain the trained video reconstruction prediction model, comprising:
and keeping the parameters of the modal reconstruction network unchanged during training, and optimizing the network parameters of the video reconstruction network according to the video loss function value and the modal loss function value until convergence to obtain the trained video reconstruction network.
As an optional implementation manner, in the first aspect of the present invention, the optimizing the model parameters of the video reconstruction prediction model according to the video loss function value and the modal loss function value until convergence includes:
calculating a weighted sum of the video loss function values and the modal loss function values;
and optimizing the model parameters of the video reconstruction prediction model according to the weighted sum value until convergence.
As an alternative implementation, in the first aspect of the present invention, the video loss function value is calculated as follows:
for any one of the predicted video frames, calculating a frame loss function value between the predicted video frame and the corresponding training video frame;
and calculating the average value of the frame loss function values of all the prediction video frames to obtain the loss function values between a plurality of prediction video frames and the input training video frames.
The invention discloses a model training device based on multi-modal associated data in a second aspect, which comprises:
the video determining module is used for determining a training video for training the model;
the association determining module is used for determining association data of at least one modality corresponding to the training video;
the model training module is used for inputting the training video and the associated data into a video reconstruction prediction model for training, and calculating a video loss function value between a prediction video output by the video reconstruction prediction model and the input training video and a modal loss function value between the prediction video and at least one input associated data in the training process;
and the model optimization module is used for optimizing the model parameters of the video reconstruction prediction model according to the video loss function values and the modal loss function values until convergence, so as to obtain the trained video reconstruction prediction model.
As an alternative embodiment, in the second aspect of the present invention, the modality includes at least one of an audio modality, a text modality, and an image modality; and/or the associated data comprises at least one of descriptive audio data, descriptive text data and characterizing image data.
As an alternative embodiment, in the second aspect of the present invention, the model training module includes:
the frame extracting operation unit is used for performing frame extracting operation on the training video to obtain a plurality of training video frames corresponding to the training video;
the model training unit is used for inputting the training video frames and the associated data into a video reconstruction prediction model for training;
a loss calculation unit, configured to calculate, in the training, video loss function values between a plurality of predicted video frames output by the video reconstruction prediction model and the plurality of input training video frames, and modal loss function values between the predicted video and at least one input of the associated data.
As an optional implementation manner, in the second aspect of the present invention, the association data is characterizing image data, and the specific manner of determining the association data of at least one modality corresponding to the training video by the association determination module includes:
determining a target representation frame image from the plurality of training video frames, and copying the target representation frame image to obtain a plurality of copied representation frame images;
and determining the plurality of copied representation frame images as representation image data corresponding to the training video.
As an optional implementation manner, in the second aspect of the present invention, a specific manner in which the frame extracting operation unit performs a frame extracting operation on the training video to obtain a plurality of training video frames corresponding to the training video includes:
determining a frame extraction interval corresponding to the training video according to the video parameters of the training video;
and performing frame extraction operation on the training video according to the frame extraction interval to obtain a plurality of training video frames corresponding to the training video.
As an alternative embodiment, in the second aspect of the present invention, the video reconstruction prediction model includes a video reconstruction network and a modal reconstruction network; the video reconstruction network is used for receiving the training video and the associated data and reconstructing the prediction video; the modal reconstruction network is used for extracting the associated data characteristics of the modal corresponding to the prediction video; the correlation data characteristics are used for comparing with the correlation data to calculate the modal loss function value; the modal reconstruction network is obtained by training convergence of a training data set comprising a plurality of training videos and corresponding training associated data of the modal;
and the model optimization module optimizes the model parameters of the video reconstruction prediction model according to the video loss function values and the modal loss function values until convergence, so as to obtain a specific mode of the trained video reconstruction prediction model, and the specific mode comprises the following steps:
and keeping the parameters of the modal reconstruction network unchanged during training, and optimizing the network parameters of the video reconstruction network according to the video loss function value and the modal loss function value until convergence to obtain the trained video reconstruction network.
As an optional implementation manner, in the second aspect of the present invention, a specific manner in which the model optimization module optimizes the model parameters of the video reconstruction prediction model according to the video loss function values and the modal loss function values until convergence includes:
calculating a weighted sum of the video loss function values and the modal loss function values;
and optimizing the model parameters of the video reconstruction prediction model according to the weighted sum value until convergence.
As an alternative implementation, in the second aspect of the present invention, the video loss function value is calculated as follows:
for any one of the predicted video frames, calculating a frame loss function value between the predicted video frame and the corresponding training video frame;
and calculating the average value of the frame loss function values of all the prediction video frames to obtain the loss function values between a plurality of prediction video frames and the input training video frames.
The invention discloses another model training device based on multi-modal associated data in a third aspect, which comprises:
a memory storing executable program code;
a processor coupled with the memory;
the processor calls the executable program code stored in the memory to execute part or all of the steps of the model training method based on the multi-modal associated data disclosed in the first aspect of the embodiment of the invention.
In a fourth aspect of the present invention, a computer storage medium is disclosed, where the computer storage medium stores computer instructions, and when the computer instructions are called, the computer instructions are used to perform part or all of the steps in the model training method based on multi-modal associated data disclosed in the first aspect of the embodiments of the present invention.
Compared with the prior art, the embodiment of the invention has the following beneficial effects:
in the embodiment of the invention, a training video for training a model is determined; determining associated data of at least one modality corresponding to the training video; inputting the training video and the associated data into a video reconstruction prediction model for training, and calculating a video loss function value between a prediction video output by the video reconstruction prediction model and the input training video and a modal loss function value between the prediction video and at least one input associated data in the training process; and optimizing the model parameters of the video reconstruction prediction model according to the video loss function values and the modal loss function values until convergence, so as to obtain the trained video reconstruction prediction model. Therefore, the model can be trained based on the training video and the corresponding associated data of the specific modality, and the modality loss between the prediction video and the associated data is considered in the training, so that the model can learn the relation between the video and the associated data in the training, and the model obtained by final training can repair or even rebuild the video according to the associated data.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a schematic flowchart of a model training method based on multi-modal associated data according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of another model training method based on multi-modal associated data according to an embodiment of the present invention;
FIG. 3 is a schematic structural diagram of a model training apparatus based on multi-modal associated data according to an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of another model training apparatus based on multi-modal associated data according to the embodiment of the present invention;
FIG. 5 is a schematic structural diagram of another model training apparatus based on multi-modal associated data according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terms "first," "second," and the like in the description and claims of the present invention and in the above-described drawings are used for distinguishing between different objects and not necessarily for describing a particular sequential or chronological order. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, apparatus, article, or article that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or article.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the invention. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
The invention discloses a model training method and device based on multi-mode associated data, which can train a model based on a training video and corresponding associated data of a specific mode, and consider mode loss between a prediction video and the associated data in training, so that the model can learn the relation between the video and the associated data in training, and the model obtained by final training can repair or even rebuild the video according to the associated data. The following are detailed below.
Example one
Referring to fig. 1, fig. 1 is a schematic flow chart diagram of a model training method based on multi-modal associated data according to an embodiment of the present invention. The method described in fig. 1 is applied to a video data processing apparatus, where the processing apparatus may be a corresponding processing terminal, a corresponding processing device, or a corresponding processing server, and the server may be a local server or a cloud server, which is not limited in the embodiment of the present invention. As shown in fig. 1, the model training method based on multi-modal associated data may include the following operations:
101. a training video for training the model is determined.
Optionally, the video content of the training video may be determined according to the target processing video content of the model to be trained, and may also include various types of video content, so as to improve the adaptive characteristic of the trained model. Optionally, the video content of the training video may be a continuous motion or a continuous scene, and since the scheme of the present invention adds assistance of the associated data, a picture shot or a scene in the video content of the training video may be switched.
102. And determining the associated data of at least one modality corresponding to the training video.
Optionally, the modalities may include at least one of an audio modality, a text modality, and an image modality. Accordingly, the associated data may include at least one of descriptive audio data, descriptive text data, and characterizing image data.
Optionally, the associated data is related to the content of the training video, and may be used to express part of features of the training video, and the associated data may be written by an operator according to the content of the training video, or may be generated by automatic prediction through other video content algorithms, which is not limited in the present invention.
103. Inputting a training video and associated data into a video reconstruction prediction model for training, and calculating a video loss function value between a prediction video output by the video reconstruction prediction model and an input training video and a modal loss function value between the prediction video and at least one input associated data in the training.
104. And optimizing the model parameters of the video reconstruction prediction model according to the video loss function value and the modal loss function value until convergence, so as to obtain the trained video reconstruction prediction model.
Alternatively, the loss function value may be an L1 loss function value or an L2 loss function value, or other loss function values suitable for calculating the similarity between images or texts, which is not limited in the present invention.
Optionally, a gradient descent method may be used to continuously optimize the model parameters until the loss function value reaches the minimum, so that the model converges to obtain a trained video reconstruction prediction model.
Therefore, the method can train the model based on the training video and the corresponding associated data of the specific modality, and considers the modality loss between the prediction video and the associated data in the training process, so that the model can learn the relation between the video and the associated data in the training process, and the finally trained model can repair or even rebuild the video according to the associated data.
As an alternative implementation, in the above steps, inputting a training video and associated data into a video reconstruction prediction model for training, and calculating a video loss function value between a prediction video output by the video reconstruction prediction model and an input training video in the training, and a modal loss function value between the prediction video and at least one input associated data, the method includes:
performing frame extraction operation on the training video to obtain a plurality of training video frames corresponding to the training video;
inputting a plurality of training video frames and associated data into a video reconstruction prediction model for training;
and calculating video loss function values between a plurality of prediction video frames output by the video reconstruction prediction model and a plurality of input training video frames in training, and modal loss function values between the prediction video and at least one input relevant data.
Optionally, the frame extracting operation may be performed manually, or may be performed automatically according to a predetermined frame extracting interval by an algorithm, which is not limited in the present invention.
Through the arrangement, the training video can be subjected to frame extraction to obtain a small number of video frames which can be used for representing the characteristics of the training video and serve as training data, and the data volume and the workload can be effectively reduced.
As an alternative embodiment, the determining the association data of at least one modality corresponding to the training video in the above step includes:
determining a target representation frame image from a plurality of training video frames, and copying the target representation frame image to obtain a plurality of copied representation frame images;
and determining the plurality of copied representation frame images as the representation image data corresponding to the training video.
Optionally, the target characterization frame image may be a first training video frame of the training video frames, that is, a first frame image, and by setting this, the training model may learn the image relationship between the first frame image and the entire video. Alternatively, the target representation frame image may be a video frame with a key representation function in a plurality of training video frames, for example, a landmark appears in a picture, or a video frame belonging to a turning point of a scenario in the whole video, and it may also train the model to learn an image relationship between the key frame image and the whole video. Optionally, the number of the images of the duplicate characterization frame trained by each input model may be the same as the number of the training video frames, so as to facilitate the subsequent loss calculation.
As an optional implementation manner, the video reconstruction prediction model includes a video reconstruction network and a modality reconstruction network, where the video reconstruction network is configured to receive the training video and the associated data and reconstruct the prediction video, and the modality reconstruction network is configured to extract associated data features of a modality corresponding to the prediction video.
Specifically, the associated data features are used for comparing with the associated data to calculate a modal loss function value, and the modal reconstruction network is obtained by training convergence through a training data set including a plurality of training videos and training associated data of corresponding modalities, that is, the modal reconstruction network is trained before a video reconstruction prediction model is trained, and can be directly used for extracting the associated data features of a specific modality.
Alternatively, the modal reconstruction network may be a text reconstruction network or an audio reconstruction network.
Optionally, the modality reconstruction network may be trained in advance using the original video frames and associated data of the corresponding modalities. That is, a video frame is input to the modal reconstruction network, smoothL1 loss between the output feature vector and the vector of the associated data is calculated, and training of the modal reconstruction network is completed by optimizing the loss value to convergence.
Optionally, the video reconstruction network may be configured to receive a plurality of copied representation frame images and associated data and reconstruct a plurality of predicted video frames, and accordingly, the video loss function value may be a video loss function value between a plurality of predicted video frames output by the video reconstruction prediction model and a plurality of input training video frames.
Optionally, in the above step, optimizing the model parameters of the video reconstruction prediction model according to the video loss function value and the text loss function value until convergence, so as to obtain a trained video reconstruction prediction model, including:
and keeping the parameters of the modal reconstruction network unchanged during training, and optimizing the network parameters of the video reconstruction network according to the video loss function values and the modal loss function values until convergence to obtain the trained video reconstruction network.
Specifically, in the training process, the parameters of the modal reconstruction network are frozen, only the network parameters of the video reconstruction network are optimized, and finally the video reconstruction network obtained through training can be used for reconstructing the video.
Optionally, the modality reconstruction network includes an embedding module, a Transformer module, and a full connection layer module.
Specifically, a modality reconstruction network can be constructed to maintain semantic association between video frames and associated data, and the modality reconstruction network is composed of an Embedding layer, 2 transform modules and a full connection layer, and is used for receiving video frames reconstructed and output by a decoder of the video reconstruction network, reconstructing feature vectors of a specific modality from the video frames through the modality reconstruction network, and optimizing distances between initial coding feature vectors corresponding to the associated data through a modality loss function.
As an alternative embodiment, the video reconstruction network includes an encoder and a decoder, where the encoder is configured to extract the features and the decoder is configured to restore the features. Optionally, the encoder includes a video embedding layer, a modality embedding layer, a feature fusion layer, and a first transform layer. The video embedding layer is used for receiving training video frames and processing the training video frames to obtain video characteristics, the modal embedding layer is used for receiving associated data and processing the associated data to obtain modal characteristics, the characteristic fusion layer is used for fusing the video characteristics and the modal characteristics to obtain training characteristics, and the training characteristics are input to the first transform layer.
Wherein the video embedding layer comprises a two-dimensional convolutional layer and/or a three-dimensional convolutional layer.
Optionally, a two-dimensional convolution image block Embedding layer (Patch Embedding) may be constructed as a video Embedding layer, and is used to replace the high-dimensional original image features with a lower-dimensional vector, and optionally, the image block Embedding layer is composed of a convolution layer, the size of the convolution kernel is equal to the size of the step size, and the number of output channels is selected 768 (or others).
Optionally, a three-dimensional convolved video block Embedding layer may also be constructed as the video Embedding layer, that is, a 3D Patch Embedding layer, and the convolution is performed in the spatial and temporal dimensions through the three-dimensional convolution layer, so as to additionally extract the correlation characteristics between the previous and subsequent frames. Specifically, in order to ensure that each frame has characteristics of front-back correlation, the step size of convolution is not necessarily equal to the depth size of convolution, that is, the step size may be equal to 1, for example, the convolution depth is equal to 2, and the step size is equal to 1, at this time, a feature vector is obtained by three-dimensional convolution of the first frame and the second frame, then, a feature vector … … is obtained by the second frame and the third frame, if the convolution depth is equal to 2, the step size is also equal to 2, at this time, a feature vector is obtained by convolution of the first frame and the second frame, then, convolution characteristics between the third frame and the fourth frame are directly calculated, and characteristics between the second frame and the third frame are not calculated.
Specifically, all input video frames are converted into corresponding feature vectors through the video embedding layer. Taking a specific implementation of the two-dimensional convolved image block embedding layer as an example, for example, 30 frames of video frames, the image size of each frame is 224 × 224, the dimension is (30,3,224,224), 3 represents RGB triple channels, the convolution kernel size is (16,16), the step size is 16, the result is (30,768,14,14) after conversion, and then the result is transformed into a feature vector (30,768,196). Subsequently, the order of the dimensions is exchanged and a class mark is added at the initial position of the dimension 196 for processing the downstream tasks such as classification, and the dimension of the finally obtained feature is (30,197,768).
Optionally, the modality Embedding layer may include a Tokenizer module and an Embedding module, wherein the Tokenizer module is configured to convert the input data unit of the associated data into a token index, and then the Embedding module encodes the token index into the feature vector.
Optionally, the feature fusion layer may include a first fully-connected layer, a second fully-connected layer, a feature fusion module, and a GELU activation layer. And the input feature dimensions of the first full-connection layer and the second full-connection layer need to be equal so as to fuse the features of the first full-connection layer and the second full-connection layer. The first full connection layer is used for receiving the output characteristics of the video embedding layer and performing conversion of a characteristic space, the second full connection layer is used for receiving the output characteristics of the modal embedding layer and performing conversion of the characteristic space, and the characteristic fusion module can perform fusion, splicing and fusion or other fusion methods on the characteristics of the first full connection layer and the second full connection layer by using characteristic addition mean value fusion or splicing fusion, and performs conversion through the GELU activation layer to obtain the characteristics finally obtained by fusion.
In a specific scheme, associated data is description text data, corresponding to text features, in order to better fuse video frame features and text features together, two full-connection layers are respectively constructed for conversion of a feature space, a feature vector dimension of a video frame is (30,197,768), the text features are not added with position marks, when a maximum text length 196 is used, the corresponding feature vector dimension is (1,196,768), the two features are spliced on a 1 st dimension (starting from 0), and the dimension order of the spliced features is changed, that is: (30, 197+196, 768) - > (30, 768,197+ 196), then inputting into a full connection layer, the output dimension is (30,768,197), finally, carrying out nonlinear transformation by using a layer of GELU activation layer to obtain the fused feature, and the dimension of retransformation is (30,197,768).
Optionally, the first Transformer layer includes a plurality of stacked Transformer modules, and the structure of the first Transformer layer may refer to the structure of an encoder of a VIT (Vision Transformer) network.
Therefore, by implementing the optional implementation mode, an encoder structure capable of fully extracting and fusing the characteristics of the video frame and the associated data can be constructed, so that the prediction effect of the model is better.
As an alternative embodiment, the decoder includes a first fully-concatenated layer, a second transform layer, and a second fully-concatenated layer.
Specifically, the decoder first uses a full link layer to merge and transform the features of the encoder. Then, the video frame is composed of a plurality of transform modules, and finally, a full connection layer is adopted to generate a video frame at a pixel level.
It can be seen that by implementing this alternative embodiment, a decoder structure that can sufficiently reconstruct the features of the video frame can be constructed, so that the prediction effect of the model is better.
As an optional implementation manner, in the foregoing step, optimizing the model parameters of the video reconstruction prediction model according to the video loss function value and the modal loss function value until convergence includes:
calculating a weighted sum of the video loss function value and the modal loss function value;
and optimizing the model parameters of the video reconstruction prediction model according to the weighted sum until convergence.
Optionally, weights corresponding to the video loss function value and the modal loss function value may be adjusted by a technician according to an experimental value or an empirical value, so as to achieve a best characterization effect.
Optionally, the video loss function value is calculated as follows:
for any prediction video frame, calculating a frame loss function value between the prediction video frame and the corresponding training video frame;
and calculating the average value of the frame loss function values of all the predicted video frames to obtain the loss function values between the plurality of predicted video frames and the plurality of input training video frames.
In a specific embodiment, the reconstruction process of the final video frame involves a training optimization loss comprising two parts, the first part is an image reconstruction loss of the video frame reconstructed by the decoder and the original video frame, and a SmoothL1 loss can be adopted. Respectively calculating reconstruction loss between each decoded video frame and a corresponding real frame, then calculating the loss average value of each frame to be used as final reconstruction loss, wherein the second part is modal association loss between the video and the associated data, namely a modal loss function, re-expressing a feature vector of a modality corresponding to the associated data from the reconstructed video frame by using a trained modal reconstruction module, and calculating the distance between the feature vector and an original feature vector of the associated data, wherein the part of loss is also optimized by adopting Smoothl 1. In the training process, the parameters of the modal reconstruction module are frozen and do not participate in the parameter updating process.
In particular, since the video frames input to the encoder are all identical (stacked from a particular frame image), the task of the decoder is actually to make local modifications of the image on the basis of the existing video frames, based on the input associated data. If only the reconstruction loss of the video frame is used, the reconstruction effect of part of the frames is good, and the reconstruction effect of the rest of the frames is poor easily in the training process. And semantic information expressed by a reconstructed video frame sequence is chaotic because only the similarity between a reconstructed frame and an original frame is considered, and the continuity between the whole reconstructed frame is not considered. Therefore, a modal loss function needs to be added, modal associated information is re-expressed from the reconstructed video frame, and the distance between the feature of the reconstructed associated data and the feature vector of the original associated data is shortened, so that the reconstructed video frame sequence can also express complete associated information, and the continuity of the reconstructed video frame is maintained.
Specifically, the two losses are balanced by setting different weighting factors. The video loss function considers the similarity between two video frames from the perspective of each frame, and the modal loss function considers the correlation as a whole. Since the parameters of the modal reconstruction network are fixed, the magnitude of the modal loss function value is directly dependent on the overall similarity of the reconstructed video frame sequence to the original video frame sequence. When the reconstructed video frame sequence is closer to the original video frame sequence, the reconstructed modal characteristics are closer to the modal characteristics of the original associated data, and finally, a model with better video reconstruction effect can be trained.
Example two
Referring to fig. 2, fig. 2 is a schematic flowchart of another model training method based on multi-modal associated data according to an embodiment of the present invention. The method described in fig. 2 is applied to a video data processing apparatus, where the processing apparatus may be a corresponding processing terminal, a corresponding processing device, or a corresponding processing server, and the server may be a local server or a cloud server, which is not limited in the embodiment of the present invention. As shown in fig. 2, the model training method based on multi-modal associated data may include the following operations:
201. a training video for training the model is determined.
202. And determining the associated data of at least one mode corresponding to the training video.
203. And determining the frame extraction interval corresponding to the training video according to the video parameters of the training video.
Optionally, the video parameters may include a picture change parameter and/or a video scene parameter, which may be used to characterize the complexity of the video content, and when the complexity is higher, the frame extraction interval should be shortened to obtain more video frames, so that the video frames may sufficiently reflect the video content, and when the complexity is lower, the frame extraction interval may be appropriately increased to obtain fewer video frames.
204. And performing frame extraction operation on the training video according to the frame extraction interval to obtain a plurality of training video frames corresponding to the training video.
Optionally, the frame extraction interval according to the present invention may be a time interval or a frame number interval.
Optionally, a plurality of frame extraction time points may be determined at intervals of frame extraction intervals according to a time sequence or a frame number sequence, and then video frames corresponding to the frame extraction time points in the training video are acquired, so as to obtain a plurality of training video frames corresponding to the training video. It should be noted that the time interval or frame number interval between adjacent video frames in the plurality of training video frames is not necessarily strictly the above-mentioned frame extraction interval, because when the frame extraction is performed according to the time sequence or frame number interval, the last frame may be directly determined as a training video frame when the interval of the last part is insufficient.
Optionally, after obtaining a plurality of training video frames corresponding to the training video, the plurality of training video frames and the identifier (such as a storage path, a video ID, and the like) of the training video may be bound and stored for subsequent training.
205. And inputting a plurality of training video frames and associated data into a video reconstruction prediction model for training.
206. And calculating video loss function values between a plurality of prediction video frames output by the video reconstruction prediction model and a plurality of input training video frames in training, and modal loss function values between the prediction video and at least one input relevant data.
207. And optimizing the model parameters of the video reconstruction prediction model according to the video loss function value and the modal loss function value until convergence, so as to obtain the trained video reconstruction prediction model.
The specific technical details and technical noun explanations of the steps 201-202 and 205-207 may refer to the description of the steps 101-104 in the first embodiment and the technical details of other steps with the same description, and are not repeated herein.
Therefore, the method described by the embodiment of the invention can determine the reasonable frame extraction interval, so that the proper video frame capable of representing the video content can be obtained by frame extraction, and the prediction effect of the trained model is better.
As an alternative embodiment, the decimation interval comprises a plurality of different decimation intervals. Correspondingly, in the above steps, performing frame extraction on the training video according to the frame extraction interval to obtain a plurality of training video frames corresponding to the training video may include:
and respectively carrying out frame extraction operation on the training video according to a plurality of different frame extraction intervals so as to respectively obtain a plurality of training video frame groups corresponding to the training video.
Optionally, each training video frame set is used as training data for a single input in training the video reconstruction prediction model.
Optionally, each training video frame group includes a plurality of training video frames.
Specifically, in order to amplify the data set, the same training video may be decimated at a plurality of different decimation intervals, for example, 5 frames per second and 2 frames per second, and the corresponding sequence of video frames may show a slow-fast difference. Optionally, frame extraction of the training video may be performed before the whole training is started, frame extraction in advance may greatly reduce training time consumption, if a dynamic frame extraction interval is selected to be adopted in a training stage to perform frame extraction on the short video, although a data set may be greatly enriched, data enhancement is achieved, but the frame extraction speed is often slow, and frame extraction is required again for each training iteration, which undoubtedly seriously delays the whole training process.
As an optional implementation manner, in the above step, performing frame extraction on the training video according to the frame extraction interval to obtain a plurality of training video frames corresponding to the training video, includes:
performing frame extraction operation on the training video according to the frame extraction interval to obtain a plurality of candidate video frames corresponding to the training video;
calculating the picture similarity between any two adjacent candidate video frames;
judging whether the picture similarity meets a preset similarity threshold condition or not;
if the judgment result is yes, determining the two candidate video frames as key video frames;
and determining a plurality of training video frames corresponding to the training video according to all key video frames in the candidate video frames.
Optionally, the picture similarity may be a structural similarity parameter or a cosine similarity parameter. Optionally, the similarity threshold condition may be that the picture similarity is greater than a certain similarity threshold, at this time, the two candidate video frames are not similar, it may be considered that picture switching has occurred between the two frames, and the two frames are retained as critical key frames.
As an optional implementation manner, in the foregoing step, determining, according to all key video frames in the plurality of candidate video frames, a plurality of training video frames corresponding to the training video includes:
performing frame extraction operation on other candidate video frames except the key video frame in the plurality of candidate video frames according to a second frame extraction interval to obtain a plurality of extracted video frames; the second frame extraction interval is greater than the frame extraction interval;
and determining all the key video frames and the extracted video frames as a plurality of training video frames corresponding to the training video.
Optionally, the determining manner of the second decimation frame interval may be:
determining the total number of all other candidate video frames;
and determining a second frame extraction interval according to the corresponding relation between the total frame number and a preset frame number-interval.
The second frame extraction interval is proportional to the total frame number, i.e. the more the total frame number, the more the remaining video content, therefore, the larger the second frame extraction interval is, the less the number of frames is extracted, because at this time, for the video with more content but less picture conversion, it is not necessary to extract too many frames, and vice versa.
Optionally, determining a plurality of training video frames corresponding to the training video according to all key video frames in the plurality of candidate video frames may also include:
calculating the picture similarity between at least two other candidate video frames for other candidate video frames except the key video frame in the plurality of candidate video frames;
and reserving all candidate video frames of which the mutual picture similarity meets the similarity threshold condition so as to determine a plurality of training video frames corresponding to the training video.
Specifically, a video may be decimated at a smaller decimation interval, for example, the frame rate of the video is 30, a decimation interval of 10 frames per second is selected, 50 corresponding frames can be obtained from 5 seconds of the video, then, the picture similarity between two consecutive frames in the 50 frames is calculated, and when the similarity is greater than a set maximum threshold m, it is considered that picture switching has occurred between the two frames, and the two frames are retained as critical key frames. After all key frames with picture switching in the video are reserved by the method, continuous frames except the key frames are screened at equal intervals to extract frames, at the moment, the second frame extraction interval of the extracted frames can be determined according to the final required sequence total length, and self-adaptive selection can be carried out by calculating the picture similarity between the continuous frames, for example, the similarity between a first frame and a second frame is smaller than a set minimum threshold value n, namely the difference between the two pictures is considered to be smaller, the picture redundancy is higher, only the first frame is reserved, and the second frame is removed; and comparing the third frame with the first frame, removing the next frame as long as the third frame is less than a set threshold n until the next frame is greater than the minimum threshold n or a critical key frame, and then retaining.
The key frame selection method for picture switching is provided for enabling the model to learn the characteristic change process of picture switching, so that the finally reconstructed video can also show a certain picture switching special effect or picture continuity.
As an optional implementation manner, in the foregoing step, determining a frame extraction interval corresponding to the training video according to the video parameter of the training video includes:
determining picture change parameters of a training video;
and determining the frame extraction interval corresponding to the training video according to the picture change parameters and the preset parameter threshold condition.
Alternatively, the picture change parameter may be an optical flow value parameter between different frames of the training video, such as an average or a highest or weighted average of the amount of optical flow motion between all adjacent frames. Accordingly, the parameter threshold condition may be a light flow value threshold condition.
Preferably, the optical flow value between each frame may be calculated, and the frame-extraction interval may be determined by limiting the amount of optical flow movement between each frame, for example, a threshold of optical flow variation is set, and after statistics, it is found that the optical flow variation of each K frames just exceeds the threshold, the frame-extraction interval may be set as K frames. If the amount of optical flow motion between each frame is large, a smaller decimation interval may be chosen.
Therefore, by implementing the optional implementation mode, a more reasonable frame extraction interval can be determined according to the picture change parameters, so that the video content of the video frame can be determined reasonably and efficiently, and the training efficiency of the model is improved.
As an optional implementation manner, in the foregoing step, determining a frame extraction interval corresponding to the training video according to the video parameter of the training video includes:
determining video scene parameters of a training video;
and determining a frame extraction interval corresponding to the training video according to the corresponding relation between the video scene parameters and the preset scene frame extraction.
Optionally, the video scene parameter may be a scene type of the training video. Optionally, the scene frame extraction correspondence is used to indicate frame extraction intervals corresponding to different types of scenes, for example, the short video mainly includes motion changes of some human bodies, such as a basket-up motion of a section of human body, the whole motion speed is fast, and the change between each frame is relatively obvious, so that a smaller frame extraction interval may be selected at this time. If the content of the short video changes slowly or has a certain rule, if the automobile slowly runs in a mountain lane, the automobile data recorder records the road condition in front, and the trees at two sides move towards the lens regularly; with regular or slower variation, larger decimation intervals can be used. Specifically, the frame extraction intervals are different for different task scenes.
Optionally, the number of different types of scenes appearing in the training video may be used to indicate the degree of scene change or the complexity of the video content, and optionally, the scene frame extraction correspondence is used to indicate a frame extraction interval corresponding to the number of different types of scenes, generally speaking, the frame extraction interval is inversely proportional to the number of the scenes, that is, the number of scenes is larger, that is, the content is more complex as the video scenes change more, at this time, the frame extraction interval is smaller, the number of obtained video frames is larger, and vice versa.
Therefore, by implementing the optional implementation mode, a more reasonable frame extraction interval can be determined according to the video scene parameters, so that the video content of the video frame can be determined reasonably and efficiently, and the training efficiency of the model is improved.
As an optional implementation manner, in the foregoing steps, after performing frame extraction on the training video according to the frame extraction interval to obtain a plurality of training video frames corresponding to the training video, the method further includes:
judging whether the number of the training video frames is larger than a preset first frame number threshold value or not;
if yes, dividing the training video frames into at least two divided training video frame groups with the number of video frames less than or equal to the first frame number threshold.
Wherein each of the divided training video frame groups is used as training data for a single input when training the video reconstruction prediction model.
Specifically, after a video is decimated, a final frame number is counted, and here, in order to avoid excessive memory occupation during training, a first frame number threshold value, for example, 30 frames, is set, and when a result after a certain video is decimated is 54, the first 30 frames should be truncated as a sequence, and then 24 frames should be truncated as a second sequence, so as to segment training data input once.
Therefore, by implementing the optional implementation mode, the plurality of training video frames can be divided into at least two divided training video frame groups with the number of video frames less than or equal to the first frame number threshold, so that the training data input at a single time can be determined reasonably and efficiently, the training cost is reduced, and the training efficiency of the model is improved.
As an optional implementation manner, in the foregoing steps, after performing frame extraction on the training video according to the frame extraction interval to obtain a plurality of training video frames corresponding to the training video, the method further includes:
judging whether the number of the training video frames is smaller than a preset second frame number threshold value or not;
if yes, extracting video frames from the training video and filling the video frames into the training video frames until the number of the training video frames is equal to a second frame number threshold.
Specifically, after the video is subjected to frame extraction, the final frame number is counted, in order to avoid that the frame number of part of the video is too small and cannot achieve the expected training effect, a second frame number threshold value is set, for example, 30 frames, and if the total frame number of the video is less than 30 and only 24 frames exist in total, 6 frames are randomly selected and are respectively copied and inserted according to the original time sequence so as to complement the 30 frames.
Therefore, by implementing the optional implementation mode, the video frames can be extracted from the training video and filled into the plurality of training video frames until the number of the plurality of training video frames is equal to the threshold value of the second frame number, so that the training data volume of single input can be reasonably and efficiently supplemented, and the training efficiency and effect of the model are improved.
EXAMPLE III
Referring to fig. 3, fig. 3 is a schematic structural diagram of a model training device based on multi-modal associated data according to an embodiment of the present invention. The apparatus described in fig. 3 may be applied to a corresponding video data processing apparatus, where the processing apparatus may be a corresponding processing terminal, a processing device, or a processing server, and the server may be a local server or a cloud server, which is not limited in the embodiment of the present invention. As shown in fig. 3, the apparatus may include:
a video determining module 301, configured to determine a training video for training a model;
an association determining module 302, configured to determine association data of at least one modality corresponding to a training video;
a model training module 303, configured to input a training video and associated data into a video reconstruction prediction model for training, and calculate a video loss function value between a prediction video output by the video reconstruction prediction model and an input training video, and a modal loss function value between the prediction video and at least one input associated data during training;
and the model optimization module 304 is configured to optimize model parameters of the video reconstruction prediction model according to the video loss function value and the modal loss function value until convergence, so as to obtain a trained video reconstruction prediction model.
As an alternative embodiment, the modalities include at least one of an audio modality, a text modality, and an image modality; and/or the association data comprises at least one of descriptive audio data, descriptive text data and characterizing image data.
As an alternative embodiment, as shown in fig. 4, the model training module 303 includes:
a frame extracting operation unit 3031, configured to perform frame extracting operation on a training video to obtain a plurality of training video frames corresponding to the training video;
a model training unit 3032, configured to input a plurality of training video frames and associated data into a video reconstruction prediction model for training;
a loss calculating unit 3033, configured to calculate, in the training, video loss function values between a plurality of predicted video frames output by the video reconstruction prediction model and a plurality of input training video frames, and modal loss function values between the predicted video and the input at least one associated data.
As an optional implementation manner, the association data is characterizing image data, and the specific manner of determining the association data of at least one modality corresponding to the training video by the association determining module 302 includes:
determining a target representation frame image from a plurality of training video frames, and copying the target representation frame image to obtain a plurality of copied representation frame images;
and determining the plurality of copied representation frame images as representation image data corresponding to the training video.
As an optional implementation manner, the specific manner in which the frame extracting operation unit 3031 performs frame extracting operation on the training video to obtain a plurality of training video frames corresponding to the training video includes:
determining a frame extraction interval corresponding to a training video according to the video parameters of the training video;
and performing frame extraction operation on the training video according to the frame extraction interval to obtain a plurality of training video frames corresponding to the training video.
As an alternative embodiment, the video reconstruction prediction model includes a video reconstruction network and a modality reconstruction network; the video reconstruction network is used for receiving the training video and the associated data and reconstructing a prediction video; the modal reconstruction network is used for extracting the associated data characteristics of the corresponding modal of the predicted video; the correlation data characteristics are used for comparing with the correlation data to calculate a modal loss function value; the modal reconstruction network is obtained by training convergence of a training data set comprising a plurality of training videos and training associated data of corresponding modalities;
and the model optimization module 304 optimizes the model parameters of the video reconstruction prediction model according to the video loss function value and the modal loss function value until convergence, so as to obtain a specific mode of the trained video reconstruction prediction model, including:
and keeping the parameters of the modal reconstruction network unchanged during training, and optimizing the network parameters of the video reconstruction network according to the video loss function values and the modal loss function values until convergence to obtain the trained video reconstruction network.
As an optional implementation manner, the specific manner of optimizing the model parameters of the video reconstruction prediction model by the model optimization module 304 according to the video loss function value and the modal loss function value until convergence includes:
calculating a weighted sum of the video loss function value and the modal loss function value;
and optimizing the model parameters of the video reconstruction prediction model according to the weighted sum until convergence.
As an alternative implementation, the video loss function value is calculated as follows:
for any prediction video frame, calculating a frame loss function value between the prediction video frame and the corresponding training video frame;
and calculating the average value of the frame loss function values of all the predicted video frames to obtain the loss function values between the plurality of predicted video frames and the plurality of input training video frames.
Example four
Referring to fig. 5, fig. 5 is a schematic structural diagram of another model training device based on multi-modal associated data according to an embodiment of the present disclosure. As shown in fig. 5, the apparatus may include:
a memory 401 storing executable program code;
a processor 402 coupled with the memory 401;
the processor 402 calls the executable program code stored in the memory 401 to execute part or all of the steps of the model training method based on the multi-modal associated data disclosed in the first embodiment or the second embodiment of the present invention.
EXAMPLE five
The embodiment of the invention discloses a computer storage medium, which stores computer instructions, and when the computer instructions are called, the computer instructions are used for executing part or all of the steps of the model training method based on multi-modal associated data disclosed in the first embodiment or the second embodiment of the invention.
While certain embodiments of the present disclosure have been described above, other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily have to be in the particular order shown or in sequential order to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus, device, and non-volatile computer-readable storage medium embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and in relation to the description, reference may be made to some portions of the description of the method embodiments.
The apparatus, the device, the nonvolatile computer readable storage medium, and the method provided in the embodiments of the present specification correspond to each other, and therefore, the apparatus, the device, and the nonvolatile computer storage medium also have similar advantageous technical effects to the corresponding method.
In the 90 s of the 20 th century, improvements in a technology could clearly distinguish between improvements in hardware (e.g., improvements in circuit structures such as diodes, transistors, switches, etc.) and improvements in software (improvements in process flow). However, as technology advances, many of today's process flow improvements have been seen as direct improvements in hardware circuit architecture. Designers almost always obtain the corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical modules. For example, a Programmable Logic Device (PLD), such as a Field Programmable Gate Array (FPGA), is an integrated circuit whose Logic functions are determined by programming the Device by a user. A digital system is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Furthermore, nowadays, instead of manually manufacturing an integrated Circuit chip, such Programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one but many, such as ABEL (Advanced Boolean Expression Language), AHDL (alternate Hardware Description Language), traffic, CUPL (core universal Programming Language), HDCal, jhddl (Java Hardware Description Language), lava, lola, HDL, PALASM, rhyd (Hardware Description Language), and the like, which are currently used in the field-Hardware Language. It will also be apparent to those skilled in the art that hardware circuitry that implements the logical method flows can be readily obtained by merely slightly programming the method flows into an integrated circuit using the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, an Application Specific Integrated Circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, atmel AT91SAM, microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic for the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may thus be regarded as a hardware component and the means for performing the various functions included therein may also be regarded as structures within the hardware component. Or even means for performing the functions may be regarded as being both a software module for performing the method and a structure within a hardware component.
The systems, apparatuses, modules or units described in the above embodiments may be specifically implemented by a computer chip or an entity, or implemented by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, respectively. Of course, the functions of the various elements may be implemented in the same one or more software and/or hardware implementations of the present description.
As will be appreciated by one skilled in the art, the present specification embodiments may be provided as a method, system, or computer program product. Accordingly, embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and so forth) having computer-usable program code embodied therein.
The description has been presented with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the description. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or apparatus that comprises the element.
This description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
Finally, it should be noted that: the model training method and apparatus based on multi-modal associated data disclosed in the embodiments of the present invention are only preferred embodiments of the present invention, and are only used for illustrating the technical solutions of the present invention, rather than limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those skilled in the art; the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (10)
1. A model training method based on multi-modal associated data, the method comprising:
determining a training video for training the model;
determining associated data of at least one modality corresponding to the training video;
inputting the training video and the associated data into a video reconstruction prediction model for training, and calculating a video loss function value between a prediction video output by the video reconstruction prediction model and the input training video and a modal loss function value between the prediction video and at least one input associated data during training;
and optimizing the model parameters of the video reconstruction prediction model according to the video loss function values and the modal loss function values until convergence, so as to obtain the trained video reconstruction prediction model.
2. The model training method based on multi-modal associated data according to claim 1, wherein the modality comprises at least one of an audio modality, a text modality, and an image modality; and/or the associated data comprises at least one of descriptive audio data, descriptive text data and characterizing image data.
3. The method of claim 1, wherein the training video and the associated data into a video reconstruction prediction model, and the calculating the video loss function value between the prediction video output by the video reconstruction prediction model and the training video input by the video reconstruction prediction model and the modal loss function value between the prediction video and at least one of the associated data input by the video reconstruction prediction model comprises:
performing frame extraction operation on the training video to obtain a plurality of training video frames corresponding to the training video;
inputting the plurality of training video frames and the associated data into a video reconstruction prediction model for training;
calculating, in the training, video loss function values between a plurality of predicted video frames output by the video reconstruction prediction model and the plurality of training video frames input, and modal loss function values between the predicted video and at least one of the associated data input.
4. The method of claim 3, wherein the correlation data is image data, and the determining the correlation data of at least one modality corresponding to the training video comprises:
determining a target representation frame image from the plurality of training video frames, and copying the target representation frame image to obtain a plurality of copied representation frame images;
and determining the plurality of copied representation frame images as representation image data corresponding to the training video.
5. The model training method based on multi-modal associated data according to claim 1, wherein the performing frame extraction on the training video to obtain a plurality of training video frames corresponding to the training video comprises:
determining a frame extraction interval corresponding to the training video according to the video parameters of the training video;
and performing frame extraction operation on the training video according to the frame extraction interval to obtain a plurality of training video frames corresponding to the training video.
6. The model training method based on multi-modal associated data according to claim 1, wherein the video reconstruction prediction model comprises a video reconstruction network and a modal reconstruction network; the video reconstruction network is used for receiving the training video and the associated data and reconstructing the prediction video; the modal reconstruction network is used for extracting relevant data characteristics of the modal corresponding to the prediction video; the correlation data characteristics are used for comparing with the correlation data to calculate the modal loss function value; the modal reconstruction network is obtained by training convergence of a training data set comprising a plurality of training videos and corresponding training associated data of the modal;
and optimizing the model parameters of the video reconstruction prediction model according to the video loss function value and the modal loss function value until convergence to obtain the trained video reconstruction prediction model, comprising:
and keeping the parameters of the modal reconstruction network unchanged during training, and optimizing the network parameters of the video reconstruction network according to the video loss function value and the modal loss function value until convergence to obtain the trained video reconstruction network.
7. The method of claim 1, wherein the optimizing the model parameters of the video reconstruction prediction model according to the video loss function values and the modal loss function values until convergence comprises:
calculating a weighted sum of the video loss function values and the modal loss function values;
and optimizing the model parameters of the video reconstruction prediction model according to the weighted sum value until convergence.
8. The method of claim 7, wherein the video loss function value is calculated as follows:
for any one of the predicted video frames, calculating a frame loss function value between the predicted video frame and the corresponding training video frame;
and calculating the average value of the frame loss function values of all the prediction video frames to obtain the loss function values between a plurality of prediction video frames and the input training video frames.
9. A model training apparatus based on multi-modal associated data, the apparatus comprising:
the video determining module is used for determining a training video for training the model;
the association determining module is used for determining association data of at least one modality corresponding to the training video;
the model training module is used for inputting the training video and the associated data into a video reconstruction prediction model for training, and calculating a video loss function value between a prediction video output by the video reconstruction prediction model and the input training video and a modal loss function value between the prediction video and at least one input associated data in the training process;
and the model optimization module is used for optimizing the model parameters of the video reconstruction prediction model according to the video loss function values and the modal loss function values until convergence, so as to obtain the trained video reconstruction prediction model.
10. A model training apparatus based on multi-modal associated data, the apparatus comprising:
a memory storing executable program code;
a processor coupled with the memory;
the processor calls the executable program code stored in the memory to perform the model training method based on multi-modal association data as recited in any one of claims 1-8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210704027.3A CN115240099A (en) | 2022-06-21 | 2022-06-21 | Model training method and device based on multi-mode associated data |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210704027.3A CN115240099A (en) | 2022-06-21 | 2022-06-21 | Model training method and device based on multi-mode associated data |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115240099A true CN115240099A (en) | 2022-10-25 |
Family
ID=83669436
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210704027.3A Pending CN115240099A (en) | 2022-06-21 | 2022-06-21 | Model training method and device based on multi-mode associated data |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115240099A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117710777A (en) * | 2024-02-06 | 2024-03-15 | 腾讯科技(深圳)有限公司 | Model training method, key frame extraction method and device |
-
2022
- 2022-06-21 CN CN202210704027.3A patent/CN115240099A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117710777A (en) * | 2024-02-06 | 2024-03-15 | 腾讯科技(深圳)有限公司 | Model training method, key frame extraction method and device |
CN117710777B (en) * | 2024-02-06 | 2024-06-04 | 腾讯科技(深圳)有限公司 | Model training method, key frame extraction method and device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN115240102A (en) | Model training method and device based on images and texts | |
CN117372631B (en) | Training method and application method of multi-view image generation model | |
CN115240103A (en) | Model training method and device based on videos and texts | |
CN110012310B (en) | Free viewpoint-based encoding and decoding method and device | |
JP2022507399A (en) | Robot image enhancement methods and devices, processors, equipment, media and programs | |
CN112119408A (en) | Method for acquiring image quality enhancement network, image quality enhancement method, image quality enhancement device, movable platform, camera and storage medium | |
CN115240100A (en) | Model training method and device based on video frame | |
CN114238904B (en) | Identity recognition method, and training method and device of dual-channel hyper-resolution model | |
CN114359775A (en) | Key frame detection method, device, equipment, storage medium and program product | |
CN115240099A (en) | Model training method and device based on multi-mode associated data | |
CN113688832B (en) | Model training and image processing method and device | |
CN111263226B (en) | Video processing method, video processing device, electronic equipment and medium | |
CN115481283A (en) | Audio and video feature extraction method and device, electronic equipment and computer readable storage medium | |
CN117478949A (en) | Method and system for constructing audio visual sense attention prediction model | |
CN116797975A (en) | Video segmentation method, device, computer equipment and storage medium | |
CN117880444A (en) | Human body rehabilitation exercise video data generation method guided by long-short time features | |
CN117541963A (en) | Method and device for extracting key video frames containing text risks | |
CN115499635B (en) | Data compression processing method and device | |
CN115484494B (en) | Digital twin video stream processing method, device and equipment | |
CN115623221A (en) | Video coding method and device, storage medium and image acquisition equipment | |
CN113256765A (en) | AI anchor video generation method and device, electronic equipment and storage medium | |
CN112511838A (en) | Method, device, equipment and readable medium for reducing video transcoding delay | |
CN115953706B (en) | Virtual image processing method and device | |
KR102205518B1 (en) | Storage device that performs machine learning and method thereof | |
CN117808976B (en) | Three-dimensional model construction method and device, storage medium and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |