Video sampling method and system based on motion vector clustering bidirectional matching

Through the video sampling method based on motion vector clustering and bidirectional matching, the performance bottleneck problem of decoding and preprocessing steps in video data analysis is solved, and key video frames are efficiently screened, significantly reducing resource consumption and time costs, and improving the efficiency of video analysis. and accuracy.

CN118609026APending Publication Date: 2024-09-06SHANDONG UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410753776.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-12
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

Existing video data analysis systems have performance bottlenecks in the video decoding and preprocessing steps. The traditional uniform frame sampling method cannot flexibly adapt to dynamic changes in the video, resulting in low information utilization efficiency.

Method used

A video sampling method based on two-way matching of motion vector clustering is used to extract the motion vectors of video frames, perform clustering processing, and segment the video frames into segments with target objects and without target objects according to the matching of motion vectors. Only for segments with target objects, Fragments of the target object are analyzed by deep neural networks to reduce unnecessary calculations.

Benefits of technology

It significantly reduces the resource consumption and time cost of video decoding and DNN inference, improves video analysis efficiency, maintains analysis accuracy, and achieves both cost and efficiency improvements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118609026A
    Figure CN118609026A
Patent Text Reader

Abstract

The invention discloses a video sampling method and system based on motion vector clustering bidirectional matching, and the method comprises the steps: extracting a motion vector from each frame of image of a to-be-sampled video; performing clustering processing on the motion vectors to obtain a plurality of clusters of each frame of image; for each class cluster of the current frame image, respectively searching a class cluster of which the distance is less than a set threshold value from the previous frame image and the next frame image, if the class cluster of which the distance is less than the set threshold value is found, indicating that the class cluster of the current frame is successfully matched with the class cluster of the adjacent frame, otherwise, indicating that the matching fails; based on the frame number of disappearance of the target object and the frame number of appearance of the target object, the video to be sampled is segmented into a plurality of video segments, and the video segments are divided into segments with the target object and segments without the target object; and taking the target object fragment as a sampling result, and inputting the sampling result into a trained target detection network to obtain a video content identification result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of video sampling, and in particular to a video sampling method and system based on motion vector clustering bidirectional matching. Background Art

[0002] Existing video data analysis systems mainly use DNN target detection algorithms to identify objects of interest to users in video frames. To speed up the video analysis process based on deep neural networks (DNNs), existing strategies tend to use model concatenation or model slimming techniques to remove frames that do not contain target objects, thereby reducing the number of frames for subsequent DNN reasoning.

[0003] Given the temporal coherence of object content between video frames, uniform frame sampling technology is widely used to accelerate this process. This technology selects frames at fixed intervals in the video stream to ensure that data sampling across time segments is both consistent and regular, effectively utilizing inter-frame redundancy, reducing computing requirements, and maintaining reasonable tracking of video dynamics.

[0004] However, research shows that even with the above measures, the decoding and preprocessing steps of the video still become the performance limiting link in the entire end-to-end analysis process. Although model concatenation and slimming can reduce the cost of DNN inference, they fail to bypass the need for full-frame decoding, and therefore it is difficult to reduce the resource consumption introduced by decoding and preprocessing.

[0005] The dynamic nature of video content, including irregular static segments and active changes, further complicates this challenge. The irregular alternation of dynamic and static scenes in videos means that traditional uniform sampling methods, although reducing the number of frames processed by DNNs, cannot flexibly adapt to the dynamic changes inherent in the video by using a constant sampling interval, resulting in inefficient information utilization.

[0006] Therefore, exploring methods that can intelligently identify the rhythm of video content changes and dynamically adjust sampling strategies is crucial to further improve the efficiency of video analysis. This requires new solutions to not only consider how to reduce unnecessary calculations, but also to intelligently utilize the temporal correlation and content diversity of video sequences to achieve a higher level of efficiency and accuracy balance. Summary of the invention

[0007] In order to solve the deficiencies of the prior art, the present invention provides a video sampling method and system based on motion vector clustering bidirectional matching;

[0008] On the one hand, a video sampling method based on motion vector clustering bidirectional matching is provided, comprising:

