Video classification method, device, electronic device and storage medium

By extracting and merging multi-time granularity features from short videos, the problem of low classification accuracy caused by single time-granularity features in the existing technology is solved, and higher video classification accuracy is achieved.

CN113010736BActive Publication Date: 2024-09-06BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201911328274.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-12-20
Publication Date
2024-09-06
Estimated Expiration
2039-12-20

AI Technical Summary

Technical Problem

The existing technology uses a C3D convolutional network sampled at a single time interval in short video classification, resulting in extracted features with a single time granularity and low accuracy of classification results.

Method used

By determining S target image groups from N video frames of the video to be classified, each group includes multiple video frames with different temporal intervals, inputs them into the deep learning model, obtains feature vectors and performs feature fusion to generate multi-time granularity Classification feature vector for classification.

Benefits of technology

The accuracy of video classification is improved, and the accuracy of video classification is enhanced by fusing features with different time granularities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113010736B
    Figure CN113010736B
Patent Text Reader

Abstract

The embodiments of the present application provide a video classification method, device, electronic device and storage medium, which obtain N video frames of a video to be classified; determine S target image groups from the N video frames; input the S target image groups into S feature extraction networks of a pre-trained deep learning model, obtain feature vectors of each target image group, and obtain S feature vectors; perform feature fusion on the S feature vectors to obtain classification feature vectors of the N video frames; classify the video to be classified according to the classification feature vectors of the N video frames, and obtain the classification result of the video to be classified. The method realizes that by obtaining features of different time granularities, fusing them, and classifying the video to be classified according to the fusion results, it is possible to extract features of multiple time granularities to classify the video, thereby improving the accuracy of video classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of information technology, and in particular to a video classification method, device, electronic device and storage medium. Background Art

[0002] With the development of intelligent high-definition technology, video processing technology based on image analysis is increasingly being applied to practical tasks. As the main source of profit for short video manufacturers, effective analysis of short videos, such as classification, target segmentation, video overview, etc., plays a vital role in the subsequent processing of short videos.

[0003] At present, short videos are generally classified through C3D (3D ConvNets, 3D convolutional networks). In the prior art, when classifying short videos through C3D, video frames sampled at a single time interval are usually used as the training input of C3D. Therefore, the features extracted during the entire network learning process are also at a single time granularity. In the actual classification process, because the input to C3D is continuous video frames, the features extracted are usually at a single time granularity. Then, video classification is performed only through the features of a single time granularity, and the classification result has low accuracy. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a video classification method, device, electronic device and storage medium to improve the accuracy of video classification results. The specific technical solution is as follows:

[0005] In a first aspect, the present application provides a video classification method, comprising:

[0006] Get N video frames of the video to be classified;

[0007] Determine S target image groups from N video frames, wherein each target image group includes multiple video frames, and the time intervals between the video frames in different target image groups are different;

[0008] Input the S target image groups into the S feature extraction networks of the pre-trained deep learning model respectively, obtain the feature vectors of each target image group, and obtain S feature vectors, wherein the feature vectors are used to represent the spatial features and temporal features of the target image;

[0009] Perform feature fusion on the S feature vectors to obtain classification feature vectors of N video frames, where the classification feature vectors include spatial features and temporal features of the N video frames;

[0010] The video to be classified is classified according to the classification feature vectors of N video frames to obtain the classification result of the video to be classified.

[0011] Optionally, determining S target image groups from N video frames includes:

[0012] Grouping N video frames according to different time intervals to obtain a grouping result corresponding to each time interval, wherein the grouping result corresponding to each time interval includes multiple image groups;

[0013] A group of image groups is randomly selected from the grouping results corresponding to each time interval to obtain S target image groups.

[0014] Optionally, the N video frames are grouped according to different time intervals to obtain a grouping result corresponding to each time interval, including:

[0015] According to a preset rule, an image of a preset specification is intercepted from each of the N video frames to obtain the intercepted N video frames, wherein the preset rule is to regard the N video frames as a video segment, intercept the same video segment at the same position, and intercept different video segments at different positions;

[0016] The captured N video frames are grouped according to different time intervals to obtain a grouping result corresponding to each time interval.

[0017] Optionally, before grouping the captured N video frames according to different time intervals to obtain the grouping result corresponding to each time interval, the method further includes:

[0018] Mapping processing is performed on each of the N captured video frames to obtain a shallow feature map corresponding to each of the N captured video frames.

