WO2023035877A1 - 视频的识别方法、装置、可读介质和电子设备 - Google Patents

视频的识别方法、装置、可读介质和电子设备 Download PDF

Info

Publication number
WO2023035877A1
WO2023035877A1 PCT/CN2022/112759 CN2022112759W WO2023035877A1 WO 2023035877 A1 WO2023035877 A1 WO 2023035877A1 CN 2022112759 W CN2022112759 W CN 2022112759W WO 2023035877 A1 WO2023035877 A1 WO 2023035877A1
Authority
WO
WIPO (PCT)
Prior art keywords
video
training
encoder
recognition model
target
Prior art date
Application number
PCT/CN2022/112759
Other languages
English (en)
French (fr)
Inventor
佘琪
张�林
王长虎
Original Assignee
北京有竹居网络技术有限公司
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 北京有竹居网络技术有限公司 filed Critical 北京有竹居网络技术有限公司
Publication of WO2023035877A1 publication Critical patent/WO2023035877A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • 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
    • G06N3/084Backpropagation, e.g. using gradient descent
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02TCLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
    • Y02T10/00Road transport of goods or passengers
    • Y02T10/10Internal combustion engine [ICE] based vehicles
    • Y02T10/40Engine management systems

Definitions

  • the present disclosure relates to the technical field of image processing, and in particular, to a video recognition method, device, readable medium and electronic equipment.
  • the present disclosure provides a video recognition method, the method comprising:
  • the recognition result is used to characterize the category of the video to be processed;
  • the recognition model includes an encoder and a projection layer;
  • the encoder is pre-trained according to a plurality of pre-projection layers and a first number of pre-training videos, and each of the pre-projection layers is used to extract a video feature of the pre-training video;
  • the recognition model is obtained according to the pre-trained encoder and a second number of training videos, the second number is smaller than the first number, and the pre-training videos do not have category label.
  • the present disclosure provides a video recognition device, the device comprising:
  • the preprocessing module is used to preprocess the acquired video to be processed to obtain the target video
  • a recognition module configured to input the target video into a pre-trained recognition model to obtain a recognition result output by the recognition model, the recognition result being used to characterize the category of the video to be processed;
  • the recognition model includes an encoder and the projection layer;
  • the encoder is pre-trained according to a plurality of pre-projection layers and a first number of pre-training videos, and each of the pre-projection layers is used to extract a video feature of the pre-training video;
  • the recognition model is obtained according to the pre-trained encoder and a second number of training videos, the second number is smaller than the first number, and the pre-training videos do not have category label.
  • the present disclosure provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processing device, the steps of the method described in the first aspect of the present disclosure are implemented.
  • an electronic device including:
  • a processing device configured to execute the computer program in the storage device to implement the steps of the method described in the first aspect of the present disclosure.
  • the present disclosure first preprocesses the obtained video to be processed to obtain the target video, and then inputs the target video into the pre-trained recognition model to obtain the output of the recognition model, which is used to represent the category of the video to be processed recognition results.
  • the recognition model includes an encoder and a projection layer, and the encoder obtains pre-training according to multiple pre-projection layers and the first number of pre-training videos without category labels, and each pre-projection layer is used to extract the pre-training video A video feature.
  • the recognition model is trained based on the pre-trained encoder and the second number of training videos.
  • the encoder included in the recognition model in this disclosure is pre-trained through a self-supervised method and a pre-projection layer capable of extracting various video features, so as to improve the representation ability and generalization ability of the encoder, thereby improving the recognition accuracy of the recognition model .
  • Fig. 1 is a flow chart of a video recognition method shown according to an exemplary embodiment
  • Fig. 2 is a flow chart showing another video recognition method according to an exemplary embodiment
  • Fig. 3 is a flow chart showing a pre-training encoder according to an exemplary embodiment
  • Fig. 4 is a structural diagram of an encoder and a pre-projection layer according to an exemplary embodiment
  • Fig. 5 is a flowchart of another pre-training encoder according to an exemplary embodiment
  • Fig. 6 is a flow chart showing a training recognition model according to an exemplary embodiment
  • Fig. 7 is a flow chart showing another training recognition model according to an exemplary embodiment
  • Fig. 8 is a structural diagram of a recognition model according to an exemplary embodiment
  • Fig. 9 is a flow chart showing another training recognition model according to an exemplary embodiment.
  • Fig. 10 is a block diagram of a video recognition device according to an exemplary embodiment
  • Fig. 11 is a block diagram of another video recognition device according to an exemplary embodiment
  • Fig. 12 is a block diagram of an electronic device according to an exemplary embodiment.
  • the term “comprise” and its variations are open-ended, ie “including but not limited to”.
  • the term “based on” is “based at least in part on”.
  • the term “one embodiment” means “at least one embodiment”; the term “another embodiment” means “at least one further embodiment”; the term “some embodiments” means “at least some embodiments.” Relevant definitions of other terms will be given in the description below.
  • Fig. 1 is a flow chart of a video recognition method shown according to an exemplary embodiment. As shown in Fig. 1, the method includes the following steps:
  • Step 101 preprocessing the acquired video to be processed to obtain a target video.
  • the video to be processed may be obtained, and the video to be processed may be a video stored locally, or a video obtained from a server through a network.
  • the video to be processed needs to be preprocessed to obtain a preprocessed target video.
  • the preprocessing may include two steps: cleaning and sampling. Cleaning the video to be processed can be understood as performing noise reduction, cropping, etc. on the video to be processed, and can also remove the differences between adjacent video frames in the video to be processed. Large video frames.
  • Sampling the video to be processed one way is to extract multiple video frames from the video to be processed according to the preset time interval to form the target video, and the other way is to extract a specified number of frames from the video to be processed according to the specified number video frames to form the target video.
  • the video to be processed can be cleaned first, and then 16 video frames are extracted from the cleaned video, and the target video is composed according to the timing of each video frame in the video to be processed, that is, the target video includes 16 video frames.
  • Step 102 input the target video into the pre-trained recognition model to obtain the recognition result output by the recognition model, and the recognition result is used to represent the category of the video to be processed.
  • the recognition model consists of encoder and projection layers.
  • the encoder is obtained according to multiple pre-projection layers and the first number of pre-training videos, and each pre-projection layer is used to extract a video feature of the pre-training videos.
  • the recognition model is obtained according to a pre-trained encoder and a second number of training videos, the second number is smaller than the first number, and the pre-training videos do not have category labels for indicating categories.
  • a recognition model may be pre-trained to recognize video categories, and the categories may be action categories, content categories, weather categories, security categories, etc., which are not specifically limited in the present disclosure.
  • the recognition model includes an encoder and a projection layer.
  • the encoder is used to encode the video
  • the projection layer is used to project the encoding result into a feature vector used to characterize the video.
  • the video is recognized according to the feature vector.
  • the target video can be input into the recognition model, and the output of the recognition model is the recognition result used to characterize the category of the video to be processed.
  • the encoder in the recognition model is obtained by pre-training according to multiple pre-projection layers and the first number of pre-training videos without category labels.
  • the recognition model is trained according to a pre-trained encoder and a second number of training videos, wherein the second number is much smaller than the first number, for example, the second number is 100, and the first number is 5000. That is to say, before training the recognition model, you can use a large number of pre-training videos without category labels and multiple pre-projection layers to pre-train the encoder, where each pre-projection layer is used to extract the pre-training video
  • Each video feature can characterize the video from one dimension, that is, the types of video features extracted by different pre-projection layers are different.
  • any two pre-training videos can be input into the encoder, and the encoder encodes the pre-training videos, and then input the encoding results into multiple pre-projection layers, and each pre-projection layer extracts a video features. Then use the self-supervised method (English: Self-supervised learning) to adjust the parameters in the encoder and multiple pre-projection layers by comparing each video feature of the two pre-training videos, so as to achieve the pre-training of the encoder. Purpose.
  • pre-training the encoder multiple video features corresponding to multiple pre-projection layers are combined, so that the encoder can learn video representations in multiple dimensions, which can effectively improve the representation and generalization capabilities of the encoder.
  • videos without category labels are easy to obtain, a large number of videos in various fields can be selected as pre-training videos, which further improves the representation ability and generalization ability of the encoder.
  • the recognition model may be trained according to the pre-trained encoder and a second number of training videos, wherein the training videos may be a small number of videos with class labels.
  • any training video can be input into a pre-trained encoder for encoding, and then the encoding result can be input into a projection layer, which can project the encoding result into a feature vector that can represent the training video, and then according to the feature vector
  • the vector predicts the category of the training video, and finally the predicted category of the training video can be compared with the category label of the training video to adjust the projection layer and/or the encoder, so as to achieve the purpose of training the recognition model.
  • the recognition accuracy of the recognition model Due to the high representation ability and generalization ability of the pre-trained encoder, the recognition accuracy of the recognition model has also been improved. Fine-tuning), also improves the efficiency of recognition model training.
  • the present disclosure first preprocesses the acquired video to be processed to obtain the target video, and then inputs the target video into the pre-trained recognition model to obtain the output of the recognition model, which is used to represent the category of the video to be processed recognition results.
  • the recognition model includes an encoder and a projection layer, and the encoder obtains pre-training according to multiple pre-projection layers and the first number of pre-training videos without category labels, and each pre-projection layer is used to extract the pre-training video A video feature.
  • the recognition model is trained based on the pre-trained encoder and the second number of training videos.
  • the encoder included in the recognition model in this disclosure is pre-trained through a self-supervised method and a pre-projection layer capable of extracting various video features, so as to improve the representation ability and generalization ability of the encoder, thereby improving the recognition accuracy of the recognition model .
  • Fig. 2 is a flowchart of another video recognition method shown according to an exemplary embodiment. As shown in Fig. 2, the implementation of step 102 may include:
  • Step 1021 Encode the target video through an encoder to obtain an encoding vector corresponding to the target video.
  • Step 1022 Project the coding vector into a video vector through the projection layer, the dimension of the video vector is the same as the number of the categories to be selected, and the category of the video to be processed belongs to the category to be selected.
  • Step 1023 determine the recognition result according to the video vector.
  • the specific process of identifying the target video may first input the target video into an encoder, and the encoder encodes the target video, and the output of the encoder is the encoding vector corresponding to the target video. Afterwards, the encoding vector is input into the projection layer, and the projection layer projects the encoding vector into a video vector representing the target video (that is, the output of the projection layer).
  • the projection layer can be understood as a linear layer or a fully connected layer.
  • the dimension of the video vector (which can also be understood as the output dimension of the projection layer) is the same as the number of categories to be selected, which can be understood as the number of categories that the video to be processed may be identified as, which can be determined according to specific needs .
  • the categories to be selected can be: smooth road conditions, uphill road conditions, and downhill road conditions, a total of 3 types.
  • the categories to be selected can be: safety, third-level danger, second-level danger, and first-level danger, a total of 4 types.
  • the Softmax layer can be used to process the video vector to obtain the matching probabilities of the target video and various candidate categories. Finally, the candidate category with the highest matching probability can be used as the category of the video to be processed, that is, the recognition result.
  • Fig. 3 is a flow chart showing a pre-training encoder according to an exemplary embodiment. As shown in Fig. 3, the encoder is obtained through pre-training in the following manner:
  • Step 201 preprocessing the first number of pre-training videos to obtain a target pre-training video corresponding to each pre-training video.
  • Step 202 Input each target pre-training video into an encoder, and input the output of the encoder into multiple pre-projection layers, so as to obtain a video feature of the target pre-training video extracted by each pre-projection layer.
  • Step 203 according to various video features of each target pre-training video, pre-training encoder and multiple pre-projection layers.
  • the first number of pre-training videos without category labels can be pre-collected, and then each pre-training video is pre-processed to obtain the target pre-training video corresponding to each pre-training video.
  • the training video is to obtain the first number of target pre-training videos.
  • the manner of preprocessing the pre-training video may be the same as the manner of preprocessing the video to be processed in step 101, which will not be repeated here.
  • multiple pre-projection layers can be established, and the input end of each pre-projection layer is connected to the output end of the encoder, as shown in FIG. 4 .
  • the pre-projection layer can be understood as a linear layer or a fully connected layer.
  • the input dimension of each pre-projection layer is the output dimension of the encoder, and the output dimension of each pre-projection layer can be different. That is to say, multiple pre-projection layers can extract multiple videos of different dimensions. feature.
  • the output of the encoder is 1*N dimension
  • the multiple pre-projection layers can be N*T dimension, N*(T+1) dimension, N*(T+2) dimension, N(T+3)
  • the video features extracted by multiple pre-projection layers can be 1*T dimension, 1*(T+1) dimension, 1*(T+2) dimension, 1*(T+3) dimension wait.
  • the first number of target pre-training videos can be respectively input into the encoder, and the output of the encoder can be input into multiple pre-projection layers, so as to obtain a video feature of the target pre-training video extracted by each pre-projection layer.
  • an encoder and multiple pre-projection layers are pre-trained based on multiple video features of each target pre-trained video.
  • a self-supervised method can be used to determine the loss function, and with the goal of reducing the loss function, the backpropagation algorithm can be used to modify the parameters of the encoder and neurons in multiple pre-projection layers.
  • the parameters of the neurons can be, for example, neurons The weight (English: Weight) and bias (English: Bias). Repeat the above steps until the loss function satisfies the preset condition, for example, the loss function is smaller than the preset loss threshold, and the pre-training of the encoder is completed.
  • FIG. 5 is a flow chart of another pre-training encoder according to an exemplary embodiment. As shown in FIG. 5, step 203 can be implemented by the following steps:
  • Step 2031 for each video feature, according to the video features of every two target pre-training videos, the loss corresponding to the video feature is determined.
  • Step 2032 determine the comprehensive loss according to the loss corresponding to each video feature.
  • Step 2033 aiming at reducing the comprehensive loss, pre-training the encoder and multiple pre-projection layers using the backpropagation algorithm.
  • the specific manner of pre-training the encoder and multiple pre-projection layers may first determine the loss corresponding to each video feature, and then determine the comprehensive loss according to the loss corresponding to each video feature. For example, the losses corresponding to each video feature can be averaged, or weighted and summed, as a comprehensive loss. Finally, with the goal of reducing the overall loss, the encoder and multiple pre-projection layers are pre-trained using the back-propagation algorithm. Specifically, the loss corresponding to each video feature can be determined by formula 1:
  • L c represents the loss corresponding to any video feature
  • M represents the batch_size (ie, batch size) of the pre-training encoder and multiple pre-projection layers
  • z i represents the video feature of the i-th target training video
  • z i+ represents the video feature of the positive sample of the i-th target training video (which can be understood as the same video as the i-th target training video) in the M target training videos
  • z k represents the k-th target training video.
  • This kind of video feature can be understood as the negative sample of the i-th target training video in the M target training videos, that is, a video that is different from the i-th target training video
  • represents a preset adjustment coefficient, for example, it can be 0.07.
  • Fig. 6 is a flowchart showing a training recognition model according to an exemplary embodiment. As shown in Fig. 6, the recognition model is obtained by training in the following manner:
  • Step 301 preprocessing the second number of training videos to obtain a target training video corresponding to each training video.
  • Step 302 input each target training video into the recognition model, and train the recognition model according to the output of the recognition model and the category label of the training video corresponding to the target training video.
  • a second number of training videos may be collected in advance, and each training video has a category label. Then each training video is preprocessed to obtain the corresponding target training video of each training video, that is, obtain the second number of target training videos.
  • the manner of preprocessing the training video may be the same as the manner of preprocessing the video to be processed in step 101, which will not be repeated here.
  • each target training video can be input into the recognition model, and the recognition model can be trained according to the output of the recognition model and the category label of the training video corresponding to the target training video.
  • the loss function can be determined according to the output of the recognition model and the category label of the training video corresponding to the target training video, and with the goal of reducing the loss function, the backpropagation algorithm is used to correct the parameters of the neurons in the recognition model, neurons
  • the parameters of can be, for example, the weights and biases of neurons.
  • Fig. 7 is a flow chart showing another training recognition model according to an exemplary embodiment. As shown in Fig. 7, step 302 may include:
  • Step 3021 input the target training video into the pre-trained encoder, so as to obtain the training encoding vector corresponding to the target training video output by the pre-trained encoder.
  • Step 3022 input the training encoding vector into the projection layer to obtain the training video vector output by the projection layer.
  • Step 3023 input the training video vector into the classification layer of the recognition model to obtain the training recognition result output by the classification layer, and use the training recognition result as the output of the recognition model.
  • Step 3024 Train the projection layer and/or the encoder according to the training recognition result and the category label of the training video corresponding to the target training video.
  • the structure of the recognition model can be shown in FIG. 8 , which includes a pre-trained encoder, a projection layer and a classification layer, wherein the projection layer can be understood as a linear layer or a fully connected layer.
  • the input dimension of the projection layer is the output dimension of the encoder, and the output dimension of the projection layer may be determined according to the number of categories that the video to be processed may be identified as.
  • the classification layer can be understood as a Softmax layer.
  • a specific way of training the recognition model is to first input any target training video into a pre-trained encoder to obtain a training encoding vector corresponding to the target training video output by the pre-trained encoder.
  • the training encoding vector into the projection layer to obtain the training video vector output by the projection layer
  • the training video vector into the classification layer of the recognition model to obtain the training recognition result output by the classification layer, and use the training recognition result as the recognition
  • the classification layer can determine the matching probabilities between the target training video and multiple candidate categories according to the training video vector, and then use the candidate category with the highest matching probability as the training recognition result.
  • the projection layer and/or the encoder can be trained according to the training recognition result and the category label of the training video corresponding to the target training video.
  • the matching probabilities of the target training video determined by the classification layer and various candidate categories can be compared with the category labels of the training videos corresponding to the target training video to modify the projection layer and/or the neural network in the encoder.
  • the parameters of the neuron may be, for example, the weight and bias of the neuron. It should be noted that, in one way, when training the recognition model, only the parameters of the neurons in the projection layer can be corrected, so that after a small amount of adjustment (also can be understood as fine-tuning), the well-trained neurons can be quickly obtained. Identify the model. In another implementation manner, when training the recognition model, the parameters of the neurons in the projection layer and the encoder can also be corrected at the same time, which can further improve the recognition accuracy of the recognition model. In yet another implementation, when training the recognition model, only the parameters of the neurons in the encoder can be corrected. The present disclosure does not specifically limit this.
  • Fig. 9 is a flow chart showing another training recognition model according to an exemplary embodiment. As shown in Fig. 9, the recognition model is also obtained through training in the following manner:
  • Step 303 Determine the output dimension of the projection layer according to the number of candidate categories, so that the dimension of the training video vector output by the projection layer is the same as the number of candidate categories.
  • the category of the video to be processed belongs to the category to be selected.
  • the output dimension of the projection layer can be determined according to the number of candidate categories that the video to be processed may be recognized as, so that the dimension of the training video vector output by the projection layer is the same as that of the candidate category same amount. That is to say, the output dimension of the projection layer can be determined according to the specific task that the recognition model needs to complete.
  • the video to be processed is a road condition video collected by a vehicle, which is used to determine the slope of the road.
  • the categories to be selected can be: smooth road conditions, uphill road conditions, and downhill road conditions, a total of three types. Then the output dimension of the projection layer can be 3.
  • the video to be processed is the surveillance video collected by the security system, which is used to judge whether there is a dangerous situation.
  • the categories to be selected can be: safety, third-level danger, second-level danger, and first-level danger.
  • the output dimension of the projection layer can be 4. In this way, after pre-training the encoder with a large number of pre-training videos without category labels, when training the recognition model, you can select projection layers with different output dimensions according to specific needs, and use a small number of training videos.
  • a recognition model capable of recognizing multiple categories to be selected is obtained through training.
  • the present disclosure first preprocesses the acquired video to be processed to obtain the target video, and then inputs the target video into the pre-trained recognition model to obtain the output of the recognition model, which is used to represent the category of the video to be processed recognition results.
  • the recognition model includes an encoder and a projection layer, and the encoder obtains pre-training according to multiple pre-projection layers and the first number of pre-training videos without category labels, and each pre-projection layer is used to extract the pre-training video A video feature.
  • the recognition model is trained based on the pre-trained encoder and the second number of training videos.
  • the encoder included in the recognition model in this disclosure is pre-trained through a self-supervised method and a pre-projection layer capable of extracting various video features, so as to improve the representation ability and generalization ability of the encoder, thereby improving the recognition accuracy of the recognition model .
  • Fig. 10 is a block diagram of a video recognition device according to an exemplary embodiment. As shown in Fig. 10, the device 400 includes:
  • the preprocessing module 401 is configured to preprocess the acquired video to be processed to obtain a target video.
  • the recognition module 402 is configured to input the target video into a pre-trained recognition model to obtain a recognition result output by the recognition model, and the recognition result is used to represent the category of the video to be processed.
  • the recognition model consists of encoder and projection layers.
  • the encoder is pre-trained according to multiple pre-projection layers and the first number of pre-training videos, and each pre-projection layer is used to extract a video feature of the pre-training video.
  • the recognition model is obtained according to a pre-trained encoder and a second number of training videos, the second number is smaller than the first number, and the pre-training videos do not have category labels for indicating categories.
  • Fig. 11 is a block diagram of another video recognition device according to an exemplary embodiment.
  • the recognition module 402 may include:
  • the encoding sub-module 4021 is configured to encode the target video through an encoder to obtain an encoding vector corresponding to the target video.
  • the projection sub-module 4022 is configured to project the encoding vector into a video vector through the projection layer, the dimension of the video vector is the same as the number of the categories to be selected, and the category of the video to be processed belongs to the category to be selected.
  • the identification sub-module 4023 is configured to determine the identification result according to the video vector.
  • the encoder can be obtained through pre-training as follows:
  • Step A preprocessing the first number of pre-training videos to obtain a target pre-training video corresponding to each pre-training video.
  • Step B input each target pre-training video into the encoder, and input the output of the encoder into multiple pre-projection layers, so as to obtain a video feature of the target pre-training video extracted by each pre-projection layer.
  • Step C pre-train the encoder and multiple pre-projection layers according to various video features of each target pre-training video.
  • step C may be implemented through the following steps:
  • Step C1 for each video feature, according to the video features of every two target pre-training videos, determine the loss corresponding to the video feature.
  • Step C2 determine the comprehensive loss according to the loss corresponding to each video feature.
  • Step C3 with the goal of reducing the overall loss, pre-trains the encoder and multiple pre-projection layers using the back-propagation algorithm.
  • the recognition model may be obtained through training as follows:
  • Step D preprocessing the second number of training videos to obtain a target training video corresponding to each training video.
  • Step E input each target training video into the recognition model, and train the recognition model according to the output of the recognition model and the category label of the training video corresponding to the target training video.
  • step E may include:
  • Step E1 inputting the target training video into a pre-trained encoder to obtain a training encoding vector corresponding to the target training video output by the pre-trained encoder.
  • Step E2 input the training encoding vector into the projection layer to obtain the training video vector output by the projection layer.
  • Step E3 input the training video vector into the classification layer of the recognition model to obtain the training recognition result output by the classification layer, and use the training recognition result as the output of the recognition model.
  • Step E4 training the projection layer and/or the encoder according to the training recognition result and the category label of the training video corresponding to the target training video.
  • the recognition model is also obtained through training in the following manner:
  • Step F Determine the output dimension of the projection layer according to the number of categories to be selected, so that the dimension of the training video vector output by the projection layer is the same as the number of categories to be selected.
  • the category of the video to be processed belongs to the category to be selected.
  • the present disclosure first preprocesses the acquired video to be processed to obtain the target video, and then inputs the target video into the pre-trained recognition model to obtain the output of the recognition model, which is used to represent the category of the video to be processed recognition results.
  • the recognition model includes an encoder and a projection layer, and the encoder obtains pre-training according to multiple pre-projection layers and the first number of pre-training videos without category labels, and each pre-projection layer is used to extract the pre-training video A video feature.
  • the recognition model is trained based on the pre-trained encoder and the second number of training videos.
  • the encoder included in the recognition model in this disclosure is pre-trained through a self-supervised method and a pre-projection layer capable of extracting various video features, so as to improve the representation ability and generalization ability of the encoder, thereby improving the recognition accuracy of the recognition model .
  • FIG. 12 shows a schematic structural diagram of an electronic device (that is, the execution subject of the above-mentioned video recognition method, which may be a terminal device or a server) 500 suitable for implementing an embodiment of the present disclosure.
  • the terminal equipment in the embodiment of the present disclosure may include but not limited to such as mobile phone, notebook computer, digital broadcast receiver, PDA (personal digital assistant), PAD (tablet computer), PMP (portable multimedia player), vehicle terminal (such as mobile terminals such as car navigation terminals) and fixed terminals such as digital TVs, desktop computers and the like.
  • the electronic device shown in FIG. 12 is only an example, and should not limit the functions and application scope of the embodiments of the present disclosure.
  • an electronic device 500 may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 501, which may be randomly accessed according to a program stored in a read-only memory (ROM) 502 or loaded from a storage device 508.
  • a processing device such as a central processing unit, a graphics processing unit, etc.
  • RAM read-only memory
  • various appropriate actions and processes are executed by programs in the memory (RAM) 503 .
  • RAM 503 In the RAM 503, various programs and data necessary for the operation of the electronic device 500 are also stored.
  • the processing device 501, ROM 502, and RAM 503 are connected to each other through a bus 504.
  • An input/output (I/O) interface 505 is also connected to the bus 504 .
  • the following devices can be connected to the I/O interface 505: input devices 506 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; including, for example, a liquid crystal display (LCD), speaker, vibration an output device 507 such as a computer; a storage device 508 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 509.
  • the communication means 509 may allow the electronic device 500 to perform wireless or wired communication with other devices to exchange data. While FIG. 12 shows electronic device 500 having various means, it is to be understood that implementing or having all of the means shown is not a requirement. More or fewer means may alternatively be implemented or provided.
  • embodiments of the present disclosure include a computer program product, which includes a computer program carried on a non-transitory computer readable medium, where the computer program includes program code for executing the method shown in the flowchart.
  • the computer program may be downloaded and installed from a network via communication means 509, or from storage means 508, or from ROM 502.
  • the processing device 501 When the computer program is executed by the processing device 501, the above-mentioned functions defined in the methods of the embodiments of the present disclosure are executed.
  • the above-mentioned computer-readable medium in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two.
  • a computer readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer diskettes, hard disks, random access memory (RAM), read-only memory (ROM), erasable Programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave carrying computer-readable program code therein. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • a computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can transmit, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device .
  • Program code embodied on a computer readable medium may be transmitted by any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
  • the terminal device and the server can communicate with any currently known or future-developed network protocols such as HTTP (HyperText Transfer Protocol, Hypertext Transfer Protocol), and can communicate with digital data in any form or medium Communications (eg, communication networks) are interconnected.
  • Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), internetworks (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network of.
  • the above-mentioned computer-readable medium may be included in the above-mentioned electronic device, or may exist independently without being incorporated into the electronic device.
  • the above-mentioned computer-readable medium carries one or more programs, and when the above-mentioned one or more programs are executed by the electronic device, the electronic device: pre-processes the acquired video to be processed to obtain the target video;
  • the target video is input into a pre-trained recognition model to obtain the recognition result output by the recognition model, and the recognition result is used to characterize the category of the video to be processed;
  • the recognition model includes an encoder and a projection layer; the encoding
  • the device is pre-trained according to a plurality of pre-projection layers and the first number of pre-training videos, and each of the pre-projection layers is used to extract a video feature of the pre-training video;
  • the recognition model is based on the The encoder is pre-trained, and a second number of training videos is trained, the second number is smaller than the first number, and the pre-training videos do not have a class label for indicating a class.
  • Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, or combinations thereof, including but not limited to object-oriented programming languages—such as Java, Smalltalk, C++, and Includes conventional procedural programming languages - such as "C" or similar programming languages.
  • the program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server.
  • the remote computer may be connected to the user computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (for example, using an Internet service provider to connected via the Internet).
  • LAN local area network
  • WAN wide area network
  • Internet service provider for example, using an Internet service provider to connected via the Internet.
  • each block in a flowchart or block diagram may represent a module, program segment, or portion of code that contains one or more logical functions for implementing specified executable instructions.
  • the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved.
  • each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations can be implemented by a dedicated hardware-based system that performs the specified functions or operations , or may be implemented by a combination of dedicated hardware and computer instructions.
  • modules involved in the embodiments described in the present disclosure may be implemented by software or by hardware. Wherein, the name of the module does not constitute a limitation of the module itself under certain circumstances, for example, the preprocessing module may also be described as "a module for preprocessing the video to be processed".
  • FPGAs Field Programmable Gate Arrays
  • ASICs Application Specific Integrated Circuits
  • ASSPs Application Specific Standard Products
  • SOCs System on Chips
  • CPLD Complex Programmable Logical device
  • a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device.
  • a machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.
  • a machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing.
  • machine-readable storage media would include one or more wire-based electrical connections, portable computer discs, hard drives, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, compact disk read only memory (CD-ROM), optical storage, magnetic storage, or any suitable combination of the foregoing.
  • RAM random access memory
  • ROM read only memory
  • EPROM or flash memory erasable programmable read only memory
  • CD-ROM compact disk read only memory
  • magnetic storage or any suitable combination of the foregoing.
  • Example 1 provides a video recognition method, including: preprocessing the acquired video to be processed to obtain a target video; inputting the target video into a pre-trained recognition model, to obtain the recognition result output by the recognition model, the recognition result is used to characterize the category of the video to be processed;
  • the recognition model includes an encoder and a projection layer; the encoder is based on a plurality of pre-projection layers And the first number of pre-training videos, obtained by pre-training, each of the pre-projection layers is used to extract a video feature of the pre-training video;
  • the recognition model is based on the pre-trained encoder, and a second number of training videos, the second number is smaller than the first number, and the pre-training videos do not have a class label for indicating a class.
  • Example 2 provides the method of Example 1.
  • the inputting the target video into the pre-trained recognition model to obtain the recognition result output by the recognition model includes: through the The encoder encodes the target video to obtain a coding vector corresponding to the target video; projects the coding vector into a video vector through the projection layer, and the dimension of the video vector is the same as the number of categories to be selected , the category of the video to be processed belongs to the category to be selected; and the recognition result is determined according to the video vector.
  • Example 3 provides the method of Example 1, and the encoder is obtained by pre-training in the following manner: preprocessing the first number of pre-training videos to obtain each Each target pre-training video corresponding to the pre-training video; each of the target pre-training videos is input into the encoder, and the output of the encoder is input into a plurality of the pre-projection layers to obtain each A video feature of the target pre-training video extracted by the pre-projection layer; pre-training the encoder and multiple pre-projection layers according to various video features of each target pre-training video.
  • Example 4 provides the method of Example 3, said pre-training said encoder and a plurality of said pre-projection according to various video features of each said target pre-training video layer, including: for each video feature, according to the video feature of each two described target pre-training videos, determine the loss corresponding to the video feature; determine the comprehensive loss according to the loss corresponding to each video feature; to reduce the Targeting the comprehensive loss, the encoder and multiple pre-projection layers are pre-trained using a back-propagation algorithm.
  • Example 5 provides the method of Example 1, the recognition model is obtained by training in the following manner: preprocessing the second number of training videos to obtain each of the The target training video corresponding to the training video; each of the target training videos is input into the recognition model, and according to the output of the recognition model and the category label of the training video corresponding to the target training video, train the recognition Model.
  • Example 6 provides the method of Example 5, inputting each of the target training videos into the recognition model, and corresponding to the target training video according to the output of the recognition model
  • the category label of the training video, training the recognition model includes: inputting the target training video into the pre-trained encoder, so as to obtain the output of the pre-trained encoder, the target training video corresponds to The training encoding vector; input the training encoding vector into the projection layer to obtain the training video vector output by the projection layer; input the training video vector into the classification layer of the recognition model to obtain the classification layer The output training recognition result, and the training recognition result as the output of the recognition model; according to the training recognition result and the category label of the training video corresponding to the target training video, train the projection layer, and/ or the encoder.
  • Example 7 provides the method of Example 6, and the recognition model is also obtained through training in the following manner: according to the number of categories to be selected, the output dimension of the projection layer is determined, so that The dimension of the training video vector output by the projection layer is the same as the number of the candidate categories; the category of the video to be processed belongs to the candidate categories.
  • Example 8 provides a video recognition device, including: a preprocessing module, configured to preprocess the acquired video to be processed to obtain a target video; a recognition module configured to Inputting the target video into a pre-trained recognition model to obtain a recognition result output by the recognition model, the recognition result is used to characterize the category of the video to be processed; the recognition model includes an encoder and a projection layer; The encoder is pre-trained according to multiple pre-projection layers and a first number of pre-training videos, and each of the pre-projection layers is used to extract a video feature of the pre-training video; the recognition model is obtained by training according to the pre-trained encoder and a second number of training videos, the second number being smaller than the first number, the pre-training videos not having a class label for indicating a class.
  • a preprocessing module configured to preprocess the acquired video to be processed to obtain a target video
  • a recognition module configured to Inputting the target video into a pre-trained recognition model to obtain a recognition result output
  • Example 9 provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processing device, the steps of the methods described in Example 1 to Example 7 are implemented.
  • Example 10 provides an electronic device, including: a storage device, on which a computer program is stored; a processing device, configured to execute the computer program in the storage device, to Implement the steps of the method described in Example 1 to Example 7.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Health & Medical Sciences (AREA)
  • Software Systems (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Biophysics (AREA)
  • Biomedical Technology (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Health & Medical Sciences (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Image Analysis (AREA)

Abstract

本公开涉及一种视频的识别方法、装置、可读介质和电子设备,涉及图像处理技术领域,该方法包括:对获取到的待处理视频进行预处理,以得到目标视频,将目标视频输入预先训练的识别模型,以得到识别模型输出的识别结果,识别结果用于表征待处理视频的类别;识别模型包括编码器和投射层,编码器为根据多个预投射层和第一数量个预训练视频,预训练得到的,每个预投射层用于提取预训练视频的一种视频特征,识别模型为根据经过预训练的编码器,和第二数量的训练视频训练得到的,第二数量小于第一数量,预训练视频不具有用于指示类别的类别标签。本公开中能够提高编码器的表征能力和泛化能力,从而提高识别模型的识别准确度。

Description

视频的识别方法、装置、可读介质和电子设备
相关申请的交叉引用
本申请基于申请号为202111050220.1、申请日为2021年09月08日,名称为“视频的识别方法、装置、可读介质和电子设备”的中国专利申请提出,并要求该中国专利申请的优先权,上述中国专利申请的公开内容全文以引入方式并入本文。
技术领域
本公开涉及图像处理技术领域,具体地,涉及一种视频的识别方法、装置、可读介质和电子设备。
背景技术
随着图像处理技术的不断发展,越来越多的业务领域开始借助视频识别来完成任务,例如利用视频来识别危险行为、利用视频来识别路况、障碍物等。通常情况下,在进行视频识别之前,需要预先采集海量具有标注的图像,以作为视频识别的参考基准。然而对图像进行标注需要投入大量人力物力,工作繁杂,效率低,难以实现,降低了视频识别的准确度。
发明内容
提供该发明内容部分以便以简要的形式介绍构思,这些构思将在后面的具体实施方式部分被详细描述。该发明内容部分并不旨在标识要求保护的技术方案的关键特征或必要特征,也不旨在用于限制所要求的保护的技术方案的范围。
第一方面,本公开提供一种视频的识别方法,所述方法包括:
对获取到的待处理视频进行预处理,以得到目标视频;
将所述目标视频输入预先训练的识别模型,以得到所述识别模型输出的识别结果,所述识别结果用于表征所述待处理视频的类别;所述识别模型包括编码器和投射层;
所述编码器为根据多个预投射层和第一数量个预训练视频,预训练得到的,每个所述预投射层用于提取所述预训练视频的一种视频特征;
所述识别模型为根据经过预训练的所述编码器,和第二数量的训练视频训练得到的,所述第二数量小于所述第一数量,所述预训练视频不具有用于指示类别的类别标签。
第二方面,本公开提供一种视频的识别装置,所述装置包括:
预处理模块,用于对获取到的待处理视频进行预处理,以得到目标视频;
识别模块,用于将所述目标视频输入预先训练的识别模型,以得到所述识别模型输出的识别结果,所述识别结果用于表征所述待处理视频的类别;所述识别模型包括编码器和投射层;
所述编码器为根据多个预投射层和第一数量个预训练视频,预训练得到的,每个所述预投射层用于提取所述预训练视频的一种视频特征;
所述识别模型为根据经过预训练的所述编码器,和第二数量的训练视频训练得到的,所述第二数量小于所述第一数量,所述预训练视频不具有用于指示类别的类别标签。
第三方面,本公开提供一种计算机可读介质,其上存储有计算机程序,该程序被处理装置执行时实现本公开第一方面所述方法的步骤。
第四方面,本公开提供一种电子设备,包括:
存储装置,其上存储有计算机程序;
处理装置,用于执行所述存储装置中的所述计算机程序,以实现本公开第一方面所述方法的步骤。
通过上述技术方案,本公开首先对获取到的待处理视频进行预处理,以得到目标视频,之后将目标视频输入预先训练的识别模型,以得到识别模型输出的,用于表征待处理视频的类别的识别结果。其中,识别模型包括编码器和投射层,编码器根据多个预投射层和第一数量个、不具有类别标签的预训练视频,预训练得到,每个预投射层用于提取预训练视频的一种视频特征。识别模型根据经过预训练的编码器,和第二数量的训练视频训练得到。本公开中识别模型包括的编码器通过自监督方法,并借助能够提取多种视频特征的预投射层进行预训练,以提高编码器的表征能力和泛化能力,从而提高识别模型的识别准确度。
本公开的其他特征和优点将在随后的具体实施方式部分予以详细说明。
附图说明
结合附图并参考以下具体实施方式,本公开各实施例的上述和其他特征、优点及方面将变得更加明显。贯穿附图中,相同或相似的附图标记表示相同或相似的元素。应当理解附图是示意性的,原件和元素不一定按照比例绘制。在附图中:
图1是根据一示例性实施例示出的一种视频的识别方法的流程图;
图2是根据一示例性实施例示出的另一种视频的识别方法的流程图;
图3是根据一示例性实施例示出的一种预训练编码器的流程图;
图4是根据一示例性实施例示出的编码器与预投射层的结构图;
图5是根据一示例性实施例示出的另一种预训练编码器的流程图;
图6是根据一示例性实施例示出的一种训练识别模型的流程图;
图7是根据一示例性实施例示出的另一种训练识别模型的流程图;
图8是根据一示例性实施例示出的一种识别模型的结构图;
图9是根据一示例性实施例示出的另一种训练识别模型的流程图;
图10是根据一示例性实施例示出的一种视频的识别装置的框图;
图11是根据一示例性实施例示出的另一种视频的识别装置的框图;
图12是根据一示例性实施例示出的一种电子设备的框图。
具体实施方式
下面将参照附图更详细地描述本公开的实施例。虽然附图中显示了本公开的某些实施例,然而应当理解的是,本公开可以通过各种形式来实现,而且不应该被解释为限于这里阐述的实施例,相反提供这些实施例是为了更加透彻和完整地理解本公开。应当理解的是,本公开的附图及实施例仅用于示例性作用,并非用于限制本公开的保护范围。
应当理解,本公开的方法实施方式中记载的各个步骤可以按照不同的顺序执行,和/或并行执行。此外,方法实施方式可以包括附加的步骤和/或省略执行示出的步骤。本公开的范围在此方面不受限制。
本文使用的术语“包括”及其变形是开放性包括,即“包括但不限于”。术语“基于”是“至少部分地基于”。术语“一个实施例”表示“至少一个实施例”;术语“另一实施例”表示“至少一个另外的实施例”;术语“一些实施例”表示“至少一些实施例”。其他术语的相关定义将在下文描述中给出。
需要注意,本公开中提及的“第一”、“第二”等概念仅用于对不同的装置、模块或单元进行区分,并非用于限定这些装置、模块或单元所执行的功能的顺序或者相互依存关系。
需要注意,本公开中提及的“一个”、“多个”的修饰是示意性而非限制性的,本领域技术人员应当理解,除非在上下文另有明确指出,否则应该理解为“一个或多个”。
本公开实施方式中的多个装置之间所交互的消息或者信息的名称仅用于说明性的目的,而并不是用于对这些消息或信息的范围进行限制。
图1是根据一示例性实施例示出的一种视频的识别方法的流程图,如图1所示,该方法包括以下步骤:
步骤101,对获取到的待处理视频进行预处理,以得到目标视频。
举例来说,首先可以获取待处理视频,待处理视频可以是存储在本地的视频,也可以是通过网络从服务器获取的视频。在对待处理视频进行识别之前,需要对待处理视频进行预处理,以得到预处理后的目标视频。具体的,预处理可以包括:清洗和采样两个步骤,对待处理视频进行清洗,可以理解为对待处理视频进行降噪、裁剪等处理,还可以去除待处理视频中与相邻的视频帧差别较大的视频帧。对待处理视频进行采样,一种方式是按照预设的时间间隔,从待处理视频中抽取多个视频帧,以组成目标视频,另一种方式是按照指定数量,从待处理视频中抽取指定数量的视频帧,以组成目标视频。例如,可以先对待处理视频进行清洗,然后从经过清洗后的视频中抽取16个视频帧,按照每个视频帧在待处理视频中的时序组成目标视频,即目标视频中包括16个视频帧。
步骤102,将目标视频输入预先训练的识别模型,以得到识别模型输出的识别结果,识别结果用于表征待处理视频的类别。识别模型包括编码器和投射层。
其中,编码器为根据多个预投射层和第一数量个预训练视频,预训练得到的,每个预投射层用于 提取预训练视频的一种视频特征。
识别模型为根据经过预训练的编码器,和第二数量的训练视频训练得到的,第二数量小于第一数量,预训练视频不具有用于指示类别的类别标签。
示例的,可以预先训练一个识别模型,用于识别视频的类别,类别可以是动作类别、内容类别、天气类别、安全类别等,本公开对此不作具体限定。识别模型包括编码器和投射层,编码器用于对视频进行编码,投射层用于将编码结果投射为用于表征视频的特征向量,最后根据特征向量对视频进行识别。在得到目标视频之后,可以将目标视频输入识别模型,识别模型的输出即为,用于表征待处理视频的类别的识别结果。
其中,识别模型中的编码器,是根据多个预投射层和第一数量个不具有类别标签的预训练视频,预训练得到的。识别模型是根据经过预训练的编码器,和第二数量的训练视频训练得到的,其中,第二数量远小于第一数量,例如,第二数量为100,第一数量为5000。也就是说在对识别模型进行训练之前,可以先利用大量的不具有类别标签的预训练视频,和多个预投射层来预训练编码器,其中,每个预投射层用于提取预训练视频的一种视频特征,每种视频特征可以从一种维度来表征视频,即不同的预投射层提取的视频特征的种类不同。在对编码器进行预训练时,可以将任意两个预训练视频输入编码器,由编码器对预训练视频进行编码,然后将编码结果分别输入多个预投射层,每个预投射层提取一种视频特征。然后利用自监督方法(英文:Self-supervised learning),通过比较该两个预训练视频的每种视频特征,来调整编码器和多个预投射层中的参数,从而达到对编码器预训练的目的。由于在对编码器进行预训练时,结合了多个预投射层对应的多种视频特征,使得编码器学习到多个维度上视频的表征,能够有效提高编码器的表征能力和泛化能力。同时,由于不具有类别标签的视频很容易获得,可以选取各种领域海量的视频作为预训练视频,进一步提高了编码器的表征能力和泛化能力。
在完成对编码器的预训练之后,可以根据经过预训练的编码器,和第二数量的训练视频训练识别模型,其中,训练视频可以是少量的具有类别标签的视频。例如,可以将任一个训练视频输入经过预训练的编码器进行编码,然后将编码结果输入一个投射层,该投射层能够将编码结果投射为能够表征该训练视频的特征向量,之后再根据该特征向量预测该训练视频的类别,最后可以将预测的该训练视频的类别,与该训练视频的类别标签进行比较,来调整投射层,和/或编码器,从而达到训练识别模型的目的。由于经过预训练的编码器的表征能力和泛化能力高,因此识别模型的识别准确度也得到了提高,同时,通过少量的训练视频就可以快速训练好识别模型(可以理解为对识别模型进行微调),也提高了识别模型训练的效率。
综上所述,本公开首先对获取到的待处理视频进行预处理,以得到目标视频,之后将目标视频输入预先训练的识别模型,以得到识别模型输出的,用于表征待处理视频的类别的识别结果。其中,识别模型包括编码器和投射层,编码器根据多个预投射层和第一数量个、不具有类别标签的预训练视频,预训练得到,每个预投射层用于提取预训练视频的一种视频特征。识别模型根据经过预训练的编码器,和第二数量的训练视频训练得到。本公开中识别模型包括的编码器通过自监督方法,并借助能够提取 多种视频特征的预投射层进行预训练,以提高编码器的表征能力和泛化能力,从而提高识别模型的识别准确度。
图2是根据一示例性实施例示出的另一种视频的识别方法的流程图,如图2所示,步骤102的实现方式可以包括:
步骤1021,通过编码器对目标视频进行编码,以得到目标视频对应的编码向量。
步骤1022,通过投射层将编码向量投射为视频向量,视频向量的维度,与待选类别的数量相同,待处理视频的类别属于待选类别。
步骤1023,根据视频向量确定识别结果。
举例来说,对目标视频进行识别的具体过程,可以先将目标视频输入编码器,由编码器对目标视频进行编码,编码器输出的即为目标视频对应的编码向量。之后,再将编码向量输入投射层,由投射层将编码向量投射为用于表征目标视频的视频向量(即投射层的输出),投射层可以理解为线性层或者全连接层。其中,视频向量的维度(也可以理解为投射层的输出维度),与待选类别的数量相同,待选类别可以理解为待处理视频可能被识别为的类别的数量,可以根据具体需求来确定。例如,待处理视频为车辆采集的路况视频,用于判断道路的坡度,那么待选类别可以为:平稳路况、上坡路况、下坡路况,共3种。再比如,待处理视频为安防系统采集的监控视频,用于判断有无危险情况,那么待选类别可以为:安全、三级危险、二级危险、一级危险,共4种。
在得到投射层输出的视频向量之后,可以利用Softmax层对视频向量进行处理,以得到目标视频与多种待选类别的匹配概率。最后,可以将匹配概率最高的待选类别,作为待处理视频的类别,即识别结果。
图3是根据一示例性实施例示出的一种预训练编码器的流程图,如图3所示,编码器是通过如下方式预训练获得的:
步骤201,对第一数量个预训练视频进行预处理,以得到每个预训练视频对应的目标预训练视频。
步骤202,将每个目标预训练视频输入编码器,并将编码器的输出,输入多个预投射层,以得到每个预投射层提取的,该目标预训练视频的一种视频特征。
步骤203,根据每个目标预训练视频的多种视频特征,预训练编码器和多个预投射层。
示例的,在对编码器进行预训练时,可以预先采集第一数量个不具有类别标签的预训练视频,然后对每个预训练视频进行预处理,以得到每个预训练视频对应的目标预训练视频,即得到第一数量个目标预训练视频。其中,对预训练视频进行预处理的方式可以和步骤101中对待处理视频进行预处理的方式相同,此处不再赘述。之后,可以建立多个预投射层,并将每个预投射层的输入端,与编码器的输出端连接,如图4所示。可以将预投射层理解为线性层或者全连接层。每个预投射层的输入维度即为编码器的输出维度,每个预投射层的输出维度都可以不相同,也就是说,多个预投射层提取出的,可以是不同维度的多种视频特征。例如,编码器的输出为1*N维,那么多个预投射层可以分别为N*T维、N*(T+1)维、N*(T+2)维、N(T+3)维等,相应的,多个预投射层提取出的视频特征可以分 别为1*T维、1*(T+1)维、1*(T+2)维、1*(T+3)维等。
可以将第一数量个目标预训练视频分别输入编码器,并将编码器的输出,输入多个预投射层,以得到每个预投射层提取的,该目标预训练视频的一种视频特征。最后,根据每个目标预训练视频的多种视频特征,预训练编码器和多个预投射层。例如,可以利用自监督方法确定损失函数,并以降低损失函数为目标,利用反向传播算法来修正编码器和多个预投射层中的神经元的参数,神经元的参数例如可以是神经元的权重(英文:Weight)和偏置量(英文:Bias)。重复上述步骤,直至损失函数满足预设条件,例如损失函数小于预设的损失阈值,已到完成对编码器的预训练。
图5是根据一示例性实施例示出的另一种预训练编码器的流程图,如图5所示,步骤203可以通过以下步骤实现:
步骤2031,针对每种视频特征,根据每两个目标预训练视频的该种视频特征,确定该种视频特征对应的损失。
步骤2032,根据每种视频特征对应的损失确定综合损失。
步骤2033,以降低综合损失为目标,利用反向传播算法预训练编码器和多个预投射层。
示例的,预训练编码器和多个预投射层的具体方式,可以先确定每种视频特征对应的损失,然后根据每种视频特征对应的损失确定综合损失。例如,可以将每种视频特征对应的损失求平均,或者加权求和,以作为综合损失。最后,以降低综合损失为目标,利用反向传播算法预训练编码器和多个预投射层。具体的,每种视频特征对应的损失可以通过公式一确定:
Figure PCTCN2022112759-appb-000001
其中,L c表示任一种视频特征对应的损失,M表示预训练编码器和多个预投射层的batch_size(即批尺寸),z i表示第i个目标训练视频的该种视频特征,z i+表示M个目标训练视频中,第i个目标训练视频的正样本(可以理解为,与第i个目标训练视频相同的视频)的该种视频特征,z k表示第k个目标训练视频的该种视频特征(可以理解为M个目标训练视频中,第i个目标训练视频的负样本,即与第i个目标训练视频不相同的视频),τ表示预设的调整系数,例如可以为0.07。
图6是根据一示例性实施例示出的一种训练识别模型的流程图,如图6所示,识别模型是通过如下方式训练获得的:
步骤301,对第二数量个训练视频进行预处理,以得到每个训练视频对应的目标训练视频。
步骤302,将每个目标训练视频输入识别模型,并根据识别模型的输出与该目标训练视频对应的训练视频的类别标签,训练识别模型。
举例来说,在对识别模型进行训练时,可以预先采集第二数量个训练视频,每个训练视频均具有类别标签。然后对每个训练视频进行预处理,以得到每个训练视频对应的目标训练视频,即得到第二 数量个目标训练视频。其中,对训练视频进行预处理的方式可以和步骤101中对待处理视频进行预处理的方式相同,此处不再赘述。之后,可以将每个目标训练视频输入识别模型,并根据识别模型的输出与该目标训练视频对应的训练视频的类别标签,训练识别模型。例如,可以根据识别模型的输出与该目标训练视频对应的训练视频的类别标签确定损失函数,并以降低损失函数为目标,利用反向传播算法来修正识别模型中的神经元的参数,神经元的参数例如可以是神经元的权重和偏置量。重复上述步骤,直至损失函数满足预设条件,例如损失函数小于预设的损失阈值,已到完成对识别模型的训练。
图7是根据一示例性实施例示出的另一种训练识别模型的流程图,如图7所示,步骤302可以包括:
步骤3021,将该目标训练视频输入经过预训练的编码器,以得到经过预训练的编码器输出的,该目标训练视频对应的训练编码向量。
步骤3022,将训练编码向量输入投射层,以得到投射层输出的训练视频向量。
步骤3023,将训练视频向量输入识别模型的分类层,以得到分类层输出的训练识别结果,并将训练识别结果作为识别模型的输出。
步骤3024,根据训练识别结果和该目标训练视频对应的训练视频的类别标签,训练投射层,和/或编码器。
示例的,识别模型的结构可以如图8所示,其中包括经过预训练的编码器、投射层和分类层,其中,投射层可以理解为线性层或者全连接层。投射层的输入维度即为编码器的输出维度,投射层的输出维度可以根据待处理视频可能被识别为的类别的数量来确定。分类层可以理解为Softmax层。训练识别模型的具体方式,首先将任一个目标训练视频输入经过预训练的编码器,以得到经过预训练的编码器输出的,该目标训练视频对应的训练编码向量。之后,将训练编码向量输入投射层,以得到投射层输出的训练视频向量,最后,将训练视频向量输入识别模型的分类层,以得到分类层输出的训练识别结果,并将训练识别结果作为识别模型的输出。具体的,分类层可以根据训练视频向量,确定该目标训练视频与多种待选类别的匹配概率,然后将匹配概率最高的待选类别,作为训练识别结果。最后,可以根据训练识别结果和该目标训练视频对应的训练视频的类别标签,训练投射层,和/或编码器。例如,可以将分类层确定的该目标训练视频与多种待选类别的匹配概率,与该目标训练视频对应的训练视频的类别标签进行比较,以修正投射层,和/或编码器中的神经元的参数,神经元的参数例如可以是神经元的权重和偏置量。需要说明的是,在一种方式中,对识别模型进行训练时,可以只修正投射层中的神经元的参数,这样经过少量的调整(也可以理解为微调),就能够快速得到训练好的识别模型。在另一种实现方式中,对识别模型进行训练时,也可以同时修正投射层和编码器中的神经元的参数,能够进一步提高识别模型的识别准确度。在又一种实现方式中,对识别模型进行训练时,还可以只修正编码器中的神经元的参数。本公开对此不作具体限定。
图9是根据一示例性实施例示出的另一种训练识别模型的流程图,如图9所示,识别模型还通过如下方式训练获得的:
步骤303,根据待选类别的数量,确定投射层的输出维度,以使投射层输出的训练视频向量的维度与待选类别的数量相同。待处理视频的类别属于待选类别。
示例的,在对识别模型进行训练时,可以根据待处理视频可能被识别为的待选类别的数量,来确定投射层的输出维度,使得投射层输出的训练视频向量的维度与待选类别的数量相同。也就是说,可以根据识别模型具体需要完成的任务来确定投射层的输出维度。例如,待处理视频为车辆采集的路况视频,用于判断道路的坡度,待选类别可以为:平稳路况、上坡路况、下坡路况,共3种。那么投射层的输出维度可以为3。再比如,待处理视频为安防系统采集的监控视频,用于判断有无危险情况,待选类别可以为:安全、三级危险、二级危险、一级危险,共4种。那么投射层的输出维度可以为4。这样,在利用海量不具有类别标签的预训练视频对编码器进行预训练后,对识别模型进行训练时,可以根据具体的需求,选择不同输出维度的投射层,并利用少量的训练视频即可训练得到能够识别多种待选类别的识别模型。
综上所述,本公开首先对获取到的待处理视频进行预处理,以得到目标视频,之后将目标视频输入预先训练的识别模型,以得到识别模型输出的,用于表征待处理视频的类别的识别结果。其中,识别模型包括编码器和投射层,编码器根据多个预投射层和第一数量个、不具有类别标签的预训练视频,预训练得到,每个预投射层用于提取预训练视频的一种视频特征。识别模型根据经过预训练的编码器,和第二数量的训练视频训练得到。本公开中识别模型包括的编码器通过自监督方法,并借助能够提取多种视频特征的预投射层进行预训练,以提高编码器的表征能力和泛化能力,从而提高识别模型的识别准确度。
图10是根据一示例性实施例示出的一种视频的识别装置的框图,如图10所示,该装置400包括:
预处理模块401,用于对获取到的待处理视频进行预处理,以得到目标视频。
识别模块402,用于将目标视频输入预先训练的识别模型,以得到识别模型输出的识别结果,识别结果用于表征待处理视频的类别。识别模型包括编码器和投射层。
其中,编码器为根据多个预投射层和第一数量个预训练视频,预训练得到的,每个预投射层用于提取预训练视频的一种视频特征。
识别模型为根据经过预训练的编码器,和第二数量的训练视频训练得到的,第二数量小于第一数量,预训练视频不具有用于指示类别的类别标签。
图11是根据一示例性实施例示出的另一种视频的识别装置的框图,如图11所示,识别模块402可以包括:
编码子模块4021,用于通过编码器对目标视频进行编码,以得到目标视频对应的编码向量。
投射子模块4022,用于通过投射层将编码向量投射为视频向量,视频向量的维度,与待选类别的数量相同,待处理视频的类别属于待选类别。
识别子模块4023,用于根据视频向量确定识别结果。
在一种实现方式中,编码器可以是通过如下方式预训练获得的:
步骤A,对第一数量个预训练视频进行预处理,以得到每个预训练视频对应的目标预训练视频。
步骤B,将每个目标预训练视频输入编码器,并将编码器的输出,输入多个预投射层,以得到每个预投射层提取的,该目标预训练视频的一种视频特征。
步骤C,根据每个目标预训练视频的多种视频特征,预训练编码器和多个预投射层。
在另一种实现方式中,步骤C可以通过以下步骤实现:
步骤C1,针对每种视频特征,根据每两个目标预训练视频的该种视频特征,确定该种视频特征对应的损失。
步骤C2,根据每种视频特征对应的损失确定综合损失。
步骤C3,以降低综合损失为目标,利用反向传播算法预训练编码器和多个预投射层。
在又一种实现方式中,识别模型可以是通过如下方式训练获得的:
步骤D,对第二数量个训练视频进行预处理,以得到每个训练视频对应的目标训练视频。
步骤E,将每个目标训练视频输入识别模型,并根据识别模型的输出与该目标训练视频对应的训练视频的类别标签,训练识别模型。
在又一种实现方式中,步骤E可以包括:
步骤E1,将该目标训练视频输入经过预训练的编码器,以得到经过预训练的编码器输出的,该目标训练视频对应的训练编码向量。
步骤E2,将训练编码向量输入投射层,以得到投射层输出的训练视频向量。
步骤E3,将训练视频向量输入识别模型的分类层,以得到分类层输出的训练识别结果,并将训练识别结果作为识别模型的输出。
步骤E4,根据训练识别结果和该目标训练视频对应的训练视频的类别标签,训练投射层,和/或编码器。
在又一种实现方式中,识别模型还通过如下方式训练获得的:
步骤F,根据待选类别的数量,确定投射层的输出维度,以使投射层输出的训练视频向量的维度与待选类别的数量相同。待处理视频的类别属于待选类别。
关于上述实施例中的装置,其中各个模块执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。
综上所述,本公开首先对获取到的待处理视频进行预处理,以得到目标视频,之后将目标视频输入预先训练的识别模型,以得到识别模型输出的,用于表征待处理视频的类别的识别结果。其中,识别模型包括编码器和投射层,编码器根据多个预投射层和第一数量个、不具有类别标签的预训练视频,预训练得到,每个预投射层用于提取预训练视频的一种视频特征。识别模型根据经过预训练的编码器,和第二数量的训练视频训练得到。本公开中识别模型包括的编码器通过自监督方法,并借助能够提取多种视频特征的预投射层进行预训练,以提高编码器的表征能力和泛化能力,从而提高识别模型的识别准确度。
下面参考图12,其示出了适于用来实现本公开实施例的电子设备(即上述视频的识别方法的执行主体,可以是终端设备,也可以是服务器)500的结构示意图。本公开实施例中的终端设备可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、PDA(个人数字助理)、PAD(平板电脑)、PMP(便携式多媒体播放器)、车载终端(例如车载导航终端)等等的移动终端以及诸如数字TV、台式计算机等等的固定终端。图12示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。
如图12所示,电子设备500可以包括处理装置(例如中央处理器、图形处理器等)501,其可以根据存储在只读存储器(ROM)502中的程序或者从存储装置508加载到随机访问存储器(RAM)503中的程序而执行各种适当的动作和处理。在RAM 503中,还存储有电子设备500操作所需的各种程序和数据。处理装置501、ROM 502以及RAM 503通过总线504彼此相连。输入/输出(I/O)接口505也连接至总线504。
通常,以下装置可以连接至I/O接口505:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置506;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置507;包括例如磁带、硬盘等的存储装置508;以及通信装置509。通信装置509可以允许电子设备500与其他设备进行无线或有线通信以交换数据。虽然图12示出了具有各种装置的电子设备500,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在非暂态计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置509从网络上被下载和安装,或者从存储装置508被安装,或者从ROM 502被安装。在该计算机程序被处理装置501执行时,执行本公开实施例的方法中限定的上述功能。
需要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传 输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。
在一些实施方式中,终端设备、服务器可以利用诸如HTTP(HyperText Transfer Protocol,超文本传输协议)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(“LAN”),广域网(“WAN”),网际网(例如,互联网)以及端对端网络(例如,ad hoc端对端网络),以及任何当前已知或未来研发的网络。
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。
上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:对获取到的待处理视频进行预处理,以得到目标视频;将所述目标视频输入预先训练的识别模型,以得到所述识别模型输出的识别结果,所述识别结果用于表征所述待处理视频的类别;所述识别模型包括编码器和投射层;所述编码器为根据多个预投射层和第一数量个预训练视频,预训练得到的,每个所述预投射层用于提取所述预训练视频的一种视频特征;所述识别模型为根据经过预训练的所述编码器,和第二数量的训练视频训练得到的,所述第二数量小于所述第一数量,所述预训练视频不具有用于指示类别的类别标签。
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括但不限于面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言——诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)——连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
描述于本公开实施例中所涉及到的模块可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,模块的名称在某种情况下并不构成对该模块本身的限定,例如,预处理模块还可以被描述为“对待处理视频进行预处理的模块”。
本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、片上系统(SOC)、复杂可编程逻辑设备(CPLD)等等。
在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。
根据本公开的一个或多个实施例,示例1提供了一种视频的识别方法,包括:对获取到的待处理视频进行预处理,以得到目标视频;将所述目标视频输入预先训练的识别模型,以得到所述识别模型输出的识别结果,所述识别结果用于表征所述待处理视频的类别;所述识别模型包括编码器和投射层;所述编码器为根据多个预投射层和第一数量个预训练视频,预训练得到的,每个所述预投射层用于提取所述预训练视频的一种视频特征;所述识别模型为根据经过预训练的所述编码器,和第二数量的训练视频训练得到的,所述第二数量小于所述第一数量,所述预训练视频不具有用于指示类别的类别标签。
根据本公开的一个或多个实施例,示例2提供了示例1的方法,所述将所述目标视频输入预先训练的识别模型,以得到所述识别模型输出的识别结果,包括:通过所述编码器对所述目标视频进行编码,以得到所述目标视频对应的编码向量;通过所述投射层将所述编码向量投射为视频向量,所述视频向量的维度,与待选类别的数量相同,所述待处理视频的类别属于所述待选类别;根据所述视频向量确定所述识别结果。
根据本公开的一个或多个实施例,示例3提供了示例1的方法,所述编码器是通过如下方式预训练获得的:对第一数量个所述预训练视频进行预处理,以得到每个所述预训练视频对应的目标预训练视频;将每个所述目标预训练视频输入所述编码器,并将所述编码器的输出,输入多个所述预投射层,以得到每个所述预投射层提取的,该目标预训练视频的一种视频特征;根据每个所述目标预训练视频的多种视频特征,预训练所述编码器和多个所述预投射层。
根据本公开的一个或多个实施例,示例4提供了示例3的方法,所述根据每个所述目标预训练视频的多种视频特征,预训练所述编码器和多个所述预投射层,包括:针对每种视频特征,根据每两个所述目标预训练视频的该种视频特征,确定该种视频特征对应的损失;根据每种视频特征对应的损失确定综合损失;以降低所述综合损失为目标,利用反向传播算法预训练所述编码器和多个所述预投射层。
根据本公开的一个或多个实施例,示例5提供了示例1的方法,所述识别模型是通过如下方式训 练获得的:对第二数量个所述训练视频进行预处理,以得到每个所述训练视频对应的目标训练视频;将每个所述目标训练视频输入所述识别模型,并根据所述识别模型的输出与该目标训练视频对应的所述训练视频的类别标签,训练所述识别模型。
根据本公开的一个或多个实施例,示例6提供了示例5的方法,所述将每个所述目标训练视频输入所述识别模型,并根据所述识别模型的输出与该目标训练视频对应的所述训练视频的类别标签,训练所述识别模型,包括:将该目标训练视频输入经过预训练的所述编码器,以得到经过预训练的所述编码器输出的,该目标训练视频对应的训练编码向量;将所述训练编码向量输入所述投射层,以得到所述投射层输出的训练视频向量;将所述训练视频向量输入所述识别模型的分类层,以得到所述分类层输出的训练识别结果,并将所述训练识别结果作为所述识别模型的输出;根据所述训练识别结果和该目标训练视频对应的所述训练视频的类别标签,训练所述投射层,和/或所述编码器。
根据本公开的一个或多个实施例,示例7提供了示例6的方法,所述识别模型还通过如下方式训练获得的:根据待选类别的数量,确定所述投射层的输出维度,以使所述投射层输出的所述训练视频向量的维度与所述待选类别的数量相同;所述待处理视频的类别属于所述待选类别。
根据本公开的一个或多个实施例,示例8提供了一种视频的识别装置,包括:预处理模块,用于对获取到的待处理视频进行预处理,以得到目标视频;识别模块,用于将所述目标视频输入预先训练的识别模型,以得到所述识别模型输出的识别结果,所述识别结果用于表征所述待处理视频的类别;所述识别模型包括编码器和投射层;所述编码器为根据多个预投射层和第一数量个预训练视频,预训练得到的,每个所述预投射层用于提取所述预训练视频的一种视频特征;所述识别模型为根据经过预训练的所述编码器,和第二数量的训练视频训练得到的,所述第二数量小于所述第一数量,所述预训练视频不具有用于指示类别的类别标签。
根据本公开的一个或多个实施例,示例9提供了一种计算机可读介质,其上存储有计算机程序,该程序被处理装置执行时实现示例1至示例7中所述方法的步骤。
根据本公开的一个或多个实施例,示例10提供了一种电子设备,包括:存储装置,其上存储有计算机程序;处理装置,用于执行所述存储装置中的所述计算机程序,以实现示例1至示例7中所述方法的步骤。
以上描述仅为本公开的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本公开中所涉及的公开范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述公开构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本公开中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。
此外,虽然采用特定次序描绘了各操作,但是这不应当理解为要求这些操作以所示出的特定次序或以顺序次序执行来执行。在一定环境下,多任务和并行处理可能是有利的。同样地,虽然在上面论述中包含了若干具体实现细节,但是这些不应当被解释为对本公开的范围的限制。在单独的实施例的上下文中描述的某些特征还可以组合地实现在单个实施例中。相反地,在单个实施例的上下文中描述 的各种特征也可以单独地或以任何合适的子组合的方式实现在多个实施例中。
尽管已经采用特定于结构特征和/或方法逻辑动作的语言描述了本主题,但是应当理解所附权利要求书中所限定的主题未必局限于上面描述的特定特征或动作。相反,上面所描述的特定特征和动作仅仅是实现权利要求书的示例形式。关于上述实施例中的装置,其中各个模块执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。

Claims (10)

  1. 一种视频的识别方法,其特征在于,所述方法包括:
    对获取到的待处理视频进行预处理,以得到目标视频;
    将所述目标视频输入预先训练的识别模型,以得到所述识别模型输出的识别结果,所述识别结果用于表征所述待处理视频的类别;所述识别模型包括编码器和投射层;
    所述编码器为根据多个预投射层和第一数量个预训练视频,预训练得到的,每个所述预投射层用于提取所述预训练视频的一种视频特征;
    所述识别模型为根据经过预训练的所述编码器,和第二数量的训练视频训练得到的,所述第二数量小于所述第一数量,所述预训练视频不具有用于指示类别的类别标签。
  2. 根据权利要求1所述的方法,其特征在于,所述将所述目标视频输入预先训练的识别模型,以得到所述识别模型输出的识别结果,包括:
    通过所述编码器对所述目标视频进行编码,以得到所述目标视频对应的编码向量;
    通过所述投射层将所述编码向量投射为视频向量,所述视频向量的维度,与待选类别的数量相同,所述待处理视频的类别属于所述待选类别;
    根据所述视频向量确定所述识别结果。
  3. 根据权利要求1所述的方法,其特征在于,所述编码器是通过如下方式预训练获得的:
    对第一数量个所述预训练视频进行预处理,以得到每个所述预训练视频对应的目标预训练视频;
    将每个所述目标预训练视频输入所述编码器,并将所述编码器的输出,输入多个所述预投射层,以得到每个所述预投射层提取的,该目标预训练视频的一种视频特征;
    根据每个所述目标预训练视频的多种视频特征,预训练所述编码器和多个所述预投射层。
  4. 根据权利要求3所述的方法,其特征在于,所述根据每个所述目标预训练视频的多种视频特征,预训练所述编码器和多个所述预投射层,包括:
    针对每种视频特征,根据每两个所述目标预训练视频的该种视频特征,确定该种视频特征对应的损失;
    根据每种视频特征对应的损失确定综合损失;
    以降低所述综合损失为目标,利用反向传播算法预训练所述编码器和多个所述预投射层。
  5. 根据权利要求1所述的方法,其特征在于,所述识别模型是通过如下方式训练获得的:
    对第二数量个所述训练视频进行预处理,以得到每个所述训练视频对应的目标训练视频;
    将每个所述目标训练视频输入所述识别模型,并根据所述识别模型的输出与该目标训练视频对应的所述训练视频的类别标签,训练所述识别模型。
  6. 根据权利要求5所述的方法,其特征在于,所述将每个所述目标训练视频输入所述识别模型,并根据所述识别模型的输出与该目标训练视频对应的所述训练视频的类别标签,训练所述识别模型,包括:
    将该目标训练视频输入经过预训练的所述编码器,以得到经过预训练的所述编码器输出的,该目标训练视频对应的训练编码向量;
    将所述训练编码向量输入所述投射层,以得到所述投射层输出的训练视频向量;
    将所述训练视频向量输入所述识别模型的分类层,以得到所述分类层输出的训练识别结果,并将所述训练识别结果作为所述识别模型的输出;
    根据所述训练识别结果和该目标训练视频对应的所述训练视频的类别标签,训练所述投射层,和/或所述编码器。
  7. 根据权利要求6所述的方法,其特征在于,所述识别模型还通过如下方式训练获得的:
    根据待选类别的数量,确定所述投射层的输出维度,以使所述投射层输出的所述训练视频向量的维度与所述待选类别的数量相同;所述待处理视频的类别属于所述待选类别。
  8. 一种视频的识别装置,其特征在于,所述装置包括:
    预处理模块,用于对获取到的待处理视频进行预处理,以得到目标视频;
    识别模块,用于将所述目标视频输入预先训练的识别模型,以得到所述识别模型输出的识别结果,所述识别结果用于表征所述待处理视频的类别;所述识别模型包括编码器和投射层;
    所述编码器为根据多个预投射层和第一数量个预训练视频,预训练得到的,每个所述预投射层用于提取所述预训练视频的一种视频特征;
    所述识别模型为根据经过预训练的所述编码器,和第二数量的训练视频训练得到的,所述第二数量小于所述第一数量,所述预训练视频不具有用于指示类别的类别标签。
  9. 一种计算机可读介质,其上存储有计算机程序,其特征在于,该程序被处理装置执行时实现权利要求1-7中任一项所述方法的步骤。
  10. 一种电子设备,其特征在于,包括:
    存储装置,其上存储有计算机程序;
    处理装置,用于执行所述存储装置中的所述计算机程序,以实现权利要求1-7中任一项所述方法的步骤。
PCT/CN2022/112759 2021-09-08 2022-08-16 视频的识别方法、装置、可读介质和电子设备 WO2023035877A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111050220.1 2021-09-08
CN202111050220.1A CN113723341B (zh) 2021-09-08 2021-09-08 视频的识别方法、装置、可读介质和电子设备

Publications (1)

Publication Number Publication Date
WO2023035877A1 true WO2023035877A1 (zh) 2023-03-16

Family

ID=78682591

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/112759 WO2023035877A1 (zh) 2021-09-08 2022-08-16 视频的识别方法、装置、可读介质和电子设备

Country Status (2)

Country Link
CN (1) CN113723341B (zh)
WO (1) WO2023035877A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113723344A (zh) * 2021-09-08 2021-11-30 北京有竹居网络技术有限公司 视频的识别方法、装置、可读介质和电子设备
CN113723341B (zh) * 2021-09-08 2023-09-01 北京有竹居网络技术有限公司 视频的识别方法、装置、可读介质和电子设备
CN114841970B (zh) * 2022-05-09 2023-07-18 抖音视界有限公司 检查图像的识别方法、装置、可读介质和电子设备

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109819282A (zh) * 2017-11-22 2019-05-28 腾讯科技(深圳)有限公司 一种视频用户类别识别方法、装置和介质
CN111626251A (zh) * 2020-06-02 2020-09-04 Oppo广东移动通信有限公司 一种视频分类方法、视频分类装置及电子设备
CN112446237A (zh) * 2019-08-29 2021-03-05 北京百度网讯科技有限公司 视频分类方法、装置、设备及计算机可读存储介质
CN112668453A (zh) * 2020-12-24 2021-04-16 平安科技(深圳)有限公司 视频识别方法及相关设备
US20210142107A1 (en) * 2019-11-11 2021-05-13 Five AI Limited Image processing
CN113033707A (zh) * 2021-04-25 2021-06-25 北京有竹居网络技术有限公司 视频分类方法、装置、可读介质及电子设备
CN113723341A (zh) * 2021-09-08 2021-11-30 北京有竹居网络技术有限公司 视频的识别方法、装置、可读介质和电子设备

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111259366B (zh) * 2020-01-22 2021-06-18 支付宝(杭州)信息技术有限公司 一种基于自监督学习的验证码识别器的训练方法和装置
CN111860674B (zh) * 2020-07-28 2023-09-19 平安科技(深圳)有限公司 样本类别识别方法、装置、计算机设备及存储介质
CN112508078B (zh) * 2020-12-02 2024-06-14 携程旅游信息技术(上海)有限公司 图像多任务多标签识别方法、系统、设备及介质
CN112668492B (zh) * 2020-12-30 2023-06-20 中山大学 一种自监督学习与骨骼信息的行为识别方法
CN112766284B (zh) * 2021-01-26 2023-11-21 北京有竹居网络技术有限公司 图像识别方法和装置、存储介质和电子设备
CN112802568A (zh) * 2021-02-03 2021-05-14 紫东信息科技(苏州)有限公司 基于病历文本的多标签胃部疾病分类方法及装置
CN113222983A (zh) * 2021-06-03 2021-08-06 北京有竹居网络技术有限公司 图像处理方法、装置、可读介质和电子设备

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109819282A (zh) * 2017-11-22 2019-05-28 腾讯科技(深圳)有限公司 一种视频用户类别识别方法、装置和介质
CN112446237A (zh) * 2019-08-29 2021-03-05 北京百度网讯科技有限公司 视频分类方法、装置、设备及计算机可读存储介质
US20210142107A1 (en) * 2019-11-11 2021-05-13 Five AI Limited Image processing
CN111626251A (zh) * 2020-06-02 2020-09-04 Oppo广东移动通信有限公司 一种视频分类方法、视频分类装置及电子设备
CN112668453A (zh) * 2020-12-24 2021-04-16 平安科技(深圳)有限公司 视频识别方法及相关设备
CN113033707A (zh) * 2021-04-25 2021-06-25 北京有竹居网络技术有限公司 视频分类方法、装置、可读介质及电子设备
CN113723341A (zh) * 2021-09-08 2021-11-30 北京有竹居网络技术有限公司 视频的识别方法、装置、可读介质和电子设备

Also Published As

Publication number Publication date
CN113723341A (zh) 2021-11-30
CN113723341B (zh) 2023-09-01

Similar Documents

Publication Publication Date Title
WO2023035877A1 (zh) 视频的识别方法、装置、可读介质和电子设备
JP7331171B2 (ja) 画像認識モデルをトレーニングするための方法および装置、画像を認識するための方法および装置、電子機器、記憶媒体、並びにコンピュータプログラム
WO2023035896A1 (zh) 视频的识别方法、装置、可读介质和电子设备
EP3940591A1 (en) Image generating method, neural network compression method, and related apparatus and device
WO2022252881A1 (zh) 图像处理方法、装置、可读介质和电子设备
WO2023273611A1 (zh) 语音识别模型的训练方法、语音识别方法、装置、介质及设备
CN112883968B (zh) 图像字符识别方法、装置、介质及电子设备
WO2023078070A1 (zh) 一种字符识别方法、装置、设备、介质及产品
WO2023030427A1 (zh) 生成模型的训练方法、息肉识别方法、装置、介质及设备
CN112836675B (zh) 一种基于聚类生成伪标签的无监督行人重识别方法及系统
WO2023143016A1 (zh) 特征提取模型的生成方法、图像特征提取方法和装置
CN116166271A (zh) 代码生成方法、装置、存储介质及电子设备
CN113140012B (zh) 图像处理方法、装置、介质及电子设备
CN113033707B (zh) 视频分类方法、装置、可读介质及电子设备
CN117131281B (zh) 舆情事件处理方法、装置、电子设备和计算机可读介质
CN114463340A (zh) 一种边缘信息引导的敏捷型遥感图像语义分割方法
Wang et al. Contrastive GNN-based traffic anomaly analysis against imbalanced dataset in IoT-based its
WO2023016290A1 (zh) 视频分类方法、装置、可读介质和电子设备
WO2023030426A1 (zh) 息肉识别方法、装置、介质及设备
WO2023130925A1 (zh) 字体识别方法、装置、可读介质及电子设备
WO2023065895A1 (zh) 文本识别方法、装置、可读介质及电子设备
US20230237344A1 (en) Method, electronic device, and computer program product for managing training data
CN111898658B (zh) 图像分类方法、装置和电子设备
CN113033682B (zh) 视频分类方法、装置、可读介质、电子设备
CN114638973A (zh) 目标图像检测方法及图像检测模型训练方法

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE