Video retrieval method

By using the video matching model to analyze the matching degree between the search text and the video in video retrieval, the problem of insufficient video retrieval accuracy in the prior art is solved, and the user experience and retrieval accuracy are improved.

CN119441537APending Publication Date: 2025-02-14ALIBABA DAMO (HANGZHOU) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310961671.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-01
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

The prior art lacks perception of the overall content and local content of the video in video retrieval, resulting in insufficient retrieval accuracy and reduced user experience.

Method used

By obtaining the search text and candidate videos, input them into the video matching model to obtain matching weights. Combining the first matching result and the second matching result, the local content and overall content of the target candidate video are analyzed, and the accuracy of the matching weights is improved, thereby determining the target video.

Benefits of technology

It improves the accuracy and user experience of video retrieval, and meets users' retrieval needs by making more accurate matches to the local and overall content of the video.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119441537A_ABST
    Figure CN119441537A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a video retrieval method. The video retrieval method comprises the following steps: acquiring a retrieval text and at least one candidate video; the retrieval text and the target candidate video are input into a video matching model, the matching weight corresponding to the target candidate video output by the video matching model is obtained, the target candidate video is any one of the at least one candidate video, and the matching weight is matched with the target candidate video; the matching weight is determined based on a first matching result and a second matching result between the retrieval text and the target candidate video, the first matching result is used for representing the matching degree between the retrieval text and each target object in the target candidate video, and the second matching result is used for representing the matching degree between the retrieval text and the video semantics of the target candidate video; and determining at least one target video in the at least one candidate video based on the matching weight corresponding to each candidate video. The local content and the overall content of the candidate videos are analyzed, and the accuracy of video retrieval based on texts is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present specification relate to the field of data processing technology, and in particular to a video retrieval method. Background Art

[0002] With the development of various video platforms, people usually spend their free time watching videos. Due to different personal viewing needs, if users are not interested in the videos recommended by the video platform, they will conduct independent searches based on text to obtain videos. In current practical applications, searching for semantically related videos based on the natural language input by users often requires appropriate matching modeling between video and text data. Or, it is necessary to extract features and perform feature fusion by training multiple single-modal pre-trained models.

[0003] However, since videos contain rich visual elements, text descriptions may only correspond to part of the video content, lacking the perception of the overall and local content of the video, making the accuracy of video retrieval insufficient to meet user needs and reducing the user experience. Therefore, a method is urgently needed to solve the above problem. Summary of the invention

[0004] In view of this, an embodiment of this specification provides a video retrieval method. One or more embodiments of this specification also relate to a video retrieval device, a computing device, a computer-readable storage medium and a computer program to solve the technical defects existing in the prior art.

[0005] According to a first aspect of an embodiment of this specification, a video retrieval method is provided, including:

[0006] Obtaining a search text and at least one candidate video;

[0007] Input the search text and the target candidate video into a video matching model, and obtain a matching weight corresponding to the target candidate video output by the video matching model, wherein the target candidate video is any one of the at least one candidate video, and the matching weight is determined based on a first matching result and a second matching result between the search text and the target candidate video, wherein the first matching result is used to characterize the matching degree between the search text and each target object in the target candidate video, and the second matching result is used to characterize the matching degree between the search text and the video semantics of the target candidate video;

[0008] At least one target video is determined from the at least one candidate video based on the matching weights corresponding to the candidate videos.

[0009] According to a second aspect of the embodiments of this specification, a video retrieval device is provided, including:

[0010] An acquisition module, configured to acquire a search text and at least one candidate video;

[0011] An input module is configured to input the search text and the target candidate video into a video matching model, and obtain a matching weight corresponding to the target candidate video output by the video matching model, wherein the target candidate video is any one of the at least one candidate video, and the matching weight is determined based on a first matching result and a second matching result between the search text and the target candidate video, wherein the first matching result is used to characterize the matching degree between the search text and each target object in the target candidate video, and the second matching result is used to characterize the matching degree between the search text and the video semantics of the target candidate video;

[0012] The determination module is configured to determine at least one target video from the at least one candidate video based on the matching weight corresponding to each candidate video.

[0013] According to a third aspect of an embodiment of this specification, a computing device is provided, including:

[0014] Memory and processor;

[0015] The memory is used to store computer executable instructions, and the processor is used to execute the computer executable instructions. When the computer executable instructions are executed by the processor, the steps of the above-mentioned video retrieval method are implemented.

[0016] According to a fourth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores computer-executable instructions, and when the instructions are executed by a processor, the steps of the above-mentioned video retrieval method are implemented.

[0017] According to a fifth aspect of the embodiments of this specification, a computer program is provided, wherein when the computer program is executed in a computer, the computer is caused to execute the steps of the above-mentioned video retrieval method.

[0018] The video retrieval method provided in this specification includes: obtaining a retrieval text and at least one candidate video; inputting the retrieval text and the target candidate video into a video matching model, and obtaining a matching weight corresponding to the target candidate video output by the video matching model, wherein the target candidate video is any one of the at least one candidate video, and the matching weight is determined based on a first matching result and a second matching result between the retrieval text and the target candidate video, the first matching result being used to characterize the matching degree between the retrieval text and each target object in the target candidate video, and the second matching result being used to characterize the matching degree between the retrieval text and the video semantics of the target candidate video; based on the matching weight corresponding to each candidate video, at least one target video is determined in the at least one candidate video.

[0019] In one embodiment of the present specification, the first matching result between the search text and the target candidate video is calculated to determine the matching degree between the search text and each target object in the target candidate video, and the second matching result between the search text and the target candidate video is calculated to determine the matching degree between the search text and the video semantics of the target candidate video. Then, the matching weight of the target candidate video is determined by combining the first matching result and the second matching result, and the accuracy of determining the matching weight of the target candidate video is improved by analyzing the local content and the overall content of the target candidate video; then, the target video is determined in each candidate video according to the matching weight corresponding to each candidate video, thereby improving the accuracy of text-based video retrieval. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 is an architecture diagram of a video retrieval system provided by an embodiment of this specification;

[0021] Figure 2 is a flow chart of a video retrieval method provided by an embodiment of this specification;

[0022] Figure 3 is a schematic diagram of a model architecture of a video matching model provided by an embodiment of this specification;

[0023] Figure 4a It is a schematic diagram of an interactive interface of a video retrieval method provided by an embodiment of this specification;

[0024] Figure 4b is a schematic diagram of an interactive interface of another video retrieval method provided by an embodiment of this specification;

[0025] Figure 5 is a processing flow chart of a video retrieval method provided by an embodiment of this specification;

[0026] Figure 6is a schematic diagram of the structure of a video retrieval device provided by an embodiment of this specification;

[0027] Figure 7 It is a structural block diagram of a computing device provided by an embodiment of this specification. DETAILED DESCRIPTION

[0028] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.

[0029] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.

[0030] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0031] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and corresponding operation entrances shall be provided for users to choose to authorize or refuse.

[0032] The large model in one or more embodiments of this specification specifically refers to a deep learning model with large-scale model parameters, which usually contains hundreds of millions, tens of billions, or even hundreds of billions of model parameters. The large model can also be called a foundation model / foundation model. The large model is pre-trained with large-scale unlabeled corpus to produce a pre-trained model with more than 100 million parameters. This model can adapt to a wide range of downstream tasks, and the model has good generalization ability, such as a large-scale language model (LLM), a multi-modal pre-training model, etc.

[0033] When the big model is used in practice, only a small number of samples are needed to fine-tune the pre-trained model and it can be applied to different tasks. The big model can be widely used in natural language processing (NLP), computer vision and other fields. Specifically, it can be applied to computer vision tasks such as visual question answering (VQA), image caption (IC), image generation, as well as natural language processing tasks such as text-based sentiment classification, text summary generation, and machine translation. The main application scenarios of the big model include digital assistants, intelligent robots, search, online education, office software, e-commerce, intelligent design, etc.

[0034] First, the terms involved in one or more embodiments of this specification are explained.

[0035] Video text retrieval: Traditional image retrieval tasks are only applicable to searches between images, and their application scenarios are limited. Video text retrieval can achieve cross-modal search between natural language and video, and its model is generally trained based on a large amount of video-text data pairs.

