Video scene boundary detection method based on neighbor network
By constructing feature maps and time maps, using graph convolution networks to propagate information, suppress noise edges, and enhance the correlation of shots within the same scene, we solve the problem of inaccurate merging of different scene information in video scene boundary detection in the existing technology, and improve Detection effect.
Patent Information
- Application Number
- CN202410722619.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-05
- Publication Date
- 2024-08-30
AI Technical Summary
When existing methods capture video scene boundaries, simple shot similarity correlation cannot accurately combine information from different scenes, resulting in poor prediction results, especially when similar shots span two scenes.
A method based on neighbor networks is used to connect semantically similar shots by constructing feature maps and time graphs. The graph convolution network is used to propagate information, suppress noise edges, enhance the correlation of shots within the same scene, and weaken the correlation between different scenes.
It effectively improves the ability to capture lens context, enhances the correlation of shots within the same scene, weakens the correlation between different scenes, and improves the accuracy of video scene boundary detection.
Smart Images

Figure CN118570239A
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of deep learning in artificial intelligence, and specifically is a method for discovering potential patterns of semantic transitions in video scenes and detecting scene boundaries in videos. Background Art
[0002] Existing methods use shot-to-shot similarity to integrate information from other shots to capture the context of each shot. However, when similar shots span two scenes, simple similarity association often fails to accurately merge information from different scenes, resulting in poor prediction of video scene boundaries. This problem motivates us to explore how to capture shot context in the same scene while minimizing the fusion of shot information from different scenes. Summary of the invention
[0003] The purpose of the present invention is to provide a method for discovering potential patterns of semantic transition of video scenes and detecting scene boundaries of videos.
[0004] In order to achieve the above object, the present invention adopts such a technical solution: a video scene boundary detection method based on a neighbor network, comprising the following steps performed in sequence:
[0005] Step S1: Extracting shot sequences: obtaining M videos, and using existing methods to obtain the shots in each video to form a shot sequence S = [s1, s2, ..., s n ], sampling key frames from the shots, each video corresponds to a shot sequence;
[0006] Step S2: Construct a scene boundary detection neighbor network.
[0007] Step S21: For a shot sequence, use a visual encoder to extract features from the key frames corresponding to the shot sequence to obtain the features of each shot. The features of all shots constitute a feature sequence X = [x1, x2, ..., x n ], where one of the features x i Corresponding to a lens s i , n is the length of the shot and feature sequence.
[0008] Step S22: For the shot sequence, construct a feature graph G F ,G F The nodes are different lenses, G F The edge E F is the similarity A between different shots NPS , the A NPS Including A NPS and A NNS , where A NPS is the jth shot s jWith the i-th lens s i Neighbors Lenses g Similarity A collection of NNS is the i-th lens s i Neighbors Lenses g With the jth lens s j Neighbors Lenses h Similarity The set of , i,j≤n, and i≠j.
[0009] Step S23: The obtained A NPS Send it to the graph convolutional network to get the sequence feature X FG , With the i-th lens s i correspond.
[0010] Step S24: Perform the operations of S21-S23 on the M videos to obtain the sequence feature X of each video. FG .
[0011] Step S25: For obtaining sequence feature X FG , construct a time graph G T ,G T The nodes are different lenses, G T The edge E T is the similarity B between different shots NPS , the B NPS Including B CPS and B TCS , where B CPS yes and The similarity between The collection of B TCS is the contextual similarity between the j-th shot and the neighbors of the i-th shot A collection of .
[0012] If the jth shot is temporally between the ith shot and one of its neighbor shots, then calculate and The similarity between Otherwise the similarity is -∞.
[0013] Step S26: The obtained B NPS Send it to the graph convolutional network to get the time feature X TG .
[0014] Step S27: Perform the operations of S25-S26 on the M videos to obtain the time feature X of each video. TG .
[0015] Step S28: X corresponding to each video segment TG Input a multi-layer perceptron and output the confidence of n shots. A confidence of 1 indicates that it is a boundary, and a confidence of 0 indicates that it is not a boundary.
[0016] Step S3: Train the scene boundary detection neighbor network, calculate the loss, and update the parameters of the scene boundary detection neighbor network according to the loss. When the loss no longer decreases, the optimal scene boundary detection neighbor network is obtained.
[0017] Step S4: Detection: Obtain a shot sequence S′ from the video clip to be detected through step S1, input S′ into the optimal scene boundary detection neighbor network, and output the confidence that each shot in the shot sequence S′ is a scene boundary.
[0018] Furthermore, in step S22, A is calculated NPS The method is: when the lens s j In the lens i centered in a time window of length l and with lens s i If there are not enough shots in the time window among the most similar first k shots, they are filled with zero vectors, and the cosine similarity is used to calculate the similarity between the shots:
[0019]
[0020] Among them, x j Indicates lens i The corresponding feature, x j Indicates lens j The corresponding features, Indicates the lens i As the center, the time window of length l, when the shot s j If the above conditions are not met, the lens s i With lens j The similarity is -∞.
[0021] Furthermore, in step S23, the calculation The method is:
[0022]
[0023] in and represents the learnable matrix, represents a learnable weight ratio, Indicates the lens i The time window is centered at a length of l and excludes shot s j , x j Indicates lens jCorresponding features.
[0024] In step S23, the calculation The method is:
[0025]
[0026] in Represents a learnable weight ratio, x h Indicates lens j The time window with length l as the center does not contain shot s i The corresponding features of other lenses.
[0027] Further, in step S25, B is calculated CPS The method is to use a lens s j In the lens i With lens i Among the neighbor nodes, the cosine similarity is used to calculate the similarity score between the shots:
[0028]
[0029] in, Indicates lens i The corresponding sequence features are Indicates lens j The corresponding sequence features are Indicates the lens i As the center, the time window of length l, when the shot s j When the above conditions are not met, the similarity is -∞.
[0030] Furthermore, in step S25, the calculation The method is:
[0031]
[0032] in Represents a learnable matrix. g∈T r (i),h∈T r (j), T r (i) represents a time window with the i-th shot as the center and a length of r. If the window does not meet the length requirement, it is filled with boundary shots.
[0033] In step S25, the calculation The method is:
[0034]
[0035] in, Indicates lensi The corresponding sequence features are Indicates lens j The corresponding sequence features.
[0036] Furthermore, when S3 calculates the loss, if M videos have no labels, the loss is L p :
[0037] The feature sequence X uses the dynamic time adjustment algorithm to obtain the pseudo boundary X p , the self-supervised scene boundary detection neighbor network is trained using binary cross entropy loss, as shown in the following formula:
[0038]
[0039] in is the boundary predicted by the network.
[0040] Furthermore, when S3 calculates the loss, if M videos have labels, the loss is L f :
[0041] Use binary cross entropy loss to train a supervised scene boundary detection neighbor network as shown in the following formula:
[0042]
[0043] in is the boundary predicted by the network, y i represents the true label of the i-th shot.
[0044] Compared with the prior art, the beneficial effects of the present invention are:
[0045] By constructing feature graphs and time graphs, semantically similar and temporally similar shots are connected, and information is propagated using graph convolutional networks. This method effectively suppresses noise edges, enhances the association of shots in the same scene, and weakens the association of shots in different scenes. It solves the problem of incomplete contextual information capture in the same scene in previous methods, thereby improving the ability to capture shot context. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 It is a structural diagram of the scene boundary detection neighbor network of the present invention.
[0047] Figure 2 It is a structural diagram of the neighbor-node attention layer of the present invention.
[0048] Figure 3 It is a structural schematic diagram of the neighbor-neighbor attention layer of the present invention.
[0049] Figure 4It is a structural diagram of the temporal context attention layer of the present invention. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only partial embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0051] A video scene boundary detection method based on neighbor network, such as Figure 1 As shown, the steps include the following steps performed in sequence:
[0052] Step S1: Extracting shot sequences: obtaining M videos, and using existing methods to obtain the shots in each video to form a shot sequence S = [s1, s2, ..., s n ], sampling key frames from the shots, each video corresponds to a shot sequence;
[0053] Step S2: Figure 2-Figure 4 As shown, a scene boundary detection neighbor network is constructed based on a neighbor-node attention layer, a neighbor-neighbor attention layer, a temporal context attention layer, a multi-layer perceptron (MLP) and a graph convolutional network (GCN);
[0054] Step S21: For a shot sequence, use a visual encoder to extract features from the key frames corresponding to the shot sequence to obtain the features of each shot. The features of all shots constitute a feature sequence X = [x1, x2, ..., x n ], where one of the features x i Corresponding to a lens s i , n is the length of the shot and feature sequence; first, the long video is segmented and frame sampled, and then the pre-trained visual encoder ResNet-50 is used to extract frame features. The feature of each frame is a 2048-dimensional frame-level visual feature vector.
[0055] Step S22: For the shot sequence, construct a feature graph G F ,G F The nodes are different lenses, G F The edge E F is the similarity A between different shots NPS , the A NPS Including A NPS and A NNS , where A NPS is the jth shot s j With the i-th lens s i Neighbors Lensesg Similarity A collection of NNS is the i-th lens s i Neighbors Lenses g With the jth lens s j Neighbors Lenses h Similarity The set of , i,j≤n, and i≠j.
[0056] Step S23: The obtained A NPS Send it to the graph convolutional network to get the sequence feature X FG , With the i-th lens s i correspond.
[0057] Step S24: Perform the operations of S21-S23 on the M videos to obtain the sequence feature X of each video. FG ;
[0058] Step S25: For obtaining sequence feature X FG , construct a time graph G T ,G T The nodes are different lenses, G T The edge E T is the similarity B between different shots NPS , the B NPS Including B CPS and B TCS , where B CPS yes and The similarity between The collection of B TCS is the contextual similarity between the j-th shot and the neighbors of the i-th shot A collection of .
[0059] If the jth shot is temporally between the ith shot and one of its neighbor shots, then calculate and The similarity between Otherwise the similarity is -∞;
[0060] Step S26: The obtained B NPS Send it to the graph convolutional network to get the time feature X TG ;
[0061] Step S27: Perform the operations of S25-S26 on the M videos to obtain the time feature X of each video. TG .
[0062] Step S28: X corresponding to each video segment TG Input a multi-layer perceptron and output the confidence of n shots. A confidence of 1 indicates that it is a boundary, and a confidence of 0 indicates that it is not a boundary.
[0063] Step S3: Train the scene boundary detection neighbor network, calculate the loss, and update the parameters of the scene boundary detection neighbor network according to the loss. When the loss no longer decreases, the optimal scene boundary detection neighbor network is obtained.
[0064] Step S4: Detection: Obtain a shot sequence S′ from the video clip to be detected through step S1, input S′ into the optimal scene boundary detection neighbor network, and output the confidence that each shot in the shot sequence S′ is a scene boundary.
[0065] Specifically, in step S22, A is calculated NPS The method is: when the lens s j In the lens i centered in a time window of length l and with lens s i If there are not enough shots in the time window among the most similar first k shots, they are filled with zero vectors, and the cosine similarity is used to calculate the similarity between the shots:
[0066]
[0067] Among them, x i Indicates lens i The corresponding feature, x j Indicates lens j The corresponding features, Indicates the lens i As the center, the time window of length l, when the shot s j If the above conditions are not met, the lens s i With lens j The similarity is -∞.
[0068] Specifically, in step S23, the calculation The method is:
[0069]
[0070] in and represents the learnable matrix, represents a learnable weight ratio, Indicates the lens i The time window is centered at a length of l and excludes shot s j , x j Indicates lens j Corresponding features.
[0071] In step S23, the calculation The method is:
[0072]
[0073] in Represents a learnable weight ratio, x h Indicates lens j The time window with length l as the center does not contain shot s i The corresponding features of other lenses.
[0074] Specifically, in step S25, calculate B CPS The method is to use a lens s j In the lens i With lens i Among the neighbor nodes, the cosine similarity is used to calculate the similarity score between the shots:
[0075]
[0076] in, Indicates lens i The corresponding sequence features are Indicates lens j The corresponding sequence features are Indicates the lens i As the center, the time window of length l, when the shot s j When the above conditions are not met, the similarity is -∞.
[0077] Specifically, in step S25, the calculation The method is:
[0078]
[0079] in Represents a learnable matrix. g∈T r (i),h∈T r (j), T r (i) represents a time window with the i-th shot as the center and a length of r. If the window does not meet the length requirement, it is filled with boundary shots.
[0080] In step S25, the calculation The method is:
[0081]
[0082] in, Indicates lensi The corresponding sequence features are Indicates lens j The corresponding sequence features.
[0083] Specifically, when S3 calculates the loss, if M videos have no labels, the loss is L p :
[0084] The feature sequence X uses the dynamic time adjustment algorithm to obtain the pseudo boundary X p , the self-supervised scene boundary detection neighbor network is trained using binary cross entropy loss, as shown in the following formula:
[0085]
[0086] in is the boundary predicted by the network.
[0087] Specifically, when S3 calculates the loss, if M videos have labels, the loss is L f :
[0088] Use binary cross entropy loss to train a supervised scene boundary detection neighbor network as shown in the following formula:
[0089]
[0090] in is the boundary predicted by the network, y i represents the true label of the i-th shot.
[0091] Experimental analysis
[0092] Table 1 Performance comparison of self-supervised transfer learning methods
[0093] Comparison Method AP QUR F1 ShotCoL 53.4 - 49.7 SCRL 54.8 - 51.4 BaSSL 57.4 50.6 47.0 TranS4mer 60.8 52.0 48.4 The present invention 71.9 64.5 62.7
[0094] The experimental data in Table 1 are the comparative results of self-supervised transfer learning experiments on the MovieNet dataset. The table compares the performance of several self-supervised transfer learning methods on three evaluation indicators: AP, mIoU and F1. The present invention has achieved the most advanced results on multiple evaluation indicators. Compared with the ShotCoL method, the present invention has improved the AP and F1 evaluation indicators by 34.6% and 26.2%, respectively. Compared with the SCRL method, the present invention has improved the AP and F1 evaluation indicators by 31.2% and 22.0%, respectively. Compared with the BaSSL method, the present invention has improved the mIoU evaluation indicator by 27.5%. Compared with the most advanced TranS4mer method, the present invention has surpassed the TranS4mer method in all indicators, especially in the F1 evaluation indicator by 29.5%. Among them, BaSSL and TranS4mer methods are both pseudo-boundary prediction algorithms. The experimental results show that the performance of the present invention is superior to that of the pseudo-boundary prediction algorithm. These substantial improvements can be attributed to the use of adjacent shots proposed by the present invention to capture the relationship between shots. These improvements verify the effectiveness and superiority of the method of the present invention.
[0095] The core idea of the present invention is the shot context learning method. Specifically, a feature graph is constructed to connect semantically similar shots, and a graph convolutional network is used to propagate information on the graph. The edge weights in the feature graph are estimated by the neighbor relationships between pairs of nodes in the graph. In the feature graph, the relationship between neighbor nodes is introduced to suppress the potential connection between different scenes. We achieve this by measuring the relationship between the neighbors of the node pairs. In order to capture a more complete context of the shot, a temporal graph is constructed to connect similar shots with intervening shots. The edge weights in the temporal graph consider the similarity of paired shots and the similarity of their temporal neighbor shots at the same time. After having the temporal context similarity, the edge weights are recalculated to better capture the relationship between different shots. Information propagation is performed on the feature graph and the temporal graph respectively, and the context features of each shot node are updated. The graph convolutional network is used to enhance the correlation of shots within the same scene, while weakening the correlation between different scenes. A large number of experiments on very challenging datasets have verified that the proposed method has good performance and advantages.
[0096] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A video scene boundary detection method based on a neighbor network, characterized in that: The process includes the following steps: Step S1: Extracting shot sequences: obtaining M videos, and using existing methods to obtain the shots in each video to form a shot sequence S = [s1, s2, ..., s n ], sampling key frames from the shots, each video corresponds to a shot sequence; Step S2: construct a scene boundary detection neighbor network; Step S21: For a shot sequence, use a visual encoder to extract features from the key frames corresponding to the shot sequence to obtain the features of each shot. The features of all shots constitute a feature sequence X = [x1, x2, ..., x n ], where one of the features x i Corresponding to a lens s i , n is the length of the lens and feature sequence; Step S22: For the shot sequence, construct a feature graph G F ,G F The nodes of G are different lenses. F The edge E F is the similarity A between different shots NPS , the A NPS Including A NPS and A NNS , where A NPS is the jth shot s j With the i-th lens s i Neighbors Lenses g Similarity A collection of NNS is the i-th lens s i Neighbors Lenses g With the jth lens s j Neighbors Lenses h Similarity The set of i,j≤n, and i≠j; Step S23: The obtained A NPS Send it to the graph convolutional network to get the sequence feature X FG , With the i-th lens s i correspond; Step S24: Perform the operations of S21-S23 on the M videos to obtain the sequence feature X of each video. FG ; Step S25: For obtaining sequence feature X FG , construct a time graph G T ,G T The nodes of G are different lenses. T The edge E T is the similarity B between different shots NPS , the B NPS Including B CPS and B TCS , where B CPS yes and The similarity between The collection of B TCS is the contextual similarity between the j-th shot and the neighbors of the i-th shot A collection of; If the jth shot is temporally between the ith shot and one of its neighbor shots, then calculate and The similarity between Otherwise the similarity is -∞; Step S26: The obtained B NPS Send it to the graph convolutional network to get the time feature X TG ; Step S27: Perform the operations of S25-S26 on the M videos to obtain the time feature X of each video. TG ; Step S28: The X corresponding to each video segment TG Input the multi-layer perceptron and output the confidence of n shots. A confidence of 1 indicates that it is a boundary, and a confidence of 0 indicates that it is not a boundary. Step S3: training the scene boundary detection neighbor network, calculating the loss, and updating the parameters of the scene boundary detection neighbor network according to the loss, and obtaining the optimal scene boundary detection neighbor network when the loss no longer decreases; Step S4: Detection: Obtain a shot sequence S′ from the video clip to be detected through step S1, input S′ into the optimal scene boundary detection neighbor network, and output the confidence that each shot in the shot sequence S′ is a scene boundary.
2. The video scene boundary detection method based on neighbor network as claimed in claim 1, characterized in that: In step S22, A is calculated. NPS The method is: when the lens s j In the lens i centered in a time window of length l and with lens s i If there are not enough shots in the time window among the most similar first k shots, they are filled with zero vectors, and the cosine similarity is used to calculate the similarity between the shots: Among them, x i Indicates lens i The corresponding feature, x j Indicates lens j The corresponding features, Indicates the lens i As the center, the time window of length l, when the shot s j If the above conditions are not met, the lens s i With lens j The similarity is -∞.
3. The video scene boundary detection method based on neighbor network as claimed in claim 1, characterized in that: In step S23, the calculation The method is: in and represents the learnable matrix, represents a learnable weight ratio, Indicates the lens i The time window is centered at a length of l and excludes shot s j , x j Indicates lens j Corresponding features; In step S23, the calculation The method is: in Represents a learnable weight ratio, x h Indicates lens j The time window with length l as the center does not contain shot s i The corresponding features of other lenses.
4. The video scene boundary detection method based on neighbor network as claimed in claim 1, characterized in that: In step S25, calculate B CPS The method is to use a lens s j In the lens i With lens i Among the neighbor nodes, the cosine similarity is used to calculate the similarity score between the shots: in, Indicates lens i The corresponding sequence features are Indicates lens j The corresponding sequence features are Indicates the lens i As the center, the time window of length l, when the shot s j When the above conditions are not met, the similarity is -∞.
5. The video scene boundary detection method based on neighbor network as claimed in claim 1, characterized in that: In step S25, the calculation The method is: in represents the learnable matrix, g∈T r (i),h∈T r (j), T r (i) represents a time window with a length of r and centered at the i-th shot. If the window does not meet the length requirement, it is filled with boundary shots. In step S25, the calculation The method is: in, Indicates lens i The corresponding sequence features are Indicates lens j The corresponding sequence features.
6. The video scene boundary detection method based on neighbor network as claimed in claim 1, characterized in that: When S3 calculates the loss, if M videos have no labels, the loss is L p : The feature sequence X uses the dynamic time adjustment algorithm to obtain the pseudo boundary X p , the self-supervised scene boundary detection neighbor network is trained using binary cross entropy loss, as shown in the following formula: in is the boundary predicted by the network.
7. The video scene boundary detection method based on neighbor network as claimed in claim 1, characterized in that: When S3 calculates the loss, if M videos have labels, the loss is L f : Use binary cross entropy loss to train a supervised scene boundary detection neighbor network as shown in the following formula: in is the boundary predicted by the network, y i represents the true label of the i-th shot.
