CN115240100A - Model training method and device based on video frame - Google Patents

Model training method and device based on video frame Download PDF

Info

Publication number
CN115240100A
CN115240100A CN202210704031.XA CN202210704031A CN115240100A CN 115240100 A CN115240100 A CN 115240100A CN 202210704031 A CN202210704031 A CN 202210704031A CN 115240100 A CN115240100 A CN 115240100A
Authority
CN
China
Prior art keywords
video
training
frame
video frames
frames
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
Application number
CN202210704031.XA
Other languages
Chinese (zh)
Inventor
陈畅新
黄于晏
陈第
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Youmi Technology Co ltd
Original Assignee
Youmi Technology Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Youmi Technology Co ltd filed Critical Youmi Technology Co ltd
Priority to CN202210704031.XA priority Critical patent/CN115240100A/en
Publication of CN115240100A publication Critical patent/CN115240100A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/40Scenes; Scene-specific elements in video content
    • G06V20/46Extracting features or characteristics from the video content, e.g. video fingerprints, representative shots or key frames
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/77Processing 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/774Generating sets of training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/82Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Multimedia (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Databases & Information Systems (AREA)
  • Medical Informatics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Molecular Biology (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The invention discloses a model training method and a device based on video frames, wherein the method comprises the following steps: determining a plurality of training videos for training the model; determining a frame extraction interval corresponding to the training video according to the video parameters of the training video; 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; training a video reconstruction prediction model based on a Transformer network structure according to the training video frames, calculating loss function values between the input training video frames and the output prediction video frames of the video reconstruction prediction model in the training process, and optimizing model parameters of the video reconstruction prediction model according to the loss function values until convergence to obtain the trained video reconstruction prediction model. Therefore, the method and the device can improve training efficiency, and make the prediction effect better by using the algorithm advantage of the Transformer network structure.

Description

Model training method and device based on video frame
Technical Field
The invention relates to the technical field of algorithm model training, in particular to a method and a device for training a model based on video frames.
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, the factor of the frame extraction interval when the video is subjected to frame extraction is not considered, and the training of the video related task by using the algorithm advantage of the transform network structure is not considered, so that reasonable video frames cannot be obtained through reasonable frame extraction for training, and the training effect is poor. Therefore, the prior art has defects and needs to be solved urgently.
Disclosure of Invention
The technical problem to be solved by the present invention is to provide a method and an apparatus for determining model training based on video frames, which can improve training efficiency and make prediction effect better by using algorithm advantages of a transform network structure.
In order to solve the above technical problem, a first aspect of the present invention discloses a method for training a model based on video frames, where the method includes:
determining a plurality of training videos for training the model;
determining a frame extraction interval corresponding to the training video according to the video parameters of the training video;
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;
training a video reconstruction prediction model based on a Transformer network structure according to the training video frames, calculating loss function values between the input training video frames and the output prediction video frames of the video reconstruction prediction model in the training process, and optimizing model parameters of the video reconstruction prediction model according to the loss function values until convergence to obtain the trained video reconstruction prediction model.
As an optional implementation manner, in the first aspect of the present invention, the determining, according to the video parameter of the training video, a frame extraction interval corresponding to the training video includes:
determining picture change parameters of the training video;
determining a frame extraction interval corresponding to the training video according to the picture change parameter and a preset parameter threshold condition;
and/or the presence of a gas in the gas,
determining video scene parameters of the training video;
and determining the frame extraction interval corresponding to the training video according to the video scene parameters and the preset scene frame extraction corresponding relation.
As an optional implementation manner, in the first aspect of the present invention, the framing interval includes a plurality of different framing intervals; the frame extraction operation is performed on the training video according to the frame extraction interval to obtain a plurality of training video frames corresponding to the training video, and the method comprises the following steps:
performing frame extraction operation on the training video according to the different frame extraction intervals respectively to obtain a plurality of first training video frame groups corresponding to the training video respectively; each of the first training video frame sets is used as training data for a single input when training a video reconstruction prediction model.
As an optional implementation manner, in the first aspect of the present invention, 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 second training video frame groups with the number of video frames smaller than or equal to the threshold of the first frame number; each second training video frame group is used as training data of single input when a video reconstruction prediction model is trained;
and/or the presence of a gas in the gas,
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 the second frame number threshold.
As an optional implementation manner, in the first aspect of the present invention, before the training the transform network structure-based video reconstruction prediction model according to the training video frames, the method further includes:
performing normalization operation on the training video frames to enable the pixel value of the pixel point in each training video frame to be in a preset pixel value interval;
and/or the presence of a gas in the gas,
the method comprises the steps of scrambling the arrangement sequence of a plurality of training video frames arranged according to the original time sequence to obtain out-of-order training video frames; the out-of-order training video frames are used for being input to an encoder of the video reconstruction prediction model; the encoder is used for inputting the encoded output data of the out-of-order training video frame to a decoder of the video reconstruction prediction model after the original time sequence is restored;
and/or the presence of a gas in the gas,
determining a mask video frame in the plurality of training video frames;
deleting the mask video frame, and determining the rest training video frames of the training video frames as input video frames; the input video frame is used for being input to an encoder of the video reconstruction prediction model; the masked video frame is for input to a decoder of the video reconstruction prediction model together with encoded output data of the encoder from the input video frame.
As an alternative implementation, in the first aspect of the present invention, the loss function values between the plurality of prediction video frames and the plurality of input training video frames are 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.
As an alternative embodiment, in the first aspect of the present invention, the video reconstruction prediction model includes an encoder; the encoder comprises an embedded layer, a position coding layer and a first transform layer; the embedded layers include two-dimensional convolutional layers and/or three-dimensional convolutional layers.
As an alternative implementation, in the first aspect of the present invention, the video reconstruction prediction model includes a decoder; the decoder includes a first fully-connected layer, a second transform layer, and a second fully-connected layer.
The second aspect of the present invention discloses a model training device based on video frames, the device comprising:
a video determination module for determining a plurality of training videos for training the model;
the interval determining module is used for determining a frame extraction interval corresponding to the training video according to the video parameters of the training video;
the frame extracting operation module is used for carrying out frame extracting operation on the training video according to the frame extracting interval to obtain a plurality of training video frames corresponding to the training video;
and the model training module is used for training a video reconstruction prediction model based on a transform network structure according to the training video frames, calculating loss function values between the input training video frames and the plurality of prediction video frames output by the video reconstruction prediction model in training, and optimizing model parameters of the video reconstruction prediction model according to the loss function values until convergence to obtain the trained video reconstruction prediction model.
As an optional implementation manner, in the second aspect of the present invention, the specific manner in which the interval determining module determines the frame extraction interval corresponding to the training video according to the video parameter of the training video includes:
determining picture change parameters of the training video;
determining a frame extraction interval corresponding to the training video according to the picture change parameter and a preset parameter threshold condition;
and/or the presence of a gas in the atmosphere,
determining video scene parameters of the training video;
and determining the frame extraction interval corresponding to the training video according to the corresponding relation between the video scene parameters and the preset scene frame extraction.
As an optional implementation manner, in the second aspect of the present invention, the framing interval includes a plurality of different framing intervals; the specific mode of the frame extraction operation module 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 comprises the following steps:
performing frame extraction operation on the training video according to the different frame extraction intervals respectively to obtain a plurality of first training video frame groups corresponding to the training video respectively; each of the first training video frame sets is used as training data for a single input when training a video reconstruction prediction model.
As an optional implementation manner, in the second aspect of the present invention, the apparatus further includes a frame number adjusting module, configured to, after the frame extracting operation module performs a frame extracting operation on the training video according to the frame extracting interval to obtain a plurality of training video frames corresponding to the training video, execute the following steps:
judging whether the number of the training video frames is greater than a preset first frame number threshold value or not;
if yes, dividing the training video frames into at least two second training video frame groups with the number of video frames smaller than or equal to the threshold of the first frame number; each second training video frame group is used as training data of single input when a video reconstruction prediction model is trained;
and/or the presence of a gas in the gas,
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 the second frame number threshold.
As an optional implementation manner, in the second aspect of the present invention, the apparatus further includes a preprocessing module, configured to, before the model training module trains the transform network structure-based video reconstruction prediction model according to the training video frames, perform the following steps:
performing normalization operation on the training video frames to enable the pixel value of the pixel point in each training video frame to be in a preset pixel value interval;
and/or the presence of a gas in the atmosphere,
disordering the arrangement sequence of the training video frames arranged according to the original time sequence to obtain disordered training video frames; the out-of-order training video frames are used for being input to an encoder of the video reconstruction prediction model; the encoder is used for inputting the encoded output data of the out-of-order training video frame to a decoder of the video reconstruction prediction model after the original time sequence is restored according to the encoded output data of the out-of-order training video frame;
and/or the presence of a gas in the atmosphere,
determining a mask video frame in the plurality of training video frames;
deleting the mask video frame, and determining the rest training video frames of the training video frames as input video frames; the input video frame is used for being input to an encoder of the video reconstruction prediction model; the masked video frame is for input to a decoder of the video reconstruction prediction model together with encoded output data of the encoder from the input video frame.
As an alternative implementation manner, in the second aspect of the present invention, the loss function values between the plurality of prediction video frames and the plurality of input training video frames are 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.
As an alternative implementation, in the second aspect of the present invention, the video reconstruction prediction model includes an encoder; the encoder comprises an embedded layer, a position coding layer and a first transform layer; the embedded layers include two-dimensional convolutional layers and/or three-dimensional convolutional layers.
As an alternative embodiment, in the second aspect of the present invention, the video reconstruction prediction model includes a decoder; the decoder includes a first fully-connected layer, a second transform layer, and a second fully-connected layer.
The third aspect of the present invention discloses another model training device based on video frames, the device includes:
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 video frame disclosed by the first aspect of the embodiment of the invention.
In a fourth aspect, the present invention discloses a computer storage medium, which stores computer instructions for performing some or all of the steps of the video frame based model training method disclosed in the first aspect of the embodiments of the present invention when the computer instructions are called.
Compared with the prior art, the embodiment of the invention has the following beneficial effects:
in the embodiment of the invention, a plurality of training videos for training a model are determined; determining a frame extraction interval corresponding to the training video according to the video parameters of the training video; 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; training a video reconstruction prediction model based on a Transformer network structure according to the training video frames, calculating loss function values between the input training video frames and the output prediction video frames of the video reconstruction prediction model in the training process, and optimizing model parameters of the video reconstruction prediction model according to the loss function values until convergence to obtain the trained video reconstruction prediction model. Therefore, the method and the device can train the algorithm model based on the transform network structure by utilizing the video frame obtained by frame extraction of the training video based on the specific interval, so that the video content of the video frame can be reasonably and efficiently determined to improve the training efficiency of the model on the one hand, and the algorithm advantage of the transform network structure is utilized to enable the prediction effect of the trained model to be better on the other hand.
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 method for training a model based on video frames according to an embodiment of the present invention;
FIG. 2 is a schematic flowchart illustrating another method for training a model based on video frames according to an embodiment of the present invention;
FIG. 3 is a schematic structural diagram of a model training apparatus based on video frames according to an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of another video frame-based model training apparatus according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of another video frame-based model training apparatus 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 for describing a particular order. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover a non-exclusive inclusion. 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 but may alternatively include other steps or elements not expressly 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 a model training device based on video frames, which can train an algorithm model based on a transform network structure by utilizing video frames obtained by extracting frames from a training video based on specific intervals, so that the video content of the video frames can be reasonably and efficiently determined to improve the training efficiency of the model on the one hand, and the algorithm advantage of the transform network structure is utilized to ensure that the prediction effect of the trained model is better on the other hand. The following are detailed below.
Example one
Referring to fig. 1, fig. 1 is a schematic flowchart illustrating a method for training a model based on video frames 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 video frame-based model training method may include the following operations:
101. a plurality of training videos 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 the shot of the picture may continuously and slowly move, but the shot switching frequency in the video content should be as small as possible, and may be set to be smaller than a preset frequency threshold, where the frequency threshold may be 0.
102. 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 fully reflect the video content, and when the complexity is lower, the frame extraction interval may be appropriately increased to obtain fewer video frames.
103. 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.
Alternatively, the decimation interval may be a time interval or a frame 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 may be bound and stored with an identifier (such as a storage path, a video ID, and the like) of the training video for subsequent training.
104. Training a video reconstruction prediction model based on a Transformer network structure according to a plurality of training video frames, calculating 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 the training, and optimizing model parameters of the video reconstruction prediction model according to the loss function values until convergence to obtain the trained video reconstruction prediction model.
Alternatively, the loss function value may be an L1 loss function value, an L2 loss function value, or other loss function values suitable for calculating the similarity between images, which is not limited in the present invention.
Therefore, the method described by the embodiment of the invention can train the algorithm model based on the transform network structure by using the video frame obtained by frame extraction of the training video based on the specific interval, so that the video content of the video frame can be reasonably and efficiently determined to improve the training efficiency of the model on the one hand, and the algorithm advantage of the transform network structure is utilized to enable the prediction effect of the trained model to be better on the other hand.
As an alternative embodiment, the video reconstruction prediction model includes an encoder and a decoder, wherein the encoder is used for extracting the features, and the decoder is used for restoring the features. Optionally, the encoder includes an embedded layer, a position encoding layer, and a first transform layer, where the embedded layer includes 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, which is used to replace the high-dimensional original image features with a lower-dimensional vector, optionally, the image block Embedding layer is formed by a convolution layer, the sizes of convolution kernels and the sizes of step sizes are equal, and the number of output channels is selected 768 (or others).
Optionally, a three-dimensional convolution video block Embedding layer, that is, a 3D Patch Embedding layer, may also be constructed, 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 can have 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 can 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 characteristic vector is obtained by three-dimensional convolution of the first frame and the second frame, then a characteristic vector is obtained by the second frame and the third frame, \8230, if the convolution depth is equal to 2, the step size is also equal to 2, at this time, a characteristic 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 the characteristics between the second frame and the third frame are not calculated.
Specifically, through the embedding layer, all input video frames are converted into corresponding feature vectors. Taking a specific implementation of the two-dimensional convolved image block embedding layer as an example, for example, 30 frames of video frames, each frame has an image size of 224 × 224, the dimension is (30, 3, 224), 3 represents RGB three channels, the convolution kernel has a size of (16, 16) and a step size of 16, and is transformed into (30, 768, 14) and then transformed into a feature vector (30, 768, 196). Subsequently, the order of the dimensions is reversed and a class label is added at the initial position of the dimension 196 for processing downstream tasks such as classification, and the dimension of the finally obtained feature is (30, 197, 768).
Optionally, the position coding layer adds a position coding vector obtained by cosine initialization to the features, and is used to represent position information of each image block in the image.
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 embodiment, an encoder structure capable of sufficiently extracting the features of the video frame 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, determining the 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 the 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, the change between each frame is relatively obvious, and then 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 such a regular or slower change, 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 plurality of training video frames into at least two second training video frame groups with the number of video frames smaller than or equal to the threshold of the first frame number.
Wherein each second training video frame set 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 second training video frame groups with the number of video frames smaller than or equal to the threshold value of the first frame number, 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 the 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 complemented, and the training efficiency and effect of the model are improved.
As an optional implementation manner, in the above steps, before training the video reconstruction prediction model based on the transform network structure according to a plurality of training video frames, the method further includes:
and carrying out normalization operation on a plurality of training video frames to enable the pixel value of the pixel point in each training video frame to be in a preset pixel value interval.
Preferably, the original input video frame is normalized before being processed by the encoder to obtain features, so that the value range of the pixel value of the image is converted into [0,1]. Therefore, the value range of the pixel value of the video frame output by the decoder is [0,1], which can effectively improve the efficiency of calculation and training efficiency.
As an optional implementation manner, in the foregoing steps, before training the transform network structure-based video reconstruction prediction model according to a plurality of training video frames, the method further includes:
and (3) disordering the arrangement sequence of the training video frames arranged according to the original time sequence to obtain the out-of-order training video frames.
Specifically, the encoder outputs data according to the encoding of the out-of-order training video frames and inputs the data to a decoder of the video reconstruction prediction model after the data is restored to the original time sequence.
Through the arrangement, the video frames can be scrambled to train the model, and the prediction effect of the trained model can be effectively improved.
As an optional implementation manner, in the foregoing steps, before training the transform network structure-based video reconstruction prediction model according to a plurality of training video frames, the method further includes:
determining a mask video frame in a plurality of training video frames;
and deleting the mask video frame, and determining the rest training video frames of the training video frames as input video frames.
The input video frame is used for being input to an encoder of a video reconstruction prediction model, and specifically, the mask video frame is used for being input to a decoder of the video reconstruction prediction model together with the encoder according to the encoding output data of the input video frame.
Specifically, for example, in the above embodiment, there are 30 video frames in total, corresponding to the feature vectors of (30,197,768), but during the training process, a part of the video frames will be randomly masked off by Mask, i.e. a part of the video frames will be randomly masked off in 30 dimensions, for example, the Mask proportion is 33%, and finally the feature vectors of (20,197,768) will be used for training. Specifically, the Mask operation adopts a random Mask method, that is, a part of the random Mask is removed from 30 frames.
And then, randomly disturbing the sequence of the video frames with the Mask removed, and inputting the video frames into a coder-decoder to enable the model to learn the video characteristics. Where the encoder is responsible for learning their consistency and variability characteristics from the 20 visible video frames. Since the encoder is composed of multiple transform modules, the output dimension of the encoder is consistent with the input dimension, and after passing through the encoder, the output dimension is still (20,197,768).
Then, the decoder receives not only the output of the encoder but also the part of the video frames that were previously masked, i.e., the entire video frames, and all the input video frames are arranged in the original time sequence. In the decoder, the input eigenvectors of (30, 197, 768) are first transformed in the eigenspace through the full-concatenation layer and then input into the transform of the decoder. The same (30,197,768) feature vector is finally output. At this time, the feature vector corresponding to the category label is removed, that is, (30, 196, 768), the dimension of the retransform 196 is 14 × 14, and the final output dimension is (30, 14, 768), where: 30 represents 30 frames, 14 × 14 represents 196 image blocks, each image block comprises 768 pixels (3 × 256,3 represents image channel number RGB,256 represents 16 × 16 pixels), and the dimension (30, 3, 224) can be obtained after the shape is transformed. Therefore, after some frame information of the input 30 video frames is masked by Mask operation, feature learning is performed by the encoder, and then 30 frames are reconstructed by the decoder.
As an alternative embodiment, the loss function values between the plurality of prediction video frames and the plurality of input training video frames are 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.
Specifically, the SmoothL1 loss between the original video frame received by the encoder and the output video frame corresponding to the decoder may be calculated, and after the loss is correspondingly calculated between each frame, the average value is calculated to serve as the loss for reconstructing the video frame. Since the loss calculation is based only on the original video frame and the corresponding decoded video frame, no additional tag information is needed and an unsupervised learning method can be implemented.
Preferably, after the model is pre-trained according to the above embodiment, if a decoder is used to reconstruct a video, the output result of the decoder may be subjected to inverse normalization to obtain a reconstructed RGB video frame, and then the continuous video frame is converted into a video. If the method is used for other downstream tasks such as a classification task, only a small amount of supervision data sets need to be prepared, then only an encoder needs to be used for obtaining output feature vectors, then the 0 th dimension in the 197 dimension, namely a classification mark, is taken, and the mark is input into a new full-connection layer for classification. I.e., the trained model may be used for a variety of other downstream tasks.
Example two
Referring to fig. 2, fig. 2 is a schematic flowchart illustrating another video frame-based model training method 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 video frame-based model training method may include the following operations:
201. a plurality of training videos for training the model is determined.
202. And determining the frame extraction interval corresponding to the training video according to the video parameters of the training video.
Specifically, the decimation frame interval includes a plurality of different decimation frame intervals.
203. 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 first training video frame groups corresponding to the training video.
Optionally, each first training video frame group is used as training data for a single input when training the video reconstruction prediction model.
Optionally, each first training video frame group includes a plurality of training video frames.
Specifically, in order to expand the data set, the same training video is decimated at a plurality of different decimation intervals, for example, 5 frames per second and 2 frames per second, and the corresponding video frame sequence shows 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.
204. Training a video reconstruction prediction model based on a Transformer network structure according to a plurality of training video frames, calculating 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 the training, and optimizing model parameters of the video reconstruction prediction model according to the loss function values until convergence to obtain the trained video reconstruction prediction model.
The detailed technical details and technical noun explanations of the above steps 201-202, 204 can refer to the description of the steps 101-102, 104 in the first embodiment, which are not repeated herein.
Therefore, the method described by the embodiment of the invention can effectively enhance data by using a plurality of different intervals, thereby improving the training data volume at low cost and ensuring that the prediction effect of the model obtained by training is better.
EXAMPLE III
Referring to fig. 3, fig. 3 is a schematic structural diagram of a model training apparatus based on video frames 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 determination module 301, configured to determine a plurality of training videos for training a model;
an interval determining module 302, configured to determine a frame extraction interval corresponding to a training video according to a video parameter of the training video;
a frame extracting operation module 303, configured to perform frame extracting operation on the training video according to the frame extracting interval to obtain multiple training video frames corresponding to the training video;
the model training module 304 is configured to train a video reconstruction prediction model based on a transform network structure according to a plurality of training video frames, calculate a loss function value between a plurality of prediction video frames output by the video reconstruction prediction model and a plurality of training video frames input by the video reconstruction prediction model during training, and optimize model parameters of the video reconstruction prediction model according to the loss function value until convergence to obtain a trained video reconstruction prediction model.
As an optional implementation manner, the specific manner of determining the frame extraction interval corresponding to the training video by the interval determining module 302 according to the video parameter of the training video includes:
determining picture change parameters of a training video;
determining a frame extraction interval corresponding to the training video according to the picture change parameter and a preset parameter threshold condition;
and/or the presence of a gas in the gas,
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.
As an alternative embodiment, the decimation frame interval comprises a plurality of different decimation frame intervals; the specific manner of performing frame extraction on the training video by the frame extraction operation module 303 according to the frame extraction interval to obtain a plurality of training video frames corresponding to the training video includes:
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 first training video frame groups corresponding to the training video; each first training video frame set is used as training data for a single input when training the video reconstruction prediction model.
As an optional implementation manner, as shown in fig. 4, the apparatus further includes a frame number adjusting module 305, configured to, after the frame extracting operation module 303 performs a frame extracting operation on the training video according to the frame extracting interval to obtain a plurality of training video frames corresponding to the training video, execute the following steps:
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 plurality of training video frames into at least two second training video frame groups with the number of video frames less than or equal to the threshold of the first frame number; each second training video frame group is used as training data of single input when the video reconstruction prediction model is trained;
and/or the presence of a gas in the gas,
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 the second frame number threshold.
As an optional implementation manner, as shown in fig. 4, the apparatus further includes a preprocessing module 306, configured to perform the following steps before the model training module 304 trains the transform network structure-based video reconstruction prediction model according to a plurality of training video frames:
carrying out normalization operation on a plurality of training video frames to enable the pixel value of a pixel point in each training video frame to be in a preset pixel value interval;
and/or the presence of a gas in the gas,
disordering the arrangement sequence of a plurality of training video frames arranged according to the original time sequence to obtain disordered training video frames; the disordered training video frame is used for being input to an encoder of a video reconstruction prediction model; the encoder is used for inputting the encoded output data of the out-of-order training video frames to a decoder of a video reconstruction prediction model after restoring to an original time sequence;
and/or the presence of a gas in the gas,
determining a mask video frame in a plurality of training video frames;
deleting the mask video frame, and determining the remaining training video frames of the plurality of training video frames as input video frames; an encoder for inputting video frames for input to a video reconstruction prediction model; the masked video frames are used to be input to a decoder of a video reconstruction prediction model together with encoded output data from the encoder based on the input video frames.
As an alternative embodiment, the loss function values between the plurality of prediction video frames and the plurality of input training video frames are 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.
As an alternative embodiment, the video reconstruction prediction model includes an encoder; the encoder comprises an embedded layer, a position coding layer and a first transform layer; the embedding layer includes a two-dimensional convolution layer and/or a three-dimensional convolution layer.
As an alternative embodiment, the video reconstruction prediction model comprises a decoder; the decoder includes a first fully-connected layer, a second transform layer, and a second fully-connected layer.
Example four
Referring to fig. 5, fig. 5 is a schematic structural diagram of another video frame-based model training apparatus according to an embodiment of the present invention. As shown in fig. 5, the apparatus may include:
a memory 401 storing executable program code;
a processor 402 coupled to a memory 401;
the processor 402 calls the executable program code stored in the memory 401 to perform part or all of the steps of the video frame-based model training method 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 steps in the model training method based on video frames 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.
All 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 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 blocks. 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 for implementing the logical method flows can be readily obtained by a mere need to program the method flows with some of the hardware description languages described above and into an integrated circuit.
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 that stores 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 embedded microcontrollers, 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 considered a hardware component, and the means included therein for performing the various functions may also be considered as a structure 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, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or 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, embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the embodiments described herein 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 described 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 flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations 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 phrases "comprising a," "8230," "8230," or "comprising" does not exclude the presence of other like elements in a process, method, article, or apparatus comprising 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 video frames 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 being limited thereto; 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 method for training a model based on video frames, the method comprising:
determining a plurality of training videos for training the model;
determining a frame extraction interval corresponding to the training video according to the video parameters of the training video;
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;
training a video reconstruction prediction model based on a Transformer network structure according to the training video frames, calculating loss function values between the input training video frames and the output prediction video frames of the video reconstruction prediction model in the training process, and optimizing model parameters of the video reconstruction prediction model according to the loss function values until convergence to obtain the trained video reconstruction prediction model.
2. The method for training a model based on video frames according to claim 1, wherein the determining the frame-extracting interval corresponding to the training video according to the video parameters of the training video comprises:
determining picture change parameters of the training video;
determining a frame extraction interval corresponding to the training video according to the picture change parameters and a preset parameter threshold condition;
and/or the presence of a gas in the gas,
determining video scene parameters of the training video;
and determining the frame extraction interval corresponding to the training video according to the video scene parameters and the preset scene frame extraction corresponding relation.
3. The method of claim 1, wherein the decimation interval comprises a plurality of different decimation intervals; the frame extraction operation is performed on the training video according to the frame extraction interval to obtain a plurality of training video frames corresponding to the training video, and the method comprises the following steps:
performing frame extraction on the training video according to the different frame extraction intervals respectively to obtain a plurality of first training video frame groups corresponding to the training video respectively; each of the first training video frame sets is used as training data for a single input when training a video reconstruction prediction model.
4. The method for training a model based on video frames according to claim 1, wherein after performing the frame-extracting operation on the training video according to the frame-extracting interval to obtain a plurality of training video frames corresponding to the training video, the method further comprises:
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 second training video frame groups with the number of video frames smaller than or equal to the threshold of the first frame number; each second training video frame group is used as training data of single input when a video reconstruction prediction model is trained;
and/or the presence of a gas in the gas,
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 the second frame number threshold.
5. The method of claim 1, wherein before training the transform network structure based video reconstruction prediction model from the training video frames, the method further comprises:
performing normalization operation on the training video frames to enable the pixel value of the pixel point in each training video frame to be in a preset pixel value interval;
and/or the presence of a gas in the atmosphere,
disordering the arrangement sequence of the training video frames arranged according to the original time sequence to obtain disordered training video frames; the out-of-order training video frames are used for being input to an encoder of the video reconstruction prediction model; the encoder is used for inputting the encoded output data of the out-of-order training video frame to a decoder of the video reconstruction prediction model after the original time sequence is restored according to the encoded output data of the out-of-order training video frame;
and/or the presence of a gas in the gas,
determining a mask video frame in the plurality of training video frames;
deleting the mask video frame, and determining the rest training video frames of the training video frames as input video frames; the input video frame is used for being input to an encoder of the video reconstruction prediction model; the masked video frame is for input to a decoder of the video reconstruction prediction model together with encoded output data of the encoder from the input video frame.
6. The method of claim 1, wherein the loss function values between the plurality of predicted video frames and the plurality of input training video frames are 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.
7. The method of claim 1, wherein the video reconstruction prediction model comprises an encoder; the encoder comprises an embedded layer, a position coding layer and a first transform layer; the embedded layers include two-dimensional convolutional layers and/or three-dimensional convolutional layers.
8. The method of claim 1, wherein the video reconstruction prediction model comprises a decoder; the decoder includes a first fully-connected layer, a second transform layer, and a second fully-connected layer.
9. An apparatus for model training based on video frames, the apparatus comprising:
a video determination module for determining a plurality of training videos for training the model;
the interval determining module is used for determining a frame extraction interval corresponding to the training video according to the video parameters of the training video;
the frame extracting operation module is used for performing frame extracting operation on the training video according to the frame extracting interval to obtain a plurality of training video frames corresponding to the training video;
and the model training module is used for training a video reconstruction prediction model based on a transform network structure according to the training video frames, calculating loss function values between the input training video frames and the multiple prediction video frames output by the video reconstruction prediction model in training, and optimizing model parameters of the video reconstruction prediction model according to the loss function values until convergence to obtain the trained video reconstruction prediction model.
10. An apparatus for model training based on video frames, 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 execute the video frame based model training method according to any one of claims 1 to 8.
CN202210704031.XA 2022-06-21 2022-06-21 Model training method and device based on video frame Pending CN115240100A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210704031.XA CN115240100A (en) 2022-06-21 2022-06-21 Model training method and device based on video frame

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210704031.XA CN115240100A (en) 2022-06-21 2022-06-21 Model training method and device based on video frame

Publications (1)

Publication Number Publication Date
CN115240100A true CN115240100A (en) 2022-10-25

Family

ID=83668972

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210704031.XA Pending CN115240100A (en) 2022-06-21 2022-06-21 Model training method and device based on video frame

Country Status (1)

Country Link
CN (1) CN115240100A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116524545A (en) * 2023-06-30 2023-08-01 暨南大学 Embryo classification method and system based on artificial intelligence
CN117750021A (en) * 2024-02-19 2024-03-22 北京铁力山科技股份有限公司 Video compression method, device, computer equipment and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116524545A (en) * 2023-06-30 2023-08-01 暨南大学 Embryo classification method and system based on artificial intelligence
CN116524545B (en) * 2023-06-30 2023-09-15 暨南大学 Embryo classification method and system based on artificial intelligence
CN117750021A (en) * 2024-02-19 2024-03-22 北京铁力山科技股份有限公司 Video compression method, device, computer equipment and storage medium
CN117750021B (en) * 2024-02-19 2024-04-30 北京铁力山科技股份有限公司 Video compression method, device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
CN115240100A (en) Model training method and device based on video frame
CN115240103A (en) Model training method and device based on videos and texts
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
CN112119408A (en) Method for acquiring image quality enhancement network, image quality enhancement method, image quality enhancement device, movable platform, camera and storage medium
US11062210B2 (en) Method and apparatus for training a neural network used for denoising
CN114973049B (en) Lightweight video classification method with unified convolution and self-attention
CN112804558B (en) Video splitting method, device and equipment
CN111368795B (en) Face feature extraction method, device and equipment
CN114358243A (en) Universal feature extraction network training method and device and universal feature extraction network
CN115240099A (en) Model training method and device based on multi-mode associated data
CN111263226B (en) Video processing method, video processing device, electronic equipment and medium
CN115499635B (en) Data compression processing method and device
CN113382244B (en) Coding and decoding network structure, image compression method, device and storage medium
CN113542780B (en) Method and device for removing compression artifacts of live webcast video
CN115115972A (en) Video processing method, video processing apparatus, computer device, medium, and program product
CN111107377A (en) Depth image compression method, device, equipment and storage medium
CN111654706B (en) Video compression method, device, equipment and medium
CN115830633A (en) Pedestrian re-identification method and system based on multitask learning residual error neural network
CN112511838A (en) Method, device, equipment and readable medium for reducing video transcoding delay
CN113887719A (en) Model compression method and device
CN112468826A (en) VVC loop filtering method and system based on multilayer GAN
CN117834793A (en) Video generation method and device based on static image
CN117152752B (en) Visual depth feature reconstruction method and device with self-adaptive weight
CN117830564B (en) Three-dimensional virtual human model reconstruction method based on gesture distribution guidance

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