[0036] CLIP: is a multimodal pre-training model. It can process images and texts simultaneously and combine the two for tasks such as classification, retrieval, and generation. During the training process, CLIP uses a large amount of image and text data. Its pre-training goal is to learn to align the representations of text and images so that similar text and images are closer in the embedding space. To achieve this goal, CLIP uses a contrastive learning method to maximize the cosine similarity of similar text and images, while minimizing the cosine similarity of dissimilar text and images, thereby training an embedding space that can align data of different modalities.

[0037] Transformer: A model that mainly uses self-attention to obtain long-term dependencies in a sequence. Transformer contains an encoder and a decoder. The encoder is used to generate a representation of the input sequence. The decoder is used to generate a representation of the target sequence. Both the encoder and the decoder are composed of multiple layers of self-attention and feedforward neural networks. In addition, the self-attention mechanism in Transformer is a mechanism that calculates the representation of each element in the sequence, which can help the model focus on the part of the input sequence related to the current position and generate an importance weight vector. For example, when a sentence is input, the meaning of each word in the sentence is related to the other words in the sentence.

[0038] Prototype: A representative representation vector. For example, an event can be represented by an event-level vector (prototype).

[0039] Understanding multimodal information is an important way for humans to perceive the world. As a basic task in multimodal understanding, video text retrieval has attracted great interest from researchers with the rapid development of short video platforms. Video text retrieval aims to search for semantically related videos based on natural language input by users, which requires appropriate matching modeling between video and text data. However, the inherent modal difference phenomenon increases the difficulty of associating multimodal data. To address this problem, in practical applications, multiple unimodal pre-trained models are usually used to extract features, and then metric learning strategies are used to strengthen modal alignment in the joint space. However, there are large differences in the initial distributions of multiple unimodal offline features, which inevitably brings challenges to feature fusion and affects the retrieval results.

[0040] In addition, since videos contain rich visual elements, text descriptions may only correspond to part of the video content and lack the perception of the overall and local content of the video, making the accuracy of video retrieval insufficient to meet user needs and reducing the user experience.

[0041] In this specification, a video retrieval method is provided. This specification also relates to a video retrieval system, a video retrieval device, a computing device, and a computer-readable storage medium, which are described in detail one by one in the following embodiments.

[0042] See also Figure 1 , Figure 1 The architecture diagram of a video retrieval system provided by an embodiment of the present specification is shown. The video retrieval system may include a client 100 and a server 200;

[0043] The client 100 is used to send a video retrieval instruction to the server 200;

[0044] The server 200 is used to receive a video search instruction sent by the client 100; obtain a search text and at least one candidate video in response to the video search instruction; input the search text and the target candidate video into a video matching model to obtain a matching weight corresponding to the target candidate video output by the video matching model, wherein the target candidate video is any one of the at least one candidate video, and the matching weight is determined based on a first matching result and a second matching result between the search text and the target candidate video, wherein the first matching result is used to characterize the matching degree between the search text and each target object in the target candidate video, and the second matching result is used to characterize the matching degree between the search text and the video semantics of the target candidate video; determine at least one target video in the at least one candidate video based on the matching weight corresponding to each candidate video; and send at least one target video to the client 100;

[0045] The client 100 is further configured to receive at least one target video sent by the server 200 .

[0046] By applying the scheme of the embodiments of the present specification, a user can trigger a video retrieval instruction through a client and send the video retrieval instruction to a server. After receiving the video retrieval instruction, the server obtains the retrieval text carried in the video retrieval instruction and obtains multiple candidate videos from a preset database, inputs the retrieval text and the candidate videos into a video matching model to determine a target video associated with the retrieval text among multiple candidate videos, and feeds the target video back to the client.

[0047] The video retrieval system may include multiple clients 100 and a server 200, wherein the client 100 may be referred to as a client-side device and the server 200 may be referred to as a cloud-side device. A communication connection may be established between multiple clients 100 through the server 200. In the video retrieval scenario, the server 200 is used to provide video retrieval services between multiple clients 100. Multiple clients 100 may serve as a sender or a receiver, respectively, and achieve communication through the server 200.

[0048] The user can interact with the server 200 through the client 100 to receive data sent by other clients 100, or send data to other clients 100, etc. In the video retrieval scenario, the user can publish a data stream to the server 200 through the client 100, and the server 200 determines at least one target video according to the data stream, and pushes the at least one target video to other clients that have established communication.

[0049] The client 100 and the server 200 are connected via a network. The network provides a medium for a communication link between the client 100 and the server 200. The network may include various connection types, such as wired or wireless communication links or optical fiber cables, etc. The data transmitted by the client 100 may need to be encoded, transcoded, compressed, etc. before being released to the server 200.

[0050] The client 100 can be a browser, an APP (Application), or a web application such as an H5 (HyperText Markup Language 5, Hypertext Markup Language Version 5) application, or a light application (also known as a mini-program, a lightweight application) or a cloud application, etc. The client 100 can be based on the software development kit (SDK, Software Development Kit) of the corresponding service provided by the server 200, such as based on the real-time communication (RTC, Real Time Communication) SDK development and acquisition. The client 100 can be deployed in an electronic device, and needs to rely on the device to run or some APPs in the device to run. For example, the electronic device can have a display screen and support information browsing, such as a personal mobile terminal such as a mobile phone, a tablet computer, a personal computer, etc. Various other types of applications can also be configured in the electronic device, such as human-computer dialogue applications, model training applications, text processing applications, web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0051] The server 200 may include servers that provide various services, such as servers that provide communication services to multiple clients, servers for background training that provide support for models used on clients, and servers that process data sent by clients. It should be noted that the server 200 can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. The server can also be a server of a distributed system, or a server combined with a blockchain. The server can also be a cloud server for 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, content distribution networks (CDN, Content Delivery Network), and big data and artificial intelligence platforms, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology.

[0052] It is worth noting that the video retrieval method provided in the embodiments of this specification is generally executed by the server, but in other embodiments of this specification, the client may also have similar functions to the server, thereby executing the video retrieval method provided in the embodiments of this specification. In other embodiments, the video retrieval method provided in the embodiments of this specification may also be jointly executed by the client and the server.

[0053] See also Figure 2 , Figure 2 A flowchart of a video retrieval method provided by an embodiment of this specification is shown, which specifically includes the following steps:

[0054] Step 202: Obtain a search text and at least one candidate video.

[0055] In actual applications, various short video platforms are gradually favored by the public, and people tend to kill time by refreshing and watching videos. However, in the process of watching videos, there may be cases where users are not interested in the video content recommended by the short video platform. In this case, users tend to search for videos in the search bar.

[0056] In this scenario, although each short video platform will make corresponding video recommendations based on the text entered by the user, there may also be a problem that the videos recommended by the short video platform do not match the text entered by the user's search or the matching degree is low, thereby reducing the user's viewing experience.

[0057] The video retrieval method provided in an embodiment of the present specification can recommend videos matching the retrieval text to the user based on the retrieval text input by the user.

[0058] The search text refers to the text used to search for videos, and the search text may be a keyword, a phrase, a sentence, or a text paragraph, etc. The candidate video refers to a video stored in a preset database, which is video data for searching videos based on the search text.

[0059] For example, if it is necessary to retrieve videos related to "cooking noodles" from database A, then "cooking noodles" is the search text, and each video stored in database A is a candidate video.

[0060] Specifically, when a user needs to search for videos, the user can manually enter the search text to be searched in the search bar, or input the search text by voice, thereby generating a video search instruction. The client sends the video search instruction to the server. After receiving the video search instruction, the server obtains the search text carried in the video search instruction and obtains the candidate videos in the preset database.

[0061] For example, if a user wants to obtain videos related to "cooking noodles", he can enter the word "cooking noodles" or text related to "cooking noodles" in the search bar of the client. Then, the client sends the video retrieval instruction generated for "cooking noodles" to the server. After receiving the video retrieval instruction, the server obtains the retrieval text "cooking noodles" carried in the video retrieval instruction and obtains multiple candidate videos from the preset database.

