Implicit sentiment analysis method and device
Through multi-modal feature extraction and fusion methods, the fusion technology of text, speech and visual features is used to solve the problem of difficulty in capturing implicit emotions with existing technology, and achieve more accurate emotional analysis and personalized mental health services.
Patent Information
- Application Number
- CN202410767072.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-14
- Publication Date
- 2024-10-01
AI Technical Summary
Existing text-based natural language processing models are difficult to capture people's explicit implicit emotions, making it difficult to determine emotional tendencies and provide accurate implicit emotion analysis.
Multi-modal feature extraction and fusion methods are used to fuse text, speech and visual features through multi-head attention mechanisms and cross-attention mechanisms to generate fusion features for implicit emotion classification and improve analysis accuracy.
It improves the accuracy of implicit sentiment analysis, can more accurately understand the user's emotional state, provide more personalized mental health services, and improve the quality of medical services and user experience.
Smart Images

Figure CN118734200A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of online medical technology, and in particular to an implicit sentiment analysis method and device. Background Art
[0002] In today's digital society, as people's attention to mental health continues to increase, traditional offline medical services face challenges such as insufficient medical resources and inconvenient transportation. To solve these problems, the online mental health doctor system came into being, which allows patients to no longer be restricted by time and place, and provide more personalized treatment plans and psychological support based on their personal emotional characteristics and needs.
[0003] With the continuous development of artificial intelligence and natural language processing technology, more abundant methods and reliable theoretical basis are provided for sentiment analysis. For example, machines with integrated artificial learning models are used to collect text information from patients online, and the sentiment analysis carried in the text is understood by analyzing the machine's ability to imitate human perception and understanding of emotions.
[0004] However, the inventors of the present invention have found in their research that existing text-based natural language processing models can generally only understand the emotional information expressed by the literal information of a sentence, but have difficulty capturing a person's explicit implicit emotions, and further have difficulty determining a person's true emotional tendencies.
[0005] Therefore, it is necessary to provide a model, device or method that can improve the accuracy of implicit sentiment analysis. Summary of the invention
[0006] In response to the above problems, the purpose of this application is to provide an implicit sentiment analysis method and device, which can obtain the original data of online users, extract and fuse multimodal features for the original data, and predict the user's implicit sentiment tendency classification results based on the fusion features obtained by the preset feature fusion strategy, so as to improve the accuracy of analysis and prediction.
[0007] To achieve the above objectives, this application adopts the following technical solutions:
[0008] In a first aspect, the present application provides an implicit sentiment analysis method, the method comprising:
[0009] Obtaining raw data of online users and preprocessing the raw data;
[0010] Based on the preprocessed data, extracting multimodal data features of preset types;
[0011] The multimodal data features of the preset types are subjected to feature fusion according to a preset fusion strategy to obtain fused data features, and the implicit emotions of online users are classified and predicted based on the fused data features to obtain implicit emotion classification results;
[0012] Output the implicit sentiment classification result.
[0013] In one implementation of the present invention, the original data is video data;
[0014] The preset types of multimodal data features include text features, voice features and visual features.
[0015] In one implementation of the present invention, the preset fusion strategy includes:
[0016] A multi-head attention mechanism is used to perform bimodal fusion on the text feature and the speech feature, as well as the text feature and the visual feature, to obtain text-speech fusion features and text-visual fusion features respectively;
[0017] The text features, the text-speech fusion features, and the text-visual fusion features are deeply fused based on a cross-attention mechanism to obtain the fused data features.
[0018] The present invention also provides an implicit sentiment analysis device, comprising: a data preprocessing module, a multimodal feature extraction module, a feature fusion module and a sentiment analysis result display module;
[0019] The data preprocessing module is used to obtain the original data of online users and preprocess the original data;
[0020] The multimodal feature extraction module is used to extract multimodal data features of preset types based on the preprocessed data;
[0021] The feature fusion module is used to perform feature fusion on the multimodal data features of the preset types according to a preset fusion strategy to obtain fused data features, and classify and predict the implicit emotions of online users based on the fused data features to obtain implicit emotion classification results;
[0022] The sentiment analysis result display module is used to output the implicit sentiment classification result.
[0023] In one implementation of the present invention, the multimodal feature extraction module includes: a text feature extraction module, a speech feature extraction module and a visual feature extraction module, which are respectively used to extract text features, speech features and visual features.
[0024] In one implementation of the present invention, the feature fusion module includes a text-speech multi-head mutual attention mechanism module, a text-vision multi-head mutual attention mechanism module, and a cross-attention fusion module;
[0025] The text-speech multi-head mutual attention mechanism module and the text-vision multi-head mutual attention mechanism module are used to adopt a multi-head attention mechanism to perform bimodal fusion on the text features and the speech features, as well as the text features and the vision features, to obtain text-speech fusion features and text-vision fusion features, respectively;
[0026] The cross-attention fusion module deeply fuses the text features, the text-speech fusion features, and the text-visual fusion features based on the cross-attention mechanism to obtain the fused data features.
[0027] In one implementation of the present invention, the feature fusion module is further used to perform linear feature dimension matching between text and speech, and between text and vision before fusing text features, speech features and visual features.
[0028] In one implementation of the present invention, the feature fusion module is also used to match the text features acquired at each time step with the speech and visual features to obtain the final representation of the interactive features of speech, vision and text. The calculation process is as follows:
[0029]
[0030] Among them, h represents the number of heads in the multi-head attention mechanism, represents the trainable weight matrix of the h-th attention head, is the scaling factor.
[0031] In one implementation of the present invention, the calculation process of the cross attention fusion module is:
[0032] (1) Calculate text feature enhancement. The calculation process is as follows:
[0033]
[0034] in, and X T is the input of CorAn, and K=X T W K 、V=X (A,V) W (A,V) Represent the query keywords and values of the cross attention mechanism respectively;
[0035] (2) Calculate the deep fusion calculation weights and embed the text into the representation As query vector and text feature X T Perform deep fusion calculation weights to obtain enhanced text feature output The calculation process is as follows:
[0036]
[0037] (3) Calculate the attention score and enhance the feature output and X V→T Splicing, obtain dimensionality reduction features through linear mapping, and use tanh and softmax activation functions to obtain the final attention score. The calculation process is as follows:
[0038]
[0039] In one implementation of the present invention, the specific processing process of the sentiment analysis result display module is as follows:
[0040] (1) Calculate implicit emotion probability: Input the final fused implicit multimodal feature O into the fully connected layer and use the softmax activation function to calculate the emotion label. The calculation process is as follows:
[0041] y=softmax(W O O+b O )
[0042] Among them, W o and b o Represents the trainable parameters of the prediction layer;
[0043] (2) The cross entropy loss function is used to calculate the loss between the predicted label and the true label, and the mean square error function is used to measure the difference between the fused features and the true label; the loss expression of the sentiment analysis task is as follows:
[0044]
[0045] Among them, n is the number of training samples, y is the sentiment classification prediction output, is the real sentiment label, i is and the exponent of the y value;
[0046] The loss definition of the auxiliary task feature fusion strategy is as follows:
[0047]
[0048] Among them, f i and Represent the model output and true label of multimodal feature fusion respectively;
[0049] The total loss is the sentiment analysis task Lsentiment and auxiliary task L fusion The weighted sum of:
[0050] L joint =α·L sentiment +β·L fusion +γ·R
[0051] Among them, α, β, and γ are the weights of the loss.
[0052] The present invention adopts the above technical solution, which has the following advantages:
[0053] 1. The present invention introduces multimodal features in Chinese implicit sentiment analysis, uses speech and visual features to assist text analysis, and effectively improves the accuracy of implicit sentiment analysis. 2. A novel and scarce implicit multimodal dataset MUMETA is created to make up for the shortcomings of implicit multimodal datasets. This dataset provides valuable multimodal training data for implicit texts, so as to understand implicit emotional information from multimodal texts and images. 3. The present invention fully mines the implicit information in user communication to provide users with more intelligent and personalized mental health services. It solves the problem of automatically analyzing user emotional orientation in the medical field, enables the system to more accurately understand the user's emotional state, and achieves more nuanced emotional classification and diagnosis. This not only improves the quality of medical services, but also improves the user experience, provides a key way to improve the overall level of the medical industry, and has important value at both the commercial and social levels. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 is a device structure diagram of the device provided by the present invention;
[0055] Figure 2 It is a network architecture diagram of the main model used in the method of the present invention;
[0056] Figure 3 It is a framework diagram of the multi-head mutual attention mechanism module in the method of the present invention;
[0057] Figure 4 It is a framework diagram of the cross-attention fusion module in the method of the present invention. DETAILED DESCRIPTION
[0058] In order to make the purpose, technical solution and advantages of the embodiment of the present invention clearer, the technical solution of the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings of the embodiment of the present invention. Obviously, the described embodiment is a part of the embodiment of the present invention, not all of the embodiments. Based on the described embodiment of the present invention, all other embodiments obtained by ordinary technicians in this field belong to the scope of protection of the present invention.
[0059] The existing artificial intelligence technology can only understand the emotional information expressed by the literal information of a sentence, but it is difficult to capture people's explicit implicit emotions. The present invention accordingly provides an implicit emotion analysis method and device.
[0060] The method comprises:
[0061] S1, obtaining the original data of online users and preprocessing the original data;
[0062] S2, extracting multimodal data features of preset types based on the preprocessed data;
[0063] S3, fusing the multimodal data features of the preset types according to a preset fusion strategy to obtain fused data features, and classifying and predicting the implicit emotions of online users based on the fused data features to obtain implicit emotion classification results;
[0064] S4, output the implicit sentiment classification result.
[0065] Accordingly, the device comprises: a data preprocessing module, a multimodal feature extraction module, a feature fusion module and a sentiment analysis result display module;
[0066] The data preprocessing module is used to obtain the original data of online users and preprocess the original data;
[0067] The multimodal feature extraction module is used to extract multimodal data features of preset types based on the preprocessed data;
[0068] The feature fusion module is used to perform feature fusion on the multimodal data features of the preset types according to a preset fusion strategy to obtain fused data features, and classify and predict the implicit emotions of online users based on the fused data features to obtain implicit emotion classification results;
[0069] The sentiment analysis result display module is used to output the implicit sentiment classification result.
[0070] The implicit sentiment analysis method and device provided by the present invention can obtain the original data of online users, extract and fuse multimodal features for the original data, predict the implicit sentiment tendency classification results of users based on the fusion features obtained by the preset feature fusion strategy, and improve the accuracy of analysis and prediction.
[0071] The above method and device are described below in more detailed embodiments in conjunction with more drawings of the present invention.
[0072] like Figure 1 , is a device structure diagram of the device provided by the present invention.
[0073] The device comprises a data preprocessing module (1), a text feature extraction module (2), a speech feature extraction module (3), a visual feature extraction module (4), a text-speech multi-head mutual attention mechanism module (5), a text-vision multi-head mutual attention mechanism module (6), a cross-attention fusion module (7), and a sentiment analysis result display module (8).
[0074] The steps are as follows:
[0075] S1: The data preprocessing module (1) is used to process the underlying data of the mental health intelligent doctor system, and then the processed data is transmitted to modules (2), (3), and (4) respectively;
[0076] S2: Modules (2), (3), and (4) use corresponding data processing tools to extract the initial feature information of each modality from the data received from the data preprocessing module (1), crop and align the data, and then input the data into the text-speech multi-head mutual attention mechanism module (5) and the text-vision multi-head mutual attention mechanism module (6) for processing;
[0077] S3: Modules (5) and (6) use the multi-head mutual attention mechanism to learn the bimodal fusion between the text modality obtained in modules (2), (3), and (4) and the acoustic and visual modalities, and input them into the cross-attention fusion module (7) for processing;
[0078] S4: Module (7) requests module (2) to process input data after deep fusion with the optimal data, and transmits the sentiment analysis processing results to module (8);
[0079] S5: The sentiment analysis result display module (8) provides an API (Application Programming Interface) based on the data obtained by the cross-attention fusion module (7) for different clients to call. Once the client accesses the API, the sentiment analysis results can be displayed in the form of charts.
[0080] The architecture diagram of the main model integrated in the device is as follows Figure 2 .
[0081] Before deployment, the main model needs to be trained based on the training data.
[0082] Potential implicit videos were collected from the mental health intelligent detection system by querying keywords. Only Mandarin was considered during the collection process, and videos with accents were carefully selected. A total of 60 original implicit videos were collected. At the same time, 788 Chinese implicit sentiment sentences were selected from the public dataset SMP-ECISA 2019, and the average length of the selected sentences was 15.5 Chinese characters. Among them, there were 192 and 218 commendatory and derogatory implicit sentiment sentences respectively, and 378 sentences without sentiment words.
[0083] The specific operations of the data preprocessing module are:
[0084] S1.1: Data cropping. The video editing tool Adobe Premiere Pro1 was used to crop the target segments from the original video, and a total of 2844 video segments were obtained. At the same time, pyttsx3 and Text2Video were used to generate the voice and video data corresponding to each text.
[0085] S1.2: Data annotation. Each video clip in the dataset is labeled with one of three emotions: -1 (negative), 0 (neutral) or 1 (positive). The final implicit multimodal dataset contains a total of 3632 sentences and the same number of videos and voices.
[0086] The specific operations of the single-modal feature extraction module are:
[0087] S2.1: Unimodal feature extraction. The text, speech, and visual features in the implicit multimodal dataset obtained in S1.2 are processed by BERT, LibROSA, and OpenFace2.0, respectively, and the extracted dimensions are d t =768,d a =33 and d v =709.
[0088] S2.2: Matching dimension. The text feature vector X of each utterance extracted in S3.1 is T As the target modality, the size X′ between the speech and visual features is matched through a linear layer m , where m∈{T,A,V}.
[0089] X′ m =Linear(X m )
[0090] The specific operation of the multi-head mutual attention mechanism module is:
[0091] S3.1: Calculation of feature contribution. According to the multi-head mutual attention model, the text features of each time step obtained in S2.2 are matched with the speech and visual features to obtain the final representation of the interactive features of speech, vision and text. The calculation process is as follows:
[0092]
[0093] Among them, h represents the number of heads in the multi-head attention mechanism, represents the trainable weight matrix of the h-th attention head, is the scaling factor.
[0094] The specific operations of the cross attention fusion module are:
[0095] S4.1: Text feature enhancement. The cross-attention mechanism is used to take the text-speech and text-visual feature representations obtained in S3.1 as weight vectors to enhance the text features. The calculation process is as follows:
[0096]
[0097] in, and X T is the input of CorAn, and K=X T W K 、V=X (A,V) W (A,V) Represent the query keywords and values of the cross attention mechanism respectively.
[0098] S4.2: Deep fusion calculation weights. Embedding text into representation As query vector and text features XT Perform deep fusion calculation weights to obtain enhanced text feature output The calculation process is as follows:
[0099]
[0100] S4.3: Attention score. Output the enhanced features obtained in S4.2 and X V→T Splicing, and obtaining the dimension reduction features through linear mapping. And using tanh and softmax activation functions to obtain the final attention score. The calculation process is as follows:
[0101]
[0102] The specific operations of the sentiment analysis result display module are:
[0103] S5.1: Calculate implicit emotion probability. The final fused implicit multimodal feature O obtained in S4.3 is input into the fully connected layer, and the emotion label is calculated using the softmax activation function. The calculation process is as follows:
[0104] y=softmax(WO O+b O )
[0105] Among them, W o and b o Represents the trainable parameters of the prediction layer.
[0106] S5.2: Use the cross entropy loss function to calculate the loss between the predicted label and the true label, and use the mean square error function to measure the difference between the fused features and the true label. The loss expression of the sentiment analysis task is as follows:
[0107]
[0108] Among them, n is the number of training samples, y is the sentiment classification prediction output, is the real sentiment label, i is and the exponential of the y values.
[0109] The loss definition of the auxiliary task feature fusion strategy is as follows:
[0110]
[0111] Among them, f i and They represent the model output of multimodal feature fusion and the true label respectively. Next, we capture the relationship between the two tasks through dot product.
[0112] R=y i ·f i
[0113] Finally, the total loss of our model is the sentiment analysis task L sentiment and auxiliary task L fusion The weighted sum of:
[0114] L joint =α·L sentiment +β·L fusion +γ·R
[0115] Among them, α, β, and γ are the weights of the loss.
[0116] In order to verify the validity and accuracy of this model,
[0117] Through 9 groups of experiments, the control groups are: BiLSTM, which outputs by stacking two layers of LSTM and combining context; MPOA-BiLSTM, a BiLSTM model with multi-level orthogonal attention; BDISA, which uses search engines to extract word definitions as external explicit sentiment features and combines them into the language model; KC-ISA, which uses knowledge graphs as a supplement to implicit sentiment expression; MFGAN, which performs implicit sentiment analysis by combining text, homology and dependency relationships; TTP, an implicit sentiment text data preprocessing method that converts text features into images;
[0118] LSTM+CNN+RF, using facial expression features and text features to analyze implicit emotions; SKEAFN, an emotion knowledge enhanced attention fusion network. The feasibility of the algorithm is verified and the accuracy index is compared with similar algorithms on the same data set. The specific experimental technical plan is as follows:
[0119] Solution 1: Feasibility verification of the model proposed by the present invention.
[0120] Solution 2: Comparison between the algorithm proposed in this invention and other similar algorithms.
[0121] The results of experimental scheme 1 are recorded in Table 1 below.
[0122]
[0123] Table 1
[0124] The results of experimental scheme 2 are shown below.
[0125]
[0126] Table 2
[0127] Table 2 shows the experimental results of the present invention on three datasets in implicit sentiment analysis tasks. The experimental data sources include SMP2019, CMU-MOSI and the multimodal implicit dataset MUMETA created by the present invention. Experiments show that for implicit sentiment classification tasks, the accuracy of the present invention is generally higher than that of the baseline method. The result analysis shows that the model can obtain more contextual information and interaction information from speech and visual features during the fusion process. The multimodal feature fusion method does help improve the performance of implicit sentiment analysis.
[0128] In the several embodiments provided by the present invention, it should be understood that the disclosed method can be implemented in other ways. For example, the embodiments described above are merely illustrative.
[0129] 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, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (Processor) to perform some steps of the above-mentioned method of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program codes.
[0130] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. An implicit sentiment analysis method, characterized in that: The method comprises: Obtaining raw data of online users and preprocessing the raw data; Based on the preprocessed data, extract multimodal data features of preset types; The multimodal data features of the preset types are subjected to feature fusion according to a preset fusion strategy to obtain fused data features, and the implicit emotions of online users are classified and predicted based on the fused data features to obtain implicit emotion classification results; Output the implicit sentiment classification result.
2. The implicit sentiment analysis method according to claim 1, characterized in that: The original data is video data; The preset types of multimodal data features include text features, voice features and visual features.
3. The implicit sentiment analysis method according to claim 2, characterized in that: The preset fusion strategy includes: A multi-head attention mechanism is used to perform bimodal fusion on the text feature and the speech feature, as well as the text feature and the visual feature, to obtain text-speech fusion features and text-visual fusion features respectively; The text features, the text-speech fusion features, and the text-visual fusion features are deeply fused based on a cross-attention mechanism to obtain the fused data features.
4. An implicit sentiment analysis device, characterized in that: include: Data preprocessing module, multimodal feature extraction module, feature fusion module and sentiment analysis result display module; The data preprocessing module is used to obtain the original data of online users and preprocess the original data; The multimodal feature extraction module is used to extract multimodal data features of preset types based on the preprocessed data; The feature fusion module is used to perform feature fusion on the multimodal data features of the preset types according to a preset fusion strategy to obtain fused data features, and classify and predict the implicit emotions of online users based on the fused data features to obtain implicit emotion classification results; The sentiment analysis result display module is used to output the implicit sentiment classification result.
5. The implicit sentiment analysis device according to claim 4, characterized in that: The multimodal feature extraction module includes: a text feature extraction module, a voice feature extraction module and a visual feature extraction module, which are used to extract text features, voice features and visual features respectively.
6. The implicit sentiment analysis device according to claim 5, characterized in that: The feature fusion module includes a text-speech multi-head mutual attention mechanism module, a text-vision multi-head mutual attention mechanism module, and a cross-attention fusion module; The text-speech multi-head mutual attention mechanism module and the text-vision multi-head mutual attention mechanism module are used to adopt a multi-head attention mechanism to perform bimodal fusion on the text features and the speech features, as well as the text features and the vision features, to obtain text-speech fusion features and text-vision fusion features, respectively; The cross-attention fusion module deeply fuses the text features, the text-speech fusion features, and the text-visual fusion features based on the cross-attention mechanism to obtain the fused data features.
7. The implicit sentiment analysis device according to claim 6, characterized in that: The feature fusion module is also used to perform linear feature dimension matching between text and speech, and between text and vision before fusing text features, speech features and visual features.
8. The implicit sentiment analysis device according to claim 7, characterized in that: The feature fusion module is also used to match the text features acquired at each time step with the speech and visual features to obtain the final representation of the interactive features of speech, vision and text. The calculation process is as follows: Among them, h represents the number of heads in the multi-head attention mechanism, represents the trainable weight matrix of the h-th attention head, is the scaling factor.
9. The implicit sentiment analysis device according to claim 8, characterized in that: The calculation process of the cross attention fusion module is: (1) Calculate text feature enhancement. The calculation process is as follows: in, and X T is the input of CorAn, and K=X T W K 、V=X (A,V) W (A,V) Represent the query keywords and values of the cross attention mechanism respectively; (2) Calculate the deep fusion calculation weights and embed the text into the representation As query vector and text features XT Perform deep fusion calculation weights to obtain enhanced text feature output The calculation process is as follows: (3) Calculate the attention score and enhance the feature output and X V→T Splicing, obtain dimensionality reduction features through linear mapping, and use tanh and softmax activation functions to obtain the final attention score. The calculation process is as follows:
10. The implicit sentiment analysis device according to claim 9, characterized in that: The specific processing process of the sentiment analysis result display module is as follows: (1) Calculate implicit emotion probability: Input the final fused implicit multimodal feature O into the fully connected layer and use the softmax activation function to calculate the emotion label. The calculation process is as follows: y =softmax(W O O+b O ) Among them, W o and b o Represents the trainable parameters of the prediction layer; (2) The cross entropy loss function is used to calculate the loss between the predicted label and the true label, and the mean square error function is used to measure the difference between the fused features and the true label; the loss expression of the sentiment analysis task is as follows: Among them, n is the number of training samples, y is the sentiment classification prediction output, is the real sentiment label, i is and the exponent of the y value; The loss definition of the auxiliary task feature fusion strategy is as follows: Among them, f i and Represent the model output and true label of multimodal feature fusion respectively; The total loss is the sentiment analysis task L sentiment and auxiliary task L fusion The weighted sum of: L joint =α·L sentiment +β·L fusion +γ·R Among them, α, β, and γ are the weights of the loss.
Citation Information
Cited By
Intelligent psychological state assessment method and system based on multi-modal alignment
CN119833145A
Information recommendation method and device, equipment and storage medium
CN120894106A
