Method, apparatus, medium, and program product for processing multimodal data

The BERT model is used to fuse text and image features to generate multimodal fusion features, which solves the problem of needing to process image-containing dynamics and pure text dynamics separately in existing technologies, achieving resource conservation and efficiency improvement.

CN119272009BActive Publication Date: 2025-09-19SHANGHAI BILIBILI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411386418.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2025-09-19
Estimated Expiration
2044-09-29

AI Technical Summary

Technical Problem

Existing technologies require training two models separately when processing image-containing dynamics and pure text dynamics on social networking platforms, resulting in duplicate resource investment and increased labor costs.

Method used

The BERT model is used to perform word representation processing on text and image features, and multimodal fusion features are generated through feature fusion. A multimodal model is trained to process both plain text and dynamic images at the same time, and zero-filling technology is used to handle the situation where the number of images is insufficient.

Benefits of technology

This saves computing resources and the labor cost of model iteration and optimization, and enables one model to process different types of dynamic content at the same time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119272009B_ABST
    Figure CN119272009B_ABST
Patent Text Reader

Abstract

The present application provides a method, apparatus, electronic device, computer-readable medium and computer program product for processing multimodal data. The method of the present application includes: obtaining a text feature vector by performing word representation processing on the text content of the data to be processed; if the data to be processed contains a predetermined number of pictures, obtaining a picture feature vector by extracting the picture features of each picture and mapping the picture features to the text feature space; if the number of pictures in the data to be processed is less than the predetermined number, then after mapping the picture features to the text feature space, the mapping result is zero-filled according to the preset input sequence length; the multimodal fusion features obtained by feature fusion of the text feature vector and the picture feature vector are used as the input of the multimodal model; the multimodal model is trained to output the prediction result of the predetermined prediction task in the multimodal model based on the input multimodal fusion features. The present application realizes the use of one model to simultaneously process pure text data and data containing text and pictures, saving computing resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, apparatus, electronic device, computer-readable medium, and computer program product for processing multimodal data. Background Art

[0002] On existing social networking platforms, the status sharing feature has become a crucial tool for users to exchange information in real time. Users can post status updates containing both text and images, and enjoy interactive services such as forwarding, commenting, and liking. Status updates are primarily categorized into two types: status updates with images and status updates with text only. Status updates with images contain not only text but also a predefined number of images, while status updates with text only consist of text without any images.

[0003] Given the differences in content characteristics between posts containing images and posts containing only text, existing technologies typically use different models to process data with different characteristics when conducting machine-generated reviews of posts and other similar data. For example, when reviewing posts for violations, two different risk scoring models are used to identify violating content. One is a multimodal risk scoring model specifically designed to identify violations in posts containing images; the other is a text risk scoring model used to detect whether posts containing only text contain violations.

[0004] However, this separate model training approach has some significant drawbacks. Because different types of dynamic content need to be processed separately, two models with similar structures need to be trained and deployed, resulting in duplicated investment in machine review resources and a doubling of human resources and time costs in subsequent model iterations and deployments. Summary of the Invention

[0005] Various aspects of the present application provide a method, an apparatus, an electronic device, a computer-readable medium, and a computer program product for processing multimodal data.

[0006] In one aspect of the present application, a method for processing multimodal data is provided, wherein the method comprises:

[0007] The text content of the data to be processed is processed into word representation to obtain a text feature vector;

[0008] If the data to be processed contains a predetermined number of pictures, the picture features of each picture are extracted and mapped to the text feature space to obtain a picture feature vector. If the number of pictures in the data to be processed is less than the predetermined number, after mapping the picture features to the text feature space, the mapping result is zero-padded according to the preset input sequence length;

[0009] The multimodal fusion feature obtained by fusing the text feature vector and the image feature vector is used as the input of the multimodal model;

[0010] The multimodal model is trained to output a prediction result of a predetermined prediction task based on the input multimodal fusion features in the multimodal model.

[0011] In one aspect of the present application, a device for processing multimodal data is provided, wherein the device comprises:

[0012] A device for obtaining a text feature vector by performing word representation processing on the text content of the data to be processed;

[0013] A device for obtaining a picture feature vector by extracting picture features from each picture and mapping the picture features to a text feature space if the data to be processed contains a predetermined number of pictures; and for performing zero padding on the mapping results according to a preset input sequence length after mapping the picture features to the text feature space if the number of pictures in the data to be processed is less than the predetermined number;

[0014] A device for fusing the text feature vector and the image feature vector to obtain a multimodal fusion feature as an input to a multimodal model;