[0062] After obtaining the search text and multiple candidate videos, the search text and the multiple candidate videos can be matched to determine the matching degree between the search text and the multiple candidate videos, and based on the matching degree between the search text and the multiple candidate videos, determine the video that the user needs to retrieve.

[0063] In order to improve the retrieval efficiency of video text retrieval, the video matching model can be used to process the retrieval text and each candidate video.

[0064] Step 204: input the search text and the target candidate video into a video matching model to obtain a matching weight corresponding to the target candidate video output by the video matching model.

[0065] The target candidate video refers to any one of the candidate videos. The video matching model is used to determine the matching weight between the search text and each candidate video. The matching weight is used to characterize the matching degree between the search text and each candidate video, which can be expressed by a numerical value, such as 0.5, 0.8, or 50%, 80%, etc.

[0066] Specifically, the acquired search text and target candidate video are input into the video matching model, and the matching weight corresponding to the target candidate video output by the video matching model can be obtained.

[0067] In a specific implementation provided in this specification, the video matching model includes a coding layer, a first matching layer, and a second matching layer;

[0068] Inputting the search text and the target candidate video into a video matching model, and obtaining a matching weight corresponding to the target candidate video output by the video matching model, comprises:

[0069] Inputting the search text and the target candidate video into the coding layer to obtain a text feature sequence of the search text and a target video frame block feature sequence of the target candidate video;

[0070] Inputting the text feature sequence and the target video frame block feature sequence into the first matching layer, obtaining a phrase feature sequence corresponding to the text feature sequence and a target object feature sequence corresponding to the target video frame block feature sequence, and determining a first matching result according to the phrase feature sequence and the target object feature sequence;

[0071] The target object feature sequence, the text feature sequence and the first matching result are input into the second matching layer, a second matching result is determined according to the target object feature sequence and the text feature sequence, and a matching weight corresponding to the target candidate video is determined based on the first matching result and the second matching result.

[0072] Among them, the encoding layer is used to encode the search text and each candidate video to obtain a text feature sequence corresponding to the search text; the first matching layer is used to determine the first matching result between the search text and each candidate video, and the first matching result is used to characterize the matching degree between the search text and each target object in each candidate video, and the target object may refer to a person, an object, etc. in the video frame; the second matching layer is used to determine the second matching result between the search text and each candidate video, and the second matching result is used to characterize the matching degree between the search text and the video semantics of each candidate video.

[0073] Specifically, the retrieval text and the target candidate video are input into the video matching model. First, the retrieval text and the target candidate video need to be input into the encoding layer of the video matching model, and the retrieval text and the target candidate video are encoded respectively to obtain the text feature sequence corresponding to the retrieval text and the target video frame block feature sequence corresponding to the target candidate video.

[0074] The text feature sequence refers to a feature sequence composed of text feature vectors corresponding to the search text, and the text feature vectors include word feature vectors and identifier feature vectors; the target video frame block feature sequence refers to a feature sequence composed of target video frame block feature vectors corresponding to the target candidate video, and the target video frame block feature vectors include key frame block feature vectors and global frame feature vectors.

[0075] Since the retrieved text and the target candidate video belong to data of different modalities, the retrieved text and the target candidate video can be encoded using a text encoder and a video encoder respectively.

[0076] In a specific implementation provided in this specification, the encoding layer includes a text encoder and a video encoder;

[0077] Inputting the search text and the target candidate video into a video matching model to obtain a text feature sequence of the search text and a target video frame block feature sequence of the target candidate video, including:

[0078] Inputting the search text into the text encoder to obtain a text feature sequence of the search text;

[0079] The target candidate video is input into the video encoder to obtain a target video frame block feature sequence of the target candidate video.

[0080] The text encoder refers to an encoder used to encode the retrieved text, and the video encoder refers to an encoder used to encode the candidate video.

[0081] The search text and the target candidate video are input into the encoding layer of the video matching model, that is, the search text is input into the text encoder, and the target candidate video is input into the video encoder, thereby obtaining the text feature sequence corresponding to the search text and the target video frame block feature sequence corresponding to the target candidate video.

[0082] Specifically, in a specific implementation provided in this specification, obtaining the text feature sequence of the search text includes:

[0083] Identify the search text and obtain words in the search text;

[0084] Encode each word to obtain the word feature vector corresponding to each word;

[0085] Obtaining preset text identifiers, encoding each preset text identifier, and obtaining an identifier feature vector corresponding to each preset text identifier;

[0086] Based on each word feature vector and each identifier feature vector, a text feature sequence of the search text is obtained.

[0087] The preset text identifier refers to the identifier that is preset to determine the starting position and the ending position of the search text, including the start identifier and the end identifier, which can be specifically represented by [start] and [end]. The identifier feature vector is the vector representation of the start identifier and the end identifier, where the identifier feature vector corresponding to the end identifier is also the global feature vector of the search text.

[0088] The search text is segmented and recognized to obtain each word in the search text, and each word is encoded to obtain a word feature vector corresponding to each word, a preset text identifier is obtained, the preset identifier is encoded, an identifier feature vector corresponding to each preset identifier is obtained, and a text feature sequence is constructed based on each word feature vector and each identifier feature vector.

[0089] For example, for the search text Y i , the text feature sequence obtained based on the above method can be expressed as Among them, y S is the start identifier feature vector, is the word feature vector, y E is the end identifier feature vector, also the retrieval text Y iThe global feature vector of , M is the number of words, D is the feature dimension, which is usually set to 512 dimensions. This specification does not limit the feature dimension of the feature vector.

[0090] In a specific implementation manner provided in this specification, obtaining a target video frame block feature sequence of the target candidate video includes:

[0091] Sampling a preset number of key frames from the target candidate video;

[0092] Segmenting a target key frame to obtain at least one video frame block corresponding to the target key frame, wherein the target key frame is any one of the preset number of key frames;

[0093] Encoding each video frame block to obtain a key frame block feature sequence of the target key frame;

[0094] Obtaining a preset classification embedding symbol, encoding the preset classification embedding symbol, and obtaining a global frame feature vector corresponding to the preset classification embedding symbol;

[0095] Based on the key frame block feature sequence of each key frame and each global frame feature vector, a target video frame block feature sequence of the target candidate video is obtained.

[0096] The preset number refers to the number of video frames that need to be sampled in advance; the key frame refers to the video frame sampled from the target candidate video; the key frame block feature sequence refers to the feature sequence composed of the key frame block feature vectors corresponding to the key frame.

[0097] The preset classification embedding character refers to a special classification embedding character that is pre-set and inserted before the key frame. It is used in the classification task and can be specifically represented by [CLS]. The global frame feature vector refers to the vector representation of the preset classification embedding character.

[0098] Obtain a preset number, sample a preset number of key frames from the target candidate video based on the preset number, segment each sampled key frame to obtain multiple video frame blocks of each key frame, then encode each video frame block to obtain a key frame block feature vector corresponding to each video frame block, and generate a key frame block feature sequence corresponding to each key frame. Obtain a preset classification embedding symbol, encode the preset classification embedding symbol, and obtain a global frame feature vector corresponding to the preset classification embedding symbol. Based on each key frame block feature sequence and each global frame feature vector, construct a target video frame block feature sequence.

[0099] For example, for the target candidate video X i , the target video frame block feature sequence obtained based on the above method can be expressed as in, is the global frame feature vector, is the key frame block feature vector of the lth frame, is the key frame block feature sequence of the lth frame, K is the number of video frame blocks, L is the preset number, D is the feature dimension, usually set to 512 dimensions, and this specification does not limit the feature dimension of the feature vector.

[0100] Furthermore, after respectively encoding the retrieval text and the target candidate video and obtaining the text feature sequence corresponding to the retrieval text and the target video frame block feature sequence corresponding to the target candidate video, the text feature sequence and the target video frame block feature sequence are input into the first matching layer of the video matching model to obtain the phrase feature sequence corresponding to the text feature sequence and the target object feature sequence corresponding to the target video frame block feature sequence, so that the first matching result can be determined based on the phrase feature sequence and the target object feature sequence.

[0101] In a specific implementation provided in this specification, the first matching layer includes a spatial prototype generator and a target phrase matcher;

