Video retrieval method, device, equipment and computer-readable storage medium

Through frame sequence extraction and fixed-length feature extraction, the problem of temporal logic judgment in video retrieval is solved, efficient retrieval and similarity sorting of mixed-cut and variable-length videos is achieved, and the effectiveness of video retrieval is improved.

CN114297432BActive Publication Date: 2024-10-22TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110898247.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-05
Publication Date
2024-10-22
Estimated Expiration
2041-08-05

AI Technical Summary

Technical Problem

The existing technology is difficult to judge the temporal logic of mixed-cut videos and variable-length videos in video retrieval, which results in low effectiveness of video retrieval and inability to effectively implement video similarity sorting.

Method used

By extracting the frame sequence of the video to be retrieved, extracting image features, and performing fixed-length feature extraction, the representation features on the video elements are obtained, thereby retrieving similar videos in the video library and avoiding temporal logic judgments.

Benefits of technology

It realizes effective retrieval of normal, chaotic or variable-length videos, improves the effectiveness of video retrieval, and can accurately judge and sort video similarities without the need for temporal logic judgment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114297432B_ABST
    Figure CN114297432B_ABST
Patent Text Reader

Abstract

The present application provides a video retrieval method, device, equipment and computer-readable storage medium; it relates to the field of artificial intelligence and blockchain technology; the method comprises: extracting a frame sequence of a video to be retrieved to obtain a video frame sequence; extracting image features of video frames in the video frame sequence to obtain an image feature sequence; extracting fixed-length features of the image feature sequence to obtain target video features, wherein the target video features are representations of the video to be retrieved on video elements; based on the target video features and the features of the videos in the video library, retrieving similar videos corresponding to the video to be retrieved from the video library. Through the present application, the effectiveness of video retrieval can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to artificial intelligence technology, and in particular to a video retrieval method, apparatus, device and computer-readable storage medium. Background Art

[0002] Video retrieval refers to the use of artificial intelligence technology to determine whether a given video is repeated or identical to other videos. It is widely used in scenarios such as video infringement judgment and similar video recommendation. Video retrieval must first make similarity judgments on the given video and other videos. In related technologies, temporal logic judgments are required to make similarity judgments on videos. However, it is difficult to make temporal logic judgments on mixed and variable-length videos, which makes video retrieval difficult for mixed and variable-length videos, and thus the effectiveness of video retrieval is low. Summary of the invention

[0003] The embodiments of the present application provide a video retrieval method, apparatus, device and computer-readable storage medium, which can improve the effectiveness of video retrieval.

[0004] The technical solution of the embodiment of the present application is implemented as follows:

[0005] The present application provides a video retrieval method, including:

[0006] Extract the frame sequence of the video to be retrieved to obtain a video frame sequence;

[0007] Extracting image features from video frames in the video frame sequence to obtain an image feature sequence;

[0008] Extracting fixed-length features from the image feature sequence to obtain target video features, wherein the target video features are representations of the video to be retrieved on video elements;

[0009] Based on the target video features and the features of the videos in the video library, similar videos corresponding to the video to be retrieved are retrieved from the video library.

[0010] The present application provides a video retrieval device, including:

[0011] A sequence extraction module is used to extract the frame sequence of the video to be retrieved to obtain a video frame sequence;

[0012] An image feature extraction module, used to extract image features from video frames in the video frame sequence to obtain an image feature sequence;

[0013] A fixed-length feature extraction module, used for extracting fixed-length features from the image feature sequence to obtain target video features, wherein the target video features are representations of the video to be retrieved on video elements;

[0014] The video retrieval module is used to retrieve similar videos corresponding to the video to be retrieved from the video library based on the characteristics of the target video and the characteristics of the videos in the video library.

[0015] In some embodiments of the present application, the video frame sequence includes: a plurality of frame sequences, and the image feature sequence includes: a plurality of sub-feature sequences corresponding to the plurality of frame sequences;

[0016] The fixed-length feature extraction module is also used to extract features from each of the multiple sub-feature sequences to obtain multiple characterization features; wherein the characterization features retain the features of different video scenes in the sub-feature sequences and remove the features of the same video scene; based on statistical pooling processing of the multiple characterization features in the channel dimension, a fixed-length pooling feature is obtained; and the target video feature is extracted from the pooling feature.

[0017] In some embodiments of the present application, the fixed-length feature extraction module is also used to determine multiple eigenvalues ​​of each channel from the multiple characterization features; calculate the mean and variance of the multiple eigenvalues ​​of each channel to obtain the feature mean and feature variance corresponding to each channel; concatenate the feature means of each channel to obtain a mean vector, and concatenate the feature variances of each channel to obtain a variance vector; and use the mean vector and the variance vector to splice the fixed-length pooling features.

[0018] In some embodiments of the present application, the sequence extraction module is further used to segment the video to be retrieved using a preset frame interval to obtain multiple frame sequences; and determine the multiple frame sequences as the video frame sequence;

[0019] The image feature extraction module is further used to generate a sub-feature sequence corresponding to each frame sequence using the image features extracted from the video frames of each frame sequence; and determine the multiple sub-feature sequences corresponding to the multiple frame sequences as the image feature sequence.

[0020] In some embodiments of the present application, the videos in the video library include: multiple preset videos; the video retrieval module is also used to calculate the similarity between the target video features and the features of the multiple preset videos to obtain multiple feature similarities; the preset videos corresponding to the largest N feature similarities among the multiple feature similarities are determined as the similar videos.

[0021] In some embodiments of the present application, the video retrieval device further includes: a model training module;

[0022] The model training module is used to obtain training video samples and annotated samples corresponding to the training video samples; the annotated samples are labeled with whether they are the same or similar to the training video samples; training triples corresponding to the training video samples are mined from the training video samples and the annotated samples; and the initial fixed-length feature extraction model is metrically trained using the training triples to obtain a preset-length feature extraction model, which is used to extract fixed-length features from the image feature sequence.

[0023] In some embodiments of the present application, the model training module is also used to use the initial fixed-length feature extraction model to extract fixed-length features for the training frame sequence, positive samples and negative samples in the training triplet, respectively, to obtain training video features, positive sample features and negative sample features; use the distance between the training video features and the positive sample features, and the distance between the training video features and the negative sample features to calculate a first training loss value; use the first training loss value to continuously update the parameters of the initial fixed-length feature extraction model until the training end condition is reached, and obtain the preset fixed-length feature extraction model.

[0024] In some embodiments of the present application, the training video sample includes: a plurality of training frame sequences, and the annotated sample includes: a plurality of similar frame sequences corresponding to the plurality of training frame sequences;

[0025] The model training module is also used to use each training frame sequence and a similar frame sequence corresponding to each training frame sequence to form a positive sample pair corresponding to each training frame sequence. When the corresponding positive sample pairs are determined for the multiple training frame sequences, multiple positive sample pairs are obtained; from the multiple positive sample pairs, excluding the positive sample pairs corresponding to each training frame sequence, the candidate negative sample set corresponding to each training frame sequence is extracted; the feature distance between each training frame sequence and the candidate negative samples in the candidate negative sample set is calculated to obtain the negative sample feature distance set of each training frame sequence; the candidate negative samples corresponding to the smallest N negative sample feature distances in the negative sample feature distance set are used as the negative samples of each training frame sequence; wherein N is a positive integer; the positive sample pairs corresponding to each training frame sequence and the negative samples corresponding to each training frame sequence are used to generate the triples corresponding to each training frame sequence, and the triples corresponding to each training frame sequence are determined as the training triples.

[0026] In some embodiments of the present application, the model training module is also used to use the similarity measurement model to be trained to calculate the similarity between the training video features extracted from the training video samples and the labeled sample features extracted from the labeled samples to obtain the training similarity; calculate the second training loss value based on the labeled labels between the training video samples and the labeled samples, and the training similarity; use the second training loss value to update the parameters of the similarity measurement model to be trained until the training is completed, and obtain a preset similarity measurement model, which is used to calculate the similarity between the target video features and the features of multiple preset videos.

[0027] In some embodiments of the present application, the model training module is also used to obtain a first video and a second video different from the first video; wherein, neither the first video nor the second video has been labeled with similarity; from the first video, a pre-trained positive sample pair with labeled similarity is constructed, and from the second video, a pre-trained negative sample is selected; the pre-trained positive sample pair and the pre-trained negative sample are determined as a pre-training triplet; and the initial similarity measurement model obtained by parameter initialization is pre-trained using the pre-training triplet to obtain the similarity measurement model to be trained.

[0028] In some embodiments of the present application, the model training module is also used to extract an anchor video frame sequence from the first video; to extract a preset number of captured image sequences from the anchor video frame sequence; and to calculate the labeled similarity of the pre-trained positive sample pair including the anchor video frame sequence and the captured image sequence based on the area of ​​the captured images in the captured image sequence, the area of ​​the video frames in the anchor video frame sequence, and a preset loss hyperparameter, to obtain the pre-trained positive sample pair with the labeled similarity.

[0029] In some embodiments of the present application, the model training module is further used to perform storyboard processing on the first video to obtain multiple storyboard segments, and determine the storyboard segments other than the storyboard segments corresponding to the anchor video frame sequence as candidate storyboard segments; wherein the similarity of the video frames in each storyboard segment is greater than a similarity threshold; the distance between each storyboard segment and its adjacent storyboard segments is averaged to obtain a distance mean; when the distance between the first storyboard center feature of the candidate storyboard segment and the second storyboard center feature of the storyboard segment corresponding to the anchor video frame sequence is greater than the distance mean, a target positive sample is screened out from the video frame of the candidate storyboard segment; based on the number of storyboard segments corresponding to the anchor video frame sequence and the number of storyboard segments corresponding to the target positive sample, the labeled similarity of the pre-trained positive sample pair containing the anchor video frame sequence and the target positive sample is calculated to obtain the pre-trained positive sample pair with the labeled similarity;

[0030] The model training module is also used to select the pre-trained negative sample from the second video when the distance between the third storyboard center feature of other storyboard segments obtained by storyboarding the second video and the storyboard center feature of the storyboard segment of the pre-trained positive sample pair is greater than the distance mean.

[0031] The present application provides a video retrieval device, including:

[0032] A memory for storing executable video retrieval instructions;

[0033] The processor is used to implement the video retrieval method provided in the embodiment of the present application when executing the executable video retrieval instruction stored in the memory.

[0034] An embodiment of the present application provides a computer-readable storage medium storing executable video retrieval instructions for causing a processor to execute and implement the video retrieval method provided in the embodiment of the present application.

[0035] The embodiment of the present application has the following beneficial effects: the video retrieval device can first extract the frame sequence of the video to be retrieved to obtain the video frame sequence, then extract the image features of the video frames in the video frame sequence to obtain the image feature sequence, and then extract the fixed-length target video features from the image feature sequence to obtain the representation of the video to be retrieved on the video element, and finally retrieve similar videos from the video library based on the target video features, that is, based on the representation of the video to be retrieved on the video element. In this way, it is possible to determine whether the videos are similar based on the video elements without performing timing logic judgment, so that whether it is a general video with normal timing, a mixed video with chaotic timing, or a variable-length video, it is possible to effectively perform video retrieval, and ultimately improve the effectiveness of video retrieval. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1A It is a schematic diagram of an optional architecture of a video retrieval system provided in an embodiment of the present application;

[0037] Figure 1B is another optional architecture diagram of the video retrieval system provided in the embodiment of the present application;

[0038] Figure 2 is a schematic diagram of the structure of a video retrieval device provided in an embodiment of the present application;

[0039] Figure 3 It is an optional flow chart of the video retrieval method provided in the embodiment of the present application;

[0040] Figure 4 It is an optional flow chart of the video retrieval method provided in the embodiment of the present application;

[0041] Figure 5 It is a schematic diagram of the process of fixed-length feature extraction provided in an embodiment of the present application;

[0042] Figure 6 It is an optional flow chart of the video retrieval method provided in the embodiment of the present application;

[0043] Figure 7 is a schematic diagram of the training process of the similarity measurement model to be trained provided in an embodiment of the present application;

[0044] Figure 8 is a schematic diagram of a pre-trained positive sample pair provided in an embodiment of the present application;

[0045] Fig. 9 is a schematic diagram of generating a pre-trained negative sample from a second video provided in an embodiment of the present application;

[0046] Fig.10 is a schematic diagram comparing pre-trained positive sample pairs and pre-trained negative samples provided in an embodiment of the present application;

[0047] Fig.11 It is a schematic diagram of pre-training the initial similarity measurement model provided in an embodiment of the present application. DETAILED DESCRIPTION

[0048] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.

[0049] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it can be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0050] In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0051] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0052] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.

[0053] 1) Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.

[0054] Artificial intelligence is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics and other technologies. Artificial intelligence software technologies mainly include computer vision technology, speech processing technology, natural language processing technology, as well as machine learning / deep learning, autonomous driving, smart transportation and other major directions.

