A movie genre prediction method and system based on multimodal data
Through the combination of the inter-modal attention mechanism and the multi-modal movie map, the problem of failing to effectively integrate multi-modal data and metadata in the existing technology is solved, and the accuracy of movie type classification and recommendation effect are improved.
Patent Information
- Application Number
- CN202310440703.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-23
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2043-04-23
AI Technical Summary
Existing technologies fail to effectively consider the interactive information and movie metadata between multi-modal data in movie genre classification tasks, resulting in poor classification results.
Using an inter-modal attention mechanism and a multi-modal movie graph, it learns the connections between movies by fusing text, video, poster and audio features, and using metadata such as directors, screenwriters and actors to build a multi-modal movie graph. relationship, thereby improving classification performance.
Effectively captures the interactive information and movie metadata between multi-modal data, improves the accuracy and expressiveness of movie type classification, and can more accurately recommend the movie types required by users.
Smart Images

Figure CN116610828B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of movie type classification, and in particular to a movie type prediction method and system based on multimodal data. Background Art
[0002] In the past few decades, the film industry has developed rapidly, generating a large amount of film data. Film introduction data includes movie synopsis, posters, and trailers, which is a classic multimodal data. In recent years, the film genre classification (MGC) task has gradually attracted the attention of researchers due to its wide application space, such as organizing similar videos of users on social media, correcting videos with wrong labels, and retrieving a certain type of movies for recommendation systems.
[0003] Movie data includes movie synopsis, posters, videos and audios. Based on these multimodal data, there are already works that have made great efforts to deal with the movie type classification task. For example, the existing technology uses the video and audio data of the trailer to classify movies; the existing technology also uses movie synopsis and posters to deal with MGC tasks. Although these works have achieved good performance, they only use simple fusion strategies such as splicing or weighted fusion for the fusion of multimodal information, and fail to effectively capture the interactive information between text and audio-visual data. In addition to text and audio-visual data, movie metadata (such as directors and actors) is also important data for processing MGC tasks, because movies can be connected through the cooperation of cast and crew. For example, there is a large overlap between the cast and crew between a movie and its sequel, so the connection between the movies is strong, and the movie and its sequel have the same genre label, but the current research work has not considered the fusion of movie metadata (such as directors and actors) with multimodal data.
[0004] Disadvantages of existing technologies: (1) The multimodal fusion strategies of existing works cannot effectively consider the interaction between multimodal data; (2) Currently, no work considers the director and actor information in movie metadata to improve the performance of processing MGC tasks. Summary of the invention
[0005] To this end, the technical problem to be solved by the present invention is to overcome the problem that the prior art cannot effectively consider the interaction between multimodal data in the task of movie type classification, and does not consider the fusion of movie metadata (such as directors and actors) with multimodal information, resulting in poor movie type classification effect.
[0006] In order to solve the above technical problems, the present invention provides a method for predicting movie genres based on multimodal data, comprising:
[0007] Step S1: Obtain the text, video, poster and audio data of each movie and embed them respectively to obtain text embedding, video embedding, poster embedding and audio embedding;
[0008] Step S2: splicing the text embedding and the video embedding, and performing feature extraction and fusion on the spliced data to obtain text and video features;
[0009] At the same time, feature extraction is performed on the poster embedding and the audio embedding respectively to obtain poster features and audio features;
[0010] Step S3: constructing a multimodal movie graph of different movies based on movie metadata, and using the text and video features, poster features, and audio features to learn the movie metadata in the multimodal movie graph to obtain movie embedding, wherein the movie metadata includes director, screenwriter, and actor information;
[0011] Step S4: Classify different movie types according to the movie embeddings.
[0012] In one embodiment of the present invention, the step between step S2 and step S3 also includes: fusing the text and video features, poster features and audio features of each movie to obtain multimodal data of all movies.
[0013] In one embodiment of the present invention, the method of fusing the text and video features, poster features and audio features of each movie to obtain multimodal data of all movies includes:
[0014] The text and video features of each movie O TV Convert to poster with features O P and audio feature O A The same dimensional space h, obtains the multimodal feature F, expressed as: in, Text and video features transformed into dimensional space;
[0015] Connect the multimodal features F along the transformed dimension space h to obtain f i ∈R m×h , where m represents the number of modes;
[0016] By the first linear matrix W q Get the query matrix Q i =f i W q , through the second linear matrix W k Get the key matrix K i =f i W k , through the third linear matrix W vGet the value matrix V i =f i W v ;
[0017] According to the query matrix Q i and the key matrix K i Calculate the inter-modality attention matrix P i , the formula is: Among them, softmax(·) represents the attention function; T represents the matrix transpose, P i ∈R m×m , R represents the vector space, P i Indicates the three modes in the i-th movie Attention to each other;
[0018] According to the inter-modality attention matrix P i The structure and value matrix V i Construct an attention aggregation, denoted as P i V i ;
[0019] Aggregate the attention P i V i The multimodal features F after quantization are vectorized to obtain O i , and add residual connection to the multimodal feature F, the formula is: i =Vec(P i V i +f i ), where Vec(·) represents expanding the feature matrix row by row, O i ∈R 1×mh ;
[0020] All movies O i Aggregation is performed, which is represented by: O = {O1, O2, ..., O N}, where O represents the multimodal data of all movies.
[0021] In one embodiment of the present invention, the formulas for text embedding, video embedding, poster embedding and audio embedding in step S1 are respectively:
[0022]
[0023]
[0024]
[0025]
[0026] Among them, BertEmbed(·) represents the Bert-based embedding module used to embed text data. The text data M representing the i-th movie t SwinSmall(·) represents the SwinSmall layer in the Swin Transformer used to embed video data or posters. represents the video embedding of the i-th video frame, M p Represents poster data, represents the poster embedding of the i-th movie, Wav2Vec2(·) represents the Wav2Vec2 layer used to embed the audio data, represents the audio embedding of the i-th movie.
[0027] In one embodiment of the present invention, the step S2 extracts and fuses features of the spliced data to obtain text and video features, including:
[0028] The Transformer module is used to extract and fuse the spliced data to obtain the initial text and video features O att ;
[0029] The initial text and video features are input into the average pooling layer to obtain the text and video features O TV , the text and video features are initial text and video features O att The representation vector, where O TV =MP(O att ), MP represents the average pooling operation.
[0030] In one embodiment of the present invention, in step S2, feature extraction is performed on the poster embedding and the audio embedding respectively by a multi-layer perceptron to obtain poster features and audio features, and the formula is:
[0031]
[0032]
[0033] Among them, O P represents poster features, FFN represents a multilayer perceptron, and the multilayer perceptron includes a first linear layer, an activation layer, and a second linear layer connected in sequence. represents the poster embedding of the i-th movie, O A represents audio features, MP represents average pooling operation, represents the audio embedding of the i-th movie.
[0034] In one embodiment of the present invention, the method of step S3 includes:
[0035] Construct a multimodal movie graph of different movies based on movie metadata, and obtain an adjacency matrix of the multimodal movie graph, where if movie D i and Movie D j If the number of overlapping directors, screenwriters or actors in the movie metadata between exceeds a preset threshold, then movie D i and Movie D j There is an edge between them, corresponding to the movie D in the adjacency matrix i and Movie D j The element of is 1; otherwise, in the multimodal movie graph, movie D i and Movie D j There is no edge between them, corresponding to the movie D in the adjacency matrix i and Movie D j The element of is 0;
[0036] The adjacency matrix of the multimodal movie graph and the multimodal data of all movies are input into a two-layer graph neural network, which is used to update the multimodal data of all movies through the adjacency matrix of the multimodal movie graph to obtain the movie embedding
[0037] In one embodiment of the present invention, the adjacency matrix of the multimodal movie graph and the multimodal data of all movies are input into a two-layer graph neural network, and the two-layer graph neural network is used to update the multimodal data of all movies through the adjacency matrix of the multimodal movie graph to obtain the movie embedding The formula is:
[0038]
[0039]
[0040]
[0041] Among them, H (l+1) Indicates H (l) The movie embedding obtained after a layer of graph neural network, l∈{0,1}, H (0) Represents the multimodal data O,H of all movies (1) represents the result obtained by the first layer of graph neural network, H (2) Represents the movie embedding obtained by the second layer of graph neural network σ(·) represents the activation function ReLU, A represents the adjacency matrix of the multimodal movie graph and A ij =E ij , E ij Indicates movie D i and Movie D j The edge between them, D represents the movie dataset, W (l)represents the learnable parameter matrix, I N represents the N-order identity matrix, It means adding 1 to the diagonal of the adjacency matrix A. Representation Matrix The elements in .
[0042] In one embodiment of the present invention, in step S4, according to the movie embedding The formula for classifying different movie types is:
[0043]
[0044] in, express The i-th movie embedding in , Sigmoid(·) represents the activation function, Linear(·) represents the linear layer, is the predicted type set of the i-th movie, and L represents the number of movie types.
[0045] In order to solve the above technical problems, the present invention provides a movie type prediction system based on multimodal data, comprising:
[0046] Embedding module: used to obtain the text, video, poster and audio data of each movie and embed them respectively to obtain text embedding, video embedding, poster embedding and audio embedding;
[0047] Feature extraction module: used to splice the text embedding and the video embedding, and perform feature extraction and fusion on the spliced data to obtain text and video features;
[0048] At the same time, it is used to extract features of the poster embedding and the audio embedding respectively to obtain poster features and audio features;
[0049] Construction and learning module: used for constructing a multimodal movie graph of different movies based on movie metadata, and using the text and video features, poster features and audio features to learn the movie metadata in the multimodal movie graph to obtain movie embedding, wherein the movie metadata includes director, screenwriter and actor information;
[0050] Classification module: used to classify different movie genres based on the movie embeddings.
[0051] The above technical solution of the present invention has the following advantages compared with the prior art:
[0052] The present invention designs an inter-modal attention mechanism (inter-modal attention layer), through which the interaction between two features in multimodal features (including text and video features, poster features, and audio features) can be learned;
[0053] The present invention creatively introduces movie metadata in constructing a multimodal movie graph. If two movies have a connection relationship in the multimodal movie graph, it indicates that the two movies often have the same genre. By learning the connection relationship of the multimodal movie graph, movies of the same genre can be aggregated to improve the performance of the movie genre classification task (MGC).
[0054] The movie type prediction method of the present invention can be applied to large video website platforms to recommend accurate movies to users based on the user's keyword search (such as love, story, family, comedy, etc.). BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to make the contents of the present invention more clearly understood, the present invention is further described in detail below based on specific embodiments of the present invention in conjunction with the accompanying drawings.
[0056] Figure 1 is a flow chart of the method of the present invention;
[0057] Figure 2 is a schematic diagram of the MFMGC framework structure in an embodiment of the present invention;
[0058] Figure 3 It is a multimodal movie map (MMG) in an embodiment of the present invention. DETAILED DESCRIPTION
[0059] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.
[0060] Reference Figure 1 The present invention relates to a method for predicting movie genres based on multimodal data, comprising:
[0061] Step S1: Obtain the text, video, poster and audio data of each movie and embed them respectively to obtain text embedding, video embedding, poster embedding and audio embedding;
[0062] Step S2: splicing the text embedding and the video embedding, and performing feature extraction and fusion on the spliced data to obtain text and video features;
[0063] At the same time, feature extraction is performed on the poster embedding and the audio embedding respectively to obtain poster features and audio features;
[0064] Step S3: Fusing the text and video features, poster features, and audio features of each movie to obtain multimodal data of all movies;
[0065] Step S4: constructing a multimodal movie graph of different movies based on movie metadata, and learning the multimodal movie graph and multimodal data of all movies to obtain movie embeddings, wherein the movie metadata includes director, screenwriter and actor information;
[0066] Step S5: Classify different movie types according to the movie embeddings.
[0067] The following is a detailed introduction to this embodiment:
[0068] Overview of the MFMGC Framework
[0069] In order to effectively utilize the multimodal data of movies to process MGC tasks, this embodiment proposes a new framework called MFMGC. Figure 2 ,The MFMGC framework consists of two modules: the multimodal data fusion (MDF) module and the MDF-based graph representation (MDF-GR) module, and the specific details are introduced as follows.
[0070] This embodiment first embeds the movie data and then inputs it into the MDF module. Specifically, the audio is first segmented into segments, and the video is extracted and converted into a frame set. Then, different pre-training tasks are used to embed text, posters, video frames, and audio segments. After that, these embeddings are sent to the MDF module, which consists of two stages. In the first stage, this embodiment pre-extracts data features. For the embedding of text and video frames with important sequence data, inspired by VLBert, this embodiment uses the Transformer module to extract and fuse information from both. For posters and audio data, this embodiment designs a multi-layer perceptron (MLP) to perform feature pre-extraction. After that, the data of each movie can be represented by three different features (i.e., text and video features, poster features, and audio features). In the second stage, this embodiment uses a modal attention layer (inter-modal attention mechanism) to fuse three different features to ensure that multimodal data can be effectively integrated, thereby comprehensively representing the multimodal data of each movie. In the MDF-GR module, this embodiment uses two layers of GCN to aggregate the neighborhood information of movie nodes, thereby improving the performance of the classification task.
[0071] 1. Multimodal Data Embedding
[0072] See also Figure 2 This part embeds the multimodal data of movies through three pre-training tasks, which includes four components:
[0073] Text embedding: MFMGC is inspired by VLBert. This embodiment embeds text data based on the Bert Embedding module. In detail, given a movie D iText data M t , where M t It consists of a sequence of words, namely {w1,w2,...,w l}, l represents M t The number of words in M t Input the Bert-based embedding module (i.e., Bert Embedding module) to obtain text embedding The formal definition is as follows:
[0074]
[0075] Among them, BertEmbed(·) represents the Bert-based embedding module; Represents text data M t Embedding.
[0076] Video embedding: In addition to the text data of the movie, the video data extracted from the movie trailer is also important data for processing the movie classification task. For example, love movies usually have bright scenes. For the video data, a frame extraction operation is performed every FPS to convert the video data into a sequence of pictures. In order to fuse the video data with the text data using the Transformer module, this embodiment first uses the Swin Transformer to extract the high-order dimensional features of the frame. Movie D i Visual data M v Contains p video frames, namely M v ={f1,f2,...,f p}, where f i represents the i-th video frame, and p represents the movie D i The number of frames of video data. The formal definition is as follows:
[0077]
[0078] Among them, SwinSmall(·) represents the SwinSmall layer in Swin Transformer, Represents the embedding of video frames, each frame is represented as a length of h v Vector.
[0079] Poster embedding: In addition to video data, posters are designed to contain a lot of information about the type of movie, which is used to attract viewers who like specific types of movies. Similar to the steps of processing video frames, posters are also image data. This example inputs the posters into Swin Transformer to obtain embedding. The formal definition is as follows:
[0080]
[0081] Among them, SwinSmall(·) represents the SwinSmall layer in Swin Transformer, M p Represents poster data, represents the poster embedding of the i-th movie.
[0082] Audio embedding: In addition to the modal information mentioned above, this embodiment also considers audio data. This is because different types of movies have different background sound effects. For example, comedy and action movies usually have bright scenes, but the background music of comedy movies tends to have a cheerful rhythm. In order to make full use of the potential features contained in the audio, this embodiment uses the Wav2Vec2 layer to generate audio embedding. Given audio data M a ={o1,o2,...,o s}, where o i represents the i-th audio segment. In this embodiment, the sampling rate is set to 16000, and each segment is an audio signal with a duration of 5 seconds. The formal definition is as follows:
[0083]
[0084] Where Wav2Vec2(·) represents the Wav2Vec2 layer, represents the audio embedding of the i-th movie.
[0085] 2. Multimodal Data Fusion
[0086] In this embodiment, the "TAV" data is embedded (ie, x t 、x v 、x p and x a ) and then introduced the multimodal data fusion (MDF) module. This embodiment has two different types of input data, namely movie metadata and "TAV" data. In order to effectively fuse them, this embodiment divides the MDF module into two parts, namely, MDF based on text audio visual data and MDF-based graph representation learning (MDF-GR). Please note that the first part is to fuse the "TAV" data, and the goal of the second part is to fuse all data simultaneously through the multimodal graph (MMG). In the following subsections, this embodiment will introduce these two parts in detail.
[0087] MDF-feature pre-extraction. The attention mechanism in Transformers has been proven to be powerful and flexible, which can weigh the importance of each part of the input, and Transformers have been widely used in natural language processing (NLP) and computer vision (CV). Since text and video data have obvious sequence properties, this embodiment designs a Transformer module based on the attention mechanism. Specifically, this embodiment first splices the embeddings of text and video: Among them, || is the connection operation. Then, the spliced I tv The embedded input is input into the Transformer module, which consists of multiple Scaled Dot Product Attention layers, which will not be described here. In this embodiment, the output obtained is defined as att .
[0088] Finally, this embodiment uses a mean pooling layer to obtain a representation vector O that combines text and video data. TV =MP(O att ).
[0089] As for poster and audio embedding, this embodiment uses a multi-layer perceptron (MLP) to extract their features. The process is expressed as:
[0090]
[0091]
[0092] Among them, O P Indicates the poster features, represents the poster embedding of the i-th movie, O A Represents audio features, represents the audio embedding of the i-th movie, FFN represents a multi-layer perceptron (MLP) consisting of two linear layers and a ReLU activation layer in the middle, and MP represents the average pooling operation.
[0093] MDF - Inter-modal attention layer. After feature extraction, this embodiment uses the modal attention layer to fuse the features of different modal data. The features are firstly transformed into text and video features through a linear layer. TV Convert to poster with features O P and audio feature O A The same dimensional space h, obtains the multimodal feature F, and expresses the obtained multimodal feature as Taking a movie as an example, we first concatenate the multimodal features F along the modal dimension h to obtain f i ∈R m ×h, where m is the number of modes. By first using the linear matrix W q Get the query matrix Q i =f i W q (equivalent to W q Perform linear operation), through the second linear matrix W k Get the key matrix K i =f i W k , through the third linear matrix W v Get the value matrix V i =f i W v Next, this embodiment uses the scaled dot product function as the attention function. The inter-modal attention matrix P i The calculation is as follows:
[0094]
[0095] Where P i ∈R m×m , P i Indicates the three modes in the i-th movie Finally, the fusion of modalities is expressed by attention aggregation (P i V i ) and vectorized, expressed as O i .
[0096] It is worth mentioning that during the training of deep networks, as the number of network layers increases, the back propagation algorithm will cause the gradient to gradually decrease, making training very difficult. In order to avoid the problem of gradient disappearance during training, this embodiment adds additional residual connections when calculating the fusion representation of the modality. The calculation process can be expressed as:
[0097] O i =Vec(P i V i +f i )
[0098] Among them, Vec(·) means expanding the feature matrix row by row, O i ∈R 1×mh Finally, this embodiment obtains the fusion data O of all movies, which is expressed as: O = {O1, O2, ..., O N}.
[0099] Compared to multimodal fusion methods such as splicing or simple weighted summation, this embodiment can obtain the degree of attention between different modalities by calculating the attention coefficient, and has a high representation ability. In addition, the adaptive weighted processing of different modal information can reduce redundant information in the input, and finally obtain a more accurate fusion representation of different modalities. In addition, when the sequence length is very short, the model needs to capture fewer dependencies than long sequences. Therefore, the single-head attention used in this embodiment is sufficient to capture the information of the input sequence. At this time, if the present embodiment uses multi-head attention, it may cause overfitting, because multi-head attention requires more parameters to learn different attention weights, and the use of multi-head attention on relatively short sequences may reduce the generalization ability of the model. For the inter-modal attention in this embodiment, the sequence length is the number of modalities (this embodiment has three modes). ), which is very short compared to the number of words in a sentence in natural language processing, and the dependencies between modalities can be well captured using single-head attention.
[0100] MDF-based Movie Graph Representation - MDF-GR. In order to obtain more accurate movie embedding, this embodiment uses Multimodal Movie Graph (MMG) to explore the correlation between metadata and "TAV" data. Intuitively, the construction of MMG is to use the structural information between movies and their "TAV" data, see Figure 3 .
[0101] Given a movie dataset D = {D1, D2, ..., D N}, the constructed multimodal movie graph is represented as G = {D, E}, where D is a node set and a node represents a movie D i ; E is the edge set of the multimodal movie graph, E ij Represents node D i and D j Since the "TAV" data represents the attributes of the movie, node D i From the subgraph T = {D t ,E t}, where D t Contains the i-th movie and its attributes. t is a subgraph edge set, which has four types of edges, namely, "movie-text", "movie-poster", "movie-video" and "movie-audio". In addition, this embodiment associates the adjacency matrix A with the edge set E. The element A in the adjacency matrix A is ij Represents movie node D i and node D j Is there an edge between them? If movie D i and D j The number of overlapping movie metadata (i.e., director, screenwriter, and actor) between A and B is greater than the threshold. ijis 1. Otherwise, A ij is 0. In the experiment of this embodiment, when the number of overlaps among the director, screenwriter, and the top three leading actors is greater than 3, A ij is 1. Figure 3 In the figure, the number of overlaps between the director, screenwriter, and top three leading actors of the movie Heartbeat and Magical Bella is 4, so there is an edge between the two movies, that is, the two movies are connected.
[0102] After constructing the multimodal movie graph, this embodiment first uses the MDF module to fuse the multimodal data of the movie to obtain the movie embedding. Then, this embodiment uses two layers of GCN to learn the structural information of the movie graph. The movie embedding obtained after GCN learning is defined as The above embedding process can be summarized as follows. Given a movie dataset D, O = {O1, O2, ..., O N} is a set of node embeddings, where O i is the output of the TAVF stage, indicating D i The embedding of , N is the number of movies. It is defined as follows:
[0103]
[0104]
[0105]
[0106] Among them, H (l+1) Indicates H (l) The movie embedding obtained after a layer of graph neural network (GCN), l∈{0,1}, H (0) Represents the multimodal data O of all movies, that is, the multimodal data O of movies is used as the input of the graph neural network, H (1) represents the result obtained by the first layer of graph neural network (GCN), H (2) Represents the movie embedding obtained through the second layer of graph neural network (GCN) σ(·) represents the activation function ReLU, A represents the adjacency matrix of the multimodal movie graph and A ij =E ij , E ij Indicates movie D i and Movie D j The edge between them, D represents the movie dataset, W (l) represents the learnable parameter matrix, I N represents the N-order unit matrix, A~ represents adding 1 to the diagonal of the adjacency matrix A, Representation Matrix The elements in .
[0107] GCN is different from traditional graph analysis methods. It takes advantage of the advantages of neural networks and learns the feature representation of each node through information interaction between nodes. Specifically, GCN applies the same linear transformation at each node, and uses the adjacency matrix to weighted sum the feature vectors of the node and its neighboring nodes, and then performs a nonlinear transformation through the activation function to obtain the updated feature vector of the node. Using multi-layer GCN, layer-by-layer information transmission and node feature updates can be achieved, and then more extensive local and global information can be gradually captured to generate node representation vectors with rich information. The working principle of GCN can be simply summarized as: using local neighborhood information to update the representation vector of each node, and capturing global information through multi-layer convolution operations.
[0108] In the MDF-GR module of this framework, the multimodal data representation of movies obtained by the first-stage MDF module is used as the initial representation vector of the movie nodes, and the movie nodes are connected according to the overlap of metadata (cast and crew). The new movie representation vector obtained after two layers of GCN can well learn the structural information of the movie graph. As mentioned earlier, movies with large overlaps in cast and crew often have the same genre. Therefore, the movie graph can connect potential movies of the same genre. Through the learning of two layers of GCN, the node representations with connection relationships in the movie graph have a closer distance in the vector space, that is, the aggregation of movies of the same genre can be achieved, which can improve the performance of the movie genre prediction task.
[0109] Classification layer
[0110] This example uses a linear layer and a sigmoid function (which together form the classification component) to generate a set of predicted movie types, formally defined as follows:
[0111]
[0112] in, express The i-th movie embedding in , Sigmoid(·) is the activation function, is the set of predicted genres for the ith movie, where represents the probability that a movie belongs to type j.
[0113] The training process is as follows:
[0114] The training process includes two stages. Specifically, in the first stage, text-audio-visual data is used as input. After passing through the module MDF, this embodiment can obtain the movie embedding that integrates the text-audio-visual data information. In the second stage, the two-layer GCN and the movie embedding obtained in the first stage are used to learn the structural information of the movie graph. Finally, this embodiment uses the classification layer to process the movie embedding to obtain the prediction of the movie type. The training loss function is the binary cross entropy, and the loss function is defined as:
[0115]
[0116] Among them, BCELoss(·) represents the binary cross entropy loss function, represents the set of predicted genres for movies, represents the set of true genres of movies, Indicates whether the i-th movie belongs to type j. If so, then N represents the number of training samples, L represents the number of movie types, represents the true label of the i-th movie.
[0117] Experimental comparison
[0118] This example uses Marco-F1 and Micro-F1 as evaluation indicators. In the proposed framework MFMGC, the number of words l, the number of video frames p, and the number of audio clips s of the text are set to 256, 32, and 16. The embedding dimensions of text, posters, and videos are 768, and the audio dimension is 1024. The number of epochs and mini-batch sizes are 100 and 16, respectively, and Adam is used as the optimizer during training.
[0119] Under the same experimental setting as the benchmark, the framework MFMGC of this embodiment has better performance. As shown in Table 1, when using the movie synopsis as input, the Macro-F1 value of MFMGC is about 30% higher than the benchmark; when using the movie synopsis and visual data (such as posters, videos) as input, the framework also has a higher F1 score.
[0120] According to the analysis of this embodiment, the reasons why the framework performs better are as follows: 1) This embodiment uses an advanced pre-trained model to embed the data. Since the model is pre-trained on a large amount of data, the parameters have rich knowledge of specific modal data (such as text, images), and can extract information about modal data better than traditional embeddings such as Word2vec and Glove. 2) This embodiment designs a fusion module based on the attention mechanism for different types of data to fuse multimodal data. The attention mechanism weighs the importance of each part of the input data differently, so that the framework MFMGC can learn the fusion representation of different modal data, making the framework more effective in multimodal data fusion.
[0121] Embodiment 2
[0122] This embodiment provides a movie type classification system based on multimodal data, including:
[0123] Embedding module: used to obtain the text, video, poster and audio data of each movie and embed them respectively to obtain text embedding, video embedding, poster embedding and audio embedding;
[0124] Feature extraction module: used to splice the text embedding and the video embedding, and perform feature extraction and fusion on the spliced data to obtain text and video features;
[0125] At the same time, it is used to extract features of the poster embedding and the audio embedding respectively to obtain poster features and audio features;
[0126] Construction and learning module: used for constructing a multimodal movie graph of different movies based on movie metadata, and using the text and video features, poster features and audio features to learn the movie metadata in the multimodal movie graph to obtain movie embedding, wherein the movie metadata includes director, screenwriter and actor information;
[0127] Classification module: used to classify different movie genres based on the movie embeddings.
[0128] Embodiment 3
[0129] This embodiment provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the method for predicting movie genres based on multimodal data described in Embodiment 1 are implemented.
[0130] Embodiment 4
[0131] This embodiment provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the method for predicting movie genres based on multimodal data described in the first embodiment are implemented.
[0132] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of complete hardware embodiments, complete software embodiments, or embodiments in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code. The scheme in the embodiments of the present application can be implemented in various computer languages, for example, object-oriented programming language Java and literal scripting language JavaScript, etc.
[0133] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0134] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0135] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0136] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0137] Obviously, the above embodiments are merely examples for clear explanation and are not intended to limit the implementation methods. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived from these are still within the protection scope of the invention.
Claims
1. A method for predicting movie genres based on multimodal data, characterized in that: include: Step S1: Obtain the text, video, poster and audio data of each movie and embed them respectively to obtain text embedding, video embedding, poster embedding and audio embedding; Step S2: splicing the text embedding and the video embedding, and performing feature extraction and fusion on the spliced data to obtain text and video features; At the same time, feature extraction is performed on the poster embedding and the audio embedding respectively to obtain poster features and audio features; Step S3: constructing a multimodal movie graph of different movies based on movie metadata, and using the text and video features, poster features, and audio features to learn the movie metadata in the multimodal movie graph to obtain movie embedding, wherein the movie metadata includes director, screenwriter, and actor information; Step S4: classifying different movie types according to the movie embedding; The step between step S2 and step S3 also includes: fusing the text and video features, poster features and audio features of each movie to obtain multimodal data of all movies; The method of fusing the text and video features, poster features and audio features of each movie to obtain multimodal data of all movies includes: The text and video features of each movie O TV Convert to poster with features O P and audio feature O A The same dimensional space h, obtains the multimodal feature F, expressed as: in, Text and video features transformed into dimensional space; Connect the multimodal features F along the transformed dimension space h to obtain f i ∈R m×h , where m represents the number of modes; By the first linear matrix W q Get the query matrix Q i =f i W q , through the second linear matrix W k Get the key matrix K i =f i W k , through the third linear matrix W v Get the value matrix V i =f i W v ; According to the query matrix Q i and the key matrix K i Calculate the inter-modality attention matrix P i , the formula is: Among them, softmax(·) represents the attention function; T represents the matrix transpose, P i ∈R m×m , R represents the vector space, P i Indicates the three modes in the i-th movie Attention to each other; According to the inter-modality attention matrix P i The structure and value matrix V i Construct an attention aggregation, denoted as P i V i ; Focusing attention on P i V i The multimodal features F after quantization are vectorized to obtain O i , and add residual connection to the multimodal feature F, the formula is: i =Vec(P i V i +f i ), where Vec(·) represents expanding the feature matrix row by row, O i ∈R 1×mh ; All movies O i Aggregation is performed, which is represented by: O = {O1, O2, ..., O N }, where O represents the multimodal data of all movies; The method of step S3 comprises: Construct a multimodal movie graph of different movies based on movie metadata, and obtain an adjacency matrix of the multimodal movie graph, where if movie D i and Movie D j If the number of overlapping directors, screenwriters or actors in the movie metadata between exceeds a preset threshold, then movie D i and Movie D j There is an edge between them, corresponding to the movie D in the adjacency matrix i and Movie D j The element of is 1; otherwise, in the multimodal movie graph, movie D i and Movie D j There is no edge between them, corresponding to the movie D in the adjacency matrix i and Movie D j The element of is 0; The adjacency matrix of the multimodal movie graph and the multimodal data of all movies are input into a two-layer graph neural network, which is used to update the multimodal data of all movies through the adjacency matrix of the multimodal movie graph to obtain the movie embedding .
2. The method for predicting movie genres based on multimodal data according to claim 1, characterized in that: The formulas for text embedding, video embedding, poster embedding and audio embedding in step S1 are: Among them, BertEmbed(·) represents the Bert-based embedding module used to embed text data, x i t The text data M representing the i-th movie t Text embedding, SwinSmall(·) represents the SwinSmal l layer in the Swin Transformer used to embed video data or poster data, represents the video embedding of the i-th video frame, M p Represents poster data, represents the poster embedding of the i-th movie, Wav2Vec2(·) represents the Wav2Vec2 layer used to embed the audio data, represents the audio embedding of the i-th movie.
3. The method for predicting movie genres based on multimodal data according to claim 1, characterized in that: In step S2, feature extraction and fusion are performed on the spliced data to obtain text and video features, including: The Transformer module is used to extract and fuse the spliced data to obtain the initial text and video features O att ; The initial text and video features are input into the average pooling layer to obtain the text and video features O TV , the text and video features are initial text and video features O att The representation vector, where O TV =MP(O att ), MP represents the average pooling operation.
4. The method for predicting movie genres based on multimodal data according to claim 1, characterized in that: In step S2, feature extraction is performed on the poster embedding and the audio embedding respectively by a multi-layer perceptron to obtain poster features and audio features, and the formula is: Among them, O P represents poster features, FFN represents a multilayer perceptron, and the multilayer perceptron includes a first linear layer, an activation layer, and a second linear layer connected in sequence. represents the poster embedding of the i-th movie, O A represents audio features, MP represents average pooling operation, represents the audio embedding of the i-th movie.
5. The method for predicting movie genres based on multimodal data according to claim 1, characterized in that: The adjacency matrix of the multimodal movie graph and the multimodal data of all movies are input into a two-layer graph neural network, which is used to update the multimodal data of all movies through the adjacency matrix of the multimodal movie graph to obtain the movie embedding The formula is: Among them, H (l+1) Indicates H (l) The movie embedding obtained after a layer of graph neural network, l∈{0,1}, H (0) Represents the multimodal data O,H of all movies (1) represents the result obtained by the first layer of graph neural network, H (2) Represents the movie embedding obtained by the second layer of graph neural network σ(·) represents the activation function ReLU, A represents the adjacency matrix of the multimodal movie graph and A ij =E ij , E ij Indicates movie D i and Movie D j The edge between them, D represents the movie dataset, W (l) represents the learnable parameter matrix, I N represents the N-order identity matrix, It means adding 1 to the diagonal of the adjacency matrix A. Representation Matrix The elements in .
6. The method for predicting movie genres based on multimodal data according to claim 1, characterized in that: In step S4, different movie types are classified according to the movie embedding, and the formula is: in, Represents movie embedding The i-th movie embedding in , Sigmoid(·) represents the activation function, Linear(·) represents the linear layer, is the predicted type set of the i-th movie, and L represents the number of movie types.
7. A movie type classification system based on multimodal data, characterized by: include: Embedding module: used to obtain the text, video, poster and audio data of each movie and embed them respectively to obtain text embedding, video embedding, poster embedding and audio embedding; Feature extraction module: used to splice the text embedding and the video embedding, and perform feature extraction and fusion on the spliced data to obtain text and video features; At the same time, it is used to extract features of the poster embedding and the audio embedding respectively to obtain poster features and audio features; Construction and learning module: used for constructing a multimodal movie graph of different movies based on movie metadata, and using the text and video features, poster features and audio features to learn the movie metadata in the multimodal movie graph to obtain movie embedding, wherein the movie metadata includes director, screenwriter and actor information; Classification module: for classifying different movie genres based on the movie embeddings; The feature extraction module and the construction and learning module also include: fusing the text and video features, poster features and audio features of each movie to obtain multimodal data of all movies; The text and video features, poster features and audio features of each movie are fused to obtain multimodal data of all movies, including: The text and video features of each movie O TV Convert to poster with features O P and audio feature O A The same dimensional space h, obtains the multimodal feature F, expressed as: in, Text and video features transformed into dimensional space; Connect the multimodal features F along the transformed dimension space h to obtain f i ∈R m×h , where m represents the number of modes; By the first linear matrix W q Get the query matrix Q i =f i W q , through the second linear matrix W k Get the key matrix K i =f i W k , through the third linear matrix W v Get the value matrix V i =f i W v ; According to the query matrix Q i and the key matrix K i Calculate the inter-modality attention matrix P i , the formula is: Among them, softmax(·) represents the attention function; T represents the matrix transpose, P i ∈R m×m , R represents the vector space, P i Indicates the three modes in the i-th movie Attention to each other; According to the inter-modality attention matrix P i The structure and value matrix V i Construct an attention aggregation, denoted as P i V i ; Focusing attention on P i V i The multimodal features F after quantization are vectorized to obtain O i , and add residual connection to the multimodal feature F, the formula is: i =Vec(P i V i +f i ), where Vec(·) represents expanding the feature matrix row by row, O i ∈R 1×mh ; All movies O i Aggregation is performed, which is represented by: O = {O1, O2, ..., O N }, where O represents the multimodal data of all movies; The building and learning modules include: Construct a multimodal movie graph of different movies based on movie metadata, and obtain an adjacency matrix of the multimodal movie graph, where if movie D i and Movie D j If the number of overlapping directors, screenwriters or actors in the movie metadata between exceeds a preset threshold, then movie D i and Movie D j There is an edge between them, corresponding to the movie D in the adjacency matrix i and Movie D j The element of is 1; otherwise, in the multimodal movie graph, movie D i and Movie D j There is no edge between them, corresponding to the movie D in the adjacency matrix i and Movie D j The element of is 0; The adjacency matrix of the multimodal movie graph and the multimodal data of all movies are input into a two-layer graph neural network, which is used to update the multimodal data of all movies through the adjacency matrix of the multimodal movie graph to obtain the movie embedding .
