Video classification method, device, equipment, medium and product based on classification model

By using the main feature extraction network and the secondary feature extraction network in the video classification model to extract and fuse global and local spatio-temporal features, the problems of insufficient spatio-temporal feature extraction and high computational complexity in video classification in the existing technology are solved, and video classification is improved. accuracy and application scenarios.

CN114529761BActive Publication Date: 2024-10-15TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202210112774.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-29
Publication Date
2024-10-15
Estimated Expiration
2042-01-29

AI Technical Summary

Technical Problem

Existing video classification models have problems with insufficient extraction and large amounts of calculations when capturing spatiotemporal features of video streams. Moreover, models based on the Transformer architecture have high computational complexity, which limits their application in industrial and commercial scenarios.

Method used

The video classification method based on the classification model is adopted, and the global spatio-temporal features and local spatio-temporal features are extracted through the main feature extraction network and the secondary feature extraction network respectively, and feature fusion is performed, and the video classification layer is used for the final video classification.

Benefits of technology

It improves the accuracy of video classification, can better understand video content, complete video classification tasks in different scenarios, avoids loss in feature processing, and captures more sufficient spatial semantic information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114529761B_ABST
    Figure CN114529761B_ABST
Patent Text Reader

Abstract

The present application provides a video classification method based on a classification model, comprising: extracting a first feature of a video to be classified through a main feature extraction network of the classification model, obtaining a global spatiotemporal feature that integrates the spatial feature of the video to be classified and the temporal feature of the video to be classified; then, extracting a second feature of the video to be classified through a secondary feature extraction network, obtaining a local spatiotemporal feature that integrates the temporal feature of the video to be classified and the spatial sub-features of the video to be classified in at least two spatial dimensions; then, through a feature fusion layer, performing feature fusion on the global spatiotemporal feature and the local spatiotemporal feature, obtaining a target spatiotemporal feature of the video to be classified; finally, through a video classification layer, classifying the video to be classified based on the target spatiotemporal feature, obtaining a video category to which the video to be classified belongs. Through the present application, the accuracy of understanding the video content can be improved, thereby completing video classification tasks in different scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to Internet technology, and in particular to a video classification method, apparatus, device, computer-readable storage medium, and computer program product based on a classification model. Background Art

[0002] The implementation of video classification and video stream understanding in related technologies is mainly based on three models. The first is a video classifier based on Convolutional Neural Network (CNN); the second is a video classifier based on Transformer architecture; the third is a feature extractor based on Multilayer Perceptron (MLP) framework.

[0003] However, for the first model mentioned above, although the convolutional neural network can well capture the local spatiotemporal features of the video stream, it has the problems of insufficient spatiotemporal feature extraction and large amount of computation; and for the second model mentioned above, although it can well capture the long-term dependencies between frames and thus assist the network in classifying video streams, the design complexity of the model itself is relatively high, which to a certain extent limits the actual use of such models in industrial and even commercial scenarios; and for the third model mentioned above, although it inherits the characteristics of the Transformer architecture in capturing global information dependencies and the advantage of the fast reasoning speed of the convolutional neural network framework, it is only limited to solving the spatial feature extraction of images and cannot solve the related tasks of video classification well. Summary of the invention

[0004] The embodiments of the present application provide a video classification method, device, electronic device, computer-readable storage medium and computer program product based on a classification model, which can improve the accuracy of understanding video content, thereby completing video classification tasks in different scenarios.

[0005] The technical solution of the embodiment of the present application is implemented as follows:

[0006] The embodiment of the present application provides a video classification method based on a classification model, wherein the classification model includes: a main feature extraction network, a secondary feature extraction network, a feature fusion layer and a video classification layer, and the method includes:

[0007] Through the main feature extraction network, a first feature extraction is performed on the video to be classified to obtain a global spatiotemporal feature of the video to be classified, wherein the global spatiotemporal feature is integrated with the spatial feature of the video to be classified and the temporal feature of the video to be classified;

[0008] Performing a second feature extraction on the video to be classified through the secondary feature extraction network to obtain local spatiotemporal features of the video to be classified, wherein the local spatiotemporal features are integrated with the time features of the video to be classified and the spatial sub-features of the video to be classified in at least two spatial dimensions;

[0009] By means of the feature fusion layer, the global spatiotemporal features and the local spatiotemporal features are fused to obtain target spatiotemporal features of the video to be classified;

[0010] Through the video classification layer, the video to be classified is classified based on the target spatiotemporal features to obtain the video category to which the video to be classified belongs.

[0011] The embodiment of the present application provides a video classification device based on a classification model, wherein the classification model includes: a main feature extraction network, a secondary feature extraction network, a feature fusion layer and a video classification layer, and the device includes:

[0012] A main feature extraction module, used to perform a first feature extraction on the video to be classified through the main feature extraction network to obtain a global spatiotemporal feature of the video to be classified, wherein the global spatiotemporal feature incorporates a spatial feature of the video to be classified and a temporal feature of the video to be classified;

[0013] A secondary feature extraction module, used for performing a second feature extraction on the video to be classified through the secondary feature extraction network to obtain a local spatiotemporal feature of the video to be classified, wherein the local spatiotemporal feature integrates the time feature of the video to be classified and the spatial sub-features of the video to be classified in at least two spatial dimensions;

[0014] A feature fusion module, used to perform feature fusion on the global spatiotemporal features and the local spatiotemporal features through the feature fusion layer to obtain target spatiotemporal features of the video to be classified;

[0015] The video classification module is used to classify the video to be classified based on the target spatiotemporal features through the video classification layer to obtain the video category to which the video to be classified belongs.

[0016] In the above scheme, the main feature extraction network includes a main spatial feature extraction layer, a main temporal feature extraction layer and a main feature fusion layer. The main feature extraction module is also used to perform spatial feature extraction on the video to be classified through the main spatial feature extraction layer to obtain the spatial features of the video to be classified; perform temporal feature extraction on the video to be classified through the main temporal feature extraction layer to obtain the temporal features of the video to be classified; and perform feature fusion on the spatial features and the temporal features through the main feature fusion layer to obtain the global spatiotemporal features of the video to be classified.

[0017] In the above scheme, the main feature extraction network includes a main spatial feature extraction layer, a main temporal feature extraction layer and a main feature fusion layer. The main feature extraction module is also used to perform spatial feature extraction on the video to be classified through the main spatial feature extraction layer to obtain the spatial features of the video to be classified; perform temporal feature extraction on the spatial features through the main temporal feature extraction layer to obtain the temporal features of the video to be classified; wherein the temporal features carry the spatial features of the video to be classified; and perform feature fusion on the temporal features carrying the spatial features and the spatial features through the main feature fusion layer to obtain the global spatiotemporal features of the video to be classified.

[0018] In the above scheme, the main feature extraction module is also used to perform spatial feature extraction of at least two spatial dimensions on the video to be classified through the main spatial feature extraction layer to obtain the first spatial sub-features of the video to be classified in at least two spatial dimensions; perform feature fusion on the first spatial sub-features of the video to be classified in at least two spatial dimensions to obtain the spatial features of the video to be classified.

[0019] In the above scheme, the main feature extraction module is further used to obtain the first weight of each of the first spatial sub-features; based on the first weight, the first spatial sub-features are weightedly fused to obtain the spatial feature of the video to be classified.

[0020] In the above scheme, the sub-feature extraction network includes a sub-spatial feature extraction layer, a sub-temporal feature extraction layer and a sub-feature fusion layer. The sub-feature extraction module is also used to perform spatial feature extraction of the at least two spatial dimensions on the video to be classified through the sub-spatial feature extraction layer to obtain the second spatial sub-features of the video to be classified in each of the spatial dimensions; perform temporal feature extraction on the video to be classified through the sub-temporal feature extraction layer to obtain the temporal features of the video to be classified; perform feature fusion of each of the second spatial sub-features with the temporal features through the sub-feature fusion layer to obtain the spatiotemporal fusion features corresponding to each of the second spatial sub-features, and fuse the spatiotemporal fusion features corresponding to each of the second spatial sub-features to obtain the local spatiotemporal features of the video to be classified.

[0021] In the above scheme, the secondary feature extraction module is also used to obtain the second weight of each second spatial sub-feature; based on the second weight, the spatiotemporal fusion features corresponding to each second spatial sub-feature are weightedly fused to obtain the local spatiotemporal features of the video to be classified.

[0022] In the above scheme, the sub-feature extraction network includes a sub-spatial feature extraction layer, a sub-temporal feature extraction layer and a sub-feature fusion layer, the at least two spatial dimensions include a channel dimension, and the sub-feature extraction module is also used to perform spatial feature extraction of the at least two spatial dimensions on the video to be classified through the sub-spatial feature extraction layer to obtain the channel features of the video to be classified in the channel dimension and the third spatial sub-features of the video to be classified in other spatial dimensions; perform temporal feature extraction on the video to be classified through the sub-temporal feature extraction layer to obtain the temporal features of the video to be classified; perform feature fusion of each of the third spatial sub-features with the temporal features through the sub-feature fusion layer to obtain the spatiotemporal fusion features corresponding to each of the third spatial sub-features, and fuse the channel features and the spatiotemporal fusion features corresponding to each of the third spatial sub-features to obtain the local spatiotemporal features of the video to be classified.

[0023] In the above scheme, the secondary feature extraction module is also used to fuse the channel features and the spatiotemporal fusion features corresponding to each of the third spatial sub-features to obtain intermediate spatiotemporal features; and to fuse the intermediate spatiotemporal features and the spatial sub-features of the video to be classified in at least two spatial dimensions to obtain local spatiotemporal features of the video to be classified.

[0024] In the above scheme, the secondary feature extraction module is also used to obtain the weight of the channel feature and the weight of each of the third spatial sub-features; based on the weight of the channel feature and the weight of each of the third spatial sub-features, the spatiotemporal fusion features corresponding to the channel feature and each of the third spatial sub-features are fused to obtain the local spatiotemporal features of the video to be classified.

[0025] In the above scheme, the device also includes a training module, which is used to obtain video training samples carrying labels; wherein the labels are used to indicate the video category to which the video training samples belong; through the main feature extraction network, the video training samples are subjected to a first feature extraction to obtain global spatiotemporal features of the video training samples, and the global spatiotemporal features are integrated with the spatial features of the video training samples and the temporal features of the video training samples; through the secondary feature extraction network, the video training samples are subjected to a second feature extraction to obtain local spatiotemporal features of the video training samples, and the local spatiotemporal features are integrated with the temporal features of the video training samples and the spatial sub-features of the video training samples in at least two spatial dimensions; through the feature fusion layer, the global spatiotemporal features and the local spatiotemporal features are subjected to feature fusion to obtain target spatiotemporal features of the video training samples; through the video classification layer, the video training samples are subjected to video classification based on the target spatiotemporal features to obtain the video category to which the video training samples belong; the difference between the video category to which the video training samples belong and the label is obtained, and the model parameters of the classification model are updated based on the difference.