[0102] Inputting the text feature sequence and the target video frame block feature sequence into the first matching layer, obtaining a phrase feature sequence corresponding to the text feature sequence and a target object feature sequence corresponding to the target video frame block feature sequence, and determining a first matching result according to the phrase feature sequence and the target object feature sequence, including:

[0103] Inputting the text feature sequence and the target video frame block feature sequence into the spatial prototype generator to obtain a phrase feature sequence corresponding to the text feature sequence and a target object feature sequence corresponding to the target video frame block feature sequence;

[0104] The phrase feature sequence and the target object feature sequence are input into the target phrase matcher to obtain a first matching result.

[0105] The spatial prototype generator is used to aggregate each text feature vector in the text feature sequence into a phrase feature vector, and to aggregate each target video frame block feature vector in the target video frame block feature sequence into a target object feature vector.

[0106] The target phrase matcher is used to perform feature matching between each target object feature vector and each phrase feature vector.

[0107] The phrase feature sequence refers to a feature sequence composed of each phrase feature vector aggregated from the text feature sequence; the target object feature sequence refers to a feature sequence composed of each target object feature vector aggregated from the target video frame block feature sequence.

[0108] Specifically, the text feature sequence and the target video frame block feature sequence are input into the spatial prototype generator, and the phrase feature sequence corresponding to the text feature sequence and the target object feature sequence corresponding to the target video frame block feature sequence can be obtained. Then, the obtained phrase feature sequence and target object feature sequence are input into the target phrase matcher, and the first matching result for characterizing the matching degree between the search text and each target object in the target candidate video can be obtained. Specifically, the implementation method of obtaining the phrase feature sequence is as follows:

[0109] In a specific implementation provided in this specification, obtaining a phrase feature sequence corresponding to the text feature sequence includes:

[0110] Determining a predicted text weight of a target text feature vector, wherein the target text feature vector is any one of the text feature vectors in the text feature sequence;

[0111] Generate a target phrase feature vector based on the target text feature vector and the predicted text weight;

[0112] Based on each target phrase feature vector, a phrase feature sequence is obtained.

[0113] Since there may be redundant feature vectors in each text feature vector, not all text feature vectors will be aggregated during the process of aggregating the text feature vectors. In order to screen the valid text feature vectors in each text feature vector, the weight corresponding to each text feature vector can be predicted, and the text feature vectors can be aggregated according to the weight corresponding to each text feature vector to generate a phrase feature sequence.

[0114] The target text feature vector refers to any one of the text feature vectors in the text feature sequence. The predicted text weight is used to characterize the importance of the text feature vector in obtaining effective information. To express, N p is the number of phrase feature vectors.

[0115] Specifically, any text feature vector is selected as the target text feature vector in the text feature sequence, the predicted text weight of the target text feature vector is determined, and the target phrase feature vector is generated based on the target text feature vector and the predicted text weight of the target text feature vector, and then, a phrase feature sequence is formed based on the generated target phrase feature vectors. Among them, the phrase feature sequence can be expressed as The generation process of phrase feature sequence can be expressed as

[0116] Furthermore, the method for obtaining the target object feature sequence is as follows:

[0117] In a specific implementation manner provided in this specification, obtaining a target object feature sequence corresponding to the target video frame block feature sequence includes:

[0118] Determine a prediction frame weight of a first frame block feature vector, wherein the first frame block feature vector is any one of the target video frame block feature vectors in the target video frame block feature sequence;

[0119] generating a first object feature vector based on the first frame block feature vector and the predicted frame weight;

[0120] Based on each first object feature vector, a target object feature sequence is obtained.

[0121] Since redundant feature vectors may also exist in the feature vectors of each target video frame block, which may even interfere with cross-modal alignment, not all target video frame block feature vectors will be aggregated during the process of aggregating the feature vectors of each target video frame block. In order to screen out the valid target video frame block feature vectors in the feature vectors of each target video frame block, the weights corresponding to the feature vectors of each target video frame block can be predicted. According to the weights corresponding to the feature vectors of each target video frame block, the feature vectors of each target video frame block are filtered and aggregated to generate a target object feature sequence.

[0122] The first frame block feature vector refers to any one of the target video frame block feature vectors in the target video frame block feature sequence. The predicted frame weight is used to characterize the importance of the target video frame block feature vector in obtaining effective information. To express, N o is the number of feature vectors of the target object.

[0123] Specifically, any target video frame block feature vector is selected as the first frame block feature vector in the target video frame block feature sequence, the predicted frame weight of the first frame block feature vector is determined, and the first object feature vector is generated based on the first frame block feature vector and the predicted frame weight of the first frame block feature vector, and then, the target object feature sequence is formed based on the generated first object feature vectors. The target object feature sequence can be expressed as The generation process of the target object feature sequence can be expressed as

[0124] In this way, redundant text feature vectors and redundant target video frame block feature vectors can be filtered, and a phrase feature sequence corresponding to the text feature sequence and a target object feature sequence corresponding to the target video frame block feature sequence can be aggregated to improve the accuracy of determining the target video.

[0125] After the phrase feature sequence and the target object feature sequence are generated, the phrase feature sequence and the target object feature sequence may be input into a target phrase matcher to obtain a first matching result.

[0126] In a specific implementation manner provided in this specification, obtaining a first matching result includes:

[0127] Selecting a feature vector of an object to be processed from the target object feature sequence;

[0128] Calculating a first similarity between the feature vector of the object to be processed and each phrase feature vector in the phrase feature sequence, and calculating a second similarity between the feature vector of the object to be processed and each target video frame block feature vector in the target video frame block feature sequence;

[0129] Determine a target first similarity among each first similarity, and determine a target second similarity among each second similarity;

[0130] Determining an initial matching result of the feature vector of the object to be processed based on the first target similarity and the second target similarity;

[0131] Based on the initial matching results of the feature vectors of the objects to be processed, a first matching result is generated.

[0132] The feature vector of the object to be processed refers to any one of the feature vectors of the target object in the feature sequence of the target object. The first target similarity specifically refers to the maximum similarity among the first similarities, and the second target similarity specifically refers to the maximum similarity among the second similarities. The initial matching result refers to the matching result between the feature vector of the object to be processed and the feature vectors of each phrase, and is used to determine the phrase feature vector with the maximum similarity to the feature vector of the object to be processed among the feature vectors of each phrase.

[0133] Specifically, after generating the phrase feature sequence and the target object feature sequence, any target object feature vector is selected in the target object feature sequence for processing, that is, as the object feature vector to be processed, and the first similarity between the object feature vector to be processed and each phrase feature vector in the phrase feature sequence, and the second similarity between the object feature vector to be processed and each target video frame block feature vector in the target video frame block feature sequence are calculated, and the maximum first similarity is determined as the target first similarity in the first similarity between the object feature vector to be processed and each phrase feature vector in the phrase feature sequence, and the maximum second similarity is determined as the target second similarity in the second similarity between the object feature vector to be processed and each target video frame block feature vector in the target video frame block feature sequence, and the final similarity of the object feature vector to be processed is determined according to the target first similarity and the target second similarity, and the similarity is determined as the initial matching result of the object feature vector to be processed. Further, based on the same method as above, the initial matching results of each target object feature vector in the target object feature sequence are calculated, and the initial matching results are directly added or weighted and added as the first matching result.

[0134] By calculating the first matching result between the search text and the target candidate video, the matching degree between the search text and each target object in the target candidate video can be obtained.

[0135] Furthermore, after obtaining the first matching result between the retrieved text and the target candidate video, the target object feature sequence, the text feature sequence and the first matching result are input into the second matching layer to obtain the second matching result between the retrieved text and the target candidate video, so that the matching weight corresponding to the target candidate video can be determined based on the first matching result and the second matching result.

[0136] In a specific implementation provided in this specification, the second matching layer includes a temporal prototype generator and a semantic matcher;

[0137] Inputting the target object feature sequence, the text feature sequence, and the first matching result into the second matching layer, and determining a second matching result according to the target object feature sequence and the text feature sequence, comprising:

[0138] Inputting the target object feature sequence into the temporal prototype generator to obtain a semantic feature sequence corresponding to the target object feature sequence;