[0019] Optionally, obtain N video frames of the video to be classified, including:

[0020] Select a video frame from the video to be classified as a starting video frame;

[0021] In the video to be classified, select N consecutive video frames forward or backward starting from the starting video frame.

[0022] Optionally, the S eigenvectors are eigenvectors of the same dimension.

[0023] Optionally, before obtaining N video frames of the video to be classified, the method further includes:

[0024] Obtain multiple sample videos and a network model to be trained, wherein the sample videos include N video frames and the sample videos are marked with video classification results;

[0025] Select a sample video, and select S sample image groups from N video frames of the selected sample video, wherein each sample image group includes multiple video frames, and the time intervals between the video frames in different sample image groups are different;

[0026] The S sample image groups are input into the S feature extraction networks of the network model to be trained respectively, and the feature vectors of each sample image group are obtained to obtain S sample feature vectors;

[0027] Using the network model to be trained to perform feature fusion on S sample feature vectors, a sample classification feature vector is obtained;

[0028] Using the network model to be trained to classify the sample classification feature vector, and obtain the predicted classification result;

[0029] Calculate the loss of the network model to be trained according to the predicted classification results of the selected sample videos and the video classification results of the selected sample video labels;

[0030] Adjust the parameters of the network model to be trained according to the loss of the network model;

[0031] Select sample videos to continue training the network model to be trained until the loss of the network model to be trained is less than a preset threshold, thereby obtaining a trained network model.

[0032] In a second aspect, the present application provides a video classification device, comprising:

[0033] A video frame acquisition module is used to acquire N video frames of the video to be classified;

[0034] A video frame grouping module, used to determine S target image groups from N video frames, wherein each target image group includes multiple video frames, and the time intervals between the video frames in different target image groups are different;

[0035] An image input module is used to input S target image groups into S feature extraction networks of a pre-trained deep learning model, respectively, to obtain feature vectors of each target image group, and obtain S feature vectors, wherein the feature vectors are used to characterize the spatial features and temporal features of the target image;

[0036] A feature fusion module is used to perform feature fusion on the S feature vectors to obtain classification feature vectors of N video frames, wherein the classification feature vectors include spatial features and temporal features of the N video frames;

[0037] The video classification module is used to classify the video to be classified according to the classification feature vectors of N video frames to obtain the classification result of the video to be classified.

[0038] Optionally, a video frame grouping module includes:

[0039] The video frame classification submodule is used to group N video frames according to different time intervals to obtain a grouping result corresponding to each time interval, wherein the grouping result corresponding to each time interval includes multiple image groups;

[0040] The image grouping submodule is used to randomly select a group of image groups from the grouping results corresponding to each time interval to obtain S target image groups.

[0041] Optional, image grouping submodule, including:

[0042] A region capture unit is used to capture an image of preset specifications from each of N video frames according to a preset rule to obtain N captured video frames, wherein the preset rule is to take the N video frames as a video segment, capture the same video segment at the same position, and capture different video segments at different positions;

[0043] The grouping rule unit is used to group the N captured video frames according to different time intervals to obtain a grouping result corresponding to each time interval.

[0044] Optionally, the image grouping submodule further includes:

[0045] A mapping unit, used to perform mapping processing on each of the N intercepted video frames to obtain a shallow feature map corresponding to each of the N intercepted video frames;

[0046] Optionally, a video frame acquisition module includes:

[0047] A starting frame submodule is used to select a video frame from the video to be classified as a starting video frame;

[0048] The continuous selection submodule is used to select N continuous video frames forward or backward from the starting video frame in the video to be classified.

[0049] Optionally, the S eigenvectors are eigenvectors of the same dimension.

[0050] Optionally, the above device is also used for:

[0051] Obtain multiple sample videos and a network model to be trained, wherein the sample videos include N video frames and the sample videos are marked with video classification results;

[0052] Select a sample video, and select S sample image groups from N video frames of the selected sample video, wherein each sample image group includes multiple video frames, and the time intervals between the video frames in different sample image groups are different;

[0053] The S sample image groups are input into the S feature extraction networks of the network model to be trained respectively, and the feature vectors of each sample image group are obtained to obtain S sample feature vectors;

[0054] Using the network model to be trained to perform feature fusion on S sample feature vectors, a sample classification feature vector is obtained;

