Video-to-text generation method and device, medium and electronic equipment

By extracting and fusing visual features from video frames for text decoding, the problem of high dependence on video-text pairing data in the prior art is solved, efficient video-to-text generation is achieved, reducing data annotation costs and improving performance.

CN119906858APending Publication Date: 2025-04-29BEIJING ZITIAO NETWORK TECH CO LTD +1
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202311415913.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-10-27
Publication Date
2025-04-29

AI Technical Summary

Technical Problem

Existing video-to-text generation methods require a large amount of video-text pairing data for training, resulting in high labor and time cost for data annotation.

Method used

By extracting visual features from multiple video frames of the video to be processed, and fusion and text decoding these features are generated, text descriptions of the video are achieved, text generation is achieved without the need for video-text pairing data training.

Benefits of technology

Reduces dependence on video-text pairing data, reduces the cost of data annotation, and improves text generation performance in zero sample situations, narrowing the performance gap with models trained with video-text pairing data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119906858A_ABST
    Figure CN119906858A_ABST
Patent Text Reader

Abstract

The invention relates to a video-to-text generation method and device, a medium and electronic equipment, belongs to the technical field of computers, and can reduce the dependence on video-text pairing data and improve the text generation performance under the condition that the video-text pairing data is not adopted for training. The video-to-text generation method comprises the following steps: acquiring a to-be-processed video; extracting visual features from a plurality of video frames of the to-be-processed video; fusing the visual features of the plurality of video frames; and performing text decoding on the fused visual features to obtain text description of the video to be processed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular, to a video-to-text generation method, device, medium and electronic device. Background Art

[0002] Videos contain rich information, but the information density of videos themselves is relatively low. Therefore, how to generate high-information-density text from videos has become a hot topic. In related technologies, video-to-text generation methods require a large amount of video-text pairing data for training. However, manually annotating text descriptions or question-answer pairs for videos requires huge human resources and time costs. Summary of the invention

[0003] This summary is provided to introduce concepts in a brief form that will be described in detail in the detailed description below. This summary is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.

[0004] In a first aspect, the present disclosure provides a video-to-text generation method, comprising: obtaining a video to be processed; extracting visual features from multiple video frames of the video to be processed; fusing the visual features of the multiple video frames; and text decoding the fused visual features to obtain a text description of the video to be processed.

[0005] In a second aspect, the present disclosure provides a video-to-text generation device, comprising: an acquisition module for acquiring a video to be processed; an extraction module for extracting visual features from multiple video frames of the video to be processed; a fusion module for fusing the visual features of the multiple video frames; and a decoding module for text decoding the fused visual features to obtain a text description of the video to be processed.

[0006] In a third aspect, the present disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of any one of the methods described in the first aspect.

[0007] In a fourth aspect, the present disclosure provides an electronic device, comprising: a storage device on which a computer program is stored; and a processing device for executing the computer program in the storage device to implement the steps of any one of the methods described in the first aspect.

[0008] By adopting the above technical solution, since visual features are extracted from multiple video frames of the video to be processed, and then the visual features of the multiple video frames are fused, and the fused visual features are text-decoded to obtain a text description of the video to be processed, therefore, on the one hand, since all of the above operations can be performed without the need to use video-text paired data for training, the dependence on video-text paired data is reduced, and the manpower and time costs of data annotation are reduced; on the other hand, since the visual features extracted from the video frames can be used for text decoding, the performance of text generation without the use of video-text paired data for training (that is, in the zero-sample case) is improved, and the performance gap between the model trained with video-text paired data is greatly narrowed.

[0009] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale. In the drawings:

[0011] Figure 1 The present invention is a flowchart of a method for generating text from a video according to an embodiment of the present invention.

[0012] Figure 2 The present invention is a flowchart of fusing visual features of multiple video frames according to an embodiment of the present invention.

[0013] Figure 3 This is another flowchart for fusing visual features of multiple video frames according to an embodiment of the present disclosure.

[0014] Figure 4 The present invention is a flowchart of modifying a text decoder according to an embodiment of the present invention.

[0015] Figure 5 This is another flow chart for modifying a text decoder according to an embodiment of the present disclosure.

[0016] Figure 6 It is a schematic block diagram of a video-to-text generation device according to an embodiment of the present disclosure.

[0017] Figure 7 A schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0018] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0019] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0020] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0021] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0022] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0023] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0024] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.

[0025] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.

[0026] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0027] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.

[0028] At the same time, it is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.

[0029] Figure 1 FIG. 1 is a flow chart of a method for generating text from a video according to an embodiment of the present disclosure. Figure 1 As shown, the video-to-text generation method may include the following steps S11 to S14.

[0030] In step S11, a video to be processed is obtained.

[0031] The videos to be processed are videos whose contents require text description or videos whose contents require answers to user questions.

[0032] In step S12, visual features are extracted from a plurality of video frames of the video to be processed.

[0033] In some embodiments, video frames included in the video to be processed may be extracted from the video to be processed first, and then visual features may be extracted from each video frame. The video frame may be in the form of an image.

[0034] Various methods can be used to extract visual features from each video frame. For example, a pre-trained image-to-text generation model can be used to extract visual features of video frames. This is based on generative modeling rather than discriminative modeling (for example, in related technologies, the focus is mainly on discriminative tasks such as action recognition, which belongs to discriminative models), thereby narrowing the modality gap and not requiring video-text paired data for training, and achieving excellent zero-shot performance of video-to-text generation models.

[0035] In step S13, visual features of multiple video frames are fused.

[0036] In step S14, text decoding is performed on the fused visual features to obtain a text description of the video to be processed.

[0037] By adopting the above technical solution, since visual features are extracted from multiple video frames of the video to be processed, and then the visual features of the multiple video frames are fused, and the fused visual features are text-decoded to obtain a text description of the video to be processed, therefore, on the one hand, since all of the above operations can be performed without the need to use video-text paired data for training, the dependence on video-text paired data is reduced, and the manpower and time costs of data annotation are reduced; on the other hand, since the visual features extracted from the video frames can be used for text decoding, the performance of text generation without the use of video-text paired data for training (that is, in the zero-sample case) is improved, and the performance gap between the model trained with video-text paired data is greatly narrowed.

[0038] Figure 2 FIG. 1 is a flow chart of fusing visual features of multiple video frames according to an embodiment of the present disclosure. Figure 2 As shown, the method for fusing visual features of multiple video frames includes the following steps S21 to S22.

[0039] In step S21 , visual features of multiple video frames are aggregated into a first video-level representation by using a preset aggregation function.

[0040] The preset aggregation function may be one of concatenation, average pooling, and maximum pooling, and is intended to aggregate a set of video frame-level visual features. When aggregating, all visual features may be first stacked along the time dimension to form a small batch of video sequence labels, and then the aforementioned preset aggregation function may be used to aggregate the visual features.

[0041] Connection refers to connecting visual features along the time dimension to obtain an aggregated video-level representation, that is, to obtain a first video-level representation.

[0042] Average pooling refers to average pooling of visual features along the time dimension to obtain an aggregated video-level representation, that is, a first video-level representation.

[0043] Max pooling refers to performing maximum pooling of visual features along the time dimension to obtain an aggregated video-level representation, that is, to obtain a first video-level representation.

[0044] In step S22, based on the attention mechanism, the first video-level representation is compressed to obtain a second video-level representation, wherein the information density of the second video-level representation is higher than the information density of the first video-level representation.

[0045] In some embodiments, compression of the first video-level representation based on the attention mechanism can be achieved in the following manner: self-attention processing is performed on the query tag, and cross-attention processing is performed on the query tag and the visual feature to compress the first video-level representation. The query tag can be a learnable query tag, which refers to a related tag for querying the visual feature. The compression process can be implemented by a pre-trained image-to-text generation model, wherein the pre-trained image-to-text generation model can use a set of query tags to extract visual information from visual features. These query tags can interact through a self-attention layer and interact with the visual features through a cross-attention layer. Finally, the pre-trained image-to-text generation model compresses the grid features (i.e., visual features) of the video frame into N (e.g., 32) information features, that is, a second video-level representation is obtained.