[0139] A global feature vector is determined in the text feature sequence, and the semantic feature sequence and the global feature vector are input into the semantic matcher to obtain a second matching result.

[0140] The temporal prototype generator is used to aggregate the target object feature vectors in the target object feature sequence into a semantic feature vector. The semantic feature sequence refers to a feature sequence composed of the semantic feature vectors aggregated from the target object feature sequence. The semantic matcher is used to perform feature matching between the global feature vector and the semantic feature vectors.

[0141] Specifically, the target object feature sequence is input into the temporal prototype generator to obtain a semantic feature sequence corresponding to the target object feature sequence, and then a global feature vector is determined in the text feature vector, and the global feature vector and the semantic feature sequence are input into the semantic matcher to obtain a second matching result between the search text and the target candidate video. Furthermore, the implementation method of obtaining the semantic feature sequence corresponding to the target object feature sequence is as follows:

[0142] In a specific implementation provided in this specification, obtaining a semantic feature sequence corresponding to the target object feature sequence includes:

[0143] Decoding the target object feature sequence to obtain a key frame feature sequence;

[0144] Determining the correlation relationship between the key frame feature vectors in the key frame feature sequence;

[0145] Based on the association relationship, generating at least one semantic feature vector;

[0146] Based on each semantic feature vector, a semantic feature sequence is obtained.

[0147] A frame decoder is provided in the temporal prototype generator, which can decode each target object feature vector to generate a key frame feature vector at the frame level, and further, can generate a semantic feature vector based on each key frame feature vector.

[0148] Among them, the key frame feature sequence refers to the feature sequence composed of the key frame feature vectors obtained by decoding the target object feature vector. The key frame feature sequence can be expressed as The semantic feature sequence refers to the feature sequence composed of semantic feature vectors generated by the interaction of each key frame feature vector in the key frame feature sequence. The semantic feature sequence can be expressed as Among them, N e is the number of semantic feature vectors.

[0149] Specifically, a frame decoder is used to decode each target object feature vector in the target object feature sequence, and the spatial relationship between each target object feature vector is analyzed to obtain each key frame feature vector to form a corresponding key frame feature sequence. The association relationship between each key frame feature vector in the key frame feature sequence is determined, and at least one semantic feature vector is generated according to each association relationship, and a semantic feature sequence is generated based on the at least one semantic feature vector.

[0150] Furthermore, the attention mechanism can be used to analyze the spatial relationship between the feature vectors of each target object. Specifically, the frame query feature vector Q is randomly initialized f , the feature vector P of each target object o Perform linear transformation and use the feature vectors after linear transformation as frame key feature vectors K o , and the frame value feature vector V o ,Through mask attention calculation, the spatial relationship between the feature vectors of each target object is obtained, and the key frame feature sequence is generated based on the spatial relationship between the feature vectors of each target object.

[0151] Furthermore, the mask attention calculation can be implemented by the following formula (1):

[0152]

[0153] Among them, P f is the key frame feature vector, Q f is the frame query feature vector, K o is the frame key feature vector, V o is the frame value feature vector, M f is the attention mask, specifically expressed as softmax(.) is a normalized exponential function.

[0154] Similarly, the attention mechanism can be used to dynamically analyze the semantic relationship between the feature vectors of each key frame. Specifically, the semantic query feature vector Q is randomly initialized e , the feature vector P of each key frame f Perform linear transformation and use the feature vectors after linear transformation as semantic key feature vectors K f , and the semantic value feature vector V f , through dynamic attention calculation, the correlation relationship between the feature vectors of each key frame is obtained, and based on the correlation relationship between the feature vectors of each key frame, a semantic feature sequence is generated. Among them, the number of semantic feature vectors can be customized based on actual application conditions, for example, the number of semantic feature vectors can be set to 2, 3, etc.

[0155] Dynamic attention calculation can be achieved by the following formula (2):

[0156]

[0157] Among them, P e is the semantic feature vector, Q e is the semantic query feature vector, K f is the semantic key feature vector, V f is the semantic value feature vector, and softmax(.) is the normalized exponential function.

[0158] Through the above method, the spatial relationship between the feature vectors of each target object is analyzed to generate a key frame feature sequence, and the semantic relationship between the feature vectors of each key frame is analyzed to generate a semantic feature sequence, so that the video semantic diversity of the target candidate video can be known. In the subsequent process of retrieving the target video, the target video can be retrieved in combination with the video semantics of the candidate video, which can improve the accuracy of retrieving the target video.

[0159] After the semantic feature sequence is generated, the search text needs to be matched with the video semantics of the target candidate video to obtain a second matching result between the search text and the target candidate video.

[0160] In a specific implementation manner provided in this specification, obtaining a second matching result includes:

[0161] Determining the semantic similarity between the global feature vector and each semantic feature vector in the semantic feature sequence;

[0162] Based on the semantic similarity of each semantic feature vector, a second matching result between the search text and the target candidate video is determined.

[0163] Specifically, the semantic similarity between the global feature vector and each semantic feature vector in the semantic feature sequence is calculated, the maximum semantic similarity is determined among the semantic similarities between the global feature vector and each semantic feature vector, and the maximum semantic similarity is determined as the second matching result.

[0164] By calculating the second matching result between the search text and the target candidate video, the matching degree between the search text and the video semantics of the target candidate video can be known.

[0165] After obtaining a first matching result and a second matching result between the search text and the target candidate video, a matching weight of the target candidate video is determined based on the first matching result and the second matching result.

[0166] Specifically, the first matching result and the second matching result may be weighted and calculated, and the calculation result may be determined as the matching weight of the target candidate video. The specific calculation method may refer to the following formula (3):

[0167] s=s es +βs op (3)

[0168] Among them, s is the matching weight, s es is the second matching result, s op is the first matching result, and β is the spatial matching factor. β can be manually adjusted based on actual application conditions, and the specific numerical setting is not limited in this specification.

[0169] The video retrieval method provided in this specification determines the matching degree between the retrieval text and each target object in the target candidate video by calculating the first matching result between the retrieval text and the target candidate video, and determines the matching degree between the retrieval text and the video semantics of the target candidate video by calculating the second matching result between the retrieval text and the target candidate video. Then, the matching weight of the target candidate video is determined by combining the first matching result and the second matching result, and the accuracy of determining the matching weight of the target candidate video is improved by analyzing the local content and the overall content of the target candidate video.

[0170] See also Figure 3 , Figure 3 FIG. 1 shows a schematic diagram of a model architecture of a video matching model provided according to an embodiment of the present specification. Figure 3 As shown, the video matching model includes an encoding layer, a first matching layer and a second matching layer. The encoding layer includes a video encoder and a text encoder, the first matching layer includes a spatial prototype generator and a target phrase matcher, and the second matching layer includes a temporal prototype generator and a semantic matcher.

[0171] Furthermore, in the actual application process, the search text is input into the text encoder of the encoding layer to obtain the text feature sequence corresponding to the search text, and the target candidate video is input into the video encoder of the encoding layer to obtain the target video frame block feature sequence corresponding to the target candidate video; the text feature sequence and the target video frame block feature sequence are input into the spatial prototype generator of the first matching layer to obtain the phrase feature sequence corresponding to the text feature sequence and the target object feature sequence corresponding to the target video frame block feature sequence; the phrase feature sequence and the target object feature sequence are input into the target phrase matcher of the first matching layer to obtain the first matching result; further, the target object feature sequence is input into the temporal prototype generator of the second matching layer to obtain the semantic feature sequence corresponding to the target object feature sequence; the global feature vector and the semantic feature sequence in the text feature sequence are input into the semantic matcher of the second matching layer to obtain the second matching result; finally, the second matching layer calculates the matching weight of the target candidate video based on the first matching result and the second matching result. By combining the analysis of the local content and the overall content of the target candidate video, the accuracy of determining the matching weight of the target candidate video is improved.

[0172] Furthermore, in order to improve the accuracy of the video matching model, the video matching model is trained by the following method:

[0173] Obtaining training data sample pairs and matching weight labels corresponding to the training data sample pairs;

[0174] Inputting the training data sample pairs into the video matching model to obtain predicted matching weights;

[0175] Calculating a model loss value of the video matching model according to the matching weight label and the predicted matching weight;