[0055] Using the network model to be trained to classify the sample classification feature vector, and obtain the predicted classification result;

[0056] Calculate the loss of the network model to be trained according to the predicted classification results of the selected sample videos and the video classification results of the selected sample video labels;

[0057] Adjust the parameters of the network model to be trained according to the loss of the network model;

[0058] Select sample videos to continue training the network model to be trained until the loss of the network model to be trained is less than a preset threshold, thereby obtaining a trained network model.

[0059] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:

[0060] processor;

[0061] a memory for storing processor-executable instructions;

[0062] The processor is configured to execute instructions to implement any of the above-mentioned video classification methods.

[0063] According to a fourth aspect of the embodiments of the present disclosure, a storage medium is provided.

[0064] When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute any of the above-mentioned video classification methods.

[0065] The embodiments of the present application provide a video classification method, device, electronic device and storage medium, which obtain N video frames of a video to be classified; determine S target image groups from the N video frames; input the S target image groups into S feature extraction networks of a pre-trained deep learning model, obtain feature vectors of each target image group, and obtain S feature vectors; perform feature fusion on the S feature vectors to obtain classification feature vectors of the N video frames; classify the video to be classified according to the classification feature vectors of the N video frames to obtain the classification result of the video to be classified. It is achieved by obtaining features of different time granularities, fusing them, and classifying the video to be classified according to the fusion results, thereby achieving the extraction of features of multiple time granularities for video classification and improving the accuracy of video classification. Of course, it is not necessary to achieve all the advantages described above at the same time to implement any product or method of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0066] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0067] Figure 1 A flow chart of a video classification method according to an embodiment of the present application;

[0068] Figure 2 A flowchart of a target image grouping method according to an embodiment of the present application;

[0069] Figure 3 A flowchart of a video frame classification method according to an embodiment of the present application;

[0070] Figure 4 A flowchart of another video frame classification method according to an embodiment of the present application;

[0071] Figure 5 A flowchart of a video frame selection method according to an embodiment of the present application;

[0072] Figure 6 This is an example diagram of a video classification method according to an embodiment of the present application;

[0073] Figure 7 A schematic diagram of a video classification device according to an embodiment of the present application;

[0074] Figure 8 A schematic diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0075] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0076] First, the professional terms in the embodiments of the present application are explained:

[0077] Convolutional Neural Network (CNN): is a neural network designed specifically for image recognition problems. It imitates the multi-layer process of human image recognition: pupils take in pixels; some cells in the cerebral cortex perform preliminary processing to find shape edges and directions; abstractly determine shapes (such as circles and squares); and further abstractly determine (such as determining that an object is a balloon).

[0078] Multiple Granularity Feature: It refines the network based on the existing feature extraction method so that the network can learn not only coarse-grained features but also fine-grained features.

[0079] Scene Classification: By using convolutional neural networks to learn a large amount of different types of scene video data, the same type of scenes have similar feature descriptions, and then different videos are classified into scenes.

[0080] In order to classify videos through features of multiple time granularities and improve the accuracy of video classification, the present application provides a video classification method, device, electronic device and storage medium, which are described in detail below.

[0081] Figure 1 A flow chart of a video classification method according to an embodiment of the present application is shown in FIG. Figure 1 As shown, the video classification method includes the following steps:

[0082] In step S11, N video frames of the video to be classified are obtained.

[0083] The video splitting method of the embodiment of the present application is aimed at videos in smart terminal devices, and therefore can be executed by smart terminal devices. The smart terminal device can be a smart device that classifies videos through a trained network model. The smart terminal device can also train the network model and classify videos through its own trained network model. Specifically, the smart terminal device can be a computer, a smart phone or a server, etc.

[0084] The video to be classified may be in various formats, such as AVI (Audio Video Interleaved), MP4 (Moving Picture Experts Group 4), etc. The obtained video frames may be continuous video frames or randomly selected video frames from the video to be classified, which is not limited in the present application. The N video frames of the video to be classified may be obtained by the prior art method.

[0085] In step S12, S target image groups are determined from N video frames.

[0086] Each target image group includes multiple video frames, and the time intervals between the video frames in different target image groups are different.