[0009] Extract motion vectors from each frame of the sampled video;

[0010] Perform clustering on the motion vectors to obtain several clusters for each frame of the image;

[0011] For each cluster of the current frame image, search for clusters whose distance is less than the set threshold from the previous frame image and the next frame image respectively. If a cluster whose distance is less than the set threshold is found, it means that the cluster of the current frame successfully matches the cluster of the adjacent frame, otherwise it means that the matching fails; if the previous frame matches successfully and the next frame matches unsuccessfully, it is considered that the target object of the current frame disappears in the next frame, and the frame number where the target object disappears is recorded; if the previous frame matches unsuccessfully and the next frame matches successfully, it is considered that the target object appears in the current frame, and the frame number where the target object appears is recorded;

[0012] Based on the frame numbers where the target object disappears and the frame numbers where the target object appears, the video to be sampled is divided into several video segments, and the video segments are divided into segments with target objects and segments without target objects; the segments with target objects are used as sampling results and input into the trained target detection network to obtain video content recognition results.

[0013] On the other hand, a video sampling system based on motion vector clustering bidirectional matching is provided, including:

[0014] An extraction module is configured to: extract a motion vector from each frame of the video to be sampled;

[0015] A clustering module is configured to: perform clustering processing on the motion vectors to obtain a plurality of clusters for each frame of the image;

[0016] A matching module is configured as follows: for each cluster of the current frame image, respectively, searching for clusters whose distance is less than a set threshold from the previous frame image and the next frame image; if a cluster whose distance is less than the set threshold is found, it indicates that the cluster of the current frame successfully matches the cluster of the adjacent frame, otherwise it indicates that the matching fails; if the previous frame matches successfully and the next frame matches unsuccessfully, it is considered that the target object of the current frame disappears in the next frame, and the frame number in which the target object disappears is recorded; if the previous frame matches unsuccessfully and the next frame matches successfully, it is considered that the target object appears in the current frame, and the frame number in which the target object appears is recorded;

[0017] The recognition module is configured to: divide the video to be sampled into a plurality of video segments based on the frame numbers where the target object disappears and the frame numbers where the target object appears, wherein the video segments are divided into segments with target objects and segments without target objects; and input the segments with target objects as sampling results into the trained target detection network to obtain video content recognition results.

[0018] On the other hand, there is also provided an electronic device, comprising:

[0019] a memory for non-transitory storage of computer-readable instructions; and

[0020] a processor for executing the computer readable instructions,

[0021] When the computer-readable instructions are executed by the processor, the method described in the first aspect is executed.

[0022] On the other hand, a storage medium is provided, which non-temporarily stores computer-readable instructions, wherein when the non-temporary computer-readable instructions are executed by a computer, the instructions of the method described in the first aspect are executed.

[0023] On the other hand, a computer program product is provided, comprising a computer program, wherein the computer program is used to implement the method described in the first aspect when running on one or more processors.

[0024] The above technical solution has the following advantages or beneficial effects:

[0025] The innovation of the present invention is reflected in the following aspects: In view of the decoding and preprocessing performance bottleneck problems faced by the RGB-based video data analysis optimization strategy, the present invention proposes a dynamic video frame sampling method based on compressed video motion vectors. This process does not require the video data to be fully decoded, reducing the decoding cost of end-to-end video data analysis; the present invention is based on the two-way matching dynamic video frame sampling method of motion vector clustering, which significantly reduces the resource consumption and time cost caused by video decoding and DNN reasoning in end-to-end video content analysis. By intelligently identifying and utilizing the changing pattern of motion vectors between video frames, the present invention can efficiently screen out key video frames for processing while maintaining the analysis accuracy, thereby achieving a dual improvement in cost and efficiency in the field of deep learning-driven video analysis. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] The accompanying drawings in the specification, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.

[0027] Figure 1 This is a schematic diagram of a video data analysis process based on motion vector dynamic sampling according to Embodiment 1;

[0028] FIG2(a) is a schematic diagram of motion vector clustering of the i-1th frame in Example 1;