[0015] A device for training the multimodal model to output a prediction result of a predetermined prediction task based on the input multimodal fusion features in the multimodal model.

[0016] In another aspect of the present application, a computer-readable storage medium is provided, on which computer program instructions are stored. The computer program instructions can be executed by a processor to implement the method of the embodiment of the present application.

[0017] In another aspect of the present application, a computer program product is provided, including a computer program, which implements the method of the embodiment of the present application when executed by a processor.

[0018] In the solution provided in the embodiment of the present application, the text features and image features corresponding to the data to be processed are used as two input tokens of a BERT-based multimodal model, and the text features and image features are spliced ​​and fused in the multimodal model, and then the prediction results of the predetermined prediction task are output based on the fused features. This enables the use of one model to simultaneously process pure text data and data containing text and images. There is no need to train different models separately to process the two types of data as in the traditional way, which saves computing resources and the manpower cost of subsequent iterative optimization of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application, a brief introduction will be given below to the drawings required for use in the embodiments or descriptions of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0020] Other features, objects and advantages of the present application will become more apparent upon reading the detailed description of non-limiting embodiments made with reference to the following drawings:

[0021] Figure 1 A schematic diagram of a process for processing multimodal data provided by an embodiment of the present application is shown;

[0022] Figure 2 shows an exemplary model structure schematic diagram according to an embodiment of the present application;

[0023] Figure 3 A schematic diagram of the structure of a device for processing multimodal data provided by an embodiment of the present application is shown;

[0024] Figure 4 A structural diagram of a device suitable for implementing the solution in the embodiments of the present application is shown.

[0025] The same or similar reference numerals in the drawings represent the same or similar components. DETAILED DESCRIPTION

[0026] To make the purpose, technical solutions, and advantages of the embodiments of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0027] In a typical configuration of the present application, the terminal and the equipment of the service network each include one or more processors (CPUs), input / output interfaces, network interfaces and memories.

[0028] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.

[0029] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology for information storage. The information can be computer program instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc-read only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission medium that can be used to store information that can be accessed by a computing device.

[0030] Figure 1 A flow chart of a method for processing multimodal data provided in an embodiment of the present application is shown, wherein the method comprises at least step S101, step S102, step S103 and step S104.

[0031] In actual scenarios, the execution subject of this method can be a network device, or an application running on a network device. The network device includes but is not limited to a network host, a single network server, a set of multiple network servers, or a set of computers based on cloud computing, which can be used to implement some processing functions when setting an alarm. Here, the cloud is composed of a large number of hosts or network servers based on cloud computing (Cloud Computing). Cloud computing is a type of distributed computing, which is a virtual computer composed of a group of loosely coupled computers.

[0032] The concepts involved in the embodiments of this application are explained below.

[0033] BERT (Bidirectional Encoder Representations from Transformers) model: BERT is a bidirectional encoding representation method based on the Transformer unit, and the Transformer unit is an encoding unit based on the self-attention mechanism.

[0034] Token: The smallest unit in the text. In the BERT model, the text is first divided into tokens. These tokens can be words, phrases, or characters, depending on how the model is trained. The BERT model has a fixed vocabulary that contains all the tokens that the model can recognize. Each token is mapped to a vector space of fixed dimension, a process called word embedding. The BERT model uses word embedding to convert text information into a numerical form that the model can understand. Each token has a unique index in the vocabulary. The BERT model uses some special tokens to mark the beginning and end of sentences, such as [CLS] and [SEP]. [CLS] is usually used for aggregate representation of classification tasks, while [SEP] is used to separate sentences or paragraphs.

