Video segment extraction method, video segment extraction device and storage medium
By using the frame feature extraction model and the scoring model to evaluate the splendor of video frames in video clip extraction, the problem of long video clip extraction in the existing technology is solved, fast and efficient video clip extraction is achieved, and the user experience is improved.
Patent Information
- Application Number
- CN202010866476.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-25
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2040-08-25
AI Technical Summary
Existing video clip extraction methods require the video to be completely acquired, divided into multiple clips, and scored, which results in large amounts of calculation, long time consumption, and affects the user experience.
By acquiring video frames and using pre-trained frame feature extraction models and scoring models, we can quickly evaluate the excitement of video frames based on frame feature vectors, and use multi-frame fusion layers and twin neural networks for scoring, reducing the amount of calculation and extracting target video clips. .
It realizes the rapid extraction of target video clips during the online video acquisition process, saves computing resources and improves user experience.
Smart Images

Figure CN112069952B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of video processing technology, and in particular to a video segment extraction method, a video segment extraction device and a storage medium. Background Art
[0002] The extraction of video segments may be performed on any one or more relatively short video segments in the video. For example, to extract wonderful video segments in a video, one or more video segments whose contents are more wonderful than those of other video segments in the video may be extracted.
[0003] In the related art, video segment extraction requires that the video be completely acquired before it is divided into multiple video segments according to the content of the video, and each video segment needs to be scored, and the video segment extraction is performed based on the score of each video segment. However, extracting video segments using this method requires a lot of calculations to determine the score of each video segment, which results in a long extraction time and affects the user experience. Summary of the invention
[0004] In order to overcome the problems existing in the related art, the present disclosure provides a video segment extraction method, a video segment extraction device and a storage medium.
[0005] According to a first aspect of an embodiment of the present disclosure, a method for extracting video segments is provided, comprising: acquiring a video, and sampling N video frames in the video, where N is a positive integer. The N video frames are input into a pre-trained frame feature extraction model to obtain a feature vector of each of the N video frames. The scores of the N video frames are determined based on a pre-trained scoring model, wherein, for the i-th frame in the N video frames, the feature vectors of K video frames centered on the i-th frame are input into a pre-trained scoring model to obtain the score of the i-th frame, where i is a positive integer less than or equal to N, and K is a positive integer. A target video segment is extracted from the video based on the scores of the N video frames.
[0006] In one embodiment, the scoring model is trained based on a multi-frame fusion layer and data pairs consisting of positive segments and negative segments; the data pairs consisting of positive segments and negative segments are obtained based on sample video segments labeled with target attributes, and the target attributes include attributes that characterize the video segment as a target video segment or a non-target video segment. The multi-frame fusion layer is used to fuse the feature vectors of K video frames into a fixed-length vector.
[0007] In another embodiment, the scoring model is obtained by training based on the multi-frame fusion layer and the data pairs composed of positive segments and negative segments, including: sampling K video frames in the positive segment, extracting feature vectors of the K video frames sampled in the positive segment based on the frame feature extraction model, sampling K video frames in the negative segment, extracting feature vectors of the K video frames sampled in the negative segment based on the frame feature extraction model, and fusing the feature vectors of the K video frames sampled in the positive segment into a positive segment feature vector with a fixed length vector based on the multi-frame fusion layer, and fusing the K video frames sampled in the negative segment into a negative segment feature vector with a fixed length vector based on the multi-frame fusion layer. The positive segment feature vector and the negative segment feature vector are input into a twin neural network to obtain the score of the positive segment and the score of the negative segment, and back propagation is performed using the sorting loss to train the trained twin neural network; wherein the twin neural network includes two multi-layer perceptron models with shared parameters; and the scoring model is a multi-layer perceptron model of the trained twin neural network.
[0008] In another embodiment, the data pair consisting of the positive segment and the negative segment is obtained based on the sample video segment annotated with the target attribute in the following manner: a sample video including one or more sample video segments is obtained. Based on the target attributes annotated by the one or more sample video segments and the non-sample video segments included in the sample video, a data pair consisting of the positive segment and the negative segment is obtained, wherein the possibility that the positive segment becomes the target video segment is greater than the possibility that the negative segment becomes the target video segment.
[0009] In another embodiment, based on the target attributes marked by the one or more sample video segments and the non-sample video segments included in the sample video, a data pair consisting of a positive segment and a negative segment is obtained, including: if the target attributes marked by the one or more sample video segments include an attribute that characterizes the video segment as a target video segment, the one or more sample video segments are used as positive segments, and some video segments are extracted from the non-sample video segments included in the sample video as negative segments, and one or more data pairs are obtained from the positive segments and the negative segments. Or if the target attributes marked by the one or more sample video segments include an attribute that characterizes the video segment as a non-target video segment, the one or more sample video segments are used as negative segments, and some video segments are extracted from the non-sample video segments included in the sample video as positive segments, and one or more data pairs are obtained from the positive segments and the negative segments. Alternatively, if the target attributes annotated by the one or more sample video clips include attributes characterizing the video clip as a target video clip and attributes characterizing the video clip as a non-target video clip, the sample video clip annotated with the attributes characterizing the target video clip is used as a positive clip, the sample video clip annotated with the attributes characterizing the non-target video clip is used as a negative clip, and partial video clips are extracted from the non-sample video clips included in the sample video, data pairs are obtained from the positive clip and the negative clip, data pairs are obtained from the positive clip and the partial video clip, and data pairs are obtained from the negative clip and the partial video clip.
[0010] In another embodiment, extracting a target video segment from the video based on the scores of the N video frames includes: obtaining multiple video segments by sliding a sliding window of a fixed length along a time sequence on the video, wherein each sliding window corresponds to a video segment. For each sliding window, determining an average score of the video frames included in the sliding window, and using the average score of the video frames as the score of the video segment corresponding to the sliding window. Extracting one or more target video segments from the multiple video segments based on the scores of the multiple video segments.
[0011] According to a second aspect of an embodiment of the present disclosure, a video segment extraction device is provided, comprising: an acquisition unit, for acquiring a video, and sampling N video frames in the video, where N is a positive integer. A feature extraction unit, for inputting the N video frames into a pre-trained frame feature extraction model, and obtaining a feature vector of each of the N video frames. A determination unit, for determining the scores of the N video frames based on a pre-trained scoring model, wherein, for the i-th frame of the N video frames, the feature vectors of K video frames centered on the i-th frame are input into the pre-trained scoring model to obtain the score of the i-th frame, where i is a positive integer less than or equal to N, and K is a positive integer. An extraction unit, for extracting a target video segment from the video based on the scores of the N video frames.
[0012] In one embodiment, the video segment extraction device also includes a training unit; the training unit is used to obtain the scoring model based on a multi-frame fusion layer and a data pair consisting of positive segments and negative segments, the data pairs consisting of positive segments and negative segments are obtained based on sample video segments marked with target attributes, the target attributes include attributes that characterize the video segment as a target video segment or a non-target video segment, and the multi-frame fusion layer is used to fuse the feature vectors of K video frames into a fixed-length vector.
[0013] In another embodiment, the training unit obtains the scoring model by training based on the multi-frame fusion layer and the data pairs composed of the positive segment and the negative segment in the following manner: sampling K video frames in the positive segment, extracting feature vectors of the K video frames sampled in the positive segment based on the frame feature extraction model, sampling K video frames in the negative segment, extracting feature vectors of the K video frames sampled in the negative segment based on the frame feature extraction model, and fusing the feature vectors of the K video frames sampled in the positive segment into a positive segment feature vector with a fixed length vector based on the multi-frame fusion layer, and fusing the K video frames sampled in the negative segment into a negative segment feature vector with a fixed length vector based on the multi-frame fusion layer. The positive segment feature vector and the negative segment feature vector are input into the twin neural network to obtain the score of the positive segment and the score of the negative segment, and back propagation is performed using the sorting loss to train the trained twin neural network; wherein the twin neural network includes two multi-layer perceptron models with shared parameters; and the scoring model is a multi-layer perceptron model of the trained twin neural network.
[0014] In another embodiment, the data pair consisting of the positive segment and the negative segment is obtained based on the sample video segment annotated with the target attribute in the following manner: a sample video including one or more sample video segments is obtained. Based on the target attributes annotated by the one or more sample video segments and the non-sample video segments included in the sample video, a data pair consisting of the positive segment and the negative segment is obtained, wherein the possibility that the positive segment becomes the target video segment is greater than the possibility that the negative segment becomes the target video segment.
[0015] In another embodiment, the data pairs consisting of the positive and negative segments are obtained based on the target attributes marked by the one or more sample video segments and the non-sample video segments included in the sample video in the following manner: if the target attributes marked by the one or more sample video segments include attributes that characterize the video segments as target video segments, the one or more sample video segments are used as positive segments, and some video segments are extracted from the non-sample video segments included in the sample video as negative segments, and one or more data pairs are obtained from the positive segments and the negative segments; or if the target attributes marked by the one or more sample video segments include attributes that characterize the video segments as non-target video segments, the one or more sample video segments are used as negative segments, and some video segments are extracted from the non-sample video segments included in the sample video as positive segments, and one or more data pairs are obtained from the positive segments and the negative segments. Alternatively, if the target attributes annotated by the one or more sample video clips include attributes characterizing the video clip as a target video clip and attributes characterizing the video clip as a non-target video clip, the sample video clip annotated with the attributes characterizing the target video clip is used as a positive clip, the sample video clip annotated with the attributes characterizing the non-target video clip is used as a negative clip, and partial video clips are extracted from the non-sample video clips included in the sample video, data pairs are obtained from the positive clip and the negative clip, data pairs are obtained from the positive clip and the partial video clip, and data pairs are obtained from the negative clip and the partial video clip.
[0016] In another embodiment, the extraction module extracts the target video segment from the video based on the scores of the N video frames in the following manner: based on a sliding window of a fixed length sliding on the video along a time sequence to obtain multiple video segments, wherein each sliding window corresponds to a video segment. For each sliding window, an average score of the video frames included in the sliding window is determined respectively, and the average score of the video frames is used as the score of the video segment corresponding to the sliding window. One or more target video segments are extracted from the multiple video segments based on the scores of the multiple video segments.
[0017] According to a third aspect of an embodiment of the present disclosure, a video segment extraction device is provided, comprising: a memory for storing instructions; and a processor for calling the instructions stored in the memory to execute any one of the above-mentioned video segment extraction methods.
[0018] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, in which instructions are stored. When the instructions are executed by a processor, any one of the above-mentioned video segment extraction methods is executed.
[0019] The technical solution provided by the embodiments of the present disclosure may include the following beneficial effects: through the video segment extraction method provided by the present disclosure, sampling and extraction can be performed based on the acquired video frames during the process of online video acquisition, thereby helping to save the computational workload of the scoring model and facilitating the speed of video segment extraction. Moreover, based on the wonderfulness score of the video frame, the wonderfulness of each part of the video can be compared while acquiring the video frame, so that when the video is completely acquired, the target video segment required by the user can be quickly extracted, facilitating improving the user experience.
[0020] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0022] Figure 1 The figure is a flowchart of a method for extracting video segments according to an exemplary embodiment.
[0023] Figure 2 The figure is a flowchart of a scoring model training method according to an exemplary embodiment.
[0024] Figure 3 It is a schematic diagram of another scoring model training method according to an exemplary embodiment.
[0025] Figure 4 The figure is a flow chart of a method for determining a data pair according to an exemplary embodiment.
[0026] Figure 5 The figure is a schematic diagram of labeling a sample video according to an exemplary embodiment.
[0027] Figure 6 The diagram is another schematic diagram of sample video annotation according to an exemplary embodiment.
[0028] Figure 7The diagram is another schematic diagram of sample video annotation according to an exemplary embodiment.
[0029] Figure 8 The figure is a block diagram of a video segment extraction device according to an exemplary embodiment.
[0030] Fig. 9 The figure is a block diagram of another apparatus for extracting video segments according to an exemplary embodiment. DETAILED DESCRIPTION
[0031] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0032] The video clip extraction method provided by the embodiment of the present disclosure is applied to the scene of extracting target video clips, such as the scene of extracting wonderful video clips. For example: generating wonderful video clips of user videos in the mobile phone album and displaying them to the user as preview images; or obtaining wonderful video clips of short videos in a short video application to generate gif images and display them to the user as video covers; or calculating the degree of excitement of each moment in the background while playing the video watched by the user online, and immediately popping up the wonderful video clips in the video after the user finishes watching the video, so that the user can review the excitement.
[0033] In the related art, video segment extraction of a video requires that the video be completely acquired offline, and then divided into multiple video segments according to the content of the video, and then video features are extracted for each video segment, and the wonderfulness score of each video segment is calculated. In this way, the video segment to be extracted is determined. When extracting video segments using this method, the extraction operation needs to be performed after the video is completely acquired. In addition, when extracting video segment features for each video segment, a large amount of calculation is required to determine, which is time-consuming and cannot quickly obtain the required extracted video segment, thereby affecting the user experience.
[0034] In view of this, an embodiment of the present disclosure provides a video segment extraction method, in which the video segment extraction model used in the video segment extraction method can be trained based on frame feature vectors, thereby helping to reduce the amount of calculation of the scoring model and improve the scoring rate. And because the model has a small amount of calculation, it is helpful to deploy it in terminals such as mobile phones, tablets, and computers, so that users can use it at any time.
[0035] The video segment extraction method provided in the present disclosure can obtain the score of each video frame by inputting the feature vector of the sampled video frame into the scoring model, and extract the target video segment based on the score of each video frame. Among them, the scoring model adopted is obtained based on the training of the frame feature vector. The scoring model has a simple structure and low calculation amount, which helps to quickly output the score of each video frame. Then, when extracting the target video segment according to the score of each video frame, it can be quickly extracted in a short time, shortening the extraction process, thereby helping to improve the user experience.
[0036] Figure 1 is a flowchart of a video segment extraction method according to an exemplary embodiment. Figure 1 As shown, the video segment extraction method includes the following steps S11 to S14.
[0037] In step S11, a video is acquired, and N video frames are sampled from the video.
[0038] For videos of different durations, the number of sampled video frames may be different. In the embodiments of the present disclosure, the sampling of video frames may be in various forms.
[0039] In one embodiment, the sampling method of the video frame can be to perform equal-time sampling through a preset time ladder, and then there is no need to consider the total time length of the video, and it is only necessary to sample according to the time interval, which helps to reduce the sampling algorithm and speed up the sampling rate of the video frame. For example: according to the preset time ladder, according to the acquired video, a video frame needs to be sampled every 2 seconds, then for the 2nd second, 4th second, 6th second, 8th second in the video, and so on, a video frame is sampled every two seconds until the video ends. If the video is 10 seconds, 5 video frames are obtained. In one example, when the video is not fully loaded, the currently loaded video frame can be sampled, and then in the process of video loading, the score of each moment of the video can be calculated only by delaying a few frames of the video, without waiting until the video is fully acquired, which helps to achieve online quasi-real-time calculation, thereby shortening the process of extracting the target video segment, which is conducive to improving the user experience.
[0040] In another embodiment, the sampling method of the video frame can be to pre-set a specified number of sampled video frames, and then perform video frame sampling. This helps to save feature vector extraction time when calculating the feature vector of the video frame, facilitates the calculation of the feature vector extraction model, and speeds up the extraction process of the target video segment. In one example, the video can be evenly sampled according to the specified number of video frames, which helps to distinguish the corresponding video content between each moment, and facilitates the rapid extraction of the target video segment based on the score of the video frame. For example: if 5 video frames need to be obtained, for a 10-second video, sampling can be performed every two seconds. For a 15-second video, sampling can be performed every three seconds.
[0041] In step S12, N video frames are input into a pre-trained frame feature extraction model to obtain a feature vector of each of the N video frames.
[0042] In the embodiment of the present disclosure, the obtained N video frames are respectively input into the trained frame feature extraction model to obtain the feature vector corresponding to each video frame, which helps the scoring model to score according to the obtained feature vector of each video frame, and is convenient for evaluating the score of each video frame corresponding to each moment in the video, thereby helping to extract the target video segment required by the user. The frame feature model can be a standard convolutional neural network (CNN) or an online video understanding model, such as the Temporal Shift Module for Efficient Video Understanding (TSM). When using the trained CNN for frame feature extraction, the output vector of the previous layer of the network classification layer can be used as the frame feature vector of the input video frame. When using the trained online TSM for frame feature extraction, the output of the last layer of its base network (backbone) can be taken as the feature vector, which is not limited in the present disclosure.
[0043] In step S13, the scores of the N video frames are determined based on the pre-trained scoring model.
[0044] In the disclosed embodiment, the frame feature vectors of the N video frames obtained by the trained scoring model are input into the scoring model to obtain the scores of each video frame. The scoring model can be scored according to the wonderfulness of the image content of each video frame. For different video frames of the same video, the higher the score output by the scoring model, the more wonderful the content is. The relative size between each score can be characterized as the relative difference in wonderfulness between the contents of each video frame. By obtaining the scores of each video frame, the relative wonderfulness between the contents of each video frame can be intuitively distinguished, which helps to quickly extract the target video clips required by the user.
[0045] In the present disclosure, the score obtained by each video frame through the trained scoring model is obtained based on the fusion feature vector of multiple video frames obtained with the current moment of the video frame as the center. When calculating the score of the i-th frame among N video frames, based on the time position corresponding to the i-th frame in the video, multiple video frames are respectively obtained before and after the i-th frame to obtain K video frames, and then the score output based on the fusion feature vector of the K video frames is used as the score of the current i-th frame. Among them, i is a positive integer less than or equal to N, and K is a positive integer. When calculating the score of the current video frame, combining the frame feature vectors of the surrounding video frames helps to obtain a more accurate score, and then when extracting the target video segment according to the obtained score, the content of the target video segment is consistent with the content corresponding to the score, thereby helping to avoid the possibility of mis-extraction or omission of the target video segment. For example: the content of the current video frame belongs to an ordinary video segment in the corresponding moment of the video, and there are wonderful video segments before and after this moment, and this moment is only a momentary transition. Then, the score of the current frame is calculated based on the video frames extracted before and after the current video frame, which helps to avoid the possibility of missing the target video segment. In one example, in order to obtain a more accurate score, the same number of video frames can be obtained before and after the i-th frame. For example, [i-(K / 2)] video frames are obtained before the moment of the i-th frame, and [i+(K / 2)-1] video frames are obtained after the moment of the i-th frame, and uniform sampling is performed, so that the score obtained is more in line with the score of the video segment where the current video frame is located, and is more accurate, which facilitates the elimination of abnormal data. In another example, when the i-th frame belongs to the first frame of the video, the feature vectors of the [i-(K / 2)] video frames before the first frame can be assumed to be 0 or the same as the feature vectors of the [i+(K / 2)-1] video frames obtained after the first frame, which helps to smoothly score the video frames and facilitates frame-by-frame evaluation.
[0046] In step S14, a target video segment is extracted from the video based on the scores of the N video frames.
[0047] In the embodiment of the present disclosure, according to the needs of the user, based on the obtained scores of each video frame, the target video segment required by the user is extracted.
[0048] In an embodiment of the present disclosure, in a video, there are both target video segments to be extracted and non-target video segments. The target video segments have the attributes of the target video segments, and the non-target video segments also have the attributes of the non-target video segments. For example, when the target video segments are exciting video segments, the video has both the relatively most exciting video segments and the relatively least exciting video segments. Different users have different needs and require different target video segments. In order to facilitate the rapid extraction of the target video segments required by the user based on the acquired video, the acquired video can be sampled to obtain N video frames, where N is a positive integer. The scoring model can be used to quickly obtain the scores of each video frame, and an evaluation is performed based on the scores of each video frame to determine the target video segments to be extracted.
[0049] Usually, the target video clip can be one or more video clips in the video and has the target video clip attributes. For example, a wonderful video clip is one or more relatively short video clips in the video, and the content is more exciting and attractive than the content of other video clips. For example, taking a basketball game video as an example, the video clips such as dunks and smashes in the video are wonderful video clips in the basketball game video, and the video clips such as ordinary dribbling are non-wonderful video clips. The black screen and animation during the camera switch are the least exciting video clips.
[0050] In the disclosed embodiment, the target video clip is a wonderful video clip as an example for explanation. For multiple video frames in a video, wonderful video clips are extracted based on scores. Since the scores of each video frame are calculated in combination with the video frames at the surrounding time, the scores obtained can represent the average wonderfulness of the video clips in a small range before and after the video frame. And the wonderfulness of the extracted target video clip is determined based on the scores of the video frames. Compared with calculating the scores of the entire video clip, the amount of calculation is smaller, which is more conducive to rapid evaluation in a short time, and then providing a suitable target video clip. For example: if the user needs the most wonderful video clip in the video, the video clip where the video frame with the highest score is located can be used as the target video clip according to the scores of each video frame. In one example, if the user needs multiple wonderful video clips, the video frames can be sorted based on the corresponding scores, and the video clips where multiple video frames with relatively high scores are located can be used as the target video clip.
[0051] Through the above embodiment, scoring based on sampled video frames instead of video clips through a trained scoring model can effectively reduce the calculation amount of the scoring model, thereby speeding up the scoring calculation rate and improving the process of extracting target video clips, thereby helping to improve the user experience.
[0052] In one embodiment, the target video segment can be extracted by sliding a sliding window of fixed length on the video along the time sequence, and the range covered by the sliding window each time it slides is a video segment. That is, each time the sliding window slides, when the end position of the sliding window slides to the starting position of the sliding window, a video segment is generated. For each sliding window, the average score of the sliding window is obtained according to the scores of each video frame included in the sliding window, and then the average score is used as the score of the video segment corresponding to the sliding window. Therefore, according to user needs, one or more target segments are extracted from multiple segments based on the scores of multiple segments. Taking the acquisition of wonderful video segments as an example, a sliding window of fixed length is used to slide on the video along the time sequence, and the average value of the wonderful scores of all video frames in the window is calculated as the wonderful score of the video segment corresponding to the window. The video segment corresponding to the sliding window with the highest score is the wonderful segment of the video. When multiple wonderful segments need to be extracted, the video segments with relatively high scores can be extracted according to the scores corresponding to each sliding window. To avoid high repetition between video clips, before extracting the video clips, the non-maximum mechanism algorithm can be used to eliminate the video clips corresponding to the sliding windows with high overlap, so that the extracted video clips are dispersed from each other, which is beneficial to improving the user's viewing experience when watching the extracted video clips.
[0053] In the disclosed embodiment, the scoring model may be pre-trained based on a multi-frame fusion layer and data pairs consisting of positive segments and negative segments.
[0054] Figure 2 is a flowchart of a scoring model training method according to an exemplary embodiment. Figure 2 As shown, the scoring model training method includes the following steps S21 to S24.
[0055] In step S21, a video is acquired, and N video frames are sampled from the video.
[0056] In step S22, N video frames are input into a pre-trained frame feature extraction model to obtain a feature vector of each of the N video frames.
[0057] In step S23, a multi-frame fusion layer is determined to fuse the feature vectors of K video frames into a fixed-length vector.
[0058] In the disclosed embodiment, the target video clip is a wonderful video clip as an example for explanation. In order to facilitate the score of the video frame obtained by the scoring model to correspond to the wonderfulness of the content of the video clip where the video frame is located. When obtaining the feature vector of the i-th frame, it is necessary to simultaneously obtain the feature vectors of (K-1) video frames centered on the i-th frame, which helps to improve the reliability of the output score. Therefore, before training the scoring model, it is necessary to first determine a multi-frame fusion layer that can fuse the feature vectors of K video frames into a fixed-length vector, so that the length vector output by the multi-frame fusion layer can enter the scoring model for scoring. For example: one video frame corresponds to an N-dimensional vector. When 7 video frames are obtained at the same time, 7 N-dimensional vectors are obtained. Therefore, in order to ensure the normal operation of the scoring model and the reliability of the score, it is necessary to fuse the 7 N-dimensional vectors obtained through the multi-frame fusion layer to obtain an M-dimensional vector suitable for use as the input of the scoring model. The multi-frame fusion layer can fuse multiple N-dimensional vectors into a fixed-length vector by means of concatenation, pooling or vector addition.
[0059] In step S24, a scoring model is obtained by training based on the multi-frame fusion layer and the data consisting of positive segments and negative segments.
[0060] In the disclosed embodiment, the scoring model is obtained by training a data pair consisting of a determined multi-frame fusion layer, a positive segment and a negative segment. In the process of obtaining the data pair, the obtained annotated video segment is annotated based on the content of the video segment, and then it is determined whether the annotated video segment belongs to a positive segment or a negative segment. The target attribute includes an attribute that characterizes the video segment as a target video segment or a non-target video segment. In one example, the target video segment can be the most exciting video segment in the video; the non-target video segment is the least exciting video segment in the video. Therefore, when the data pair is obtained, the difference between the positive segment and the negative segment can be clearly distinguished, so that when the scoring model is trained, the scoring model can quickly learn the video segment features between different attributes. Furthermore, based on the attribute annotation of the annotated video segment, the accuracy of the training data can be improved, and the interference of noise data on the model training can be reduced, which helps to improve the cleanliness of the training data, make the structure of the training model simpler, and do not need to use an additional network model to calculate the reliability of the annotated video segment. This helps the training process of the scoring model to accelerate convergence and save costs.
[0061] In one implementation scenario, when training the scoring model, K video frames are randomly or evenly sampled in the positive segment. Figure 3As shown in the figure, the obtained K video frames are subjected to frame feature extraction model to extract frame feature vectors, and the frame feature vectors corresponding to each video frame in the positive segment are obtained. Then, the obtained K frame feature vectors are fused through a multi-frame fusion layer to obtain a positive segment feature vector with a fixed length vector, denoted as {P1,P2,...P k}. Randomly sample or uniformly sample K video frames in the negative segment. Then extract the frame feature vectors of the obtained K video frames through the frame feature extraction model to obtain the frame feature vectors corresponding to each video frame in the negative segment. Then fuse the obtained K frame feature vectors through the multi-frame fusion layer to obtain a negative segment feature vector with a fixed length vector, denoted as {N1,N2,...,N K}.
[0062] The scoring model can be obtained from a multi-layer perceptron model. By copying a multi-layer perceptron model and sharing parameters, a twin neural network is obtained. Then, by training the twin neural network, a trained scoring model is obtained. When the obtained positive segment feature vector and negative segment feature vector are input into the twin neural network for training, the obtained positive segment feature vector and negative segment feature vector can be used as input at the same time to obtain the score of the positive segment and the score of the negative segment, and the loss value is calculated according to the score of the positive segment and the negative segment, so as to train the twin neural network through the back propagation algorithm. During training, the feature vector {P1, P2, ...P k} and the eigenvectors of the negative segments {N1,N2,...,N K} is input into the twin neural network to obtain the score S(P) of the positive segment and the score S(N) of the negative segment. The score of the positive segment should be higher than the score of the negative segment. Then, the ranking loss function is used to back-propagate the score output by the scoring model to adjust the parameters and weight ratios in the twin neural network, thereby improving the accuracy of the scoring model and accelerating the convergence rate of the twin neural network during training. The ranking loss can be recorded as follows: L({P1,P2,...P k},{N1,N2,...,N K})=max(0,1-S(P)+S(N)).
[0063] The present disclosure will now illustrate the training process of the scoring model with examples in combination with practical applications.
[0064] Before training the scoring model, data pairs suitable for scoring model training are obtained in advance, so that when training the scoring model, the scoring model can distinguish the differences in the wonderfulness between different video contents, so as to improve the accuracy of scoring. And the data pairs used for training are obtained based on the annotated segments of the sample video with the target attributes annotated, which helps to avoid the mixing of noise data and improve the quality of training data, thereby reducing the difficulty of training and speeding up the training process.
[0065] Figure 4 is a flow chart of a method for determining a data pair according to an exemplary embodiment. Figure 4 As shown, the method for determining a data pair includes the following steps S31 to S32.
[0066] In step S31, a sample video including one or more annotated video segments is obtained.
[0067] In one embodiment, before training the scoring model, a certain amount of sample videos is acquired in advance to obtain a sample video set so that the scoring model can have sufficient training data for training.
[0068] In step S32, based on the target attributes annotated by one or more annotated video segments and the non-annotated video segments included in the sample video, a data pair consisting of a positive segment and a negative segment is obtained.
[0069] In the sample video set, each sample video has one or more annotated video segments and non-annotated video segments. The annotated video segments in each sample video are annotated based on the content to clarify the target attributes of each annotated video segment. Based on the annotated target attributes, each annotated video segment and each non-annotated video segment are obtained into a data pair consisting of a positive segment and a negative segment. Among them, the possibility of a positive segment becoming a target video segment is greater than the possibility of a negative segment becoming a target video segment. Based on the difference between the positive segment and the negative segment, it is convenient for the scoring model to accurately distinguish the feature differences between the target video segment and the non-target video segment and the non-annotated video segment, which helps to improve the accuracy of the scoring model.
[0070] In one example, in order to facilitate the scoring model to better distinguish the differences in the degree of excitement between different video clips in the same video, when obtaining the data pair, the positive clip and the negative clip can come from the same sample video, so that the relative score difference between each video clip can be obtained, which helps to distinguish the degree of excitement between each video clip in the same video and helps to make full use of the sample video. For example: for a dunk highlight video, each dunk video clip is a wonderful video clip. By using the scoring model trained with data pairs obtained from the positive clip and the negative clip from the same sample video, the relative size of the scores of each dunk video clip can be obtained, which helps to distinguish relatively more exciting dunk video clips, thereby facilitating the extraction of target videos.
[0071] The embodiments of the present disclosure are described below by taking the target video segment as a wonderful video segment as an example.
[0072] Among them, when marking the target attribute in the sample video as the target video segment attribute, according to the content of the sample video, the most exciting video segment in the sample video is used as the video segment with the target video segment attribute, that is, the video segment is more exciting and attractive than the content at other times in the same video. Then the start and end times of the video segment are marked to obtain the marked video segment with the target video segment attribute. When marking the non-target attribute in the sample video as the target video segment attribute, according to the content of the sample video, the least exciting video segment in the sample video is used as the video segment with the non-target video segment attribute, that is, the video segment is less exciting and less attractive than the content at other times in the same video. Then the start and end times of the video segment are marked to obtain the marked video segment with the non-target video segment attribute.
[0073] In one example, the sample video may include one or more annotated video segments whose target attributes are the target video segment attributes, and unannotated video segments. When obtaining data pairs, one or more annotated video segments may be used as positive segments, and some video segments may be extracted from the unannotated video segments included in the sample video as negative segments. If there is only one annotated video segment in the sample video, and the length of the unannotated video segment is similar to that of the annotated video segment, the annotated video segment may be directly used as the positive segment, and the unannotated video segment may be used as the negative segment to obtain the data pairs required for training. For example: Figure 5As shown, video clip 2 is a labeled video clip whose target attribute is the target video clip attribute, and video clip 1 and video clip 3 are non-labeled video clips. Then, when obtaining data pairs, data pairs in which video clip 2 is a positive clip and video clip 1 is a negative clip and data pairs in which video clip 2 is a positive clip and video clip 3 is a negative clip can be obtained. If there is only one labeled video clip in the sample video, but the duration of the non-labeled video clip is too long, the non-labeled video clip can be divided into multiple sub-non-labeled video clips within a specified duration range, and then multiple data pairs in which the labeled video clip is a positive clip and the sub-non-labeled video clip is a negative clip can be obtained. This helps to reduce the difficulty of labeling, and a large number of training data pairs can be obtained by labeling a small number of labeled video clips. For example: the duration of the sample video is 60 seconds, of which the labeled video clip is 10 seconds and the non-labeled video clip is 50 seconds. In order to facilitate the acquisition of a large number of training data pairs, the non-labeled video clip can be divided into multiple sub-non-labeled video clips with a duration close to that of the labeled video clip. If the non-labeled video clip is divided into multiple sub-non-labeled video clips of no more than 10 seconds, at least 5 sub-non-labeled video clips can be obtained, for example: sub-non-labeled video clip 1, sub-non-labeled video clip 2, sub-non-labeled video clip 3, sub-non-labeled video clip 4, sub-non-labeled video clip 5. Then, 5 pairs of data pairs for fractional model training can be obtained: the labeled video clip is a positive clip and the sub-non-labeled video clip 1 is a negative clip; the labeled video clip is a positive clip and the sub-non-labeled video clip 2 is a negative clip; the labeled video clip is a positive clip and the sub-non-labeled video clip 3 is a negative clip; the labeled video clip is a positive clip and the sub-non-labeled video clip 4 is a negative clip; the labeled video clip is a positive clip and the sub-non-labeled video clip 5 is a negative clip.
[0074] In another example, the sample video may include one or more annotated video segments whose target attributes are non-target video segment attributes, and unannotated video segments. When obtaining data pairs, one or more annotated video segments may be used as negative segments, and some video segments may be extracted from the unannotated video segments included in the sample video as positive and negative segments. If there is only one annotated video segment in the sample video, and the length of the unannotated video segment is similar to that of the annotated video segment, the annotated video segment may be directly used as the negative segment, and the unannotated video segment may be used as the positive segment to obtain the data pairs required for training. For example: Figure 6As shown, video clip 3 is a labeled video clip whose target attribute is a non-target video clip attribute, and video clip 1 and video clip 2 are non-labeled video clips. Then, when obtaining data pairs, data pairs in which video clip 1 is a positive clip and video clip 3 is a negative clip and data pairs in which video clip 2 is a positive clip and video clip 3 is a negative clip can be obtained. If there is only one labeled video clip in the sample video, but the duration of the non-labeled video clip is too long, the non-labeled video clip can be divided into multiple sub-non-labeled video clips within a specified duration range, and multiple data pairs in which the labeled video clip is a negative clip and the sub-non-labeled video clip is a positive clip can be obtained. This helps to reduce the difficulty of labeling, and a large number of training data pairs can be obtained by labeling a small number of labeled video clips.
[0075] In another example, the sample video may include one or more labeled video segments whose target attributes are attributes of the target video segment, one or more labeled video segments whose target attributes are attributes of the non-target video segment, and unlabeled video segments. When obtaining the data pairs, if the labeled video segments whose labels represent the attributes of the target video segment are taken as positive segments, then the labeled video segments whose labels represent the attributes of the non-target video segment are taken as negative segments, or a portion of the video segments extracted from the unlabeled video segment is taken as a negative segment. If the labeled video segments whose labels represent the attributes of the non-target video segment are taken as negative segments, then the labeled video segments whose labels represent the attributes of the target video segment are taken as positive segments, or a portion of the video segments extracted from the unlabeled video segment is taken as a positive segment. For example: Figure 7 As shown, video segment 2 is a labeled video segment that represents the target video segment attribute, video segment 3 is a labeled video segment whose target attribute is a non-target video segment attribute, and video segment 1 is a non-labeled video segment. Then, when obtaining data pairs, we can obtain data pairs where video segment 2 is a positive segment and video segment 1 is a negative segment; obtain data pairs where video segment 2 is a positive segment and video segment 3 is a negative segment; and obtain data pairs where video segment 1 is a positive segment and video segment 3 is a negative segment.
[0076] By obtaining labeled training data pairs, the generation of noise data can be effectively reduced and the interference of noise data can be avoided, which in turn helps to improve the cleanliness of the training data and make the scoring model structure simple. There is no need to adopt other network models or add other parameters to improve the reliability of the training data. The training difficulty is low, which helps to speed up the convergence of the scoring model during the training process.
[0077] Based on the same concept, the embodiment of the present disclosure also provides a video segment extraction device.
[0078] It is understandable that in order to achieve the above functions, the video clip extraction device provided by the embodiment of the present disclosure includes hardware structures and / or software modules corresponding to the execution of each function. In combination with the units and algorithm steps of each example disclosed in the embodiment of the present disclosure, the embodiment of the present disclosure can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the technical solution of the embodiment of the present disclosure.
[0079] Figure 8 FIG. 1 is a block diagram of a video segment extraction device according to an exemplary embodiment. Figure 8 The video segment extraction device 100 includes an acquisition unit 101, a feature extraction unit 102, a determination unit 103 and an extraction unit 104.
[0080] The acquisition unit 101 is used to acquire a video and obtain N video frames by sampling the video, where N is a positive integer.
[0081] The feature extraction unit 102 is used to input N video frames into a pre-trained frame feature extraction model to obtain a feature vector of each of the N video frames.
[0082] The determination unit 103 is used to determine the scores of N video frames based on a pre-trained scoring model, wherein, for the i-th frame among the N video frames, the feature vectors of K video frames centered on the i-th frame are input into the pre-trained scoring model to obtain the score of the i-th frame, where i is a positive integer less than or equal to N, and K is a positive integer.
[0083] The extraction unit 104 is configured to extract a target video segment from the video based on the scores of the N video frames.
[0084] In one embodiment, the video segment extraction device further includes a training unit. The training unit is used to train a scoring model based on a fusion layer and a data pair consisting of a positive segment and a negative segment, wherein the data pair consisting of the positive segment and the negative segment is obtained based on sample video segments labeled with target attributes, wherein the target attributes include attributes that characterize the video segment as a target video segment or a non-target video segment, and the multi-frame fusion layer is used to fuse feature vectors of K video frames into a fixed-length vector.
[0085] In another embodiment, the training unit adopts the following method to obtain a scoring model based on a multi-frame fusion layer and a data pair consisting of a positive segment and a negative segment: sample K video frames in the positive segment, extract feature vectors of the K video frames sampled in the positive segment based on a frame feature extraction model, sample K video frames in the negative segment, extract feature vectors of the K video frames sampled in the negative segment based on a frame feature extraction model, and fuse the feature vectors of the K video frames sampled in the positive segment into a positive segment feature vector with a fixed length vector based on a multi-frame fusion layer, and fuse the K video frames sampled in the negative segment into a negative segment feature vector with a fixed length vector based on a multi-frame fusion layer. Input the positive segment feature vector and the negative segment feature vector into a twin neural network to obtain the score of the positive segment and the score of the negative segment, and perform back propagation using a sorting loss to train a trained twin neural network; wherein the twin neural network includes two multi-layer perceptron models with shared parameters; and the scoring model is a multi-layer perceptron model of the trained twin neural network.
[0086] In another embodiment, a data pair consisting of a positive segment and a negative segment is obtained based on a sample video segment annotated with a target attribute in the following manner: a sample video including one or more sample video segments is obtained. Based on the target attributes annotated by the one or more sample video segments and the non-sample video segments included in the sample video, a data pair consisting of a positive segment and a negative segment is obtained, wherein the possibility that the positive segment becomes the target video segment is greater than the possibility that the negative segment becomes the target video segment.
[0087] In another embodiment, the data pairs consisting of positive segments and negative segments are obtained based on the target attributes marked by one or more sample video segments and the non-sample video segments included in the sample video in the following manner: if the target attributes marked by one or more sample video segments include attributes that characterize the video segments as target video segments, then one or more sample video segments are used as positive segments, and some video segments are extracted from the non-sample video segments included in the sample video as negative segments, and one or more data pairs are obtained from the positive segments and the negative segments; or if the target attributes marked by one or more sample video segments include attributes that characterize the video segments as non-target video segments, then one or more sample video segments are used as negative segments, and some video segments are extracted from the non-sample video segments included in the sample video as positive segments, and one or more data pairs are obtained from the positive segments and the negative segments. Alternatively, if the target attributes annotated by one or more sample video clips include attributes characterizing the video clip as a target video clip and attributes characterizing the video clip as a non-target video clip, the sample video clip annotated with the attributes characterizing the target video clip is used as a positive clip, the sample video clip annotated with the attributes characterizing the non-target video clip is used as a negative clip, and partial video clips are extracted from the non-sample video clips included in the sample video, data pairs are obtained from the positive clips and the negative clips, data pairs are obtained from the positive clips and the partial video clips, and data pairs are obtained from the negative clips and the partial video clips.
[0088] In another embodiment, the extraction module extracts the target video segment from the video based on the scores of the N video frames in the following manner: based on a sliding window of a fixed length sliding on the video along the time sequence to obtain multiple video segments, wherein each sliding window corresponds to a video segment. For each sliding window, the average score of the video frames included in the sliding window is determined respectively, and the average score of the video frames is used as the score of the video segment corresponding to the sliding window. One or more target video segments are extracted from the multiple video segments based on the scores of the multiple video segments.
[0089] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0090] Fig. 9 2 is a block diagram of another video segment extraction device according to an exemplary embodiment. For example, the video segment extraction device 200 can be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0091] Reference Fig. 9The video segment extraction device 200 may include one or more of the following components: a processing component 202 , a memory 204 , a power component 206 , a multimedia component 208 , an audio component 210 , an input / output (I / O) interface 212 , a sensor component 214 , and a communication component 216 .
[0092] The processing component 202 generally controls the overall operation of the video segment extraction device 200, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 202 may include one or more processors 220 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 202 may include one or more modules to facilitate the interaction between the processing component 202 and other components. For example, the processing component 202 may include a multimedia module to facilitate the interaction between the multimedia component 208 and the processing component 202.
[0093] The memory 204 is configured to store various types of data to support the operation of the video segment extraction device 200. Examples of such data include instructions for any application or method operating on the video segment extraction device 200, contact data, phone book data, messages, pictures, videos, etc. The memory 204 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0094] The power component 206 provides power to various components of the video segment extraction device 200. The power component 206 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the video segment extraction device 200.
[0095] The multimedia component 208 includes a screen that provides an output interface between the video segment extraction device 200 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 208 includes a front camera and / or a rear camera. When the video segment extraction device 200 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0096] The audio component 210 is configured to output and / or input audio signals. For example, the audio component 210 includes a microphone (MIC), and when the video segment extraction device 200 is in an operation mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 204 or sent via the communication component 216. In some embodiments, the audio component 210 also includes a speaker for outputting audio signals.
[0097] I / O interface 212 provides an interface between processing component 202 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0098] The sensor assembly 214 includes one or more sensors for providing various aspects of status assessment for the video clip extraction device 200. For example, the sensor assembly 214 can detect the open / closed state of the video clip extraction device 200, the relative positioning of components, such as the display and keypad of the video clip extraction device 200, the sensor assembly 214 can also detect the position change of the video clip extraction device 200 or a component of the video clip extraction device 200, the presence or absence of user contact with the video clip extraction device 200, the orientation or acceleration / deceleration of the video clip extraction device 200, and the temperature change of the video clip extraction device 200. The sensor assembly 214 can include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 214 can also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 214 can also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0099] The communication component 216 is configured to facilitate wired or wireless communication between the video segment extraction device 200 and other devices. The video segment extraction device 200 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 216 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 216 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0100] In an exemplary embodiment, the video segment extraction device 200 can be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above method.
[0101] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 204 including instructions, and the instructions can be executed by the processor 220 of the video segment extraction device 200 to complete the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0102] It is further understood that in the present disclosure, "plurality" refers to two or more than two, and other quantifiers are similar thereto. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. The singular forms "a", "the" and "the" are also intended to include plural forms, unless the context clearly indicates other meanings.
[0103] It is further understood that the terms "first", "second", etc. are used to describe various information, but such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other, and do not indicate a specific order or degree of importance. In fact, the expressions "first", "second", etc. can be used interchangeably. For example, without departing from the scope of the present disclosure, the first information can also be referred to as the second information, and similarly, the second information can also be referred to as the first information.
[0104] It can be further understood that, unless otherwise specified, “connection” includes a direct connection without other components between the two, and also includes an indirect connection with other components between the two.
[0105] It is further understood that, although the operations are described in a specific order in the drawings in the embodiments of the present disclosure, it should not be understood as requiring the operations to be performed in the specific order shown or in a serial order, or requiring the execution of all the operations shown to obtain the desired results. In certain environments, multitasking and parallel processing may be advantageous.
[0106] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0107] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A video segment extraction method, characterized in that: The video clip extraction method comprises: Acquire a video, and sample the video to obtain N video frames, where N is a positive integer; Inputting the N video frames into a pre-trained frame feature extraction model to obtain a feature vector of each of the N video frames; Determine the scores of the N video frames based on a pre-trained scoring model, wherein, for an i-th frame among the N video frames, feature vectors of K video frames centered on the i-th frame are input into the pre-trained scoring model to obtain the score of the i-th frame, where i is a positive integer less than or equal to N, and K is a positive integer; Extracting a target video segment from the video based on the scores of the N video frames; The scoring model is trained based on a multi-frame fusion layer and a data pair consisting of positive segments and negative segments; The data pairs consisting of the positive segments and the negative segments are obtained based on sample video segments annotated with target attributes, wherein the target attributes include attributes characterizing that the video segments are target video segments or non-target video segments, and the multi-frame fusion layer is used to fuse feature vectors of K video frames into a fixed-length vector; The data pair consisting of the positive segment and the negative segment is obtained based on the sample video segment annotated with the target attribute in the following manner: Acquire a sample video including one or more sample video clips; Based on the target attributes marked by the one or more sample video segments and the non-sample video segments included in the sample video, a data pair consisting of a positive segment and a negative segment is obtained, wherein the possibility that the positive segment becomes the target video segment is greater than the possibility that the negative segment becomes the target video segment.
2. The video segment extraction method according to claim 1, characterized in that: The scoring model is obtained by training the data pairs composed of the multi-frame fusion layer and the positive segments and the negative segments, including: K video frames are sampled in the positive segment, feature vectors of the K video frames sampled in the positive segment are extracted based on the frame feature extraction model, K video frames are sampled in the negative segment, feature vectors of the K video frames sampled in the negative segment are extracted based on the frame feature extraction model, and Based on the multi-frame fusion layer, the feature vectors of the K video frames sampled in the positive segment are fused into a positive segment feature vector having a fixed length vector, and based on the multi-frame fusion layer, the K video frames sampled in the negative segment are fused into a negative segment feature vector having a fixed length vector; The positive segment feature vector and the negative segment feature vector are input into the twin neural network to obtain the score of the positive segment and the score of the negative segment, and the sorting loss is used for back propagation to obtain a trained twin neural network; wherein the twin neural network includes two multi-layer perceptron models with shared parameters; and the scoring model is a multi-layer perceptron model of the trained twin neural network.
3. The video segment extraction method according to claim 1, characterized in that: Based on the target attributes marked by the one or more sample video segments and the non-sample video segments included in the sample video, a data pair consisting of a positive segment and a negative segment is obtained, including: If the target attributes marked by the one or more sample video segments include an attribute that characterizes the video segment as a target video segment, the one or more sample video segments are used as positive segments, and some video segments are extracted from the non-sample video segments included in the sample video as negative segments, and one or more data pairs are obtained from the positive segments and the negative segments; or If the target attributes marked by the one or more sample video segments include an attribute that characterizes the video segment as a non-target video segment, the one or more sample video segments are used as negative segments, and some video segments are extracted from the non-sample video segments included in the sample video as positive segments, and one or more data pairs are obtained from the positive segments and the negative segments; or If the target attributes annotated by the one or more sample video clips include attributes characterizing the video clip as a target video clip and attributes characterizing the video clip as a non-target video clip, the sample video clip annotated with the attributes characterizing the target video clip is used as a positive clip, the sample video clip annotated with the attributes characterizing the non-target video clip is used as a negative clip, and partial video clips are extracted from the non-sample video clips included in the sample video, data pairs are obtained from the positive clip and the negative clip, data pairs are obtained from the positive clip and the partial video clip, and data pairs are obtained from the negative clip and the partial video clip.
4. The video segment extraction method according to claim 1, characterized in that: Extracting a target video segment from the video based on the scores of the N video frames includes: A plurality of video segments are obtained by sliding a sliding window of a fixed length on the video along a time sequence, wherein each sliding window corresponds to a video segment; For each sliding window, respectively determine the average score of the video frames included in the sliding window, and use the average score of the video frames as the score of the video segment corresponding to the sliding window; One or more target video segments are extracted from the multiple video segments based on the scores of the multiple video segments.
5. A video clip extraction device, characterized in that: The video segment extraction device comprises: An acquisition unit, used to acquire a video and sample the video to obtain N video frames, where N is a positive integer; A feature extraction unit, used to input the N video frames into a pre-trained frame feature extraction model to obtain a feature vector of each of the N video frames; a determining unit, configured to determine the scores of the N video frames based on a pre-trained scoring model, wherein, for an i-th frame among the N video frames, feature vectors of K video frames centered on the i-th frame are input into the pre-trained scoring model to obtain the score of the i-th frame, wherein i is a positive integer less than or equal to N, and K is a positive integer; An extraction unit, configured to extract a target video segment from the video based on the scores of the N video frames; The video segment extraction device also includes a training unit; The training unit is used to obtain the scoring model through training based on a multi-frame fusion layer and a data pair consisting of a positive segment and a negative segment, wherein the data pair consisting of the positive segment and the negative segment is obtained based on a sample video segment annotated with a target attribute, wherein the target attribute includes an attribute characterizing that the video segment is a target video segment or a non-target video segment, and the multi-frame fusion layer is used to fuse feature vectors of K video frames into a fixed-length vector; The data pair consisting of the positive segment and the negative segment is obtained based on the sample video segment annotated with the target attribute in the following manner: Acquire a sample video including one or more sample video clips; Based on the target attributes marked by the one or more sample video segments and the non-sample video segments included in the sample video, a data pair consisting of a positive segment and a negative segment is obtained, wherein the possibility that the positive segment becomes the target video segment is greater than the possibility that the negative segment becomes the target video segment.
6. The video segment extraction device according to claim 5, characterized in that: The training unit obtains the scoring model by training based on the multi-frame fusion layer and the data pairs consisting of the positive segments and the negative segments in the following manner: K video frames are sampled in the positive segment, feature vectors of the K video frames sampled in the positive segment are extracted based on the frame feature extraction model, K video frames are sampled in the negative segment, feature vectors of the K video frames sampled in the negative segment are extracted based on the frame feature extraction model, and Based on the multi-frame fusion layer, the feature vectors of the K video frames sampled in the positive segment are fused into a positive segment feature vector having a fixed length vector, and based on the multi-frame fusion layer, the K video frames sampled in the negative segment are fused into a negative segment feature vector having a fixed length vector; The positive segment feature vector and the negative segment feature vector are input into the twin neural network to obtain the score of the positive segment and the score of the negative segment, and the sorting loss is used for back propagation to obtain a trained twin neural network; wherein the twin neural network includes two multi-layer perceptron models with shared parameters; and the scoring model is a multi-layer perceptron model of the trained twin neural network.
7. The video segment extraction device according to claim 5, characterized in that: The data pair consisting of the positive segment and the negative segment is obtained based on the target attributes marked by the one or more sample video segments and the non-sample video segments included in the sample video in the following manner: If the target attributes marked by the one or more sample video segments include an attribute that characterizes the video segment as a target video segment, the one or more sample video segments are used as positive segments, and some video segments are extracted from the non-sample video segments included in the sample video as negative segments, and one or more data pairs are obtained from the positive segments and the negative segments; or If the target attributes marked by the one or more sample video segments include an attribute that characterizes the video segment as a non-target video segment, the one or more sample video segments are used as negative segments, and some video segments are extracted from the non-sample video segments included in the sample video as positive segments, and one or more data pairs are obtained from the positive segments and the negative segments; or If the target attributes annotated by the one or more sample video clips include attributes characterizing the video clip as a target video clip and attributes characterizing the video clip as a non-target video clip, the sample video clip annotated with the attributes characterizing the target video clip is used as a positive clip, the sample video clip annotated with the attributes characterizing the non-target video clip is used as a negative clip, and partial video clips are extracted from the non-sample video clips included in the sample video, data pairs are obtained from the positive clip and the negative clip, data pairs are obtained from the positive clip and the partial video clip, and data pairs are obtained from the negative clip and the partial video clip.
8. The video segment extraction device according to claim 5, characterized in that: The extraction module extracts the target video segment from the video based on the scores of the N video frames in the following manner: A plurality of video segments are obtained by sliding a sliding window of a fixed length on the video along a time sequence, wherein each sliding window corresponds to a video segment; For each sliding window, respectively determine the average score of the video frames included in the sliding window, and use the average score of the video frames as the score of the video segment corresponding to the sliding window; One or more target video segments are extracted from the multiple video segments based on the scores of the multiple video segments.
9. A video clip extraction device, wherein: The video segment extraction device comprises: a memory for storing instructions; and The processor is used to call the instructions stored in the memory to execute the video segment extraction method as described in any one of claims 1-4.
10. A computer-readable storage medium storing instructions, wherein when the instructions are executed by a processor, the video segment extraction method according to any one of claims 1 to 4 is executed.
Citation Information
Patent Citations
Video high-level characteristic retrieval system and realization thereof
CN101650728A
No-reference video quality evaluation method based on visual stimulation attenuation characteristic
CN106375754A
Video clip wonderness degree evaluation and dynamic cover generation method and device
CN110191357A
Video highlight fragment identification method and device
CN110263220A
Video classification model training method, video classification method, device and equipment
CN110751224A