[0087] Among them, the above-mentioned selection of S target image groups from N video frames can be to select S target image groups from N video frames and classify the above video frames by different time intervals. For example, after the above-mentioned N video frames are sorted in chronological order, one video frame is selected every other video frame, so that the above-mentioned N video frames are divided into two groups of video frames, or one video frame is selected every other video frames, so that the above-mentioned N video frames are divided into three groups, and one group of image groups is selected from each grouping result. It is also possible to directly select S target image groups from N video frames. This application is not limited to this.

[0088] In step S13, the S target image groups are respectively input into the S feature extraction networks of the pre-trained deep learning model to obtain the feature vector of each target image group, thereby obtaining S feature vectors.

[0089] Among them, the feature vector is used to characterize the spatial features and temporal features of the target image. The spatial features refer to the spatial information of each frame, and the temporal features characterize the temporal relationship between frames.

[0090] Optionally, the S eigenvectors are eigenvectors of the same dimension.

[0091] The above-mentioned obtaining of the feature vector of each image group may obtain the feature vector of each image in each image group.

[0092] In step S14, feature fusion is performed on the S feature vectors to obtain classification feature vectors of N video frames.

[0093] The classification feature vector includes the spatial features and temporal features of N video frames. There are many different fusion methods for the feature fusion of the feature vectors. For example, the feature vectors are fused by splicing to obtain the classification feature vector. That is, the feature vectors are spliced ​​together, for example, vector (1,2) and vector (3,4) are spliced ​​to obtain (1,2,3,4). Or the feature vectors are connected by the concat function.

[0094] By performing feature fusion on the above S feature vectors, classification feature vectors of N video frames are obtained. The obtained classification feature vectors may include features of the S feature vectors, thereby facilitating classification of videos through multiple features.

[0095] In step S15, the video to be classified is classified according to the classification feature vectors of the N video frames to obtain a classification result of the video to be classified.

[0096] Among them, the video to be classified is classified according to the classification feature vectors of N video frames. The N video frames can be classified as a video clip, and multiple video clips are selected from the video to be classified. The classification result with the most classifications among the classification results of all the clips is taken as the classification result of the entire video.

[0097] It can be seen that through the video classification method of the embodiment of the present application, it is achieved by acquiring features of different time granularities, fusing them, and classifying the video to be classified according to the fusion results, thereby realizing the extraction of features of multiple time granularities for video classification and improving the accuracy of video classification.

[0098] In a possible implementation, Figure 2 As shown, the above-mentioned selection of S target image groups from N video frames includes the following steps:

[0099] In step S121, N video frames are grouped according to different time intervals to obtain a grouping result corresponding to each time interval.

[0100] Among them, the grouping results corresponding to each time interval include multiple image groups. For example, for the image group (1,2,3…32), according to the time interval of 2 groups, it can be divided into two groups (1,3,5…31) and (2,4,6…32), and the first classification result is obtained. According to the time interval of 4 groups, it can be divided into four groups (1,5,9…), (2,6,10…), (3,7,11…) and (4,8,12…), and the second classification result is obtained. According to the time interval of 8 groups, it can be divided into eight groups such as (1,9…), (2,10…), and the third classification result is obtained.

[0101] In step S122, a group of image groups is randomly selected from the grouping results corresponding to each time interval to obtain S target image groups.

[0102] By grouping N video frames according to different time intervals, a grouping result corresponding to each time interval is obtained, wherein each time interval corresponding to the grouping result includes multiple image groups; a group of image groups is randomly selected from the grouping results corresponding to each time interval, and S target image groups are obtained. Each group can contain different time granularity characteristics, and the above-mentioned video to be classified is classified through the grouping, and the video to be classified can be classified according to different time granularity characteristics.

[0103] Optional, see Figure 3 , the N video frames are grouped according to different time intervals, and the grouping results corresponding to each time interval are obtained, including:

[0104] S1211, according to a preset rule, an image of a preset specification is intercepted from each of the N video frames to obtain N intercepted video frames.

[0105] The preset rule is to take N video frames as one video segment, cut out the same video segment at the same position, and cut out different video segments at different positions.

[0106] Among them, the above-mentioned intercepting an image of preset specifications from each video frame of N video frames according to preset rules to obtain the intercepted N video frames can be intercepting a local area in the video frame according to preset rules to obtain the intercepted N video frames.

[0107] S1212, grouping the captured N video frames according to different time intervals to obtain a grouping result corresponding to each time interval.

[0108] Each image group includes multiple regional images, and the time intervals between the regional images in image groups with different classification results are different.