[0055] 2) Computer Vision (CV) is a science that studies how to make machines "see". To put it more specifically, it refers to using cameras and computers to replace human eyes to identify and measure targets, and further perform image processing to make computer processing into images that are more suitable for human eye observation or transmission to instruments for detection. As an interdisciplinary subject, computer vision studies related theories and technologies, and attempts to establish an artificial intelligence system that can obtain information from images or multi-dimensional data. Computer vision technology usually includes image processing, image recognition, image semantic understanding, image retrieval, OCR, video processing, video semantic understanding, video content / behavior recognition, three-dimensional object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous positioning and mapping, autonomous driving, smart transportation and other technologies, as well as common biometric recognition technologies such as face recognition and fingerprint recognition.

[0056] 3) Machine Learning (ML) is a multi-disciplinary subject that involves probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning and other technologies.

[0057] 4) Image recognition is category-level recognition, which does not consider the specific instance of the object, but only considers the category of the object (e.g., human, dog, cat, bird, etc.) to identify and give the category to which the object belongs. For example, for the recognition task in the large-scale general object recognition open source dataset, it identifies which of the 1,000 categories the object belongs to.

[0058] 5) Pre-training refers to training using a large amount of data that is irrelevant to the final task. The resulting pre-trained model can be applied to the final task after formal training (such as fine-tuning).

[0059] 6) Video similarity sorting,When the task of obtaining similar videos in the video library is,it is necessary to sort the retrieved videos so that the videos at the front are closer to the,similar videos waiting to be found.

[0060] With the research and advancement of artificial intelligence technology, artificial intelligence technology has been studied and applied in many fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, unmanned driving, automatic driving, drones, robots, smart medical care, smart customer service, etc. I believe that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.

[0061] Video retrieval refers to the use of artificial intelligence technology to determine whether a given video is repeated or identical to other videos. It is widely used in scenarios such as video infringement judgment and similar video recommendation. Video retrieval must first make similarity judgments between the given video and other videos. In related technologies, there are mainly two methods to achieve video similarity judgment, namely, judgment based on feature joint temporal logic and judgment based on spatiotemporal convolution.

[0062] When judging based on feature joint temporal logic, the image feature extraction model is used to extract feature sequences from each frame of the video, and then temporal logic is used to judge whether two videos are similar. For example, for N-frame video a and M-frame video b, when min(N,M) / 2 consecutive frames are similar, video a and video b are judged to be similar. It can be seen that temporal logic is needed to judge whether videos are similar based on feature joint temporal logic.

[0063] When judging based on moment convolution, the video to be compared is first clipped into segments of equal length, and the video segment features are extracted for each segment. Since the number of frames of the video segment needs to be fixed during training, it is impossible to handle feature training of videos of unequal lengths. Therefore, it is necessary to perform temporal logic judgment on the video segment features of each video to be compared in order to determine whether the two videos are similar.

[0064] It can be seen that in the related art, the similarity judgment of videos requires temporal logic judgment to be realized. However, it is difficult to perform temporal logic judgment on mixed videos with chaotic time sequence and variable length videos, which makes it difficult to perform video retrieval for mixed videos and variable length videos, that is, it is difficult to ensure effective video retrieval for mixed videos and variable length videos, so the effectiveness of video retrieval is low.

[0065] In addition, the video similarity judgment in the related art can only determine whether two videos are similar, but cannot determine the degree of similarity between the two videos. Therefore, the video similarity ranking cannot be effectively implemented, and it is difficult to obtain the video that is closest to the given video.

[0066] The embodiments of the present application provide a video retrieval method, apparatus, device, and computer-readable storage medium, which can expand the scope of application of video retrieval. The following describes an exemplary application of the video retrieval device provided by the embodiments of the present application. The video retrieval device provided by the embodiments of the present application can be implemented as a terminal, a server, or a device cluster composed of a server and a terminal. The following describes an exemplary application when the video retrieval device is implemented as a server.

[0067] See also Figure 1A , Figure 1A FIG. 1 is an optional schematic diagram of the architecture of the video retrieval system provided in the embodiment of the present application. Figure 1A In the video retrieval system 100, the terminal 400 is connected to the server 200 via the network 300. The network 300 may be a wide area network or a local area network, or a combination of the two.

[0068] The terminal 400 is used to upload the video to be retrieved to the server 200. The terminal 400 responds to the user's operation in the graphical interface 410, generates the video to be retrieved, and sends the video to be retrieved to the server 200 through the network 300.

[0069] The server 200 is used to extract a frame sequence of the video to be retrieved to obtain a video frame sequence; extract image features of the video frames in the video frame sequence to obtain an image feature sequence; extract fixed-length features of the image feature sequence to obtain target video features, wherein the target video features are representations of the video to be retrieved on video elements; based on the target video features and features of videos in the video library, similar videos corresponding to the video to be retrieved are retrieved from the video library to achieve video retrieval.

[0070] The server 200 is also used to send similar videos to the terminal 400, and the terminal 400 displays similar videos on the graphical interface 410 to prompt the user to understand whether there is an infringement risk in the video to be retrieved, or to prompt the user to modify the video to be retrieved.

[0071] In some embodiments, the server 200 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal 400 may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart TV, a smart watch, a car terminal, a smart home, etc., but is not limited thereto. On the terminal, a client is provided, for example, a video client, a browsing client, an information stream client, an education client, and the like. The terminal and the server may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present invention.

[0072] The present application embodiment can also be implemented through blockchain technology, see Figure 1B , Figure 1B It is another optional architecture diagram of the video retrieval system provided in the embodiment of the present application. Figure 1B In the video retrieval system 100, the video to be retrieved, the target video features and similar videos are uploaded to the chain through the server 200, so that the video to be retrieved, the target video features and similar videos can be recorded, and the records cannot be tampered with.

[0073] In some embodiments, the server 200 can join the blockchain network 700 and become a node therein. The types of blockchain networks 700 are flexible and diverse, for example, they can be any of a public chain, a private chain, or a consortium chain. Taking the public chain as an example, any electronic device of a business entity can access the blockchain network 700 without authorization to serve as a consensus node of the blockchain network 700. For example, the terminal 400 is mapped as a consensus node 700-1 in the blockchain network 700 to reach a consensus when putting metadata on the chain.

[0074] Taking the blockchain network 700 as an alliance chain as an example, the terminal 400 can access the blockchain network 700 and become a node after obtaining authorization. The server 200 extracts the frame sequence of the video to be retrieved to obtain a video frame sequence; extracts the image features of the video frames in the video frame sequence to obtain an image feature sequence; extracts the fixed-length features of the image feature sequence to obtain the target video features; retrieves the similar video corresponding to the video to be retrieved from the video library based on the target video features and the features of the videos in the video library. At the same time, the server 200 sends the video to be retrieved, the target video features and the similar videos to the blockchain network 700 for consensus. When the consensus is passed, the blockchain network 700 will allocate new blocks for the video to be retrieved, the target video features and the similar videos, write the video to be retrieved, the target video features and the similar videos into the new blocks, and add the new blocks to the end of the blockchain.

[0075] See also Figure 2 , Figure 2 is a schematic diagram of the structure of a video retrieval device provided in an embodiment of the present application, Figure 2 The video retrieval device 500 shown includes: at least one processor 510, a memory 550, at least one network interface 520 and a user interface 530. The various components in the video retrieval device 500 are coupled together via a bus system 540. It is understood that the bus system 540 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 540 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 540 is not described in detail. Figure 2 Various buses are labeled as bus system 540 .

[0076] The processor 510 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0077] The user interface 530 includes one or more output devices 531 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 530 also includes one or more input devices 532, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.

[0078] The memory 550 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, etc. The memory 550 may optionally include one or more storage devices that are physically remote from the processor 510.

[0079] The memory 550 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 550 described in the embodiments of the present application is intended to include any suitable type of memory.

[0080] In some embodiments, the memory 550 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.

[0081] Operating system 551, including system programs for processing various basic system services and performing hardware-related tasks, such as framework layer, core library layer, driver layer, etc., for implementing various basic services and processing hardware-based tasks;

[0082] A network communication module 552, for reaching other computing devices via one or more (wired or wireless) network interfaces 520, exemplary network interfaces 520 include: Bluetooth, Wireless Fidelity (Wi-Fi), and Universal Serial Bus (USB);

[0083] a presentation module 553 for enabling presentation of information via one or more output devices 531 (e.g., display screen, speaker, etc.) associated with the user interface 530 (e.g., a user interface for operating peripherals and displaying content and information);

[0084] The input processing module 554 is used to detect one or more user inputs or interactions from one of the one or more input devices 532 and translate the detected inputs or interactions.

[0085] In some embodiments, the video retrieval device provided in the embodiments of the present application can be implemented in software. Figure 2A video retrieval device 555 stored in a memory 550 is shown, which may be software in the form of a program or plug-in, including the following software modules: a sequence extraction module 5551, an image feature extraction module 5552, a fixed-length feature extraction module 5553, a video retrieval module 5554, and a model training module 5555. These modules are logical and can therefore be arbitrarily combined or further split according to the functions implemented.

[0086] The functions of each module will be described below.

[0087] In other embodiments, the video retrieval device provided in the embodiments of the present application can be implemented in hardware. As an example, the video retrieval device provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the video retrieval method provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs) or other electronic components.

[0088] Exemplarily, an embodiment of the present application provides a video retrieval device, including:

[0089] A memory for storing executable video retrieval instructions;

[0090] The processor is used to implement the video retrieval method provided in the embodiment of the present application when executing the executable video retrieval instruction stored in the memory.

[0091] Below, the video retrieval method provided in the embodiment of the present application will be described in combination with the exemplary application and implementation of the video retrieval device provided in the embodiment of the present application.

[0092] See also Figure 3 , Figure 3 FIG. 1 is an optional flow chart of the video retrieval method provided in the embodiment of the present application. The video retrieval device method provided in the embodiment of the present application can be executed by the video retrieval device. Figure 3 The steps shown are explained.

[0093] S101. Extracting a video frame sequence from a video to be retrieved to obtain a video frame sequence.

[0094] The embodiment of the present application is implemented in the scenario of performing similar video retrieval on a video, for example, performing video retrieval on a remixed video uploaded by a user to determine whether the remixed video uploaded by the user infringes upon copyright, or performing video retrieval on a video that the user has watched to recommend similar videos to the user, etc. In the embodiment of the present application, after obtaining the video to be retrieved, the video retrieval device will first extract a frame sequence from the video to be retrieved, thereby obtaining a frame sequence, or multiple different frame sequences, and the extracted frame sequences are collectively referred to as video frame sequences.

[0095] In the embodiment of the present application, the video retrieval device can extract a video frame sequence by extracting a fixed-length frame sequence from the video to be retrieved. More specifically, the video retrieval device can extract a plurality of different frame sequences from the video to be retrieved at a preset time interval, and use these different frame sequences to form a video frame sequence, and each time a frame sequence is extracted, a preset number of continuous video frames are extracted from the video to be retrieved.

[0096] The video retrieval device can also extract a single video frame from the video to be retrieved at a preset time interval, and use the extracted video frames to form a video frame sequence to achieve the extraction of the frame sequence of the video to be retrieved. For example, a video frame is extracted from the video to be retrieved every 1 second until the frame extraction of the video to be retrieved is completed, and multiple video frames are obtained, and the extracted multiple video frames are arranged in time order to obtain a video frame sequence.

[0097] It should be noted that the video to be retrieved may include a variable-length video or a fixed-length video. When the video to be retrieved includes a variable-length video, the video retrieval device extracts the frame sequence by extracting a fixed-length frame sequence from the video to be retrieved, or extracts the frame sequence by extracting a single video frame from the video to be retrieved at preset intervals, thereby obtaining a variable number of frame sequences or a variable number of video frames, so that the length of the composed video frame sequence is variable, and further, the length of the video frame sequence is positively correlated with the duration of the video to be retrieved.

[0098] Correspondingly, when the video to be retrieved includes a fixed-length video, the video retrieval device will obtain a fixed-length video frame sequence for the video to be retrieved.

[0099] It is understandable that the video to be retrieved can be a mixed video or a shredded video produced by a user, for example, a video pieced together from clips edited from a TV series, etc., or it can be a video produced by a professional producer, such as a movie, a TV series, etc., which is not limited to the embodiments of the present application.

[0100] S102: extracting image features from video frames in a video frame sequence to obtain an image feature sequence.

[0101] After extracting the video frame sequence, the video retrieval device will extract image features from each of the video frames in the video frame sequence, and then compose an image feature sequence using the image features extracted from each video frame.