[0026] In the above scheme, the device also includes an optical flow feature extraction module, which is used to perform a third feature extraction on the video to be classified through the optical flow feature extraction layer to obtain the optical flow features of the video to be classified; the feature fusion module is also used to perform feature fusion on the global spatiotemporal features, the local spatiotemporal features and the optical flow features through the feature fusion layer to obtain the target spatiotemporal features of the video to be classified.

[0027] In the above scheme, the number of the main feature extraction network and the number of the secondary feature extraction network are both at least two, the at least two main feature extraction networks are arranged in series to form a main feature extraction network sequence with increasing levels, the at least two secondary feature extraction networks are arranged in series to form a secondary feature extraction network sequence with increasing levels, and the number of the main feature extraction networks is the same as that of the secondary feature extraction networks; the main feature extraction module is also used to perform a first feature extraction on the video to be classified through at least two of the main feature extraction networks in the main feature extraction network sequence to obtain the global spatiotemporal features of the video to be classified; the secondary feature extraction module is also used to perform a second feature extraction on the video to be classified through at least two of the secondary feature extraction networks in the secondary feature extraction network sequence to obtain the local spatiotemporal features of the video to be classified; wherein, in the main feature extraction network sequence, the input of the next-level main feature extraction network is the output of the previous-level main feature extraction network and the secondary feature extraction network; in the secondary feature extraction network sequence, the input of the next-level secondary feature extraction network is the output of the previous-level secondary feature extraction network.

[0028] The embodiment of the present application also provides a training method for a classification model, wherein the classification model includes: a main feature extraction network, a secondary feature extraction network, a feature fusion layer, and a video classification layer, and the method includes:

[0029] Through the main feature extraction network, a first feature extraction is performed on the video training sample carrying the label to obtain the global spatiotemporal feature of the video training sample, wherein the global spatiotemporal feature integrates the spatial feature of the video training sample and the temporal feature of the video training sample, and the label is used to indicate the video category to which the video training sample belongs;

[0030] Performing a second feature extraction on the video training sample through the secondary feature extraction network to obtain local spatiotemporal features of the video training sample, wherein the local spatiotemporal features are integrated with the temporal features of the video training sample and the spatial sub-features of the video to be classified in at least two spatial dimensions;

[0031] By means of the feature fusion layer, the global spatiotemporal features and the local spatiotemporal features are fused to obtain target spatiotemporal features of the video training sample;

[0032] By means of the video classification layer, the video training samples are classified based on the target spatiotemporal features to obtain the video category to which the video training samples belong;

[0033] The difference between the video category to which the video training sample belongs and the label is obtained, and the classification model is trained based on the difference, so as to classify the video to be classified by using the classification model obtained through the training, and obtain the video category to which the video to be classified belongs.

[0034] The embodiment of the present application provides a training device for a classification model, wherein the classification model includes: a main feature extraction network, a secondary feature extraction network, a feature fusion layer, and a video classification layer, and the device includes:

[0035] A main feature extraction module is used to perform a first feature extraction on a video training sample carrying a label to obtain a global spatiotemporal feature of the video training sample, wherein the global spatiotemporal feature incorporates a spatial feature of the video training sample and a temporal feature of the video training sample, and the label is used to indicate a video category to which the video training sample belongs;

[0036] A secondary feature extraction module, used to perform a second feature extraction on the video training sample through the secondary feature extraction network to obtain a local spatiotemporal feature of the video training sample, wherein the local spatiotemporal feature incorporates the temporal feature of the video training sample and the spatial sub-features of the video to be classified in at least two spatial dimensions;

[0037] A feature fusion module, used to perform feature fusion on the global spatiotemporal features and the local spatiotemporal features through the feature fusion layer to obtain target spatiotemporal features of the video training sample;

[0038] A video classification module, configured to classify the video training samples based on the target spatiotemporal features through the video classification layer to obtain the video category to which the video training samples belong;

[0039] The parameter updating module is used to obtain the difference between the video category to which the video training sample belongs and the label, and train the classification model based on the difference, so as to classify the video to be classified through the classification model obtained by training, and obtain the video category to which the video to be classified belongs.

[0040] An embodiment of the present application provides an electronic device, including:

[0041] A memory for storing executable instructions;

[0042] The processor is used to implement the video classification method based on the classification model provided in the embodiment of the present application when executing the executable instructions stored in the memory.

[0043] An embodiment of the present application provides an electronic device, including:

[0044] A memory for storing executable instructions;

[0045] The processor is used to implement the training method of the classification model provided in the embodiment of the present application when executing the executable instructions stored in the memory.

[0046] An embodiment of the present application provides a computer-readable storage medium storing executable instructions for causing a processor to execute and implement the classification model-based video classification method provided in the embodiment of the present application.

[0047] An embodiment of the present application provides a computer-readable storage medium storing executable instructions for causing a processor to execute and implement the classification model training method provided in the embodiment of the present application.

[0048] The embodiment of the present application provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device performs the video classification method based on the classification model provided in the embodiment of the present application.

[0049] The embodiment of the present application provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. The processor of the electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device executes the training method of the classification model provided in the embodiment of the present application.

[0050] The embodiments of the present application have the following beneficial technical effects:

[0051] In the process of video classification, the global spatiotemporal features and local spatiotemporal features of the video to be classified are extracted by building a dual-path feature extraction network, and then the extracted global spatiotemporal features and local spatiotemporal features are fused to obtain the target spatiotemporal features of the video to be classified, and the final video classification is performed based on the target spatiotemporal features. In this way, the video content can be better understood, the accuracy of video classification is improved, and video classification tasks in different scenarios can be completed. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] Figure 1 1 is a schematic diagram of the architecture of a video classification system 100 based on a classification model provided in an embodiment of the present application;

[0053] Figure 2 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0054] Figure 3 It is a flow chart of a video classification method based on a classification model provided in an embodiment of the present application;

[0055] Figure 4 It is a structural diagram of a classification model provided in an embodiment of the present application;

[0056] Figure 5 It is a schematic diagram of a process of extracting global spatiotemporal features based on a main feature extraction network provided in an embodiment of the present application;

[0057] Figure 6 It is a structural diagram of the main feature extraction network provided in the embodiment of the present application;

[0058] Figure 7 It is a schematic diagram of a process of extracting global spatiotemporal features based on a main feature extraction network provided in an embodiment of the present application;

[0059] Figure 8 It is a structural diagram of the main feature extraction network provided in the embodiment of the present application;

[0060] Fig. 9 is a schematic diagram of a process for determining spatial features of a video to be classified provided in an embodiment of the present application;

[0061] Fig.10 It is a processing schematic diagram of the main space feature extraction layer provided in an embodiment of the present application;

[0062] Fig.11 It is a schematic diagram of a process of extracting local spatiotemporal features based on a secondary feature extraction network provided in an embodiment of the present application;

[0063] Fig.12 is a schematic diagram of the structure of the secondary feature extraction network provided in an embodiment of the present application;

[0064] Fig.13 is a schematic diagram of processing of the secondary feature fusion layer provided in an embodiment of the present application;

[0065] Fig.14 It is a schematic diagram of a flow chart of determining local spatiotemporal features of a video to be classified provided by an embodiment of the present application;

[0066] Fig.15 is a schematic diagram of processing of the secondary feature fusion layer provided in an embodiment of the present application;

[0067] Fig.16 is a schematic diagram of determining local spatiotemporal features of a video to be classified provided by an embodiment of the present application;

[0068] Fig.17 It is a structural diagram of a classification model provided in an embodiment of the present application;

[0069] Fig.18 It is a structural diagram of a classification model provided in an embodiment of the present application;

[0070] Fig.19 It is a structural diagram of the main feature extraction network provided in the embodiment of the present application;

[0071] Fig. 20 It is a structural diagram of the main feature extraction network provided in the embodiment of the present application;

[0072] Fig.21 is a schematic diagram of the structure of the secondary feature extraction network provided in an embodiment of the present application;

[0073] Fig. 22 is a schematic diagram of determining local spatiotemporal features of a video to be classified provided by an embodiment of the present application;

[0074] Fig.23 It is a flow chart of a training method for a classification model provided in an embodiment of the present application;

[0075] Fig.24 It is a structural diagram of the training device 2400 of the classification model provided in an embodiment of the present application. DETAILED DESCRIPTION

[0076] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.

[0077] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0078] In the following description, the terms "first\second\third" are only used to distinguish similar objects, and do not represent a specific order for the objects. It is understandable that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In the following description, the term "plurality" refers to at least two.

[0079] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0080] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.

[0081] 1) Multilayer Perceptron (MLP): It is a feedforward artificial neural network that maps a set of input vectors to a set of output vectors. MLP can be viewed as a directed graph consisting of multiple layers of nodes, each of which is fully connected to the next layer. Except for the input node, each node is a neuron (or processing unit) with a nonlinear activation function.

[0082] 2) Convolutional Neural Network (CNN): A feedforward neural network, generally composed of one or more convolutional layers (network layers that use convolutional mathematical operations) and a fully connected layer at the end. The neurons inside the network can respond to partial areas of the input image and generally have a better performance in the field of visual image processing.

[0083] 3) Transformer: An encoder used in a deep self-attention transformer network. The features extracted by this network have good spatial focus properties. At the same time, the network can effectively solve the modeling of long dependencies.

[0084] 4) Global Average Pool (GAP): average the feature map.

[0085] 5) Cross Entropy Loss (CEL): In classification problems in the field of machine learning, the cross entropy loss function can be used to express the degree of prediction inaccuracy.

[0086] The applicant found that, from the perspective of the model, the relevant technologies for video classification and video stream understanding are mainly divided into three categories:

[0087] The first category is the video classifier based on convolutional neural network. This type of model mainly uses convolutional neural network to build deep learning neural network. Convolutional neural network can well capture the local spatiotemporal features of video streams, so it is widely used in image / video classification tasks. In this type of video classifier, there are two sub-categories. The first sub-category is based on 2D convolutional neural network solutions. This type of technical solution mainly uses 2D convolutional neural network to carry out targeted modeling in the spatial (HWC) dimension and the temporal (T) dimension respectively, so as to capture the spatial features and temporal features of the video stream respectively. The running calculation speed of this type of technical solution is fast, but because the temporal and spatial features are captured separately, there is a phenomenon of insufficient spatiotemporal feature extraction. The second sub-category is based on 3D convolutional neural network solutions. This type of technical solution simply and directly uses 3D convolutional neural network to uniformly extract features in the spatiotemporal dimension of video stream information, so it can extract high-quality high-dimensional features, and the final classification effect is better than that of 2D convolutional neural network solutions. The only drawback is that the calculation amount of this type of solution is large, so the inference speed of the model is also slow.

[0088] The second category is the video classifier based on the Transformer architecture. This type of model mainly uses the Transformer structure to build a deep neural network. The Transformer structure originated from NLP and is used to capture global information dependencies. Compared with convolutional neural networks, Transformer can capture the long dependencies between frames due to its own characteristics, and this global relationship modeling can well assist the network in classifying video streams. Therefore, the Transformer architecture is increasingly used in related technologies to solve the difficulties in video understanding tasks. However, due to the high computational complexity of the Transformer framework, it also limits the actual use of such frameworks in industrial and even commercial scenarios to a certain extent.