[0109] The above-mentioned grouping of the regional images in the image region group corresponding to the preset rule according to the image grouping rule in the preset rule may be grouping the images in the order of the time intervals of the video frames.

[0110] It can be seen that by intercepting an image of preset specifications from each of N video frames according to the preset rules, N intercepted video frames are obtained; the N intercepted video frames are grouped according to different time intervals to obtain the grouping results corresponding to each time interval, the regional image information in the video to be classified can be obtained, and image groups of different time granularities can be obtained through grouping.

[0111] Optional, see Figure 4 , before grouping the captured N video frames according to different time intervals to obtain the grouping result corresponding to each time interval, the method further includes:

[0112] S1213, mapping processing is performed on each of the N captured video frames to obtain a shallow feature map corresponding to each of the N captured video frames.

[0113] Among them, by performing the mapping process on each of the N video frames, the acquired video frame can be mapped from an RGB (a color mode) image to a feature map, wherein the above mapping can be implemented by a variety of existing technologies.

[0114] It can be seen that by performing mapping processing on each video frame in N video frames to obtain a shallow feature map corresponding to each video frame in the N video frames, feature information of different time granularities of the shallow information of the above video frames can be obtained.

[0115] In a possible implementation, Figure 5 As shown, the above-mentioned acquisition of N video frames of the video to be classified includes:

[0116] In step S111 , a video frame is selected from the video to be classified as a starting video frame.

[0117] The above-mentioned starting video frame is a reference video frame for obtaining sample video frames, and specifically can be any video frame in the video to be classified.

[0118] In step S112, in the video to be classified, N consecutive video frames are selected forward or backward starting from the starting video frame.

[0119] The above starting video frame can be used as a reference video frame for obtaining video frames in the video to be classified. For example, a frame a is randomly selected in a video, and 32 consecutive frames (recorded as 1, 2, 3...32 in the order of frames) are taken as a segment. When the selected frame a is at the end of the video (less than 32 frames after a), the starting frame is reselected in the current video to replace a. Or a is taken as the end frame and the previous 32 consecutive frames are taken as a segment.

[0120] It can be seen that through the video frame acquisition method of the embodiment of the present application, it is realized to select a video frame in the video to be classified as the starting video frame, and in the video to be classified, select N consecutive video frames forward or backward from the starting video frame, so that multiple consecutive video frames can be obtained at any position of the video to be classified, and the video samples the video to be classified at multiple time granularities.

[0121] Optional, pre-trained deep learning model steps include:

[0122] Obtain multiple sample videos and a network model to be trained, wherein the sample videos include N video frames and the sample videos are marked with video classification results;

[0123] Select a sample video, and select S sample image groups from N video frames of the selected sample video, wherein each sample image group includes multiple video frames, and the time intervals between the video frames in different sample image groups are different;

[0124] The S sample image groups are input into the S feature extraction networks of the network model to be trained respectively, and the feature vectors of each sample image group are obtained to obtain S sample feature vectors;

[0125] Using the network model to be trained to perform feature fusion on S sample feature vectors, a sample classification feature vector is obtained;

[0126] Using the network model to be trained to classify the sample classification feature vector, and obtain the predicted classification result;

[0127] Calculate the loss of the network model to be trained according to the predicted classification results of the selected sample videos and the video classification results of the selected sample video labels;

[0128] Adjust the parameters of the network model to be trained according to the loss of the network model;

[0129] Select sample videos to continue training the network model to be trained until the loss of the network model to be trained is less than a preset threshold, thereby obtaining a trained network model.

[0130] An example process of a video classification method according to an embodiment of the present application is shown in FIG. Figure 6 , Figure 6 An example diagram of a video classification method according to an embodiment of the present application, comprising:

[0131] In step A, a frame a is randomly selected from a video, and 32 consecutive frames (recorded as 1, 2, 3...32 in the order of frames) are taken as a segment, and these 32 frames are adjusted to 256×256 pixel images, and randomly cropped (different video segments are cropped at different positions during training, and the same segment is cropped at the same position) to 224×224 pixel images, which are used as network input. When the selected frame a is at the end of the video (less than 32 frames after a), a new starting frame is selected in the current video to replace a.

[0132] In step B, the shallow features of the video clip are extracted through the backbone network, and the video frame is mapped from an RGB (a color mode) image to a feature map, and the output is 32×C×H×W, where C is the channel of the backbone network output feature map, and H and W are the height and width of the backbone network output feature map.