[0102] It should be noted that when the video to be retrieved is a variable-length video, the length of the video frame sequence is positively correlated with the duration of the video to be retrieved. Thus, the number of video frames in the video frame sequence is also positively correlated with the duration of the video to be retrieved. This will make the length of the image feature sequence positively correlated with the duration of the video to be retrieved.

[0103] Correspondingly, when the video to be retrieved is a fixed-length video, the length of the video frame sequence is also fixed, so that the number of video frames in the video frame sequence does not change, and thus, the length of the image feature sequence is also a fixed value.

[0104] In some embodiments, when a video frame sequence includes multiple frame sequences, the video retrieval device extracts image features for the video frames in each frame sequence, and then groups the image features in the same frame sequence into a sub-feature sequence corresponding to the frame sequence, and uses multiple sub-feature sequences corresponding to multiple frame sequences to form an image feature sequence.

[0105] In other embodiments, when the video frame sequence includes only one frame sequence, the image feature sequence is composed of image features of the video frames in this frame sequence.

[0106] It is understandable that the image features in the image feature sequence can be feature matrices, feature vectors, or feature values, which are not limited in this application. The video retrieval device can extract image features from video frames in the video frame sequence through a trained deep learning model to obtain an image feature sequence, or can extract image features such as color features and texture features from video frames to obtain an image feature sequence.

[0107] S103: extract fixed-length features from the image feature sequence to obtain target video features.

[0108] After obtaining the image feature sequence, the video retrieval device will extract fixed-length features from the image feature sequence, regardless of whether the image feature sequence is variable-length or fixed-length, thereby obtaining fixed-length target video features. In other words, even for videos to be retrieved of different lengths, fixed-length features can be used to represent them for subsequent retrieval.

[0109] It should be noted that the video frames in the video frame sequence will inevitably contain the video elements in the video to be retrieved, so the image feature sequence obtained by the video retrieval device also includes the representation of the video elements of different video frames. In this way, the video retrieval device extracts fixed-length features from the image feature sequence, and in essence obtains the representation of the video to be retrieved in terms of video elements. That is to say, in the embodiment of the present application, the target video feature is the representation of the video to be retrieved in terms of video elements.

[0110] It is understandable that the video retrieval device can extract fixed-length features by inputting the image feature sequence into a preset length feature extraction model. The video retrieval device can also extract fixed-length features by performing statistical processing on the image feature sequence, for example, obtaining the mean and variance of each channel. Of course, the video retrieval device can also extract fixed-length features from the image feature sequence in other ways, which is not limited in this application.

[0111] Furthermore, the preset length feature extraction model is also trained using labeled data. In some embodiments, the preset length feature extraction model can be trained using only the commonly used gradient back propagation method. In other embodiments, in order to enable the preset length feature extraction model to distinguish the features of different types of videos in the feature space when extracting features, for example, mapping the features of the same type of videos to the same area of ​​the feature space, so that the features of different types of videos are far apart, the video retrieval device can also train the preset length feature extraction model based on metric learning, which is not limited in this application.

[0112] S104: Retrieve similar videos corresponding to the video to be retrieved from the video library based on the target video features and the features of the videos in the video library.

[0113] After the video retrieval device obtains the target video features, it will undoubtedly clarify the situation of the video to be retrieved in terms of video elements. When the video retrieval device retrieves similar videos from the video library based on the target video features, it actually does so from the perspective of the representation of video elements. Therefore, when analyzing video similarity, there is no need to perform timing logic analysis. Therefore, whether it is a mixed video with chaotic timing or a lengthened video, it can determine whether two videos are similar.

[0114] It should be noted that the video retrieval device can calculate the feature distance between the target video features and the features of each video in the video library, and filter out the corresponding similar videos based on the feature distance, or match the features of the videos from the video library to find features that are sufficiently different from the target video features, thereby obtaining similar videos corresponding to the video to be retrieved.

[0115] It can be understood that the video library can refer to a video library on a video platform, for example, a video library on a short video platform composed of short videos uploaded by different users; the video library can also be a locally constructed video library, for example, a video library constructed on the local device of the violation video inspection department, composed of different violation videos, etc., and this application is not limited here.

[0116] In the embodiment of the present application, the video retrieval device can first extract the frame sequence of the video to be retrieved to obtain the video frame sequence, then extract the image features of the video frames in the video frame sequence to obtain the image feature sequence, and then extract the fixed-length target video features from the image feature sequence to obtain the representation of the video to be retrieved on the video element, and finally retrieve similar videos from the video library based on the target video features, that is, based on the representation of the video to be retrieved on the video element. In this way, it is possible to determine whether the videos are similar based on the video elements without performing timing logic judgment, so that whether it is for general videos with normal timing, videos with chaotic timing, or videos with variable length, video retrieval can be effectively performed, which ultimately improves the effectiveness of video retrieval.

[0117] See also Figure 4 , Figure 4 It is an optional flow chart of the video retrieval method provided in the embodiment of the present application. In some embodiments of the present application, the video frame sequence includes: multiple frame sequences, and the image feature sequence includes: multiple sub-feature sequences corresponding to the multiple frame sequences. In this case, the fixed-length features are extracted for the image feature sequence to obtain the target video features, that is, the specific implementation process of S103, which may include: S1031-S1033, as follows:

[0118] S1031. Perform feature extraction on each of the multiple sub-feature sequences to obtain multiple representation features.

[0119] In the embodiment of the present application, the video retrieval device uses a trained, preset-length feature extraction model to extract features from the image features in each sub-feature sequence, thereby realizing secondary feature extraction of the video elements of the video to be retrieved, so as to remove the feature representations of the continuously appearing video scenes in the image dimension and retain the feature representations of different video scenes in the image dimension. That is to say, in the embodiment of the present application, the representation features retain the features of different video scenes in the sub-feature sequence and remove the features of the same video scene.

[0120] It is understandable that the video retrieval device can extract features of the image features in each sub-feature sequence by utilizing a feature extraction module in a preset length feature extraction model to obtain a plurality of representation features.

[0121] In some embodiments, the number of feature extraction modules may be greater than or equal to the number of sub-feature sequences, so that one feature extraction module is responsible for extracting features of one sub-feature sequence to obtain multiple characterization features at the same time. In other embodiments, the number of feature extraction modules may be less than the number of sub-feature sequences, so that the video retrieval device may input the sub-feature sequences into the feature extraction modules in batches, thereby obtaining multiple characterization features one after another.

[0122] It is understandable that the feature extraction module can be composed of multiple convolutional layers stacked together. The convolution kernel size, step size, padding number, number of channels, etc. of each convolutional layer can be set according to actual conditions, and this application does not limit it here.

[0123] S1032. Based on statistical pooling processing of multiple representation features in the channel dimension, a fixed-length pooling feature is obtained.

[0124] Statistical pooling calculates statistical data for different representation features according to the feature values ​​of the channel dimension through the pooling module in the preset length feature extraction model for pooling. For example, for the same channel, the feature values ​​of different representation features in the channel are obtained respectively, and then the statistics of the channel are calculated. After obtaining the statistics of all channels, these statistics are used to generate pooling features.

[0125] It should be noted that when calculating statistical data for each channel separately, the length of the calculation result obtained is independent of the number of eigenvalues ​​involved in the calculation, but is only related to the number of channels that characterize the features. The number of channels is generally set and will not change during the forward calculation process of the model. Therefore, in the embodiment of the present application, the video retrieval device can obtain a pooled feature whose length is independent of the length of the video to be retrieved, that is, the pooled feature is of fixed length.

[0126] It is understandable that statistical data calculation may include variance calculation or mean calculation, which is not limited in the present application.

[0127] S1033. Extract target video features from the pooled features.

[0128] After obtaining the pooled features, the video retrieval device will use the feature learning module in the preset fixed-length feature extraction model to continue to extract features from the fixed-length pooled features. The extracted features are the target video features.

[0129] It can be understood that the feature learning module in the preset length feature extraction model can be a network module composed of one or more fully connected layers, or a network module composed of one or more convolutional layers, and this application does not limit this.

[0130] For example, Figure 5 Schematic diagram of the fixed-length feature extraction process provided by the embodiment of the present application. Figure 5 The video retrieval device first inputs the sub-feature sequences of the video frame sequence 5-1, i.e., the sub-feature sequences corresponding to the frame sequence 5-11 to the frame sequence 5-1n (each frame sequence contains 3 video frames), into the feature extraction module 5-2 of the preset length feature extraction model, i.e., module 5-21 to module 5-2n, so as to use each feature extraction module to extract features from each sub-feature sequence to obtain the representation feature 5-3, i.e., feature 5-31 to feature 5-3n. Then, the video retrieval device performs statistical pooling on the features 5-31 to feature 5-3n through the pooling module 5-4 to obtain the pooled feature 5-5, and then uses the feature learning module 5-6 to extract features from the pooled feature 5-5 to obtain the final target video feature 5-7.

[0131] It should be noted that the structures of the feature extraction module, pooling module and feature learning module in the preset length feature extraction model in the embodiment of the present application can be set according to actual conditions, and the present application does not limit it here.

[0132] Illustratively, Table 1 provides a schematic structure of a preset length feature extraction model.

[0133] Table 1

[0134]

[0135]

[0136] Among them, convolutional layer 1 to convolutional layer 5 constitute the feature extraction module in the preset length feature extraction model; the pooling layer is the pooling module in the preset length feature extraction model; the fully connected layer 1 and the fully connected layer 2 constitute the feature learning module in the preset length feature extraction model. It should be noted that F1 in Table 1 represents the number of image features in the sub-feature sequence, that is, the number of video frames in the frame sequence.

[0137] In the embodiment of the present application, the video retrieval device can first extract features from each sub-feature sequence included in the image feature sequence to remove duplicate features of the same video scene, and then perform statistical pooling processing on the obtained multiple representation features in the channel dimension to obtain fixed-length pooling features, and finally extract the target video features from the pooling features. In this way, the representation of the video to be retrieved on the video element can be obtained, so as to facilitate the subsequent retrieval of similar videos.

[0138] In some embodiments of the present application, based on the statistical pooling processing of multiple characterization features in the channel dimension, a fixed-length pooling feature is obtained, that is, the specific implementation process of S1032 may include: S1032a-S1032d, as follows:

[0139] S1032a. Determine multiple feature values ​​for each channel from the multiple characterization features.

[0140] Since the number of channels is fixed, each characterization feature is composed of its characteristic values ​​in different channels. In the embodiment of the present application, the video retrieval device will first divide each characterization feature according to the channel, so as to obtain the characteristic value of each characterization feature in different channels, and then collect the characteristic values ​​of different characterization features under each channel to obtain multiple characteristic values ​​of each channel.

[0141] It can be understood that the number of feature values ​​of each channel is the same as the number of sub-feature sequences included in the image feature sequence, so that the video retrieval device can obtain feature values ​​of the number of sub-feature sequences for each channel.

[0142] Exemplarily, when the video retrieval device obtains Kvi frame sequences for the video to be retrieved, it also obtains Kvi sub-feature sequences, thereby obtaining Kvi characterization features. Assuming that the number of channels of the extracted characterization features is 512, then for each channel, there are Kvi feature values.

[0143] S1032b, calculating the mean and variance of multiple eigenvalues ​​of each channel to obtain the eigenmean and eigenvariance corresponding to each channel.

[0144] S1032c, concatenating the feature means of each channel to obtain a mean vector, and concatenating the feature variances of each channel to obtain a variance vector.

[0145] The video retrieval device calculates the mean and variance of multiple eigenvalues ​​of each channel, thereby obtaining the eigenvalue mean and eigenvariance of each channel. Then, the video retrieval device uses the eigenvalue of each channel as a vector component, and after splicing, it will obtain a mean vector. Similarly, the video retrieval device uses the eigenvalue of each channel as a vector component, and splices to obtain a variance vector.

[0146] S1032d. Use the mean vector and variance vector to concatenate fixed-length pooling features.

[0147] Finally, the video retrieval device will concatenate the mean vector and the variance vector to obtain the pooled feature. It is understandable that the video retrieval device can concatenate the pooled feature by first concatenating the mean vector and then the variance vector, or by first concatenating the variance vector and then the mean vector. It should be noted that the length of the pooled feature is twice the number of channels.

[0148] Exemplarily, when the number of channels is 512, the video retrieval device calculates the mean and variance of the Kvi eigenvalues ​​of each channel respectively, and 512 means and 512 variances are obtained. After splicing in the above manner, a 1*1024 pooling feature is obtained.

[0149] In an embodiment of the present application, the video retrieval device will first determine multiple feature values ​​for each channel from multiple characterization features, and then calculate the variance and mean of the multiple feature values ​​of each channel, and use the calculated feature mean and feature variance of each channel to splice out a fixed-length pooling feature to facilitate the subsequent extraction of target video features.

[0150] In some embodiments of the present application, at this time, the frame sequence of the video to be retrieved is extracted to obtain the video frame sequence, that is, the specific implementation process of S101 may include: S1011-S1012, as follows:

[0151] S1011 , segment the video to be retrieved using a preset frame interval to obtain multiple frame sequences.

[0152] When the video retrieval device extracts the frame sequence of the video to be retrieved, it first divides the video to be retrieved into multiple frame sequences according to the preset frame interval, wherein the number of video frames in each frame sequence is the same. Thus, for the videos to be retrieved of different lengths, the video retrieval device can obtain different numbers of frame sequences.

[0153] It is understandable that the preset frame interval can be set according to actual conditions, for example, set to 5, or set to 8, etc., and this application does not limit this.

[0154] Exemplarily, when the preset frame interval is set to 9, the video retrieval device can extract 9 consecutive video frames from the video to be retrieved each time as a frame sequence, until the extraction of the video frames to be retrieved is completed, thereby obtaining multiple frame sequences.

[0155] In some embodiments, after two adjacent frame sequences, there may be one frame overlap, there may be multiple frames overlap, or there may be no overlap at all, and this application does not limit this.

[0156] S1012: Determine multiple frame sequences as video frame sequences.

[0157] After obtaining the multiple frame sequences, the video retrieval device will determine the multiple frame sequences as video frame sequences.

[0158] In this case, the image features of the video frames in the video frame sequence are extracted to obtain the image feature sequence, that is, the specific implementation process of S102 may include: S1021-S1022, as follows:

[0159] S1021. Generate a sub-feature sequence corresponding to each frame sequence by using the image features extracted from the video frames of each frame sequence.

[0160] The video retrieval device uses a trained image feature extraction model to extract features from the video frames in each frame sequence, and then organizes the image features of the video frames in each frame sequence into a sequence according to the order of the video frames or in a random order, thereby obtaining a sub-feature sequence corresponding to each frame sequence.

[0161] It is understandable that the structure of the image feature extraction model can be set according to actual conditions, and this application does not limit it here.

[0162] Illustratively, Table 2 provides a structural example of an image feature extraction model.

[0163] Table 2

[0164]

[0165]

[0166] Among them, the network module refers to a module composed of convolutional layers and pooling layers. The network modules are all composed of 3x3 maximum pooling, and the step size of pooling is 2. Group refers to the number of repetitions of the minimum module in a network module. The minimum module is composed of 3 convolutional layers. In different network modules, the settings of convolutional layers are different (for example, the three convolutional layers of the minimum module of network module 1_x are convolutional layers with convolution kernel size 1x1 and 64 channels, convolutional layers with convolution kernel size 3x3 and 64 channels, and convolutional layers with convolution kernel size 1x1 and 256 channels).

[0167] S1022: Determine multiple sub-feature sequences corresponding to multiple frame sequences as image feature sequences.

[0168] After obtaining multiple sub-feature sequences, the video retrieval device will combine the multiple sub-feature sequences together to obtain an image feature sequence.

[0169] In an embodiment of the present application, the video retrieval device can segment the video to be retrieved to obtain multiple frame sequences, thereby extracting image features for the video frames in each frame sequence respectively, and thus obtaining multiple sub-feature sequences corresponding to the multiple frame sequences, thereby obtaining an image feature sequence, so as to facilitate the subsequent extraction of fixed-length features.

[0170] In some embodiments of the present application, the videos in the video library include: a plurality of preset videos. In this case, based on the target video features and the features of the videos in the video library, similar videos corresponding to the video to be retrieved are retrieved from the video library, that is, the specific implementation process of S104 may include: S1041-S1042, as follows:

[0171] S1041. Calculate similarities between features of a target video and features of multiple preset videos to obtain multiple feature similarities.

[0172] When the videos in the video library include multiple preset videos, the video retrieval device calculates the similarity between the target video feature and the feature of each preset video, thereby obtaining the feature similarity corresponding to each preset video.

[0173] It is understandable that the video retrieval device can calculate the L2 distance between the target video feature and the feature corresponding to each preset video to obtain the feature similarity. The video retrieval device can also calculate the cosine similarity between the target video feature and the feature corresponding to each preset video to obtain the feature similarity, which is not limited in this application.

[0174] It should be noted that the target video features and the features of multiple preset videos should be features of the same dimension. For example, when the target video features and the features of multiple preset videos are all feature vectors, then the lengths of these feature vectors should be the same; when the target video features and the features of multiple preset videos are all feature matrices, then the sizes of these feature matrices should be the same.

[0175] Furthermore, the features of the plurality of preset videos may also be extracted using a preset length feature extraction model, so that the feature similarity corresponding to the calculated target video features and the features of the plurality of preset videos will be more accurate.

[0176] S1042: Determine preset videos corresponding to the largest N feature similarities among the multiple feature similarities as similar videos.

[0177] After obtaining multiple feature similarities, the video retrieval device will sort the multiple feature similarities by size to determine the largest N feature similarities. Therefore, the preset videos corresponding to the largest N feature similarities are the videos that are sufficiently similar to the video to be retrieved, and the video retrieval device will use these videos as similar videos to the video to be retrieved.

[0178] It is understandable that the value of N can be set according to actual conditions, for example, set to 1, or set to 3, etc., and this application does not limit this.

[0179] Of course, in other embodiments, the video retrieval device may also determine preset videos whose feature similarity exceeds a similarity threshold as similar videos to the video to be retrieved.

[0180] In an embodiment of the present application, the video retrieval device first calculates the feature similarity between the target video features and the features of the preset video, and then sorts these feature similarities, using the N preset videos closest to the video to be retrieved as similar videos, thereby achieving similar videos based on the measurement of similarity.

[0181] In some embodiments of the present application, before extracting a frame sequence from the video to be retrieved to obtain a video frame sequence, that is, before S101, the method may further include: S105-S107, as follows:

[0182] S105: Obtain training video samples and labeled samples corresponding to the training video samples.

[0183] It should be noted that the labeled samples carry labels indicating whether they are identical or similar to the training video samples.

[0184] S106: mining training triples corresponding to the training video samples from the training video samples and the labeled samples.

[0185] It can be understood that the training triplet includes the training frame sequence in the training video sample, the positive sample of the training frame sequence, and the negative sample in the training frame sequence. Among them, the positive sample refers to the sample that is similar to or related to the training frame sequence, while the negative sample is the sample that is completely unrelated to the training frame sequence.

[0186] S107. Perform metric training on the initial fixed-length feature extraction model using the training triples to obtain a preset fixed-length feature extraction model.

[0187] In an embodiment of the present application, in order to make the distance between features of similar videos closer during forward prediction (i.e., map the features of similar videos to the same area of ​​the feature space) and make the distance between features of videos that have no similarities farther, the video retrieval device trains the initial fixed-length feature extraction model based on metric learning, thereby optimizing the feature representation mapping capability of the initial fixed-length feature extraction model and obtaining a preset fixed-length extraction model having the characteristic of mapping features of similar videos to the same area of ​​the feature space.

[0188] It should be noted that the preset fixed-length feature extraction model is used to extract fixed-length features from the image feature sequence, that is, the model trained using the embodiment of the present application can be used to implement the process of S103.

[0189] In an embodiment of the present application, the video retrieval device can use the training triplets mined from the training video samples and their corresponding annotated samples to implement metric training of the initial fixed-length feature extraction model, thereby obtaining a preset fixed-length feature extraction model with better mapping effect for the features of different videos, so as to improve the accuracy of the target video features in the feature space.

[0190] In some embodiments of the present application, the initial fixed-length feature extraction model is metrically trained using the training triplet to obtain a preset fixed-length feature extraction model, that is, the specific implementation process of S107 may include: S1071-S1073, as follows:

[0191] S1071. Using the initial fixed-length feature extraction model, extract fixed-length features from the training frame sequence, positive samples and negative samples in the training triplet, respectively, to obtain training video features, positive sample features and negative sample features.

[0192] Metric training is based on metric learning for training, and metric learning refers to learning a mapping method so that in the feature space, the distance between the features of the same type of video is closer, and the distance between the features of different types of videos is farther, that is, the features of the same type of video are in the same area. Therefore, in the embodiment of the present application, it is necessary to first use the initial fixed-length feature extraction model to extract features from the training frame sequence, positive samples and negative training respectively, so as to calculate the distance of these features later, and then obtain the loss value based on the distance of these features, so as to optimize the feature mapping ability of the initial fixed-length feature extraction model based on the loss value.

[0193] S1072. Calculate a first training loss value using the distance between the training video feature and the positive sample feature, and the distance between the training video feature and the negative sample feature.

[0194] The video retrieval device calculates the distance between the training video features and the positive sample features, as well as the distance between the training video features and the negative sample features, and then subtracts the distance between the training video features and the positive sample features from the distance between the training video features and the negative sample features, and then accumulates the preset loss hyperparameter on the difference result to obtain the accumulated result, and finally takes the maximum value between the accumulated result and the preset value, and the maximum value obtained is the first training loss value.

[0195] It is understandable that the distance between the training video feature and the positive sample feature can be the L1 distance or the L2 distance, which is not limited in this application. Similarly, the distance between the training video feature and the negative sample feature can be the L1 distance or the L2 distance, which is not limited in this application.

[0196] Exemplarily, the present application embodiment provides a formula for calculating the first training loss value, see formula (1):

[0197] l tri =max(||x a -x p ||-||x a -x n ||+α,0) (1)

[0198] Among them, x a represents the training video features, x p represents the positive sample feature, x n represents the negative sample feature, ||x a -x p || is the distance between the training video features and the positive sample features, ||x a -x n || is the distance between the training sample features and the negative sample features, α is the preset loss hyperparameter, l tri is the first training loss value calculated.

[0199] It should be noted that the preset loss hyperparameter is used to control the distance between the positive sample features and the negative sample features. The size of the preset loss hyperparameter (margin) can be set according to actual needs, for example, set to 10, or set to 5, etc., and this application is not limited here.

[0200] S1073. Continuously update the parameters of the initial fixed-length feature extraction model using the first training loss value until the training end condition is reached to obtain a preset fixed-length feature extraction model.

[0201] After obtaining the sum of the first training loss values, the video retrieval device will use the first training loss value to calculate the parameter adjustment amount of each network layer in the initial fixed-length feature extraction model to adjust the parameters of each network layer of the initial fixed-length feature extraction model until it is determined that the training is ended, and the preset fixed-length feature extraction model is obtained.

[0202] It is understandable that the training end condition may be that the number of training times reaches a certain number, for example, 10,000 times, or it may refer to the convergence of the first training loss value during training, for example, the oscillation amplitude of the first training loss value is less than 0.00001, etc. This application is not limited here.

[0203] In an embodiment of the present application, the video retrieval device first uses an initial fixed-length feature extraction model to extract features from samples in the training triplet, and then uses the distance between the training video features and the positive sample features, and the distance between the training video features and the negative sample features to obtain a first training loss value, and uses the first training loss value to continuously adjust the parameters of the initial fixed-length feature extraction model, and when the training is completed, a preset fixed-length feature extraction model is obtained.

[0204] See also Figure 6 , Figure 6 It is an optional flow chart of the video retrieval method provided by the embodiment of the present application. In some embodiments of the present application, the training video sample includes: multiple training frame sequences, and the annotated sample includes: multiple similar frame sequences corresponding to the multiple training frame sequences. In this case, the training triples corresponding to the training video samples are mined from the training video samples and the annotated samples, that is, the specific implementation process of S106 may include: S1061-S1065, as follows:

[0205] S1061. Utilize each training frame sequence and a similar frame sequence corresponding to each training frame sequence to form a positive sample pair corresponding to each training frame sequence. When corresponding positive sample pairs are determined for multiple training frame sequences, multiple positive sample pairs are obtained.

[0206] S1062: Extract a negative sample set corresponding to each training frame sequence from other sample pairs excluding the positive sample pair corresponding to each training frame sequence from the multiple positive sample pairs.

[0207] The positive sample pairs corresponding to a certain training frame sequence include similar frame sequences that are the same or similar to the training frame sequence, while the contents of other positive sample pairs may not be the same or similar to the training frame sequence. Therefore, the video retrieval device extracts negative samples from all other positive sample pairs except the positive sample pairs corresponding to each training frame sequence, i.e., other sample pairs. Since there are more than one positive sample pairs in other sample pairs, each training frame sequence can obtain more than one negative sample, and these negative samples are combined into a candidate negative sample set.

[0208] It is understandable that when the video retrieval device extracts negative samples from other sample pairs, it can extract an image arbitrarily from the training frame sequence and the similar frame sequence in the other sample pairs, or it can extract an image each from the training frame sequence and the similar frame sequence to obtain a negative sample.

[0209] Exemplarily, when there are bs training frame sequences, the video retrieval device extracts negative samples of x from the remaining bs-1 positive samples for a certain training frame sequence x, thereby obtaining a candidate negative sample set containing bs-1 candidate negative samples for the training frame sequence x.

