Multi-modal sentiment analysis method based on modal fusion and spatial position coding
By using modal fusion and spatial position coding methods in multi-modal emotion analysis, the problem of emotional information association and location information loss in video multi-modal data is solved, and more accurate emotional analysis results are achieved.
Patent Information
- Application Number
- CN202410858171.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-06-28
AI Technical Summary
Existing multimodal emotion analysis methods ignore the correlation within and between modalities when processing video multimodal data, making it difficult to effectively combine emotional information in different modalities, and there is spatial location information in the propagation process. losses.
Using a method based on modal fusion and spatial position coding, by extracting text, speech and video modal information, a spatial position coding module is constructed to reduce the loss of position feature information, and a fusion embedding module and emotion classifier are designed, and weight parameters are used to adjust the coding Fusion of information and original information, combined with Bert model for information fusion and prediction.
It effectively retains modal feature information, enhances the accuracy and stability of sentiment analysis, and improves the performance of the model in multi-modal sentiment analysis.
Smart Images

Figure CN118733800A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of multimodal sentiment analysis and relates to a multimodal sentiment analysis method based on modal fusion and spatial position coding. Background Art
[0002] With the advancement of communication technology and the popularity of social platforms such as Facebook and YouTube, people are increasingly accustomed to expressing their emotions and opinions on these social platforms through various data. Early sentiment analysis could only extract and analyze people's emotions, attitudes and positions on a subject or behavior from single-modal data such as text, without considering the emotional information contained in other modal data such as voice and video. In most environments, it is not possible to effectively extract and analyze people's true emotional opinions on the content they post. Therefore, multimodal sentiment analysis focuses on extending text-based sentiment analysis to multimodal information including text, vision, voice or other forms. Multimodal sentiment analysis has made significant improvements in processing complex multimodal data and has received increasing attention. Since people's truest emotions and opinions can be extracted from these multimodal data, sentiment analysis can be applied to practical application fields such as social recommendation, public opinion warning, trust management, and mental health.
[0003] In addition to individual applications, sentiment analysis also has an important impact at the national level. In terms of government decision-making and governance, sentiment analysis can provide the government with accurate public opinion feedback, which helps to formulate more targeted and feasible policies. In addition, for the management of national image and crisis response, sentiment analysis can monitor emotional feedback in channels such as social media, help the country respond to public concerns in a timely manner, and effectively avoid the damage of negative emotions to the national image. In international relations, sentiment analysis can provide countries with a better understanding of the international community's response to their policies and behaviors by analyzing the emotional color in international social media and news reports, which helps to enhance the country's image, strengthen international communication and cooperation, and thus promote the country's reputation and influence on the global stage.
[0004] However, early sentiment analysis could only extract and analyze people's emotions, attitudes and positions towards a subject or behavior from single-modal data such as text, without considering the emotional information contained in other modal data such as voice and video. In most environments, it could not effectively extract and analyze people's true emotional opinions in the content they posted. Therefore, sentiment analysis based on multimodal data has gradually gained favor among more scholars.
[0005] In fact, today's multimodal sentiment analysis includes many different branch tasks, in large part because with the development of sensor technology, data types have become more diverse, and according to the definition of "multimodal", multimodal data is already a very large data set. Among the many multimodal sentiment analysis tasks currently available, video multimodal data that combines text, voice, and video data appears more frequently in many social platforms than other multimodal data. Therefore, the research on video multimodal sentiment analysis that can combine multiple modal data is of great significance.
[0006] Different from traditional single-modal sentiment analysis, video multimodal sentiment analysis needs to extract fused sentiment information from more complex video multimodal data to judge sentiment tendency. Initially, many researchers simply extracted sentiment information from each modality and directly fused them to achieve multimodal sentiment analysis. Although the sentiment analysis capability of the model can be improved by improving the way of extracting sentiment information from different modalities, this type of method ignores the correlation within and between modalities, making it difficult to effectively combine sentiment information in different modalities, and cannot fully reflect the advantages of video multimodal sentiment analysis.
[0007] In view of the above problems, in the current multimodal sentiment analysis, the modal fusion method can retain key features more effectively than other methods based on a single modality. However, the existing methods do not fully consider the loss of spatial position information of modal data during the transmission process. Therefore, it is necessary to encode the spatial position of modal data to reduce the loss of its spatial position information. Summary of the invention
[0008] In view of this, the object of the present invention is to provide a multimodal sentiment analysis method based on modal fusion and spatial position coding.
[0009] In order to achieve the above object, the present invention provides the following technical solutions:
[0010] A multimodal sentiment analysis method based on modal fusion and spatial position encoding comprises the following steps:
[0011] Step 1: Process the original data samples to extract text modality, voice modality, and video modality;
[0012] Step 2: Construct a spatial position encoding module to reduce the loss of position feature information;
[0013] Step 3: Design a fusion embedding module to fuse text with speech and video modalities as the basic modality;
[0014] Step 4: Design sentiment classifier and loss function;
[0015] Step 5: Verify the effectiveness of the proposed method by comparing it with a variety of different methods.
[0016] Optionally, the specific process of step 1 includes: considering that the original data contains noise irrelevant to the modal information, we preprocess the original data and extract text modality, voice modality, and video modality information from the original data samples. T , X A and X V They represent text mode, voice mode and video mode respectively. The definition of modality pair is as follows: T = (X T ), V'=(X T ,F V ),A'=(X T ,F A ).
[0017] Optionally, the specific process of step 2 includes: spatial position encoding module: construct an L×N matrix for the input modal data, where L represents rows and N represents columns, and encode the row position information and column position information respectively. In order to ensure the integrity of the position information, we follow a specific correspondence rule: odd positions correspond to odd position information, and even positions correspond to even position information. Among them, PE R Represents row position code, PE C represents the column position encoding; k and j represent the position of the token in the sequence; q represents odd dimensions, 2q represents even dimensions; d model Indicates that the dimension of token is 512.
[0018]
[0019] After spatial position encoding, we get the row position vector and column position vector respectively:
[0020] R=[R0,R1,R2,...,R k ] T ,C=[C0,C1,C2,...,C j ] T
[0021] At this point we can get the encoded matrix O':
[0022] O'=R⊙C T
[0023] After the spatial position encoding process, the modal information obtained needs to be added to the original information. The purpose of this step is to minimize the loss of modal feature information and ensure that the encoded data is consistent with the original data in key features. Since there may be certain differences in content and structure between the spatial position encoded information and the original information, direct addition may not fully achieve the expected effect. Therefore, we introduced a weight parameter to adjust the weight of the two in the final fused information. In this way, the encoded information and the original information can be effectively fused, which not only retains the characteristics of the original data, but also makes full use of the advantages brought by spatial position encoding. The final output is:
[0024] F=(1-α)·O+αO',F∈{A,V}
[0025] Among them, O represents the original information, O' represents the encoded information, and α represents the weight parameter in the fusion of the two information.
[0026] Optionally, the specific process of step 3 includes: fusion embedding module: fusion embedding integrates text information embedding and fusion gate mechanism. The text embedding part includes tag embedding and position embedding, which respectively embed the text X T The word tags are converted into real digital information to provide position information for the text. Text embedding uses ordinary Bert tag embedding and position embedding, and the output results of text embedding and spatial position encoding are used as the input of the fusion gate.
[0027] Bert uses three pairs of processed data, T, V' and A', as input. F generated after spatial position encoding is fused with the data of completed text embedding to generate V' and A', where the text modality is used as the basic modality to be fused with the other two modalities, such as Figure 4 As shown. This fusion process first matches the dimensions of the text and other modal data through a linear layer to ensure that they are in the same dimensional space. Then, the data of the two modalities are connected to form a unified representation, which contains information from both the text and other modalities. Finally, the connected modal data is layer normalized to eliminate the scale differences between different modalities and further promote information fusion. The corresponding formula is as follows:
[0028]
[0029] in It is defined as the fusion of T and F, where T represents the text modality and F represents the voice modality or video modality.
[0030] Since these modalities are processed differently, they have different dimensions. We set the text modality as the base modality, so the dimensions of the other two modalities will change with the size of the text modality. The specific process is as follows: F is connected to the text modality T through projection through the linear layer in the formula. The corresponding formula is as follows:
[0031] F'=Linear(F)
[0032] Then, according to the sequence length operation combination T and F in the following formula, the corresponding formula is as follows:
[0033]
[0034] Finally, in order to eliminate the scale differences between different modalities and enhance the stability of the model, we adopt a regularization dimension d T LayerNorm layer. At this time, X processed by the fusion gate V' and X A' The size and length of R T×2L , the length of the text modality T is still L. In Bert, the Pooler layer is used to complete the downstream task. The Pooler layer uses a fully connected layer and a tanh activation function. After the three pairs of T, A' and V' are processed by the Pooler layer, we can get the following output:
[0035] W=tanh(Linear(Z)),Z∈{T,A',V'}
[0036] Optionally, in step 4, sentiment classifier and loss function: we introduce a self-attention layer for W T , W V and W A Finally, we connect each group of multimodal fusion representations and send them to the fully connected layer for result prediction. The corresponding formula is as follows:
[0037]
[0038] Due to the fusion loss Loss f is calculated in these three pairs of modal data, so Loss f There are three types: Loss T 、Loss V' and Loss A' , each type of loss value is calculated using the same method. task is a task-dependent loss. Since sentiment analysis is a regression task, the mean square error loss function is used. task and Loss fThe sum of the average values of the three fusion losses is used to perform the overall learning of the model by minimizing the formula. The corresponding formula is as follows:
[0039]
[0040] The beneficial effects of the present invention are: proposing a multimodal sentiment analysis method based on modal fusion and spatial position coding,
[0041] It includes: 1) processing the original data samples to extract text modality, speech modality, and video modality; 2) constructing a spatial position encoding module to reduce the loss of position feature information; 3) designing a fusion embedding module to fuse text as the basic modality with speech and video modalities; 4) designing a sentiment classifier and loss function, which is used to update model training parameters.
[0042] Other advantages, objectives and features of the present invention will be described in the following description to some extent, and to some extent, will be obvious to those skilled in the art based on the following examination and study, or can be taught from the practice of the present invention. The objectives and other advantages of the present invention can be realized and obtained through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be described in detail below in conjunction with the accompanying drawings, wherein:
[0044] Figure 1 Overall process;
[0045] Figure 2 The overall framework diagram of the multimodal sentiment analysis method based on modal fusion and spatial position encoding;
[0046] Figure 3 The structure diagram of the spatial position encoding module;
[0047] Figure 4 Fusion gate module structure diagram;
[0048] Figure 5 Diagram of the self-attention layer structure. DETAILED DESCRIPTION
[0049] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments only illustrate the basic concept of the present invention in a schematic manner, and the following embodiments and features in the embodiments can be combined with each other without conflict.
[0050] Among them, the drawings are only used for illustrative explanations, and they only represent schematic diagrams rather than actual pictures, and should not be understood as limitations on the present invention. In order to better illustrate the embodiments of the present invention, some parts of the drawings may be omitted, enlarged or reduced, and do not represent the size of actual products. For those skilled in the art, it is understandable that some well-known structures and their descriptions in the drawings may be omitted.
[0051] The same or similar numbers in the drawings of the embodiments of the present invention correspond to the same or similar parts; in the description of the present invention, it should be understood that if the terms "upper", "lower", "left", "right", "front", "rear", etc. indicate the orientation or position relationship, they are based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation. Therefore, the terms describing the position relationship in the drawings are only used for illustrative purposes and cannot be understood as limiting the present invention. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.
[0052] See also Figure 1 to Figure 5 The present invention provides a multimodal sentiment analysis method based on modal fusion and spatial position coding.
[0053] Figure 1 The following is a flowchart for the specific implementation.
[0054] Figure 2 This is the overall structure diagram of the present invention. Figure 3 , Figure 4 and Figure 5 They are Figure 2 The detailed structure of the module in FIG. is described below with reference to the accompanying drawings, and includes the following steps:
[0055] Optionally, step 1 specifically includes: preprocessing the raw data, extracting text modality, voice modality, and video modality information from the raw data. In this study, sentiment analysis uses three modalities for experiments, namely text, voice, and video. The definitions of these three input modalities are as follows: X T ∈R dT×L ,XV ∈R dV×L ,X A ∈R dA×L Where X T ,X V and X A They represent text mode, video mode and speech mode respectively. The length of these modality vectors is L, and the dimensions are d T ,d V and d A . Because L is a fixed length we set, when some of our inputs are smaller than L, we will use zero padding to ensure the input length is consistent. Our model also uses (X T ,F A ) and (X T ,F V ) mode pair. The text mode is regarded as the basic mode in the model. The definition of the mode pair is as follows: T = (X T ), V'=(X T ,F V ),A'=(X T ,F A ).
[0056] Optionally, step 2 specifically includes: Figure 2 This is the overall structure diagram of the present invention, which mainly includes a spatial position coding module Figure 3 , Fusion Gate Module Figure 4 and the self-attention layer in the classifier Figure 5 The proposed modality fusion and spatial position encoding network structure is as follows Figure 2 The main structures are the spatial position encoding module, the fusion gate module and the self-attention layer.
[0057] Spatial position encoding: Due to various factors, the voice and video modalities will inevitably face the problem of information loss in the process of modal data encoding. In order to maximize the preservation of the original data content of the modalities, we performed spatial position encoding on these two modalities. The importance of this step is that it can ensure that the key features of each modality can be effectively retained and fully utilized in the subsequent data fusion. This paper establishes the following Figure 3 The spatial position encoding module shown.
[0058] Construct an L×N matrix for the input modal data, where L represents rows and N represents columns, encoding row position information and column position information respectively. To ensure the integrity of the position information, we follow a specific correspondence rule: odd positions correspond to odd position information, and even positions correspond to even position information. R Represents row position code, PE Crepresents the column position encoding; k and j represent the position of the token in the sequence; q represents odd dimensions, 2q represents even dimensions; d model Indicates that the dimension of token is 512.
[0059]
[0060] After spatial position encoding, we get the row position vector and column position vector respectively:
[0061] R=[R0,R1,R2,...,R k ] T ,C=[C0,C1,C2,...,C j ] T
[0062] Where R represents the row position vector and C represents the column position vector. Now we can get the encoded matrix O':
[0063] O'=R⊙C T
[0064] After the spatial position encoding process, the modal information obtained needs to be added to the original information. The purpose of this step is to minimize the loss of modal feature information and ensure that the encoded data is consistent with the original data in key features. Since there may be certain differences in content and structure between the spatial position encoded information and the original information, direct addition may not fully achieve the expected effect. Therefore, we introduced a weight parameter to adjust the weight of the two in the final fused information. In this way, the encoded information and the original information can be effectively fused, which not only retains the characteristics of the original data, but also makes full use of the advantages brought by spatial position encoding. The final output is:
[0065] F=(1-α)·O+αO',F∈{A,V}
[0066] Among them, O represents the original information, O' represents the encoded information, and α represents the weight parameter in the fusion of the two information.
[0067] Fusion gate module: Fusion embedding integrates text information embedding and fusion gate mechanism. The text embedding part includes tag embedding and position embedding, which respectively T The word tags are converted into real digital information to provide position information for the text. Text embedding uses ordinary Bert tag embedding and position embedding, and the output results of text embedding and spatial position encoding are used as the input of the fusion gate.
[0068] Bert uses three pairs of processed data, T, V' and A', as input. F generated after spatial position encoding is fused with the data of completed text embedding to generate V' and A', where the text modality is used as the basic modality to be fused with the other two modalities, such as Figure 4 As shown. This fusion process first matches the dimensions of the text and other modal data through a linear layer to ensure that they are in the same dimensional space. Then, the data of the two modalities are connected to form a unified representation, which contains information from both the text and other modalities. Finally, the connected modal data is layer normalized to eliminate the scale differences between different modalities and further promote information fusion. The corresponding formula is as follows:
[0069]
[0070] in It is defined as the fusion of T and F, where T represents the text modality and F represents the voice modality or video modality.
[0071] Since these modalities are processed differently, they have different dimensions. We set the text modality as the base modality, so the dimensions of the other two modalities will change with the size of the text modality. The specific process is as follows: F is connected to the text modality T through projection through the linear layer in the formula. The corresponding formula is as follows:
[0072] F'=Linear(F)
[0073] Then, according to the sequence length operation combination T and F in the following formula, the corresponding formula is as follows:
[0074]
[0075] Finally, in order to eliminate the scale differences between different modalities and enhance the stability of the model, we adopt a regularization dimension d T LayerNorm layer. At this time, X processed by the fusion gate V' and X A' The size and length of R T×2L , the length of the text modality T is still L. In Bert, the Pooler layer is used to complete the downstream task. The Pooler layer uses a fully connected layer and a tanh activation function. After the three pairs of T, V' and A' are processed by the Pooler layer, we can get the following output:
[0076] W=tanh(Linear(Z)),Z∈{T,A',V'}
[0077] Sentiment classifier and loss function: In order to obtain meaningful fusion performance, we introduce a self-attention layer to WT , W V and W A Finally, we connect each group of multimodal fusion representations and send them to the fully connected layer for result prediction. The corresponding formula is as follows:
[0078]
[0079] Due to the fusion loss Loss f is calculated in these three pairs of modal data, so Loss f There are three types: Loss T 、Loss V' and Loss A' , each type of loss value is calculated using the same method. task is a task-dependent loss. Since sentiment analysis is a regression task, the mean square error loss function is used. task and Loss f The sum of the average values of the three fusion losses is used to perform the overall learning of the model by minimizing the formula. The corresponding formula is as follows:
[0080] .
Claims
1. A multimodal sentiment analysis method based on modal fusion and spatial position coding, characterized by: The method comprises the following steps: Step 1: Process the original data samples to extract text modality, voice modality, and video modality; Step 2: Construct a spatial position encoding module to reduce the loss of position feature information; Step 3: Design a fusion embedding module to fuse text as the basic modality with speech and video modalities; Step 4: Design sentiment classifier and loss function; Step 5: Verify the effectiveness of the proposed method by comparing it with a variety of different methods.
2. The multimodal sentiment analysis method based on modal fusion and spatial position coding according to claim 1, characterized in that: In step 1, considering that the original data contains noise that is irrelevant to the modal information, we preprocess the original data and extract text modality, voice modality, and video modality information from the original data samples. T , X A and X V They represent text mode, voice mode and video mode respectively. The definition of modality pair is as follows: T = (X T ), V'=(X T ,F V ),A'=(X T ,F A ).
3. The multimodal sentiment analysis method based on modal fusion and spatial position coding according to claim 2, characterized in that: In step 2, the spatial position encoding module: constructs an L×N matrix for the input modal data, where L represents rows and N represents columns, and encodes the row position information and column position information respectively. In order to ensure the integrity of the position information, we follow a specific correspondence rule: odd positions correspond to odd position information, and even positions correspond to even position information. R Represents row position code, PE C represents the column position encoding; k and j represent the position of the token in the sequence; q represents odd dimensions, 2q represents even dimensions; d model Indicates that the dimension of token is 512. After spatial position encoding, we get the row position vector and column position vector respectively: R=[R0,R1,R2,...,R k ] T ,C=[C0,C1,C2,...,C j ] T At this point we can get the encoded matrix O': O'=R⊙C T After the spatial position encoding process, the modal information obtained needs to be added to the original information. We introduced a weight parameter to adjust the weight of the two in the final fused information. This can achieve effective fusion of the encoded information and the original information, which not only retains the characteristics of the original data, but also makes full use of the advantages brought by spatial position encoding. The final output is: F=(1-α)·O+α·O',F∈{A,V} Among them, O represents the original information, O' represents the encoded information, and α represents the weight parameter in the fusion of the two information.
4. The multimodal sentiment analysis method based on modal fusion and spatial position coding according to claim 3 is characterized in that: In the step three, the fusion embedding module: the fusion embedding integrates text information embedding and the fusion gate mechanism. Text embedding uses ordinary Bert tag embedding and position embedding, and the output results of text embedding and spatial position encoding are used as the input of the fusion gate. Bert uses three pairs of processed data as input. Among them, the text modality is fused with the other two modalities as the basic modality. This fusion process first matches the dimensions of the text and other modal data through a linear layer to ensure that they are in the same dimensional space. Then, the data of the two modalities are connected for a unified representation, which contains the information of both the text and other modalities. Finally, the connected modal data is layer normalized. The corresponding formula is as follows: in It is defined as the fusion of T and F, where T represents the text modality and F represents the speech modality or video modality after being processed by the spatial position encoding module. Since these modalities are processed differently, they have different dimensions. We set the text modality as the base modality, so the dimensions of the other two modalities will change with the size of the text modality. The specific process is as follows: F is connected to the text modality T through projection through the linear layer in the formula. The corresponding formula is as follows: F'=Linear(F) Then, according to the sequence length operation combination T and F in the following formula, the corresponding formula is as follows: In Bert, the Pooler layer is used to complete downstream tasks. The Pooler layer uses a fully connected layer and a tanh activation function. After the three pairs of T, A' and V' are processed by the Pooler layer, we can get the following output: W=tanh(Linear(Z)),Z∈{T,A',V'}.
5. The multimodal sentiment analysis method based on modal fusion and spatial position coding according to claim 4, characterized in that: In step 4, sentiment classifier and loss function: We introduce the self-attention layer to W T , W V and W A For processing, we connect each group of multimodal fusion representations and send them to the fully connected layer for result prediction. Due to the fusion loss Loss f is calculated in these three pairs of modal data, so Loss f There are three types: Loss T 、Loss V' and Loss A' , each type of loss value is calculated using the same method. task is a task-dependent loss. Since sentiment analysis is a regression task, the mean square error loss function is used. task and Loss f The sum of the averages of the three fusion losses is calculated by minimizing Loss f and Loss task to perform overall learning of the model.
6. The multimodal sentiment analysis method based on modal fusion and spatial position coding according to claim 5, characterized in that: In step 5, the effectiveness of the proposed method is verified by comparing it with a variety of different methods. We conduct experiments on the proposed method on the CMU-MOSI and CMU-MOSEI datasets and verify its effectiveness by comparing it with the most advanced methods.
Citation Information
Patent Citations
Multi-modal sentiment analysis method based on MIT and FSM
CN113806609A
Multi-modal fine-grained sentiment analysis method based on momentum contrast learning
CN117435732A
Multi-modal network public opinion sentiment analysis method based on deep technology integration
CN118227893A