[0089] The third category is the feature extractor based on the multi-layer perceptron framework (MLP). The feature extractor based on the multi-layer perceptron framework (MLP) inherits the characteristics of the Transformer architecture to capture global information dependencies and the advantage of the fast reasoning speed of the convolutional neural network framework. Therefore, in theory, it can well solve the tasks related to video content understanding. However, the relevant MLP framework solution is limited to solving the spatial feature extraction of images and cannot well solve the tasks related to video classification.

[0090] Based on this, the present application provides a video classification method, device, electronic device, computer-readable storage medium and computer program product based on a classification model to achieve the high-precision requirements of video stream understanding and video classification in industrial and commercial applications.

[0091] See also Figure 1 , Figure 1 It is an architectural diagram of a video classification system 100 based on a classification model provided in an embodiment of the present application. To implement application scenarios of video classification based on a classification model (for example, application scenarios of video classification based on a classification model may be application scenarios of video APPs recommending videos, such as when a user enters a video APP, the homepage recommends videos of corresponding categories based on user historical data obtained through user authorization; for example, after a user has watched a video, the end page may recommend corresponding videos based on the category of the video at the end of the video), a terminal (terminal 400 is shown as an example) is connected to a server 200 via a network 300, and the network 300 may be a wide area network or a local area network, or a combination of the two.

[0092] The terminal 400 is used for the user to use the client 401, which is displayed on the display interface 401-1. The terminal 400 and the server 200 are connected to each other via a wired or wireless network.

[0093] The server 200 is used to perform a first feature extraction on the video to be classified through the main feature extraction network of the classification model, and obtain a global spatiotemporal feature that integrates the spatial features of the video to be classified and the temporal features of the video to be classified; then, perform a second feature extraction on the video to be classified through the secondary feature extraction network, and obtain a local spatiotemporal feature that integrates the temporal features of the video to be classified and the spatial sub-features of the video to be classified in at least two spatial dimensions; then, perform feature fusion on the global spatiotemporal features and the local spatiotemporal features through the feature fusion layer, and obtain the target spatiotemporal features of the video to be classified; finally, perform video classification on the video to be classified based on the target spatiotemporal features through the video classification layer, and obtain the video category to which the video to be classified belongs; and send the video category to which the video to be classified belongs to to the terminal 400.

[0094] The terminal 400 is used to receive the video category to which the to-be-classified video belongs obtained from the server 200, so as to recommend corresponding videos based on the video category in the display interface 401-1.

[0095] In some embodiments, the server 200 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks (CDN, Content Deliver Network), and big data and artificial intelligence platforms. The terminal 400 may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a set-top box, an intelligent voice interaction device, a smart home appliance, a vehicle-mounted terminal, an aircraft, and a mobile device (e.g., a mobile phone, a portable music player, a personal digital assistant, a dedicated messaging device, a portable gaming device, an intelligent speaker, and a smart watch), etc., but is not limited thereto. The terminal device and the server may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present application.

[0096] See also Figure 2 , Figure 2 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. In practical applications, the electronic device can be Figure 1 The server 200 or terminal 400 shown, see Figure 2 , Figure 2The electronic device shown includes: at least one processor 410, a memory 450, at least one network interface 420 and a user interface 430. The various components in the terminal 400 are coupled together via a bus system 440. It is understood that the bus system 440 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 440 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 440 is not shown in FIG. Figure 2 Various buses are labeled as bus system 440 .

[0097] Processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0098] The user interface 430 includes one or more output devices 431 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.

[0099] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, etc. The memory 450 may optionally include one or more storage devices that are physically remote from the processor 410.

[0100] The memory 450 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 450 described in the embodiments of the present application is intended to include any suitable type of memory.

[0101] In some embodiments, memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.

[0102] Operating system 451, including system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks;

[0103] A network communication module 452, for reaching other computing devices via one or more (wired or wireless) network interfaces 420, exemplary network interfaces 420 include: Bluetooth, Wireless Compatibility Authentication (WiFi), and Universal Serial Bus (USB);

[0104] a presentation module 453 for enabling presentation of information via one or more output devices 431 (e.g., display screen, speaker, etc.) associated with the user interface 430 (e.g., a user interface for operating peripherals and displaying content and information);

[0105] The input processing module 454 is used to detect one or more user inputs or interactions from one of the one or more input devices 432 and translate the detected inputs or interactions.

[0106] In some embodiments, the video classification device based on the classification model provided in the embodiments of the present application can be implemented in a software manner. Figure 2 A video classification device 455 based on a classification model stored in a memory 450 is shown, which can be software in the form of a program and a plug-in, etc., including the following software modules: a main feature extraction module 4551, a secondary feature extraction module 4552, a feature fusion module 4553 and a video classification module 4554. These modules are logical and can therefore be arbitrarily combined or further split according to the functions implemented.

[0107] In other embodiments, the video classification device based on the classification model provided in the embodiments of the present application can be implemented in hardware. As an example, the video classification device based on the classification model provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the video classification method based on the classification model provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field programmable gate arrays (FPGAs) or other electronic components.

[0108] In some embodiments, the terminal or server can implement the video classification method based on the classification model provided in the embodiment of the present application by running a computer program. For example, the computer program can be a native program or software module in the operating system; it can be a native application (APP, Application), that is, a program that needs to be installed in the operating system to run, such as an instant messaging APP, a web browser APP; it can also be a small program, that is, a program that only needs to be downloaded to a browser environment to run; it can also be a small program that can be embedded in any APP. In short, the above-mentioned computer program can be an application, module or plug-in in any form.

[0109] Based on the above description of the video classification system and electronic device based on the classification model provided by the embodiment of the present application, the video classification method based on the classification model provided by the embodiment of the present application is described below. In actual implementation, the video classification method based on the classification model provided by the embodiment of the present application can be implemented by the terminal or the server alone, or by the terminal and the server in collaboration, so that Figure 1 The server 200 in the embodiment of the present application independently executes the video classification method based on the classification model provided in the embodiment of the present application as an example for explanation. Figure 3 , Figure 3 is a flow chart of a video classification method based on a classification model provided in an embodiment of the present application. It should be noted that the classification model includes: a main feature extraction network, a secondary feature extraction network, a feature fusion layer and a video classification layer. Figure 4 , Figure 4 is a schematic diagram of the structure of the classification model provided in the embodiment of the present application, combined with Figure 3 and Figure 4 The steps shown are explained.

[0110] Step 101, performing a first feature extraction on the video to be classified through a main feature extraction network to obtain a global spatiotemporal feature of the video to be classified, wherein the global spatiotemporal feature integrates the spatial feature of the video to be classified and the temporal feature of the video to be classified.

[0111] In actual implementation, the video to be classified may be pre-stored locally in the terminal, or obtained by the terminal from the outside world (such as the Internet), or collected by the terminal in real time, for example, collected by a camera of the terminal in real time.

[0112] In actual implementation, after obtaining the video to be classified, the video to be classified is firstly subjected to data preprocessing of frame sampling to obtain the preprocessed video to be classified, and then subsequent video classification processing is performed based on the processed video to be classified. Here, the global spatiotemporal features of the preprocessed video to be classified are firstly extracted based on the main feature extraction network. It should be noted that there are two ways to extract global spatiotemporal features based on the main feature extraction network. Next, these two ways are explained.

[0113] In some embodiments, see Figure 5 , Figure 5 is a schematic diagram of a process for extracting global spatiotemporal features based on a main feature extraction network provided in an embodiment of the present application. Here, the main feature extraction network includes a main spatial feature extraction layer, a main temporal feature extraction layer, and a main feature fusion layer. Figure 6 , Figure 6 is a schematic diagram of the structure of the main feature extraction network provided in the embodiment of the present application, based on Figure 5 and Figure 6 , step 101 can be implemented as follows:

[0114] Step 1011a: extract spatial features from the video to be classified through the main spatial feature extraction layer to obtain spatial features of the video to be classified.

[0115] Step 1012a, extracting time features from the video to be classified through the main time feature extraction layer to obtain the time features of the video to be classified.

[0116] In actual implementation, a parallel processing method is adopted here to extract features of the video to be classified through the main spatial feature extraction layer and the main temporal feature extraction layer respectively, so as to obtain the spatial features and temporal features of the video to be classified.

[0117] Step 1013a, performing feature fusion on the spatial features and the temporal features through the main feature fusion layer to obtain the global spatiotemporal features of the video to be classified.

[0118] In actual implementation, after determining the spatial features and temporal features of the video to be classified, the global spatiotemporal features of the video to be classified are obtained by fusion of the spatial features and the temporal features.

[0119] In some embodiments, see Figure 7 , Figure 7 is a schematic diagram of a process for extracting global spatiotemporal features based on a main feature extraction network provided in an embodiment of the present application. Here, the main feature extraction network includes a main spatial feature extraction layer, a main temporal feature extraction layer, and a main feature fusion layer. Figure 8 , Figure 8 is a schematic diagram of the structure of the main feature extraction network provided in the embodiment of the present application, based on Figure 7 and Figure 8 , step 101 can be implemented as follows:

[0120] Step 1011b: extract spatial features from the video to be classified through the main spatial feature extraction layer to obtain spatial features of the video to be classified.

[0121] Step 1012b, extracting temporal features from spatial features through the main temporal feature extraction layer to obtain temporal features of the video to be classified; wherein the temporal features carry spatial features of the video to be classified.

[0122] In actual implementation, a serial processing method is adopted here. After obtaining the spatial features of the video to be classified, the main temporal feature extraction layer extracts the temporal features of the spatial features to obtain the temporal features carrying the spatial features of the video to be classified.

[0123] Step 1013b, through the main feature fusion layer, the time features carrying spatial features and the spatial features are fused to obtain the global spatiotemporal features of the video to be classified.

[0124] In actual implementation, after obtaining the temporal features that carry the spatial features of the video to be classified, the temporal features and spatial features are fused through the main feature fusion layer to obtain the global spatiotemporal features of the video to be classified.

[0125] It should be noted that, for the main temporal feature extraction layer and the main feature fusion layer, the input features are the output of the previous layer and the input of the previous layer. Specifically, for the main temporal feature extraction layer, the input features are the spatial features of the video to be classified and the video to be classified, while for the main feature fusion layer, the input features are the temporal features carrying spatial features and the spatial features of the video to be classified. In this way, the loss of features in the feature processing process is avoided, and more sufficient spatial semantic information can be captured, thereby improving the accuracy of video understanding.

[0126] In some embodiments, see Fig. 9 and Fig.10 , Fig. 9 is a schematic diagram of a flow chart of determining the spatial features of a video to be classified provided in an embodiment of the present application, Fig.10 is a schematic diagram of the processing of the main space feature extraction layer provided in the embodiment of the present application, based on Fig. 9 and Fig.10 Step 1011a and step 1011b may also be implemented in the following manner:

[0127] Step 10111: extract spatial features of at least two spatial dimensions from the video to be classified through the main spatial feature extraction layer to obtain first spatial sub-features of the video to be classified in at least two spatial dimensions.