[0210] S1063 . Calculate the feature distance between each training frame sequence and the candidate negative samples in the candidate negative sample set to obtain a negative sample feature distance set for each training frame sequence.

[0211] S1064. Use the candidate negative samples corresponding to the smallest N negative sample feature distances in the negative sample feature distance set as negative samples for each training frame sequence.

[0212] The video retrieval device calculates the feature distance between each training frame sequence and the candidate negative samples in the corresponding candidate negative sample set, thereby obtaining multiple negative sample feature distances for each training frame sequence, and using these negative sample feature distances to form a negative sample feature distance set. Next, the video retrieval device compares the negative sample feature distances in the negative sample feature distance set, and selects the smallest N negative sample feature distances therefrom, and then determines the candidate negative samples corresponding to the smallest N negative sample feature distances as negative samples for each training frame sequence.

[0213] It is understandable that N is a positive integer. The value of N can be set according to actual conditions, and this application does not limit it here.

[0214] Exemplarily, when N is set to 10, the video retrieval device will select, for each training frame sequence, 10 candidate negative samples corresponding to the negative sample feature distances from each candidate negative sample as the final negative samples.

[0215] S1065. Generate a triplet corresponding to each training frame sequence by using the positive sample pairs corresponding to each training frame sequence and the negative samples corresponding to each training frame sequence, and determine the triplet corresponding to each training frame sequence as a training triplet.

[0216] The video retrieval device forms a triplet of the positive sample pair and a negative sample corresponding to each training frame sequence, so as to obtain a triplet of the number of negative samples for each training frame sequence. When the triplet is determined for all training frame sequences, the video retrieval device will unify these triplet as training triplet.

[0217] In an embodiment of the present application, the video retrieval device first groups each training frame sequence and its corresponding similar frame sequence into a positive sample pair, then mines out a candidate negative sample set for each training frame sequence from other positive sample pairs, and then screens out the negative samples corresponding to each training frame sequence from the candidate negative sample set based on the negative sample feature distance, and combines the positive sample pairs and the negative samples into triplets corresponding to each training frame sequence, thereby obtaining training triplets, so as to facilitate subsequent training using the training triplets.

[0218] In some embodiments of the present application, a training video sample and an annotated sample corresponding to the training video sample are obtained, that is, after S105, the method may further include: S108-S110, as follows:

[0219] S108. Using the similarity measurement model to be trained, similarity is calculated for the training video features extracted from the training video samples and the labeled sample features extracted from the labeled samples to obtain training similarity.

[0220] It should be noted that the similarity measurement model to be trained in the embodiment of the present application can be an initial similarity measurement model that has not been trained after parameter initialization, or it can be a similarity measurement model obtained by pre-training the initial similarity measurement model, and the present application does not limit this.

[0221] It is understandable that the video retrieval device can use a trained preset fixed-length feature extraction model, or an initial fixed-length feature extraction model, or even other feature extraction models to extract video training features and annotated sample features from training video samples and annotated samples, respectively. This application is not limited here.

[0222] S109: Calculate a second training loss value based on the annotation labels between the training video sample and the annotated sample, and the training similarity.

[0223] The annotation label indicates whether the training video sample and the annotation sample are identical or similar, with 1 representing the identical or similar and 0 representing the different or dissimilar. In this way, the video retrieval device can calculate the second training loss value based on the calculated training similarity and the annotation label.

[0224] S110, using the second training loss value to update the parameters of the similarity measurement model to be trained until the training is completed, thereby obtaining a preset similarity measurement model.

[0225] It should be noted that the preset similarity measurement model is used to calculate the similarity between the target video feature and the features of multiple preset videos, thereby obtaining multiple feature similarities.

[0226] It is understandable that the video retrieval device may determine that the training is finished when it is determined that the second training loss value oscillates within a preset range, or when the number of iterations during training reaches a threshold number.

[0227] For example, Figure 7 Schematic diagram of the training process of the similarity measurement model to be trained provided in the embodiment of the present application. Figure 7 The video retrieval device inputs the training video sample 7-1 and the annotated sample 7-2 into a preset fixed-length feature extraction model 7-3 to extract fixed-length features 7-4, and obtains fixed-length training video features 7-5 and annotated sample features 7-6, and then inputs the training video features 7-5 and the annotated sample features 7-6 into the similarity measurement model to be trained 7-7 to calculate the similarity, and combines the obtained training similarity with the similarity label 7-8 to calculate the second training loss value 7-9, and then adjusts the parameters of the similarity measurement model to be trained 7-7 based on back propagation of the second training loss value 7-10 to obtain the preset similarity measurement model.

[0228] In an embodiment of the present application, the video retrieval device can use the similarity measurement model to be trained to predict the training similarity of the extracted training video features and the labeled sample features, combine the training similarity and the labeled label to obtain a second training loss value, and then use the second training loss value to update the parameters of the similarity measurement model to be trained to obtain the final preset similarity measurement model, so as to facilitate the subsequent calculation of the similarity between the target video features and the features of multiple preset videos.

[0229] In some embodiments of the present application, before obtaining the training similarity, i.e., before S108, the method may further include: S111-S114, as follows:

[0230] S111. Obtain a first video and a second video different from the first video.

[0231] It should be noted that neither the first video nor the second video has been annotated for similarity, that is, in the embodiment of the present application, the annotated data is automatically generated using the unannotated video data. This is because a large amount of annotated data is often required during training, but the amount of annotated data is limited, while the amount of unannotated data is often large. Therefore, the automatic generation of annotated data based on unannotated data, even if the annotated data is not necessarily very accurate, is sufficient to deal with problems such as overfitting during pre-training, and the subsequent formal training using a small amount of annotated data can also ensure the performance of the trained preset similarity measurement model.

[0232] S112: constructing pre-trained positive sample pairs with labeled similarities from the first video, and selecting pre-trained negative samples from the second video.

[0233] The pre-trained positive sample pair includes the video frames used in pre-training and video frames similar to the video frames, while the negative samples are video frames that are completely different from the video frames used in pre-training. Therefore, in an embodiment of the present application, the video retrieval device constructs a pre-trained positive sample pair (including the first anchor point sample determined and the positive sample determined based on the anchor point sample) from the same first video, and the pre-trained positive sample pair is annotated with similarity. Among them, the annotated similarity characterizes the similarity between the two samples in the pre-trained positive sample pair. At the same time, due to the differences between the first video and the second video, the video retrieval device will filter out some video frames from the second video as pre-trained negative samples.

[0234] Generally, the two samples in the pre-trained positive sample pair are required to have similarities but not be completely identical. Therefore, in the embodiment of the present application, the video retrieval device can form a pre-trained positive sample pair by screening out two video frame sequences that have intersecting scenes but contain scenes that are not completely identical from the first video. At this time, the video retrieval device can determine the ratio of the number of repeated video frames between the two video frame sequences to the total number of video frames in the two video frame sequences as the labeled similarity of the pre-trained positive sample pair.

[0235] For example, Figure 8 Schematic diagram of the pre-trained positive sample pair provided in the embodiment of the present application. The video retrieval device searches for two different video frame sequences, namely video frame sequence 8-2 and video frame sequence 8-3, which have the same video frames as the video frame sequence 8-1 extracted from the first video, but have different video frames. Among them, there are 2 repeated frames between the video frame sequence 8-1 and the video frame sequence 8-2, and there is only 1 repeated frame between the video frame sequence 8-1 and the video frame sequence 8-3. Therefore, the annotation similarity of the pre-trained positive sample pair composed of the video frame sequence 8-1 and the video frame sequence 8-2 is greater than the annotation similarity of the pre-trained positive sample pair composed of the video frame sequence 8-1 and the video frame sequence 8-3.

[0236] It is understandable that the video retrieval device can arbitrarily extract some continuous video frames or discontinuous video frames from the second video as pre-training negative samples, or it can intercept the extracted video frames and use an image sequence composed of the intercepted images as pre-training negative samples. The embodiments of the present application are not limited here.

[0237] For example, Fig. 9This is a schematic diagram of generating pre-trained negative samples from a second video provided by an embodiment of the present application. The second video has different screen contents from the first video 9-1, and the video retrieval device can use some video frames 9-2 of the second video as pre-trained negative samples 9-3, or intercept these video frames to obtain image sequences 9-4 as pre-trained negative samples 9-5.

[0238] For example, Fig.10 is a schematic diagram comparing the pre-trained positive sample pairs and the pre-trained negative samples provided in the embodiment of the present application. Fig.10 It can be seen that the anchor sample 10-1 in the pre-trained positive sample pair is selected from the first video 10-A, and the positive samples 10-2 and 10-3 corresponding to the anchor sample 10-1 are both in the first video with the same video frames as the anchor sample 10-1, but the video frames are not completely the same. The pre-trained negative sample 10-4 is obtained from the second video 10-B, which is completely different from the anchor sample 10-1.

[0239] S113: Determine the pre-training positive sample pairs and the pre-training negative samples as pre-training triplets.

[0240] S114. Pre-training the initial similarity measurement model obtained by parameter initialization using the pre-training triplet to obtain a similarity measurement model to be trained.

[0241] The video retrieval device combines pre-trained positive sample pairs and pre-trained negative samples into pre-trained triplets, and then uses the pre-trained triplets to pre-train the initial similarity measurement model. After the pre-training is completed, the similarity measurement model to be trained is obtained.

[0242] It is understandable that the video retrieval device can use a Gaussian distribution with a variance of 0.01 and a mean of 0 to initialize parameters to obtain an initial similarity measurement model. During the pre-training process, the learning rate can be set to 0.05, and each video is traversed once as a training stage (epoch), and the learning rate is set to half of the original after every 5 epochs.

[0243] During the pre-training process, the video retrieval device uses the distance between the feature pairs of the two video frame sequences in the pre-training positive sample pair in the pre-training triplet, as well as the distance between the anchor sample of the pre-training positive sample pair (that is, the basis for selecting similar video frames, the first selected video frame sequence) and the pre-training negative sample sequence to calculate the ternary distance loss value, and then uses the ternary distance loss value to update the parameters of the initial similarity measurement model. In this way, the obtained similarity measurement model to be trained can have the ability to measure the similarity of two different videos, so that the preset similarity measurement model finally trained can also measure the similarity, so as to obtain the specific feature similarity for sorting during prediction.

[0244] In some embodiments, the video retrieval device can extract the features of pre-trained positive sample pairs and pre-trained negative sample sequences in the pre-trained triples by pre-setting a length feature extraction model, and pre-train the initial similarity measurement model based on metric learning, so that the results of measuring the similarity of these features using the initial similarity measurement model gradually approach the size of the labeled similarity (obviously the similarity between the pre-trained negative sample sequence and the anchor video frame sequence is less than the similarity threshold).

[0245] For example, Fig.11 It is a schematic diagram of pre-training the initial similarity measurement model provided by an embodiment of the present application. The video retrieval device inputs the anchor sample 11-1 into a preset length feature extraction model 11-2 (including a feature extraction module, a pooling module and a feature learning module), and inputs the positive sample 11-3 and the pre-trained negative sample sequence 11-4 into a preset length feature extraction module 11-5 (the structure is the same as the preset length feature extraction model 11-2) to obtain fixed-length features respectively, and then inputs these fixed-length features into the initial similarity measurement model 11-6, and then uses these fixed-length features to perform triple loss 11-7 to perform back propagation to adjust the parameters of the initial similarity measurement model 11-6. Among them, the positive samples include image sequence 11-31, image sequence 11-32 and image sequence 11-33, and the annotated similarities of the anchor sample 11-1 and these three image sequences are a1, a2 and a3 respectively. For the pre-trained negative sample sequence 11-4, the video retrieval device can calculate the similarity value a4 (generally less than the similarity threshold) between it and the anchor video frame sequence 11-1, or directly determine the similarity a4 to be 0. The preset length feature extraction model 11-2 and the preset length feature extraction model 11-5 share parameters.

[0246] In the embodiment of the present application, the video retrieval device can construct a pre-trained positive sample pair with annotated similarity from the first video, and select a pre-trained negative sample from the second video, and then use the pre-trained positive sample pair and the pre-trained negative sample to form a pre-trained triplet to train the initial similarity measurement model. In this way, the final preset similarity measurement model can have the ability to measure similarity.

[0247] In some embodiments of the present application, constructing a pre-trained positive sample pair with annotated similarity from the first video, that is, a specific implementation process of S112, may include: S1121-S1123, as follows:

[0248] S1121. Extract an anchor video frame sequence from the first video.

[0249] The video retrieval device can extract video frames from the first video at any time of the first video in a manner of extracting a specified number of video frames per second, and the frame extraction ends after a preset time, and the extracted video frames form an anchor video frame sequence. The video retrieval device can also extract a certain number of video frames continuously from any time of the first video to obtain an anchor video frame sequence.