[0029] FIG2( b ) is a schematic diagram of clustering motion vectors of the i-th frame in Example 1;

[0030] FIG. 2( c ) is a schematic diagram of clustering motion vectors of the i+1th frame in the first embodiment. DETAILED DESCRIPTION

[0031] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present invention belongs.

[0032] The present invention belongs to the field of Video Data Analysis, and focuses on optimizing the performance of target detection technology based on Deep Neural Network (DNN) when processing compressed video data. The invention innovatively introduces a novel strategy, namely a two-way matching dynamic video frame sampling method based on motion vector clustering, which aims to significantly reduce the resource consumption and time cost caused by video decoding and DNN reasoning in end-to-end video content analysis. By intelligently identifying and utilizing the changing pattern of motion vectors between video frames, this method can efficiently screen out key video frames for processing while maintaining analysis accuracy, thereby achieving a dual improvement in cost-effectiveness and analysis efficiency in the field of deep learning-driven video analysis.

[0033] Video data analysis technology, especially through advanced object detection algorithms, has unlocked the ability to automatically identify and extract specific objects from massive video information, greatly expanding our detailed insights into the real world. This innovative approach has been widely integrated into many fields such as security monitoring, intelligent traffic management systems, and business strategy planning, profoundly changing the way we understand and interact. In recent years, the rapid development of deep neural networks (DNNs) has surpassed the accuracy of traditional computer vision algorithms and even human levels in the fields of object detection and image understanding, opening up a new era for automated video data analysis. However, this leap in accuracy comes with a high computational cost. Applying DNNs frame by frame for video parsing inevitably brings significant time delays and high resource consumption, which has become a major obstacle to its large-scale and efficient application. Therefore, exploring how to optimize algorithm efficiency and reduce computational costs without sacrificing analysis quality has become one of the core issues in current video data analysis research.

[0034] Since video data is usually saved in a compressed format, before using DNN to detect objects on video data, the video data must be decoded and then converted into the RGB format for final reasoning through preprocessing steps such as color channel conversion and size scaling. Experiments have confirmed that data decoding and preprocessing become performance bottlenecks in end-to-end object detection reasoning based on DNN.

[0035] In traditional deep neural network (DNN)-based frame-by-frame video analysis or video data processing scenarios based on model cascading and model customization, the application first needs to load the compressed video from the storage medium into the memory, and then fully decode and preprocess the video data to convert it into RGB format video frame data. This series of operations inevitably includes the high cost of video decoding. In addition, in typical DNN-driven video frame analysis using fixed-frequency uniform sampling, due to the constant sampling step size, the dynamic change trend naturally existing in the video frame sequence cannot be effectively utilized to reduce the computing resources required for DNN inference.

[0036] Embodiment 1

[0037] This embodiment provides a video sampling method based on motion vector clustering bidirectional matching;

[0038] The video sampling method based on motion vector clustering bidirectional matching includes:

[0039] S101: extracting a motion vector for each frame of the sampled video;

[0040] S102: performing clustering processing on the motion vectors to obtain a number of clusters for each frame of the image;

[0041] S103: for each cluster of the current frame image, search for clusters whose distance is less than a set threshold from the previous frame image and the next frame image respectively; if a cluster whose distance is less than the set threshold is found, it means that the cluster of the current frame matches the cluster of the adjacent frame successfully, otherwise it means that the matching fails; if the previous frame matches successfully and the next frame matches unsuccessfully, it is considered that the target object of the current frame disappears in the next frame, and the frame number where the target object disappears is recorded; if the previous frame matches unsuccessfully and the next frame matches successfully, it is considered that the target object appears in the current frame, and the frame number where the target object appears is recorded;

[0042] S104: Based on the frame numbers where the target object disappears and the frame numbers where the target object appears, the video to be sampled is divided into a plurality of video segments, wherein the video segments are divided into segments with target objects and segments without target objects; the segments with target objects are used as sampling results and input into the trained target detection network to obtain video content recognition results.