[0128] In actual implementation, the spatial dimensions here include at least the height (H) dimension, width (W) dimension and channel dimension (C) of the video frame image. The main spatial feature extraction layer performs spatial feature extraction of at least two spatial dimensions on the video to be classified, and obtains at least two first spatial sub-features of the height feature, width feature and channel feature of the video to be classified.

[0129] Step 10112, performing feature fusion on the first spatial sub-features of the video to be classified in at least two spatial dimensions to obtain the spatial features of the video to be classified.

[0130] In actual implementation, after obtaining the first spatial sub-features of the video to be classified in at least two spatial dimensions, the first weights of the first spatial sub-features are obtained, and then based on the first weights, the first spatial sub-features are weightedly fused to obtain the spatial features of the video to be classified. It should be noted that the first weights here are pre-set according to each spatial dimension.

[0131] Step 102, performing a second feature extraction on the video to be classified through a secondary feature extraction network to obtain local spatiotemporal features of the video to be classified, wherein the local spatiotemporal features integrate the temporal features of the video to be classified and the spatial sub-features of the video to be classified in at least two spatial dimensions.

[0132] It should be noted that the secondary feature extraction network and the main feature extraction network here are processed in parallel. Therefore, after obtaining the video to be classified, while the main feature extraction network extracts features from the video to be classified to obtain the global spatiotemporal features of the video to be classified, the secondary feature extraction network also extracts features from the video to be classified to obtain the local spatiotemporal features of the video to be classified.

[0133] In some embodiments, see Fig.11 , Fig.11 is a flow chart of extracting local spatiotemporal features based on a secondary feature extraction network provided in an embodiment of the present application. Here, the secondary feature extraction network includes a secondary spatial feature extraction layer, a secondary temporal feature extraction layer, and a secondary feature fusion layer. Fig.12 , Fig.12 is a schematic diagram of the structure of the secondary feature extraction network provided in the embodiment of the present application, based on Fig.11 and Fig.12 , step 102 can be implemented as follows:

[0134] Step 1021a: extract spatial features of at least two spatial dimensions from the video to be classified through the secondary spatial feature extraction layer to obtain second spatial sub-features of the video to be classified in each spatial dimension.

[0135] In actual implementation, here, the spatial dimension at least includes the height dimension, width dimension and channel dimension of the video frame image. Through the sub-spatial feature extraction layer, spatial features of at least two spatial dimensions are extracted for the video to be classified to obtain the height feature, width feature and channel feature of the video to be classified.

[0136] Step 1022a: extracting the time features of the video to be classified through the secondary time feature extraction layer to obtain the time features of the video to be classified.

[0137] Step 1023a, through the sub-feature fusion layer, each second spatial sub-feature is respectively fused with the time feature to obtain the spatiotemporal fusion feature corresponding to each second spatial sub-feature, and the spatiotemporal fusion features corresponding to each second spatial sub-feature are fused to obtain the local spatiotemporal features of the video to be classified.

[0138] See also Fig.13 , Fig.13 is a schematic diagram of processing the secondary feature fusion layer provided in an embodiment of the present application, based on Fig.13 After obtaining the second spatial sub-features of the video to be classified in each spatial dimension and the time features of the video to be classified, each second spatial sub-feature is fused with the time feature through the sub-feature fusion layer to obtain the spatiotemporal fusion features corresponding to each second spatial sub-feature, and then the obtained spatiotemporal fusion features are fused to obtain the local spatiotemporal features of the video to be classified.

[0139] As an example, when the spatial dimensions are the height dimension, width dimension and channel dimension of the video to be classified, the height feature, width feature and channel feature of the video are fused with the time feature of the video respectively through the sub-feature fusion layer to obtain the spatiotemporal fusion features corresponding to each second spatial sub-feature, that is, the height-time feature, width-time feature and channel-time feature; finally, the height-time feature, width-time feature and channel-time feature of the video are fused to obtain the local spatiotemporal features of the video to be classified.

[0140] It should be noted that the process of fusing the spatiotemporal fusion features corresponding to each second spatial sub-feature to obtain the local spatiotemporal features of the video to be classified specifically includes obtaining the second weight of each second spatial sub-feature; based on the second weight, weighted fusing the spatiotemporal fusion features corresponding to each second spatial sub-feature to obtain the local spatiotemporal features of the video to be classified. The second weight here is pre-set according to each spatial dimension.

[0141] In some embodiments, the at least two spatial dimensions in step 102 include channel dimensions, see Fig.14 , Fig.14 is a flow chart of determining the local spatiotemporal features of a video to be classified according to an embodiment of the present application, based on Fig.14 and Fig.12 , step 102 can be implemented as follows:

[0142] Step 1021b, extracting spatial features of at least two spatial dimensions from the video to be classified through the secondary spatial feature extraction layer, and obtaining channel features of the video to be classified in the channel dimension and third spatial sub-features of the video to be classified in other spatial dimensions.

[0143] In actual implementation, the other spatial dimensions here include at least the height dimension and the width dimension of the video to be classified. Through the sub-spatial feature extraction layer, spatial feature extraction is performed on at least two spatial dimensions of the video to be classified to obtain the channel features of the video to be classified in the channel dimension, and the third spatial sub-features of the video to be classified in other spatial dimensions. Specifically, through the sub-spatial feature extraction layer, spatial feature extraction is performed on at least two spatial dimensions of the video to be classified to obtain the channel features of the video to be classified in the channel dimension, the height features of the video to be classified in the height dimension, and the width features of the video to be classified in the width dimension.

[0144] Step 1022b: extracting the time features of the video to be classified through the secondary time feature extraction layer to obtain the time features of the video to be classified.

[0145] Step 1023b, through the sub-feature fusion layer, each third spatial sub-feature is respectively fused with the time feature to obtain the spatiotemporal fusion feature corresponding to each third spatial sub-feature, and the channel feature and the spatiotemporal fusion feature corresponding to each third spatial sub-feature are fused to obtain the local spatiotemporal feature of the video to be classified.

[0146] See also Fig.15 , Fig.15 is a schematic diagram of processing the secondary feature fusion layer provided in an embodiment of the present application, based on Fig.15 After obtaining the third spatial sub-features of the video to be classified in dimensions other than the channel dimension, each third spatial sub-feature is fused with the time feature to obtain the spatiotemporal fusion features corresponding to each third spatial sub-feature, and then the channel feature and the spatiotemporal fusion features corresponding to each third spatial sub-feature are fused to obtain the local spatiotemporal features of the video to be classified.

[0147] As an example, here when the other spatial dimensions are height dimension and width dimension, the spatiotemporal fusion features corresponding to each third spatial sub-feature are height-time features and width-time features, and then the height-time features, width-time features and channel features are fused to obtain the local spatiotemporal features of the video to be classified.

[0148] In some embodiments, after obtaining the channel features of the video to be classified and the spatiotemporal fusion features corresponding to each third spatial sub-feature, the channel features and the spatiotemporal fusion features corresponding to each third spatial sub-feature may be fused to obtain intermediate spatiotemporal features, and then based on the intermediate spatiotemporal features, the local spatiotemporal features of the video to be classified are determined. Fig.16 , Fig.16 is a schematic diagram of determining the local spatiotemporal features of a video to be classified according to an embodiment of the present application, based on Fig.16 After obtaining the channel features of the video to be classified and the spatiotemporal fusion features corresponding to each third spatial sub-feature, the channel features and the spatiotemporal fusion features corresponding to each third spatial sub-feature are fused to obtain intermediate spatiotemporal features; then, the intermediate spatiotemporal features and the spatial sub-features of the video to be classified in at least two spatial dimensions are fused to obtain local spatiotemporal features of the video to be classified.

[0149] It should be noted that the spatial sub-features of the video to be classified in at least two spatial dimensions are spatial sub-features extracted by the sub-spatial feature extraction layer, and the spatial dimensions here include at least length dimension, width dimension and channel dimension, and the spatial sub-features include at least length feature, width feature and channel feature. In this way, when performing feature fusion, the spatial sub-features before feature processing are also integrated, avoiding the loss of features during the feature processing process, and can capture more sufficient spatial semantic information, thereby improving the accuracy of video understanding.

[0150] It should be noted that the process of fusing the intermediate spatiotemporal features and the spatial sub-features of the video to be classified in at least two spatial dimensions to obtain the local spatiotemporal features of the video to be classified specifically includes obtaining the weight of the channel feature and the weight of each third spatial sub-feature; based on the weight of the channel feature and the weight of each third spatial sub-feature, fusing the spatiotemporal fusion features corresponding to the channel feature and each third spatial sub-feature to obtain the local spatiotemporal features of the video to be classified. The third weight here is pre-set according to each spatial dimension.

[0151] In actual implementation, when the spatial dimension includes the channel dimension, by presetting the number of channels (such as 56, 128, 256, etc.), the deeper the network, the smaller the resolution of the output feature and the larger the number of channels, while the shallower the network, the higher the resolution of the output feature and the smaller the number of channels. In this way, in the shallow network, highly fine-grained spatial features can be better captured, and in the deep network, more sufficient spatial semantic information can be captured, so that spatiotemporal features can be more fully extracted. It should be noted that the number of channels pre-set here is the same as the number of features (i.e., the number of frame images in the video).

[0152] Step 103, through the feature fusion layer, the global spatiotemporal features and the local spatiotemporal features are fused to obtain the target spatiotemporal features of the video to be classified.

[0153] In actual implementation, after determining the local spatiotemporal features, the local spatiotemporal features are standardized to obtain standardized local spatiotemporal features; then, the global spatiotemporal features and the standardized local spatiotemporal features are fused through the feature fusion layer to obtain the target spatiotemporal features of the video to be classified. In this way, the local spatiotemporal features are standardized, so that the standardized local spatiotemporal features are fused with the global spatiotemporal features to effectively integrate the local spatiotemporal features into the global spatiotemporal features.

[0154] In some embodiments, when the number of the main feature extraction network and the number of the secondary feature extraction network are both at least two, see Fig.17 , Fig.17 is a schematic diagram of the structure of the classification model provided in the embodiment of the present application, based on Fig.17 At least two main feature extraction networks are arranged in series to form a main feature extraction network sequence with increasing levels, and at least two sub-feature extraction networks are arranged in series to form a sub-feature extraction network sequence with increasing levels, and the number of main feature extraction networks and sub-feature extraction networks is the same, and then at least two main feature extraction networks in the main feature extraction network sequence are used to perform a first feature extraction on the video to be classified to obtain the global spatiotemporal features of the video to be classified, and then at least two sub-feature extraction networks in the sub-feature extraction network sequence are used to perform a second feature extraction on the video to be classified to obtain the local spatiotemporal features of the video to be classified, and finally, the global spatiotemporal features and the local spatiotemporal features are fused through a feature fusion layer to obtain the target spatiotemporal features of the video to be classified.

[0155] It should be noted that in the main feature extraction network sequence, the input of the next main feature extraction network is the output of the previous main feature extraction network and the secondary feature extraction network; while in the secondary feature extraction network sequence, the input of the next secondary feature extraction network is the output of the previous secondary feature extraction network. In this way, through the layer-by-layer feature fusion, the local spatiotemporal features are effectively fused into the global spatiotemporal features to capture more complete spatial semantic information.