[0250] It is understandable that the specified number can be set according to actual conditions, such as 3, 5, etc. The preset duration can also be set according to actual conditions, such as 3s, 10s, etc., which is not limited in this application.

[0251] Exemplarily, the video retrieval device may extract frames by taking a time period of dt (preset duration) seconds from time t0. Within each second, the video retrieval device extracts 3 frames, thereby obtaining an anchor video frame sequence with a number of 3dt frames.

[0252] S1122: extract a preset number of captured image sequences from the anchor video frame sequence.

[0253] The video retrieval device captures an image frame from each video frame of the anchor point video frame sequence, captures a preset number of captured images from each video frame, and groups the captured images at the same position into a sequence to obtain a screenshot image sequence. In this way, the video retrieval device can obtain a preset number of screenshot image sequences.

[0254] It should be noted that the video retrieval device can capture an image of any area from each video frame as a captured image, or it can capture a captured image from each video frame in a non-overlapping manner such as the upper left, upper right, lower left, or lower right. This application does not limit this.

[0255] It is understandable that the preset number can be set according to actual conditions, for example, set to 4, that is, 4 captured images are captured for each video frame, and can also be set to 2, 5, etc., which is not limited in this application.

[0256] S1123. Based on the area of ​​the cropped image in the cropped image sequence, the area of ​​the video frame in the anchor video frame sequence, and the preset loss hyperparameters, calculate the labeling similarity of the pre-trained positive sample pairs including the anchor video frame sequence and the cropped image sequence to obtain the pre-trained positive sample pairs with labeling similarity.

[0257] After obtaining the captured image sequence, the video retrieval device will calculate the similarity between each captured image sequence and the anchor video frame sequence and the captured image sequence using the area of ​​the captured image inside the captured image sequence, the area of ​​the video frame in the anchor video frame sequence, and the preset loss hyperparameter. Finally, the video retrieval device determines the anchor video frame sequence and the captured image sequence as a pre-trained positive sample pair, so that the similarity between the anchor video frame sequence and the captured image sequence is the labeled similarity of the pre-trained positive sample pair.

[0258] It can be understood that the video retrieval device can determine the ratio of the area of ​​the cropped image to the sum of the area of ​​the video frame in the anchor video frame sequence and the preset loss hyperparameter as the annotation similarity, or can determine the preset loss hyperparameter to the sum of the ratio of the area of ​​the cropped image to the area of ​​the video frame as the annotation similarity, and the present application is not limited here.

[0259] For example, when the preset number is 4, the video retrieval device obtains 4 groups of intercepted image sequences. At this time, if the preset loss hyperparameter is 10, the annotation similarities corresponding to the 4 groups of intercepted image sequences can be expressed as: area1 / areai*10+10, area2 / areai*10+10, area3 / areai*10+10, area4 / areai*10+10. Among them, areai is the area of ​​the video frame in the anchor video frame sequence, and area1 to area4 are the areas of the intercepted images in the 4 groups of intercepted image sequences.

[0260] In an embodiment of the present application, the video retrieval device may first extract some video frames from the first video to form an anchor video frame sequence, and then extract a cropped image sequence from the anchor video frame sequence, and then calculate the annotation similarity based on the area of ​​the video frames in the anchor video frame sequence and the area of ​​the cropped images in the cropped image sequence, so as to facilitate the subsequent use of pre-trained positive samples with annotation similarity to perform metric learning on the initial similarity measurement model.

[0261] In some embodiments of the present application, after extracting the anchor video frame sequence from the first video, before determining the pre-trained positive sample pairs and the pre-trained negative samples as pre-trained triples, that is, after S1121 and before S113, the method may further include:

[0262] S1124. Perform storyboard processing on the first video to obtain a plurality of storyboard segments, and determine the storyboard segments other than the storyboard segments corresponding to the anchor video frame sequence as candidate storyboard segments.

[0263] The video retrieval device divides the first video into a plurality of different storyboard segments, wherein the similarity of the video frames in each storyboard segment is greater than a similarity threshold, that is, the video frames in each storyboard segment are relatively similar. Since the anchor video frame sequence is extracted from a period of time in the first video, the storyboard segments outside the storyboard segments corresponding to the anchor video frame sequence are similar to the pictures in the anchor video frame sequence, but not completely the same, and are suitable for generating positive samples. Therefore, the video retrieval device determines other storyboard segments different from the storyboard segments corresponding to the anchor video frame sequence as candidate storyboard segments for generating positive samples of the anchor video frame sequence (i.e., the above-mentioned anchor samples).

[0264] It is understandable that the video retrieval device can use commonly used storyboard tools (such as pyscenedete ct tool) to storyboard the first video, or it can use artificial intelligence technology to detect storyboard points in the first video and then cut at the storyboard points to achieve storyboarding of the first video.

[0265] S1125. Average the distance between each storyboard segment and its adjacent storyboard segments to obtain a distance mean.

[0266] The video retrieval device determines the adjacent storyboard segments for each storyboard segment. Then, the video retrieval device calculates the storyboard center features of each storyboard segment and the storyboard center features of the adjacent storyboard segments, and performs distance calculation on the storyboard center features of each storyboard segment and the storyboard center features of the adjacent storyboard segments, so as to obtain the distance between each storyboard segment and the adjacent storyboard segments. Finally, the video retrieval device calculates the average value of the distance between each storyboard segment and the adjacent storyboard segments, and obtains the distance mean.

[0267] It should be noted that the storyboard center feature of a storyboard segment can be obtained by averaging each image feature in the storyboard segment. The distance mean is used to distinguish whether the image feature belongs to different storyboard segments, that is, when the distance of the storyboard center feature of a storyboard segment of the image feature is less than the distance mean, then it can be determined that the image feature, that is, the video frame corresponding to the image feature, belongs to the storyboard segment.

[0268] It can be understood that adjacent storyboard segments may refer to the previous storyboard segment of each storyboard segment, may refer to the next storyboard segment of each storyboard segment, or may refer to the previous and next storyboard segments.

[0269] Exemplarily, assuming that a total of K storyboard segments are obtained, and when the adjacent storyboard segment refers to the next storyboard segment, the video retrieval device calculates the distance between each storyboard segment and the next storyboard segment (the last one is not calculated), and a K-1 distance is obtained. Then, the video retrieval device averages these K-1 distances to obtain the distance mean Dsd.

[0270] S1126. When the distance between the first storyboard center feature of the candidate storyboard segment and the second storyboard center feature of the storyboard segment corresponding to the anchor video frame sequence is greater than the mean distance, select a target positive sample from the video frame of the candidate storyboard segment.

[0271] The video retrieval device calculates the central feature for the candidate storyboard segment to obtain the first storyboard central feature, and simultaneously calculates the central feature for the assigned segment corresponding to the anchor video frame sequence, and records the obtained feature as the second storyboard central feature. Next, the video retrieval device calculates the distance between the first storyboard central feature and the second storyboard central feature, and compares the calculated distance with the mean distance, so that when it is determined that the distance between the first storyboard central feature and the second storyboard central feature is greater than the mean distance, the corresponding target positive sample can be screened out for the anchor video frame sequence from the candidate storyboard segment.

[0272] It should be noted that the video retrieval device can randomly select a certain number of video frames from the video frames of the candidate storyboard fragments as target positive samples, or select specific video frames of the candidate storyboard fragments, such as odd frames, as target positive samples, which is not limited in this application.

[0273] S1127. Calculate the labeling similarity of the pre-trained positive sample pair including the anchor video frame sequence and the target positive sample based on the number of storyboard segments corresponding to the anchor video frame sequence and the number of storyboard segments corresponding to the target positive sample, and obtain the pre-trained positive sample pair with labeling similarity.

[0274] The number of storyboard segments corresponding to the anchor video frame sequence refers to the number of storyboard segments involved in the video frames in the anchor video frame sequence. For example, when the video frames in the anchor video frame sequence are provided by two different storyboard segments, the number of storyboard segments corresponding to the anchor video frame sequence is 2. Similarly, the number of storyboard segments corresponding to the target positive sample is the number of storyboard segments involved in the target positive sample. The video retrieval device may use the ratio of the number of storyboard segments corresponding to the anchor video frame sequence to the number of storyboard segments corresponding to the anchor video frame sequence and the number of storyboard segments corresponding to the target positive sample as the annotation similarity.

[0275] Exemplarily, when the number of storyboard segments corresponding to the anchor video frame sequence is k1, and the number of storyboard segments corresponding to the target positive samples is k2, then the annotation similarity can be k1 / (k1+k2).

[0276] Of course, in some embodiments, the video retrieval device may also use the ratio of the number of storyboard segments corresponding to the anchor video frame sequence to the number of candidate storyboard segments to determine the annotation similarity.

[0277] In some embodiments of the present application, selecting a pre-trained negative sample from the second video, that is, the specific implementation process of S112, may also include:

[0278] S1128. When the distance between the third storyboard center feature of other storyboard segments obtained by storyboarding the second video and the storyboard center feature of the storyboard segment of the pre-trained positive sample pair is greater than the distance mean, a pre-trained negative sample is selected from the second video.

[0279] The video retrieval device performs storyboarding on the second video to obtain other storyboard segments, and then calculates the third storyboard center features of the other storyboard segments, performs distance calculation on the third storyboard center features and the storyboard center features of the storyboard centers involved in the pre-trained positive sample pair, and compares the calculated distance with the distance mean. When the distance between the third storyboard center feature and the storyboard center feature of the storyboard center of the pre-trained positive sample pair is greater than the distance mean, the video retrieval device can select any video frame from the second video as a pre-training negative sample, or select a specific video frame in the second video frame, such as the last frame, the first frame, etc., as a pre-training negative sample. In this way, the video retrieval device obtains a pre-training negative sample.

[0280] In the embodiment of the present application, the video retrieval device may first storyboard the first video, and then select the pre-trained positive sample pairs based on the storyboard segments of the first video, and then storyboard the second video, and obtain the pre-trained negative samples based on the storyboard segments of the second video. In this way, the differences between the scenes can be used to obtain the pre-trained positive sample pairs and the pre-trained negative samples.

[0281] The following is an explanation of an exemplary application of the embodiments of the present application in a practical application scenario.

[0282] The embodiment of the present application is implemented in a scenario where a server retrieves and sorts similar videos (similar videos) for a mixed video (video to be retrieved).

[0283] The server generates fixed-length video element representation embeddings (target video features) through variable-length sequence feature learning and statistical pooling in the element extraction model (preset length feature extraction model), and then performs retrieval. During pre-training, the similarity learning of video representations is performed with the help of metric learning (metric training). Before pre-training, the video is cropped according to the same or different video cropping methods to measure the similarity, so that the similarity model (preset similarity measurement model) can have the ability to perform relative sorting.

[0284] First, the server needs to process the variable-length video. For the mixed video Vi, the server first extracts the sub-video frame sequence every F1 field (using the preset frame interval to divide the video to be retrieved). When extracting, the sub-video frame sequences can overlap by 1 frame, not overlap, or overlap by multiple frames. Assuming that Kvi sub-video sequences (multiple frame sequences) are obtained, the image feature sequences corresponding to these sub-video sequences are input into the element extraction model.

[0285] The input of the server to the first convolutional layer of the element extraction model is the embedding (sub-feature sequence) of F1 consecutive image frames, where F1 is the length of the embedding, which is the frame length processed each time by the extraction module of the element extraction model (the feature extraction module of the preset length feature extraction model). If 9 frames are processed each time, the input is 9*2048 (1*2045 is the embedding of a single video frame output). After the input is learned through convolutional layers 1 to 5 of the model shown in Table 1, a 9*512 feature space is obtained (1*512 for 1 frame). During the convolution process, if the padding is not increased, the output will be narrowed by 2 elements after each convolution. If there is a lot of video content, the feature dimension can be expanded, for example, to 2048. Assuming that the 9*2048 features are regarded as image representation values ​​in the 2048 image feature spaces at different times, the element extraction model performs secondary extraction of the information through multi-layer convolution, which removes the continuously appearing feature representations (image dimension features of the same video scene) and retains different representations (image dimension representations of different previous and next scenes).

[0286] In the pooling layer (pooling module) of the element extraction model, unlike the general mean or maximum value, the server first counts the 9*512 feature vectors (multiple representation features) of the output Kvi sub-video sequences, that is, Kvi feature values ​​(multiple feature values ​​for each channel) are evenly distributed in 512 channels. During the pooling process, the server obtains the mean and variance of the Kvi feature values ​​for each channel, and finally obtains 512 means mean_vi and 512 variances std_vi (the feature mean and feature variance corresponding to each channel), which represent the feature mean vector (mean vector) and feature variance vector (variance vector) of the video VI under 512 channels. Then, the server splices it to obtain 1*1024 [mean_vi, std_vi] (using the mean vector and variance vector to splice the fixed-length pooling feature). At this point, a fixed-length video overall element description vector is generated, which depends only on the number of channels and has nothing to do with the length of the input video.