[0035] The multimodal model according to an embodiment of the present application is a BERT model. In some embodiments, the BERT model according to an embodiment of the present application learns the deep features of language through pre-training tasks (such as Masked Language Model (MLM) and Next Sentence Prediction (NSP). In the MLM task, the model needs to predict tokens that are randomly masked in the sentence. The pre-trained BERT model can be used for various downstream tasks, usually by fine-tuning it on a specific task.

[0036] In some embodiments, the multimodal model according to this embodiment is a risk score model used to predict risk violations for input data to be processed. The model can simultaneously identify both illegal data to be processed containing images and text and illegal data to be processed containing only text, eliminating the need to train separate multimodal risk score models and text risk score models to identify illegal data containing images and illegal data containing only text, as is traditionally done.

[0037] Reference Figure 1 In step S101, the text content of the data to be processed is processed by word representation to obtain a text feature vector.

[0038] The data to be processed includes various data that may contain text and images at the same time.

[0039] Optionally, the data to be processed is dynamic. Dynamics can be a social tool used by video websites to share real-time user information through a follow-up mechanism, providing services such as publishing dynamic content, displaying dynamics of followed users, forwarding dynamics, commenting on dynamics, and liking dynamics. Dynamics are mainly divided into two categories: dynamics with images and dynamics with only text. Dynamics with images refer to dynamics that contain text and a predetermined number of accompanying images; dynamics with only text refer to dynamics that contain only text without images.

[0040] Specifically, the BERT model's embedding layer performs token embedding on the text content to obtain the corresponding text feature vector. Token embedding maps each word or token in the vocabulary to a fixed-size vector.

[0041] In step S102, if the data to be processed contains a predetermined number of pictures, the picture feature vector is obtained by extracting the picture features of each picture and mapping the picture features to the text feature space. If the number of pictures in the data to be processed is less than the predetermined number, after mapping the picture features to the text feature space, the mapping result is zero-filled according to the preset input sequence length.

[0042] Specifically, step S102 includes step S1021, step S1022 and step S1023.

[0043] In step S1021 , it is determined whether the data to be processed includes a predetermined number of pictures.

[0044] Methods for determining whether the data to be processed contains images include, but are not limited to, content inspection, file format analysis, media type detection, encoding analysis, or visual recognition.

[0045] For example, for data to be processed in HTML format, by checking whether the HTML code contains Tags or image links tag to determine whether to include images.

[0046] In step S1022, if the data to be processed contains a predetermined number of pictures, the image features of each picture are extracted through the pre-trained convolutional neural network model, and mapped to the text feature space through the fully connected layer to obtain the image feature vector of the multimodal model.

[0047] Optionally, if the data to be processed contains a predetermined number of pictures, the image features of each picture are extracted through a pre-trained ResNet50 model, and mapped to the text feature space through a fully connected layer (MLP) to obtain the image feature vector of the multimodal model.

[0048] Among them, after mapping to the semantic space of the text, the feature vector of the image is converted into an image feature vector with the same dimension and semantic alignment as the text feature.

[0049] Among them, those skilled in the art should be familiar with that there are many other ways to extract image features, for example, using one or more convolutional layers, recurrent neural networks, Transformer and other pre-trained neural network models to extract image features, etc. Those skilled in the art can choose a suitable image feature extraction method based on actual needs, which will not be repeated here.

[0050] In step S1023, if the number of pictures in the data to be processed is less than the predetermined number, the picture features of each picture are extracted through the pre-trained convolutional neural network model, and mapped to the text feature space through the fully connected layer, and the mapping result is padded based on the zero-padding technology. By filling the zero vector, a vector with the same length as the preset input sequence length is obtained as the picture feature vector.

[0051] The padding process ensures that the lengths of the feature sequences input to the model are the same by adding vectors.

[0052] Zero padding is a technique for processing sequences of varying lengths. When processing data, the BERT model must unify the lengths of all input sequences to a fixed maximum length. This is done to enable the model to perform batch processing using fixed-size inputs. For sequences shorter than the maximum length, the BERT model appends a zero vector (a vector consisting entirely of zeros) to the end until the sequence reaches the set maximum length. The padded zero vectors do not affect the hidden state of the model because they do not contain any useful information. The BERT model uses a mask mechanism to ignore these padded zero vectors. During BERT model training, the zero padding portion is marked with a mask to avoid affecting the model training effect.

[0053] In step S103, the multimodal fusion feature obtained by performing feature fusion on the text feature vector and the image feature vector is used as the input of the multimodal model.

[0054] Specifically, the text feature vector obtained in step S101 and the image feature vector obtained in step S102 are concatenated and fused to obtain corresponding multimodal fusion features.

[0055] The multimodal fusion features are used as input embeddings of the BERT model.

[0056] The splicing and fusion includes a splicing operation and a feature fusion operation. The splicing operation splices the text feature vector and the image feature vector together along a specific dimension.

[0057] Optionally, after the splicing and fusion, segment embedding processing and position embedding processing are performed on the text feature vector and the image feature vector respectively.

[0058] The segment representation process is used to distinguish different parts of the text, and the position representation process is used to help the model understand the order of words in the text.

[0059] In step S104, the multimodal model is trained to output a prediction result of a predetermined prediction task based on the input multimodal fusion features in the multimodal model.

[0060] According to one embodiment, the multimodal model is a risk classification model. In step S104, a risk prediction result is output based on the input multimodal fusion features. The risk prediction result includes a violation determination result of the data to be processed.

[0061] Optionally, the risk prediction result may also include other information, such as a risk score for assessing the possibility of a violation.

[0062] According to an embodiment of the present application, the obtained text feature vector is used as the first input sequence, the obtained image feature vector is used as the second input sequence, and the first input sequence and the second input sequence are used as the two inputs of the next sentence prediction task (NSP) in the BERT-based multimodal model to train the BERT-based multimodal model.

[0063] For example, the text feature vector obtained in step S101 is used as token a, the image feature vector obtained in step S102 is used as token b, and token a and token b are used as two inputs of the NSP task in the BERT model to train a BERT-based multimodal model.

[0064] Typically, in the NSP task, the model needs to determine whether a given second sentence is the direct continuation of the first. This task helps the model capture the coherence of text, thereby better understanding the relationship between sentences in downstream tasks such as question answering and natural language inference. In practice, the NSP task takes two sentences as input and separates them with specific tokens, such as [CLS] to mark the beginning of a sentence and [SEP] to mark the end of a sentence. The model then learns how to determine whether these sentences are coherent based on their representations.

[0065] In the scenario where the multimodal model is a risk classification model, the purpose of the NSP task according to the embodiment of the present application is to enable the multimodal model to learn the correlation between images and texts based on the first input sequence and the second input sequence.

[0066] According to the method of the embodiment of the present application, by using the text features and image features corresponding to the data to be processed as two input tokens of a BERT-based multimodal model, and splicing and fusing the text features and image features in the multimodal model, and then outputting the prediction results of the predetermined prediction task based on the fused features, it is possible to use one model to simultaneously process pure text data and data containing text and images. There is no need to train different models separately to process these two types of data as in the traditional way, which saves computing resources and saves the manpower cost of subsequent iterative optimization of the model.

[0067] Refer to the following Figure 2 The exemplary model structure shown is used to illustrate the method of the embodiment of the present application.

[0068] Reference Figure 2 The model used in this example is a multimodal risk scoring model based on the BERT model. This model is designed for the complex situation of dynamic vetting, which includes both plain text and image-containing dynamic vetting. This model enables the use of a single model to simultaneously identify illegal image-containing dynamic vetting and illegal plain text dynamic vetting. The data to be processed in this example is dynamic vetting for publication on a video website, which includes both plain text dynamic vetting and dynamic vetting containing images. In this example, dynamic vetting can contain up to 18 images.

[0069] Reference Figure 2 The BERT model in this example mainly consists of three parts: feature input, model backbone, and risk score output. These three parts are introduced below.

[0070] 1) Feature Input: For a dynamic response containing 18 images, the input features are the dynamic content and the image features of each image. For a text-only dynamic response or a dynamic response containing fewer than 18 images, the input features are the dynamic content and the image vector padded with zeros.

