Time sequence action detection method and device
By extracting key frames and motion vector frames from compressed video data and generating temporal feature sequences for temporal action detection, it solves the storage and calculation problems caused by the increase in video length in the existing technology, and achieves efficient long video detection.
Patent Information
- Application Number
- CN202410710847.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-03
- Publication Date
- 2024-09-24
AI Technical Summary
Existing temporal action detection methods rely on the RGB image information of the video. As the length of the video increases, the storage resource consumption and calculation amount increase significantly, resulting in the difficulty of end-to-end training of the video backbone network, especially when transmitting and processing over the Internet. The detection efficiency of long videos is low.
Key frames and motion vector frames are extracted from the compressed video data, features are extracted through the pre-trained backbone network, and sorted according to the video frame playback order, a temporal feature sequence is generated, and the temporal action detection model is input for action detection, reducing the amount of information and amount of calculation.
It significantly reduces the memory requirements and calculation amount of video detection, improves video processing speed, and is suitable for time-series action detection of long videos, especially in live broadcast scenarios. It has huge potential.
Smart Images

Figure CN118692142A
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to the field of computer technology, and in particular to a method and device for detecting a sequential action. Background Art
[0002] Temporal Action Detection (TAD) is an important task in video understanding. Its main purpose is to detect the time range and corresponding type of all actions in a long video. Most existing TAD methods first extract temporal feature sequences offline from a pre-trained video backbone network, and then predict action clips from the temporal feature sequences through a temporal action detection model.
[0003] Current methods for detecting temporal motion often rely on the RGB image information of the video. As the length of the video increases, the amount of information at the input end will increase significantly, resulting in extremely high consumption of storage resources and algorithm calculations, making end-to-end training of the video backbone network difficult. For example, using an I3D backbone network to train a 2464-frame RGB video consumes 65.4GB of video memory. However, videos transmitted on the Internet are often compressed using compression algorithms (such as H.264). For example, a video with 8.72GB of floating-point memory only requires 12MB of storage space after compression. If it is possible to directly perform temporal motion detection on compressed videos, the memory requirements and computational complexity for long video detection will be greatly reduced. Summary of the invention
[0004] The embodiments of the present disclosure provide a method and device for detecting a time sequence action.
[0005] In a first aspect, an embodiment of the present disclosure provides a method for temporal action detection, comprising: extracting key frames and motion vector frames from compressed video data; inputting the key frames and motion vector frames into a pre-trained backbone network to extract key frame features and motion vector frame features; sorting the key frame features and the motion vector frame features in the order of video frame playback to obtain a temporal feature sequence; inputting the temporal feature sequence into a temporal action detection model to output action detection results.
[0006] In some embodiments, extracting key frames and motion vector frames from compressed video data includes: extracting key frames and reference frames from compressed video data; generating motion vector frames based on the displacement of motion pixel blocks in the reference frames compared to the previous frame or the next frame.
[0007] In some embodiments, extracting key frames and motion vector frames from compressed video data includes: extracting key frames and reference frames from compressed video data; generating motion vector frames based on the displacement of motion pixel blocks in the reference frame compared to the previous frame or the next frame and the corresponding pixel color difference.
[0008] In some embodiments, the backbone network includes a key frame feature extraction model and a motion vector feature extraction model; and the step of inputting the key frame and the motion vector frame into a pre-trained backbone network to extract key frame features and motion vector frame features includes: inputting the key frame into the key frame feature extraction model to extract key frame features; inputting the motion vector frame into the motion vector feature extraction model to extract motion vector features.
[0009] In some embodiments, the motion vector feature extraction model includes a sparse convolutional neural network.
[0010] In some embodiments, the key frame features and the motion vector frame features are sorted in the order of video frame playback to obtain a timing feature sequence, including: spatial feature pooling of the key frame features and the motion vector frame features to obtain a key frame feature sequence and a motion vector frame feature sequence, respectively; splicing the key frame feature sequence and the motion vector frame feature sequence and sorting them in the order of video frame playback to obtain a timing feature sequence.
[0011] In some embodiments, the key frame features and the motion vector frame features are sorted in the order of video frame playback to obtain a timing feature sequence, including: downsampling the motion vector frame features; splicing each downsampled motion vector frame feature with its preceding closest key frame feature and sorting them in the order of video frame playback to obtain a timing feature sequence.
[0012] In some embodiments, the reference frames include forward reference frames and bidirectional reference frames.
[0013] In a second aspect, an embodiment of the present disclosure provides a method for training a backbone network, comprising: extracting key frames and motion vector frames from compressed sample video data; inputting the key frames and the motion vector frames into the backbone network, extracting key frame features and motion vector frame features; sorting the key frame features and the motion vector frame features in the order of video frame playback to obtain a compressed temporal feature sequence; inputting the sample video data before compression into the backbone network, extracting the complete image features of each video frame, and sorting them in the order of video frame playback to obtain a complete temporal feature sequence; inputting the compressed temporal feature sequence and the complete temporal feature sequence into a temporal action detection model, respectively, to obtain a compressed classification score and a complete classification score; calculating a loss value based on the difference between the compressed classification score and the complete classification score, and adjusting the network parameters of the backbone network based on the loss value.
[0014] In some embodiments, the backbone network includes a key frame feature extraction model and a motion vector feature extraction model; and the step of inputting the key frame and the motion vector frame into the backbone network to extract key frame features and motion vector frame features includes: inputting the key frame into the key frame feature extraction model to extract key frame features; inputting the motion vector frame into the motion vector feature extraction model to extract motion vector features, wherein the motion vector feature extraction model includes a sparse convolutional neural network.
[0015] In some embodiments, the calculating of the loss value based on the difference between the compressed classification score and the complete classification score includes: calculating a teacher loss value based on the complete classification score; calculating a student loss value based on the compressed classification score; and calculating a cross entropy loss value based on the teacher loss value and the student loss value.
[0016] In a third aspect, an embodiment of the present disclosure provides a temporal motion detection device, comprising: a frame segmentation unit, configured to extract key frames and motion vector frames from compressed video data; an extraction unit, configured to input the key frames and the motion vector frames into a pre-trained backbone network, and extract key frame features and motion vector frame features; a splicing unit, configured to sort the key frame features and the motion vector frame features in the order of video frame playback to obtain a temporal feature sequence; a detection unit, configured to input the temporal feature sequence into a temporal motion detection model, and output a motion detection result.
[0017] In some embodiments, the frame segmentation unit is further configured to: extract key frames and reference frames from the compressed video data; and generate motion vector frames according to the displacement of motion pixel blocks in the reference frame compared with the previous frame or the next frame.
[0018] In some embodiments, the frame segmentation unit is further configured to: extract key frames and reference frames from the compressed video data; generate motion vector frames according to the displacement of the motion pixel block in the reference frame compared with the previous frame or the next frame and the corresponding pixel color difference.
[0019] In some embodiments, the backbone network includes a key frame feature extraction model and a motion vector feature extraction model; and the extraction unit is further configured to: input the key frame into the key frame feature extraction model to extract the key frame feature; input the motion vector frame into the motion vector feature extraction model to extract the motion vector feature.
[0020] In some embodiments, the motion vector feature extraction model includes a sparse convolutional neural network.
[0021] In some embodiments, the splicing unit is further configured to: perform spatial feature pooling on the key frame features and the motion vector frame features to obtain a key frame feature sequence and a motion vector frame feature sequence, respectively; splice the key frame feature sequence and the motion vector frame feature sequence and sort them in the order of video frame playback to obtain a temporal feature sequence.
[0022] In some embodiments, the splicing unit is further configured to: downsample the motion vector frame features; splice each downsampled motion vector frame feature with its preceding closest key frame feature and sort them in the order of video frame playback to obtain a temporal feature sequence.
[0023] In some embodiments, the reference frames include forward reference frames and bidirectional reference frames.
[0024] In a fourth aspect, an embodiment of the present disclosure provides a device for training a backbone network, comprising: a frame segmentation unit, configured to extract key frames and motion vector frames from compressed sample video data; an extraction unit, configured to input the key frames and the motion vector frames into the backbone network, and extract key frame features and motion vector frame features; a first splicing unit, configured to sort the key frame features and the motion vector frame features in the order of video frame playback to obtain a compressed temporal feature sequence; a second splicing unit, configured to input the sample video data before compression into the backbone network, extract the complete image features of each video frame, and sort them in the order of video frame playback to obtain a complete temporal feature sequence; a detection unit, configured to input the compressed temporal feature sequence and the complete temporal feature sequence into a temporal action detection model, respectively, to obtain a compressed classification score and a complete classification score; an adjustment unit, configured to calculate a loss value based on the difference between the compressed classification score and the complete classification score, and adjust the network parameters of the backbone network based on the loss value.
[0025] In some embodiments, the backbone network includes a key frame feature extraction model and a motion vector feature extraction model; and the extraction unit is further configured to: input the key frame into the key frame feature extraction model to extract the key frame feature; input the motion vector frame into the motion vector feature extraction model to extract the motion vector feature.
[0026] In some embodiments, the motion vector feature extraction model includes a sparse convolutional neural network.
[0027] In some embodiments, the adjustment unit is further configured to: calculate a teacher loss value based on the complete classification score; calculate a student loss value based on the compressed classification score; and calculate a cross entropy loss value based on the teacher loss value and the student loss value.
[0028] In some embodiments, the loss function uses a Softmax function with a temperature parameter.
[0029] In a fifth aspect, an embodiment of the present disclosure provides an electronic device, comprising: one or more processing models; a storage device on which one or more computer programs are stored, and when the one or more computer programs are executed by the one or more processing models, the one or more processing models implement a method as described in any one of the first aspect or the second aspect.
[0030] In a sixth aspect, an embodiment of the present disclosure provides a computer-readable medium having a computer program stored thereon, wherein the computer program, when executed by a processing model, implements a method as described in any one of the first aspect or the second aspect.
[0031] In a seventh aspect, an embodiment of the present disclosure provides a computer program product, comprising a computer program, wherein the computer program implements the method as described in any one of the first aspect or the second aspect when executed by a processing model.
[0032] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Other features, objects and advantages of the present disclosure will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:
[0034] Figure 1 is an exemplary system architecture diagram in which an embodiment of the present disclosure may be applied;
[0035] Figure 2is a flow chart of an embodiment of a method for detecting sequential actions according to the present disclosure;
[0036] Figure 3a-3b is a schematic diagram of an application scenario of the time sequence action detection method disclosed in the present invention;
[0037] Figure 4 is a flow chart of an embodiment of a method for training a backbone network according to the present disclosure;
[0038] Figure 5 is a structural schematic diagram of an embodiment of a sequential motion detection device according to the present disclosure;
[0039] Figure 6 is a structural schematic diagram of an embodiment of an apparatus for training a backbone network according to the present disclosure;
[0040] Figure 7 It is a structural diagram of a computer system of an electronic device suitable for implementing an embodiment of the present disclosure. DETAILED DESCRIPTION
[0041] The present disclosure is further described in detail below in conjunction with the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It is also necessary to explain that, for ease of description, only the parts related to the relevant invention are shown in the accompanying drawings.
[0042] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present disclosure may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0043] Figure 1 An exemplary system architecture 100 is shown to which the method for detecting a time-series motion, the device for detecting a time-series motion, the method for training a backbone network, or the device for training a backbone network according to the embodiments of the present disclosure can be applied.
[0044] like Figure 1 As shown, the system architecture 100 may include terminals 101, 102, a network 103, a database server 104, and a server 105. The network 103 is used to provide a medium for communication links between the terminals 101, 102, the database server 104, and the server 105. The network 103 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0045] The user 110 can use the terminals 101 and 102 to interact with the server 105 through the network 103 to receive or send messages, etc. Various client applications can be installed on the terminals 101 and 102, such as model training applications, motion detection applications, shopping applications, payment applications, web browsers, and instant messaging tools.
[0046] The terminals 101 and 102 here can be hardware or software. When the terminals 101 and 102 are hardware, they can be various electronic devices with display screens, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III, Dynamic Image Experts Compression Standard Audio Layer 3), laptops and desktop computers, etc. When the terminals 101 and 102 are software, they can be installed in the electronic devices listed above. It can be implemented as multiple software or software modules (for example, to provide distributed services), or it can be implemented as a single software or software module. No specific limitation is made here.
[0047] When the terminals 101 and 102 are hardware, an image acquisition device may be installed thereon. The image acquisition device may be any device capable of acquiring images, such as a camera, a sensor, etc. The user 110 may use the image acquisition device on the terminals 101 and 102 to capture action videos of himself or others.
[0048] The database server 104 may be a database server that provides various services. For example, a large number of sample videos may be stored in the database server. Thus, the user 110 may also select a sample video from the database server 104 through the terminals 101 and 102.
[0049] The server 105 may also be a server that provides various services, such as a background server that supports various applications displayed on the terminals 101 and 102. The background server may train the backbone network using the sample videos sent by the terminals 101 and 102, and may send the training results (such as the generated backbone network) to the terminals 101 and 102. In this way, the user may apply the generated backbone network for action detection.
[0050] The database server 104 and server 105 here can also be hardware or software. When they are hardware, they can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. When they are software, they can be implemented as multiple software or software modules (for example, used to provide distributed services), or as a single software or software module. No specific limitation is made here. The database server 104 and server 105 can also be servers of a distributed system, or servers combined with blockchain. The database server 104 and server 105 can also be cloud servers, or intelligent cloud computing servers or intelligent cloud hosts with artificial intelligence technology.
[0051] It should be noted that the method for detecting sequential motion or the method for training a backbone network provided in the embodiments of the present disclosure is generally executed by the server 105. Accordingly, the device for detecting sequential motion or the device for training a backbone network is generally also disposed in the server 105.
[0052] It should be pointed out that, in the case where the server 105 can implement the related functions of the database server 104 , the database server 104 may not be provided in the system architecture 100 .
[0053] It should be understood that Figure 1 The number of terminals, networks, database servers and servers in the embodiment is only for illustration. Any number of terminals, networks, database servers and servers may be provided according to the implementation requirements.
[0054] Continue to refer Figure 2 , shows a process 200 of an embodiment of a sequential action detection method according to the present disclosure. The sequential action detection method comprises the following steps:
[0055] Step 201: extract key frames and motion vector frames from compressed video data.
[0056] In this embodiment, the execution subject of the time sequence action detection method (for example Figure 1 The server shown in the figure can receive video data from the terminal device through a wired connection or a wireless connection. The video data is then compressed using a compression algorithm such as H.264. This type of compression algorithm divides the video frames into multiple groups (GOPs), each GOP contains an I frame (key frame) and several P frames (forward reference frames), and B frames (bidirectional reference frames). The I frame is the first frame of each GOP and is a complete video frame. The P frame and B frame contain multiple motion vectors (MV), which are the displacement of the moving pixel block in a certain frame compared to the previous frame or the next frame and the corresponding pixel color difference. Extract all I frames in the video, and extract all P / B frames in the video, and record them as MV frames.
[0057] Step 202: input the key frame and the motion vector frame into a pre-trained backbone network to extract key frame features and motion vector frame features.
[0058] In this embodiment, the backbone network is a convolutional neural network for extracting features from an image. Optionally, the backbone network includes two branches: a key frame feature extraction model and a motion vector feature extraction model. The key frame feature extraction model uses a pre-trained RGB image classification neural network (such as ConvNext, ResNet) to extract key frame features corresponding to the input key frame, and the motion vector feature extraction model is used to extract motion vector frame features from the motion vector frame. The key frame feature extraction model uses I frames as training samples for training, and the motion vector feature extraction model uses P frames and B frames as sample training.
[0059] Step 203, sorting the key frame features and the motion vector frame features according to the video frame playback order to obtain a temporal feature sequence.
[0060] In this embodiment, there are many key frames and motion vector frames in the video data, and the corresponding features are sorted according to the video playback order to obtain a temporal feature sequence.
[0061] Step 204, input the temporal feature sequence into the temporal action detection model, and output the action detection result.
[0062] In this embodiment, the temporal action detection model is a neural network for action classification based on temporal feature sequences. The temporal feature sequences will be sent to a TAD detector (such as TriDet) for detecting action segments, and the action detection results include the type, start time and end time of the action.
[0063] The method provided by the above-mentioned embodiments of the present disclosure directly uses compressed video data as the processing target, which can greatly reduce the amount of information that needs to be processed, reduce the demand for video processing resources, and improve the video processing speed. It has great potential in video tagging, action recognition and detection in live broadcast scenarios.
[0064] In some optional implementations of this embodiment, extracting key frames and motion vector frames from compressed video data includes: extracting key frames and reference frames from compressed video data; generating motion vector frames according to the displacement of motion pixel blocks in the reference frames compared to the previous frame or the next frame. Only retaining the displacement information of sparse motion vectors and ignoring color difference information can further reduce the amount of calculation, improve the detection speed of the action without affecting the accuracy of the detection result.
[0065] In some optional implementations of this embodiment, key frames and reference frames are extracted from compressed video data; motion vector frames are generated based on the displacement of motion pixel blocks in the reference frame compared to the previous frame or the next frame and the corresponding pixel color difference. Retaining the displacement information and color difference information can improve the accuracy of the detection result.
[0066] In some optional implementations of this embodiment, the backbone network includes a key frame feature extraction model and a motion vector feature extraction model; and the step of inputting the key frame and the motion vector frame into a pre-trained backbone network to extract key frame features and motion vector frame features includes: inputting the key frame into the key frame feature extraction model to extract key frame features; inputting the motion vector frame into the motion vector feature extraction model to extract motion vector features. By extracting different types of features respectively through the two branches of the backbone network, the comprehensiveness of feature extraction can be ensured, thereby improving the accuracy of the detection result.
[0067] In some optional implementations of this embodiment, the motion vector feature extraction model includes a sparse convolutional neural network. The key frame feature extraction model uses a conventional convolutional neural network to ensure the comprehensiveness of feature extraction. The motion vector feature extraction model uses a sparse convolutional neural network to reduce the amount of calculation. Since the data included in the motion vector frame itself is sparse, the use of a sparse convolutional neural network will not affect the comprehensiveness of feature extraction.
[0068] In some optional implementations of this embodiment, the key frame features and the motion vector frame features are sorted in the order of video frame playback to obtain a temporal feature sequence, including: performing spatial feature pooling on the key frame features and the motion vector frame features to obtain a key frame feature sequence and a motion vector frame feature sequence respectively; splicing the key frame feature sequence and the motion vector frame feature sequence and sorting them in the order of video frame playback to obtain a temporal feature sequence. Spatial feature pooling makes the key frame features and the motion vector frame features more uniform, and makes the spliced temporal feature sequence more uniform, thereby improving the detection speed.
[0069] In some optional implementations of the present embodiment, the key frame features and the motion vector frame features are sorted in the order of video frame playback to obtain a time series feature sequence, including: downsampling the motion vector frame features; splicing each downsampled motion vector frame feature with the key frame feature closest to it and sorting them in the order of video frame playback to obtain a time series feature sequence. Since the number of reference frames is large, the number of corresponding motion vector frames is also large, and the motion vector frame features can be downsampled to reduce the number of motion vector frame features, thereby reducing the amount of calculation and improving the detection speed. Since the number of motion vector frames is large, the changes between each frame are not large, and even if downsampling is performed, it will not have much impact on the detection result.
[0070] In some optional implementations of this embodiment, the reference frame includes a forward reference frame and a bidirectional reference frame. The video data is compressed by a compression algorithm such as H.264. This type of compression algorithm divides the video frames into multiple groups (GOPs), each GOP contains an I frame (key frame) and several P frames (forward reference frames), B frames (bidirectional reference frames). The I frame is the first frame of each GOP and is a complete video frame. The P frame and the B frame contain multiple motion vectors (MV), which are the displacement of the moving pixel block in a frame compared to the previous frame or the next frame and the corresponding pixel color difference.
[0071] Continue to see Figure 3a-3b , Figure 3a-3b is a schematic diagram of an application scenario of the time sequence action detection method according to this embodiment. Figure 3a In the application scenario, I frames (key frames) and MV frames (motion vector frames) are extracted from the compressed video data and input into the IM extractor (key frame feature extraction model) and MV extractor (motion vector feature extraction model) of the backbone network respectively. For example, for all I frames in the video, a pre-trained RGB image classification neural network (such as ConvNext, ResNet) is used to extract the IM features corresponding to the image input. For all MV frames, a sparse convolutional neural network is used to extract MV features. For the outputs of the two branches, spatial feature pooling (i.e., downsampling) is performed to obtain feature sequences of T1×D and T2×D, respectively. T1 and T2 are the number of I frames and MV frames, respectively, and D is the feature dimension.
[0072] like Figure 3bAs shown in the figure, one MV frame is sampled for every three MV frames. In order to construct a temporal feature sequence for use in the TAD task, the two branches need to be integrated into a unified branch. To this end, this method uses the left nearest neighbor method to match each MV feature with the nearest IM feature on its left according to the frame number of the two branches, and connects them by splicing to obtain a temporal feature sequence. This temporal feature sequence will be sent to the TAD detector (such as TriDet) for detecting action clips.
[0073] Further references Figure 4 , which shows a process 400 of an embodiment of a method for training a backbone network. The process 400 of the method for training a backbone network includes the following steps:
[0074] Step 401: extract key frames and motion vector frames from compressed sample video data.
[0075] In this embodiment, the execution body of the method for training the backbone network (for example Figure 1 The server shown in FIG. 200 can obtain sample video data from a data server, compress the sample video data, and extract key frames and motion vector frames from the compressed sample video data. The specific implementation process can refer to step 201.
[0076] Step 402: input the key frame and the motion vector frame into the backbone network to extract the key frame features and the motion vector frame features.
[0077] In this embodiment, the backbone network is a convolutional neural network that can extract key frame features and motion vector frame features. The specific implementation process can refer to step 202. The backbone network can be a single branch or a two-branch network.
[0078] When the backbone network is applied to the TAD task, it needs to be pre-trained on a large-scale action recognition dataset. Specifically, each time an I frame in the video and 32 MV frames in the GOP where it is located are sampled from the pre-training dataset (short video), the above two branches are used to extract IM features (1) and MV features (15, due to downsampling). The networks of the two branches are first pre-trained with the corresponding data, and then initialized with the corresponding pre-training weights and trained together. The loss function is the cross entropy loss.
[0079] Step 403, sorting the key frame features and the motion vector frame features according to the video frame playback order to obtain a compressed temporal feature sequence.
[0080] In this embodiment, the specific implementation process may refer to step 203.
[0081] Step 404, input the sample video data before compression into the backbone network, extract the complete image features of each video frame, and sort them according to the playback order of the video frames to obtain a complete temporal feature sequence.
[0082] In this embodiment, the backbone network of the present application adopts supervised training, using the action detection results of the sample video data before compression as labels. Optionally, the convolutional network (e.g., I3D) conventionally used in existing temporal action detection technology can be used to extract the complete image features of the sample video data before compression.
[0083] Step 405 , respectively input the compressed temporal feature sequence and the complete temporal feature sequence into the temporal action detection model to obtain a compressed classification score and a complete classification score.
[0084] In this embodiment, the temporal action detection model can classify the input temporal feature sequence to obtain a classification score, that is, the probability of belonging to a certain category. The categories include: action category, whether it is the start time of the action, and whether it is the end time of the action.
[0085] Step 406 , calculating a loss value based on the difference between the compressed classification score and the complete classification score, and adjusting the network parameters of the backbone network based on the loss value.
[0086] In this embodiment, the loss value can be calculated according to the difference between the compressed classification score and the complete classification score by the cross entropy loss function. The network parameters of the backbone network are adjusted in the direction of convergence of the loss value according to the gradient descent algorithm. When the loss value reaches a predetermined threshold, the backbone network training is completed.
[0087] In some optional implementations of the present embodiment, the backbone network includes a key frame feature extraction model and a motion vector feature extraction model; and the step of inputting the key frame and the motion vector frame into the backbone network to extract key frame features and motion vector frame features includes: inputting the key frame into the key frame feature extraction model to extract key frame features; inputting the motion vector frame into the motion vector feature extraction model to extract motion vector features.
[0088] In some optional implementations of this embodiment, the motion vector feature extraction model includes a sparse convolutional neural network, which can reduce the amount of calculation and thus improve the training speed.
[0089] The backbone network consists of two branches, each pre-trained with the corresponding data, and then trained together after initialization with the corresponding pre-trained weights, and the loss function is the cross entropy loss.
[0090] In some optional implementations of this embodiment, the loss value is calculated based on the difference between the compressed classification score and the complete classification score, including: calculating a teacher loss value based on the complete classification score; calculating a student loss value based on the compressed classification score; and calculating a cross entropy loss value based on the teacher loss value and the student loss value.
[0091] The Softmax function with a temperature parameter can be used as the loss function, and the backbone network can be trained by distillation. For example, each time an I frame in the video and 32 MV frames in the GOP in which it is located are sampled from the pre-training dataset (short video), the above two branches are used to extract IM features (1) and MV features (15) respectively. By averaging 15 MV features and then splicing them with the IM features, the features corresponding to this short clip (1×2D) can be obtained. The pre-trained convolutional network (such as I3D) inputs the pre-compressed video frame to extract the features of the complete RGB image corresponding to these 16 frames, and the distillation loss is used to bring the classification scores of the compressed features and the features before compression closer. The loss function is as follows:
[0092]
[0093]
[0094]
[0095] Where C is the number of categories (here there are 3, including: action category, whether it is the start time of the action, whether it is the end time of the action), is the classification score predicted based on the compressed video frame, is the classification score predicted based on the video frame before compression, t i is the teacher loss value, s i is the student loss value, L dist is the cross entropy loss value, T is the temperature parameter, which controls the difficulty of the distillation task by controlling the difference between the two distributions.
[0096] In some optional implementations of this embodiment, the loss function uses a Softmax function with a temperature parameter. The difficulty of the distillation task can be controlled by adjusting the temperature parameter.
[0097] The backbone network trained by the method provided by the above-mentioned embodiment of the present disclosure can be applied to the method described in process 200.
[0098] Further references Figure 5 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a sequential action detection device. Figure 2Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0099] like Figure 5 As shown, the temporal action detection device 500 of this embodiment includes: a frame division unit 501, an extraction unit 502, a splicing unit 503 and a detection unit 504. The frame division unit 501 is configured to extract key frames and motion vector frames from compressed video data; the extraction unit 502 is configured to input the key frames and motion vector frames into a pre-trained backbone network to extract key frame features and motion vector frame features; the splicing unit 503 is configured to sort the key frame features and the motion vector frame features according to the video frame playback order to obtain a temporal feature sequence; the detection unit 504 is configured to input the temporal feature sequence into a temporal action detection model to output an action detection result.
[0100] In this embodiment, the specific processing of the frame division unit 501, the extraction unit 502, the splicing unit 503 and the detection unit 504 of the time sequence motion detection device 500 can refer to Figure 2 Corresponding to step 201, step 202, step 203, and step 204 in the embodiment.
[0101] In some optional implementations of this embodiment, the frame segmentation unit 501 is further configured to: extract key frames and reference frames from the compressed video data; and generate motion vector frames according to the displacement of motion pixel blocks in the reference frame compared to the previous frame or the next frame.
[0102] In some optional implementations of this embodiment, the frame segmentation unit 501 is further configured to: extract key frames and reference frames from the compressed video data; and generate motion vector frames based on the displacement of the motion pixel blocks in the reference frame compared to the previous frame or the next frame and the corresponding pixel color difference.
[0103] In some optional implementations of this embodiment, the backbone network includes a key frame feature extraction model and a motion vector feature extraction model; and the extraction unit 502 is further configured to: input the key frame into the key frame feature extraction model to extract the key frame features; input the motion vector frame into the motion vector feature extraction model to extract the motion vector features.
[0104] In some optional implementations of this embodiment, the motion vector feature extraction model includes a sparse convolutional neural network.
[0105] In some optional implementations of the present embodiment, the splicing unit 503 is further configured to: perform spatial feature pooling on the key frame features and the motion vector frame features to obtain a key frame feature sequence and a motion vector frame feature sequence, respectively; splice the key frame feature sequence and the motion vector frame feature sequence and sort them in the order of video frame playback to obtain a temporal feature sequence.
[0106] In some optional implementations of this embodiment, the reference frame includes a forward reference frame and a bidirectional reference frame.
[0107] In some optional implementations of this embodiment, the splicing unit 503 is further configured to: downsample the motion vector frame features; splice each downsampled motion vector frame feature with its preceding closest key frame feature and sort them in the order of video frame playback to obtain a timing feature sequence.
[0108] Further references Figure 6 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a device for training a backbone network. Figure 4 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0109] like Figure 6 As shown, the apparatus 600 for training a backbone network in this embodiment includes: a framing unit 601 , an extracting unit 602 , a first splicing unit 603 , a second splicing unit 604 , a detecting unit 605 and an adjusting unit 606 . Among them, the frame segmentation unit 601 is configured to extract key frames and motion vector frames from the compressed sample video data; the extraction unit 602 is configured to input the key frames and the motion vector frames into the backbone network, and extract key frame features and motion vector frame features; the first splicing unit 603 is configured to sort the key frame features and the motion vector frame features in the order of video frame playback to obtain a compressed time series feature sequence; the second splicing unit 604 is configured to input the sample video data before compression into the backbone network, extract the complete image features of each video frame, and sort them in the order of video frame playback to obtain a complete time series feature sequence; the detection unit 605 is configured to input the compressed time series feature sequence and the complete time series feature sequence into the time series action detection model respectively, and obtain a compressed classification score and a complete classification score; the adjustment unit 606 is configured to calculate a loss value based on the difference between the compressed classification score and the complete classification score, and adjust the network parameters of the backbone network based on the loss value.
[0110] In this embodiment, the specific processing of the framing unit 601, the extraction unit 602, the first splicing unit 603, the second splicing unit 604, the detection unit 605 and the adjustment unit 606 of the apparatus 600 for training the backbone network can be referred to. Figure 4 This corresponds to steps 401-406 in the embodiment.
[0111] In some optional implementations of this embodiment, the backbone network includes a key frame feature extraction model and a motion vector feature extraction model; and the extraction unit 602 is further configured to: input the key frame into the key frame feature extraction model to extract the key frame features; input the motion vector frame into the motion vector feature extraction model to extract the motion vector features.
[0112] In some optional implementations of this embodiment, the motion vector feature extraction model includes a sparse convolutional neural network.
[0113] In some optional implementations of this embodiment, the adjustment unit 606 is further configured to: calculate a teacher loss value based on the complete classification score; calculate a student loss value based on the compressed classification score; and calculate a cross entropy loss value based on the teacher loss value and the student loss value.
[0114] In some optional implementations of this embodiment, the loss function adopts a Softmax function with a temperature parameter.
[0115] It should be noted that the collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of user personal information involved in the technical solution of this disclosure are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information, network security and national security.
[0116] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device and a readable storage medium.
[0117] An electronic device comprises: one or more processing models; a storage device on which one or more computer programs are stored, and when the one or more computer programs are executed by the one or more processing models, the one or more processing models implement the method described in process 200 or 400.
[0118] A computer-readable medium stores a computer program, wherein the computer program implements the method described in process 200 or 400 when executed by a processing model.
[0119] Figure 7A schematic block diagram of an example electronic device 700 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, service models, blade service models, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0120] like Figure 7 As shown, the device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only storage model (ROM) 702 or a computer program loaded from a storage unit 708 into a random access storage model (RAM) 703. In the RAM 703, various programs and data required for the operation of the device 700 can also be stored. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0121] A number of components in the device 700 are connected to the I / O interface 705, including: an input unit 706, such as a keyboard, a mouse, etc.; an output unit 707, such as various types of display models, speaker models, etc.; a storage unit 708, such as a disk, an optical disk, etc.; and a communication unit 709, such as a network card, a modem model, a wireless communication transceiver, etc. The communication unit 709 allows the device 700 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0122] The computing unit 701 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine model learning model algorithms, digital signal processing models (DSPs), and any appropriate processing models, control models, microcontroller models, etc. The computing unit 701 performs the various methods and processes described above, such as a road area planning method. For example, in some embodiments, the road area planning method may be implemented as a computer software program that is tangibly included in a machine model readable medium, such as a storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 700 via the ROM 702 and / or the communication unit 709. When the computer program is loaded into the RAM 703 and executed by the computing unit 701, one or more steps of the road area planning method described above may be performed. Alternatively, in other embodiments, the computing unit 701 may be configured to perform the road area planning method in any other appropriate manner (e.g., by means of firmware).
[0123] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system that includes at least one programmable processing model, which can be a special purpose or general purpose programmable processing model, and can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0124] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processing model or control model of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processing model or control model, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine model, partially on the machine model, partially on the machine model and partially on the remote machine model as a stand-alone software package, or entirely on the remote machine model or service model.
[0125] In the context of the present disclosure, a machine model readable medium may be a tangible medium that may contain or store a program for use by an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. A machine model readable medium may be a machine model readable signal medium or a machine model readable storage medium. A machine model readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. A more specific example of a machine model readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory model (RAM), a read-only memory model (ROM), an erasable programmable read-only memory model (EPROM or flash memory model), an optical fiber, a portable compact disk read-only memory model (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0126] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor model) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0127] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data service model), or a computing system that includes middleware components (e.g., an application service model), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browsing model through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0128] The computer system may include a client and a service model. The client and service models are generally remote from each other and usually interact through a communication network. The relationship between the client and service model is generated by computer programs running on corresponding computers and having a client-service model relationship with each other. The service model may be a service model for a distributed system, or a service model combined with a blockchain. The service model may also be a cloud service model, or an intelligent cloud computing service model or an intelligent cloud host with artificial intelligence technology. The service model may be a service model for a distributed system, or a service model combined with a blockchain. The service model may also be a cloud service model, or an intelligent cloud computing service model or an intelligent cloud host with artificial intelligence technology.
[0129] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0130] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for detecting a time sequence action, comprising: Extract key frames and motion vector frames from compressed video data; Inputting the key frame and the motion vector frame into a pre-trained backbone network to extract key frame features and motion vector frame features; Sorting the key frame features and the motion vector frame features in the order of video frame playback to obtain a temporal feature sequence; The temporal feature sequence is input into a temporal action detection model, and an action detection result is output.
2. The method according to claim 1, wherein: The step of extracting key frames and motion vector frames from the compressed video data includes: Extract key frames and reference frames from compressed video data; A motion vector frame is generated according to the displacement of the motion pixel block in the reference frame compared with the previous frame or the next frame.
3. The method according to claim 1, wherein: The step of extracting key frames and motion vector frames from the compressed video data includes: Extract key frames and reference frames from compressed video data; A motion vector frame is generated according to the displacement of the motion pixel block in the reference frame compared with the previous frame or the next frame and the corresponding pixel color difference.
4. The method according to claim 1, wherein: The backbone network includes a key frame feature extraction model and a motion vector feature extraction model; as well as The step of inputting the key frame and the motion vector frame into a pre-trained backbone network to extract key frame features and motion vector frame features includes: Inputting the key frame into the key frame feature extraction model to extract key frame features; The motion vector frame is input into the motion vector feature extraction model to extract the motion vector feature.
5. The method according to claim 4, wherein: The motion vector feature extraction model includes a sparse convolutional neural network.
6. The method according to claim 1, wherein: The step of sorting the key frame features and the motion vector frame features according to the video frame playback order to obtain a temporal feature sequence includes: Performing spatial feature pooling on the key frame features and the motion vector frame features to obtain a key frame feature sequence and a motion vector frame feature sequence respectively; The key frame feature sequence and the motion vector frame feature sequence are spliced and then sorted in the video frame playback order to obtain a time sequence feature sequence.
7. The method according to claim 1, wherein: The step of sorting the key frame features and the motion vector frame features according to the video frame playback order to obtain a temporal feature sequence includes: Downsampling the motion vector frame feature; Each downsampled motion vector frame feature is concatenated with its nearest key frame feature and then sorted in the order of video frame playback to obtain a temporal feature sequence.
8. The method according to claim 2, wherein: The reference frames include forward reference frames and bidirectional reference frames.
9. A method for training a backbone network, comprising: Extracting key frames and motion vector frames from compressed sample video data; Inputting the key frame and the motion vector frame into a backbone network to extract key frame features and motion vector frame features; Sorting the key frame features and the motion vector frame features in the order of video frame playback to obtain a compressed time series feature sequence; Inputting the sample video data before compression into the backbone network, extracting the complete image features of each video frame, and sorting them in the order of video frame playback to obtain a complete temporal feature sequence; Inputting the compressed temporal feature sequence and the complete temporal feature sequence into a temporal action detection model respectively to obtain a compressed classification score and a complete classification score; A loss value is calculated based on the difference between the compressed classification score and the complete classification score, and a network parameter of the backbone network is adjusted based on the loss value.
10. The method according to claim 9, wherein: The backbone network includes a key frame feature extraction model and a motion vector feature extraction model; as well as The step of inputting the key frame and the motion vector frame into a backbone network and extracting key frame features and motion vector frame features comprises: Inputting the key frame into the key frame feature extraction model to extract key frame features; The motion vector frame is input into the motion vector feature extraction model to extract the motion vector feature.
11. The method according to claim 10, wherein: The motion vector feature extraction model includes a sparse convolutional neural network.
12. The method according to claim 9, wherein: The calculating the loss value based on the difference between the compressed classification score and the complete classification score comprises: calculating a teacher loss value based on the complete classification score; calculating a student loss value based on the compressed classification score; A cross entropy loss value is calculated based on the teacher loss value and the student loss value.
13. The method according to claim 12, wherein: The loss function uses the Softmax function with a temperature parameter.
14. A time sequence motion detection device, comprising: A frame segmentation unit is configured to extract key frames and motion vector frames from the compressed video data; An extraction unit is configured to input the key frame and the motion vector frame into a pre-trained backbone network to extract key frame features and motion vector frame features; A splicing unit is configured to sort the key frame features and the motion vector frame features according to the video frame playback order to obtain a temporal feature sequence; The detection unit is configured to input the temporal feature sequence into a temporal action detection model and output an action detection result.
15. A device for training a backbone network, comprising: A frame segmentation unit is configured to extract key frames and motion vector frames from the compressed sample video data; An extraction unit, configured to input the key frame and the motion vector frame into a backbone network, and extract key frame features and motion vector frame features; A first splicing unit is configured to sort the key frame features and the motion vector frame features according to the video frame playback order to obtain a compressed time series feature sequence; The second splicing unit is configured to input the sample video data before compression into the backbone network, extract the complete image features of each video frame, and sort them according to the playback order of the video frames to obtain a complete temporal feature sequence; A detection unit, configured to input the compressed temporal feature sequence and the complete temporal feature sequence into a temporal action detection model respectively to obtain a compressed classification score and a complete classification score; An adjustment unit is configured to calculate a loss value based on a difference between the compressed classification score and the complete classification score, and adjust a network parameter of the backbone network based on the loss value.
16. An electronic device, comprising: one or more processing models; a storage device having one or more computer programs stored thereon, When the one or more computer programs are executed by the one or more processing models, the one or more processing models implement the method according to any one of claims 1 to 13.
17. A computer readable medium having a computer program stored thereon, wherein: When the computer program is executed by the processing model, the method according to any one of claims 1 to 13 is implemented.
18. A computer program product comprising a computer program, which, when executed by a processing model, implements the method according to any one of claims 1 to 13.
Citation Information
Patent Citations
Key frame extracting method for compression domain video stream
CN101453649A
Compressed domain video action recognition method and system based on new space-time feature flow
CN111626178A
Video processing using delta distillation
WO2023086911A1
Cited By
Video data identification method, electronic equipment and storage medium
CN119785275A