[0043] Furthermore, S101: extracts a motion vector for each frame image of the video to be sampled, wherein the video to be sampled is a compressed video compressed based on the H.264 standard. During the video compression process, the encoder generates a motion vector for each non-key frame, and saves the motion vector in a binary code stream of the compressed video. During the video decoding process, the motion vector is parsed from the binary code stream.

[0044] In a compressed video compressed based on the H.264 standard, three types of frame data are I-frames, P-frames, and B-frames.

[0045] I frame: Intra picture. I frame is usually the first frame of each GOP (a video compression technology used by MPEG). After compression, it serves as a reference point for random access and can be used as a static image.

[0046] P frame: Forward predictive coding frame (predictive-frame), which is a coded image that compresses the amount of transmission data by fully removing the temporal redundant information of the previously coded frames in the image sequence. It is also called a predicted frame.

[0047] B frame: bidirectional interpolated prediction frame, using the previous I frame or P frame and the following P frame as reference frames, "find" the prediction value and two motion vectors of "a certain point" in the B frame, and take the prediction difference and motion vector for transmission. The receiving end "finds (calculates)" the prediction value in the two reference frames based on the motion vector and sums it with the difference to obtain the sample value of "a certain point" in the B frame, thus obtaining a complete B frame.

[0048] In video coding, a key frame (I frame) is an independent frame in a video sequence. It contains complete image information and can be decoded separately. Non-key frames (P frames and B frames) are frames that rely on previous key frames or other non-key frames for encoding. They achieve more efficient compression by recording the differences with previous frames.

[0049] A motion vector is a vector used to describe the motion relationship between video frames. By finding the similarities between adjacent frames, the motion information between video frames is encoded into a motion vector so that the smoothness of the motion can be restored during decoding.

[0050] For example, when video data is compressed and encoded, the encoder generates corresponding motion vectors for each macroblock inside a non-key frame (B frame, P frame), and these motion vectors are stored in the binary code stream of the compressed video. Taking the H.264 video coding standard currently widely used in the industry as an example, its decoding process mainly involves motion vector prediction, entropy decoding and macroblock reconstruction. The motion vector prediction part involves parsing the motion vectors of the video frame macroblocks from the compressed video binary code stream. Experiments show that this part accounts for (7% to 20%) of the overall decoding time.

[0051] Furthermore, the S102: clustering the motion vectors to obtain a plurality of clusters for each frame of the image, wherein the clustering is based on a density-based clustering algorithm.

[0052] The density-based clustering algorithm includes: a core point query stage and a core point promotion stage, and the core point promotion stage is executed in parallel.

[0053] Furthermore, the step S102: clustering the motion vectors to obtain a plurality of clusters for each frame of the image, specifically the clustering processing steps include:

[0054] S102-1: First, set the radius threshold eps and the minimum number of points minPts;

[0055] S102-2: Then, randomly select an unvisited motion vector from the current frame image as the starting point, and explore the points in the neighborhood of the set radius threshold eps. If the number of points in the neighborhood exceeds the minimum number of points minPts, a new cluster is formed, and each cluster center point continues to explore new points in a parallel exploration manner, and adds new points within the neighborhood range to the cluster until no new points are explored;

[0056] S102-3: Next, select the next unvisited motion vector and repeat S102-2 until all motion vectors have been visited;

[0057] S1024: Finally, the cluster information is obtained by dividing the points with the same cluster label into the same cluster.

[0058] Exemplarily, after obtaining the motion vector of the video frame, the present invention uses a density-based clustering algorithm to calculate the clustering density of the video frame motion vector. The clustering algorithm adopts the basic idea of ​​the DBSCAN algorithm and adds parallel optimization. The DBSCAN algorithm is mainly divided into two stages: core point query and core point promotion. The present invention adopts a parallel execution method in the core point promotion stage, and parallel calculation promotes multiple neighboring points of the current core point to achieve the purpose of accelerating the clustering speed. The motion vector clustering strategy adopted by the present invention is implemented using parallelization, and its processing process can be pipelined with subsequent key frame decoding and DNN reasoning and will not become a performance bottleneck for end-to-end reasoning.

[0059] Furthermore, the step S103: for each cluster of the current frame image, searching for clusters whose distance is less than a set threshold from the previous frame image and the next frame image respectively, specifically includes: the distance adopts Euclidean distance; the formula of Euclidean distance is:

[0060]

[0061] Among them, x1, y1 and x2, y2 are the horizontal and vertical coordinates of the centers of the two motion vector clusters respectively.

[0062] Exemplarily, a two-way matching mechanism is used to determine whether a new object appears or disappears in the current frame. The matching process here refers to a cluster of the current frame searching for the cluster with the smallest distance from all clusters in the previous frame and the next frame. When the distance between the cluster with the smallest distance found and the cluster of the current frame is less than a preset threshold, the cluster corresponding to the current frame will be determined to be a successful match.

[0063] There are two special cases: If the cluster in the current frame is successfully matched in the historical frame but fails to match in the subsequent frame, the algorithm considers that the corresponding object in the current frame disappears in the subsequent frame.

[0064] Correspondingly, if the cluster in the current frame fails to match in the historical frame, but successfully matches in the subsequent frame, the algorithm believes that there is a new object in the current frame.

[0065] During the matching process, the frame numbers where the objects appear or disappear are continuously recorded. These frames divide the video into multiple semantically continuous segments, which are used as the final sampling results for DNN reasoning.

[0066] Further, S104: based on the frame numbers where the target object disappears and the frame numbers where the target object appears, the video to be sampled is divided into a number of video segments, wherein the video segments are divided into segments with target objects and segments without target objects; the segments with target objects are used as sampling results and input into the trained target detection network to obtain video content recognition results; wherein the trained target detection network is obtained by training a deep neural network using video images with known target object labels.

[0067] Exemplarily, the deep neural network includes: convolutional neural network (CNN), recurrent neural network (RNN), deep belief network (DBN), deep autoencoder (AutoEncoder) or generative adversarial network (GAN), etc.

[0068] Figure 1 The video data analysis process based on motion vector clustering bidirectional matching sampling proposed by the present invention is shown. Figures 2(a), 2(b), and 2(c) show schematic diagrams of the sampling algorithm proposed by the present invention. Frame i is the current frame, where the motion vector clustering clusters in the red circle are successfully matched in the previous frame, but fail to match in the subsequent frame. The algorithm believes that the object in the current frame has disappeared. The object in the blue circle failed to match in the previous frame, but successfully matched in the subsequent frame. The algorithm believes that a new object has appeared in the current frame.

[0069] Motion vector parallel clustering process: By clustering motion vectors, an approximate estimate of the number of moving objects in the video screen can be obtained without fully decoding the video frame. The clustering process is accelerated through parallel design to reduce additional computing overhead. Dynamic video frame sampling process based on motion vector clustering bidirectional matching: It is mainly divided into two processes: forward matching and backward matching. The frame number obtained by bidirectional matching is sent to the decoder as the final video frame sampling number, and the decoder decodes to obtain the final video frame data for inference.

[0070] The present invention relies on motion vectors to accurately identify and select key video frames by monitoring the changes in the number of clusters of these motion vectors. As the core metadata in the video compression process, the motion vector records the offset of the 16×16 pixel macroblock in each frame of the video relative to the corresponding macroblock position of the reference frame. It is a key factor in achieving efficient inter-frame coding in units of macroblocks and significantly reducing the amount of video data. Compared with conventional video processing techniques that rely on RGB pixel data, this method only requires preliminary decoding to obtain motion vectors, greatly reducing the computational cost. Furthermore, the motion vectors contain the temporal and spatial dynamic characteristics of the video content, so that by analyzing the changes in their cluster distribution, the semantic transformation of the video scene can be keenly captured. This method can not only effectively identify the start and end of the motion trajectory of objects in the video, but also use the clustering results to perform comparison matching of the previous and next frames, accurately diagnose the specific frame position where the object appears or disappears, thereby guiding the system to automatically select the most representative sampling frame to ensure the accuracy and completeness of the video content summary.

[0071] Embodiment 2

[0072] This embodiment provides a video sampling system based on motion vector clustering bidirectional matching, including:

[0073] An extraction module is configured to: extract a motion vector from each frame of the video to be sampled;