[0046] The above technical solution belongs to the early fusion strategy, that is, before compressing the video frame-level visual representation, the visual features are first aggregated into a video-level representation through a preset aggregation function, and then the attention mechanism is used to weight the aggregated video-level representation to obtain a video-level representation with higher information density. The early fusion strategy is conducive to fusing the complementary information between multiple video frames in the early stage, thereby making full use of the complementary information between multiple video frames to improve the performance of video-to-text generation. Moreover, the fusion process does not require training, so it is very flexible and can be easily migrated to other models.

[0047] Figure 3 FIG. 4 is another flow chart of fusing visual features of multiple video frames according to an embodiment of the present disclosure. Figure 3 As shown, the method for fusing visual features of multiple video frames includes the following steps S31 to S32.

[0048] In step S31, the visual features of multiple video frames are compressed based on the attention mechanism.

[0049] When compressing, the visual features of each video frame are processed separately. That is, the visual features of the first video frame among the multiple video frames are compressed to obtain the compressed visual features of the first video frame, and the visual features of the second video frame among the multiple video frames are compressed to obtain the compressed visual features of the second video frame, and so on, until the compression processing of each video frame among the multiple video frames is completed.

[0050] In some embodiments, compression of visual features of each video frame based on an attention mechanism can be achieved by performing self-attention processing on query tags and cross-attention processing on query tags and visual features to compress visual features of video frames. The query tags can be learnable query tags, which refer to relevant tags for querying visual features. The compression process can be implemented by a pre-trained image-to-text generation model, wherein the pre-trained image-to-text generation model can use a set of query tags to extract visual information from visual features, and these query tags can interact through a self-attention layer and interact with visual features through a cross-attention layer. Finally, the pre-trained image-to-text generation model compresses the grid features (i.e., visual features) of the video frame into N (e.g., 32) information features.

[0051] In step S32, the compressed visual features are aggregated by a preset aggregation function to obtain a video-level representation.

[0052] The preset aggregation function may be one of concatenation, average pooling, and maximum pooling, and is intended to aggregate a set of video frame-level visual features. When aggregating, all visual features may be first stacked along the time dimension to form a small batch of video sequence labels, and then the aforementioned preset aggregation function may be used to aggregate the visual features.

[0053] Connection refers to connecting visual features along the time dimension to obtain aggregated video-level representations, that is, to obtain video-level representations.

[0054] Average pooling refers to the average pooling of visual features along the time dimension to obtain aggregated video-level representations, that is, to obtain video-level representations.

[0055] Max pooling refers to performing maximum pooling of visual features along the time dimension to obtain aggregated video-level representations, that is, obtaining video-level representations.

[0056] The above technical solution belongs to the late fusion strategy, that is, the visual features (that is, the grid representation) of each video frame are first compressed to obtain compressed visual features with higher information density, and then the compressed visual features of multiple video frames are aggregated into a video-level representation through a preset aggregation function. The late fusion strategy not only makes full use of the complementary information between multiple video frames to improve the performance of video-to-text generation, but also can effectively reduce the potential information loss caused by information compression, which is conducive to performance improvement. Moreover, the fusion process does not require training, so it is very flexible and can be easily migrated to other models.

[0057] In some embodiments, the text decoding of the fused visual features in step S14 includes: using a text decoder to text decode the fused visual features. Figure 2 When the fusion process shown in FIG. 1 fuses the visual features, the second video-level representation obtained by the fusion process can be input into the text decoder; Figure 3 When the fusion process shown is used to fuse visual features, the video-level representation obtained by the fusion process can be input into a text decoder. The text decoder performs text decoding on the input features to obtain a text description of the video to be processed.

[0058] In addition, the video-to-text generation task can usually be decomposed into two subtasks, one is video description and the other is video question answering. The video description task aims to accurately describe the content in the video using text, while the video question answering task aims to answer the user's questions based on the video content. The text decoder can obtain the text description of the video by text decoding the fused visual features. If video question answering is to be performed, the fused visual features can be input into the text decoder together with the user's questions, so that the text decoder can output the answer to the user's question.