[0287] For the 1*1024 fixed-length features generated above, the final embedding representation of the video Vi is learned (the target video features are extracted from the pooled features) through a fixed-length network (feature learning module) composed of two fully connected layers for subsequent matching.

[0288] During the model training process, the server first initializes the parameters of the model and similarity measurement model shown in Table 1, and prepares video similar sample pairs (training video samples, and labeled samples corresponding to the training video samples). This scheme adopts metric learning, takes similar sample pairs as input, and mines the sample (bs) pairs in each batch to obtain triplets: for a certain sample x (each training frame sequence), from the remaining bs-1 sample pairs (multiple positive sample pairs excluding other sample pairs of positive sample pairs corresponding to each training frame sequence), randomly select an image for each pair (extract the candidate negative sample set corresponding to each training frame sequence), calculate the distance with sample x, sort them from small to large according to the distance (negative sample feature distance set), take the first 10 (smallest N negative sample feature distances) corresponding samples as negative samples, and form triplets with the positive sample pairs in x, so each sample generates 10 triplets, and the entire batch obtains 10*bs triplets.

[0289] The server treats all M sample pairs as a training batch, with bs samples as a training batch, for a total of M / bs matches. For each batch, the model is forward calculated and the parameters are updated. After M / bs updates, an epoch is completed, with a total of K epochs. Or when the average loss of 10 consecutive epochs does not decrease (reaching the training end condition), the training ends and the element extraction model is obtained.

[0290] When the model is forward, the server calls the initial model (initial fixed-length feature extraction model) to perform forward calculations on the input image to obtain the prediction result em (training video features), and calculates the triplet loss (tripletloss) using em. The calculation method is shown in formula (1). When the model parameters are updated, the loss is used to calculate the gradient candidate, and the update of all model parameters is obtained, and the parameters are updated. The server uses a learning rate of 0.005. After each round of learning, the gradient is obtained by the loss feedback, and the network weights are updated according to the learning rate.

[0291] The similarity ranking model needs to go through pre-training (preset similarity measurement model) and formal training. During pre-training, the server uses prior knowledge to obtain similarity, and does not require manually annotated video pairs to participate in training, thus saving annotation costs.

[0292] First, the server needs to prepare positive and negative sample pairs (a, p, n).

[0293] The server can generate equal-length positive sample pairs (pre-trained positive sample pairs) by cropping. At this time, for all videos, randomly extract a batch of videos sb for this learning. For each video in the batch, start at a random time t0 and go back dt to determine the time period for extracting video frames. Uniformly extract 3 frames per frame, and a total of 9 frames of images are used as sample a in the positive sample pair (anchor point video frame sequence is extracted from the first video). Assuming that the area of ​​sample a is areaai, a sequence of a certain position in the video is obtained by cropping at the same position of the video screen as a positive sample sub-segment (cropped image sequence), and the center area area1, lower right area area2, upper left area area3 and upper left area area4 are cropped in total, and then different similarity annotations (annotated similarity) are generated according to different areas.

[0294] The server can obtain positive sample pairs of unequal lengths through storyboards. Storyboard each video i in sb, and calculate the center feature of each storyboard. Calculate the distance between the storyboard centers of the two storyboards before and after (the distance between each storyboard segment and its adjacent storyboard segment). Assuming there are k storyboards, there are k-1 storyboard distances in total, and calculate the average value Dsd (distance mean) of the k-1 distances.

[0295] For the ka frames belonging to the a sample time (t0 to t0+dt) collected for the first time, k1 frames (frames corresponding to the anchor video frame sequence) are randomly selected, with a total of x1 frames of images (images are randomly selected for each frame) to form S1. At the same time, the frame center embedding of each frame from t0 to t0+dt is calculated, recorded as Ae m (second frame center feature).

[0296] From 0 to t0 or t0+dt to the end of video i (the storyboard segments other than the storyboard segments corresponding to the anchor video frame sequence), arbitrarily select a time period as the p sample time period (candidate storyboard segment). Calculate the storyboard center embedd from multiple storyboards in the above time period, recorded as P0em (the first storyboard center feature). Calculate the distance between P0em and Aem. When the distance between P0em and Aem of a candidate storyboard is greater than Dsd, retain the candidate storyboard and obtain the available p candidate storyboards.

[0297] Next, select k2 storyboards with a total of x2 images from the p candidate storyboards (screen out the target positive samples from the video frames of the candidate storyboard clips) to obtain S2. Concatenate S1 and S2 to obtain [S1, S2] (pre-trained positive sample pair).

[0298] The server can use k1 / (k1+k2) to calculate the similarity. Set the margin between the p sample and the a sample to k1 / Ka*10+10. Set the margin between the p sample and the a sample to k1 / Ka. For extreme cases, when the p sample comes entirely from archor, the margin is 20, and when the p sample does not contain archor, the margin is 10, both of which meet the requirement of loss margin = 10 for the target task.

[0299] When generating negative samples, assuming that each of the above videos generates 10 positive sample pairs, there are a total of batch*10 positive sample pairs. For all positive sample pairs i generated by sb, negative samples are generated from non-identical videos (second video). Calculate the storyboard center embeddings of the storyboards of different videos (the third storyboard center features of other storyboard segments). When the distance between the embeddings in the storyboards of a certain video and the storyboard center embeddings of all the i samples (the storyboard center features of the storyboard segments of the pre-trained positive sample pairs) is greater than Dsd, obtain negative samples from the video (select pre-trained negative samples from the second video), and form a triplet with the selected negative samples and the above positive sample pairs (determine the pre-trained positive sample pairs and pre-trained negative samples as pre-trained triplet).

[0300] During pre-training, the network parameters are initialized using a Gaussian distribution with a variance of 0.01 and a mean of 0. The lr is set to 0.05, and all videos are traversed once as an epoch. After every 5 epochs, the lr is halved. Pre-training uses triples, which are input into the model and the triple loss is calculated. Then the network parameters are updated. The training guide stops when it reaches 100 epochs. The model obtained by pre-training (the similarity measurement model to be trained) is used to initialize the parameters of the formal model training.

[0301] Of course, in the present application, when generating pre-trained positive and negative samples, targeted cropping can be performed based on whether a specific object appears in the video frame. That is, after the feature map output by the convolutional layer is activated, it is judged whether there is a target at a certain position based on the activation value. When there is a target, the image wi*hi is cut out with the position as the center as the p sample, etc.

[0302] Through the above method, the corresponding similar videos can be determined for the mixed video without tedious temporal logic analysis, thereby improving the effectiveness of video retrieval; and by using metric learning and training by annotating the similarities of different cropping methods, the obtained model can also measure the specific degree of similarity in order to rank the similarities.

[0303] The following is a description of an exemplary structure of the video retrieval device 555 provided in the embodiment of the present application implemented as a software module. In some embodiments, Figure 2 As shown, the software modules stored in the video retrieval device 555 of the memory 550 may include:

[0304] The sequence extraction module 5551 is used to extract the frame sequence of the video to be retrieved to obtain a video frame sequence;

[0305] An image feature extraction module 5552 is used to extract image features from the video frames in the video frame sequence to obtain an image feature sequence;

[0306] A fixed-length feature extraction module 5553 is used to extract fixed-length features from the image feature sequence to obtain target video features, wherein the target video features are representations of the video to be retrieved on video elements;

[0307] The video retrieval module 5554 is used to retrieve similar videos corresponding to the video to be retrieved from the video library based on the characteristics of the target video and the characteristics of the videos in the video library.

[0308] In some embodiments of the present application, the video frame sequence includes: a plurality of frame sequences, and the image feature sequence includes: a plurality of sub-feature sequences corresponding to the plurality of frame sequences;

[0309] The fixed-length feature extraction module 5553 is also used to extract features from each of the multiple sub-feature sequences to obtain multiple characterization features; wherein the characterization features retain the features of different video scenes in the sub-feature sequences and remove the features of the same video scene; based on statistical pooling processing of the multiple characterization features in the channel dimension, a fixed-length pooling feature is obtained; and the target video feature is extracted from the pooling feature.

[0310] In some embodiments of the present application, the fixed-length feature extraction module 5553 is also used to determine multiple eigenvalues ​​of each channel from the multiple characterization features; calculate the mean and variance of the multiple eigenvalues ​​of each channel to obtain the feature mean and feature variance corresponding to each channel; concatenate the feature means of each channel to obtain a mean vector, and concatenate the feature variances of each channel to obtain a variance vector; and use the mean vector and the variance vector to concatenate the fixed-length pooling features.

[0311] In some embodiments of the present application, the sequence extraction module 5551 is further used to segment the video to be retrieved using a preset frame interval to obtain multiple frame sequences; and determine the multiple frame sequences as the video frame sequence;

[0312] The image feature extraction module 5552 is further used to generate a sub-feature sequence corresponding to each frame sequence using the image features extracted from the video frames of each frame sequence; and determine the multiple sub-feature sequences corresponding to the multiple frame sequences as the image feature sequence.

[0313] In some embodiments of the present application, the videos in the video library include: multiple preset videos; the video retrieval module 5554 is also used to calculate the similarity between the target video features and the features of the multiple preset videos to obtain multiple feature similarities; the preset videos corresponding to the largest N feature similarities among the multiple feature similarities are determined as the similar videos.

[0314] In some embodiments of the present application, the video retrieval device 555 further includes: a model training module 5555;

[0315] The model training module 5555 is used to obtain training video samples and annotated samples corresponding to the training video samples; the annotated samples are labeled with whether they are the same or similar to the training video samples; the training triples corresponding to the training video samples are mined from the training video samples and the annotated samples; the initial fixed-length feature extraction model is metrically trained using the training triples to obtain a preset-length feature extraction model, and the preset-length feature extraction model is used to extract fixed-length features from the image feature sequence.

[0316] In some embodiments of the present application, the model training module 5555 is also used to use the initial fixed-length feature extraction model to extract fixed-length features for the training frame sequence, positive samples and negative samples in the training triplet, respectively, to obtain training video features, positive sample features and negative sample features; calculate a first training loss value using the distance between the training video features and the positive sample features, and the distance between the training video features and the negative sample features; and continuously update the parameters of the initial fixed-length feature extraction model using the first training loss value until the training end condition is reached, thereby obtaining the preset fixed-length feature extraction model.

[0317] In some embodiments of the present application, the training video sample includes: a plurality of training frame sequences, and the annotated sample includes: a plurality of similar frame sequences corresponding to the plurality of training frame sequences;

[0318] The model training module 5555 is also used to use each training frame sequence and a similar frame sequence corresponding to each training frame sequence to form a positive sample pair corresponding to each training frame sequence. When the corresponding positive sample pairs are determined for the multiple training frame sequences, multiple positive sample pairs are obtained; from the multiple positive sample pairs, excluding the positive sample pairs corresponding to each training frame sequence, the candidate negative sample set corresponding to each training frame sequence is extracted; the feature distance between each training frame sequence and the candidate negative samples in the candidate negative sample set is calculated to obtain the negative sample feature distance set of each training frame sequence; the candidate negative samples corresponding to the smallest N negative sample feature distances in the negative sample feature distance set are used as the negative samples of each training frame sequence; wherein N is a positive integer; using the positive sample pairs corresponding to each training frame sequence and the negative samples corresponding to each training frame sequence, a triplet corresponding to each training frame sequence is generated, and the triplet corresponding to each training frame sequence is determined as the training triplet.

[0319] In some embodiments of the present application, the model training module 5555 is also used to use the similarity measurement model to be trained to calculate the similarity between the training video features extracted from the training video samples and the labeled sample features extracted from the labeled samples to obtain the training similarity; calculate the second training loss value based on the labeled labels between the training video samples and the labeled samples, and the training similarity; use the second training loss value to update the parameters of the similarity measurement model to be trained until the training is completed, and obtain a preset similarity measurement model, which is used to calculate the similarity between the target video features and the features of multiple preset videos.

[0320] In some embodiments of the present application, the model training module 5555 is also used to obtain a first video and a second video different from the first video; wherein, neither the first video nor the second video has been labeled with similarity; constructing a pre-trained positive sample pair with labeled similarity from the first video, and selecting a pre-trained negative sample from the second video; determining the pre-trained positive sample pair and the pre-trained negative sample as a pre-training triplet; and using the pre-training triplet to pre-train the initial similarity measurement model obtained by parameter initialization to obtain the similarity measurement model to be trained.