[0176] The model parameters of the video matching model are adjusted according to the model loss value, and the layout generation model is continuously trained until a training stop condition is reached.

[0177] Among them, the training data sample pair refers to the text-video data pair obtained in the training data sample pair set, which is the training sample of the video matching model, including the positive example of the training data sample pair and the negative example of the training data sample pair; the training data sample pair set refers to the text content in the collected input speech or input text, and the video retrieved according to the text content, which is composed of the text-video data pair set; the matching weight label refers to the actual matching weight corresponding to the training data sample pair; the predicted matching weight refers to the matching weight output by inputting the training data sample pair into the video matching model; the model loss value refers to the difference between the matching weight label and the predicted matching weight, which is used to measure the difference between the matching weight label and the predicted matching weight.

[0178] Specifically, the text data in the training data sample pair is obtained by the above-mentioned acquisition method of obtaining the retrieved text, and the video obtained based on the text data retrieval and the corresponding text data constitute the positive training data sample pair, and the other text-video data pairs of the same batch in the training data sample pair set constitute the negative training data sample pair. The training data sample pair is input into the video matching model, and the video matching model is used to predict the matching weight of the training data sample pair. At this time, the video matching model is a model that has not been trained yet. There will be a deviation between the predicted predicted matching weight and the actual matching weight label, and the model parameters of the video matching model need to be adjusted accordingly. Specifically, the model loss value of the video matching model is calculated according to the output predicted matching weight and matching weight label. The loss function for calculating the model loss value can be a 0-1 loss function, a square loss function, a cross entropy loss function, etc. in actual applications. In this specification, preferably, the cross entropy function is selected as the loss function for calculating the model loss value, and the model parameters of the video matching model are adjusted according to the model loss value. The adjusted model parameters are used for the next batch of training data sample pairs to continue training the video matching model until the stop condition of the model training is reached.

[0179] Specifically, the model training stopping conditions include that the model loss value is less than a preset threshold and / or the training rounds reach a preset round.

[0180] In a specific implementation provided in this specification, taking the training stop condition of the model loss value being less than a preset threshold as an example, the preset threshold is 0.3. When the model loss value is less than 0.3, it is considered that the video matching model training is completed.

[0181] In another specific implementation provided in the present specification, taking the preset training rounds as the training stop condition as an example, the preset training rounds are 30 rounds. When the training rounds of the training data sample pair reach 30 rounds, the video matching model training is considered to be completed.

[0182] In another specific implementation manner provided in the present specification, two training stop conditions, a preset threshold and a preset training round, are set, and the model loss value and the training rounds are monitored simultaneously. When either the model loss value or the training rounds meets the training stop condition, the video matching model training is considered completed.

[0183] The video retrieval method provided in this specification analyzes and processes the retrieval text and the target candidate video through a trained video matching model to obtain the matching weight corresponding to the target candidate video, thereby improving the accuracy of determining the matching weight of the target candidate video.

[0184] Step 206: Determine at least one target video from the at least one candidate video based on the matching weight corresponding to each candidate video.

[0185] The target video refers to a video that has a high degree of matching with the search text and can be used to be displayed on the client based on the search text.

[0186] Specifically, after determining the matching weights corresponding to the candidate videos, the target video corresponding to the search text can be determined in the candidate videos based on the matching weights corresponding to the candidate videos.

[0187] In a specific implementation provided in this specification, based on the matching weights corresponding to the candidate videos, determining at least one target video from the at least one candidate video includes:

[0188] Determine the candidate video whose matching weight is greater than or equal to a preset matching weight threshold as the target video; or

[0189] The candidate videos are sorted according to the matching weights corresponding to the candidate videos to obtain a candidate video list, and a target video is determined in the candidate video list based on a preset number of videos.

[0190] The preset matching weight threshold refers to the preset minimum value of the matching weight, which is used to measure the matching degree between each candidate video and the search text. The preset number of videos refers to the preset number of selectable target videos.

[0191] Specifically, after determining the matching weight corresponding to each candidate video, a preset matching weight threshold can be obtained, and candidate videos whose matching weights are greater than or equal to the preset matching weight threshold are determined among the candidate videos, and candidate videos whose matching weights are greater than or equal to the preset matching weight threshold are determined as target videos.

[0192] Furthermore, after determining the matching weight corresponding to each candidate video, a preset number of videos can also be obtained, and then, according to the matching weight corresponding to each candidate video, each candidate video is sorted to obtain a candidate video list, and a preset number of candidate videos are selected from the candidate video list as target videos.

[0193] The implementation method for determining the target video can be set according to actual application conditions, and this specification does not limit it here.

[0194] The video retrieval method provided in this specification, after obtaining the matching weights corresponding to each candidate video, determines the target video among the candidate videos based on the matching weights corresponding to each candidate video, thereby improving the accuracy of determining the target video.

[0195] See also Figure 4a , Figure 4a FIG. 1 shows a schematic diagram of an interactive interface of a video retrieval method provided according to an embodiment of the present specification. Figure 4aAs shown, the user can enter the search text to be searched in the search bar of the client to generate a video search instruction. After receiving the video search instruction, the server uses the above video search method to determine at least one target video in the preset database, and feeds back the target video and displays it to the client. The display interface can be as shown in FIG. Figure 4a shown.

[0196] See also Figure 4b , Figure 4b FIG. 2 shows a schematic diagram of an interactive interface of another video retrieval method provided according to an embodiment of the present specification. Figure 4b As shown, the user can enter the search text to be searched in the search bar of the client to generate a video search instruction. After receiving the video search instruction, the server uses the above video search method to determine at least one target video in the preset database, and feeds back the target video and displays it to the client. The display interface can be as shown in FIG. Figure 4b shown.

[0197] It should be noted that the user's method of inputting search text is not limited to text input, and voice input can also be used. Figure 4a and Figure 4b This is for illustrative purposes only.

[0198] The video retrieval method provided in this specification includes: obtaining a retrieval text and at least one candidate video; inputting the retrieval text and the target candidate video into a video matching model, and obtaining a matching weight corresponding to the target candidate video output by the video matching model, wherein the target candidate video is any one of the at least one candidate video, and the matching weight is determined based on a first matching result and a second matching result between the retrieval text and the target candidate video, the first matching result being used to characterize the matching degree between the retrieval text and each target object in the target candidate video, and the second matching result being used to characterize the matching degree between the retrieval text and the video semantics of the target candidate video; based on the matching weight corresponding to each candidate video, at least one target video is determined in the at least one candidate video.

[0199] In one embodiment of the present specification, the first matching result between the search text and the target candidate video is calculated to determine the matching degree between the search text and each target object in the target candidate video, and the second matching result between the search text and the target candidate video is calculated to determine the matching degree between the search text and the video semantics of the target candidate video. Then, the matching weight of the target candidate video is determined by combining the first matching result and the second matching result, and the accuracy of determining the matching weight of the target candidate video is improved by analyzing the local content and the overall content of the target candidate video; then, the target video is determined in each candidate video according to the matching weight corresponding to each candidate video, thereby improving the accuracy of text-based video retrieval.

[0200] The following combination Figure 5 , taking the application of the video retrieval method provided in this specification in text-based video retrieval as an example, the video retrieval method is further described. Figure 5 A process flow chart of a video retrieval method provided by an embodiment of the present specification is shown, which specifically includes the following steps:

[0201] Step 502: Obtain the search text "cook noodles" and at least one candidate video.

[0202] Step 504: Input the search text "cook noodles" into the text encoder of the video matching model to obtain the text feature sequence of the search text "cook noodles", input the target candidate video into the video encoder of the video matching model to obtain the target video frame block feature sequence of the target candidate video.

[0203] Step 506: Input the text feature sequence and the target video frame block feature sequence into the spatial prototype generator of the video matching model to obtain a phrase feature sequence corresponding to the text feature sequence and a target object feature sequence corresponding to the target video frame block feature sequence.

[0204] Step 508: Input the phrase feature sequence and the target object feature sequence into the target phrase matcher of the video matching model to obtain a first matching result.

[0205] Step 510: Input the target object feature sequence into the temporal prototype generator of the video matching model to obtain a semantic feature sequence corresponding to the target object feature sequence.