[0059] Figure 4 FIG. 1 is a flowchart of modifying a text decoder according to an embodiment of the present disclosure. Figure 4 As shown, the method for correcting the text decoder may include the following steps S41 to S42.

[0060] In step S41, a hint tag is injected into each layer of the text decoder.

[0061] In step S42, the text decoder is modified by calculating the attention value between the text mark and the prompt mark. That is, during the modification of the text decoder, the only trainable parameter is the prompt mark, and the other parameters are frozen.

[0062] Text tokens refer to plain text data samples, such as plain text sequences.

[0063] In some embodiments, a zero-initialized attention mechanism may be used to calculate the attention between the text tag and the prompt tag. For example, in the zero-initialized attention mechanism, an additional softmax group is introduced, which is used to calculate the attention value between the text tag and the prompt tag.

[0064] In some embodiments, the text decoder is corrected by calculating the attention value between the text tag and the prompt tag, which can be achieved in the following manner. First, attention processing is performed between the text tags and attention processing is performed between the text tags and the prompt tags. For example, the text tags and the prompt tags can be mapped into queries, keys and values ​​through a weight matrix, wherein the prompt tags can be used only to calculate the keys and values, and will be discarded at the end of each layer, and then, based on the query, key and value, a scaled dot product attention processing is performed between the text tags and a scaled dot product attention processing is performed between the text tags and the prompt tags. Then, the attention value between the text tag and the prompt tag is multiplied with an initialized tensor (e.g., a zero-initialized learnable gate), and based on the result of the multiplication and the text tag, a target attention value is obtained (e.g., based on the result of the multiplication and the attention value between the text tags, a target attention value is obtained, for example, the result of the multiplication can be added to the attention value between the text tags to obtain the target attention value). Then, based on the target attention value, the text decoder is corrected.

[0065] Through the above technical solution, it is possible to use standard language modeling methods to train prompt tags, that is, to predict the current prompt tag based on the previous prompt tag, so that the text decoder can be simply and efficiently corrected on pure text data. Without affecting the model's visual signal perception ability, the text data distribution is aligned, which greatly narrows the performance gap with the model trained using video-text paired data, significantly improves the performance of the video-to-text generation model, and greatly reduces the workload of manually annotating paired data and reduces the dependence on video-text paired data. In addition, this correction method only needs to update a small number of model parameters, which greatly reduces the training cost.

[0066] In adopting Figure 4 After the text decoder is modified in the correction process shown, the text decoder can connect the fused visual features with the prompt tags when decoding the text, and share the same softmax group. The prompt tags are invisible to the video tags to reduce the inconsistency in the training and reasoning processes.

[0067] Figure 5 This is another flowchart for modifying a text decoder according to an embodiment of the present disclosure. Each layer of the text decoder has a first adapter and a second adapter. The first adapter is located after the multi-head self-attention, and the second adapter is located after the feedforward network. Both the first adapter and the second adapter use residual connections. In addition, both the first adapter and the second adapter can include learnable gates for downsampling, activation functions, upsampling, and zero initialization. Figure 5 As shown, the method for correcting the text decoder may include the following steps S51.

[0068] In step S51, the first adapter and the second adapter are adjusted by text marking to correct the text decoder.

[0069] That is, during the correction period, the text token will be processed by layer normalization, multi-head self-attention, first adapter, layer normalization, feedforward network, and second adapter in order to adjust the first adapter and the second adapter to correct the text decoder. That is, during the correction period of the text decoder, the only trainable parameters are the first adapter and the second adapter, and the rest of the parameters are frozen.

[0070] Through the above technical solution, the standard language modeling method can be used to train the adapter, so that the text decoder can be simply and efficiently corrected on pure text data. Without affecting the model's visual signal perception ability, the text data distribution is aligned, which greatly narrows the performance gap with the model trained using video-text paired data, significantly improves the performance of the video-to-text generation model, and greatly reduces the workload of manually annotating paired data and reduces the dependence on video-text paired data. In addition, this correction method only needs to update a small number of model parameters, which greatly reduces the training cost.