[0133] In step C, three sub-networks using the same C3D network structure are used to extract the spatial features (high-level abstract semantic features, referring to the spatial information of each frame) and temporal features (the temporal relationship between frames) of the video clips. The features extracted by the backbone network are grouped according to different temporal intervals.

[0134] 1. The time interval is 2 groups, which can be divided into two groups: (1, 3, 5...31) and (2, 4, 6...32). Subnetwork 1 randomly selects one group from these two groups, and 16×C×H×W is used as the input of the first subnetwork.

[0135] 2. The time interval is divided into 4 groups, which can be divided into four groups: (1, 5, 9...), (2, 6, 10...), (3, 7, 11...) and (4, 8, 12...). Subnetwork 2 randomly selects one group from these four groups, and 8×C×H×W is used as the input of the second subnetwork.

[0136] 3. The time interval is 8 groups, which can be divided into eight groups such as (1,9...), (2,10...), etc. Sub-network 3 randomly selects one group from these eight groups, and 4×C×H×W is used as the input of the third sub-network.

[0137] In step D, the outputs of different sub-networks (the input sizes of the sub-networks are inconsistent, so the output sizes are also different) are processed into the same size through pooling. Here, the outputs of the three sub-networks are processed into 2048-dimensional features.

[0138] In step E, the pooled features are connected through the concat function to form 3×2048-dimensional features, and the fused features are used as the features of the video clip for classification.

[0139] In step F, each of the continuous 32 frames of the video is regarded as a video segment and classified by the above method, and the segment with the most classification results is taken as the classification result of the entire video.

[0140] It can be seen that through the video classification method of the embodiment of the present application, it is achieved by acquiring features of different time granularities, fusing them, and classifying the video to be classified according to the fusion results, thereby realizing the extraction of features of multiple time granularities for video classification and improving the accuracy of video classification.

[0141] Figure 7 A schematic diagram of a video classification device according to an embodiment of the present application is shown in FIG. Figure 7 As shown, the video classification device includes:

[0142] The video frame acquisition module 171 is used to acquire N video frames of the video to be classified;

[0143] The video frame grouping module 172 is used to determine S target image groups from N video frames, wherein each target image group includes multiple video frames, and the time intervals between the video frames in different target image groups are different;

[0144] An image input module 173 is used to input the S target image groups into the S feature extraction networks of the pre-trained deep learning model, respectively, to obtain the feature vectors of each target image group, and obtain S feature vectors, wherein the feature vectors are used to characterize the spatial features and temporal features of the target image;

[0145] A feature fusion module 174 is used to perform feature fusion on the S feature vectors to obtain classification feature vectors of N video frames, wherein the classification feature vectors include spatial features and temporal features of the N video frames;

[0146] The video classification module 175 is used to classify the video to be classified according to the classification feature vectors of N video frames to obtain the classification result of the video to be classified.

[0147] Optionally, the video frame grouping module 172 includes:

[0148] The video frame classification submodule is used to group N video frames according to different time intervals to obtain a grouping result corresponding to each time interval, wherein the grouping result corresponding to each time interval includes multiple image groups;

[0149] The image grouping submodule is used to randomly select a group of image groups from the grouping results corresponding to each time interval to obtain S target image groups.

[0150] Optional, image grouping submodule, including:

[0151] A region capture unit is used to capture an image of preset specifications from each of N video frames according to a preset rule to obtain N captured video frames, wherein the preset rule is to take the N video frames as a video segment, capture the same video segment at the same position, and capture different video segments at different positions;

[0152] The grouping rule unit is used to group the N captured video frames according to different time intervals to obtain a grouping result corresponding to each time interval.

[0153] Optionally, the image grouping submodule further includes:

[0154] A mapping unit, used to perform mapping processing on each of the N intercepted video frames to obtain a shallow feature map corresponding to each of the N intercepted video frames;

[0155] Optionally, the video frame acquisition module 171 includes:

[0156] A starting frame submodule is used to select a video frame from the video to be classified as a starting video frame;

[0157] The continuous selection submodule is used to select N continuous video frames forward or backward from the starting video frame in the video to be classified.

[0158] Optionally, the S eigenvectors are eigenvectors of the same dimension.

[0159] Optionally, the above device is also used for:

[0160] Obtain multiple sample videos and a network model to be trained, wherein the sample videos include N video frames and the sample videos are marked with video classification results;