[0071] Specifically, this example draws on the BERT model's Next Sentence Prediction approach. For dynamic posts containing images, a ResNet50 model is used to extract the image features corresponding to the images in the post. These features are then mapped to the text feature space through a fully connected layer. The text content of the post is used as the BERT model's input token A, and the extracted image features are used as the next sentence, or the BERT model's input token B. For dynamic posts with fewer than 18 images (including pure text posts without images), the ResNet50 model is used to extract the image features corresponding to the images in the post. These features are then mapped to the text feature space through a fully connected layer. Zero padding is then used to create an image vector of the same length as the input token B, with a mask used as the zero padding position marker. The input form of token A is [CLS] + dynamic content + [SEP], and the input form of token B is the image vector + [SEP].

[0072] 2) Model backbone:

[0073] For input features, the image features are mapped to feature vectors in the text semantic space using a multi-layer perceptron. These are then concatenated and fused with the word representations of the text content generated by the BERT model's embedding layer. The concatenated features are then used to perform segment and position representations, resulting in the BERT model's input embedding vector, a fusion of both image and text modal features.

[0074] The BERT model structure in this example also includes: multi-head attention, residual connections & LayerNorm, feedforward network, residual connections (Add) & LayerNorm, and classification head. The input embedding vector is fed into these structures for processing.

[0075] Among them, the Multi-Head Attention mechanism uses the self-attention mechanism to allow each token to take into account the information of the entire sequence. Multi-Head Attention allows the model to learn information in parallel in different representation subspaces. The Residual Connection allows the output of each sublayer to be added to its input to form a residual connection to alleviate the gradient vanishing problem in deep networks. LayerNorm is used for layer normalization. Layer normalization is performed after the residual connection to reduce the difference in data distribution between layers and accelerate the training process. The Feed-Forward Neural Network is used after the attention mechanism. The model sends the data into a feed-forward neural network for further nonlinear transformation. The Classification Head is used to obtain prediction results for specific tasks.