[0156] In some embodiments, see Fig.18 , Fig.18 is a schematic diagram of the structure of the classification model provided in the embodiment of the present application, based on Fig.18The classification model also includes an optical flow feature extraction layer. The process of obtaining the target spatiotemporal features of the video to be classified specifically includes: first, through the main feature extraction network of the classification model, a first feature extraction is performed on the video to be classified to obtain a global spatiotemporal feature that integrates the spatial features of the video to be classified and the temporal features of the video to be classified; then, through the secondary feature extraction network, a second feature extraction is performed on the video to be classified to obtain a local spatiotemporal feature that integrates the temporal features of the video to be classified and the spatial sub-features of the video to be classified in at least two spatial dimensions; then, through the optical flow feature extraction layer, a third feature extraction is performed on the video to be classified to obtain the optical flow features of the video to be classified; finally, through the feature fusion layer, the global spatiotemporal features, the local spatiotemporal features and the optical flow features are feature fused to obtain the target spatiotemporal features of the video to be classified.

[0157] In actual implementation, the optical flow feature extraction layer included in the classification model can also be located in the main feature extraction network or the sub-feature extraction network. Next, the situations where the optical flow feature extraction layer is located in the main feature extraction network and in the sub-feature extraction network are explained.

[0158] In some embodiments, when the optical flow extraction layer is located in the main feature extraction network, the main feature extraction network includes a main spatial feature extraction layer, a main temporal feature extraction layer, a main optical flow feature extraction layer, and a main feature fusion layer, see Fig.19 , Fig.19 is a schematic diagram of the structure of the main feature extraction network provided in the embodiment of the present application, based on Fig.19 First, the main spatial feature extraction layer is used to extract spatial features of the video to be classified, and the spatial features of the video to be classified are obtained; then, the main temporal feature extraction layer is used to extract temporal features of the video to be classified, and the temporal features of the video to be classified are obtained; then, the main optical flow feature extraction layer is used to extract optical flow features of the video to be classified, and the optical flow features of the video to be classified are obtained; finally, the main feature fusion layer is used to fuse the spatial features, temporal features, and optical flow features, and the global spatiotemporal features of the video to be classified are obtained. In this way, the global spatiotemporal features obtained are fused with the local spatiotemporal features obtained by the secondary feature extraction network through the feature fusion layer to obtain the target spatiotemporal features.

[0159] It should be noted that the global spatiotemporal features are determined by parallel processing here, while for the process of obtaining the global spatiotemporal features by serial processing, see Fig. 20 , Fig. 20 is a schematic diagram of the structure of the main feature extraction network provided in the embodiment of the present application, based on Fig. 20First, the spatial features of the video to be classified are extracted through the main spatial feature extraction layer to obtain the spatial features of the video to be classified; then, the temporal features of the spatial features are extracted through the main temporal feature extraction layer to obtain the temporal features of the video to be classified that carry the spatial features of the video to be classified; then, the temporal features are extracted through the main optical flow feature extraction layer to obtain the optical flow features of the video to be classified that carry the temporal features of the video to be classified; finally, the spatial features, the temporal features carrying the spatial features, and the optical flow features carrying the temporal features are fused through the main feature fusion layer to obtain the global spatiotemporal features of the video to be classified. In this way, the global spatiotemporal features obtained are fused with the local spatiotemporal features obtained by the secondary feature extraction network through the feature fusion layer to obtain the target spatiotemporal features.

[0160] It should be noted that, for the main temporal feature extraction layer, the main optical flow feature extraction layer and the main feature fusion layer, the input features are the output of the previous layer and the input of the previous layer. Specifically, for the main temporal feature extraction layer, the input features are the spatial features of the video to be classified and the video to be classified, while for the main optical flow feature extraction layer, the input features are the spatial features of the video to be classified and the temporal features of the video to be classified, and for the main feature fusion layer, the input features are the temporal features carrying spatial features and the optical flow features of the video to be classified. In this way, the loss of features in the feature processing process is avoided, and more sufficient spatial semantic information can be captured, thereby improving the accuracy of video understanding.

[0161] In some other embodiments, when the optical flow extraction layer is located in the secondary feature extraction network, the secondary feature extraction network includes a secondary spatial feature extraction layer, a secondary temporal feature extraction layer, a secondary optical flow feature extraction layer, and a secondary feature fusion layer, see Fig.21 , Fig.21 is a schematic diagram of the structure of the secondary feature extraction network provided in the embodiment of the present application, based on Fig.21 First, the sub-spatial feature extraction layer is used to extract spatial features of at least two spatial dimensions of the video to be classified, and the second spatial sub-features of the video to be classified in each spatial dimension are obtained; then, the sub-temporal feature extraction layer is used to extract temporal features of the video to be classified, and the temporal features of the video to be classified are obtained; then, the sub-optical flow feature extraction layer is used to extract optical flow features of the video to be classified, and the optical flow features of the video to be classified are obtained; finally, the sub-feature fusion layer is used to fuse the second spatial sub-features, temporal features, and optical flow features, and the local spatiotemporal features of the video to be classified are obtained. In this way, the local spatiotemporal features obtained are fused with the global spatiotemporal features obtained by the main feature extraction network through the feature fusion layer to obtain the target spatiotemporal features.

[0162] In actual implementation, for the process of fusing the second spatial sub-feature, the temporal feature, and the optical flow feature through the secondary feature fusion layer to obtain the local spatiotemporal features of the video to be classified, see Fig. 22 , Fig. 22 is a schematic diagram of determining the local spatiotemporal features of a video to be classified according to an embodiment of the present application, based on Fig. 22 After obtaining the second spatial sub-features of each spatial dimension, the temporal features of the video to be classified, and the optical flow features of the video to be classified, each second spatial sub-feature is fused with the temporal features and the optical flow features to obtain the spatiotemporal fusion features corresponding to each second spatial sub-feature, and the spatiotemporal fusion features corresponding to each second spatial sub-feature are fused to obtain the local spatiotemporal features of the video to be classified. In this way, the obtained local spatiotemporal features are fused with the global spatiotemporal features obtained by the main feature extraction network through the feature fusion layer to obtain the target spatiotemporal features.

[0163] It should be noted that the optical flow feature extraction layer can also be located in the main feature extraction network and the sub-feature extraction network at the same time. When the optical flow feature extraction layer is located in both the main feature extraction network and the sub-feature extraction network, according to the process of determining the global spatiotemporal features and the local spatiotemporal features in the above embodiment in which the optical flow feature extraction layer is respectively located in the main feature extraction network and the sub-feature extraction network, after obtaining the global spatiotemporal features and the local spatiotemporal features of the video to be classified, the target spatiotemporal features of the video to be classified are determined through the global spatiotemporal features and the local spatiotemporal features of the video to be classified.

[0164] Step 104 , classifying the video to be classified based on the target spatiotemporal features through the video classification layer to obtain the video category to which the video to be classified belongs.

[0165] In actual implementation, after obtaining the target spatiotemporal features, the target spatiotemporal features are reduced in dimension through the video classification layer to obtain the target features of the video to be classified, and then the video to be classified is classified based on the target features to obtain the video category to which the video to be classified belongs, so as to recommend the corresponding video according to the video category. For example, when the user enters the video application, the corresponding category of videos can be recommended on the homepage based on the user's historical data; for example, after the user finishes watching a video, the corresponding video can be recommended based on the category of the video on the end page at the end of the video. Here, the user's historical data is obtained after the user's authorization when the user enters the video application.

[0166] It should be noted that the dimensionality reduction processing here can be achieved by performing global average pooling on the target spatiotemporal features, thereby converting the multi-dimensional target spatiotemporal features into one-dimensional target features. It should be noted that the target features well contain the global spatiotemporal features and local spatiotemporal features of the video to be classified, so the features can be well utilized to effectively classify the video content.

[0167] In some embodiments, before classifying videos based on the classification model, the classification model is first trained. Fig.23 , Fig.23 is a flow chart of a training method for a classification model provided in an embodiment of the present application, which will be combined with Fig.23 The steps shown are explained.

[0168] Step 201: The server obtains a video training sample carrying a label, wherein the label is used to indicate the video category to which the video training sample belongs.

[0169] Step 202, performing first feature extraction on the video training sample through the main feature extraction network to obtain the global spatiotemporal features of the video training sample, where the global spatiotemporal features integrate the spatial features and the temporal features of the video training sample.

[0170] Step 203, performing a second feature extraction on the video training sample through a secondary feature extraction network to obtain local spatiotemporal features of the video training sample, where the local spatiotemporal features incorporate the temporal features of the video training sample and the spatial sub-features of the video training sample in at least two spatial dimensions.

[0171] Step 204 , through a feature fusion layer, the global spatiotemporal features and the local spatiotemporal features are fused to obtain target spatiotemporal features of the video training sample.

[0172] Step 205 , classifying the video training samples based on the target spatiotemporal features through the video classification layer to obtain the video category to which the video training samples belong.

[0173] Step 206: Obtain the difference between the video category to which the video training sample belongs and the label, and update the model parameters of the classification model based on the difference.

[0174] In actual implementation, the loss function corresponding to the classification model, such as the cross entropy function, is first obtained, and then the value of the loss function is determined based on the difference between the video category and the label to which the video training sample belongs, so as to update the model parameters of the classification model based on the value of the loss function.

[0175] By using the above-mentioned embodiment of the present application, in the process of video classification, the global spatiotemporal features and local spatiotemporal features of the video to be classified are extracted respectively by building a dual-path feature extraction network, and then the extracted global spatiotemporal features and local spatiotemporal features are subjected to feature fusion to obtain the target spatiotemporal features of the video to be classified, and then the final video classification is performed based on the target spatiotemporal features. In this way, the video content can be better understood, the accuracy of video classification is improved, and video classification tasks in different scenarios can be completed.

[0176] The following is an explanation of an exemplary application of the embodiments of the present application in a practical application scenario.

[0177] In recent years, due to the rapid development of the short video industry, more and more self-media have chosen to use video content channels for related personal creation. Therefore, the technology of video content understanding perfectly fits the current multimedia market trend. On the one hand, in terms of the creation platform, video content understanding allows the creation platform to better count the content of the video stream, so as to better recommend content to platform users, thereby improving the user experience of the platform users; on the other hand, for platform users, video stream understanding technology can save a lot of video retrieval time for platform users. Specifically, platform users can get the video with the highest correlation with the keyword in the shortest time by entering keywords. From the perspective of the model, the relevant technologies are mainly divided into three categories in the implementation of video classification and video stream understanding:

[0178] The first category is the video classifier based on convolutional neural network. This type of model mainly uses convolutional neural network to build deep learning neural network. Convolutional neural network can well capture the local spatiotemporal features of video streams, so it is widely used in image / video classification tasks. In this type of video classifier, there are two sub-categories. The first sub-category is based on 2D convolutional neural network solutions. This type of technical solution mainly uses 2D convolutional neural network to carry out targeted modeling in the spatial (HWC) dimension and the temporal (T) dimension respectively, so as to capture the spatial features and temporal features of the video stream respectively. The running calculation speed of this type of technical solution is fast, but because the temporal and spatial features are captured separately, there is a phenomenon of insufficient spatiotemporal feature extraction. The second sub-category is based on 3D convolutional neural network solutions. This type of technical solution simply and directly uses 3D convolutional neural network to uniformly extract features in the spatiotemporal dimension of video stream information, so it can extract high-quality high-dimensional features, and the final classification effect is better than that of 2D convolutional neural network solutions. The only drawback is that the calculation amount of this type of solution is large, so the inference speed of the model is also slow.