[0161] Select a sample video, and select S sample image groups from N video frames of the selected sample video, wherein each sample image group includes multiple video frames, and the time intervals between the video frames in different sample image groups are different;

[0162] The S sample image groups are input into the S feature extraction networks of the network model to be trained respectively, and the feature vectors of each sample image group are obtained to obtain S sample feature vectors;

[0163] Using the network model to be trained to perform feature fusion on S sample feature vectors, a sample classification feature vector is obtained;

[0164] Using the network model to be trained to classify the sample classification feature vector, and obtain the predicted classification result;

[0165] Calculate the loss of the network model to be trained according to the predicted classification results of the selected sample videos and the video classification results of the selected sample video labels;

[0166] Adjust the parameters of the network model to be trained according to the loss of the network model;

[0167] Select sample videos to continue training the network model to be trained until the loss of the network model to be trained is less than a preset threshold, thereby obtaining a trained network model.

[0168] It can be seen that through the video classification device of the embodiment of the present application, it is achieved by acquiring features of different time granularities, fusing them, and classifying the video to be classified according to the fusion results, thereby realizing the extraction of features of multiple time granularities for video classification and improving the accuracy of video classification.

[0169] The embodiment of the present application also provides an electronic device, including: a processor and a memory;

[0170] The above-mentioned memory is used to store computer programs.

[0171] When the processor is used to execute the computer program stored in the memory, the following steps are implemented:

[0172] Get N video frames of the video to be classified;

[0173] Determine S target image groups from N video frames, wherein each target image group includes multiple video frames, and the time intervals between the video frames in different target image groups are different;

[0174] Input the S target image groups into the S feature extraction networks of the pre-trained deep learning model respectively, obtain the feature vector of each target image group, and obtain S feature vectors;

[0175] Perform feature fusion on S feature vectors to obtain classification feature vectors of N video frames;

[0176] The video to be classified is classified according to the classification feature vectors of N video frames to obtain the classification result of the video to be classified.

[0177] Optional, see Figure 8 The electronic device of the embodiment of the present application further includes a communication interface 802 and a communication bus 804 , wherein the processor 801 , the communication interface 802 , and the memory 803 communicate with each other via the communication bus 804 .

[0178] Optionally, when the processor is used to execute the computer program stored in the memory, it can also implement any of the above-mentioned video classification methods.

[0179] It can be seen that through the electronic device of the embodiment of the present application, it is possible to obtain features of different time granularities, fuse them, and classify the video to be classified according to the fusion results, thereby realizing the extraction of features of multiple time granularities for video classification and improving the accuracy of video classification.

[0180] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0181] The communication interface is used for communication between the above electronic device and other devices.

[0182] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0183] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0184] The present application also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0185] Get N video frames of the video to be classified;

[0186] Determine S target image groups from N video frames, wherein each target image group includes multiple video frames, and the time intervals between the video frames in different target image groups are different;

[0187] Input the S target image groups into the S feature extraction networks of the pre-trained deep learning model respectively, obtain the feature vector of each target image group, and obtain S feature vectors;

[0188] Perform feature fusion on S feature vectors to obtain classification feature vectors of N video frames;

[0189] The video to be classified is classified according to the classification feature vectors of N video frames to obtain the classification result of the video to be classified.

[0190] Optionally, when the above computer program is executed by a processor, it can also implement any of the above video classification methods.

[0191] It can be seen that through the computer-readable storage medium of the embodiment of the present application, it is possible to obtain features of different time granularities, fuse them, and classify the video to be classified according to the fusion results, thereby realizing the extraction of features of multiple time granularities for video classification and improving the accuracy of video classification.

[0192] It should be noted that, in this article, the technical features in each optional solution can be combined to form a solution as long as there is no contradiction, and these solutions are all within the scope disclosed in this application. Relational terms such as first and second, etc. are only used to distinguish an entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the term "include", "comprise" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements not only include those elements, but also include other elements that are not clearly listed, or also include elements inherent to such process, method, article or equipment. In the absence of more restrictions, the elements limited by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or equipment including the elements.

[0193] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the embodiments of the device, electronic device, and storage medium, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0194] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims

1. A video classification method, characterized in that: include: Get N video frames of the video to be classified; Determine S target image groups from the N video frames, wherein each of the target image groups includes multiple video frames, and the timing intervals between the video frames in different target image groups are different; Inputting the S target image groups into S feature extraction networks of a pre-trained deep learning model respectively, obtaining a feature vector of each target image group, and obtaining S feature vectors, wherein the feature vector is used to characterize the spatial features and temporal features of the target image; Performing feature fusion on the S feature vectors to obtain classification feature vectors of the N video frames, wherein the classification feature vectors include spatial features and temporal features of the N video frames; Classifying the video to be classified according to the classification feature vectors of the N video frames to obtain a classification result of the video to be classified; The determining S target image groups from the N video frames includes: Grouping the N video frames according to different time intervals to obtain a grouping result corresponding to each time interval, wherein the grouping result corresponding to each time interval includes a plurality of image groups; A group of image groups is randomly selected from the grouping results corresponding to each time interval to obtain S target image groups.

2. The method according to claim 1, characterized in that The grouping of the N video frames according to different time intervals to obtain a grouping result corresponding to each time interval includes: According to a preset rule, an image of a preset specification is intercepted from each of the N video frames to obtain the intercepted N video frames, wherein the preset rule is to regard the N video frames as a video segment, intercept the same video segment at the same position, and intercept different video segments at different positions; The captured N video frames are grouped according to different time intervals to obtain a grouping result corresponding to each time interval.

3. The method according to claim 2, characterized in that Before grouping the captured N video frames according to different time intervals to obtain a grouping result corresponding to each time interval, the method further includes: Mapping processing is performed on each of the N intercepted video frames to obtain a shallow feature map corresponding to each of the N intercepted video frames.

4. The method according to claim 1, characterized in that: The step of obtaining N video frames of the video to be classified includes: Selecting a video frame from the video to be classified as a starting video frame; In the video to be classified, N consecutive video frames are selected forward or backward starting from the starting video frame.

5. The method according to claim 1, characterized in that The S feature vectors are feature vectors of the same dimension.

6. The method according to claim 1, characterized in that Before obtaining N video frames of the video to be classified, the method further includes: Acquire multiple sample videos and a network model to be trained, wherein the sample videos include N video frames, and the sample videos are marked with video classification results; Select a sample video, and select S sample image groups from N video frames of the selected sample video, wherein each of the sample image groups includes multiple video frames, and the time intervals between the video frames in different sample image groups are different; Inputting the S sample image groups into the S feature extraction networks of the network model to be trained respectively, obtaining a feature vector of each sample image group, and obtaining S sample feature vectors; Using the network model to be trained to perform feature fusion on the S sample feature vectors to obtain a sample classification feature vector; Using the network model to be trained to classify the sample classification feature vector to obtain a predicted classification result; Calculating the loss of the network model to be trained according to the predicted classification result of the selected sample video and the video classification result of the selected sample video mark; Adjusting the parameters of the network model to be trained according to the loss of the network model; Select sample videos to continue training the network model to be trained until the loss of the network model to be trained is less than a preset threshold, thereby obtaining a trained network model.

7. A video classification device, characterized in that: include: A video frame acquisition module is used to acquire N video frames of the video to be classified; A video frame grouping module, used to determine S target image groups from the N video frames, wherein each of the target image groups includes multiple video frames, and the timing intervals between the video frames in different target image groups are different; An image input module, used to input the S target image groups into S feature extraction networks of a pre-trained deep learning model, respectively, to obtain feature vectors of each target image group, and obtain S feature vectors, wherein the feature vectors are used to characterize the spatial features and temporal features of the target image; A feature fusion module, used to perform feature fusion on the S feature vectors to obtain classification feature vectors of the N video frames, wherein the classification feature vectors include spatial features and temporal features of the N video frames; A video classification module, used to classify the video to be classified according to the classification feature vectors of the N video frames to obtain a classification result of the video to be classified; The video frame grouping module comprises: A video frame classification submodule, used for grouping the N video frames according to different time intervals to obtain a grouping result corresponding to each time interval, wherein the grouping result corresponding to each time interval includes a plurality of image groups; The image grouping submodule is used to randomly select a group of image groups from the grouping results corresponding to each time interval to obtain S target image groups.

8. An electronic device, characterized in that: including a processor and a memory; The memory is used to store computer programs; The processor is used to implement the video classification method described in any one of claims 1-6 when executing the computer program stored in the memory.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the video classification method according to any one of claims 1 to 6 is implemented.