Annotation text generation method, device, computer program product, equipment and medium
By combining video frames and overall text annotation, using picture and video understanding models to analyze video content, and filtering target annotation text based on relevance, the low annotation relevance of video-text pre-training data sets and the high cost of manual annotation in the existing technology are solved. problem, achieving an efficient and relevant automatic annotation process.
Patent Information
- Application Number
- CN202410915516.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-09
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-07-09
AI Technical Summary
The text annotation method of existing video-text pre-training data sets has the problem that subtitles or extracted text are not highly relevant to the video, and manual annotation is inefficient and costly.
Using a combination of video frame text annotation and overall text annotation, the video content is analyzed through the image understanding model and the video understanding model, the first annotated text and the second annotated text are generated, and the target annotated text is screened based on relevance, and the information is integrated using a language model. Generate semantically fluent annotated text.
It improves the correlation between the annotated text and the video, reduces the cost of manual annotation, realizes an efficient automatic annotation process, and ensures the quality and relevance of the annotated text.
Smart Images

Figure CN118470717B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a method, apparatus, computer program product, device and medium for generating annotated text. Background Art
[0002] With the rise of video models, the role of video-text pre-training datasets has become increasingly important, because the quality of the dataset will affect the performance of the model in various downstream tasks. These tasks can be roughly divided into two categories: generating text from video and generating video from text, including but not limited to retrieval between video and text, video content question and answer, generating text information based on video, generating video from text description, etc.
[0003] In recent years, more and more text-video multimodal models have demonstrated strong zero-shot capabilities in text generation and video generation, and the zero-shot capabilities of large models are closely related to the quality of pre-training datasets. Large-scale datasets have been proven to be very effective in helping models learn the association between video and text, and videos contain richer information than images and text. For a high-quality video-text dataset, the video content must be diverse and secure, and the text must be able to describe the video images and content in detail and accurately.
[0004] At present, when performing text annotation on videos to build video-text datasets, the annotation methods used mainly include the following:
[0005] 1. For videos containing subtitles, use the subtitle extraction tool to directly extract the subtitles as the text description of the video. The length of the video is the number of frames corresponding to the subtitles. If the video does not include subtitles, use ASR (Automatic Speech Recognition) to extract the relevant content. The length of the video is the number of frames corresponding to the speech.
[0006] 2. Extract the text description of the video as the text description of the entire video.
[0007] 3. Directly use manual annotation.
[0008] For the first method, the captured content is mostly dialogue or statements themselves. Taking dialogue as an example, the content of the dialogue may have little to do with the picture itself. For the second method, the extracted text description is given to the entire video. If the original video is long, the short video screen captured from it may not be highly relevant to the video theme. For the third method, the generated text is of high quality and meets the training requirements, but the cost is too high to generate a large-scale video-text pre-training dataset using manual annotation.
[0009] It can be seen that the text annotation of video-text pre-training datasets in the prior art has the following problems: the annotated text directly generated by using subtitles or extracted text descriptions is not highly relevant to the video itself, and the processing efficiency of manual annotation is low and the cost is high. Summary of the invention
[0010] In view of the above problems, embodiments of the present application provide a method, apparatus, computer program product, device and medium for generating annotation text that overcomes the above problems or at least partially solves the above problems.
[0011] In a first aspect, an embodiment of the present application provides a method for generating annotated text, comprising:
[0012] Performing video frame text annotation and overall text annotation on the video to be annotated respectively, and obtaining a first annotated text, wherein the first annotated text is generated based on first annotated information associated with the video frame and second annotated information associated with the overall video;
[0013] Performing text annotation on N sub-videos corresponding to the video to be annotated, respectively, to obtain second annotation text, where the second annotation text is generated based on third annotation information corresponding to the N sub-videos, respectively, where the value of N is greater than or equal to 2;
[0014] According to the relevance of the first annotation text, the second annotation text, the third annotation text and the video to be annotated, the target annotation text corresponding to the video to be annotated is screened, and the third annotation text is the original annotation text corresponding to the video to be annotated.
[0015] Optionally, the step of performing video frame text annotation and overall text annotation on the video to be annotated to obtain a first annotated text includes:
[0016] Selecting at least one target video frame in the video to be annotated, performing text annotation on the at least one target video frame, and obtaining the first annotation information;
[0017] Performing overall text annotation on the video to be annotated to obtain the second annotation information;
[0018] The first annotation information and the second annotation information are combined to obtain the first annotation text.
[0019] Optionally, the selecting at least one target video frame in the video to be annotated, performing text annotation on the at least one target video frame, and acquiring the first annotation information includes:
[0020] When the video duration corresponding to the video to be annotated is not greater than the preset duration, M target video frames are selected from the video to be annotated and text annotation is performed to obtain the first annotation information, where M is an integer greater than or equal to 1;
[0021] When the video duration corresponding to the video to be annotated is greater than the preset duration, P target video frames are selected from the video to be annotated and text annotation is performed to obtain the first annotation information, where P is an integer greater than or equal to 2;
[0022] The first annotation information is generated based on annotation contents corresponding to M target video frames or P target video frames, respectively, and the annotation contents corresponding to the target video frames are generated based on analysis of video frame contents by a picture understanding model.
[0023] Optionally, the step of performing overall text annotation on the video to be annotated to obtain the second annotation information includes:
[0024] The video to be annotated is analyzed as a whole based on the video understanding model to obtain second annotation information representing the subject content corresponding to the video to be annotated.
[0025] Optionally, combining the first annotation information and the second annotation information to obtain the first annotation text includes:
[0026] The first annotation information and the second annotation information are integrated and deduplicated based on a language model to generate the first annotation text with smooth semantics.
[0027] Optionally, the performing text annotation on each of the N sub-videos corresponding to the video to be annotated to obtain a second annotated text includes:
[0028] Divide the video to be labeled based on a preset division strategy to obtain N sub-videos;
[0029] Performing text annotation on the N sub-videos respectively to obtain N third annotation information;
[0030] The N third annotation information are combined to generate the second annotation text.
[0031] Optionally, dividing the video to be labeled based on a preset division strategy to obtain N sub-videos includes:
[0032] Dividing the video to be labeled into N parts based on a balanced division strategy to obtain the N sub-videos;
[0033] or
[0034] The video to be labeled is divided into N parts based on a scene switching division strategy, and the N sub-videos are obtained, each of which corresponds to a video scene.
[0035] Optionally, the performing text annotation on the N sub-videos respectively to obtain N pieces of third annotation information includes:
[0036] Performing video content analysis on the N sub-videos based on the video understanding model to generate video themes corresponding to the N sub-videos respectively;
[0037] The N pieces of third annotation information are determined according to video themes respectively corresponding to the N sub-videos.
[0038] Optionally, combining the N third annotation information to generate the second annotation text includes:
[0039] splicing the N third annotation information based on the language model to obtain splicing information;
[0040] Non-overlapping content is extracted from the splicing information for content integration to generate a semantically coherent second annotated text.
[0041] Optionally, the filtering of target annotation text corresponding to the video to be annotated according to the relevance of the first annotation text, the second annotation text, the third annotation text and the video to be annotated includes:
[0042] Determine at least one target video frame for text annotation in the video to be annotated;
[0043] According to the relevance of the at least one target video frame with the first annotated text, the second annotated text, and the third annotated text, respectively, score evaluation is performed on the first annotated text, the second annotated text, and the third annotated text to obtain corresponding scoring scores;
[0044] The target annotated text is screened out based on the scoring scores respectively corresponding to the first annotated text, the second annotated text, and the third annotated text.
[0045] Optionally, the step of performing score evaluation on the first annotated text, the second annotated text, and the third annotated text according to the relevance of the at least one target video frame with the first annotated text, the second annotated text, and the third annotated text, to obtain corresponding scoring scores includes:
[0046] Determine at least one relevance score corresponding to the candidate annotated text based on the relevance of each target video frame to the candidate annotated text;
[0047] Determining a score corresponding to the candidate annotation text based on at least one relevance score corresponding to the candidate annotation text;
[0048] The first annotated text, the second annotated text, and the third annotated text are all candidate annotated texts.
[0049] Optionally, the filtering out the target annotated text based on the scoring scores respectively corresponding to the first annotated text, the second annotated text, and the third annotated text includes:
[0050] Compare the scoring scores corresponding to the first annotated text, the second annotated text, and the third annotated text respectively with a preset score threshold;
[0051] The annotated text with a score greater than the preset score threshold is determined as the target annotated text.
[0052] Optionally, after generating the target annotation text corresponding to the video to be annotated, the method further includes:
[0053] The video parameter information corresponding to the video to be annotated is stored in a target file, wherein the video parameter information includes video path information, video duration information, video frame number, video resolution and target annotation text;
[0054] The target file is used to provide a data set for video model training, and the target file includes video parameter information corresponding to multiple videos to be labeled.
[0055] In a second aspect, an embodiment of the present application provides a device for generating an annotation text, comprising:
[0056] A first annotation acquisition module, used to perform video frame text annotation and overall text annotation on the video to be annotated, respectively, to acquire first annotation text, where the first annotation text is generated based on first annotation information associated with the video frame and second annotation information associated with the overall video;
[0057] A second annotation acquisition module, configured to perform text annotation on the N sub-videos corresponding to the video to be annotated, and acquire second annotation texts, wherein the second annotation texts are generated based on third annotation information corresponding to the N sub-videos, and the value of N is greater than or equal to 2;
[0058] The screening module is used to screen the target annotation text corresponding to the video to be annotated according to the relevance of the first annotation text, the second annotation text, the third annotation text and the video to be annotated, wherein the third annotation text is the original annotation text corresponding to the video to be annotated.
[0059] In a third aspect, an embodiment of the present application provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the annotation text generation method described in the first aspect.
[0060] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the annotated text generation method described in the first aspect.
[0061] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the annotated text generation method described in the first aspect is implemented.
[0062] The technical solution provided by the embodiments of the present application brings at least the following beneficial effects:
[0063] After extracting video frames from the video to be annotated, annotating the extracted video frames with text, and annotating the entire video with text, a first annotation text combining the annotation information of the two aspects is obtained, so that the contents focused on the two aspects can be integrated; by segmenting the video to be annotated, annotating the sub-videos obtained by segmentation with text respectively, and integrating the annotation information corresponding to each sub-video, a second annotation text matching the video content of the video to be annotated at different time periods can be generated; after obtaining the first annotation text and the second annotation text, the correlation between the first annotation text, the second annotation text, the original annotation text and the video to be annotated is calculated to screen out the target annotation text adapted to the video to be annotated, and the annotation text that meets the requirements can be retained, taking into account the description of the events in the video and the description of the picture, so that the text annotation is closer to the video content, and the correlation between the obtained annotation text and the video is higher. Moreover, the new annotation method provided by the present application does not require human participation, and while ensuring the correlation between the generated annotation text and the video, it improves processing efficiency and saves labor costs based on automatic annotation. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] Figure 1 A schematic diagram showing a method for generating annotated text provided in an embodiment of the present application;
[0065] Figure 2 A schematic diagram showing a method for obtaining a first annotated text provided in an embodiment of the present application;
[0066] Figure 3 A schematic diagram showing a method for obtaining a second annotated text provided in an embodiment of the present application;
[0067] Figure 4 A schematic diagram showing a method for screening target annotated text provided in an embodiment of the present application;
[0068] Figure 5 The overall implementation flow chart of processing a video to be annotated provided by an embodiment of the present application is shown;
[0069] Figure 6 A schematic diagram showing a device for generating annotation text provided in an embodiment of the present application. DETAILED DESCRIPTION
[0070] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, each embodiment of the present application will be described in detail below in conjunction with the accompanying drawings. However, it will be appreciated by those skilled in the art that in each embodiment of the present application, many technical details are proposed in order to enable the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical scheme claimed in the present application can also be implemented. The division of the following embodiments is for the convenience of description, and the specific implementation of the present application should not constitute any limitation, and the various embodiments can be combined with each other and referenced to each other without contradiction.
[0071] In view of the problems that the text annotated by the video is not highly relevant to the video itself, and the manual annotation processing is inefficient and costly, the present application embodiment provides a method for generating annotated text. By combining image annotation with overall video annotation and introducing segmented annotation of the video, the information in the original video can be lost as little as possible, and annotated text with high relevance to the video can be obtained. Moreover, by using model annotation instead of manual annotation, the cost of video data annotation can be reduced. The text annotation method used in the present application embodiment can be used for text annotation of Chinese videos and English videos. Through text annotation, video-text pre-training data is provided for training video models.
[0072] The following is an introduction to the method for generating annotated text provided in the embodiment of the present application. Figure 1 As shown, the method includes:
[0073] Step 101 : perform video frame text annotation and overall text annotation on the video to be annotated, respectively, to obtain a first annotation text, where the first annotation text is generated based on first annotation information associated with the video frame and second annotation information associated with the overall video.
[0074] The annotation text generation method provided in the embodiment of the present application is applied to a server, the server obtains multiple videos to be annotated, analyzes the multiple videos to be annotated, generates annotation texts corresponding to the videos to be annotated, and annotates the videos to be annotated based on the generated annotation texts. The server annotates the multiple videos to be annotated in a parallel annotation processing mode to improve processing efficiency.
[0075] When the server performs text annotation on any video to be annotated, the server selects a video frame to be annotated for the current video to be annotated, performs text annotation on the selected video frame to obtain first annotation information of the associated video frame, and performs text annotation on the entire video to be annotated to obtain second annotation information of the associated entire video; then, the server generates a first annotation text corresponding to the video to be annotated based on the first annotation information and the second annotation information.
[0076] Among them, text annotation of video frames is text annotation of pictures. Since pictures represent richer content details and the content is easier to extract, compared with information extraction based on videos, richer information can be obtained and computing power can be saved. After obtaining the first annotation information by text annotation of video frames, the first annotation information is combined with the second annotation information corresponding to the overall annotation of the video, so that the content focused on both aspects can be integrated.
[0077] Step 102: perform text annotation on N sub-videos corresponding to the video to be annotated, and obtain second annotation text, where the second annotation text is generated based on third annotation information corresponding to the N sub-videos, where the value of N is greater than or equal to 2.
[0078] While annotating video frames and the whole video to be annotated, the video to be annotated is segmented to obtain at least two sub-videos, and text annotation is performed on each sub-video to obtain third annotation information corresponding to each sub-video. Then, the second annotation text is determined based on the fusion of the third annotation information corresponding to the at least two sub-videos. The annotation text that matches the video content of the video to be annotated in different time periods can be generated by annotating the video to be annotated in blocks and then fusing the annotated information.
[0079] When segmenting the video to be labeled, it can be segmented according to the corresponding length of the video to be labeled, segmented according to the corresponding video content of the video to be labeled, or segmented using other segmentation strategies; the number of sub-videos obtained by video segmentation is a preset number or a number determined based on the video content.
[0080] Step 103: Filter the target annotation text corresponding to the video to be annotated according to the relevance of the first annotation text, the second annotation text, the third annotation text and the video to be annotated, wherein the third annotation text is the original annotation text corresponding to the video to be annotated.
[0081] After obtaining the first annotation text through video frame annotation and video overall annotation and obtaining the second annotation text through sub-video annotation, the relevance of the first annotation text, the second annotation text, the third annotation text and the video to be annotated is calculated, and the target annotation text adapted to the video to be annotated is screened out based on the obtained relevance.
[0082] The third annotated text, as the original annotated text corresponding to the video to be annotated, is generated based on the original text annotation strategy, such as determined based on the subtitle information of the video to be annotated, determined based on the text description of the video to be annotated, determined based on manual annotation, etc.
[0083] By calculating the relevance of the original annotation text corresponding to the video to be annotated, the first annotation text determined based on the video frame and the overall video, and the second annotation text determined based on the segmented video with the video to be annotated, the annotation text suitable for the video to be annotated is screened out as the target annotation text based on the relevance. All the annotation texts that meet the requirements can be retained to take into account the description of the events in the video and the description of the pictures, so that the text annotation is closer to the video content and the correlation between the obtained annotation text and the video is higher.
[0084] In the implementation process of the present application, after extracting video frames from the video to be annotated, annotating the extracted video frames with text, and annotating the entire video with text, a first annotation text combining the annotation information of the two aspects is obtained, so that the contents focused on the two aspects can be integrated; by segmenting the video to be annotated, annotating the sub-videos obtained by segmentation with text respectively, and integrating the annotation information corresponding to each sub-video, a second annotation text matching the video content of the video to be annotated at different time periods can be generated; after obtaining the first annotation text and the second annotation text, the correlation between the first annotation text, the second annotation text, the original annotation text and the video to be annotated is calculated to screen out the target annotation text adapted to the video to be annotated, and the annotation text that meets the requirements can be retained, taking into account the description of the events in the video and the description of the picture, so that the text annotation is closer to the video content, and the correlation between the obtained annotation text and the video is higher. In addition, the new annotation method provided by the present application does not require human participation, and while ensuring the correlation between the generated annotation text and the video, it improves processing efficiency and saves labor costs based on automatic annotation.
[0085] The following describes the process of obtaining the first annotation text by annotating the video frame and the entire video. When the video to be annotated is annotated with video frame text and the entire video is annotated with text, and the first annotation text is obtained, Figure 2 As shown, the following steps are included:
[0086] Step 201: select at least one target video frame in a video to be annotated, perform text annotation on the at least one target video frame, and obtain first annotation information.
[0087] Step 202: perform overall text annotation on the video to be annotated to obtain second annotation information.
[0088] Step 203: Combine the first annotation information and the second annotation information to obtain a first annotation text.
[0089] At least one video frame is selected as a target video frame in the video to be annotated, and text annotation is performed on the at least one selected target video frame. First annotation information is determined according to the annotation conditions corresponding to each target video frame, so as to obtain the first annotation information associated with the target video frame by annotating the text of the at least one selected target video frame.
[0090] When selecting target video frames in the video to be labeled, different strategies can be used to select target video frames based on the different durations of the video to be labeled, and the number of target video frames selected for videos of different durations is different.
[0091] Optionally, with respect to step 201, when selecting at least one target video frame in the video to be annotated, performing text annotation on the at least one target video frame, and obtaining first annotation information, the method includes:
[0092] When the video duration corresponding to the video to be annotated is not greater than the preset duration, M target video frames are selected from the video to be annotated and text annotation is performed to obtain first annotation information, where M is an integer greater than or equal to 1;
[0093] When the video duration corresponding to the video to be annotated is greater than the preset duration, P target video frames are selected from the video to be annotated and text annotation is performed to obtain first annotation information, where P is an integer greater than or equal to 2;
[0094] The first annotation information is generated based on annotation contents corresponding to M target video frames or P target video frames, respectively, and the annotation contents corresponding to the target video frames are generated based on analysis of video frame contents by a picture understanding model.
[0095] In the case where the video duration corresponding to the video to be annotated is less than or equal to the preset duration, for example, the video duration corresponding to the video to be annotated is less than 30 seconds, at least one target video frame is selected from the video to be annotated based on the first selection strategy. Then, the video frame content corresponding to each target video frame is analyzed based on the image understanding model, and the annotation content corresponding to the target video frame is output through model analysis, and the first annotation information is generated based on the annotation content corresponding to the at least one target video frame.
[0096] When two or more target video frames are selected based on the first selection strategy, the annotation contents corresponding to at least two target video frames are combined to generate first annotation information; if one target video frame is selected based on the first selection strategy, the annotation contents corresponding to the target video frame are the first annotation information.
[0097] As an optional implementation, for a video to be annotated whose duration is less than or equal to a preset duration, it is generally considered that the video content is relatively simple and there will not be a large scene change, so the middle frame of the video is extracted as the target video frame. If the total number of frames is an even number, any one of the two middle frames is extracted as the target video frame. In this case, the first annotation information is the annotation content corresponding to a target video frame.
[0098] In the case where the video duration corresponding to the video to be annotated is longer than the preset duration, for example, the video duration corresponding to the video to be annotated is longer than 30 seconds, at least two target video frames are selected from the video to be annotated based on the second selection strategy. For the video to be annotated whose video duration is longer than the preset duration, it is generally believed that a scene change may occur in the video. In this case, at least two target video frames need to be selected for text annotation, so as to generate the first annotation information through the annotation contents corresponding to each target video frame.
[0099] As an optional implementation, for a video to be annotated whose duration is greater than a preset duration, the first frame, the middle frame, and the last frame are extracted as target video frames, and the three target video frames are respectively annotated with text based on the image understanding model, and the first annotation information is generated according to the three annotation contents. If the total number of frames is an even number, any one of the two middle frames is extracted as the middle frame for text annotation.
[0100] It should be noted that for videos to be annotated whose duration is greater than the preset duration, the number of target video frames corresponding to them is greater than the number of target video frames corresponding to videos to be annotated whose duration is less than or equal to the preset duration. The model parameters of the image understanding model deployed on the server side are deployed on a single GPU (Graphics Processing Unit) card as much as possible, so that the amount of calculation during fine-tuning and inference is controllable, and it can support images of different resolutions and capture the details in the picture. For example, the image understanding model can directly select an open source model. If the open source model cannot directly meet the requirements, the model can be fine-tuned to obtain an image understanding model that meets the requirements.
[0101] The picture understanding model in this embodiment is used to analyze the content of the video frame and output the annotation content that is adapted to the content of the video frame. For example, the picture understanding model is a fine-tuned CoCa (Contrastive Captioner) model, and the image encoding part of the CoCa model is processed so that the adjusted CoCa model can be used to analyze the video frame and output the annotation content. And considering that annotating pictures consumes much less computing power than annotating videos, and the development of picture understanding models is more mature than that of video understanding models, by using picture understanding models to annotate video frames (pictures), computing power can be saved and picture details can be captured.
[0102] For step 202, when the video to be annotated is annotated with overall text to obtain the second annotation information, it includes: performing an overall analysis on the video to be annotated based on the video understanding model to obtain the second annotation information representing the subject content corresponding to the video to be annotated.
[0103] When performing text annotation on video frames, the image understanding model is used. When performing overall text annotation on the video to be annotated, the video understanding model is used for processing. At this time, the video to be annotated is input into the video understanding model, and the video understanding model performs an overall analysis on the video to be annotated, and outputs an annotation text that summarizes the overall content of the video. The annotation text is used to describe the theme of the video as the second annotation information.
[0104] The requirements for the video understanding model are as follows: the open source model can be directly selected as the video understanding model, or the open source model can be fine-tuned according to needs. The consumption of computing power during fine-tuning and inference should be as small as possible, and videos with different resolutions and frame rates should be supported as much as possible.
[0105] After obtaining the first annotation information through video frame annotation and obtaining the second annotation information through overall video annotation, step 203 is executed. For step 203, the first annotation information and the second annotation information are combined to obtain the first annotation text, including: integrating and removing duplicates of the first annotation information and the second annotation information based on a language model to generate a semantically coherent first annotation text.
[0106] The first annotation information and the second annotation information generated by the annotation of the two aspects have their own emphasis but are also likely to overlap. The role of the language model is to integrate and remove the first annotation information and the second annotation information, and form a semantically coherent text as the first annotation text, so as to integrate the annotation information at the video frame level and the annotation information at the overall video level into an annotation text that represents the emphasis of the two aspects.
[0107] The requirements for the language model are as follows: select an open source language model with a small number of parameters and the ability to complete summary tasks with high quality. The first annotated text generated based on the language model can be understood as a short text, and its character length needs to meet the set conditions, such as the character length must be greater than or equal to the preset length threshold. If the set conditions are not met, that is, the character length is less than the preset length threshold, the annotated text can be directly deleted.
[0108] By integrating the first annotation information and the second annotation information using a language model, semantically coherent annotation text corresponding to different emphases can be output, thereby ensuring the quality of the generated annotation text.
[0109] In the above implementation process of the present application, target video frames are selected from the video to be annotated, and the target video frames are annotated based on the image understanding model, which can reduce computing power consumption, extract detailed information, and reduce costs; by adopting a language model to integrate the first annotation information associated with the video frame and the second annotation information associated with the overall video, it is possible to integrate the content focused on both aspects to ensure the quality of the annotated text.
[0110] The following describes the process of performing text annotation on the segmented video to obtain the second annotation text. When performing text annotation on the N sub-videos corresponding to the video to be annotated to obtain the second annotation text, Figure 3 As shown, the following steps are included:
[0111] Step 301: Divide the video to be labeled based on a preset division strategy to obtain N sub-videos.
[0112] Step 302: perform text annotation on the N sub-videos respectively to obtain N third annotation information.
[0113] Step 303: Combine the N third annotation information to generate a second annotation text.
[0114] After the video frames are annotated with text and the video is annotated as a whole, the generated annotation text may lose some video information, especially for relatively long videos. Therefore, in order to generate a relatively detailed long description of the associated video to be annotated, the video to be annotated is segmented to obtain at least two sub-videos, and text annotation is performed on each sub-video. Based on the annotation information corresponding to each sub-video, the second annotation text associated with the video to be annotated is determined. Since the second annotation text is determined based on the annotation status of each sub-video, it can be understood that the second annotation text is a long annotation text.
[0115] Among them, in step 301, the video to be labeled is divided based on a preset division strategy, including: dividing the video to be labeled into N parts based on a balanced division strategy to obtain N sub-videos; or dividing the video to be labeled into N parts based on a scene switching division strategy to obtain N sub-videos, each sub-video corresponding to a video scene.
[0116] When dividing the video to be labeled, the video to be labeled can be divided into N parts based on a balanced division strategy to obtain N sub-videos. At this time, the division can be based on the duration of the video to be labeled, or based on the total number of video frames corresponding to the video to be labeled, and the durations corresponding to the N sub-videos obtained by the division are relatively balanced, or the number of video frames corresponding to the N sub-videos is relatively balanced. As an optional embodiment, if the total duration of the video to be labeled is 90 seconds, the video to be labeled is divided into 3 parts based on a balanced division strategy to obtain 3 sub-videos. By adopting a balanced division strategy to divide the video to be labeled, the N sub-videos obtained can be relatively average in duration or number of frames, ensuring that the video content represented by the N sub-videos is relatively balanced.
[0117] When dividing the video to be annotated, the video to be annotated can also be divided into N parts based on the scene switching division strategy. At this time, the video to be annotated corresponds to at least two scenes. Based on the division principle that each scene corresponds to a sub-video, the video to be annotated is divided into N parts to obtain N sub-videos corresponding to different scenes. As an optional embodiment, the video to be annotated corresponds to scene A and scene B. The content represented by scene A is different from that of scene B. The video to be annotated is divided into two sub-videos based on the different scenes corresponding to the video to be annotated, so that one sub-video corresponds to scene A and the other sub-video corresponds to scene B, thereby achieving different sub-videos corresponding to different scenes. By segmenting the video to be annotated by using scene switching to segment the video, it can be ensured that different sub-videos correspond to different scenes, so as to facilitate text annotation based on scenes.
[0118] After obtaining N sub-videos through video division, execute step 302. For step 302, when performing text annotation on the N sub-videos respectively and obtaining N third annotation information, it includes: performing video content analysis on the N sub-videos respectively based on the video understanding model to generate video themes corresponding to the N sub-videos respectively; and determining N third annotation information according to the video themes corresponding to the N sub-videos respectively.
[0119] For each of the N sub-videos, the video content is analyzed based on the video understanding model to determine the video theme corresponding to the sub-video. The video understanding model for analyzing the sub-video and the video understanding model for analyzing the video to be annotated as a whole can be the same video understanding model. Since segmented videos need to be analyzed, other video understanding models can also be used.
[0120] After determining the video themes corresponding to the N sub-videos based on the video content analysis, N third annotation information is determined according to the video themes corresponding to the N sub-videos, that is, the third annotation information corresponding to the sub-video is determined based on the analysis of the sub-video by the video understanding model. By analyzing the N sub-videos respectively, the video meanings represented by different time periods of the video to be annotated can be determined.
[0121] After determining N third annotation information by analyzing the sub-videos, execute step 303 to combine the N third annotation information to generate a second annotation text. The process includes: splicing the N third annotation information based on the language model to obtain splicing information; extracting non-overlapping content from the splicing information for content integration to generate a semantically coherent second annotation text.
[0122] After N sub-videos are analyzed separately through the video understanding model to obtain N third annotation information, the N third annotation information is processed based on the language model to generate a second annotation text. The language model used here and the language model that integrates the first annotation information and the second annotation information can be the same language model. When generating the second annotation text based on the language model, the N third annotation information are spliced to obtain splicing information. Since the N third annotation information corresponds to N sub-videos, by splicing the N third annotation information, the video to be annotated can be introduced in detail to avoid the loss of the original video information. After the splicing information is obtained by splicing, non-overlapping content is extracted from the splicing information, and the extracted content is integrated to generate a semantically coherent second annotation text. At this time, the second annotation text is a long annotation text, which is used to provide a relatively comprehensive introduction to the video to be annotated.
[0123] In the above implementation process of the present application, the video to be annotated is segmented, and text annotation is performed on at least two sub-videos after the segmentation to obtain corresponding third annotation information. The at least two third annotation information are deduplicated and integrated to determine the second annotation text. Based on the second annotation text, a relatively comprehensive introduction to the video to be annotated can be made to avoid losing information in the original video.
[0124] The following is an introduction to the process of determining the target annotation text corresponding to the video to be annotated. When the target annotation text corresponding to the video to be annotated is selected based on the relevance of the first annotation text, the second annotation text, the third annotation text and the video to be annotated, such as Figure 4 As shown, the following steps are included:
[0125] Step 401: Determine at least one target video frame for text annotation in a video to be annotated.
[0126] Step 402: perform score evaluation on the first annotated text, the second annotated text, and the third annotated text according to the relevance of at least one target video frame with the first annotated text, the second annotated text, and the third annotated text, and obtain corresponding scoring scores.
[0127] Step 403: Filter out the target annotated text based on the scoring scores corresponding to the first annotated text, the second annotated text, and the third annotated text.
[0128] After determining the first annotation text and the second annotation text, the relevance of the first annotation text, the second annotation text, the third annotation text and the video to be annotated is calculated, and the first annotation text, the second annotation text, and the third annotation text are scored based on the calculated relevance to obtain the scoring scores corresponding to the first annotation text, the second annotation text, and the third annotation text. Then, based on the scoring scores corresponding to the first annotation text, the second annotation text, and the third annotation text, the target annotation text is screened out.
[0129] Among them, when calculating the correlation between the first annotation text, the second annotation text, the third annotation text and the video to be annotated, the target video frame used for video frame annotation in the video to be annotated is determined, and the correlation between the target video frame and the first annotation text, the second annotation text, and the third annotation text is calculated to determine the correlation degree between the first annotation text, the second annotation text, the third annotation text and the video to be annotated.
[0130] The target video frame involved in video frame annotation can be understood as a key video frame that represents the subject content of the video to be annotated. By calculating the correlation between the key video frame and the first annotation text, the second annotation text, and the third annotation text, the accuracy of the correlation calculation can be guaranteed.
[0131] For step 402, when performing score evaluation on the first annotated text, the second annotated text, and the third annotated text according to the relevance of at least one target video frame with the first annotated text, the second annotated text, and the third annotated text, and obtaining corresponding scoring scores, it includes:
[0132] Based on the relevance of each target video frame to the candidate annotation text, at least one relevance score corresponding to the candidate annotation text is determined; based on at least one relevance score corresponding to the candidate annotation text, a score corresponding to the candidate annotation text is determined; wherein the first annotation text, the second annotation text, and the third annotation text are all candidate annotation texts.
[0133] After determining at least one target video frame in the video to be annotated, for the candidate annotated text, the relevance between the candidate annotated text and the at least one target video frame is calculated to determine at least one relevance score, and then the score corresponding to the candidate annotated text is determined according to the at least one relevance score.
[0134] In the case where the number of target video frames is one, the relevance score between the candidate annotation text and the one target video frame is directly determined as the score corresponding to the candidate annotation text. In the case where the number of target video frames is at least two, the score is determined based on the relevance score between the candidate annotation text and at least two target video frames, and at this time, the score corresponding to the candidate annotation text can be determined by calculating the mean.
[0135] In view of the situation that the number of target video frames is at least two, in an optional implementation, a weight corresponding to each target video frame is defined, and after determining at least two relevance scores corresponding to the candidate annotation text, an intermediate value is determined based on the product of the relevance score and the corresponding weight, and the score corresponding to the candidate annotation text is determined based on the cumulative sum of at least two intermediate values. The weight corresponding to the target video frame is positively correlated with the priority corresponding to the target video frame, that is, the higher the priority corresponding to the target video frame, the greater the weight. The priority of the target video frame is related to the position of the target video frame in the video to be annotated, such as the target video frame has a high priority if it is an intermediate video frame; or, the priority of the target video frame is related to the picture content corresponding to the target video frame, such as the higher the relevance of the picture content of the target video frame to the video theme, the higher the priority of the target video frame. By setting the corresponding weight based on the priority of the target video frame, and calculating the score corresponding to the candidate annotation text based on the weight and the relevance score, a more accurate score can be determined while considering the relevance between the target video frame and the video theme.
[0136] The first annotated text, the second annotated text, and the third annotated text are all candidate annotated texts, that is, for the first annotated text, the correlation between it and at least one target video frame is calculated, and after determining at least one correlation score, the score corresponding to the first annotated text is determined; for the second annotated text, the correlation between it and at least one target video frame is calculated, and after determining at least one correlation score, the score corresponding to the second annotated text is determined; for the third annotated text, the correlation between it and at least one target video frame is calculated, and after determining at least one correlation score, the score corresponding to the third annotated text is determined.
[0137] After determining the scoring scores corresponding to the first annotation text, the second annotation text, and the third annotation text, respectively, execute step 403. For step 403, when the target annotation text is screened out based on the scoring scores corresponding to the first annotation text, the second annotation text, and the third annotation text, respectively, it includes: comparing the scoring scores corresponding to the first annotation text, the second annotation text, and the third annotation text, respectively, with a preset score threshold; and determining the annotation text with a scoring score greater than the preset score threshold as the target annotation text.
[0138] In this embodiment, a preset score threshold is provided for screening the annotation texts that meet the requirements, and the scoring scores corresponding to the first annotation text, the second annotation text, and the third annotation text are compared with the preset score threshold. If the corresponding scoring score is not greater than the preset score threshold, it means that the annotation text cannot accurately describe the content in the video, and the annotation text needs to be deleted; if the corresponding scoring score is greater than the preset score threshold, it indicates that the annotation text is an annotation text that meets the requirements and needs to be retained. The retained annotation text is the target annotation text.
[0139] Among them, the process of calculating the scoring score in step 402 and step 403 and comparing the scoring score with the preset score threshold to screen the annotated text can be implemented using a contrastive learning model, such as calculating the relationship between the candidate annotated text and the target video frame based on the CLIP (Contrastive Language-Image Pre-Training) model, and then screening out the annotated text that can be retained.
[0140] In the above implementation process of the present application, after determining at least one target video frame participating in text annotation, the correlation between at least one target video frame and the candidate annotation text is calculated, and a score corresponding to the candidate annotation text is determined based on at least one correlation score. Based on the comparison between the score and a preset score threshold, an annotation text that can be used to accurately describe the content in the video is selected, so that the selected annotation text is closer to the picture content of the video, thereby ensuring the correlation between the annotation text and the video picture.
[0141] And by scoring the original annotation text, the original annotation text, the first annotation text, and the second annotation text are measured using the same strategy to see whether they meet the requirements, and all the annotation texts that meet the scoring requirements are retained. This can take into account both the description of the events in the video and the description of the pictures, thereby ensuring the quality of the annotation text.
[0142] The following describes a process of using a model to generate annotation texts and screening out annotation texts whose relevance to the video to be annotated meets the requirements through a specific embodiment.
[0143] Get the video duration of the video to be annotated. If the video duration is longer than 30 seconds, select the middle frame, the first frame, and the last frame as the target video frame. If the video duration is not longer than 30 seconds, select the middle frame as the target video frame. For the selected target video frame, use the image understanding model (such as the fine-tuned CoCa model) to annotate it with text. The first annotation information obtained is: city road picture, there is water on the road.
[0144] Based on the video understanding model, the video to be annotated is annotated with overall text annotation. The model can read videos with different resolutions and frame rates. The second annotation information obtained by overall text annotation is: there are multiple flooded sections in the urban area of Nanning.
[0145] After determining the first annotation information and the second annotation information through video frame annotation and overall video annotation, the above annotation information is combined using a language model, which is, for example, an open source language model, for extracting summaries of the first annotation information and the second annotation information to obtain a short annotation text (first annotation text). The first annotation text is, for example: urban scene, multiple flooded sections appeared in Nanning city.
[0146] The video to be labeled is divided into multiple parts, such as every 16 frames corresponds to a sub-video, and the multiple sub-videos are processed by the video understanding model respectively to obtain multiple third-party labeling information. For example, the multiple third-party labeling information obtained are as follows: a female reporter in a shirt is reporting in front of a road; a scene of a tree-lined city road, the road surface is empty and no cars can be seen, and there is obvious water accumulation; a sanitation worker is cleaning the roadside, and there are debris and silt on the roadside; a firefighter in red clothes is rescuing trapped people, and the city roads are congested; more than half of the vehicles parked on the roadside are submerged by water.
[0147] The language model is used to splice and integrate multiple third annotation information to obtain a long annotation text (second annotation text). For example, the second annotation text is expressed as follows: This is a news video about a city after a rainstorm. A female reporter in a shirt is reporting in front of a road. The road is shaded by trees, no cars can be seen, and there is obvious water accumulation. Sanitation workers are cleaning up the roadside. There are debris and silt on the roadside. Firefighters in red clothes are rescuing trapped people. The city roads are congested, and more than half of the vehicles parked on the roadside are submerged by water.
[0148] After obtaining the first annotation text and the second annotation text, a contrastive learning model is used to score the candidate annotation texts, wherein the first annotation text, the second annotation text and the original annotation text are all used as candidate annotation texts. The contrastive learning model is used to score the relevance of the candidate annotation texts to the target video frame to obtain the scoring scores corresponding to the candidate annotation texts, and whether the candidate annotation texts need to be retained is determined based on the scoring scores to screen the annotation texts.
[0149] In the above embodiment, short annotation text is generated by combining image annotation with video annotation, and the video is segmented and annotated and integrated to generate long annotation text. Based on the relevance of the annotation text to the video, the annotation text that meets the requirements is screened from the short annotation text, long annotation text and original annotation text. The automatic processing of the model can be used to quickly expand the video-text data set, thereby improving processing efficiency and saving costs at the same time.
[0150] In an optional embodiment of the present application, the method also includes: after generating a target annotation text corresponding to the video to be annotated, storing video parameter information corresponding to the video to be annotated in a target file, the video parameter information including video path information, video duration information, video frame number, video resolution and target annotation text; wherein the target file is used to provide a data set for video model training, and the target file includes video parameter information corresponding to multiple videos to be annotated.
[0151] The server in this embodiment can generate target annotation texts for multiple videos to be annotated in parallel. For any video to be annotated, after generating its target annotation text, the server counts the video path information, video duration information, video frame number, video resolution and target annotation text corresponding to the video to be annotated, and uses them as video parameter information of the video to be annotated, and stores the video parameter information in the target file.
[0152] By storing the video parameter information corresponding to multiple videos to be annotated in the target file, a data set can be provided for the training of the video model based on the target file. The provided data set is used for the training of the video understanding and video generation models, so as to develop related software and applications. And because the target annotated text is the annotated text determined by screening, it can effectively improve the quality of the video-text pre-training data, thereby comprehensively improving the performance of the video understanding model and the video generation model.
[0153] The following is an introduction to the process of processing a video to be labeled through an overall implementation process. Figure 5 As shown, the following steps are included:
[0154] Step 501: Select at least one target video frame from the video to be annotated, perform text annotation on the at least one target video frame based on the image understanding model, and obtain first annotation information.
[0155] Step 502: Perform text annotation on the video to be annotated based on the video understanding model to obtain second annotation information.
[0156] Step 503: Integrate the first annotation information and the second annotation information based on the language model to generate a first annotation text, wherein the first annotation text is a short annotation text.
[0157] Step 504: divide the video to be annotated into N sub-videos, perform text annotation on each sub-video based on the video understanding model, and obtain N third annotation information.
[0158] Step 505: Process the N third annotation information based on the language model to generate a second annotation text, wherein the second annotation text is a long annotation text.
[0159] Step 506: Calculate the correlation between at least one target video frame and the candidate annotation text, and determine the score corresponding to the candidate annotation text based on at least one correlation score, wherein the first annotation text, the second annotation text, and the third annotation text are all candidate annotation texts. The third annotation text is the original annotation text corresponding to the video to be annotated, and the original annotation text is determined based on subtitle information, based on the text description in the video, or based on manual annotation.
[0160] Step 507: Filter out target annotated text based on the scoring scores corresponding to the candidate annotated texts.
[0161] Step 508: Count the video path information, video duration information, video frame number, video resolution and target annotation text corresponding to the video to be annotated, generate video parameter information, and store the video parameter information in the target file.
[0162] In the above implementation process, the model is used to replace manual annotation, and image annotation is introduced in the annotation process, which can reduce the cost of video data annotation; by generating long annotation text, the content corresponding to different time periods of the video can be summarized to avoid information omission; by generating long annotation text and short annotation text, the text requirements of different tasks are taken into account; by screening out the target annotation text from the original annotation text, the first annotation text and the second annotation text, all the annotation texts that meet the requirements can be retained, while ensuring the correlation between the text and the video, taking into account the description of the events in the video and the description of the picture.
[0163] The above is the overall implementation scheme of the annotation text generation method provided by the embodiment of the present application. After extracting the video frame of the video to be annotated, annotating the extracted video frame with text, and annotating the entire video with text, a first annotation text combining the annotation information of the two aspects is obtained, so that the contents focused on the two aspects can be integrated; by segmenting the video to be annotated, annotating the sub-videos obtained by segmentation, and integrating the annotation information corresponding to each sub-video, a second annotation text matching the video content of the video to be annotated at different time periods can be generated; after obtaining the first annotation text and the second annotation text, the correlation between the first annotation text, the second annotation text, the original annotation text and the video to be annotated is calculated to screen out the target annotation text adapted to the video to be annotated, and the annotation text that meets the requirements can be retained, taking into account the description of the event in the video and the description of the picture, so that the text annotation is closer to the video content, and the correlation between the obtained annotation text and the video is higher. And the new annotation method provided by the present application does not require human participation. While ensuring the correlation between the generated annotation text and the video, it improves processing efficiency and saves labor costs based on automatic annotation.
[0164] Furthermore, by introducing video frame annotation in the annotation process, the computing power consumption can be reduced as much as possible during the model annotation process, thereby reducing the cost of video annotation; by generating long annotation text and short annotation text, the text requirements of different tasks are taken into account.
[0165] The present application also provides a device for generating a marked text. Figure 6 As shown, the device comprises:
[0166] A first annotation acquisition module 601 is used to perform video frame text annotation and overall text annotation on the video to be annotated, respectively, to obtain a first annotation text, where the first annotation text is generated based on first annotation information associated with the video frame and second annotation information associated with the overall video;
[0167] A second annotation acquisition module 602 is used to perform text annotation on the N sub-videos corresponding to the video to be annotated, and obtain second annotation texts, where the second annotation texts are generated based on the third annotation information corresponding to the N sub-videos, and the value of N is greater than or equal to 2;
[0168] The screening module 603 is used to screen the target annotation text corresponding to the video to be annotated according to the relevance of the first annotation text, the second annotation text, the third annotation text and the video to be annotated, wherein the third annotation text is the original annotation text corresponding to the video to be annotated.
[0169] Optionally, the first annotation acquisition module includes:
[0170] A processing and obtaining submodule, configured to select at least one target video frame in the video to be annotated, perform text annotation on the at least one target video frame, and obtain the first annotation information;
[0171] A first annotation acquisition submodule is used to perform overall text annotation on the video to be annotated to obtain the second annotation information;
[0172] The combination acquisition submodule is used to combine the first annotation information and the second annotation information to obtain the first annotation text.
[0173] Optionally, the processing acquisition submodule includes:
[0174] A first processing unit is configured to select M target video frames from the video to be labeled and perform text annotation to obtain the first annotation information when the video duration corresponding to the video to be labeled is not greater than a preset duration, where M is an integer greater than or equal to 1;
[0175] A second processing unit is configured to select P target video frames from the video to be labeled and perform text annotation to obtain the first annotation information when the video duration corresponding to the video to be labeled is greater than a preset duration, where P is an integer greater than or equal to 2;
[0176] The first annotation information is generated based on annotation contents corresponding to M target video frames or P target video frames, respectively, and the annotation contents corresponding to the target video frames are generated based on analysis of video frame contents by a picture understanding model.
[0177] Optionally, the first annotation acquisition submodule is further used for:
[0178] The video to be annotated is analyzed as a whole based on the video understanding model to obtain second annotation information representing the subject content corresponding to the video to be annotated.
[0179] Optionally, the combined acquisition submodule is further used for:
[0180] The first annotation information and the second annotation information are integrated and deduplicated based on a language model to generate the first annotation text with smooth semantics.
[0181] Optionally, the second annotation acquisition module includes:
[0182] A division and acquisition submodule, used for dividing the video to be labeled based on a preset division strategy to obtain N sub-videos;
[0183] A second annotation acquisition submodule is used to perform text annotation on the N sub-videos respectively to obtain N third annotation information;
[0184] The combination generation submodule is used to combine the N third annotation information to generate the second annotation text.
[0185] Optionally, the partition acquisition submodule is further used for:
[0186] Dividing the video to be labeled into N parts based on a balanced division strategy to obtain the N sub-videos;
[0187] or
[0188] The video to be labeled is divided into N parts based on a scene switching division strategy, and the N sub-videos are obtained, each of which corresponds to a video scene.
[0189] Optionally, the second annotation acquisition submodule includes:
[0190] An analysis and generation unit, configured to perform video content analysis on each of the N sub-videos based on a video understanding model, and generate video themes corresponding to each of the N sub-videos;
[0191] The first determining unit is used to determine the N third annotation information according to video themes respectively corresponding to the N sub-videos.
[0192] Optionally, the combination generation submodule includes:
[0193] A splicing and obtaining unit, configured to splice the N pieces of third annotation information based on a language model to obtain splicing information;
[0194] The extraction and generation unit is used to extract non-overlapping content from the splicing information, integrate the content, and generate a semantically coherent second annotated text.
[0195] Optionally, the screening module includes:
[0196] A determination submodule, used to determine at least one target video frame for text annotation in the video to be annotated;
[0197] An evaluation acquisition submodule, configured to evaluate the scores of the first annotated text, the second annotated text, and the third annotated text according to the relevance of the at least one target video frame with the first annotated text, the second annotated text, and the third annotated text, and obtain corresponding scoring scores;
[0198] The screening submodule is used to screen out the target marked text based on the scoring scores corresponding to the first marked text, the second marked text, and the third marked text.
[0199] Optionally, the evaluation acquisition submodule includes:
[0200] A second determination unit, configured to determine at least one relevance score corresponding to the candidate annotated text based on the relevance between each target video frame and the candidate annotated text;
[0201] A third determining unit, configured to determine a score corresponding to the candidate annotated text based on at least one relevance score corresponding to the candidate annotated text;
[0202] The first annotated text, the second annotated text, and the third annotated text are all candidate annotated texts.
[0203] Optionally, the screening submodule includes:
[0204] A comparison unit, configured to compare the scoring scores corresponding to the first annotated text, the second annotated text, and the third annotated text respectively with a preset score threshold;
[0205] The fourth determining unit is used to determine the annotated text whose scoring score is greater than the preset score threshold as the target annotated text.
[0206] Optionally, the device further comprises:
[0207] A storage module, configured to store video parameter information corresponding to the video to be annotated in a target file after generating a target annotation text corresponding to the video to be annotated, wherein the video parameter information includes video path information, video duration information, video frame number, video resolution and target annotation text;
[0208] The target file is used to provide a data set for video model training, and the target file includes video parameter information corresponding to multiple videos to be labeled.
[0209] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0210] The embodiment of the present application also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the various processes of the above-mentioned annotation text generation method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0211] An embodiment of the present application also provides an electronic device, including a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned annotation text generation method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0212] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned annotation text generation method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0213] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0214] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices, computer program products, electronic devices, and storage media. Therefore, the embodiments of the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present application may take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0215] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, apparatuses, computer program products, electronic devices, and storage media according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing terminal device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded into a computer or other programmable data processing terminal device, so that a series of operation steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable terminal device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0216] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.
[0217] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the term "comprise" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0218] The above is an introduction to a method, device, computer program product, electronic device and medium for generating annotated text provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for a person skilled in the art, according to the idea of the present application, there will be changes in the specific implementation method and scope of application. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for generating annotated text, characterized in that: include: Performing video frame text annotation and overall text annotation on the video to be annotated respectively, and obtaining a first annotated text, wherein the first annotated text is generated based on first annotated information associated with the video frame and second annotated information associated with the overall video; Performing text annotation on N sub-videos corresponding to the video to be annotated, respectively, to obtain second annotation text, where the second annotation text is generated based on third annotation information corresponding to the N sub-videos, respectively, where the value of N is greater than or equal to 2; Filtering a target annotation text corresponding to the video to be annotated according to the correlation between the first annotation text, the second annotation text, the third annotation text and at least one video frame in the video to be annotated, wherein the third annotation text is the original annotation text corresponding to the video to be annotated; The annotated text whose scoring score meets a preset score threshold is the target annotated text, and the scoring score is determined based on the correlation score between the annotated text and the at least one video frame.
2. The method for generating annotated text according to claim 1, characterized in that: The step of performing video frame text annotation and overall text annotation on the video to be annotated to obtain a first annotated text includes: Selecting at least one target video frame in the video to be annotated, performing text annotation on the at least one target video frame, and obtaining the first annotation information; Performing overall text annotation on the video to be annotated to obtain the second annotation information; The first annotation information and the second annotation information are combined to obtain the first annotation text.
3. The method for generating annotated text according to claim 2, characterized in that: The selecting at least one target video frame in the video to be annotated, performing text annotation on the at least one target video frame, and obtaining the first annotation information includes: When the video duration corresponding to the video to be annotated is not greater than the preset duration, M target video frames are selected from the video to be annotated and text annotation is performed to obtain the first annotation information, where M is an integer greater than or equal to 1; When the video duration corresponding to the video to be annotated is greater than the preset duration, P target video frames are selected from the video to be annotated and text annotation is performed to obtain the first annotation information, where P is an integer greater than or equal to 2; The first annotation information is generated based on annotation contents corresponding to M target video frames or P target video frames, respectively, and the annotation contents corresponding to the target video frames are generated based on analysis of video frame contents by a picture understanding model.
4. The method for generating annotated text according to claim 2, characterized in that: The step of performing overall text annotation on the video to be annotated to obtain the second annotation information includes: Based on the video understanding model, the video to be labeled is analyzed as a whole to obtain second labeling information representing the subject content corresponding to the video to be labeled.
5. The method for generating annotated text according to claim 2, characterized in that: The combining the first annotation information and the second annotation information to obtain the first annotation text includes: The first annotation information and the second annotation information are integrated and deduplicated based on a language model to generate the first annotation text with smooth semantics.
6. The method for generating annotated text according to claim 1, characterized in that: The performing text annotation on the N sub-videos corresponding to the video to be annotated to obtain a second annotated text includes: Divide the video to be labeled based on a preset division strategy to obtain N sub-videos; Performing text annotation on the N sub-videos respectively to obtain N third annotation information; The N third annotation information are combined to generate the second annotation text.
7. The method for generating annotated text according to claim 6, characterized in that: The step of dividing the video to be labeled based on a preset division strategy to obtain N sub-videos includes: Dividing the video to be labeled into N parts based on a balanced division strategy, and obtaining the N sub-videos; or The video to be labeled is divided into N parts based on a scene switching division strategy, and the N sub-videos are obtained, each of which corresponds to a video scene.
8. The method for generating annotated text according to claim 6, characterized in that: The performing text annotation on the N sub-videos respectively to obtain N third annotation information includes: Performing video content analysis on the N sub-videos based on the video understanding model to generate video themes corresponding to the N sub-videos respectively; The N pieces of third annotation information are determined according to video themes respectively corresponding to the N sub-videos.
9. The method for generating annotated text according to claim 6, characterized in that: The combining the N third annotation information to generate the second annotation text includes: splicing the N third annotation information based on the language model to obtain splicing information; Non-overlapping content is extracted from the splicing information for content integration to generate a semantically coherent second annotated text.
10. The method for generating annotated text according to claim 1, characterized in that: The step of screening target annotation text corresponding to the video to be annotated according to the correlation between the first annotation text, the second annotation text, the third annotation text and at least one video frame in the video to be annotated includes: Determine at least one target video frame for text annotation in the video to be annotated; According to the relevance of the at least one target video frame with the first annotated text, the second annotated text, and the third annotated text, respectively, score evaluation is performed on the first annotated text, the second annotated text, and the third annotated text to obtain corresponding scoring scores; The target annotated text is screened out based on the scoring scores respectively corresponding to the first annotated text, the second annotated text, and the third annotated text.
11. The method for generating annotated text according to claim 10, characterized in that: The step of performing score evaluation on the first annotated text, the second annotated text, and the third annotated text according to the relevance of the at least one target video frame with the first annotated text, the second annotated text, and the third annotated text to obtain corresponding scoring scores includes: Determine at least one relevance score corresponding to the candidate annotated text based on the relevance of each target video frame to the candidate annotated text; Determining a score corresponding to the candidate annotation text based on at least one relevance score corresponding to the candidate annotation text; The first annotated text, the second annotated text, and the third annotated text are all candidate annotated texts.
12. The method for generating annotated text according to claim 10, characterized in that: The filtering out the target annotated text based on the scoring scores respectively corresponding to the first annotated text, the second annotated text, and the third annotated text includes: Compare the scoring scores corresponding to the first annotated text, the second annotated text, and the third annotated text respectively with a preset score threshold; The annotated text with a score greater than the preset score threshold is determined as the target annotated text.
13. The method for generating annotated text according to any one of claims 1 to 12, characterized in that: After generating the target annotation text corresponding to the video to be annotated, the method further includes: The video parameter information corresponding to the video to be annotated is stored in a target file, wherein the video parameter information includes video path information, video duration information, video frame number, video resolution and target annotation text; The target file is used to provide a data set for video model training, and the target file includes video parameter information corresponding to a plurality of videos to be labeled.
14. A device for generating annotated text, characterized in that: include: A first annotation acquisition module, used to perform video frame text annotation and overall text annotation on the video to be annotated, respectively, to acquire first annotation text, where the first annotation text is generated based on first annotation information associated with the video frame and second annotation information associated with the overall video; A second annotation acquisition module, configured to perform text annotation on the N sub-videos corresponding to the video to be annotated, and acquire second annotation texts, wherein the second annotation texts are generated based on third annotation information corresponding to the N sub-videos, and the value of N is greater than or equal to 2; A screening module is used to screen a target annotation text corresponding to the video to be annotated according to the correlation between the first annotation text, the second annotation text, the third annotation text and at least one video frame in the video to be annotated, wherein the third annotation text is an original annotation text corresponding to the video to be annotated; The annotated text whose scoring score meets a preset score threshold is the target annotated text, and the scoring score is determined based on the correlation score between the annotated text and the at least one video frame.
15. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the annotated text generation method according to any one of claims 1 to 13 is implemented.
16. An electronic device, characterized in that: The invention comprises a processor, a memory and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the annotated text generating method according to any one of claims 1 to 13 is implemented.
17. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the annotated text generation method according to any one of claims 1 to 13 is implemented.