[0071] In adopting Figure 5 After the text decoder is modified by the correction process shown, the text decoder can connect the fused visual features with the text tags when decoding the fused visual features. It is worth noting that the adapter only operates on the text tags and does not affect the video tags. Therefore, the fused visual features are processed by layer normalization, multi-head self-attention, layer normalization, and feedforward network in sequence, while the network through which the text tags pass during training and inference remains unchanged, that is, during the inference process, the text tags are still processed by layer normalization, multi-head self-attention, the first adapter, layer normalization, feedforward network, and the second adapter in sequence.

[0072] Figure 6 FIG. 1 is a schematic block diagram of a video-to-text generation apparatus according to an embodiment of the present disclosure. Figure 6 As shown, the video-to-text generation device includes: an acquisition module 61, used to acquire the video to be processed; an extraction module 62, used to extract visual features from multiple video frames of the video to be processed; a fusion module 63, used to fuse the visual features of multiple video frames; a decoding module 64, used to perform text decoding on the fused visual features to obtain a text description of the video to be processed.

[0073] By adopting the above technical solution, since visual features are extracted from multiple video frames of the video to be processed, and then the visual features of the multiple video frames are fused, and the fused visual features are text-decoded to obtain a text description of the video to be processed, therefore, on the one hand, since all of the above operations can be performed without the need to use video-text paired data for training, the dependence on video-text paired data is reduced, and the manpower and time costs of data annotation are reduced; on the other hand, since the visual features extracted from the video frames can be used for text decoding, the performance of text generation without the use of video-text paired data for training (that is, in the zero-sample case) is improved, and the performance gap between the model trained with video-text paired data is greatly narrowed.

[0074] Optionally, the fusion module 63 fuses the visual features of the multiple video frames, including: aggregating the visual features of the multiple video frames into a first video-level representation through a preset aggregation function; based on an attention mechanism, compressing the first video-level representation to obtain a second video-level representation, wherein the information density of the second video-level representation is higher than the information density of the first video-level representation.

[0075] Optionally, the fusion module 63 fuses the visual features of the multiple video frames, including: compressing the visual features of the multiple video frames based on an attention mechanism; and aggregating the compressed visual features through a preset aggregation function to obtain a video-level representation.

[0076] Optionally, the fusion module 63 performs aggregation by a preset aggregation function, including one of the following:

[0077] Connecting the visual features along a time dimension;

[0078] Average pooling the visual features along the temporal dimension; and

[0079] The visual features are max-pooled along the temporal dimension.

[0080] Optionally, the fusion module 63 performs compression based on the attention mechanism, including: performing self-attention processing on the query tag, and performing cross-attention processing on the query tag and the visual feature to perform compression.

[0081] Optionally, the decoding module 64 performs text decoding on the fused visual features, including: using a text decoder to perform text decoding on the fused visual features;

[0082] The text decoder is modified as follows:

[0083] Injecting a hint token into each layer of the text decoder;

[0084] The text decoder is modified by calculating an attention value between a text tag and the prompt tag.

[0085] Optionally, the text decoder is corrected by calculating the attention value between the text tag and the prompt tag, including: performing attention processing between the text tags and performing attention processing between the text tag and the prompt tag; multiplying the attention value between the text tag and the prompt tag with an initialization tensor, and obtaining a target attention value based on the multiplication result and the text tag; and correcting the text decoder based on the target attention value.

[0086] Optionally, the decoding module 64 performs text decoding on the fused visual features, including: using a text decoder to perform text decoding on the fused visual features; wherein each layer network of the text decoder has a first adapter and a second adapter, the first adapter is located after the multi-head self-attention, the second adapter is located after the feedforward network, and the first adapter and the second adapter both use residual connections;

[0087] The text decoder is modified as follows:

[0088] The text decoder is modified by adjusting the first adapter and the second adapter through text marking.

[0089] The specific implementation methods of the operations performed by each module in the video-to-text generation device according to the embodiment of the present disclosure have been described in detail in the relevant methods and will not be repeated here.