[0179] The second category is the video classifier based on the Transformer architecture. This type of model mainly uses the Transformer structure to build a deep neural network. The Transformer structure originated from NLP and is used to capture global information dependencies. Compared with convolutional neural networks, Transformer can capture the long dependencies between frames due to its own characteristics, and this global relationship modeling can well assist the network in classifying video streams. Therefore, the Transformer architecture is increasingly used in related technologies to solve the difficulties in video understanding tasks. However, due to the high computational complexity of the Transformer framework, it also limits the actual use of such frameworks in industrial and even commercial scenarios to a certain extent.

[0180] The third category is the feature extractor based on the multi-layer perceptron framework (MLP). The feature extractor based on the multi-layer perceptron framework (MLP) inherits the characteristics of the Transformer architecture to capture global information dependencies and the advantage of the fast reasoning speed of the convolutional neural network framework. Therefore, in theory, it can well solve the tasks related to video content understanding. However, the relevant MLP framework solution is limited to solving the spatial feature extraction of images and cannot well solve the tasks related to video classification.

[0181] Based on this, the present application provides a video classification method, device, electronic device, computer-readable storage medium and computer program product based on a classification model to achieve high-precision requirements for video stream understanding and video classification in industrial and commercial applications. Fig.17 , the embodiment of the present application first pre-processes the input video stream through frame sampling data, and then inputs the pre-processed data into the main network (main network feature extraction layer) and the sub-network (sub-network feature extraction layer) at the same time, and finally outputs a one-dimensional feature vector through layer-by-layer feature fusion. The feature vector well contains the global spatiotemporal features and local spatiotemporal features of the video stream, so the feature vector can be well used to classify the video content. Here, the above processing process is mainly implemented through four modules, namely the main network module, the sub-network module, the feature fusion module and the video classification module.

[0182] For the main network module, the main network module (main network feature extraction layer) in the embodiment of the present application is mainly responsible for capturing the global spatial and temporal features of the input video stream, wherein the spatial features are extracted by the video spatial perception module, and the temporal features are mainly extracted by the video temporal perception module. Specifically, the spatial perception module designed in the present application performs linear fully connected layer modeling in the height (H) dimension, width (W) dimension and channel dimension (C) of the video frame image, respectively, to obtain modeling features of three different dimensions, and then weightedly fuses the features of the three dimensions to output the final spatial features; in terms of capturing temporal features, the present application mainly performs fully connected layer modeling on the temporal dimension of the input video stream, that is, through a separate multi-layer perceptron (MLP) module, a separate linear mapping is performed on the temporal dimension of the input video stream.

[0183] In actual implementation, the main network (main feature extraction network) provided in the embodiment of the present application can be referred to Figure 8 The video space perception module (main space feature extraction layer) and the video time perception module (main time feature extraction layer) are serially linked in the main network structure. The input video stream information first passes through the video space perception module and then enters the video time perception module. In the architectural design of the main network, a multi-level pyramid structure (Pyramid Architectures) is adopted, so that the deeper the network outputs, the smaller the resolution of the features and the larger the number of channels, while the shallower the network outputs, the higher the resolution of the features and the smaller the number of channels. This design can better help the network to fully extract spatiotemporal features. Specifically, such a design can better capture highly fine-grained spatial features in the shallow network, and can capture more sufficient spatial semantic information in the deep network.

[0184] For the secondary network module, the secondary network module (secondary network feature extraction layer) in the embodiment of the present application is mainly responsible for capturing the temporal variation characteristics of the input video stream in different spatial dimensions. In specific implementation, the present application first transforms the input features (i.e., the spatial features of the video stream in each dimension, such as height features, width features, channel features, and temporal features of the video stream) three times respectively, see Fig.16Specifically, firstly, the height dimension (H) and the time dimension (T) of the video stream are fused to integrate a new hybrid dimension (HT), and a fully connected layer modeling is performed on this dimension to obtain the height-time feature of the video stream; then the width dimension (W) and the time dimension (T) of the video stream are fused to integrate a new hybrid dimension (WT), and a fully connected layer modeling is performed on this dimension to obtain the width-time feature of the video stream; finally, the channel dimension of the video is modeled in a fully connected layer to obtain the channel feature of the video stream. Finally, this application performs a weighted summation on the above three features to obtain features that can perceive the temporal changes of the video stream in different spatial dimensions, that is, it can better capture the temporal change features of the video stream in different spatial dimensions.

[0185] For the feature fusion module, the embodiment of the present application first normalizes the features of the secondary network, i.e., norm(input_featuer), and then sums the normalized features with the features of the corresponding level of the main network, so as to effectively integrate the features of the secondary network into the main network. In actual implementation, the embodiment of the present application adopts a dual-path network design. In terms of the feature interaction between the main network and the secondary network, see Fig.17 As shown in the figure, through a step-by-step interaction approach, the temporal features learned by the secondary network are effectively integrated into the main network to help the main network classify videos more effectively.

[0186] For the video classification module, the embodiment of the present application proposes that at the end of the main network, the output features after output fusion (i.e., the target spatiotemporal features) are first subjected to global average pooling processing, the two-dimensional feature map is converted into a one-dimensional vector, and then the one-dimensional vector is input using a traditional fully connected layer structure, and finally a feature vector for video classification is obtained, thereby determining the category to which the video belongs based on the feature vector.

[0187] In actual implementation, during the training process of the video classification method based on the classification model provided in the embodiment of the present application, the model can be trained on a GPU, and the GPU model is Tesla V100-SXM2. During the training and testing process, a multi-card GPU (Tesla V100-SXM2) can be selected for training, and for the loss function, a cross entropy function (CrossEntropy Loss) can be selected to standardize and limit the final output vector.

[0188] It should be noted that for the design of the overall architecture, it is also possible to consider using a hybrid infrastructure approach for modeling, such as a convolutional neural network (CNN) + multi-layer perceptron (MLP), or a hybrid architecture of Transformer + multi-layer perceptron (MLP). The advantage of this design is that it can integrate the characteristics of multiple infrastructures to more effectively understand and classify video content.

[0189] By using the above-mentioned embodiment of the present application, in the process of video classification, the global spatiotemporal features and local spatiotemporal features of the video to be classified are extracted respectively by building a dual-path feature extraction network, and then the extracted global spatiotemporal features and local spatiotemporal features are subjected to feature fusion to obtain the target spatiotemporal features of the video to be classified, and then the final video classification is performed based on the target spatiotemporal features. In this way, the video content can be better understood, the accuracy of video classification is improved, and video classification tasks in different scenarios can be completed.

[0190] The following is a description of an exemplary structure of a video classification device 455 based on a classification model provided in an embodiment of the present application implemented as a software module. In some embodiments, Figure 2 As shown, the software modules stored in the classification model-based video classification device 455 of the memory 440 may include:

[0191] A main feature extraction module 4551 is used to perform a first feature extraction on the video to be classified through the main feature extraction network of the classification model to obtain a global spatiotemporal feature of the video to be classified, wherein the global spatiotemporal feature integrates the spatial feature of the video to be classified and the temporal feature of the video to be classified;

[0192] A secondary feature extraction module 4552 is used to perform a second feature extraction on the video to be classified through the secondary feature extraction network of the classification model to obtain a local spatiotemporal feature of the video to be classified, wherein the local spatiotemporal feature integrates the time feature of the video to be classified and the spatial sub-features of the video to be classified in at least two spatial dimensions;

[0193] A feature fusion module 4553 is used to perform feature fusion on the global spatiotemporal features and the local spatiotemporal features through the feature fusion layer of the classification model to obtain target spatiotemporal features of the video to be classified;

[0194] The video classification module 4554 is used to classify the video to be classified based on the target spatiotemporal features through the video classification layer of the classification model to obtain the video category to which the video to be classified belongs.

[0195] In some embodiments, the main feature extraction network includes a main spatial feature extraction layer, a main temporal feature extraction layer and a main feature fusion layer. The main feature extraction module 4551 is also used to perform spatial feature extraction on the video to be classified through the main spatial feature extraction layer to obtain the spatial features of the video to be classified; perform temporal feature extraction on the video to be classified through the main temporal feature extraction layer to obtain the temporal features of the video to be classified; and perform feature fusion on the spatial features and the temporal features through the main feature fusion layer to obtain the global spatiotemporal features of the video to be classified.

[0196] In some embodiments, the main feature extraction network includes a main spatial feature extraction layer, a main temporal feature extraction layer and a main feature fusion layer. The main feature extraction module 4551 is also used to perform spatial feature extraction on the video to be classified through the main spatial feature extraction layer to obtain the spatial features of the video to be classified; perform temporal feature extraction on the spatial features through the main temporal feature extraction layer to obtain the temporal features of the video to be classified; wherein the temporal features carry the spatial features of the video to be classified; and perform feature fusion on the temporal features carrying the spatial features and the spatial features through the main feature fusion layer to obtain the global spatiotemporal features of the video to be classified.

[0197] In some embodiments, the main feature extraction module 4551 is also used to perform spatial feature extraction of at least two spatial dimensions on the video to be classified through the main spatial feature extraction layer to obtain the first spatial sub-features of the video to be classified in at least two spatial dimensions; perform feature fusion on the first spatial sub-features of the video to be classified in at least two spatial dimensions to obtain the spatial features of the video to be classified.

[0198] In some embodiments, the main feature extraction module 4551 is further used to obtain a first weight of each of the first spatial sub-features; based on the first weight, weighted fusion is performed on each of the first spatial sub-features to obtain the spatial feature of the video to be classified.

[0199] In some embodiments, the sub-feature extraction network includes a sub-spatial feature extraction layer, a sub-temporal feature extraction layer and a sub-feature fusion layer. The sub-feature extraction module 4552 is also used to perform spatial feature extraction of the at least two spatial dimensions on the video to be classified through the sub-spatial feature extraction layer to obtain the second spatial sub-features of the video to be classified in each of the spatial dimensions; perform temporal feature extraction on the video to be classified through the sub-temporal feature extraction layer to obtain the temporal features of the video to be classified; perform feature fusion of each of the second spatial sub-features with the temporal features through the sub-feature fusion layer to obtain the spatiotemporal fusion features corresponding to each of the second spatial sub-features, and fuse the spatiotemporal fusion features corresponding to each of the second spatial sub-features to obtain the local spatiotemporal features of the video to be classified.

[0200] In some embodiments, the sub-feature extraction module 4552 is also used to obtain a second weight of each of the second spatial sub-features; based on the second weight, the spatiotemporal fusion features corresponding to each of the second spatial sub-features are weightedly fused to obtain the local spatiotemporal features of the video to be classified.