[0076] 3) Risk score output;

[0077] The classification head structure outputs the final binary classification prediction result. In this example, the task is to determine whether the dynamics violates the rules, and the prediction result is whether the dynamics violates the rules or not.

[0078] This example uses a multimodal risk scoring model based on BERT, employing the concepts of zero padding and masking, to implement a single model capable of simultaneously identifying both illegal image-containing and text-only dynamics. This avoids wasting machine review resources and reduces the labor cost of subsequent iterative optimization of the model.

[0079] In addition, the present invention also provides a device for processing multimodal data. Figure 3 As shown. The device includes: a device for obtaining a text feature vector by performing word representation processing on the text content of the data to be processed (hereinafter referred to as "text feature acquisition device 101"), a device for extracting the image features of each image and mapping the image features to the text feature space to obtain the image feature vector if the data to be processed contains a predetermined number of images, and if the number of images in the data to be processed is less than the predetermined number, after mapping the image features to the text feature space, a device for zero-padding the mapping result according to a preset input sequence length (hereinafter referred to as "image feature acquisition device 102"), a device for performing feature fusion of the text feature vector and the image feature vector to obtain a multimodal fusion feature as an input of a multimodal model (hereinafter referred to as "feature fusion device 103"), and a device for training the multimodal model to output a prediction result of a predetermined prediction task based on the input multimodal fusion feature in the multimodal model (hereinafter referred to as "model training device 104").

[0080] Reference Figure 3 The text feature acquisition device 101 obtains a text feature vector by performing word representation processing on the text content of the data to be processed.

[0081] The data to be processed includes various data that may contain text and images at the same time.

[0082] Optionally, the data to be processed is dynamic. Dynamics can be a social tool used by video websites to share real-time user information through a follow-up mechanism, providing services such as publishing dynamic content, displaying dynamics of followed users, forwarding dynamics, commenting on dynamics, and liking dynamics. Dynamics are mainly divided into two categories: dynamics with images and dynamics with only text. Dynamics with images refer to dynamics that contain text and a predetermined number of accompanying images; dynamics with only text refer to dynamics that contain only text without images.

[0083] Specifically, the BERT model's embedding layer performs token embedding on the text content to obtain the corresponding text feature vector. Token embedding maps each word or token in the vocabulary to a fixed-size vector.

[0084] If the data to be processed contains a predetermined number of pictures, the picture feature acquisition device 102 obtains a picture feature vector by extracting the picture features of each picture and mapping the picture features to the text feature space. If the number of pictures in the data to be processed is less than the predetermined number, the picture feature acquisition device 102 maps the picture features to the text feature space and then fills the mapping result with zeros according to the preset input sequence length.

[0085] Specifically, the picture feature acquisition device 102 determines whether the data to be processed contains a predetermined number of pictures.

[0086] Methods for determining whether the data to be processed contains images include, but are not limited to, content inspection, file format analysis, media type detection, encoding analysis, or visual recognition.

[0087] For example, for data to be processed in HTML format, by checking whether the HTML code contains Tags or image links tag to determine whether to include images.

[0088] If the data to be processed contains a predetermined number of pictures, the picture feature acquisition device 102 extracts the picture features of each picture through a pre-trained convolutional neural network model, and maps them to the text feature space through a fully connected layer to obtain the picture feature vector of the multimodal model.

[0089] Optionally, if the data to be processed contains a predetermined number of pictures, the picture feature acquisition device 102 extracts the picture features of each picture through the pre-trained ResNet50 model, and maps it to the text feature space through the fully connected layer (MLP) to obtain the picture feature vector of the multimodal model.

[0090] Among them, after mapping to the semantic space of the text, the feature vector of the image is converted into an image feature vector with the same dimension and semantic alignment as the text feature.

[0091] Among them, those skilled in the art should be familiar with that there are many other ways to extract image features, for example, using one or more convolutional layers, recurrent neural networks, Transformer and other pre-trained neural network models to extract image features, etc. Those skilled in the art can choose a suitable image feature extraction method based on actual needs, which will not be repeated here.

[0092] If the number of pictures in the data to be processed is less than a predetermined number, the picture feature acquisition device 102 extracts the picture features of each picture through a pre-trained convolutional neural network model, maps them to the text feature space through a fully connected layer, and fills the mapping result based on the zero-filling technology. By filling the zero vector, a vector with the same length as the preset input sequence length is obtained as the picture feature vector.