[0090] The present disclosure also provides a computer-readable medium having a computer program stored thereon, which implements the steps of any method in the present disclosure when the program is executed by a processing device.

[0091] The present disclosure also provides an electronic device, comprising: a storage device on which a computer program is stored; and a processing device for executing the computer program in the storage device to implement the steps of any method in the present disclosure.

[0092] Reference below Figure 7, which shows a schematic diagram of the structure of an electronic device 600 suitable for implementing the embodiment of the present disclosure. The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 7 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0093] like Figure 7 As shown, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0094] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 7 The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0095] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0096] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0097] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.

[0098] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0099] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: obtains a video to be processed; extracts visual features from multiple video frames of the video to be processed; fuses the visual features of the multiple video frames; and performs text decoding on the fused visual features to obtain a text description of the video to be processed.

[0100] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0101] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0102] The modules involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a module does not limit the module itself in some cases. For example, an acquisition module may also be described as a "module for acquiring a video to be processed".

[0103] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0104] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0105] According to one or more embodiments of the present disclosure, Example 1 provides a video-to-text generation method, including: obtaining a video to be processed; extracting visual features from multiple video frames of the video to be processed; fusing the visual features of the multiple video frames; and text decoding the fused visual features to obtain a text description of the video to be processed.

[0106] According to one or more embodiments of the present disclosure, Example 2 provides the method of Example 1, wherein the fusing the visual features of the multiple video frames includes:

[0107] Aggregating the visual features of the plurality of video frames into a first video-level representation by a preset aggregation function;

[0108] Based on the attention mechanism, the first video-level representation is compressed to obtain a second video-level representation, wherein the information density of the second video-level representation is higher than the information density of the first video-level representation.

[0109] According to one or more embodiments of the present disclosure, Example 3 provides the method of Example 1, wherein fusing the visual features of the multiple video frames includes:

[0110] Based on an attention mechanism, compressing the visual features of the multiple video frames;

[0111] The compressed visual features are aggregated through a preset aggregation function to obtain a video-level representation.

[0112] According to one or more embodiments of the present disclosure, Example 4 provides the method of Example 2 or 3, wherein the aggregating by a preset aggregation function includes one of the following:

[0113] Connecting the visual features along a time dimension;

[0114] Average pooling the visual features along the temporal dimension; and

[0115] The visual features are max-pooled along the temporal dimension.

[0116] According to one or more embodiments of the present disclosure, Example 5 provides the method of Example 2 or 3, wherein the compression based on the attention mechanism includes:

[0117] A self-attention process is performed on the query token, and a cross-attention process is performed on the query token and the visual feature to perform compression.

[0118] According to one or more embodiments of the present disclosure, Example 6 provides the method of Example 1, wherein the text decoding of the fused visual features comprises: using a text decoder to text decode the fused visual features;

[0119] The text decoder is modified as follows:

[0120] Injecting a hint token into each layer of the text decoder;

[0121] The text decoder is modified by calculating an attention value between a text tag and the prompt tag.

[0122] According to one or more embodiments of the present disclosure, Example 7 provides the method of Example 6, wherein the step of modifying the text decoder by calculating the attention value between the text tag and the prompt tag includes:

[0123] Performing attention processing between the text markers and performing attention processing between the text marker and the prompt marker;

[0124] Multiplying the attention value between the text mark and the prompt mark with the initialization tensor, and obtaining a target attention value based on the multiplication result and the text mark;

[0125] Based on the target attention value, the text decoder is modified.

[0126] According to one or more embodiments of the present disclosure, Example 8 provides the method of Example 1, wherein the text decoding of the fused visual features comprises: using a text decoder to perform text decoding on the fused visual features; wherein each layer network of the text decoder has a first adapter and a second adapter, the first adapter is located after the multi-head self-attention, the second adapter is located after the feedforward network, and the first adapter and the second adapter both use residual connections;

[0127] The text decoder is modified as follows:

[0128] The text decoder is modified by adjusting the first adapter and the second adapter through text marking.

