Video retrieval question and answer method and system based on multi-modal large model
By processing video and audio information through multi-modal large models, key frames and subtitle texts are extracted, which solves the limitations of relying on pure text tags in the existing technology, enables rapid understanding and precise search of video content, and improves the efficiency of video retrieval. and accuracy.
Patent Information
- Application Number
- CN202411116662.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-15
- Publication Date
- 2024-09-10
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing video retrieval technology relies on manually annotated text descriptions, making it difficult to fully utilize the multi-modal information in videos, resulting in inaccurate and irrelevant retrieval results, and making it difficult to deeply understand complex semantic relationships.
Using a video retrieval question and answer method based on multi-modal large models, by obtaining video and audio information, extracting key frames and subtitle texts, performing vectorization processing and storing them in the database, using hybrid search and multi-modal models to perform similarity searches, we get Related video clips and subtitle text enable quick understanding and precise search of video content.
It improves the efficiency of video information extraction and retrieval accuracy, can quickly understand and locate the information in the video, and achieve more precise video search and question and answer.
Smart Images

Figure CN118626673A
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of artificial intelligence technology, and in particular relates to a video retrieval question-answering method and system based on a multimodal large model. Background Art
[0002] With the rapid development of the Internet and multimedia technology, video has become an important medium for information dissemination, entertainment and education. In areas such as social media, online video platforms, news media and online education, the generation and consumption of video content are increasing dramatically. However, how to efficiently and accurately extract and retrieve the required information from massive videos has become a major challenge. Existing video retrieval technologies mainly rely on text tags, metadata or manual annotation methods. Although these methods can meet user needs to a certain extent, they have the following limitations: Reliance on text description: Traditional methods require adding detailed text descriptions or labels to each video. This manual annotation is not only time-consuming and labor-intensive, but also easily affected by subjective factors, resulting in inaccurate or incomplete labels.
[0003] Ignoring multimodal information: Videos usually contain multiple types of information, including visual (images), auditory (audio), and text (subtitles), which play a complementary role in content understanding. Methods that rely solely on text tags are unable to fully utilize the multimodal information in videos, thus affecting the accuracy and relevance of retrieval results.
[0004] Lack of deep understanding: Traditional methods have difficulty in deeply understanding the complex semantic relationships in video content, such as the interactions between characters and the development process of events, resulting in poor performance when processing complex queries. Summary of the invention
[0005] The present invention aims at solving the problems in the prior art, and the technical solution adopted in this application is as follows: In a first aspect, the present invention provides a video retrieval question answering method based on a multimodal large model, comprising: step 1, obtaining a video file, and performing channel splitting to obtain video information and audio information; Step 2, decomposing the video information to obtain a list of multiple video segments; Step 3, decomposing the audio information to obtain subtitle information; Step 4, optimizing and aligning the video clip list and the subtitle information timestamps to obtain the video clip and the subtitle text; Step 5: extract several key frames from the video clip to form a frame list, and use the multimodal model to vectorize the frame list and subtitle text to obtain a feature vector and , and store it in the vector database together with the source information; Step 6, obtaining user input, vectorizing the user input, and performing similarity search in the vector database through a hybrid search method to obtain relevant video clips and relevant subtitle texts; Step 7: Put the user input, relevant video clips and relevant subtitle text into the set prompt word template and send them to the multimodal model to obtain the final answer.
[0006] Furthermore, step 2 includes using a key frame extraction algorithm to extract video information The key frames of the camera switching are output as a frame list of different video clips. According to the frame rate of the video, the frame list is converted into a timestamp list to obtain a video clip list. .
[0007] Further, step 3 includes using a paraformer model to process the audio information Perform feature extraction and output as a text The timestamp of each word is used to further segment the text using punctuation marks, and the time interval corresponding to the text is given according to the timestamp of the beginning and end characters of each text segment, thereby generating subtitle information. .
[0008] Furthermore, step 4 includes extracting a list of video clips Each time period in the Match the time period, find the subtitle that best matches each Shot, and sort the video clip list according to the time period of the subtitle. The time period is adjusted to obtain the video clip and the corresponding subtitle text .
[0009] Furthermore, the step 5 includes uniformly sampling the video clips using an average frame sampling method to obtain a plurality of frame images to form a frame list. , which will further form a frame list Input the clip4clip model and get the corresponding feature vector and , store the image vector and subtitle vector corresponding to each Shot into the vector database, and mark the time period and the source information of the video path to which it belongs.
[0010] Further, step 6 includes: obtaining user input , and send it to the clip4clip model to vectorize it, and calculate its difference with the vector database and The similarity score is calculated by the weightedranker strategy. :
[0011] in, and Corresponding to and The weight coefficient of ; Get points The video clip corresponding to the highest data and subtitle text As relevant information.
[0012] Furthermore, the step 7 integrates the user input through the pre-specified prompt word template. , Related video clips and related subtitle text , and feed it into the Video-LLaMa model to get the final answer.
[0013] In the second aspect, a video retrieval question answering system based on a multimodal large model includes: The audio and video channel splitting module is configured to: obtain a video file, and perform channel splitting to obtain video information and audio information; The video decomposition module is configured to: decompose the video information to obtain a list of multiple video segments; The audio decomposition module is configured to: decompose the audio information to obtain subtitle information; The information alignment module is configured to: optimize and align the video clip list and the timestamps of the subtitle information to obtain the video clip and the subtitle text; The vectorization module is configured to extract several key frames from the video clip to form a frame list, and use the multimodal model to vectorize the frame list and subtitle text to obtain a feature vector and , and store it in the vector database together with the source information; The retrieval module is configured to: obtain user input, vectorize the user input, perform similarity search in the vector database through a hybrid search method, and obtain relevant video clips and relevant subtitle texts; The question-answering module is configured to: put user input, relevant video clips and relevant subtitle text into the set prompt word template, and send them to the multimodal model to obtain the final answer.
[0014] In a third aspect, a computer-readable storage medium includes a stored program, wherein when the program is running, the device where the computer-readable storage medium is located is controlled to execute the video retrieval question-answering method based on a multimodal large model described in the first aspect.
[0015] In a fourth aspect, an electronic device comprises a memory for storing computer program instructions and a processor for executing the program instructions, wherein when the computer program instructions are executed by the processor, the electronic device is triggered to execute the video retrieval question-answering method based on a multimodal large model as described in the first aspect.
[0016] Compared with the prior art, the advantages and positive effects of the present invention are: 1. The present invention provides a video retrieval question-answering method based on a multimodal large model. The audio and video modes are respectively subjected to frame extraction and translation processing and vectorized and stored in a database. The user's questions are retrieved in the database through a hybrid search method to obtain the video and text with the highest similarity. The user's questions are answered according to the retrieved video through the multimodal large model, thereby improving the efficiency of obtaining information from the video, enabling rapid understanding and answering of the video content, and achieving more accurate video search, clip positioning and video information question-answering.
[0017] 2. The present invention can quickly extract video information through video speech and image understanding, thereby improving the efficiency of video information extraction, accurately retrieve related video and subtitle information through input content, and utilize both audio and video modes to improve video retrieval accuracy; accurately locate clips in the video through detailed video segmentation and subtitle information according to user questions, and improve the efficiency of video content question and answer based on video and subtitle information. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0019] Figure 1 The present invention is a flowchart of a video retrieval question answering method based on a multimodal large model. DETAILED DESCRIPTION
[0020] In order to more clearly understand the above-mentioned purpose, features and advantages of the present invention, the present invention is further described below in conjunction with the accompanying drawings and embodiments. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0021] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways than those described herein. Therefore, the present invention is not limited to the specific embodiments of the following disclosure.
[0022] Embodiment 1, as Figure 1 As shown, the present application provides a video retrieval question-answering method based on a multimodal large model, including: extracting frames and translating the two modes of audio and video respectively and storing them in a database in a vectorized manner, retrieving the user's questions in the database through a hybrid search method, obtaining the video and text with the highest similarity, and further answering the user's questions based on the retrieved video through a multimodal large model, aiming to achieve rapid understanding and question-answering of video content. The specific steps are as follows: Step 1) Use the ffmpeg tool to split the video files of various formats into channels and obtain video information and audio information .
[0023] Step 2) For video information Perform Shot segmentation to obtain a list of multiple video clips .
[0024] Step 3) For audio information Perform ASR translation and timestamp decomposition to obtain subtitle information .
[0025] Step 4) According to the video clip list Corresponding timestamp and subtitle information The timestamp of each subtitle in the video is used to optimize and align the video shot segmentation results to obtain video segments. At the same time, the subtitle information is segmented according to the timestamp to obtain the subtitle text corresponding to the shot .
[0026] Step 5) In the video clip Extract several key frames to form a frame list , use the multimodal embedding model for the frame list and subtitle text Perform vectorization processing to obtain the feature vector and , and stored in the vector database together with the source information.
[0027] Step 6) Enter the user input Vectorization, further similarity search in the vector database through hybrid search, and finally obtain relevant video clips and subtitle text .
[0028] Step 7) Enter the user input , video clips and subtitle text Put in the set prompt word template and send it to the multimodal large model to get the final answer.
[0029] Among them, step 2) uses the key frame extraction algorithm to extract video information The key frames of the camera switching are output as a frame list of different video clips. The frame list is further converted into a timestamp list according to the frame rate of the video to obtain a video clip list. Step 3) Use the paraformer speech translation model to translate the audio information Perform feature extraction and output as a text The timestamp of each word is used to further segment the text based on punctuation marks, and the time interval corresponding to the text is given according to the timestamps of the beginning and end characters of each text segment, thereby generating subtitle information. Step 4) Extract the video clip list Each time period in the The time period of each Shot is matched, and then the time period of each Shot is corrected to obtain the most matching subtitle for each Shot (which may contain one or more sentences). The video clip list is sorted according to the time period of the subtitle. The time period is adjusted to obtain the video clip and the corresponding subtitle text Step 5) Use the average frame sampling method to uniformly sample the video clips to obtain several frames of images to form a frame list , further the frame list and subtitle text Input the clip4clip model to extract the vector and get the corresponding feature vector and , store the image vector and subtitle vector corresponding to each Shot into the vector database, and mark the source information such as time period and video path. Step 6) Get user input , and send it to the clip4clip model to vectorize it, and calculate its difference with the vector database and The similarity score is calculated by the weightedranker strategy. :
[0030] in, and Corresponding to and The weight coefficient of .
[0031] Get points The video clip corresponding to the highest data and subtitle text Step 7) Integrate the user input with the pre-specified prompt word template , video clips and subtitle text , and feed it into the Video-LLaMa model for multimodal information extraction and obtain the final answer.
[0032] See the flowchart Figure 1 , taking news video retrieval question answering as an example, it includes the following steps: Establish a news video database, use ffmpeg to split the audio and video channels of the videos in the database, and obtain video information and audio information .
[0033] Read video information one by one The frame information of the video is captured by the following formula:
[0034] in, is the color histogram of two consecutive frames, and Histogram and The mean of .
[0035] The frame interval of each shot in the video is further obtained based on the key frame list, and the corresponding time period of the frame interval is further calculated based on the video frame rate:
[0036]
[0037] in, is the frame rate of the video, is the number of the starting frame, is the number of the ending frame, is the start frame timestamp, is the end frame timestamp.
[0038] Get a list of video clips based on time period .
[0039] For audio information , use the paraformer speech translation model to get a piece of text, and the start and end timestamps corresponding to each character, use the langchain tool to segment the text according to punctuation marks to obtain several text segments, extract the start timestamp of the first character and the end timestamp of the last character of each text segment as the start and end timestamps of this text, and finally integrate all text segments and their corresponding time intervals to generate subtitle information .
[0040] Extract video clip list Each time period in the Match the time period of each Shot, find the subtitle that best matches each Shot (may contain one or more sentences), and sort the video clip list according to the time period of the subtitle. The time period is adjusted to obtain the video clip and the corresponding subtitle text .
[0041] Use the average frame sampling method to uniformly sample the video clips to obtain several frames of images to form a frame list , which will further form a frame list Input the clip4clip model and get the corresponding feature vector and , the image vector and subtitle vector corresponding to each Shot are stored in the vector database together, and the source information such as time period and video path are marked.
[0042] Getting User Input , and send it to the clip4clip model to vectorize it, and calculate its difference with the vector database and The similarity score is calculated by the weightedranker strategy. :
[0043] in, and Corresponding to and The weight coefficient of .
[0044] Get points The video clip corresponding to the highest data and subtitle text As relevant information.
[0045] Finally, the user input , video clips and subtitle text Insert the prompt word template you set. The template example is as follows: Video clips: ; Please watch the video clips provided and pay attention to the details and important plot points.
[0046] Corresponding subtitle information: ; Please read the subtitle information corresponding to the video above carefully to help you better understand the video content.
[0047] Please answer the following questions based on the above video and subtitle information: question: ; Answer: Input the specified prompt words into the multimodal large model Video-LLaMa to get the final answer.
[0048] Embodiment 2: This embodiment provides a video retrieval question answering system based on a multimodal large model, including: The audio and video channel splitting module is configured to: obtain a video file, and perform channel splitting to obtain video information and audio information; The video decomposition module is configured to: decompose the video information to obtain a list of multiple video segments; The audio decomposition module is configured to: decompose the audio information to obtain subtitle information; The information alignment module is configured to: optimize and align the video clip list and the timestamps of the subtitle information to obtain the video clip and the subtitle text; The vectorization module is configured to extract several key frames from the video clip to form a frame list, and use the multimodal model to vectorize the frame list and subtitle text to obtain a feature vector and , and store it in the vector database together with the source information; The retrieval module is configured to: obtain user input, vectorize the user input, perform similarity search in the vector database through a hybrid search method, and obtain relevant video clips and relevant subtitle texts; The question-answering module is configured to: put user input, relevant video clips and relevant subtitle text into the set prompt word template, and send them to the multimodal model to obtain the final answer.
[0049] Embodiment 3, a computer-readable storage medium, the computer-readable storage medium includes a stored program, wherein when the program is running, the device where the computer-readable storage medium is located is controlled to execute the video retrieval question-answering method based on a multimodal large model described in Embodiment 1.
[0050] Embodiment 4, an electronic device, comprises a memory for storing computer program instructions and a processor for executing the program instructions, wherein when the computer program instructions are executed by the processor, the electronic device is triggered to execute the video retrieval question answering method based on the multimodal large model described in Embodiment 1.
[0051] The electronic device may include: a processor, a memory and a communication unit. These components communicate via one or more buses. Those skilled in the art will appreciate that the structure of the electronic device does not limit the embodiments of the present invention, and it may be a bus structure or a star structure, or a combination of certain components, or different component arrangements.
[0052] The communication unit is used to establish a communication channel so that the electronic device can communicate with other devices, receive user data sent by other devices or send user data to other devices.
[0053] The processor is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. It runs or executes software programs and / or modules stored in the memory, and calls data stored in the memory to perform various functions of the electronic device and / or process data. The processor can be composed of an integrated circuit (IC), for example, it can be composed of a single packaged IC, or it can be composed of multiple packaged ICs with the same or different functions. For example, the processor can only include a central processing unit (CPU). In an embodiment of the present invention, the CPU can be a single computing core or multiple computing cores.
[0054] The memory is used to store the execution instructions of the processor. The memory can be implemented by any type of volatile or non-volatile storage device or a combination of them, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0055] When the execution instructions in the memory are executed by the processor, the electronic device is enabled to execute part or all of the steps of Embodiment 1.
[0056] The above description is only a preferred embodiment of the present invention and does not limit the present invention in other forms. Any technician familiar with the profession may use the technical content disclosed above to change or modify it into an equivalent embodiment with equivalent changes and apply it to other fields. However, any simple modification, equivalent change and modification made to the above embodiment based on the technical essence of the present invention without departing from the content of the technical solution of the present invention still falls within the protection scope of the technical solution of the present invention.
Claims
1. A video retrieval question answering method based on a multimodal large model, characterized in that: include: Step 1, obtain the video file and perform channel splitting to obtain video information and audio information; Step 2, decomposing the video information to obtain a list of multiple video segments; Step 3, decomposing the audio information to obtain subtitle information; Step 4, optimizing and aligning the video clip list and the subtitle information timestamps to obtain the video clip and the subtitle text; Step 5: extract several key frames from the video clip to form a frame list, and use the multimodal model to vectorize the frame list and subtitle text to obtain a feature vector and , and store it in the vector database together with the source information; Step 6, obtaining user input, vectorizing the user input, and performing similarity search in the vector database through a hybrid search method to obtain relevant video clips and relevant subtitle texts; Step 7: Put the user input, relevant video clips and relevant subtitle text into the set prompt word template and send them to the multimodal model to obtain the final answer.
2. The video retrieval question answering method based on a multimodal large model according to claim 1, characterized in that: The step 2 specifically includes: using a key frame extraction algorithm to extract video information The key frames of the camera switching are output as a frame list of different video clips. According to the frame rate of the video, the frame list is converted into a timestamp list to obtain a video clip list. .
3. The video retrieval question answering method based on a multimodal large model according to claim 1, characterized in that: The step 3 specifically includes: using the paraformer model to Perform feature extraction and output as a text The timestamp of each word is used to segment the text using punctuation marks, and the time interval corresponding to the text is given according to the timestamp of the beginning and end characters of each text segment, thereby generating subtitle information. .
4. The video retrieval question answering method based on a multimodal large model according to claim 1, characterized in that: The step 4 specifically includes: extracting a video clip list Each time period in the Match the time period, find the subtitle that best matches each Shot, and sort the video clip list according to the time period of the subtitle. The time period is adjusted to obtain the video clip and the corresponding subtitle text .
5. The video retrieval question answering method based on a multimodal large model according to claim 1, characterized in that: The step 5 specifically includes: using the average frame sampling method to uniformly sample the video clip to obtain a number of frame images to form a frame list , will form a list of frames Input the clip4clip model and get the corresponding feature vector and , store the image vector and subtitle vector corresponding to each Shot into the vector database, and mark the time period and the source information of the video path to which it belongs.
6. The video retrieval question answering method based on a multimodal large model according to claim 1, characterized in that: The step 6 specifically includes: obtaining user input , and send it to the clip4clip model to vectorize it, and calculate its difference with the vector database and The similarity score is calculated by the weightedranker strategy. : in, and Corresponding to and The weight coefficient of ; Get points The video clip corresponding to the highest data and subtitle text As relevant information.
7. The video retrieval question answering method based on a multimodal large model according to claim 1, characterized in that: The step 7 specifically includes: integrating the user input with the pre-specified prompt word template , Related video clips and related subtitle text , and feed it into the Video-LLaMa model to get the final answer.
8. A video retrieval question answering system based on a multimodal large model, characterized in that: include: The audio and video channel splitting module is configured to: obtain a video file, and perform channel splitting to obtain video information and audio information; The video decomposition module is configured to: decompose the video information to obtain a list of multiple video segments; The audio decomposition module is configured to: decompose the audio information to obtain subtitle information; The information alignment module is configured to: optimize and align the video clip list and the timestamps of the subtitle information to obtain the video clip and the subtitle text; The vectorization module is configured to extract several key frames from the video clip to form a frame list, and use the multimodal model to vectorize the frame list and subtitle text to obtain a feature vector and , and store it in the vector database together with the source information; The retrieval module is configured to: obtain user input, vectorize the user input, perform similarity search in the vector database through a hybrid search method, and obtain relevant video clips and relevant subtitle texts; The question-answering module is configured to: put user input, relevant video clips and relevant subtitle text into the set prompt word template, and send them to the multimodal model to obtain the final answer.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein when the program is running, the device where the computer-readable storage medium is located is controlled to execute the video retrieval question-answering method based on a multimodal large model as described in any one of claims 1-7.
10. An electronic device, characterized in that: It includes a memory for storing computer program instructions and a processor for executing the program instructions, wherein when the computer program instructions are executed by the processor, the electronic device is triggered to execute the video retrieval question answering method based on a multimodal large model as described in any one of claims 1-7.
Citation Information
Patent Citations
Video data processing method and device, equipment and storage medium
CN111813998A
Short video searching method and device based on multiple modes and storage medium
CN114840713A
Interaction method and device based on video information, equipment and storage medium
CN116962787A
Video retrieval method
CN117251598A
Video question and answer method, computer equipment and storage medium
CN117290542A
Cited By
Video understanding and retrieval method driven by multi-modal large model
CN118779492A
Video processing method and video retrieval enhancement method for multi-modal large model
CN119339284A
Video analysis processing system and method based on multi-modal large model
CN119540831A
Intelligent inspection staring system and staring method integrated with large and small models
CN119583765A
Full-automatic multi-mode machine labeling method for video with any length based on deep learning
CN119763002A