[0206] Step 512: Determine a global feature vector in the text feature sequence, input the semantic feature sequence and the global feature vector into the semantic matcher of the video matching model, and obtain a second matching result.

[0207] Step 514: Determine a matching weight corresponding to the target candidate video based on the first matching result and the second matching result.

[0208] Step 516: Determine at least one target video from the at least one candidate video based on the matching weight corresponding to each candidate video.

[0209] In one embodiment of the present specification, the first matching result between the search text "cook noodles" and the target candidate video is calculated to determine the matching degree between the search text "cook noodles" and each target object in the target candidate video, and the second matching result between the search text "cook noodles" and the target candidate video is calculated to determine the matching degree between the search text "cook noodles" and the video semantics of the target candidate video. Then, the matching weight of the target candidate video is determined by combining the first matching result and the second matching result, and the accuracy of determining the matching weight of the target candidate video is improved by analyzing the local content and the overall content of the target candidate video; then, the target video is determined in each candidate video according to the matching weight corresponding to each candidate video, thereby improving the accuracy of text-based video retrieval.

[0210] Corresponding to the above method embodiment, this specification also provides a video retrieval device embodiment, Figure 6 FIG. 2 shows a schematic diagram of the structure of a video retrieval device provided by an embodiment of the present specification. Figure 6 As shown, the device comprises:

[0211] An acquisition module 602 is configured to acquire a search text and at least one candidate video;

[0212] An input module 604 is configured to input the search text and the target candidate video into a video matching model, and obtain a matching weight corresponding to the target candidate video output by the video matching model, wherein the target candidate video is any one of the at least one candidate video, and the matching weight is determined based on a first matching result and a second matching result between the search text and the target candidate video, wherein the first matching result is used to characterize the matching degree between the search text and each target object in the target candidate video, and the second matching result is used to characterize the matching degree between the search text and the video semantics of the target candidate video;

[0213] The determination module 606 is configured to determine at least one target video from the at least one candidate video based on the matching weight corresponding to each candidate video.

[0214] Optionally, the video matching model includes a coding layer, a first matching layer and a second matching layer;

[0215] The input module is further configured as follows:

[0216] Inputting the search text and the target candidate video into the coding layer to obtain a text feature sequence of the search text and a target video frame block feature sequence of the target candidate video;

[0217] Inputting the text feature sequence and the target video frame block feature sequence into the first matching layer, obtaining a phrase feature sequence corresponding to the text feature sequence and a target object feature sequence corresponding to the target video frame block feature sequence, and determining a first matching result according to the phrase feature sequence and the target object feature sequence;

[0218] The target object feature sequence, the text feature sequence and the first matching result are input into the second matching layer, a second matching result is determined according to the target object feature sequence and the text feature sequence, and a matching weight corresponding to the target candidate video is determined based on the first matching result and the second matching result.

[0219] Optionally, the encoding layer includes a text encoder and a video encoder;

[0220] The input module is further configured as follows:

[0221] Inputting the search text into the text encoder to obtain a text feature sequence of the search text;

[0222] The target candidate video is input into the video encoder to obtain a target video frame block feature sequence of the target candidate video.

[0223] Optionally, the first matching layer includes a spatial prototype generator and a target phrase matcher;

[0224] The input module is further configured as follows:

[0225] Inputting the text feature sequence and the target video frame block feature sequence into the spatial prototype generator to obtain a phrase feature sequence corresponding to the text feature sequence and a target object feature sequence corresponding to the target video frame block feature sequence;

[0226] The phrase feature sequence and the target object feature sequence are input into the target phrase matcher to obtain a first matching result.

[0227] Optionally, the input module is further configured as:

[0228] Determining a predicted text weight of a target text feature vector, wherein the target text feature vector is any one of the text feature vectors in the text feature sequence;

[0229] Generate a target phrase feature vector based on the target text feature vector and the predicted text weight;

[0230] Based on each target phrase feature vector, a phrase feature sequence is obtained.

[0231] Optionally, the input module is further configured as:

[0232] Determine a prediction frame weight of a first frame block feature vector, wherein the first frame block feature vector is any one of the target video frame block feature vectors in the target video frame block feature sequence;

[0233] generating a first object feature vector based on the first frame block feature vector and the predicted frame weight;

[0234] Based on each first object feature vector, a target object feature sequence is obtained.

[0235] Optionally, the input module is further configured as:

[0236] Selecting a feature vector of an object to be processed from the target object feature sequence;

[0237] Calculating a first similarity between the feature vector of the object to be processed and each phrase feature vector in the phrase feature sequence, and calculating a second similarity between the feature vector of the object to be processed and each target video frame block feature vector in the target video frame block feature sequence;

[0238] Determine a target first similarity among each first similarity, and determine a target second similarity among each second similarity;

[0239] Determining an initial matching result of the feature vector of the object to be processed based on the first target similarity and the second target similarity;

[0240] Based on the initial matching results of the feature vectors of the objects to be processed, a first matching result is generated.

[0241] Optionally, the second matching layer includes a temporal prototype generator and a semantic matcher;

[0242] The input module is further configured as follows:

[0243] Inputting the target object feature sequence into the temporal prototype generator to obtain a semantic feature sequence corresponding to the target object feature sequence;

[0244] A global feature vector is determined in the text feature sequence, and the semantic feature sequence and the global feature vector are input into the semantic matcher to obtain a second matching result.

[0245] Optionally, the input module is further configured as:

[0246] Decoding the target object feature sequence to obtain a key frame feature sequence;

[0247] Determining the correlation relationship between the key frame feature vectors in the key frame feature sequence;

[0248] Based on the association relationship, generating at least one semantic feature vector;

[0249] Based on each semantic feature vector, a semantic feature sequence is obtained.

[0250] Optionally, the input module is further configured as:

[0251] Determining the semantic similarity between the global feature vector and each semantic feature vector in the semantic feature sequence;

[0252] Based on the semantic similarity of each semantic feature vector, a second matching result between the search text and the target candidate video is determined.

[0253] Optionally, the determining module is further configured to:

[0254] Determine the candidate video whose matching weight is greater than or equal to a preset matching weight threshold as the target video; or

[0255] The candidate videos are sorted according to the matching weights corresponding to the candidate videos to obtain a candidate video list, and a target video is determined in the candidate video list based on a preset number of videos.

[0256] Optionally, the device further comprises a training module configured to:

[0257] Obtaining training data sample pairs and matching weight labels corresponding to the training data sample pairs;

[0258] Inputting the training data sample pairs into the video matching model to obtain predicted matching weights;

[0259] Calculating a model loss value of the video matching model according to the matching weight label and the predicted matching weight;

[0260] The model parameters of the video matching model are adjusted according to the model loss value, and the layout generation model is continuously trained until a training stop condition is reached.

[0261] The video retrieval device provided in this specification includes: an acquisition module, configured to acquire a search text and at least one candidate video; an input module, configured to input the search text and the target candidate video into a video matching model, and obtain a matching weight corresponding to the target candidate video output by the video matching model, wherein the target candidate video is any one of the at least one candidate video, and the matching weight is determined based on a first matching result and a second matching result between the search text and the target candidate video, the first matching result being used to characterize the matching degree between the search text and each target object in the target candidate video, and the second matching result being used to characterize the matching degree between the search text and the video semantics of the target candidate video; a determination module, configured to determine at least one target video in the at least one candidate video based on the matching weight corresponding to each candidate video.

[0262] In one embodiment of the present specification, the first matching result between the search text and the target candidate video is calculated to determine the matching degree between the search text and each target object in the target candidate video, and the second matching result between the search text and the target candidate video is calculated to determine the matching degree between the search text and the video semantics of the target candidate video. Then, the matching weight of the target candidate video is determined by combining the first matching result and the second matching result, and the accuracy of determining the matching weight of the target candidate video is improved by analyzing the local content and the overall content of the target candidate video; then, the target video is determined in each candidate video according to the matching weight corresponding to each candidate video, thereby improving the accuracy of text-based video retrieval.