[0129] According to one or more embodiments of the present disclosure, Example 9 provides a video-to-text generation device, including: an acquisition module for acquiring a video to be processed; an extraction module for extracting visual features from multiple video frames of the video to be processed; a fusion module for fusing the visual features of the multiple video frames; and a decoding module for performing text decoding on the fused visual features to obtain a text description of the video to be processed.

[0130] According to one or more embodiments of the present disclosure, Example 10 provides a computer-readable medium having a computer program stored thereon, which implements the steps of any of the methods described in Examples 1-8 when executed by a processing device.

[0131] According to one or more embodiments of the present disclosure, Example 11 provides an electronic device, including:

[0132] a storage device having a computer program stored thereon;

[0133] A processing device is used to execute the computer program in the storage device to implement the steps of any one of the methods described in Examples 1-8.

[0134] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.

[0135] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0136] Although the subject matter has been described in language specific to structural features and / or method logic actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims. Regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.

Claims

1. A video to text generation method, characterized in that: include: Get the video to be processed; Extracting visual features from a plurality of video frames of the video to be processed; fusing the visual features of the multiple video frames; The fused visual features are subjected to text decoding to obtain a text description of the video to be processed.

2. The method according to claim 1, characterized in that The fusing the visual features of the multiple video frames comprises: Aggregating the visual features of the plurality of video frames into a first video-level representation by a preset aggregation function; Based on the attention mechanism, the first video-level representation is compressed to obtain a second video-level representation, wherein the information density of the second video-level representation is higher than the information density of the first video-level representation.

3. The method according to claim 1, characterized in that The fusing the visual features of the multiple video frames comprises: Based on an attention mechanism, compressing the visual features of the multiple video frames; The compressed visual features are aggregated through a preset aggregation function to obtain a video-level representation.

4. The method according to claim 2 or 3, characterized in that: The aggregation is performed by using a preset aggregation function, including one of the following: Connecting the visual features along a time dimension; Average pooling the visual features along the temporal dimension; and The visual features are max-pooled along the temporal dimension.

5. The method according to claim 2 or 3, characterized in that: The compression based on the attention mechanism includes: performing self-attention processing on the query tag, and performing cross-attention processing on the query tag and the visual feature to perform compression.

6. The method according to claim 1, characterized in that The text decoding of the fused visual features comprises: using a text decoder to text decode the fused visual features; The text decoder is modified as follows: Injecting a hint token into each layer of the text decoder; The text decoder is modified by calculating an attention value between a text tag and the prompt tag.

7. The method according to claim 6, characterized in that The step of modifying the text decoder by calculating an attention value between the text tag and the prompt tag comprises: Performing attention processing between the text markers and performing attention processing between the text marker and the prompt marker; Multiplying the attention value between the text mark and the prompt mark with the initialization tensor, and obtaining a target attention value based on the multiplication result and the text mark; Based on the target attention value, the text decoder is modified.

8. The method according to claim 1, characterized in that The text decoding of the fused visual features includes: using a text decoder to perform text decoding on the fused visual features; wherein each layer of the text decoder has a first adapter and a second adapter, the first adapter is located after the multi-head self-attention, the second adapter is located after the feedforward network, and the first adapter and the second adapter both use residual connections; The text decoder is modified as follows: The text decoder is modified by adjusting the first adapter and the second adapter through text marking.

9. A video to text generation device, characterized in that: include: An acquisition module is used to acquire the video to be processed; An extraction module, used for extracting visual features from a plurality of video frames of the video to be processed; A fusion module, used for fusing the visual features of the multiple video frames; The decoding module is used to perform text decoding on the fused visual features to obtain a text description of the video to be processed.

10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processing device, the steps of the method described in any one of claims 1 to 8 are implemented.

11. An electronic device, characterized in that: include: a storage device having a computer program stored thereon; A processing device, configured to execute the computer program in the storage device to implement the steps of the method according to any one of claims 1 to 8.

Citation Information

Cited By

  • Short video text generation method and device based on video entropy, equipment and medium

    CN120825600A

  • Generating video descriptions using a machine learning model

    WO2026054709A1