[0074] A clustering module is configured to: perform clustering processing on the motion vectors to obtain a plurality of clusters for each frame of the image;

[0075] A matching module is configured as follows: for each cluster of the current frame image, respectively, searching for clusters whose distance is less than a set threshold from the previous frame image and the next frame image; if a cluster whose distance is less than the set threshold is found, it indicates that the cluster of the current frame successfully matches the cluster of the adjacent frame, otherwise it indicates that the matching fails; if the previous frame matches successfully and the next frame matches unsuccessfully, it is considered that the target object of the current frame disappears in the next frame, and the frame number in which the target object disappears is recorded; if the previous frame matches unsuccessfully and the next frame matches successfully, it is considered that the target object appears in the current frame, and the frame number in which the target object appears is recorded;

[0076] The recognition module is configured to: divide the video to be sampled into a plurality of video segments based on the frame numbers where the target object disappears and the frame numbers where the target object appears, wherein the video segments are divided into segments with target objects and segments without target objects; and input the segments with target objects as sampling results into the trained target detection network to obtain video content recognition results.

[0077] It should be noted that the above extraction module, clustering module, matching module and recognition module correspond to steps S101 to S104 in Embodiment 1, and the examples and application scenarios implemented by the above modules and the corresponding steps are the same, but are not limited to the contents disclosed in the above Embodiment 1. It should be noted that the above modules, as part of the system, can be executed in a computer system such as a set of computer executable instructions.

[0078] The description of each embodiment in the above embodiments has different emphases. For parts not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0079] The proposed system can be implemented in other ways. For example, the system embodiment described above is only illustrative, and the division of the modules is only a logical function division. In actual implementation, there may be other division methods, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed.

[0080] Embodiment 3

[0081] This embodiment also provides an electronic device, including: one or more processors, one or more memories, and one or more computer programs; wherein the processor is connected to the memory, and the one or more computer programs are stored in the memory. When the electronic device is running, the processor executes the one or more computer programs stored in the memory so that the electronic device executes the method described in the above embodiment one.

[0082] It should be understood that in this embodiment, the processor may be a central processing unit CPU, and the processor may also be other general-purpose processors, digital signal processors DSP, application-specific integrated circuits ASIC, off-the-shelf programmable gate arrays FPGA or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0083] The memory may include a read-only memory and a random access memory, and provide instructions and data to the processor. A portion of the memory may also include a non-volatile random access memory. For example, the memory may also store information about the device type.

[0084] In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in a processor or an instruction in the form of software.

[0085] The method in the first embodiment can be directly embodied as a hardware processor, or a combination of hardware and software modules in the processor. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware. To avoid repetition, it will not be described in detail here.

[0086] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with this embodiment can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0087] Embodiment 4

[0088] This embodiment further provides a computer-readable storage medium for storing computer instructions. When the computer instructions are executed by a processor, the method described in the first embodiment is completed.

[0089] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A video sampling method based on motion vector clustering and bidirectional matching, characterized in that: include: Extract motion vectors from each frame of the sampled video; Perform clustering on the motion vectors to obtain several clusters for each frame of the image; For each cluster of the current frame image, search for clusters whose distance is less than the set threshold from the previous frame image and the next frame image respectively. If a cluster whose distance is less than the set threshold is found, it means that the cluster of the current frame successfully matches the cluster of the adjacent frame, otherwise it means that the matching fails; if the previous frame matches successfully and the next frame matches unsuccessfully, it is considered that the target object of the current frame disappears in the next frame, and the frame number where the target object disappears is recorded; if the previous frame matches unsuccessfully and the next frame matches successfully, it is considered that the target object appears in the current frame, and the frame number where the target object appears is recorded; Based on the frame numbers where the target object disappears and the frame numbers where the target object appears, the video to be sampled is divided into a plurality of video segments, wherein the video segments are divided into segments with the target object and segments without the target object; The target object segment is used as a sampling result and input into the trained target detection network to obtain a video content recognition result.