[0093] The padding process ensures that the lengths of the feature sequences input to the model are the same by adding vectors.

[0094] The feature fusion device 103 uses the multimodal fusion feature obtained by performing feature fusion on the text feature vector and the image feature vector as the input of the multimodal model.

[0095] Specifically, the feature fusion device 103 concatenates and fuses the text feature vector obtained by the text feature acquisition device 101 and the image feature vector obtained by the image feature acquisition device 102 to obtain corresponding multimodal fusion features.

[0096] The multimodal fusion features are used as input embeddings of the BERT model.

[0097] The splicing and fusion includes a splicing operation and a feature fusion operation. The splicing operation splices the text feature vector and the image feature vector together along a specific dimension.

[0098] Optionally, after the splicing and fusion, segment embedding processing and position embedding processing are performed on the text feature vector and the image feature vector respectively.

[0099] The segment representation process is used to distinguish different parts of the text, and the position representation process is used to help the model understand the order of words in the text.

[0100] The model training device 104 trains the multimodal model to output a prediction result of a predetermined prediction task based on the input multimodal fusion features in the multimodal model.

[0101] According to one embodiment, the multimodal model is a risk classification model, and the model training device 104 outputs a risk prediction result based on the input multimodal fusion features, and the risk prediction result includes a violation determination result of the data to be processed.

[0102] Optionally, the risk prediction result may also include other information, such as a risk score for assessing the possibility of a violation.

[0103] The obtained text feature vector is used as the first input sequence, the obtained image feature vector is used as the second input sequence, and the first input sequence and the second input sequence are used as the two inputs of the next sentence prediction task (NSP) in the BERT-based multimodal model to train the BERT-based multimodal model.

[0104] For example, the text feature vector obtained by the text feature acquisition device 101 is used as token a, the image feature vector obtained by the image feature acquisition device 102 is used as token b, and token a and token b are used as two inputs of the NSP task in the BERT model to train a BERT-based multimodal model.

[0105] Typically, in the NSP task, the model needs to determine whether a given second sentence is the direct continuation of the first. This task helps the model capture the coherence of text, thereby better understanding the relationship between sentences in downstream tasks such as question answering and natural language inference. In practice, the NSP task takes two sentences as input and separates them with specific tokens, such as [CLS] to mark the beginning of a sentence and [SEP] to mark the end of a sentence. The model then learns how to determine whether these sentences are coherent based on their representations.

[0106] In the scenario where the multimodal model is a risk classification model, the purpose of the NSP task according to the embodiment of the present application is to enable the multimodal model to learn the correlation between images and texts based on the first input sequence and the second input sequence.

[0107] According to the device of the embodiment of the present application, by using the text features and image features corresponding to the data to be processed as two input tokens of a BERT-based multimodal model, and splicing and fusing the text features and image features in the multimodal model, and then outputting the prediction results of the predetermined prediction task based on the fused features, it is possible to use one model to simultaneously process pure text data and data containing text and images. There is no need to train different models separately to process the two types of data as in the traditional way, which saves computing resources and saves the manpower cost of subsequent iterative optimization of the model.

[0108] Refer to the following Figure 2 The exemplary model structure shown is used to illustrate the device of the embodiment of the present application.

[0109] Reference Figure 2The model used in this example is a multimodal risk scoring model based on the BERT model. This model is designed for the complex situation of dynamic vetting, which includes both plain text and image-containing dynamic vetting. This model enables the use of a single model to simultaneously identify illegal image-containing dynamic vetting and illegal plain text dynamic vetting. The data to be processed in this example is dynamic vetting for publication on a video website, which includes both plain text dynamic vetting and dynamic vetting containing images. In this example, dynamic vetting can contain up to 18 images.

[0110] Reference Figure 2 The BERT model in this example mainly consists of three parts: feature input, model backbone, and risk score output. These three parts are introduced below.

[0111] 1) Feature Input: For a dynamic response containing 18 images, the input features are the dynamic content and the image features of each image. For a text-only dynamic response or a dynamic response containing fewer than 18 images, the input features are the dynamic content and the image vector padded with zeros.