[0321] In some embodiments of the present application, the model training module 5555 is also used to extract an anchor video frame sequence from the first video; to extract a preset number of captured image sequences from the anchor video frame sequence; and to calculate the labeled similarity of the pre-trained positive sample pair including the anchor video frame sequence and the captured image sequence based on the area of ​​the captured images in the captured image sequence, the area of ​​the video frames in the anchor video frame sequence, and a preset loss hyperparameter, to obtain the pre-trained positive sample pair with the labeled similarity.

[0322] In some embodiments of the present application, the model training module 5555 is further used to perform storyboard processing on the first video to obtain multiple storyboard segments, and determine the storyboard segments other than the storyboard segments corresponding to the anchor video frame sequence as candidate storyboard segments; wherein the similarity of the video frames in each storyboard segment is greater than a similarity threshold; the distance between each storyboard segment and its adjacent storyboard segments is averaged to obtain a distance mean; when the distance between the first storyboard center feature of the candidate storyboard segment and the second storyboard center feature of the storyboard segment corresponding to the anchor video frame sequence is greater than the distance mean, a target positive sample is screened out from the video frame of the candidate storyboard segment; based on the number of storyboard segments corresponding to the anchor video frame sequence and the number of storyboard segments corresponding to the target positive sample, the labeled similarity of the pre-trained positive sample pair containing the anchor video frame sequence and the target positive sample is calculated to obtain the pre-trained positive sample pair with the labeled similarity;

[0323] The model training module 5555 is also used to select the pre-trained negative sample from the second video when the distance between the third storyboard center feature of other storyboard segments obtained by storyboarding the second video and the storyboard center feature of the storyboard segment of the pre-trained positive sample pair is greater than the distance mean.

[0324] In summary, through the embodiments of the present application, it is possible to first extract a frame sequence of the video to be retrieved to obtain a video frame sequence, then extract image features from the video frames in the video frame sequence to obtain an image feature sequence, and then extract a fixed-length target video feature from the image feature sequence to obtain a representation of the video to be retrieved on the video element, and finally retrieve similar videos from the video library based on the target video feature, that is, based on the representation of the video to be retrieved on the video element. In this way, it is possible to determine whether the videos are similar based on the video elements without performing timing logic judgment, so that whether it is a general video with normal timing, a mixed video with chaotic timing, or a variable-length video, video retrieval can be effectively performed, ultimately improving the effectiveness of video retrieval.

[0325] The embodiment of the present application provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. The processor of the video retrieval device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the video retrieval device performs the video retrieval method described above in the embodiment of the present application.

[0326] The present application embodiment provides a computer-readable storage medium storing executable instructions, wherein executable video retrieval instructions are stored. When the executable video retrieval instructions are executed by a processor, the processor will execute the video retrieval method provided by the present application embodiment, for example, Figure 3 The method shown.

[0327] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EP ROM, EEPROM, flash memory, magnetic surface storage, optical disk, or CD-ROM; or it may be various devices including one or any combination of the above memories.

[0328] In some embodiments, the executable video retrieval instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.

[0329] As an example, executable video retrieval instructions may, but need not, correspond to a file in a file system, may be stored as part of a file storing other programs or data, for example, in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).

[0330] As an example, the executable video retrieval instructions may be deployed to be executed on one video retrieval device, or on multiple video retrieval devices located at one location, or on multiple video retrieval devices distributed at multiple locations and interconnected by a communication network.

[0331] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.

Claims

1. A video retrieval method, characterized in that: include: Extracting frame sequences from the video to be retrieved at preset time intervals, and using the obtained multiple frame sequences to form a video frame sequence, wherein each of the frame sequences includes a preset number of continuous video frames; Extracting image features from the video frames in the video frame sequence to obtain an image feature sequence; wherein the length of the image feature sequence is positively correlated with the duration of the video to be retrieved, and the image feature sequence includes: a plurality of sub-feature sequences corresponding to the plurality of frame sequences; Extracting features from each of the plurality of sub-feature sequences to obtain a plurality of representation features; wherein the representation features retain features of different video scenes in the sub-feature sequences and remove features of the same video scene; Based on statistical pooling processing of the multiple representation features in the channel dimension, a fixed-length pooling feature is obtained; Extracting a target video feature from the pooled feature, wherein the target video feature is a representation of the video to be retrieved on a video element; Based on the target video features and the features of the videos in the video library, similar videos corresponding to the video to be retrieved are retrieved from the video library.

2. The method according to claim 1, characterized in that The method of obtaining a fixed-length pooling feature based on the statistical pooling processing of the multiple characterization features in the channel dimension includes: Determining a plurality of feature values ​​for each channel from the plurality of characterizing features; Calculating the mean and variance of the multiple eigenvalues ​​of each channel to obtain the eigenvalue mean and eigenvariance corresponding to each channel; Concatenating the feature means of each channel to obtain a mean vector, and concatenating the feature variances of each channel to obtain a variance vector; The fixed-length pooling feature is concatenated using the mean vector and the variance vector.

3. The method according to any one of claims 1 to 2, characterized in that: Before extracting image features from the video frames in the video frame sequence to obtain the image feature sequence, the method further includes: The video to be retrieved is segmented using a preset frame interval to obtain a plurality of frame sequences; Determine the multiple frame sequences as the video frame sequences; The extracting of image features from the video frames in the video frame sequence to obtain an image feature sequence includes: Using the image features extracted from the video frames of each frame sequence, a sub-feature sequence corresponding to each frame sequence is generated; A plurality of sub-feature sequences corresponding to the plurality of frame sequences are determined as the image feature sequence.

4. The method according to any one of claims 1 to 2, characterized in that: The videos in the video library include: a plurality of preset videos; the retrieving similar videos corresponding to the video to be retrieved from the video library according to the features of the target video and the features of the videos in the video library includes: Calculating similarities between the target video feature and the features of the plurality of preset videos to obtain a plurality of feature similarities; The preset videos corresponding to the largest N feature similarities among the multiple feature similarities are determined as the similar videos.

5. The method according to any one of claims 1 to 2, characterized in that: Before extracting the frame sequence of the video to be retrieved at the preset time interval and using the obtained multiple frame sequences to form a video frame sequence, the method further includes: Obtaining a training video sample and a labeled sample corresponding to the training video sample; the labeled sample has a label indicating whether it is identical or similar to the training video sample; Mining training triples corresponding to the training video samples from the training video samples and the labeled samples; The training triples are used to perform metric training on an initial fixed-length feature extraction model to obtain a preset-length feature extraction model, and the preset-length feature extraction model is used to extract fixed-length features from the image feature sequence.

6. The method according to claim 5, characterized in that The method of using the training triplet to perform metric training on the initial fixed-length feature extraction model to obtain a preset fixed-length feature extraction model includes: Using the initial fixed-length feature extraction model, extracting fixed-length features from the training frame sequence, positive samples and negative samples in the training triplet, respectively, to obtain training video features, positive sample features and negative sample features; Calculating a first training loss value using the distance between the training video feature and the positive sample feature, and the distance between the training video feature and the negative sample feature; The first training loss value is used to continuously update the parameters of the initial fixed-length feature extraction model until the training end condition is reached, thereby obtaining the preset fixed-length feature extraction model.

7. The method according to claim 5, characterized in that The training video sample includes: a plurality of training frame sequences, and the annotated sample includes: a plurality of similar frame sequences corresponding to the plurality of training frame sequences; The step of mining the training triplet corresponding to the training video sample from the training video sample and the labeled sample includes: Using each training frame sequence and a similar frame sequence corresponding to each training frame sequence, a positive sample pair corresponding to each training frame sequence is formed, and when corresponding positive sample pairs are determined for the plurality of training frame sequences, a plurality of positive sample pairs are obtained; Extracting a candidate negative sample set corresponding to each training frame sequence from other sample pairs excluding the positive sample pair corresponding to each training frame sequence from the multiple positive sample pairs; Calculating the feature distance between each training frame sequence and the candidate negative samples in the candidate negative sample set to obtain a negative sample feature distance set for each training frame sequence; The candidate negative samples corresponding to the smallest N negative sample feature distances in the negative sample feature distance set are used as negative samples of each training frame sequence; wherein N is a positive integer; The positive sample pairs corresponding to each training frame sequence and the negative samples corresponding to each training frame sequence are used to generate triples corresponding to each training frame sequence, and the triples corresponding to each training frame sequence are determined as the training triples.

8. The method according to claim 5, characterized in that After obtaining the training video sample and the labeled sample corresponding to the training video sample, the method further includes: Using the similarity measurement model to be trained, similarity calculation is performed on the training video features extracted from the training video samples and the labeled sample features extracted from the labeled samples to obtain training similarity; Calculating a second training loss value according to the annotation labels between the training video sample and the annotated sample, and the training similarity; The second training loss value is used to update the parameters of the similarity measurement model to be trained until the training is completed, so as to obtain a preset similarity measurement model, wherein the preset similarity measurement model is used to calculate the similarity between the target video feature and the features of multiple preset videos.

9. The method according to claim 8, characterized in that Before calculating the similarity of the training video features extracted from the training video samples and the labeled sample features extracted from the labeled samples using the similarity measurement model to be trained to obtain the training similarity, the method further includes: Obtaining a first video and a second video different from the first video; wherein the first video and the second video are not labeled with similarity; Constructing pre-trained positive sample pairs with annotated similarities from the first video, and selecting pre-trained negative samples from the second video; Determine the pre-training positive sample pair and the pre-training negative sample as a pre-training triplet; The pre-training triples are used to pre-train the initial similarity measurement model obtained by initializing parameters to obtain the similarity measurement model to be trained.

10. The method according to claim 9, characterized in that The step of constructing a pair of pre-trained positive samples with annotated similarities from the first video includes: Extracting an anchor video frame sequence from the first video; Extracting a preset number of intercepted image sequences from the anchor video frame sequence; Based on the area of ​​the cropped image in the cropped image sequence, the area of ​​the video frame in the anchor video frame sequence, and the preset loss hyperparameter, the labeled similarity of the pre-trained positive sample pair including the anchor video frame sequence and the cropped image sequence is calculated to obtain the pre-trained positive sample pair with the labeled similarity.

11. The method according to claim 10, characterized in that After extracting the anchor video frame sequence from the first video and before determining the pre-trained positive sample pair and the pre-trained negative sample as a pre-trained triplet, the method further includes: Performing storyboard processing on the first video to obtain a plurality of storyboard segments, and determining the storyboard segments other than the storyboard segments corresponding to the anchor video frame sequence as candidate storyboard segments; wherein the similarity of the video frames in each storyboard segment is greater than a similarity threshold; Averaging the distance between each storyboard segment and its adjacent storyboard segments to obtain a distance mean; When the distance between the first storyboard center feature of the candidate storyboard segment and the second storyboard center feature of the storyboard segment corresponding to the anchor video frame sequence is greater than the distance mean, selecting a target positive sample from the video frame of the candidate storyboard segment; According to the number of storyboard segments corresponding to the anchor video frame sequence and the number of storyboard segments corresponding to the target positive sample, the labeled similarity of the pre-trained positive sample pair including the anchor video frame sequence and the target positive sample is calculated to obtain the pre-trained positive sample pair with the labeled similarity; The step of selecting a pre-trained negative sample from the second video includes: When the distances between the third storyboard center features of other storyboard segments obtained by storyboarding the second video and the storyboard center features of the storyboard segments of the pre-trained positive sample pair are both greater than the distance mean, the pre-trained negative sample is selected from the second video.

12. A video retrieval device, characterized in that: include: A sequence extraction module, used for extracting a frame sequence from the video to be retrieved at a preset time interval, and using the obtained multiple frame sequences to form a video frame sequence, wherein each of the frame sequences contains a preset number of continuous video frames; An image feature extraction module is used to extract image features from video frames in the video frame sequence to obtain an image feature sequence; wherein the length of the image feature sequence is positively correlated with the duration of the video to be retrieved, and the image feature sequence includes: a plurality of sub-feature sequences corresponding to the plurality of frame sequences; A fixed-length feature extraction module is used to extract features from each of the multiple sub-feature sequences to obtain multiple representation features; wherein the representation features retain the features of different video scenes in the sub-feature sequences and remove the features of the same video scene; based on statistical pooling processing of the multiple representation features in the channel dimension, a fixed-length pooling feature is obtained; and a target video feature is extracted from the pooling feature, wherein the target video feature is a representation of the video to be retrieved on the video element; The video retrieval module is used to retrieve similar videos corresponding to the video to be retrieved from the video library based on the characteristics of the target video and the characteristics of the videos in the video library.

13. A video retrieval device, characterized in that: include: A memory for storing executable video retrieval instructions; A processor, configured to implement the method according to any one of claims 1 to 11 when executing the executable video retrieval instruction stored in the memory.

14. A computer-readable storage medium, characterized in that: Executable video retrieval instructions are stored, and when executed by a processor, the method described in any one of claims 1 to 11 is implemented.

15. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the method according to any one of claims 1 to 11 is implemented.