[0201] In some embodiments, the sub-feature extraction network includes a sub-spatial feature extraction layer, a sub-temporal feature extraction layer and a sub-feature fusion layer, and the at least two spatial dimensions include a channel dimension. The sub-feature extraction module 4552 is also used to perform spatial feature extraction of the at least two spatial dimensions on the video to be classified through the sub-spatial feature extraction layer to obtain the channel features of the video to be classified in the channel dimension, and the third spatial sub-features of the video to be classified in other spatial dimensions; perform temporal feature extraction on the video to be classified through the sub-temporal feature extraction layer to obtain the temporal features of the video to be classified; perform feature fusion of each of the third spatial sub-features with the temporal features through the sub-feature fusion layer to obtain the spatiotemporal fusion features corresponding to each of the third spatial sub-features, and fuse the channel features and the spatiotemporal fusion features corresponding to each of the third spatial sub-features to obtain the local spatiotemporal features of the video to be classified.

[0202] In some embodiments, the sub-feature extraction module 4552 is also used to fuse the channel features and the spatiotemporal fusion features corresponding to each of the third spatial sub-features to obtain intermediate spatiotemporal features; and to fuse the intermediate spatiotemporal features and the spatial sub-features of the video to be classified in at least two spatial dimensions to obtain local spatiotemporal features of the video to be classified.

[0203] In some embodiments, the sub-feature extraction module 4552 is also used to obtain the weight of the channel feature and the weight of each of the third spatial sub-features; based on the weight of the channel feature and the weight of each of the third spatial sub-features, the spatiotemporal fusion features corresponding to the channel feature and each of the third spatial sub-features are fused to obtain the local spatiotemporal features of the video to be classified.

[0204] In some embodiments, the device further includes a training module, which is used to obtain video training samples carrying labels; wherein the labels are used to indicate the video category to which the video training samples belong; through the main feature extraction network, a first feature extraction is performed on the video training samples to obtain global spatiotemporal features of the video training samples, and the global spatiotemporal features are integrated with the spatial features of the video training samples and the temporal features of the video training samples; through the secondary feature extraction network, a second feature extraction is performed on the video training samples to obtain local spatiotemporal features of the video training samples, and the local spatiotemporal features are integrated with the temporal features of the video training samples and the spatial sub-features of the video training samples in at least two spatial dimensions; through the feature fusion layer, the global spatiotemporal features and the local spatiotemporal features are feature fused to obtain target spatiotemporal features of the video training samples; through the video classification layer, the video training samples are classified based on the target spatiotemporal features to obtain the video category to which the video training samples belong; the difference between the video category to which the video training samples belong and the label is obtained, and the model parameters of the classification model are updated based on the difference.

[0205] In some embodiments, the device also includes an optical flow feature extraction module, which is used to perform a third feature extraction on the video to be classified through the optical flow feature extraction layer to obtain the optical flow features of the video to be classified; the feature fusion module 4553 is also used to perform feature fusion on the global spatiotemporal features, the local spatiotemporal features and the optical flow features through the feature fusion layer to obtain the target spatiotemporal features of the video to be classified.

[0206] In some embodiments, the number of the main feature extraction network and the number of the secondary feature extraction network are both at least two, the at least two main feature extraction networks are arranged in series to form a main feature extraction network sequence with increasing levels, the at least two secondary feature extraction networks are arranged in series to form a secondary feature extraction network sequence with increasing levels, and the number of the main feature extraction networks is the same as that of the secondary feature extraction networks; the main feature extraction module 4551 is also used to perform a first feature extraction on the video to be classified through at least two of the main feature extraction networks in the main feature extraction network sequence to obtain the global spatiotemporal features of the video to be classified; the secondary feature extraction module 4552 is also used to perform a second feature extraction on the video to be classified through at least two of the secondary feature extraction networks in the secondary feature extraction network sequence to obtain the local spatiotemporal features of the video to be classified; wherein, in the main feature extraction network sequence, the input of the next-level main feature extraction network is the output of the previous-level main feature extraction network and the secondary feature extraction network; in the secondary feature extraction network sequence, the input of the next-level secondary feature extraction network is the output of the previous-level secondary feature extraction network.

[0207] The following describes a training device 2400 for a classification model provided in an embodiment of the present application, wherein the classification model includes: a main feature extraction network, a secondary feature extraction network, a feature fusion layer, and a video classification layer, see Fig.24 , Fig.24 2400 is a structural diagram of a classification model training device 2400 provided in an embodiment of the present application. The classification model training device 2400 provided in an embodiment of the present application includes:

[0208] The main feature extraction module 2401 is used to perform a first feature extraction on the video training sample carrying the label to obtain the global spatiotemporal feature of the video training sample, wherein the global spatiotemporal feature integrates the spatial feature of the video training sample and the temporal feature of the video training sample, and the label is used to indicate the video category to which the video training sample belongs;

[0209] A secondary feature extraction module 2402 is used to perform a second feature extraction on the video training sample through the secondary feature extraction network to obtain a local spatiotemporal feature of the video training sample, wherein the local spatiotemporal feature incorporates a temporal feature of the video training sample and a spatial sub-feature of the video to be classified in at least two spatial dimensions;

[0210] A feature fusion module 2403 is used to perform feature fusion on the global spatiotemporal features and the local spatiotemporal features through the feature fusion layer to obtain target spatiotemporal features of the video training sample;

[0211] A video classification module 2404 is used to classify the video training sample based on the target spatiotemporal features through the video classification layer to obtain the video category to which the video training sample belongs;

[0212] The parameter updating module 2405 is used to obtain the difference between the video category to which the video training sample belongs and the label, and train the classification model based on the difference, so as to classify the video to be classified through the classification model obtained by training, and obtain the video category to which the video to be classified belongs.

[0213] The embodiment of the present application provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the video classification method based on the classification model described in the embodiment of the present application.

[0214] The present application embodiment provides a computer-readable storage medium storing executable instructions, wherein the executable instructions are stored. When the executable instructions are executed by a processor, the processor will execute the video classification method based on the classification model provided by the present application embodiment, for example, Figure 3 The video classification method based on the classification model is shown.

[0215] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EP ROM, EEPROM, flash memory, magnetic surface storage, optical disk, or CD-ROM; or it may be various devices including one or any combination of the above memories.

[0216] In some embodiments, executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.

[0217] As an example, executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).

[0218] By way of example, executable instructions may be deployed to be executed on one computing device, or on multiple computing devices located at one site, or on multiple computing devices distributed across multiple sites and interconnected by a communication network.

[0219] In summary, the following technical effects can be achieved through the embodiments of the present application:

[0220] (1) In the process of video classification, the global spatiotemporal features and local spatiotemporal features of the video to be classified are extracted by building a dual-path feature extraction network, and then the extracted global spatiotemporal features and local spatiotemporal features are fused to obtain the target spatiotemporal features of the video to be classified, and the final video classification is performed based on the target spatiotemporal features. In this way, the video content can be better understood, the accuracy of video classification is improved, and video classification tasks in different scenarios can be completed.

[0221] (2) It avoids the loss of features during feature processing and can capture more sufficient spatial semantic information, thereby improving the accuracy of video understanding.

[0222] (3) When the spatial dimension includes the channel dimension, by presetting the number of channels, the deeper the network, the smaller the resolution of the output feature and the larger the number of channels, while the shallower the network, the higher the resolution of the output feature and the smaller the number of channels. In this way, the shallow network can better capture highly fine-grained spatial features, while the deep network can capture more sufficient spatial semantic information, so that the spatiotemporal features can be more fully extracted.

[0223] (4) After determining the local spatiotemporal features, the local spatiotemporal features are standardized to obtain standardized local spatiotemporal features; then, the global spatiotemporal features and the standardized local spatiotemporal features are fused through the feature fusion layer to obtain the target spatiotemporal features of the video to be classified. In this way, the local spatiotemporal features are standardized, so that the standardized local spatiotemporal features are fused with the global spatiotemporal features to effectively integrate the local spatiotemporal features into the global spatiotemporal features.

[0224] (5) Through layer-by-layer feature fusion, local spatiotemporal features are effectively integrated into global spatiotemporal features to capture more complete spatial semantic information.

[0225] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.

Claims

1. A video classification method based on classification model, It is characterized in that The classification model includes: a main feature extraction network, a secondary feature extraction network, a feature fusion layer and a video classification layer, and the method includes: Through the main feature extraction network, a first feature extraction is performed on the video to be classified to obtain a global spatiotemporal feature of the video to be classified, wherein the global spatiotemporal feature is integrated with the spatial feature of the video to be classified and the temporal feature of the video to be classified; The second feature extraction is performed on the video to be classified through the secondary feature extraction network to obtain local spatiotemporal features of the video to be classified, wherein the local spatiotemporal features are integrated with the time features of the video to be classified and the spatial sub-features of the video to be classified in at least two spatial dimensions; wherein the spatial dimensions include a length dimension, a width dimension, and a channel dimension; By means of the feature fusion layer, the global spatiotemporal features and the local spatiotemporal features are fused to obtain target spatiotemporal features of the video to be classified; Through the video classification layer, the video to be classified is classified based on the target spatiotemporal features to obtain the video category to which the video to be classified belongs.

2. The method according to claim 1, It is characterized in that The main feature extraction network includes a main spatial feature extraction layer, a main temporal feature extraction layer and a main feature fusion layer. The main feature extraction network is used to extract the first feature of the video to be classified to obtain the global spatiotemporal features of the video to be classified, including: Extracting spatial features of the video to be classified through the main spatial feature extraction layer to obtain spatial features of the video to be classified; Through the main time feature extraction layer, the time feature of the video to be classified is extracted to obtain the time feature of the video to be classified; The spatial features and the temporal features are fused through the main feature fusion layer to obtain the global spatiotemporal features of the video to be classified.

3. The method according to claim 1, It is characterized in that The main feature extraction network includes a main spatial feature extraction layer, a main temporal feature extraction layer and a main feature fusion layer. The main feature extraction network is used to extract the first feature of the video to be classified to obtain the global spatiotemporal features of the video to be classified, including: Extracting spatial features of the video to be classified through the main spatial feature extraction layer to obtain spatial features of the video to be classified; Through the main time feature extraction layer, the spatial feature is subjected to time feature extraction to obtain the time feature of the video to be classified; wherein the time feature carries the spatial feature of the video to be classified; The main feature fusion layer is used to perform feature fusion on the temporal feature carrying the spatial feature and the spatial feature to obtain the global spatiotemporal feature of the video to be classified.

4. The method according to claim 2 or 3, It is characterized in that The extracting spatial features of the video to be classified through the main spatial feature extraction layer to obtain the spatial features of the video to be classified includes: Through the main spatial feature extraction layer, spatial feature extraction of at least two spatial dimensions is performed on the video to be classified to obtain first spatial sub-features of the video to be classified in at least two spatial dimensions; Feature fusion is performed on first spatial sub-features of the video to be classified in at least two spatial dimensions to obtain spatial features of the video to be classified.