[0112] Specifically, this example draws on the idea of ​​Next Sentence Prediction of the BERT model. For dynamic images containing pictures, the picture feature acquisition device 102 uses the ResNet50 model to accurately extract the picture features corresponding to the pictures contained in the dynamic image. The text feature acquisition device 101 uses the dynamic text content as the input token A of the BERT model and the extracted picture features as the next sentence, that is, the input token B of the BERT model. For dynamic images with less than 18 pictures (including pure text dynamic images that do not contain pictures), after using the ResNet50 model to extract the picture features corresponding to the pictures contained in the dynamic image and mapping them to the text feature space through the fully connected layer, zero padding is used to supplement the picture vector of the same length as the input token B, and mask is used as the position marker of zero padding. Among them, the input form of token A is expressed as [CLS]+dynamic content+[SEP], and the input form of token B is expressed as picture vector+[SEP]

[0113] 2) Model backbone:

[0114] For the input features, the feature fusion device 103 maps the image features to the feature vector of the text semantic space through a multi-layer perceptron, and then combines this with the word representation of the text content by the BERT model's embedding layer. The combined features are then subjected to segment and position representation, respectively, to obtain the input embedding vector of the BERT model, which fuses the image and text modal features.

[0115] The BERT model structure in this example also includes: multi-head attention, residual connections & LayerNorm, feedforward network, residual connections (Add) & LayerNorm, and classification head. The input embedding vector is fed into these structures for processing.

[0116] Among them, the Multi-Head Attention mechanism uses the self-attention mechanism to allow each token to take into account the information of the entire sequence. Multi-Head Attention allows the model to learn information in parallel in different representation subspaces. The Residual Connection allows the output of each sublayer to be added to its input to form a residual connection to alleviate the gradient vanishing problem in deep networks. LayerNorm is used for layer normalization. Layer normalization is performed after the residual connection to reduce the difference in data distribution between layers and accelerate the training process. The Feed-Forward Neural Network is used after the attention mechanism. The model sends the data into a feed-forward neural network for further nonlinear transformation. The Classification Head is used to obtain prediction results for specific tasks.

[0117] 3) Risk score output;

[0118] The classification head structure outputs the final binary classification prediction result. In this example, the task is to determine whether the dynamics violates the rules, and the prediction result is whether the dynamics violates the rules or not.

[0119] The device in this example trains a BERT-based multimodal risk scoring model and adopts the ideas of zero padding and masking to achieve the function of a model to simultaneously identify illegal dynamic images and illegal pure text dynamics, avoiding the waste of machine review resources and saving the manpower cost of subsequent iterative optimization of the model.

[0120] Based on the same inventive concept, an electronic device is also provided in an embodiment of the present application. The method corresponding to the electronic device may be the method for processing multimodal data in the aforementioned embodiment, and its principle of solving the problem is similar to that of the method. The electronic device provided in an embodiment of the present application includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the methods and / or technical solutions of the aforementioned multiple embodiments of the present application.

[0121] The electronic device may be a user device, or a device formed by integrating a user device and a network device via a network, or an application running on the above device. The user device includes but is not limited to various terminal devices such as computers, mobile phones, tablets, smart watches, and bracelets. The network device includes but is not limited to network hosts, single network servers, multiple network server sets, or cloud computing-based computer collections, and can be used to implement some of the processing functions when setting an alarm. Here, the cloud is composed of a large number of hosts or network servers based on cloud computing (Cloud Computing), where cloud computing is a type of distributed computing, a virtual computer composed of a group of loosely coupled computers.

[0122] Figure 4 The structure of a device suitable for implementing the method and / or technical solution in the embodiment of the present application is shown. The device 1200 includes a central processing unit (CPU) 1201, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1202 or the program loaded from the storage part 1208 into the random access memory (RAM) 1203. Various programs and data required for system operation are also stored in RAM 1203. CPU 1201, ROM 1202 and RAM 1203 are connected to each other through a bus 1204. Input / output (I / O) interface 1205 is also connected to bus 1204.

[0123] The following components are connected to the I / O interface 1205: an input section 1206 including a keyboard, a mouse, a touch screen, a microphone, an infrared sensor, and the like; an output section 1207 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), an LED display, an OLED display, and a speaker; a storage section 1208 including one or more computer-readable media such as a hard disk, an optical disk, a magnetic disk, and a semiconductor memory; and a communication section 1209 including a network interface card such as a LAN (Local Area Network) card, a modem, and the like. The communication section 1209 performs communication processing via a network such as the Internet.

[0124] In particular, the methods and / or embodiments of the present application can be implemented as computer software programs. For example, the embodiments disclosed in the present application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for executing the method shown in the flowchart. When the computer program is executed by the central processing unit (CPU) 1201, the above-mentioned functions defined in the method of the present application are performed.