2. The video sampling method based on motion vector clustering bidirectional matching as claimed in claim 1, characterized in that: A motion vector is extracted for each frame image of a video to be sampled, wherein the video to be sampled is a compressed video compressed based on the H.264 standard. During the video compression process, the encoder generates a motion vector for each non-key frame and saves the motion vector in a binary code stream of the compressed video. During the video decoding process, the motion vector is parsed from the binary code stream.

3. The video sampling method based on motion vector clustering bidirectional matching as claimed in claim 1, characterized in that: The motion vectors are clustered to obtain a number of clusters for each frame of the image. The clustering is based on a density-based clustering algorithm.

4. The video sampling method based on motion vector clustering bidirectional matching as claimed in claim 3, characterized in that: The motion vectors are clustered to obtain several clusters for each frame of the image. The specific clustering processing steps include: (1) First, set the radius threshold eps and the minimum number of points minPts; (2) Then, randomly select an unvisited motion vector from the current frame image as the starting point, and explore the points in the neighborhood of the set radius threshold eps. If the number of points in the neighborhood exceeds the minimum number of points minPts, a new cluster is formed, and each cluster center point continues to explore new points in parallel, and adds new points within the neighborhood range to the cluster until no new points are explored; (3) Next, select the next unvisited motion vector and repeat (2) until all motion vectors have been visited; (4) Finally, the cluster information is obtained by dividing the points with the same cluster label into the same cluster.

5. The video sampling method based on motion vector clustering bidirectional matching as claimed in claim 1, characterized in that: Based on the frame numbers where the target object disappears and the frame numbers where the target object appears, the video to be sampled is divided into a plurality of video segments, wherein the video segments are divided into segments with the target object and segments without the target object; The target object segment is used as a sampling result and input into a trained target detection network to obtain a video content recognition result; wherein the trained target detection network is obtained by training a deep neural network using video images with known target object labels.

6. The video sampling method based on motion vector clustering bidirectional matching as claimed in claim 1, characterized in that: For each cluster of the current frame image, find clusters whose distance is less than a set threshold from the previous frame image and the next frame image respectively, and the distance adopts Euclidean distance; the formula of Euclidean distance is: Among them, x1, y1 and x2, y2 are the horizontal and vertical coordinates of the centers of the two motion vector clusters respectively.

7. A video sampling system based on motion vector clustering and bidirectional matching, characterized in that: include: An extraction module is configured to: extract a motion vector from each frame of the video to be sampled; A clustering module is configured to: perform clustering processing on the motion vectors to obtain a plurality of clusters for each frame of the image; A matching module is configured as follows: for each cluster of the current frame image, respectively, searching for clusters whose distance is less than a set threshold from the previous frame image and the next frame image; if a cluster whose distance is less than the set threshold is found, it indicates that the cluster of the current frame successfully matches the cluster of the adjacent frame, otherwise it indicates that the matching fails; if the previous frame matches successfully and the next frame matches unsuccessfully, it is considered that the target object of the current frame disappears in the next frame, and the frame number in which the target object disappears is recorded; if the previous frame matches unsuccessfully and the next frame matches successfully, it is considered that the target object appears in the current frame, and the frame number in which the target object appears is recorded; The recognition module is configured to: divide the video to be sampled into a plurality of video segments based on the frame sequence number where the target object disappears and the frame sequence number where the target object appears, wherein the video segments are divided into segments with the target object and segments without the target object; The target object segment is used as a sampling result and input into the trained target detection network to obtain a video content recognition result.

8. An electronic device, comprising: a memory for non-transitory storage of computer readable instructions; as well as a processor for executing the computer readable instructions, Wherein, when the computer-readable instructions are executed by the processor, the method described in any one of claims 1 to 6 is executed.

9. A storage medium characterized by being non-temporary The computer-readable instructions are stored, wherein when the non-transitory computer-readable instructions are executed by a computer, the instructions of the method according to any one of claims 1 to 6 are executed.

10. A computer program product, characterized in that The invention comprises a computer program, which is used to implement the method according to any one of claims 1 to 6 when running on one or more processors.

Citation Information

Cited By

  • Agricultural product video monitoring data compression and storage method based on Internet of Things

    CN121644823A