5. The method according to claim 4, It is characterized in that The step of fusing the first spatial sub-features of the video to be classified in at least two spatial dimensions to obtain the spatial features of the video to be classified includes: Obtaining a first weight of each of the first spatial sub-features; Based on the first weights, weighted fusion is performed on the first spatial sub-features to obtain the spatial features of the video to be classified.

6. The method according to claim 1, It is characterized in that The secondary feature extraction network includes a secondary spatial feature extraction layer, a secondary temporal feature extraction layer and a secondary feature fusion layer. The secondary feature extraction network is used to extract the second feature of the video to be classified to obtain the local spatiotemporal features of the video to be classified, including: By means of the secondary spatial feature extraction layer, the spatial feature extraction of the at least two spatial dimensions is performed on the video to be classified, so as to obtain the second spatial sub-feature of the video to be classified in each of the spatial dimensions; Extracting time features of the video to be classified through the secondary time feature extraction layer to obtain the time features of the video to be classified; Through the sub-feature fusion layer, each of the second spatial sub-features is fused with the time feature respectively to obtain the spatiotemporal fusion features corresponding to each of the second spatial sub-features, and the spatiotemporal fusion features corresponding to each of the second spatial sub-features are fused to obtain the local spatiotemporal features of the video to be classified.

7. The method according to claim 6, It is characterized in that The step of fusing the spatiotemporal fusion features corresponding to the second spatial sub-features to obtain the local spatiotemporal features of the video to be classified includes: Obtaining a second weight of each of the second spatial sub-features; Based on the second weight, the spatiotemporal fusion features corresponding to each of the second spatial sub-features are weightedly fused to obtain the local spatiotemporal features of the video to be classified.

8. The method according to claim 1, It is characterized in that The secondary feature extraction network includes a secondary spatial feature extraction layer, a secondary temporal feature extraction layer and a secondary feature fusion layer, and the at least two spatial dimensions include a channel dimension; the secondary feature extraction network is used to extract a second feature from the video to be classified to obtain a local spatiotemporal feature of the video to be classified, including: Through the secondary spatial feature extraction layer, the spatial features of the at least two spatial dimensions are extracted for the video to be classified, so as to obtain the channel features of the video to be classified in the channel dimension and the third spatial sub-features of the video to be classified in other spatial dimensions; Extracting time features of the video to be classified through the secondary time feature extraction layer to obtain the time features of the video to be classified; Through the sub-feature fusion layer, each of the third spatial sub-features is fused with the time feature respectively to obtain the spatiotemporal fusion features corresponding to each of the third spatial sub-features, and the channel features and the spatiotemporal fusion features corresponding to each of the third spatial sub-features are fused to obtain the local spatiotemporal features of the video to be classified.

9. The method according to claim 8, It is characterized in that The step of fusing the channel feature and the spatiotemporal fusion features corresponding to each of the third spatial sub-features to obtain the local spatiotemporal features of the video to be classified includes: Fusing the channel feature and the spatiotemporal fusion features corresponding to each of the third spatial sub-features to obtain an intermediate spatiotemporal feature; The intermediate spatiotemporal features and the spatial sub-features of the video to be classified in the at least two spatial dimensions are fused to obtain local spatiotemporal features of the video to be classified.

10. The method according to claim 8, It is characterized in that The step of fusing the channel feature and the spatiotemporal fusion features corresponding to each of the third spatial sub-features to obtain the local spatiotemporal features of the video to be classified includes: Obtaining the weight of the channel feature and the weight of each of the third spatial sub-features; Based on the weight of the channel feature and the weight of each of the third spatial sub-features, the spatiotemporal fusion features corresponding to the channel feature and each of the third spatial sub-features are fused to obtain the local spatiotemporal features of the video to be classified.

11. The method according to claim 1, It is characterized in that Before extracting the first feature of the video to be classified through the main feature extraction network to obtain the global spatiotemporal feature that integrates the spatial feature of the video to be classified and the temporal feature of the video to be classified, the method further includes: Acquire a video training sample with a label, wherein the label is used to indicate the video category to which the video training sample belongs; Performing a first feature extraction on the video training sample through the main feature extraction network to obtain a global spatiotemporal feature of the video training sample, wherein the global spatiotemporal feature incorporates a spatial feature of the video training sample and a temporal feature of the video training sample; Performing a second feature extraction on the video training sample through the secondary feature extraction network to obtain a local spatiotemporal feature of the video training sample, wherein the local spatiotemporal feature incorporates a temporal feature of the video training sample and a spatial sub-feature of the video training sample in at least two spatial dimensions; By means of the feature fusion layer, the global spatiotemporal features and the local spatiotemporal features are fused to obtain target spatiotemporal features of the video training sample; By means of the video classification layer, the video training samples are classified based on the target spatiotemporal features to obtain the video category to which the video training samples belong; The difference between the video category to which the video training sample belongs and the label is obtained, and the model parameters of the classification model are updated based on the difference.

12. The method of claim 1, It is characterized in that The classification model also includes an optical flow feature extraction layer, and the method further includes: Performing a third feature extraction on the video to be classified through the optical flow feature extraction layer to obtain an optical flow feature of the video to be classified; The step of fusing the global spatiotemporal features and the local spatiotemporal features through the feature fusion layer to obtain the target spatiotemporal features of the video to be classified includes: The global spatiotemporal features, the local spatiotemporal features and the optical flow features are fused through the feature fusion layer to obtain the target spatiotemporal features of the video to be classified.

13. The method of claim 1, It is characterized in that The number of the main feature extraction network and the number of the secondary feature extraction network are both at least two, the at least two main feature extraction networks are arranged in series to form a main feature extraction network sequence with increasing levels, the at least two secondary feature extraction networks are arranged in series to form a secondary feature extraction network sequence with increasing levels, and the number of the main feature extraction networks and the secondary feature extraction networks are the same; The first feature extraction is performed on the video to be classified through the main feature extraction network to obtain the global spatiotemporal features of the video to be classified, including: Performing a first feature extraction on the video to be classified by at least two of the main feature extraction networks in the main feature extraction network sequence to obtain a global spatiotemporal feature of the video to be classified; The second feature extraction is performed on the video to be classified through the secondary feature extraction network to obtain the local spatiotemporal features of the video to be classified, including: Performing a second feature extraction on the video to be classified by using at least two of the secondary feature extraction networks in the secondary feature extraction network sequence to obtain local spatiotemporal features of the video to be classified; Among them, in the main feature extraction network sequence, the input of the next level main feature extraction network is the output of the previous level main feature extraction network and the secondary feature extraction network; in the secondary feature extraction network sequence, the input of the next level secondary feature extraction network is the output of the previous level secondary feature extraction network.

14. A training method for a classification model, It is characterized in that The classification model includes: a main feature extraction network, a secondary feature extraction network, a feature fusion layer and a video classification layer, and the method includes: Through the main feature extraction network, a first feature extraction is performed on the video training sample carrying the label to obtain the global spatiotemporal feature of the video training sample, wherein the global spatiotemporal feature integrates the spatial feature of the video training sample and the temporal feature of the video training sample, and the label is used to indicate the video category to which the video training sample belongs; The secondary feature extraction network is used to extract the second feature of the video training sample to obtain the local spatiotemporal features of the video training sample, wherein the local spatiotemporal features are integrated with the time features of the video training sample and the spatial sub-features of the video training sample in at least two spatial dimensions; wherein the spatial dimensions include a length dimension, a width dimension, and a channel dimension; By means of the feature fusion layer, the global spatiotemporal features and the local spatiotemporal features are fused to obtain target spatiotemporal features of the video training sample; By means of the video classification layer, the video training samples are classified based on the target spatiotemporal features to obtain the video category to which the video training samples belong; The difference between the video category to which the video training sample belongs and the label is obtained, and the classification model is trained based on the difference, so as to classify the video to be classified by using the classification model obtained through the training, and obtain the video category to which the video to be classified belongs.

15. A video classification device based on a classification model, It is characterized in that The classification model includes: a main feature extraction network, a secondary feature extraction network, a feature fusion layer and a video classification layer, and the device includes: A main feature extraction module, used to perform a first feature extraction on the video to be classified through the main feature extraction network to obtain a global spatiotemporal feature of the video to be classified, wherein the global spatiotemporal feature incorporates a spatial feature of the video to be classified and a temporal feature of the video to be classified; A secondary feature extraction module, used for performing a second feature extraction on the video to be classified through the secondary feature extraction network to obtain local spatiotemporal features of the video to be classified, wherein the local spatiotemporal features are integrated with the time features of the video to be classified and the spatial sub-features of the video to be classified in at least two spatial dimensions; wherein the spatial dimensions include a length dimension, a width dimension and a channel dimension; A feature fusion module, used to perform feature fusion on the global spatiotemporal features and the local spatiotemporal features through the feature fusion layer to obtain target spatiotemporal features of the video to be classified; The video classification module is used to classify the video to be classified based on the target spatiotemporal features through the video classification layer to obtain the video category to which the video to be classified belongs.

16. A training device for a classification model, It is characterized in that The classification model includes: a main feature extraction network, a secondary feature extraction network, a feature fusion layer and a video classification layer, and the device includes: A main feature extraction module is used to perform a first feature extraction on a video training sample carrying a label to obtain a global spatiotemporal feature of the video training sample, wherein the global spatiotemporal feature incorporates a spatial feature of the video training sample and a temporal feature of the video training sample, and the label is used to indicate a video category to which the video training sample belongs; A secondary feature extraction module, configured to perform a second feature extraction on the video training sample through the secondary feature extraction network to obtain a local spatiotemporal feature of the video training sample, wherein the local spatiotemporal feature incorporates a temporal feature of the video training sample and a spatial sub-feature of the video training sample in at least two spatial dimensions; wherein the spatial dimensions include a length dimension, a width dimension, and a channel dimension; A feature fusion module, used to perform feature fusion on the global spatiotemporal features and the local spatiotemporal features through the feature fusion layer to obtain target spatiotemporal features of the video training sample; A video classification module, configured to classify the video training samples based on the target spatiotemporal features through the video classification layer to obtain the video category to which the video training samples belong; The parameter updating module is used to obtain the difference between the video category to which the video training sample belongs and the label, and train the classification model based on the difference, so as to classify the video to be classified through the classification model obtained by training, and obtain the video category to which the video to be classified belongs.

17. An electronic device, It is characterized in that include: A memory for storing executable instructions; A processor, configured to implement the method according to any one of claims 1 to 14 when executing the executable instructions stored in the memory.

18. A computer-readable storage medium, It is characterized in that Executable instructions are stored, which are used to cause a processor to execute and implement the method described in any one of claims 1 to 14.

19. A computer program product comprising a computer program or instructions, It is characterized in that When the computer program or instruction is executed by a processor, the method according to any one of claims 1 to 14 is implemented.

Citation Information

Patent Citations

  • Action recognition method based on attention mechanism of convolution recurrent neural network

    CN107273800A

  • Multimedia resource classification method and device, computer device, and storage medium

    CN109189950A

  • Video classification method, device and equipment and computer readable storage medium

    CN111859023A

  • Fusing multilayer and multimodal deep neural networks for video classification

    US20180032846A1

  • Video recommendation method and device, computer device and storage medium

    US20210281918A1