[0125] Another embodiment of the present application further provides a computer-readable storage medium having computer program instructions stored thereon, which can be executed by a processor to implement the methods and / or technical solutions of any one or more embodiments of the present application.

[0126] Specifically, the present embodiment can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination thereof. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device.

[0127] A computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. This propagated data signal may take a variety of forms, including, but not limited to, electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0128] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

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

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

[0131] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0132] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or page components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0133] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0134] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0135] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute some steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program code.

[0136] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

[0137] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices recited in a device claim may also be implemented by a single unit or device through software or hardware. Terms such as "first" and "second" are used to indicate names and do not imply any particular order.

Claims

1. A method for processing multimodal data, wherein: The method comprises: The text content of the data to be processed is processed into word representation to obtain a text feature vector; If the data to be processed contains a predetermined number of pictures, the picture features of each picture are extracted and mapped to the text feature space to obtain a picture feature vector. If the number of pictures in the data to be processed is less than the predetermined number, after mapping the picture features to the text feature space, the mapping result is zero-padded according to the preset input sequence length; The multimodal fusion feature obtained by fusing the text feature vector and the image feature vector is used as the input of the multimodal model; Training the multimodal model to output a prediction result of a predetermined prediction task based on the input multimodal fusion features in the multimodal model; Wherein, the training of the multimodal model comprises: The obtained text feature vector is used as the first input sequence, the obtained image feature vector is used as the second input sequence, and the first input sequence and the second input sequence are used as two inputs of the next sentence prediction task in the BERT-based multimodal model to train the BERT-based multimodal model. The purpose of the next sentence prediction task is to enable the multimodal model to learn the correlation between the image and the text based on the first input sequence and the second input sequence.

2. The method according to claim 1, wherein If the data to be processed includes a predetermined number of pictures, the picture feature vector is obtained by extracting the picture features of each picture and mapping the picture features to the text feature space, including: If the data to be processed contains a predetermined number of pictures, the image features of each picture are extracted through the pre-trained convolutional neural network model, and mapped to the text feature space through the fully connected layer to obtain the image feature vector of the multimodal model.

3. The method according to claim 1 or 2, wherein: If the number of images in the data to be processed is less than a predetermined number, after mapping the image features to the text feature space, zero-padding the mapping results according to a preset input sequence length includes: The image features of each image are extracted through a pre-trained convolutional neural network model and mapped to the text feature space through a fully connected layer; The mapping result is padded based on the zero padding technology. By padding the zero vector, a vector with the same length as the preset input sequence length is obtained as the image feature vector.

4. The method according to claim 1 or 2, wherein: The method further comprises: After splicing and fusion, the text feature vector and image feature vector are processed into segment representation and position representation respectively.

5. The method according to claim 1 or 2, wherein: The multimodal model is a risk classification model, and the prediction result of the predetermined prediction task outputted based on the input multimodal fusion features in the multimodal model includes: A risk prediction result corresponding to the data to be processed is output based on the multimodal fusion feature, where the risk prediction result includes a violation determination result of the data to be processed.

6. A device for processing multimodal data, wherein: The device comprises: A device for obtaining a text feature vector of a multimodal model by performing word representation processing on the text content of the data to be processed; A device for obtaining a picture feature vector by extracting picture features from each picture and mapping the picture features to a text feature space if the data to be processed contains a predetermined number of pictures; and for performing zero padding on the mapping results according to a preset input sequence length after mapping the picture features to the text feature space if the number of pictures in the data to be processed is less than the predetermined number; A device for performing feature fusion by concatenating text feature vectors and image feature vectors of a multimodal model, so as to use the obtained multimodal fusion features as input to the multimodal model; A device for training the multimodal model to output a prediction result of a predetermined prediction task based on the input multimodal fusion features in the multimodal model; The device for training the multimodal model to output a prediction result of a predetermined prediction task based on the input multimodal fusion features in the multimodal model is used to: The obtained text feature vector is used as the first input sequence, the obtained image feature vector is used as the second input sequence, and the first input sequence and the second input sequence are used as two inputs of the next sentence prediction task in the BERT-based multimodal model to train the BERT-based multimodal model. The purpose of the next sentence prediction task is to enable the multimodal model to learn the correlation between the image and the text based on the first input sequence and the second input sequence.

7. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 5.

8. A computer-readable medium having computer program instructions stored thereon, wherein the computer program instructions can be executed by a processor to implement the method according to any one of claims 1 to 5.

9. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Multimodal data fusion system and method

    KR102279797B1

  • Video question-answer method, device and system, and storage medium

    WO2024046038A1