[0263] The above is a schematic scheme of a video retrieval device of this embodiment. It should be noted that the technical scheme of the video retrieval device and the technical scheme of the above video retrieval method belong to the same concept, and the details not described in detail in the technical scheme of the video retrieval device can be referred to the description of the technical scheme of the above video retrieval method.

[0264] Figure 7 The block diagram of a computing device 700 according to an embodiment of the present specification is shown. The components of the computing device 700 include but are not limited to a memory 710 and a processor 720. The processor 720 is connected to the memory 710 via a bus 730, and the database 750 is used to store data.

[0265] The computing device 700 also includes an access device 740 that enables the computing device 700 to communicate via one or more networks 760. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 740 may include one or more of any type of network interface (e.g., a network interface card (NIC)) that is wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a world-wide interoperability for microwave access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, and a near field communication (NFC).

[0266] In one embodiment of the present specification, the above components of the computing device 700 and Figure 7 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 7 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.

[0267] The computing device 700 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 700 may also be a mobile or stationary server.

[0268] The processor 720 is used to execute the following computer executable instructions, which implement the steps of the above-mentioned video retrieval method when executed by the processor.

[0269] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above video retrieval method belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the above video retrieval method.

[0270] An embodiment of the present specification further provides a computer-readable storage medium storing computer-executable instructions, which can implement the steps of the above-mentioned video retrieval method when executed by a processor.

[0271] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the above video retrieval method belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the above video retrieval method.

[0272] An embodiment of the present specification further provides a computer program, wherein when the computer program is executed in a computer, the computer is caused to execute the steps of the above-mentioned video retrieval method.

[0273] The above is a schematic scheme of a computer program of this embodiment. It should be noted that the technical scheme of the computer program and the technical scheme of the above video retrieval method belong to the same concept, and the details not described in detail in the technical scheme of the computer program can be referred to the description of the technical scheme of the above video retrieval method.

[0274] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0275] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.

[0276] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of this specification are not limited by the order of the actions described, because according to the embodiments of this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of this specification.

[0277] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0278] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to only the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of this specification, so that technicians in the relevant technical field can well understand and use this specification. This specification is only limited by the claims and their full scope and equivalents.

Claims

1. A video retrieval method, comprising: Obtaining a search text and at least one candidate video; Input the search text and the target candidate video into a video matching model, and obtain a matching weight corresponding to the target candidate video output by the video matching model, wherein the target candidate video is any one of the at least one candidate video, and the matching weight is determined based on a first matching result and a second matching result between the search text and the target candidate video, wherein the first matching result is used to characterize the matching degree between the search text and each target object in the target candidate video, and the second matching result is used to characterize the matching degree between the search text and the video semantics of the target candidate video; At least one target video is determined from the at least one candidate video based on the matching weights corresponding to the candidate videos.

2. The method of claim 1, wherein the video matching model comprises a coding layer, a first matching layer, and a second matching layer; Inputting the search text and the target candidate video into a video matching model, and obtaining a matching weight corresponding to the target candidate video output by the video matching model, comprises: Inputting the search text and the target candidate video into the coding layer to obtain a text feature sequence of the search text and a target video frame block feature sequence of the target candidate video; Inputting the text feature sequence and the target video frame block feature sequence into the first matching layer, obtaining a phrase feature sequence corresponding to the text feature sequence and a target object feature sequence corresponding to the target video frame block feature sequence, and determining a first matching result according to the phrase feature sequence and the target object feature sequence; The target object feature sequence, the text feature sequence and the first matching result are input into the second matching layer, a second matching result is determined according to the target object feature sequence and the text feature sequence, and a matching weight corresponding to the target candidate video is determined based on the first matching result and the second matching result.

3. The method of claim 2, wherein the encoding layer comprises a text encoder and a video encoder; Inputting the search text and the target candidate video into a video matching model to obtain a text feature sequence of the search text and a target video frame block feature sequence of the target candidate video, including: Inputting the search text into the text encoder to obtain a text feature sequence of the search text; The target candidate video is input into the video encoder to obtain a target video frame block feature sequence of the target candidate video.

4. The method of claim 2, wherein the first matching layer comprises a spatial prototype generator and a target phrase matcher; Inputting the text feature sequence and the target video frame block feature sequence into the first matching layer, obtaining a phrase feature sequence corresponding to the text feature sequence and a target object feature sequence corresponding to the target video frame block feature sequence, and determining a first matching result according to the phrase feature sequence and the target object feature sequence, including: Inputting the text feature sequence and the target video frame block feature sequence into the spatial prototype generator to obtain a phrase feature sequence corresponding to the text feature sequence and a target object feature sequence corresponding to the target video frame block feature sequence; The phrase feature sequence and the target object feature sequence are input into the target phrase matcher to obtain a first matching result.

5. The method according to claim 4, obtaining a phrase feature sequence corresponding to the text feature sequence, comprising: Determine the predicted text weight of the target text feature vector, where The target text feature vector is any one of the text feature vectors in the text feature sequence; Generate a target phrase feature vector based on the target text feature vector and the predicted text weight; Based on each target phrase feature vector, a phrase feature sequence is obtained.

6. The method according to claim 4, obtaining the target object feature sequence corresponding to the target video frame block feature sequence, comprising: Determine a prediction frame weight of a first frame block feature vector, wherein the first frame block feature vector is any one of the target video frame block feature vectors in the target video frame block feature sequence; generating a first object feature vector based on the first frame block feature vector and the predicted frame weight; Based on each first object feature vector, a target object feature sequence is obtained.

7. The method of claim 4, obtaining the first matching result, comprising: Selecting a feature vector of an object to be processed from the target object feature sequence; Calculating a first similarity between the feature vector of the object to be processed and each phrase feature vector in the phrase feature sequence, and calculating a second similarity between the feature vector of the object to be processed and each target video frame block feature vector in the target video frame block feature sequence; Determine a target first similarity among each first similarity, and determine a target second similarity among each second similarity; Determining an initial matching result of the feature vector of the object to be processed based on the first target similarity and the second target similarity; Based on the initial matching results of the feature vectors of the objects to be processed, a first matching result is generated.

8. The method according to claim 2, wherein the second matching layer comprises a temporal prototype generator and a semantic matcher; Inputting the target object feature sequence, the text feature sequence, and the first matching result into the second matching layer, and determining a second matching result according to the target object feature sequence and the text feature sequence, comprising: Inputting the target object feature sequence into the temporal prototype generator to obtain a semantic feature sequence corresponding to the target object feature sequence; A global feature vector is determined in the text feature sequence, and the semantic feature sequence and the global feature vector are input into the semantic matcher to obtain a second matching result.

9. The method according to claim 8, wherein obtaining the semantic feature sequence corresponding to the target object feature sequence comprises: Decoding the target object feature sequence to obtain a key frame feature sequence; Determining the correlation relationship between the key frame feature vectors in the key frame feature sequence; Based on the association relationship, generating at least one semantic feature vector; Based on each semantic feature vector, a semantic feature sequence is obtained.

10. The method of claim 8, obtaining the second matching result, comprising: Determining the semantic similarity between the global feature vector and each semantic feature vector in the semantic feature sequence; Based on the semantic similarity of each semantic feature vector, a second matching result between the search text and the target candidate video is determined.

11. The method according to claim 1, determining at least one target video from the at least one candidate video based on the matching weights corresponding to the candidate videos, comprises: Determine the candidate video whose matching weight is greater than or equal to the preset matching weight threshold as the target video; or The candidate videos are sorted according to the matching weights corresponding to the candidate videos to obtain a candidate video list, and a target video is determined in the candidate video list based on a preset number of videos.

12. The method according to claim 1, wherein the video matching model is trained by the following method: Obtaining training data sample pairs and matching weight labels corresponding to the training data sample pairs; Inputting the training data sample pairs into the video matching model to obtain predicted matching weights; Calculating a model loss value of the video matching model according to the matching weight label and the predicted matching weight; The model parameters of the video matching model are adjusted according to the model loss value, and the layout generation model is continuously trained until a training stop condition is reached.

13. A computing device comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of the video retrieval method according to any one of claims 1 to 12 are implemented.

14. A computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions, when executed by a processor, implement the steps of the video retrieval method according to any one of claims 1 to 12.