Data processing method and apparatus thereof
By introducing a multi-layer network structure and dynamic routing mechanism into video multi-modal understanding, the accuracy problem caused by different image and text processing granularities is solved, and fine-grained visual-text alignment and efficient video understanding are achieved.
Patent Information
- Application Number
- PCT/CN2024/084667
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-31
- Filing Date
- 2024-03-29
- Publication Date
- 2024-10-03
AI Technical Summary
In the existing technology, in multi-modal video understanding, the processing granularity of images and text is different, resulting in poor network processing accuracy, and the visual branch structure of the image-text pre-training model is destroyed, resulting in information loss.
By introducing a multi-layer network structure in the image encoder, focusing on the attention interaction of spatial and temporal dimensions, and conducting a dynamic routing mechanism in the text encoder to fuse image and text features to achieve fine-grained visual-text alignment, And it does not destroy the structure of the original image-text pre-training model.
It improves the accuracy and fine-grained understanding of video processing, enhances verb or fine-grained understanding, correctly associates video frames and text information, and maintains the structural integrity of the original image-text pre-training model.
Smart Images

Figure CN2024084667_03102024_PF_FP_ABST
Abstract
Description
A data processing method and device thereof
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of China on March 31, 2023, with application number 202310369601.9 and invention name “A data processing method and device thereof”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of artificial intelligence, and in particular to a data processing method and device thereof. Background Art
[0003] Artificial Intelligence (AI) is the theory, methods, techniques, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, to perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a branch of computer science that seeks to understand the essence of intelligence and develop new intelligent machines that can respond in a manner similar to human intelligence. AI also studies the design principles and implementation methods of various intelligent machines, enabling them to possess the capabilities of perception, reasoning, and decision-making.
[0004] By combining big data with large models under pre-training conditions, the performance of image understanding tasks has been significantly improved, and the field has gradually shifted from image understanding to video understanding. Because video multimodal understanding technology based on image and text pre-training can fully utilize more pre-trained image and text knowledge, it has become the mainstream direction of video multimodal understanding.
[0005] Extensive data indicates that online video has surpassed traditional media like images and text to become the most mainstream internet medium. Multimodal video understanding technology can provide content understanding capabilities for short video services, including video tagging, classification, and retrieval, and has a wide range of application scenarios.
[0006] However, content feature representation varies greatly between different modalities (especially between video and text), and a model that is compatible with multimodal input data is urgently needed.
[0007] Summary of the Invention
[0008] This application provides a data processing method that can improve the processing accuracy of the network.
[0009] In a first aspect, the present application provides a data processing method, which includes: obtaining a video and a text, wherein the text includes multiple text units; obtaining a first feature representation of the video through an image encoder based on the video; obtaining a second feature representation of each text unit and a third feature representation corresponding to the text through a text encoder based on the text; the third feature representation is obtained by extracting features from the text as a whole through the text encoder; the third feature representation is fused with each second feature representation to obtain multiple fourth feature representations; and the image encoder and the text encoder are updated by performing comparative learning between the first feature representation and the multiple fourth feature representations.
[0010] In the prior art, when performing contrastive learning, the feature representation of the text branch only includes the feature representation obtained by extracting features based on the text as a whole. However, when processing videos, it includes a branch that processes with image blocks as the granularity, which is equivalent to the different processing granularities on the image side and the text side. In the embodiment of the present application, on the one hand, the feature representation of each text unit is obtained in the text processing branch, which is lower than the processing granularity of the text processing branch in the prior art and can be closer to the processing branch of the image processing branch, thereby improving the processing accuracy of the network. In addition, the feature representation of each text unit is obtained based on the text unit itself and the nearby contextual information, which can only reflect local information. In the embodiment of the present application, the third feature representation obtained by extracting features based on the text encoder based on the text as a whole is fused into the feature representation corresponding to each text unit, so that the feature representation corresponding to each text unit also includes global text information, thereby improving the processing accuracy of the network.
[0011] In one possible implementation, the video includes multiple image frames, and the first feature representation of the video is obtained based on the video through an image encoder, including: based on the video, taking each image frame as a whole, performing feature extraction and attention operation through the image encoder to obtain a first feature representation, wherein the first feature representation includes a first sub-feature representation corresponding to each image frame.
[0012] In one possible implementation, the image encoder can input each image frame into the image encoder as a whole (that is, not divided into image blocks and input into the image encoder), wherein the image encoder can perform feature extraction and attention operations on each image frame, and the image encoder can focus on attention interactions in the spatial dimension.
[0013] From the perspective of network structure, the image encoder may include multiple first network layers and multiple second network layers. When processing multiple image frames, the image encoder may perform feature extraction and attention operations in the spatial dimension within the image frames through the multiple first network layers, and perform feature extraction and attention operations in the temporal dimension between image frames through the multiple second network layers. In one possible implementation, the multiple first network layers may be connected before the multiple second network layers, or the number of the first network layers may be greater than the number of the second network layers. By designing the connection order or the number of network layers, the image encoder can focus on attention interactions in the spatial dimension.
[0014] In one possible implementation, the video includes multiple image frames, and the first feature representation of the video is obtained based on the video through an image encoder, including: based on the video, taking each image block in each of the image frames as a whole, performing feature extraction and attention operation through the image encoder to obtain a second feature representation, wherein the second feature representation includes a second sub-feature representation corresponding to each image block.
[0015] In one possible implementation, the image encoder can input the image blocks in each image frame as a whole (that is, the image frame is divided into image blocks and input into the image encoder), wherein the image encoder can perform feature extraction and attention operations on each image block, and the image encoder can focus on attention interactions in the temporal dimension.
[0016] From the perspective of network structure, the image encoder may include multiple third network layers and multiple fourth network layers. When processing multiple image frames, the image encoder may perform feature extraction and attention operations on the temporal dimension between image frames through the multiple third network layers, and perform feature extraction and attention operations on the spatial dimension within the image frames through the multiple second network layers. In one possible implementation, the multiple third network layers are connected before the multiple fourth network layers, or the number of the third network layers is greater than the fourth network layers. By designing the connection order or the number of network layers, the image encoder can focus on attention interactions on the temporal dimension.
[0017] In a possible implementation, the image encoder includes a first encoder and a second encoder; the first encoder includes a first intermediate layer, and the second encoder includes a second intermediate layer; the first feature representation of the multiple image frames is obtained through the image encoder based on the video, including: based on the video, taking each image frame as a whole, performing feature extraction and attention operation through the first encoder to obtain a first feature representation, and the first feature representation includes a first sub-feature representation corresponding to each image frame; based on the video and the output of the first intermediate layer, taking each image block in each image frame as a whole, performing feature extraction and attention operation through the second encoder to obtain a second feature representation, and the second feature representation includes a second sub-feature representation corresponding to each image block; wherein the output of the first intermediate layer is fused to the output or input of the second intermediate layer.
[0018] In a possible implementation, the first encoder includes multiple first network layers and multiple second network layers, the first intermediate layer belongs to the multiple first network layers or the multiple second network layers, and the feature extraction and attention operation through the first encoder include: performing feature extraction and attention operation on the spatial dimension within the image frame through the multiple first network layers, and performing feature extraction and attention operation on the temporal dimension between image frames through the multiple second network layers; wherein, the multiple first network layers are connected before the multiple second network layers, or the number of the first network layers is greater than the second network layers.
[0019] The first network layer is all network layers in the first encoder used to perform attention operations on the spatial dimension within the image frame, and the second network layer is all network layers in the first encoder used to perform attention operations on the temporal dimension between image frames.
[0020] In one possible implementation, the second encoder includes multiple third network layers and multiple fourth network layers, the second intermediate layer belongs to the multiple third network layers or the multiple fourth network layers, and the feature extraction and attention operation through the second encoder include: performing feature extraction and attention operation on the temporal dimension between image frames through the multiple third network layers, and performing feature extraction and attention operation on the spatial dimension within the image frame through the multiple second network layers; wherein, the multiple third network layers are connected before the multiple fourth network layers, or the number of the third network layers is greater than the fourth network layers.
[0021] The third network layer is all the network layers in the second encoder used to perform attention operations on the temporal dimension between image frames, and the fourth network layer is all the network layers in the second encoder used to perform attention operations on the spatial dimension within the image frame.
[0022] The output of the first intermediate layer can be features obtained based on spatial modeling, and the features obtained by spatial modeling are integrated into the second intermediate layer for temporal modeling, thereby realizing the integration of temporal modeling and spatial modeling. The visual branch structure of the original image-text pre-training model (that is, the structure of the first encoder) is not changed, but only the structure of the second encoder is changed, thereby improving the processing accuracy of the model.
[0023] In a possible implementation, the first intermediate layer belongs to the multiple first network layers, and the second intermediate layer belongs to the multiple third network layers.
[0024] In one possible implementation, the output of the first intermediate layer is fused to the output or input of the second intermediate layer, including: resizing the output of the first intermediate layer, so that the output of the adjusted first intermediate layer is consistent with the input or output size of the second intermediate layer, and performing a sum operation on the output of the adjusted first intermediate layer and the input or output of the second intermediate layer at corresponding positions.
[0025] In a possible implementation, a position of the first intermediate layer in the first encoder matches a position of the second intermediate layer in the first encoder.
[0026] In one possible implementation, the performing comparative learning between the first feature representation and the multiple fourth feature representations includes: performing comparative learning between the first feature representation and the multiple fourth feature representations, and performing comparative learning between the first feature representation and the third feature representation.
[0027] In a second aspect, the present application provides a data processing device, comprising:
[0028] An acquisition module, configured to acquire a video and text, wherein the text includes a plurality of text units;
[0029] a processing module, configured to obtain, based on the video, a first feature representation of the video through an image encoder;
[0030] According to the text, a text encoder is used to obtain a second feature representation of each text unit and a third feature representation corresponding to the text; the third feature representation is obtained by extracting features from the text as a whole through the text encoder;
[0031] fusing the third feature representation with each second feature representation to obtain a plurality of fourth feature representations;
[0032] The image encoder and the text encoder are updated by performing comparative learning between the first feature representation and the plurality of fourth feature representations.
[0033] In a possible implementation, the processing module is specifically configured to:
[0034] According to the video, taking each of the image frames as a whole, feature extraction and attention operation are performed through the image encoder to obtain a first feature representation, where the first feature representation includes a first sub-feature representation corresponding to each image frame.
[0035] In a possible implementation, the processing module is specifically configured to:
[0036] According to the video, each image block in each image frame is taken as a whole, and feature extraction and attention operation are performed through the image encoder to obtain a second feature representation, where the second feature representation includes a second sub-feature representation corresponding to each image block.
[0037] In one possible implementation, the image encoder includes a first encoder and a second encoder; the first encoder includes a first intermediate layer, and the second encoder includes a second intermediate layer;
[0038] The processing module is specifically used to:
[0039] According to the video, taking each of the image frames as a whole, performing feature extraction and attention operation by the first encoder to obtain a first feature representation, where the first feature representation includes a first sub-feature representation corresponding to each image frame;
[0040] According to the output of the video and the first intermediate layer, each image block in each image frame is taken as a whole, and feature extraction and attention operation are performed by the second encoder to obtain a second feature representation, where the second feature representation includes a second sub-feature representation corresponding to each image block; wherein the output of the first intermediate layer is fused to the output or input of the second intermediate layer.
[0041] In a possible implementation, the first encoder includes multiple first network layers and multiple second network layers, the first intermediate layer belongs to the multiple first network layers or the multiple second network layers, and the processing module is specifically configured to:
[0042] Through the multiple first network layers, feature extraction and attention operation on the spatial dimension are performed within the image frame, and through the multiple second network layers, feature extraction and attention operation on the temporal dimension are performed between image frames; wherein,
[0043] The multiple first network layers are connected before the multiple second network layers, or the number of the first network layers is greater than the number of the second network layers.
[0044] In a possible implementation, the second encoder includes multiple third network layers and multiple fourth network layers, the second intermediate layer belongs to the multiple third network layers or the multiple fourth network layers, and the processing module is specifically configured to:
[0045] The plurality of third network layers are used to perform feature extraction and attention operations on the temporal dimension between image frames, and the plurality of second network layers are used to perform feature extraction and attention operations on the spatial dimension within image frames; wherein,
[0046] The plurality of third network layers are connected before the plurality of fourth network layers, or the number of the third network layers is greater than the number of the fourth network layers.
[0047] In a possible implementation, the first intermediate layer belongs to the multiple first network layers, and the second intermediate layer belongs to the multiple third network layers.
[0048] In a possible implementation, the processing module is specifically configured to:
[0049] The output of the first intermediate layer is resized so that the output of the adjusted first intermediate layer is consistent with the input or output size of the second intermediate layer, and a sum operation is performed on the output of the adjusted first intermediate layer and the input or output of the second intermediate layer at corresponding positions.
[0050] In a possible implementation, a position of the first intermediate layer in the first encoder matches a position of the second intermediate layer in the first encoder.
[0051] In a possible implementation, the processing module is specifically configured to:
[0052] By performing comparative learning between the first feature representation and the plurality of fourth feature representations, and by performing comparative learning between the first feature representation and the third feature representation.
[0053] In a third aspect, the present application provides a data processing method, the method comprising:
[0054] Acquire a video and text, where the text includes multiple text units;
[0055] Obtaining a first feature representation of the video through an image encoder according to the video;
[0056] According to the text, a text encoder is used to obtain a second feature representation of each text unit and a third feature representation corresponding to the text; the third feature representation is obtained by extracting features from the text as a whole through the text encoder;
[0057] fusing the third feature representation with each second feature representation to obtain a plurality of fourth feature representations;
[0058] A task processing result is obtained through a task network according to the first feature representation and the plurality of fourth feature representations.
[0059] In one possible implementation, the task network is used to implement at least one of the following tasks: a video retrieval task, a video classification task, a video positioning task, and a video generation task (such as video question answering and video title generation).
[0060] In a fourth aspect, the present application provides a data processing device, comprising:
[0061] An acquisition module, configured to acquire a video and text, wherein the text includes a plurality of text units;
[0062] a processing module, configured to obtain, based on the video, a first feature representation of the video through an image encoder;
[0063] According to the text, a text encoder is used to obtain a second feature representation of each text unit and a third feature representation corresponding to the text; the third feature representation is obtained by extracting features from the text as a whole through the text encoder;
[0064] fusing the third feature representation with each second feature representation to obtain a plurality of fourth feature representations;
[0065] A task processing result is obtained through a task network according to the first feature representation and the plurality of fourth feature representations.
[0066] In one possible implementation, the task network is used to implement at least one of the following tasks: a video retrieval task, a video classification task, a video positioning task, and a video generation task (such as video question answering and video title generation).
[0067] In a fifth aspect, the present application provides a data processing method, the method comprising:
[0068] Acquire a video and text, where the text includes multiple text units;
[0069] Obtaining a first feature representation of the video through an image encoder according to the video;
[0070] According to the text, a text encoder is used to obtain a second feature representation of each text unit and a third feature representation corresponding to the text; the third feature representation is obtained by extracting features from the text as a whole through the text encoder;
[0071] fusing the third feature representation with each second feature representation to obtain a plurality of fourth feature representations;
[0072] Obtaining a task processing result through a task network according to the first feature representation and the plurality of fourth feature representations;
[0073] The image encoder, the text encoder and the task network are updated according to the task processing result.
[0074] In one possible implementation, the task network is used to implement at least one of the following tasks: a video retrieval task, a video classification task, a video positioning task, and a video generation task (such as video question answering and video title generation).
[0075] In a sixth aspect, the present application provides a data processing device, the device comprising:
[0076] An acquisition module, configured to acquire a video and text, wherein the text includes a plurality of text units;
[0077] a processing module, configured to obtain, based on the video, a first feature representation of the video through an image encoder;
[0078] According to the text, a text encoder is used to obtain a second feature representation of each text unit and a third feature representation corresponding to the text; the third feature representation is obtained by extracting features from the text as a whole through the text encoder;
[0079] fusing the third feature representation with each second feature representation to obtain a plurality of fourth feature representations;
[0080] Obtaining a task processing result through a task network according to the first feature representation and the plurality of fourth feature representations;
[0081] The image encoder, the text encoder and the task network are updated according to the task processing result.
[0082] In one possible implementation, the task network is used to implement at least one of the following tasks: a video retrieval task, a video classification task, a video positioning task, and a video generation task (such as video question answering and video title generation).
[0083] In the seventh aspect, an embodiment of the present application provides a training device, which may include a memory, a processor, and a bus system, wherein the memory is used to store programs, and the processor is used to execute the programs in the memory to perform the above-mentioned first aspect and any optional method thereof, and the above-mentioned fifth aspect and any optional method thereof.
[0084] In an eighth aspect, an embodiment of the present application provides an execution device, which may include a memory, a processor, and a bus system, wherein the memory is used to store programs, and the processor is used to execute the programs in the memory to execute the third aspect and any optional method thereof.
[0085] In the ninth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer-readable storage medium is run on a computer, it enables the computer to execute the above-mentioned first aspect and any optional method thereof, the above-mentioned third aspect and any optional method thereof, and the above-mentioned fifth aspect and any optional method thereof.
[0086] In the tenth aspect, an embodiment of the present application provides a computer program, which, when running on a computer, enables the computer to execute the above-mentioned first aspect and any optional method thereof, the above-mentioned third aspect and any optional method thereof, and the above-mentioned fifth aspect and any optional method thereof.
[0087] In an eleventh aspect, the present application provides a chip system comprising a processor configured to support the execution of a data processing device to implement the functions described in the aforementioned aspects, such as transmitting or processing the data or information described in the aforementioned methods. In one possible design, the chip system further comprises a memory configured to store program instructions and data necessary for executing or training the device. The chip system may consist solely of a chip or may include a chip and other discrete components. BRIEF DESCRIPTION OF THE DRAWINGS
[0088] FIG1A is a schematic diagram of a structure of an artificial intelligence main framework;
[0089] 1B and 1C are schematic diagrams of the application system framework of the present invention;
[0090] FIG1D is a schematic diagram of an optional hardware structure of a terminal;
[0091] FIG2 is a schematic diagram of the structure of a server;
[0092] FIG3 is a schematic diagram of a system architecture of the present application;
[0093] Figure 4 shows a process of cloud services;
[0094] FIG5 is a flowchart of a data processing method provided in an embodiment of the present application;
[0095] 6 to 9 are schematic diagrams of a data processing method provided in an embodiment of the present application;
[0096] FIG10 is a schematic structural diagram of a data processing device provided in an embodiment of the present application;
[0097] FIG11 is a schematic diagram of the structure of an execution device provided in an embodiment of the present application;
[0098] FIG12 is a schematic diagram of a structure of a training device provided in an embodiment of the present application;
[0099] FIG13 is a schematic diagram of the structure of a chip provided in an embodiment of the present application. DETAILED DESCRIPTION
[0100] The following describes the embodiments of the present invention in conjunction with the accompanying drawings. The terms used in the embodiments of the present invention are only used to explain the specific embodiments of the present invention, and are not intended to limit the present invention.
[0101] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0102] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, and this is merely a way of distinguishing the objects of the same attributes when describing them in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0103] As used herein, the terms "substantially," "about," and similar terms are used as terms of approximation, not as terms of degree, and are intended to take into account the inherent variations in measurements or calculations that one of ordinary skill in the art would recognize. Furthermore, the use of "may" when describing embodiments of the present invention refers to "one or more possible embodiments." As used herein, the terms "use," "using," and "used" may be considered synonymous with the terms "utilize," "utilizing," and "utilized," respectively. Additionally, the term "exemplary" is intended to refer to an example or illustration.
[0104] First, let's describe the overall workflow of an AI system. See Figure 1A, which shows a schematic diagram of the main AI framework. This AI framework will be explained from two perspectives: the "intelligent information chain" (horizontal axis) and the "IT value chain" (vertical axis). The "intelligent information chain" reflects the entire process from data acquisition to processing. For example, it could be the general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, and intelligent execution and output. Throughout this process, data undergoes a condensed journey from "data-information-knowledge-wisdom." The "IT value chain," spanning the underlying infrastructure of human intelligence, information (provided and processed by technology), and the system's industrial ecosystem, reflects the value that AI brings to the information technology industry.
[0105] (1) Infrastructure
[0106] Infrastructure provides computing power for AI systems, enabling communication with the outside world and supporting this through a foundational platform. External communication occurs through sensors; computing power is provided by intelligent chips (CPUs, NPUs, GPUs, ASICs, FPGAs, and other hardware accelerators). The foundational platform includes a distributed computing framework and network-related platform guarantees and support, including cloud storage and computing, and interconnected networks. For example, sensors communicate with the outside world to acquire data, which is then fed into the intelligent chips within the distributed computing system provided by the foundational platform for computation.
[0107] (2) Data
[0108] Data above the infrastructure layer represents data sources for AI. This data includes graphics, images, voice, and text, as well as IoT data from traditional devices. This includes business data from existing systems and sensor data such as force, displacement, liquid level, temperature, and humidity.
[0109] (3) Data processing
[0110] Data processing generally includes data training, machine learning, deep learning, search, reasoning, decision-making, etc.
[0111] Among them, machine learning and deep learning can symbolize and formalize data for intelligent information modeling, extraction, preprocessing, and training.
[0112] Reasoning refers to the process of simulating human intelligent reasoning in computers or intelligent systems, using formalized information to perform machine thinking and solve problems based on reasoning control strategies. Typical functions are search and matching.
[0113] Decision-making refers to the process of making decisions after intelligent information is reasoned, and usually provides functions such as classification, sorting, and prediction.
[0114] (4) General ability
[0115] After the data has undergone the data processing mentioned above, some general capabilities can be further formed based on the results of the data processing, such as algorithms or a general system, for example, translation, text analysis, computer vision processing, speech recognition, image recognition, etc.
[0116] (5) Smart products and industry applications
[0117] Smart products and industry applications refer to the products and applications of artificial intelligence systems in various fields. They are the encapsulation of the overall artificial intelligence solution, which productizes intelligent information decision-making and realizes practical application. Its application areas mainly include: smart terminals, smart transportation, smart medical care, autonomous driving, smart cities, etc.
[0118] This application can be applied to the field of natural language processing in the field of artificial intelligence. Taking natural language processing as an example, the following will introduce multiple application scenarios that have been implemented in products.
[0119] First, we will introduce the application scenarios of this application. This application can be applied to, but is not limited to, applications with video and text understanding capabilities (hereinafter referred to as video understanding applications) or cloud services provided by cloud-side servers. The following are introduced separately:
[0120] 1. Video Understanding Applications
[0121] The product form of the embodiment of the present application can be a video understanding application. The video understanding application can be run on a terminal device or a cloud-side server.
[0122] In one possible implementation, video understanding applications can process multimodal data and generate results. That is, the same processing model can process input data in multiple modalities (including video and text).
[0123] For example, a video understanding application may implement at least video understanding tasks including video classification tasks, video search tasks, video recommendation tasks, video positioning tasks, and advertisement matching tasks, but is not limited thereto.
[0124] In one possible implementation, a user can open a video understanding application installed on a terminal device and input multimodal data such as video and text (the text may be triggered by instructions and not necessarily actively input by the user). The video understanding application can process the video and text using a model trained by the method provided in the embodiments of the present application, or using the method provided in the embodiments of the present application, and present the processing results to the user (the presentation method may be, but is not limited to, display, saving, uploading to the cloud, etc.).
[0125] In one possible implementation, a user can open a video understanding application installed on a terminal device and input multimodal data such as video and text. The video understanding application can send multimodal data such as video and text to a cloud-side server. The cloud-side server processes the image using a multimodal model trained using the method provided in an embodiment of the present application, and transmits the processing results back to the terminal device. The terminal device can present the processing results to the user (the presentation method can be, but is not limited to, display, saving, uploading to the cloud side, etc.).
[0126] Next, the video understanding application in the embodiment of this application is introduced from the functional architecture and the product architecture that implements the function.
[0127] Referring to FIG. 1B , FIG. 1B is a schematic diagram of the functional architecture of a video understanding application program according to an embodiment of the present application:
[0128] In one possible implementation, as shown in FIG1B , a video understanding application 102 may receive input parameters 101 (e.g., including an image) and generate a processing result 103. The video understanding application 102 may be executed on (for example) at least one computer system and include computer code that, when executed by one or more computers, causes the computers to execute a multimodal model trained using the method provided in the embodiments of the present application.
[0129] Referring to FIG. 1C , FIG. 1C is a schematic diagram of the physical architecture for running a video understanding application in an embodiment of the present application:
[0130] Referring to FIG1C , FIG1C shows a schematic diagram of a system architecture. The system may include a terminal 100 and a server 200. The server 200 may include one or more servers (FIG1C illustrates one server as an example), and the server 200 may provide video understanding functionality for one or more terminals.
[0131] Among them, the terminal 100 can be installed with a video understanding application, or a web page related to the video understanding function can be opened. The above application and web page can provide an interface. The terminal 100 can receive the relevant parameters entered by the user on the video understanding function interface and send the above parameters to the server 200. The server 200 can obtain the processing results based on the received parameters and return the processing results to the terminal 100.
[0132] It should be understood that in some optional implementations, the terminal 100 can also complete the action of obtaining the processing result based on the received parameters by itself without the need for the cooperation of the server, and the embodiments of the present application are not limited to this.
[0133] Next, the product form of the terminal 100 in FIG1C is described;
[0134] The terminal 100 in the embodiment of the present application can be a mobile phone, a tablet computer, a wearable device, an in-vehicle device, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc., and the embodiment of the present application does not impose any restrictions on this.
[0135] FIG1D shows a schematic diagram of an optional hardware structure of the terminal 100 .
[0136] 1D , the terminal 100 may include components such as a radio frequency unit 110, a memory 120, an input unit 130, a display unit 140, a camera 150 (optional), an audio circuit 160 (optional), a speaker 161 (optional), a microphone 162 (optional), a processor 170, an external interface 180, and a power supply 190. Those skilled in the art will appreciate that FIG1D is merely an example of a terminal or multi-function device and does not limit the terminal or multi-function device. The terminal or multi-function device may include more or fewer components than shown, or may combine certain components or have different components.
[0137] The input unit 130 can be used to receive input digital or character information and generate key signal input related to user settings and function control of the portable multifunction device. Specifically, the input unit 130 may include a touch screen 131 (optional) and / or other input devices 132. The touch screen 131 can detect user touch operations on or near it (for example, operations performed on or near the touch screen using a finger, joint, stylus, or any other suitable object) and drive corresponding connected devices according to pre-set programs. The touch screen can detect user touch actions on the touch screen, convert the touch actions into touch signals and transmit them to the processor 170. It can also receive and execute commands sent by the processor 170; the touch signals include at least touch point coordinate information. The touch screen 131 provides an input interface and an output interface between the terminal 100 and the user. Touch screens can be implemented using various types, including resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch screen 131, the input unit 130 may also include other input devices. Specifically, the other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as a volume control button 132 , a switch button 133 , etc.), a trackball, a mouse, a joystick, and the like.
[0138] The input device 132 can receive multimodal data such as input video and text.
[0139] The display unit 140 may be used to display information input by or provided to the user, various menus of the terminal 100, interactive interfaces, file displays, and / or playback of any multimedia file. In an embodiment of the present application, the display unit 140 may be used to display the interface of a video understanding application, processing results, etc.
[0140] Memory 120 can be used to store instructions and data. It primarily includes an instruction storage area and a data storage area. The data storage area can store various data, such as multimedia files and text. The instruction storage area can store software units such as the operating system, applications, and instructions required for at least one function, or subsets or extensions thereof. It may also include non-volatile random access memory (RAM). It provides processor 170 with management functions for the hardware, software, and data resources within the computing and processing device, supporting control software and applications. It is also used to store multimedia files and running programs and applications.
[0141] The processor 170 is the control center of the terminal 100. It connects all components of the terminal 100 using various interfaces and circuits. By executing instructions stored in the memory 120 and accessing data stored therein, it executes various functions of the terminal 100 and processes data, thereby providing overall control of the terminal device. Optionally, the processor 170 may include one or more processing units. Preferably, the processor 170 may integrate an application processor and a modem processor, with the application processor primarily processing the operating system, user interface, and application programs, while the modem processor primarily handles wireless communications. It is understood that the modem processor may not be integrated into the processor 170. In some embodiments, the processor and memory may be implemented on a single chip; in other embodiments, they may be implemented on separate chips. The processor 170 may also generate corresponding operational control signals and send them to the corresponding components of the computing and processing device. It may also read and process data in the software, particularly the data and programs in the memory 120, to enable the various functional modules therein to perform their corresponding functions, thereby controlling the corresponding components to operate as instructed.
[0142] Among them, the memory 120 can be used to store software codes related to the data processing method, the processor 170 can execute the steps of the chip's data processing method, and can also schedule other units (such as the above-mentioned input unit 130 and display unit 140) to achieve corresponding functions.
[0143] The RF unit 110 (optional) can be used to send and receive information or receive and send signals during a call. For example, after receiving downlink information from the base station, it is passed to the processor 170 for processing; in addition, it sends the designed uplink data to the base station. Generally, the RF circuit includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, etc. In addition, the RF unit 110 can also communicate with network devices and other devices via wireless communication. This wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), etc.
[0144] In this embodiment of the present application, the radio frequency unit 110 can send multimodal data such as video and text to the server 200 and receive processing results sent by the server 200.
[0145] It should be understood that the radio frequency unit 110 is optional and can be replaced by other communication interfaces, such as a network port.
[0146] The terminal 100 also includes a power supply 190 (such as a battery) for supplying power to various components. Preferably, the power supply can be logically connected to the processor 170 through a power management system, thereby managing functions such as charging, discharging, and power consumption through the power management system.
[0147] The terminal 100 further includes an external interface 180 , which may be a standard Micro USB interface or a multi-pin connector, and may be used to connect the terminal 100 to other devices for communication, or to connect a charger to charge the terminal 100 .
[0148] Although not shown, the terminal 100 may also include a flash, a wireless fidelity (WiFi) module, a Bluetooth module, sensors with different functions, etc., which are not described in detail here. Some or all of the methods described below may be applied to the terminal 100 shown in FIG1D .
[0149] Next, the product form of the server 200 in FIG1C is described;
[0150] FIG2 provides a schematic diagram of the structure of a server 200. As shown in FIG2, the server 200 includes a bus 201, a processor 202, a communication interface 203, and a memory 204. The processor 202, the memory 204, and the communication interface 203 communicate with each other via the bus 201.
[0151] Bus 201 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. Buses can be categorized as address buses, data buses, and control buses. For ease of illustration, FIG2 shows only one thick line, but this does not imply that there is only one bus or only one type of bus.
[0152] The processor 202 may be any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0153] The memory 204 may include volatile memory, such as random access memory (RAM). The memory 204 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard drive (HDD), or solid state drive (SSD).
[0154] The memory 204 may be used to store software codes related to the data processing method, and the processor 202 may execute the steps of the data processing method of the chip, and may also schedule other units to implement corresponding functions.
[0155] It should be understood that the above-mentioned terminal 100 and server 200 can be centralized or distributed devices, and the processors in the above-mentioned terminal 100 and server 200 (such as processor 170 and processor 202) can be hardware circuits (such as application specific integrated circuit (ASIC), field-programmable gate array (FPGA), general-purpose processor, digital signal processor (DSP), microprocessor or microcontroller, etc.), or a combination of these hardware circuits. For example, the processor can be a hardware system with an instruction execution function, such as a CPU, DSP, etc., or a hardware system without an instruction execution function, such as an ASIC, FPGA, etc., or a combination of the above-mentioned hardware systems without an instruction execution function and hardware systems with an instruction execution function.
[0156] It should be understood that the steps related to the model reasoning process in the embodiments of this application involve AI-related operations. When performing AI operations, the instruction execution architecture of the terminal device and server is not limited to the processor-memory architecture described above. The system architecture provided in the embodiments of this application is described in detail below with reference to Figure 3.
[0157] FIG3 is a schematic diagram of the system architecture provided by an embodiment of the present application. As shown in FIG3 , the system architecture 500 includes an execution device 510 , a training device 520 , a database 530 , a client device 540 , a data storage system 550 , and a data acquisition system 560 .
[0158] The execution device 510 includes a calculation module 511, an I / O interface 512, a pre-processing module 513, and a post-processing module 514. The calculation module 511 may include the target model / rule 501, and the pre-processing module 513 and the post-processing module 514 are optional.
[0159] The execution device 510 may be a terminal device or a server that runs the aforementioned video comprehension application.
[0160] The data acquisition device 560 is used to collect training samples. The training samples can be multimodal data such as video and text. After collecting the training samples, the data acquisition device 560 stores them in the database 530.
[0161] The training device 520 can train the neural network to be trained (such as the model in the embodiment of the present application (such as an image encoder, a text encoder, etc.)) based on the training samples maintained in the database 530 to obtain the target model / rule 501.
[0162] It should be understood that the training device 520 can perform a pre-training process on the neural network to be trained based on the training samples maintained in the database 530, or fine-tune the model based on the pre-training.
[0163] It should be noted that, in actual applications, the training samples maintained in the database 530 may not all be collected by the data acquisition device 560, but may also be received from other devices. It should also be noted that the training device 520 may not train the target model / rule 501 entirely based on the training samples maintained in the database 530, but may also obtain training samples from the cloud or other places for model training. The above description should not be used as a limitation on the embodiments of the present application.
[0164] The target model / rule 501 obtained through training with the training device 520 can be applied to different systems or devices, such as the execution device 510 shown in FIG3 . The execution device 510 can be a terminal, such as a mobile phone terminal, a tablet computer, a laptop computer, an augmented reality (AR) / virtual reality (VR) device, an in-vehicle terminal, etc., or a server, etc.
[0165] Specifically, the training device 520 may transfer the trained model to the execution device 510 .
[0166] In Figure 3, the execution device 510 is configured with an input / output (I / O) interface 512 for data interaction with external devices. The user can input data (such as multimodal data such as video and text in the embodiment of the present application) to the I / O interface 512 through the client device 540.
[0167] Preprocessing module 513 and preprocessing module 514 are used to preprocess the input data received by I / O interface 512. It should be understood that preprocessing module 513 and preprocessing module 514 may be absent or only one preprocessing module may be present. If preprocessing module 513 and preprocessing module 514 are absent, computing module 511 may be used directly to process the input data.
[0168] When the execution device 510 preprocesses the input data, or when the computing module 511 of the execution device 510 performs calculations and other related processing, the execution device 510 can call the data, code, etc. in the data storage system 550 for corresponding processing, and can also store the data, instructions, etc. obtained from the corresponding processing in the data storage system 550.
[0169] Finally, the I / O interface 512 provides the processed results to the client device 540 and thus to the user.
[0170] In the scenario shown in FIG3 , the user can manually input data, and this "manual input data" can be operated through the interface provided by I / O interface 512. In another scenario, client device 540 can automatically send input data to I / O interface 512. If user authorization is required for client device 540 to automatically send input data, the user can set the corresponding permissions in client device 540. The user can view the results output by execution device 510 on client device 540, and the specific presentation form can be a display, sound, action, or other specific method. Client device 540 can also serve as a data acquisition terminal, collecting input data input into I / O interface 512 and output results output from I / O interface 512 as new sample data, and storing them in database 530. Of course, collection can also be performed without client device 540, and instead the I / O interface 512 directly stores the input data input into I / O interface 512 and output results output from I / O interface 512 as new sample data in database 530.
[0171] It is worth noting that FIG3 is merely a schematic diagram of a system architecture provided by an embodiment of the present application, and the positional relationships between the devices, components, modules, etc. shown in the figure do not constitute any limitation. For example, in FIG3 , the data storage system 550 is an external memory relative to the execution device 510. In other cases, the data storage system 550 can also be placed in the execution device 510. It should be understood that the execution device 510 can be deployed in the client device 540.
[0172] From the inference side of the model:
[0173] In the embodiment of the present application, the computing module 511 of the above-mentioned execution device 520 can obtain the code stored in the data storage system 550 to implement the steps related to the model reasoning process in the embodiment of the present application.
[0174] In an embodiment of the present application, the computing module 511 of the execution device 520 may include a hardware circuit (such as an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a general-purpose processor, a digital signal processor (DSP), a microprocessor or a microcontroller, etc.), or a combination of these hardware circuits. For example, the training device 520 can be a hardware system with an instruction execution function, such as a CPU, DSP, etc., or a hardware system without an instruction execution function, such as an ASIC, FPGA, etc., or a combination of the above-mentioned hardware systems without an instruction execution function and hardware systems with an instruction execution function.
[0175] Specifically, the computing module 511 of the execution device 520 can be a hardware system with the function of executing instructions, and the steps related to the model reasoning process provided in the embodiment of the present application can be software codes stored in the memory. The computing module 511 of the execution device 520 can obtain the software code from the memory and execute the obtained software code to implement the steps related to the model reasoning process provided in the embodiment of the present application.
[0176] It should be understood that the computing module 511 of the execution device 520 can be a combination of a hardware system that does not have the function of executing instructions and a hardware system that has the function of executing instructions. Some of the steps related to the model reasoning process provided in the embodiment of the present application can also be implemented by the hardware system that does not have the function of executing instructions in the computing module 511 of the execution device 520, which is not limited here.
[0177] From the training side of the model:
[0178] In an embodiment of the present application, the above-mentioned training device 520 can obtain the code stored in the memory (not shown in Figure 3, which can be integrated into the training device 520 or deployed separately from the training device 520) to implement the steps related to model training in the embodiment of the present application.
[0179] In an embodiment of the present application, the training device 520 may include a hardware circuit (such as an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a general-purpose processor, a digital signal processor (DSP), a microprocessor or a microcontroller, etc.), or a combination of these hardware circuits. For example, the training device 520 may be a hardware system with an instruction execution function, such as a CPU, DSP, etc., or a hardware system without an instruction execution function, such as an ASIC, FPGA, etc., or a combination of the above-mentioned hardware systems without an instruction execution function and hardware systems with an instruction execution function.
[0180] It should be understood that the training device 520 can be a combination of a hardware system that does not have the function of executing instructions and a hardware system that has the function of executing instructions. Some of the steps related to model training provided in the embodiments of the present application can also be implemented by the hardware system in the training device 520 that does not have the function of executing instructions, which is not limited here.
[0181] 2. Video understanding cloud services provided by the server:
[0182] In a possible implementation, the server may provide a video understanding service to the terminal through an application programming interface (API).
[0183] Among them, the terminal device can send relevant parameters (such as images, text and other data) to the server through the API provided by the cloud. The server can obtain processing results based on the received parameters, etc., and return the processing results to the terminal.
[0184] The description of the terminal and the server can be the same as that of the above embodiments, and will not be repeated here.
[0185] FIG4 shows a process of using a video understanding function cloud service provided by a cloud platform.
[0186] 1. Activate and purchase content review services.
[0187] 2. Users can download the software development kit (SDK) corresponding to the content review service. Usually, the cloud platform provides multiple development versions of the SDK for users to choose according to the requirements of the development environment, such as JAVA version SDK, Python version SDK, PHP version SDK, Android version SDK, etc.
[0188] 3. After downloading the corresponding version of the SDK locally as needed, the user imports the SDK project into the local development environment, configures and debugs it in the local development environment. The local development environment can also be used to develop other functions, forming an application that integrates video understanding functional capabilities.
[0189] 4. When a video understanding application is used and needs to perform video understanding, it can trigger an API call for the video understanding function. When the application triggers the video understanding function, it initiates an API request to the running instance of the video understanding service in the cloud environment. The API request includes an image, and the running instance in the cloud environment processes the image and obtains the processing result.
[0190] 5. The cloud environment returns the processing results to the application, thus completing a video understanding function call.
[0191] Since the embodiments of the present application involve the application of a large number of neural networks, in order to facilitate understanding, the relevant terms and related concepts such as neural networks involved in the embodiments of the present application are first introduced below.
[0192] (1) Neural Network
[0193] A neural network can be composed of neural units. A neural unit can refer to an operation unit that takes xs (i.e., input data) and intercept 1 as input. The output of the operation unit can be:
[0194] Where s = 1, 2, ... n, n is a natural number greater than 1, Ws is the weight of xs, and b is the bias of the neural unit. f is the activation function of the neural unit, which is used to introduce nonlinear characteristics into the neural network to convert the input signal of the neural unit into the output signal. The output signal of the activation function can be used as the input of the next convolutional layer, and the activation function can be a sigmoid function. A neural network is a network formed by connecting multiple single neural units mentioned above, that is, the output of one neural unit can be the input of another neural unit. The input of each neural unit can be connected to the local receptive field of the previous layer to extract the features of the local receptive field. The local receptive field can be an area composed of several neural units.
[0195] (2) Transformer layer
[0196] The neural network includes an embedding layer and at least one transformer layer, and the at least one transformer layer can be N transformer layers (N is an integer greater than 0), wherein each transformer layer includes an attention layer, an add&norm layer, a feed forward layer, and an add&norm layer that are adjacent in sequence. In the embedding layer, the current input is embedded to obtain multiple embedding vectors; in the attention layer, P input vectors are obtained from the previous layer of the first transformer layer, and with any first input vector among the P input vectors as the center, based on the correlation between each input vector within a preset attention window and the first input vector, the intermediate vector corresponding to the first input vector is obtained, thereby determining the P intermediate vectors corresponding to the P input vectors; in the pooling layer, the P intermediate vectors are merged into Q output vectors, wherein the multiple output vectors obtained by the last transformer layer in the transformer layer are used as feature representations of the current input.
[0197] (3) Attention mechanism
[0198] The attention mechanism mimics the internal process of biological observation behavior, namely, a mechanism that aligns internal experience and external sensations to increase the observation precision of certain areas. It can quickly filter out high-value information from a large amount of information using limited attention resources. The attention mechanism can quickly extract important features from sparse data and is therefore widely used in natural language processing tasks, especially machine translation. The self-attention mechanism is an improvement on the attention mechanism, which reduces dependence on external information and is better at capturing the internal correlation of data or features. The essential idea of the attention mechanism can be rewritten as the following formula:
[0199] Here, Lx = ||Source|| represents the length of the Source. This formula implies that the elements in the Source are imagined to consist of a series of data pairs. Given a Query element in the target, the similarity or correlation between the Query and each Key is calculated to obtain the weight coefficient for each Key's corresponding Value. The weighted sum of the Values is then taken to obtain the final Attention value. Essentially, the Attention mechanism performs a weighted sum of the Values of the Source elements, with the Query and Key used to calculate the weight coefficient for the corresponding Value. Conceptually, Attention can be understood as selectively filtering out a small amount of important information from a large amount of information and focusing on this important information, while ignoring the majority of less important information. This focusing process is reflected in the calculation of the weight coefficients: the larger the weight, the more focus is placed on the corresponding Value. In other words, the weight represents the importance of the information, while the Value represents the corresponding information. The self-attention mechanism can be understood as internal attention. The attention mechanism occurs between the Query element of the Target and all elements of the Source. The self-attention mechanism refers to the attention mechanism that occurs between the internal elements of the Source or the internal elements of the Target. It can also be understood as the attention calculation mechanism in the special case of Target = Source. The specific calculation process is the same, only the calculation object has changed.
[0200] (4) Natural language processing (NLP)
[0201] Natural language refers to human language, and natural language processing (NLP) is the processing of human language. Natural language processing is the process of systematically analyzing, understanding, and extracting information from text data in an intelligent and efficient manner. By using NLP and its components, we can manage very large amounts of text data, perform a large number of automated tasks, and solve a wide variety of problems, such as automatic summarization, machine translation (MT), named entity recognition (NER), relation extraction (RE), information extraction (IE), sentiment analysis, speech recognition, question answering, and topic segmentation.
[0202] (5) Backpropagation algorithm
[0203] Convolutional neural networks can use the back propagation (BP) algorithm to correct the size of the parameters in the initial super-resolution model during training, reducing the reconstruction error loss of the super-resolution model. Specifically, the forward propagation of the input signal to the output generates an error loss. This error loss information is then backpropagated to update the parameters of the initial super-resolution model, thereby converging the error loss. The BP algorithm is a backward propagation movement dominated by the error loss, aiming to obtain the optimal super-resolution model parameters, such as the weight matrix.
[0204] (6) Loss function
[0205] During the training of a deep neural network, because we want the output of the deep neural network to be as close as possible to the desired predicted value, we can compare the current network's predicted value with the desired target value and then update the weight vector of each layer of the neural network based on the difference between the two. (Of course, there is usually an initialization process before the first update, which is to pre-configure the parameters for each layer in the deep neural network.) For example, if the network's predicted value is too high, the weight vector is adjusted to make it predict a lower value. This adjustment is continued until the deep neural network can predict the desired target value or a value very close to the desired target value. Therefore, it is necessary to predefine "how to compare the difference between the predicted value and the target value." This is the loss function (or objective function), which is an important equation used to measure the difference between the predicted value and the target value. For example, the loss function output value (loss) indicates a greater difference, so training a deep neural network becomes a process of minimizing this loss as much as possible.
[0206] (7) Encoder / Decoder
[0207] Encoders and decoders typically work in pairs. For example, a sequence-to-sequence model consists of at least one encoder and at least one decoder. At its core, the encoder encodes the raw input data into intermediate features, while the decoder decodes these intermediate features into the target output.
[0208] (8) Multilayer Perceptron (MLP): A feed-forward artificial neural network that maps a set of input vectors to a set of output vectors. The MLP can be viewed as a directed graph consisting of multiple layers of nodes, each fully connected to the next layer. Except for the input nodes, each node is a neuron (or processing unit) with a nonlinear activation function.
[0209] By combining big data with large models under pre-training conditions, the performance of image understanding tasks has been significantly improved, and the field has gradually shifted from image understanding to video understanding. Because video multimodal understanding technology based on image and text pre-training can fully utilize more pre-trained image and text knowledge, it has become the mainstream direction of video multimodal understanding.
[0210] Extensive data indicates that online video has surpassed traditional media like images and text to become the most mainstream internet medium. Multimodal video understanding technology can provide content understanding capabilities for short video services, including video tagging, classification, and retrieval, and has a wide range of application scenarios.
[0211] In the current implementation, temporal modeling (modeling based on the granularity of image blocks in image frames) is inserted at intervals inside the original visual branch (modeling based on the granularity of image frames) to achieve interactive spatiotemporal information understanding based on the granularity of image blocks in image frames. However, the above implementation destroys the visual branch structure of the original image-text pre-training model, resulting in a large amount of image-text pre-training information being lost. In addition, the pre-training model usually constructs comparative learning between the image and text as a whole. When it is directly used for fine-grained modeling (modeling based on the granularity of image blocks in image frames), there will be a problem of different degrees of fine-grainedness between text information and image information, resulting in poor processing accuracy of the network.
[0212] In order to solve the above problems, the present invention provides a data processing method. The data processing method of the present invention is described in detail below with reference to the accompanying drawings.
[0213] Refer to Figure 5, which is a flow chart of a data processing method provided in an embodiment of the present application. As shown in Figure 5, a data processing method provided in an embodiment of the present application may include steps 501 to 505, and these steps are described in detail below.
[0214] 501. Acquire a video and text, where the text includes multiple text units;
[0215] In a possible implementation, the video may be pre-stored locally in the terminal, or obtained by the terminal from the outside world (such as the Internet), or collected by the terminal in real time, for example, through a camera of the terminal.
[0216] In a possible implementation, the text may be text used to describe the video, or other text related to the executed task, such as text related to video positioning.
[0217] 502. Obtain a first feature representation of the video through an image encoder according to the video.
[0218] In a possible implementation, features may be extracted from the video using an image encoder to obtain a first feature representation.
[0219] In one possible implementation, the video may include multiple image frames. Based on the video, each image frame can be taken as a whole, and feature extraction and attention operation can be performed through the image encoder to obtain a first feature representation. The first feature representation includes a first sub-feature representation corresponding to each image frame.
[0220] In one possible implementation, the image encoder can input each image frame into the image encoder as a whole (that is, not divided into image blocks and input into the image encoder), wherein the image encoder can perform feature extraction and attention operations on each image frame, and the image encoder can focus on attention interactions in the spatial dimension.
[0221] From the perspective of network structure, the image encoder may include multiple first network layers and multiple second network layers. When processing multiple image frames, the image encoder may perform feature extraction and attention operations in the spatial dimension within the image frame through the multiple first network layers, and perform feature extraction and attention operations in the temporal dimension between image frames through the multiple second network layers. In a possible implementation, the multiple first network layers may be connected before the multiple second network layers, or the number of the first network layers may be greater than the second network layers. By designing the connection order or the number of network layers, the image encoder may focus on attention interactions in the spatial dimension. For example, reference may be made to FIG6 , in which the spatial trans of the left branch of the video branch may include multiple first network layers, and the temporal trans of the left branch of the video branch may include multiple second network layers.
[0222] In other words, frame features can be extracted and input into the frame-level temporal modeling module to obtain the overall video features. This branch does not destroy the pre-trained information of images and texts, but because only simple frame-level information is used in temporal modeling, it lacks fine-grained understanding capabilities.
[0223] In one possible implementation, the video includes multiple image frames. Based on the video, each image block in each image frame can be taken as a whole, and feature extraction and attention operation can be performed by the image encoder to obtain a second feature representation. The second feature representation includes a second sub-feature representation corresponding to each image block.
[0224] In one possible implementation, the image encoder can input the image blocks in each image frame as a whole (that is, the image frame is divided into image blocks and input into the image encoder), wherein the image encoder can perform feature extraction and attention operations on each image block, and the image encoder can focus on attention interactions in the temporal dimension.
[0225] From the perspective of network structure, the image encoder may include multiple third network layers and multiple fourth network layers. When processing multiple image frames, the image encoder may perform feature extraction and attention operations on the temporal dimension between image frames through the multiple third network layers, and perform feature extraction and attention operations on the spatial dimension within the image frame through the multiple second network layers. In a possible implementation, the multiple third network layers are connected before the multiple fourth network layers, or the number of the third network layers is greater than the fourth network layers. By designing the connection order or the number of network layers, the image encoder can focus on attention interaction on the temporal dimension. For example, reference may be made to Figure 6, in which the temporal trans of the right branch of the video branch may include multiple third network layers, and the spatial trans of the right branch of the video branch may include multiple fourth network layers.
[0226] That is to say, the frame patch features can be extracted through the image encoder and input into the patch-level temporal modeling module to obtain fine-grained video features.
[0227] Intervals within the original visual branch insert temporal modeling to achieve interactive patch-level spatiotemporal information understanding, but this destroys the visual branch structure of the original image-text pre-training model, resulting in a large amount of image-text pre-training information loss. In the embodiment of the present application, interactive spatiotemporal information at the image patch level can be achieved without destroying the visual branch structure of the original image-text pre-training model.
[0228] In one possible implementation, the image encoder may include a first encoder and a second encoder; the first encoder includes a first intermediate layer, and the second encoder includes a second intermediate layer; the first intermediate layer may be a network layer in the first encoder, and the second intermediate layer may be a network layer in the second encoder, for example, a transformer layer.
[0229] For the first encoder, the first encoder can perform feature extraction and attention operation on each image frame, and the first encoder can focus on attention interaction in the spatial dimension.
[0230] For the second encoder, the second encoder can perform feature extraction and attention operations on each image block, and the second encoder can focus on attention interaction in the temporal dimension.
[0231] In one possible implementation, the first encoder includes multiple first network layers and multiple second network layers, and the first intermediate layer belongs to the multiple first network layers or the multiple second network layers. Feature extraction and attention operations in the spatial dimension can be performed within the image frame through the multiple first network layers, and feature extraction and attention operations in the temporal dimension can be performed between image frames through the multiple second network layers; wherein the multiple first network layers are connected before the multiple second network layers, or the number of the first network layers is greater than the number of the second network layers.
[0232] In one possible implementation, the second encoder includes multiple third network layers and multiple fourth network layers, and the second intermediate layer belongs to the multiple third network layers or the multiple fourth network layers. Feature extraction and attention operations in the temporal dimension between image frames can be performed through the multiple third network layers, and feature extraction and attention operations in the spatial dimension within the image frame can be performed through the multiple second network layers; wherein the multiple third network layers are connected before the multiple fourth network layers, or the number of the third network layers is greater than the fourth network layers.
[0233] In a possible implementation, the first intermediate layer belongs to the multiple first network layers, and the second intermediate layer belongs to the multiple third network layers.
[0234] In a possible implementation, the first intermediate layer belongs to the multiple second network layers, and the second intermediate layer belongs to the multiple fourth network layers.
[0235] Among them, the first network layer can be all network layers in the first encoder used to perform attention operations in the spatial dimension within the image frame, and the second network layer is all network layers in the first encoder used to perform attention operations in the temporal dimension between image frames.
[0236] Among them, the third network layer can be all network layers in the second encoder used to perform attention operations in the temporal dimension between image frames, and the fourth network layer is all network layers in the second encoder used to perform attention operations in the spatial dimension within the image frame.
[0237] In one possible implementation, based on the video, the first encoder may be used to perform feature extraction and attention operations on each image frame as a whole to obtain a first feature representation, wherein the first feature representation includes a first sub-feature representation corresponding to each image frame. Based on the video and the output of the first intermediate layer, the second encoder may be used to perform feature extraction and attention operations on each image block in each image frame as a whole to obtain a second feature representation, wherein the second feature representation includes a second sub-feature representation corresponding to each image block.
[0238] The output of the first intermediate layer may be fused to the output or input of the second intermediate layer.
[0239] The output of the first intermediate layer can be features obtained based on spatial modeling, and the features obtained by spatial modeling are integrated into the second intermediate layer for temporal modeling, thereby realizing the integration of temporal modeling and spatial modeling. The visual branch structure of the original image-text pre-training model (that is, the structure of the first encoder) is not changed, but only the structure of the second encoder is changed, thereby improving the processing accuracy of the model.
[0240] In one possible implementation, the output of the first intermediate layer can be resized (reshaped), and the output of the adjusted first intermediate layer is consistent with the input or output size of the second intermediate layer, and the output of the adjusted first intermediate layer and the input or output of the second intermediate layer are added at corresponding positions.
[0241] In one possible implementation, the position of the first intermediate layer in the first encoder matches the position of the second intermediate layer in the first encoder. For example, the number of network layers included in the first encoder and the number of network layers included in the second encoder may be the same as the position of the second intermediate layer in the first encoder.
[0242] It should be understood that the first intermediate layer can be a network layer of the first encoder, the second intermediate layer can be a network layer of the second encoder, and the output of each network layer in the multiple network layers of the first encoder can be fused into the corresponding network layer in the second encoder.
[0243] Taking Figure 6 as an example, the video processing part can be called parallel isotropic visual attention: a visual dual-tower attention mechanism is constructed, one of which is the Frame-Level attention branch (ST Frame Branch) and the other is the Patch-Level attention branch (TS Patch Branch), and the temporal and spatial attention order of the two is opposite (one branch first performs attention interaction in the spatial dimension and then in the temporal dimension, and the other branch first performs attention interaction in the temporal dimension and then in the spatial dimension); the ST Frame Branch transfers the video features of each layer to the corresponding layer of the TS Patch Branch through the permute of the feature dimension for summation; forming an effective Frame-level (global information) and patch-level (fine-grained information) spatiotemporal information fusion.
[0244] The present application embodiment proposes a method for migrating an image-text pre-training model to video multimodal understanding: a temporal understanding module is established in parallel with the visual branch of the image-text pre-training model to perform temporal modeling without destroying the visual branch structure of the original image-text pre-training model;
[0245] 503. According to the text, obtain a second feature representation of each text unit and a third feature representation corresponding to the text through a text encoder; the third feature representation is obtained by extracting features from the text as a whole through the text encoder.
[0246] It should be understood that the image encoder and text encoder in the embodiments of the present application may include an encoder-decoder.
[0247] In one possible implementation, the encoder can be one of the following models: LSTM, GRU, SRU, BERT, Roberta, SpanBERT, XLNET, GPT, Nezha, Mass, BART, MBart, Albert, StructBERT, Ernie, KnowBERT, K-BERT, TinyBERT.
[0248] In one possible implementation, the encoder can be understood as a deep learning network model. There are multiple network structures of the encoder, which are not specifically limited in the embodiments of the present application; specifically, the network structure of the encoder can adopt the network structure of the encoder part of the Transformer network, or adopt the network structure of a series of other networks obtained from the encoder part of the Transformer network.
[0249] 504. Fuse the third feature representation with each second feature representation to obtain multiple fourth feature representations.
[0250] In a possible implementation, a second feature representation of each text unit (that is, a token of each text unit) can be obtained based on the text through a text encoder.
[0251] In a possible implementation, the text may be English text, the text unit may be one word or multiple words, or the text may be Chinese text, the text unit may be a character unit or a word unit.
[0252] In a possible implementation, a third feature representation corresponding to the text can be obtained based on the text through a text encoder, and the third feature representation is obtained by extracting features from the text as a whole through the text encoder.
[0253] In one possible implementation, the third feature representation and each second feature representation can be fused through an MLP network to obtain multiple fourth feature representations (for example, each third feature representation can be obtained by fusing the third feature representations to obtain a corresponding fourth feature representation).
[0254] In the prior art, when performing contrastive learning, the feature representation of the text branch only includes the feature representation obtained by extracting features based on the text as a whole. However, when processing videos, it includes a branch that processes with image blocks as the granularity, which is equivalent to the different processing granularities on the image side and the text side. In the embodiment of the present application, on the one hand, the feature representation of each text unit is obtained in the text processing branch, which is lower than the processing granularity of the text processing branch in the prior art and can be closer to the processing branch of the image processing branch, thereby improving the processing accuracy of the network. In addition, the feature representation of each text unit is obtained based on the text unit itself and the nearby contextual information, which can only reflect local information. In the embodiment of the present application, the third feature representation obtained by extracting features based on the text encoder based on the text as a whole is fused into the feature representation corresponding to each text unit, so that the feature representation corresponding to each text unit also includes global text information, thereby improving the processing accuracy of the network.
[0255] Referring to Figure 6, this application proposes a dynamic text routing mechanism. Based on the image-text pre-trained model, this mechanism diverts text features into two branches: spatially relevant abstract descriptions are diverted to the ST Frame Branch, and temporally relevant fine-grained descriptions are diverted to the TS Patch Branch. This achieves fine-grained visual-text alignment. Adding a dynamic text routing mechanism after the text branch effectively fine-grains text information.
[0256] 505. Update the image encoder and the text encoder by performing comparative learning between the first feature representation and the plurality of fourth feature representations. Comparative learning can narrow the distance between image features and text features that are similar in semantics (or other dimensions of information).
[0257] In a possible implementation, comparative learning may be performed between the first feature representation and the plurality of fourth feature representations, and between the first feature representation and the third feature representation.
[0258] Refer to Figure 7, which is a schematic diagram of a process architecture provided in an embodiment of the present application.
[0259] Referring to Figure 8, Figure 8 shows the system architecture and application scenarios of the embodiment of the present application. This solution can be used as a general solution for efficiently migrating image-text pre-training to video multimodal understanding for various video understanding tasks, such as: multimodal video retrieval, classification, positioning, generation (such as video question answering, video title generation, video generation), etc.
[0260] Compared to the baseline model, the embodiments of the present application can significantly enhance verb or fine-grained understanding capabilities, such as correctly associating fine-grained verbs "extinguishes" and "wrestling" to the correct video frames. Referring to Figure 9, Figure 9 shows a visualization of multimodal attention.
[0261] Refer to Table 1, which shows the processing effect on the MSR-VTT public dataset, Table 2 shows the processing effect on the LMSDC public dataset, Table 3 shows the processing effect on the ActivityNet public dataset, and Table 4 shows the processing effect on the DiDeMo public dataset.
[0262] Table 1
[0263] Table 2
[0264] Table 3
[0265] Table 4
[0266] In addition, an embodiment of the present application also provides a data processing method, which includes: obtaining a video and a text, wherein the text includes multiple text units; based on the video, obtaining a first feature representation of the video through an image encoder; based on the text, obtaining a second feature representation of each text unit and a third feature representation corresponding to the text through a text encoder; the third feature representation is obtained by extracting features from the text as a whole through the text encoder; the third feature representation is fused with each second feature representation to obtain multiple fourth feature representations; based on the first feature representation and the multiple fourth feature representations, obtaining a task processing result through a task network.
[0267] In one possible implementation, the task network is used to implement at least one of the following tasks: a video retrieval task, a video classification task, a video positioning task, and a video generation task (such as video question answering and video title generation).
[0268] In addition, an embodiment of the present application also provides a data processing method, which includes: obtaining a video and a text, wherein the text includes multiple text units; based on the video, obtaining a first feature representation of the video through an image encoder; based on the text, obtaining a second feature representation of each text unit and a third feature representation corresponding to the text through a text encoder; the third feature representation is obtained by extracting features from the text as a whole through the text encoder; the third feature representation is fused with each second feature representation to obtain multiple fourth feature representations; based on the first feature representation and the multiple fourth feature representations, obtaining a task processing result through a task network; and based on the task processing result, updating the image encoder, the text encoder and the task network.
[0269] In one possible implementation, the task network is used to implement at least one of the following tasks: a video retrieval task, a video classification task, a video positioning task, and a video generation task (such as video question answering and video title generation).
[0270] 10 , which is a schematic diagram of the structure of a data processing device provided in an embodiment of the present application. As shown in FIG10 , a data processing device provided in an embodiment of the present application, the device 1000 includes:
[0271] An acquisition module 1001 is configured to acquire a video and text, wherein the text includes a plurality of text units;
[0272] For a detailed description of the acquisition module 1001 , reference may be made to the description of step 501 in the above embodiment, which will not be repeated here.
[0273] A processing module 1002 is configured to obtain a first feature representation of the video through an image encoder according to the video;
[0274] According to the text, a text encoder is used to obtain a second feature representation of each text unit and a third feature representation corresponding to the text; the third feature representation is obtained by extracting features from the text as a whole through the text encoder;
[0275] fusing the third feature representation with each second feature representation to obtain a plurality of fourth feature representations;
[0276] The image encoder and the text encoder are updated by performing comparative learning between the first feature representation and the plurality of fourth feature representations.
[0277] For a detailed description of the processing module 1002 , reference may be made to the description of steps 502 to 505 in the above embodiment, which will not be repeated here.
[0278] In a possible implementation, the processing module is specifically configured to:
[0279] According to the video, taking each of the image frames as a whole, feature extraction and attention operation are performed through the image encoder to obtain a first feature representation, where the first feature representation includes a first sub-feature representation corresponding to each image frame.
[0280] In a possible implementation, the processing module is specifically configured to:
[0281] According to the video, each image block in each image frame is taken as a whole, and feature extraction and attention operation are performed through the image encoder to obtain a second feature representation, where the second feature representation includes a second sub-feature representation corresponding to each image block.
[0282] In one possible implementation, the image encoder includes a first encoder and a second encoder; the first encoder includes a first intermediate layer, and the second encoder includes a second intermediate layer;
[0283] The processing module is specifically used to:
[0284] According to the video, taking each of the image frames as a whole, performing feature extraction and attention operation by the first encoder to obtain a first feature representation, where the first feature representation includes a first sub-feature representation corresponding to each image frame;
[0285] According to the output of the video and the first intermediate layer, each image block in each image frame is taken as a whole, and feature extraction and attention operation are performed by the second encoder to obtain a second feature representation, where the second feature representation includes a second sub-feature representation corresponding to each image block; wherein the output of the first intermediate layer is fused to the output or input of the second intermediate layer.
[0286] In a possible implementation, the first encoder includes multiple first network layers and multiple second network layers, the first intermediate layer belongs to the multiple first network layers or the multiple second network layers, and the processing module is specifically configured to:
[0287] Through the multiple first network layers, feature extraction and attention operation on the spatial dimension are performed within the image frame, and through the multiple second network layers, feature extraction and attention operation on the temporal dimension are performed between image frames; wherein,
[0288] The multiple first network layers are connected before the multiple second network layers, or the number of the first network layers is greater than the number of the second network layers.
[0289] In a possible implementation, the second encoder includes multiple third network layers and multiple fourth network layers, the second intermediate layer belongs to the multiple third network layers or the multiple fourth network layers, and the processing module is specifically configured to:
[0290] The plurality of third network layers are used to perform feature extraction and attention operations on the temporal dimension between image frames, and the plurality of second network layers are used to perform feature extraction and attention operations on the spatial dimension within image frames; wherein,
[0291] The plurality of third network layers are connected before the plurality of fourth network layers, or the number of the third network layers is greater than the number of the fourth network layers.
[0292] In a possible implementation, the first intermediate layer belongs to the multiple first network layers, and the second intermediate layer belongs to the multiple third network layers.
[0293] In a possible implementation, the processing module is specifically configured to:
[0294] The output of the first intermediate layer is resized so that the output of the adjusted first intermediate layer is consistent with the input or output size of the second intermediate layer, and a sum operation is performed on the output of the adjusted first intermediate layer and the input or output of the second intermediate layer at corresponding positions.
[0295] In a possible implementation, a position of the first intermediate layer in the first encoder matches a position of the second intermediate layer in the first encoder.
[0296] In a possible implementation, the processing module is specifically configured to:
[0297] By performing comparative learning between the first feature representation and the plurality of fourth feature representations, and by performing comparative learning between the first feature representation and the third feature representation.
[0298] In addition, an embodiment of the present application further provides a data processing device, the device comprising:
[0299] An acquisition module, configured to acquire a video and text, wherein the text includes a plurality of text units;
[0300] a processing module, configured to obtain, based on the video, a first feature representation of the video through an image encoder;
[0301] According to the text, a text encoder is used to obtain a second feature representation of each text unit and a third feature representation corresponding to the text; the third feature representation is obtained by extracting features from the text as a whole through the text encoder;
[0302] fusing the third feature representation with each second feature representation to obtain a plurality of fourth feature representations;
[0303] A task processing result is obtained through a task network according to the first feature representation and the plurality of fourth feature representations.
[0304] In one possible implementation, the task network is used to implement at least one of the following tasks: a video retrieval task, a video classification task, a video positioning task, and a video generation task (such as video question answering and video title generation).
[0305] In addition, an embodiment of the present application further provides a data processing device, the device comprising:
[0306] An acquisition module, configured to acquire a video and text, wherein the text includes a plurality of text units;
[0307] a processing module, configured to obtain, based on the video, a first feature representation of the video through an image encoder;
[0308] According to the text, a text encoder is used to obtain a second feature representation of each text unit and a third feature representation corresponding to the text; the third feature representation is obtained by extracting features from the text as a whole through the text encoder;
[0309] fusing the third feature representation with each second feature representation to obtain a plurality of fourth feature representations;
[0310] Obtaining a task processing result through a task network according to the first feature representation and the plurality of fourth feature representations;
[0311] The image encoder, the text encoder and the task network are updated according to the task processing result.
[0312] In one possible implementation, the task network is used to implement at least one of the following tasks: a video retrieval task, a video classification task, a video positioning task, and a video generation task (such as video question answering and video title generation).
[0313] Next, an execution device provided in an embodiment of the present application is introduced. Please refer to Figure 11. Figure 11 is a structural diagram of an execution device provided in an embodiment of the present application. The execution device 1100 can be specifically manifested as a virtual reality VR device, a mobile phone, a tablet, a laptop computer, a smart wearable device, a monitoring data processing device or a server, etc., which is not limited here. Specifically, the execution device 1100 includes: a receiver 1101, a transmitter 1102, a processor 1103 and a memory 1104 (wherein the number of processors 1103 in the execution device 1100 can be one or more, and Figure 11 takes one processor as an example), wherein the processor 1103 may include an application processor 11031 and a communication processor 11032. In some embodiments of the present application, the receiver 1101, the transmitter 1102, the processor 1103 and the memory 1104 may be connected via a bus or other means.
[0314] The memory 1104 may include a read-only memory and a random access memory, and provides instructions and data to the processor 1103. A portion of the memory 1104 may also include non-volatile random access memory (NVRAM). The memory 1104 stores processor and operation instructions, executable modules, or data structures, or subsets or extended sets thereof. The operation instructions may include various operation instructions for implementing various operations.
[0315] Processor 1103 controls the operation of the execution device. In specific applications, the various components of the execution device are coupled together via a bus system. In addition to a data bus, the bus system may also include a power bus, a control bus, and a status signal bus. However, for clarity, all of these buses are referred to as a bus system in the figure.
[0316] The methods disclosed in the above embodiments of the present application can be applied to or implemented by processor 1103. Processor 1103 can be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits or software instructions in processor 1103. The above processor 1103 can be a general-purpose processor, a digital signal processor (DSP), a microprocessor, or a microcontroller, and can further include an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The processor 1103 can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in conjunction with the embodiments of the present application can be directly implemented as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium well-known in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 1104. Processor 1103 reads information from memory 1104 and, in conjunction with its hardware, completes the steps involved in the model inference process in the above method.
[0317] Receiver 1101 can be used to receive input digital or character information and generate signal input related to executing device-related settings and function control. Transmitter 1102 can be used to output digital or character information through the first interface. Transmitter 1102 can also be used to send instructions to the disk pack through the first interface to modify data in the disk pack. Transmitter 1102 can also include a display device such as a display screen.
[0318] The present application also provides a training device. Please refer to FIG. 12 , which is a schematic diagram of the structure of a training device provided by an embodiment of the present application. Specifically, the training device 1200 is implemented by one or more servers. The training device 1200 may vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 1212 (e.g., one or more processors), a memory 1232, and one or more storage media 1230 (e.g., one or more mass storage devices) storing application programs 1242 or data 1244. The memory 1232 and storage medium 1230 may be either ephemeral or persistent storage. The program stored in the storage medium 1230 may include one or more modules (not shown), each of which may include a series of instruction operations on the training device. Furthermore, the CPU 1212 may be configured to communicate with the storage medium 1230 to execute the series of instruction operations in the storage medium 1230 on the training device 1200.
[0319] The training device 1200 may also include one or more power supplies 1226, one or more wired or wireless network interfaces 1250, one or more input and output interfaces 1258; or, one or more operating systems 1241, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0320] In the embodiment of the present application, the central processing unit 1212 is used to execute actions related to model training in the above embodiment.
[0321] An embodiment of the present application also provides a computer program product, which, when running on a computer, enables the computer to execute the steps executed by the aforementioned execution device, or enables the computer to execute the steps executed by the aforementioned training device.
[0322] A computer-readable storage medium is also provided in an embodiment of the present application, which stores a program for signal processing. When the computer-readable storage medium is run on a computer, it enables the computer to execute the steps executed by the aforementioned execution device, or enables the computer to execute the steps executed by the aforementioned training device.
[0323] The execution device, training device or terminal device provided in the embodiments of the present application can specifically be a chip, and the chip includes: a processing unit and a communication unit, the processing unit can be, for example, a processor, and the communication unit can be, for example, an input / output interface, a pin or a circuit, etc. The processing unit can execute the computer execution instructions stored in the storage unit, so that the chip in the execution device executes the data processing method described in the above embodiment, or so that the chip in the training device executes the data processing method described in the above embodiment. Optionally, the storage unit is a storage unit in the chip, such as a register, a cache, etc. The storage unit can also be a storage unit located outside the chip in the wireless access device, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM), etc.
[0324] Specifically, see Figure 13 , which is a schematic diagram of the structure of a chip provided in an embodiment of the present application. The chip may be a neural network processor (NPU) 1300. NPU 1300 is mounted on a host CPU (host CPU) as a coprocessor, with tasks assigned by the host CPU. The core of the NPU is arithmetic circuit 1303, which is controlled by controller 1304 to extract matrix data from memory and perform multiplication operations.
[0325] In some implementations, the arithmetic circuit 1303 includes multiple processing units (PEs). In some implementations, the arithmetic circuit 1303 is a two-dimensional systolic array. The arithmetic circuit 1303 can also be a one-dimensional systolic array or other electronic circuitry capable of performing mathematical operations such as multiplication and addition. In some implementations, the arithmetic circuit 1303 is a general-purpose matrix processor.
[0326] For example, assume there are input matrix A, weight matrix B, and output matrix C. The computation circuit retrieves the corresponding data of matrix B from weight memory 1302 and caches it on each PE in the computation circuit. The computation circuit then retrieves the data of matrix A from input memory 1301 and performs a matrix operation on it with matrix B. The partial or final matrix result is stored in accumulator 1308.
[0327] Unified memory 1306 is used to store input and output data. Weight data is directly transferred to weight memory 1302 through the Direct Memory Access Controller (DMAC) 1305. Input data is also transferred to unified memory 1306 through the DMAC.
[0328] BIU stands for Bus Interface Unit 1310 , which is used for interaction between the AXI bus, DMAC, and instruction fetch buffer (IFB) 1309 .
[0329] The bus interface unit 1310 (BIU) is used for the instruction fetch memory 1309 to obtain instructions from the external memory, and is also used for the storage unit access controller 1305 to obtain the original data of the input matrix A or the weight matrix B from the external memory.
[0330] DMAC is mainly used to move input data in the external memory DDR to the unified memory 1306 or to move weight data to the weight memory 1302 or to move input data to the input memory 1301.
[0331] The vector calculation unit 1307 includes multiple operation processing units. When necessary, it further processes the output of the operation circuit 1303, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc. It is mainly used for non-convolutional / fully connected layer network calculations in neural networks, such as batch normalization, pixel-level summation, and upsampling of feature planes.
[0332] In some implementations, the vector calculation unit 1307 can store the processed output vector in the unified memory 1306. For example, the vector calculation unit 1307 can apply a linear function or a nonlinear function to the output of the operation circuit 1303, such as linear interpolation of the feature plane extracted by the convolution layer, or accumulate a vector of values to generate an activation value. In some implementations, the vector calculation unit 1307 generates a normalized value, a pixel-level summed value, or both. In some implementations, the processed output vector can be used as an activation input to the operation circuit 1303, for example, for use in subsequent layers in a neural network.
[0333] An instruction fetch buffer 1309 connected to the controller 1304 is used to store instructions used by the controller 1304;
[0334] Unified memory 1306, input memory 1301, weight memory 1302, and instruction fetch memory 1309 are all on-chip memories. External memories are private to the NPU hardware architecture.
[0335] The processor mentioned in any of the above places can be a general-purpose central processing unit, a microprocessor, an ASIC, or one or more integrated circuits for controlling the execution of the above program.
[0336] It should also be noted that the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed across multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. In addition, in the drawings of the device embodiments provided in this application, the connection relationship between the modules indicates that there is a communication connection between them, which can be specifically implemented as one or more communication buses or signal lines.
[0337] Through the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course can also be implemented by special hardware including application-specific integrated circuits, special CPUs, special memories, special components, etc. In general, all functions performed by computer programs can be easily implemented with corresponding hardware, and the specific hardware structures used to implement the same function can also be diverse, such as analog circuits, digital circuits or special circuits, etc. However, for the present application, software program implementation is a better implementation method in most cases. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer's floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk or optical disk, etc., and includes a number of instructions to enable a computer device (which can be a personal computer, training equipment, or network equipment, etc.) to execute the methods described in each embodiment of the present application.
[0338] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0339] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, a computer, a training device or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website, a computer, a training device or a data center. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).
Claims
1. A data processing method, characterized in that: The method comprises: Acquire a video and a text, wherein the text includes a plurality of text units; According to the video, obtaining a first feature representation of the video through an image encoder; According to the text, a second feature representation of each text unit and a third feature representation corresponding to the text are obtained by using a text encoder; the third feature representation is obtained by extracting features from the text as a whole by using the text encoder; fusing the third feature representation with each second feature representation to obtain a plurality of fourth feature representations; The image encoder and the text encoder are updated by performing comparative learning between the first feature representation and the multiple fourth feature representations; or, a task processing result is obtained through a task network based on the first feature representation and the multiple fourth feature representations.
2. The method according to claim 1, characterized in that The video includes a plurality of image frames, and obtaining a first feature representation of the video through an image encoder according to the video includes: According to the video, taking each of the image frames as a whole, feature extraction and attention operation are performed through the image encoder to obtain a first feature representation, wherein the first feature representation includes a first sub-feature representation corresponding to each image frame.
3. The method according to claim 1, characterized in that The video includes a plurality of image frames, and obtaining a first feature representation of the video through an image encoder according to the video includes: According to the video, each image block in each image frame is taken as a whole, and feature extraction and attention operation are performed through the image encoder to obtain a second feature representation, wherein the second feature representation includes a second sub-feature representation corresponding to each image block.
4. The method according to any one of claims 1 to 3, characterized in that: The image encoder comprises a first encoder and a second encoder; the first encoder comprises a first intermediate layer, and the second encoder comprises a second intermediate layer; The step of obtaining, according to the video, a first feature representation of the plurality of image frames through an image encoder comprises: According to the video, taking each of the image frames as a whole, performing feature extraction and attention operation through the first encoder to obtain a first feature representation, wherein the first feature representation includes a first sub-feature representation corresponding to each image frame; According to the output of the video and the first intermediate layer, each image block in each of the image frames is taken as a whole, and feature extraction and attention operation are performed by the second encoder to obtain a second feature representation, wherein the second feature representation includes a second sub-feature representation corresponding to each image block; wherein the output of the first intermediate layer is fused to the output or input of the second intermediate layer.
5. The method according to claim 4, characterized in that The first encoder includes a plurality of first network layers and a plurality of second network layers, the first intermediate layer belongs to the plurality of first network layers or the plurality of second network layers, and the feature extraction and attention operation performed by the first encoder include: Through the multiple first network layers, feature extraction and attention operation on the spatial dimension are performed within the image frame, and through the multiple second network layers, feature extraction and attention operation on the temporal dimension are performed between image frames; wherein, The multiple first network layers are connected before the multiple second network layers, or the number of the first network layers is greater than the number of the second network layers.
6. The method according to claim 4 or 5, characterized in that: The second encoder includes multiple third network layers and multiple fourth network layers, the second intermediate layer belongs to the multiple third network layers or the multiple fourth network layers, and the feature extraction and attention operation performed by the second encoder include: Through the multiple third network layers, feature extraction and attention operation on the temporal dimension are performed between image frames, and through the multiple second network layers, feature extraction and attention operation on the spatial dimension are performed within the image frame; wherein, The plurality of third network layers are connected before the plurality of fourth network layers, or the number of the third network layers is greater than the number of the fourth network layers.
7. The method according to claim 6, characterized in that The first intermediate layer belongs to the multiple first network layers, and the second intermediate layer belongs to the multiple third network layers.
8. The method according to any one of claims 4 to 7, characterized in that: The output of the first intermediate layer is fused to the output or input of the second intermediate layer, including: The output of the first intermediate layer is resized so that the size of the output of the adjusted first intermediate layer is consistent with the input or output size of the second intermediate layer, and a sum operation is performed on the output of the adjusted first intermediate layer and the input or output of the second intermediate layer at corresponding positions.
9. The method according to any one of claims 4 to 8, characterized in that: The position of the first intermediate layer in the first encoder matches the position of the second intermediate layer in the first encoder.
10. The method according to any one of claims 1 to 9, characterized in that: The performing comparative learning on the first feature representation and the plurality of fourth feature representations includes: By performing comparative learning between the first feature representation and the plurality of fourth feature representations, and by performing comparative learning between the first feature representation and the third feature representation.
11. A data processing device, characterized in that: The device comprises: An acquisition module, used for acquiring a video and a text, wherein the text includes a plurality of text units; A processing module, configured to obtain a first feature representation of the video through an image encoder according to the video; According to the text, a second feature representation of each text unit and a third feature representation corresponding to the text are obtained by using a text encoder; the third feature representation is obtained by extracting features from the text as a whole by using the text encoder; fusing the third feature representation with each second feature representation to obtain a plurality of fourth feature representations; The image encoder and the text encoder are updated by performing comparative learning between the first feature representation and the multiple fourth feature representations; or, a task processing result is obtained through a task network based on the first feature representation and the multiple fourth feature representations.
12. The device according to claim 11, characterized in that The processing module is specifically used for: According to the video, taking each of the image frames as a whole, feature extraction and attention operation are performed through the image encoder to obtain a first feature representation, wherein the first feature representation includes a first sub-feature representation corresponding to each image frame.
13. The device according to claim 11, characterized in that The processing module is specifically used for: According to the video, each image block in each image frame is taken as a whole, and feature extraction and attention operation are performed through the image encoder to obtain a second feature representation, wherein the second feature representation includes a second sub-feature representation corresponding to each image block.
14. The device according to any one of claims 11 to 13, characterized in that: The image encoder comprises a first encoder and a second encoder; the first encoder comprises a first intermediate layer, and the second encoder comprises a second intermediate layer; The processing module is specifically used for: According to the video, taking each of the image frames as a whole, performing feature extraction and attention operation through the first encoder to obtain a first feature representation, wherein the first feature representation includes a first sub-feature representation corresponding to each image frame; According to the output of the video and the first intermediate layer, each image block in each of the image frames is taken as a whole, and feature extraction and attention operation are performed by the second encoder to obtain a second feature representation, wherein the second feature representation includes a second sub-feature representation corresponding to each image block; wherein the output of the first intermediate layer is fused to the output or input of the second intermediate layer.
15. The device according to claim 14, characterized in that The first encoder includes multiple first network layers and multiple second network layers, the first intermediate layer belongs to the multiple first network layers or the multiple second network layers, and the processing module is specifically used to: Through the multiple first network layers, feature extraction and attention operation on the spatial dimension are performed within the image frame, and through the multiple second network layers, feature extraction and attention operation on the temporal dimension are performed between image frames; wherein, The multiple first network layers are connected before the multiple second network layers, or the number of the first network layers is greater than the number of the second network layers.
16. The device according to claim 14 or 15, characterized in that The second encoder includes multiple third network layers and multiple fourth network layers, the second intermediate layer belongs to the multiple third network layers or the multiple fourth network layers, and the processing module is specifically used to: Through the multiple third network layers, feature extraction and attention operation on the temporal dimension are performed between image frames, and through the multiple second network layers, feature extraction and attention operation on the spatial dimension are performed within the image frame; wherein, The plurality of third network layers are connected before the plurality of fourth network layers, or the number of the third network layers is greater than the number of the fourth network layers.
17. The device according to any one of claims 11 to 16, characterized in that The first intermediate layer belongs to the multiple first network layers, and the second intermediate layer belongs to the multiple third network layers.
18. The device according to any one of claims 11 to 17, characterized in that The processing module is specifically used for: The output of the first intermediate layer is resized so that the size of the output of the adjusted first intermediate layer is consistent with the input or output size of the second intermediate layer, and a sum operation is performed on the output of the adjusted first intermediate layer and the input or output of the second intermediate layer at corresponding positions.
19. The device according to any one of claims 14 to 18, characterized in that The position of the first intermediate layer in the first encoder matches the position of the second intermediate layer in the first encoder.
20. The device according to any one of claims 11 to 19, characterized in that The processing module is specifically used for: By performing comparative learning between the first feature representation and the plurality of fourth feature representations, and by performing comparative learning between the first feature representation and the third feature representation.
21. A computer storage medium, characterized in that The computer storage medium stores one or more instructions which, when executed by one or more computers, cause the one or more computers to perform the operations of the method of any one of claims 1 to 10.
22. A computer program product, characterized in that The method comprises computer-readable instructions, and when the computer-readable instructions are executed on a computer device, the computer device is caused to execute the method according to any one of claims 1 to 10.
23. A system comprising at least one processor and at least one memory; the processor and the memory are connected via a communication bus and communicate with each other; The at least one memory is used to store code; The at least one processor is configured to execute the code to perform the method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Data processing method, device and equipment, readable storage medium and program product
CN115114480A
Data processing method and device
CN115512005A
Data processing method and device
CN116542289A
Video encoder, video transmission apparatus, video encoding method, and video transmission method
JP2008005349A
Cited By
Text-guided creative and time consistency-oriented video coloring method and system
CN121309873A
