Behavior analysis method and device based on facial expression, equipment, medium and product
By obtaining and analyzing the user's facial expression weight vector in the virtual scene, and combining static and dynamic features for behavioral type analysis, the problem of insufficiently comprehensive and systematic facial expression analysis in the existing technology is solved, and the accuracy and objectivity of behavioral analysis are improved. sex.
Patent Information
- Application Number
- CN202410935871.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-12
- Publication Date
- 2024-09-24
AI Technical Summary
The existing technology lacks comprehensiveness and systematicness in facial expression analysis, resulting in low accuracy of behavioral analysis and difficulty in effectively processing complex and changeable facial data.
By obtaining multiple expression weight vectors generated by users in virtual scenes, we perform facial expression feature extraction and temporal feature extraction, combine static and dynamic features for behavioral type analysis, and use temporal feature extraction models and behavioral classification models to achieve automatic recognition.
It improves the accuracy and objectivity of facial expression behavior analysis, enables a more comprehensive understanding of user behavior in virtual scenes, and enables automatic recognition of user behavior.
Smart Images

Figure CN118692129A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a behavior analysis method, device, equipment, medium and product based on facial expression. Background Art
[0002] When judging user behavior, non-verbal information (such as facial expressions, postures, and eye contact) often carries important information. Facial data, as a non-invasive biological information, contains rich emotional and cognitive information. When a user has abnormal behavior, there will be abnormalities in facial expression recognition, eye contact, and facial movements. These abnormalities can be objectively measured and evaluated by collecting and analyzing facial data.
[0003] Existing technology uses facial data to analyze user behavior through human subjective consciousness, but this method is often limited to specific facial expression or action analysis, lacks comprehensiveness and systematicity, and has certain challenges in dealing with the complexity and variability of facial data, resulting in low accuracy of behavior analysis. Summary of the invention
[0004] The present invention provides a facial expression-based behavior analysis method, device, equipment, medium and product, which are used to solve the problem of low accuracy of facial expression-based behavior analysis in the prior art.
[0005] In a first aspect, the present invention provides a behavior analysis method based on facial expression, comprising: Acquire multiple expression weight vectors generated by the user in a virtual scene; any of the expression weight vectors represents a facial expression; any of the expression weight vectors is composed of weights of multiple types of basic micro-expressions; Extract facial expression features based on the multiple expression weight vectors to obtain a facial expression feature matrix; Inputting the multiple expression weight vectors into a temporal feature extraction model to obtain an expression temporal feature vector output by the temporal feature extraction model; the temporal feature extraction model is obtained by model training based on expression weight vector samples; Behavior type analysis is performed based on the facial expression feature matrix and the expression time series feature vector to obtain the target behavior type of the user in the virtual scene.
[0006] In one embodiment, the facial expression feature matrix is formed by splicing facial expression feature vectors of multiple types of basic micro-expressions. When facial feature extraction is performed based on the multiple expression weight vectors, the following steps are performed for multiple basic micro-expressions of the same type: Respectively obtaining the sampling times of the multiple basic micro-expressions; Determine a basic micro-expression corresponding to a weight greater than zero among the weights of the multiple basic micro-expressions as a target basic micro-expression; Summing up the sampling times corresponding to the multiple target basic micro-expressions to obtain the total appearance duration of the basic micro-expressions of the type; Dividing the continuous sampling times among the sampling times corresponding to the multiple target basic micro-expressions into target time periods; The first target time period is determined as the duration of the first appearance of the basic micro-expression of the type; determining the number of the plurality of target time periods as the total number of occurrences of the type of basic micro-expressions; Dividing the total appearance duration by the total number of appearances to obtain an average appearance duration of the basic micro-expression of the type; Calculating the variance of the weights corresponding to the multiple target basic micro-expressions to obtain the weight variance of the basic micro-expression of the type; Calculating the average of the weights corresponding to the multiple target basic micro-expressions to obtain the weight average of the basic micro-expressions of the type; Summing up the weights corresponding to the multiple target basic micro-expressions to obtain a first weight sum of the type of basic micro-expressions; Determine a second weight sum of each other type of basic micro-expression; the other type of basic micro-expression refers to other types of basic micro-expressions among the multiple types of basic micro-expressions except the type of basic micro-expression; Summing the first weight sum and a plurality of second weight sums to obtain a third weight sum; Dividing the first weight sum by the third weight sum to obtain the weight proportion of the basic micro-expression of the type; Based on the total appearance duration, the first appearance duration, the average appearance duration, the weight variance, the weight mean and the weight proportion of the basic micro-expression of the type, a facial expression feature vector of the basic micro-expression of the type is constructed.
[0007] In one embodiment, the temporal feature extraction model includes a first hidden layer, a second hidden layer, a concatenation layer, an attention layer, and an output layer; the step of inputting the multiple expression weight vectors into the temporal feature extraction model to obtain the expression temporal feature vector output by the temporal feature extraction model includes: Inputting the plurality of expression weight vectors into the first hidden layer to obtain a first time series feature vector output by the first hidden layer; Inputting the first time series feature vectors into the second hidden layer respectively, to obtain a second time series feature vector output by the second hidden layer; Inputting the first time series feature vector and the second time series feature vector into the splicing layer to obtain a splicing feature matrix output by the splicing layer; Input the concatenated feature matrix into the attention layer to obtain an attention vector output by the attention layer; Performing a dot product calculation on the first time series feature vector and the attention vector through the attention layer to obtain an output result, and determining the output result as a second time series feature vector containing attention information output by the second hidden layer; The second temporal feature vector containing attention information is input into the output layer to obtain the expression temporal feature vector output by the output layer.
[0008] In one embodiment, the temporal feature extraction model is trained in the following manner: Obtaining expression weight vector samples generated by multiple subjects in the virtual scene; Based on the expression weight vector samples, unsupervised learning is performed on the first initial model to obtain the temporal feature extraction model.
[0009] In one embodiment, the behavior type analysis based on the facial expression feature matrix and the expression time series feature vector to obtain the target behavior type of the user in the virtual scene includes: Concatenating the facial expression feature matrix and the expression time series feature vector to obtain a fused feature matrix; The fused feature matrix is input into the behavior classification model to obtain a probability vector output by the behavior classification model; each component in the probability vector represents the probability of a behavior type; the behavior classification model is obtained by model training based on the fused feature matrix samples and the behavior type labels; The behavior type corresponding to the maximum component in the probability vector is determined as the target behavior type of the user in the virtual scene.
[0010] In one embodiment, the behavior classification model is trained in the following manner: Obtaining expression weight vector samples generated by multiple subjects in the virtual scene; Based on the expression weight vector samples, determining facial expression feature matrix samples and expression time series feature vector samples; Concatenate the facial expression feature matrix samples and the expression time series feature vector samples to obtain a fused feature matrix sample; Performing behavior type labeling on the fusion feature matrix samples to obtain behavior type labels; Based on the fused feature matrix samples and the behavior type labels, the second initial model is trained to obtain the behavior classification model.
[0011] In a second aspect, the present invention further provides a behavior analysis device based on facial expression, comprising: An acquisition module is used to acquire multiple expression weight vectors generated by the user in a virtual scene; any of the expression weight vectors represents a facial expression; any of the expression weight vectors is composed of weights of multiple types of basic micro-expressions; A first feature extraction module, configured to extract facial expression features based on the plurality of expression weight vectors to obtain a facial expression feature matrix; A second feature extraction module is used to input the multiple expression weight vectors into a temporal feature extraction model to obtain an expression temporal feature vector output by the temporal feature extraction model; the temporal feature extraction model is obtained by model training based on expression weight vector samples; The behavior analysis module is used to perform behavior type analysis based on the facial expression feature matrix and the expression time series feature vector to obtain the target behavior type of the user in the virtual scene.
[0012] In a third aspect, the present invention provides a device, comprising an electronic device, wherein the electronic device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of any of the above-mentioned methods for behavioral analysis based on facial expressions are implemented.
[0013] In a fourth aspect, the present invention further provides a medium, comprising a non-transitory computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of any of the above-mentioned facial expression-based behavior analysis methods are implemented.
[0014] In a fifth aspect, the present invention also provides a product, comprising a computer program product, wherein the computer program product comprises a computer program, wherein the computer program can be stored on a non-transitory computer-readable storage medium, and wherein when the computer program is executed by the processor, the steps of any of the above-mentioned facial expression-based behavior analysis methods are implemented.
[0015] The facial expression-based behavior analysis method, device, equipment, medium and product provided by the present invention can more comprehensively understand the user's behavior in the virtual scene by reflecting static features through facial expression feature extraction and reflecting dynamic features through time series feature extraction for multiple expression weight vectors generated by the user in the virtual scene, and perform behavior type analysis in combination with static features and dynamic features to obtain the user's target behavior type in the virtual scene, thereby realizing automatic recognition of the user's behavior and improving the accuracy and objectivity of behavior analysis based on facial expressions. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0017] Figure 1 It is a flow chart of the behavior analysis method based on facial expression provided by the present invention.
[0018] Figure 2 It is a structural schematic diagram of the facial expression-based behavior analysis device provided by the present invention.
[0019] Figure 3 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0020] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0021] The terms "first", "second", etc. in the present invention are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention can be implemented in an order other than those illustrated or described herein.
[0022] Combine the following Figure 1-Figure 3 The present invention describes the facial expression-based behavior analysis method, device, equipment, medium and product provided by the present invention.
[0023] Figure 1is one of the flow charts of the behavior analysis method based on facial expression provided by the present invention, such as Figure 1 As shown, the method includes the following steps 101, 102, 103 and 104.
[0024] Step 101: Acquire multiple expression weight vectors generated by the user in a virtual scene.
[0025] Step 102: extract facial expression features based on the multiple expression weight vectors to obtain a facial expression feature matrix.
[0026] Step 103: Input the multiple expression weight vectors into a temporal feature extraction model to obtain an expression temporal feature vector output by the temporal feature extraction model.
[0027] Step 104: Performing behavior type analysis based on the facial expression feature matrix and the expression time series feature vector to obtain the target behavior type of the user in the virtual scene.
[0028] It should be noted that the facial expression-based behavior analysis method provided in the embodiment of the present invention is implemented based on a facial expression-based behavior analysis device, which is referred to as the behavior analysis device below. Therefore, the embodiment of the present invention describes the facial expression-based behavior analysis method using the behavior analysis device as an example of the execution subject.
[0029] Before conducting the behavioral analysis process based on facial expressions, the user needs to wear a virtual reality (VR) device. After wearing it, the eye movement is calibrated at five points. Specifically, five fixed points are displayed in the virtual environment, and the user is required to look at these fixed points in turn to complete the eye tracking calibration, which can accurately capture the user's line of sight in the virtual environment.
[0030] After calibration is completed, the virtual scene is started, and the user sequentially executes levels to interact with objects in the virtual scene. In each level, a virtual host introduces the character content, and the user then performs the interactive task.
[0031] In one embodiment, the duration of a single level is 2 minutes, and there are 5 levels in total, so the total appearance duration of the virtual scene is 10 minutes.
[0032] In a virtual scene, users will show different emotions and expressions as the plot develops. In this process, the user's facial expression data can be collected by VR equipment according to the sampling frequency. It should be noted that each facial expression data includes the sampling time and a single expression weight vector.
[0033] In one embodiment, a Pico 4 Enterprise VR device may be used, and its facial data collection sampling frequency is 30 Hz. The virtual scene is rendered on the Pico 4 Enterprise VR device through a C++ program. The image of the virtual scene is dynamically updated according to the user's head orientation and spatial position, thereby providing a highly immersive interactive virtual reality environment, allowing users to obtain a real and vivid experience therein. The virtual character plays a medium role in the virtual scene. During the virtual plot presentation process, the virtual character uses voice to show the patient information such as the plot direction and task instructions, thereby helping the user to complete interactive tasks in the virtual environment.
[0034] In one embodiment, a level of a virtual scene may be: the virtual task waves and greets the user, then suddenly finds that his / her own items are lost, shows anxiety and sadness, then asks the user to find the items together and finds the items, showing joy.
[0035] Specifically, the behavior analysis device maps each facial expression data to a basic micro-expression, converts it into a basic micro-expression array, and obtains multiple expression weight vectors generated by the user in a virtual scene. Therefore, any expression weight vector represents a facial expression, and any expression weight vector is composed of the weights of multiple types of basic micro-expressions.
[0036] It should be noted that expression blending technology is a technology used to simulate facial expressions. It achieves various facial expressions by adjusting the vertex positions of the 3D model. A facial expression can be represented by a variety of different basic micro-expressions. Each basic micro-expression has a weight that determines the degree or intensity of the basic micro-expression in the final presentation.
[0037] In one embodiment, an expression weight vector includes 52 basic micro-expression elements, and the expression weight vector can be expressed as [weight of basic micro-expression 1, weight of basic micro-expression 2, ..., weight of basic micro-expression 52].
[0038] Then the matrix composed of 5 expression weight vectors is as follows:
[0039] Furthermore, the behavior analysis device extracts facial expression features according to the same type of basic micro-expressions based on the multiple expression weight vectors to obtain the facial expression feature vectors of each type of basic micro-expressions.
[0040] Furthermore, the behavior analysis device concatenates the facial expression feature vectors of each type of basic micro-expression to obtain a facial expression feature matrix.
[0041] Furthermore, the behavior analysis device inputs the expression weight vector into the temporal feature extraction model to obtain the expression temporal feature vector output by the temporal feature extraction model. Therefore, the expression temporal feature vector includes the temporal information of the expression weight vector.
[0042] In one embodiment, a long short-term memory (LSTM) network may be used. LSTM is a commonly used recurrent neural network architecture for solving long-term dependency problems and can effectively capture and utilize long-term dependencies in input sequences.
[0043] Furthermore, the behavior analysis device fuses the facial expression feature matrix and the expression time series feature vector to obtain a fused feature matrix.
[0044] Furthermore, the behavior analysis device performs behavior type analysis based on the fusion feature matrix to obtain the target behavior type of the user in the virtual scene.
[0045] It should be noted that the behavioral analysis method based on facial expressions can be subsequently used to assist in disease diagnosis or treatment decisions, such as autism and other diseases related to user behavior patterns. It can also be applied to product application evaluation, advertising effectiveness evaluation, etc., without limitation here.
[0046] The behavior analysis method based on facial expression provided by the present invention can reflect static features of multiple expression weight vectors generated by the user in a virtual scene by extracting facial expression features, and reflect dynamic features by extracting time series features, so that the user's behavior in the virtual scene can be understood more comprehensively, and the behavior type analysis is performed in combination with the static features and the dynamic features to obtain the target behavior type of the user in the virtual scene, thereby realizing automatic recognition of the user's behavior and improving the accuracy and objectivity of the behavior analysis based on facial expression.
[0047] Furthermore, when facial feature extraction is performed based on the multiple expression weight vectors, the following steps are performed for multiple basic micro-expressions of the same type: Respectively obtaining the sampling times of the multiple basic micro-expressions; Determine a basic micro-expression corresponding to a weight greater than zero among the weights of the multiple basic micro-expressions as a target basic micro-expression; Summing up the sampling times corresponding to the multiple target basic micro-expressions to obtain the total appearance duration of the basic micro-expressions of the type; Dividing the continuous sampling times among the sampling times corresponding to the multiple target basic micro-expressions into target time periods; The first target time period is determined as the duration of the first appearance of the basic micro-expression of the type; determining the number of the plurality of target time periods as the total number of occurrences of the type of basic micro-expressions; Dividing the total appearance duration by the total number of appearances to obtain an average appearance duration of the basic micro-expression of the type; Calculating the variance of the weights corresponding to the multiple target basic micro-expressions to obtain the weight variance of the basic micro-expression of the type; Calculating the average of the weights corresponding to the multiple target basic micro-expressions to obtain the weight average of the basic micro-expressions of the type; Summing up the weights corresponding to the multiple target basic micro-expressions to obtain a first weight sum of the type of basic micro-expressions; Determine a second weight sum of each other type of basic micro-expression; the other type of basic micro-expression refers to other types of basic micro-expressions among the multiple types of basic micro-expressions except the type of basic micro-expression; Summing the first weight sum and a plurality of second weight sums to obtain a third weight sum; Dividing the first weight sum by the third weight sum to obtain the weight proportion of the basic micro-expression of the type; Based on the total appearance duration, the first appearance duration, the average appearance duration, the weight variance, the weight mean and the weight proportion of the basic micro-expression of the type, a facial expression feature vector of the basic micro-expression of the type is constructed.
[0048] It should be noted that each facial expression data is recorded with a corresponding sampling time, so the expression weight vector obtained by converting the facial expression data also corresponds to the same sampling time, and various types of basic micro-expressions in the expression weight vector also correspond to the same sampling time.
[0049] In addition, during the sampling process, all facial expression data collected are time-series, so all expression weight vectors are also time-series, and all basic micro-expressions of the same type are also time-series.
[0050] The following is a specific description of the same type of basic micro-expressions of multiple expression weight vectors.
[0051] Specifically, the behavior analysis device obtains the sampling time of multiple basic micro-expressions respectively.
[0052] Furthermore, the behavior analysis device determines the basic micro-expression corresponding to the weight greater than 0 among the weights of multiple basic micro-expressions as the target basic micro-expression. It should be noted that when the weight of a basic micro-expression is greater than 0, it means that the basic micro-expression can be used to form a facial expression.
[0053] Furthermore, the behavior analysis device sums up the sampling times corresponding to the multiple target basic micro-expressions to obtain the total appearance duration of the type of basic micro-expressions.
[0054] Furthermore, the behavior analysis device divides a plurality of continuous sampling times among the sampling times corresponding to the plurality of target basic micro-expressions into target time periods to obtain a plurality of target time periods.
[0055] Furthermore, the behavior analysis device determines the first target time period, that is, the first target time period when the current type of basic micro-expression appears, as the first appearance duration of the current type of basic micro-expression.
[0056] Furthermore, the target time period during which the target basic micro-expression appears continuously is assumed by default to be one appearance of the target basic micro-expression. Therefore, the behavior analysis device determines the number of the multiple target time periods as the total number of appearances of the current type of basic micro-expression.
[0057] Furthermore, the behavior analysis device divides the total appearance duration of the current type of basic micro-expression by the total number of appearances of the current type of basic micro-expression to obtain an average appearance duration of the current type of basic micro-expression.
[0058] Furthermore, the behavior analysis device performs variance calculation on the weights corresponding to the multiple target basic micro-expressions respectively, and obtains the weight variance of the current type of basic micro-expression.
[0059] Furthermore, the behavior analysis device calculates the mean of the weights corresponding to the multiple target basic micro-expressions, and obtains the weight mean of the current type of basic micro-expression.
[0060] Furthermore, the behavior analysis device calculates the sum of the weights corresponding to the multiple target basic micro-expressions to obtain a first weight sum of the current type of basic micro-expressions.
[0061] Furthermore, the behavior analysis device calculates a second weighted sum of each other type of basic micro-expression, wherein other types of basic micro-expressions refer to other types of basic micro-expressions among multiple types of basic micro-expressions except the current type of basic micro-expression.
[0062] Furthermore, the behavior analysis device sums the first weight sum and the second weight sum to obtain a third weight sum.
[0063] Furthermore, the behavior analysis device divides the first weight sum by the third weight sum to obtain the weight ratio of the current type of basic micro-expression.
[0064] Further, the behavior analysis device constructs a facial expression feature vector of the current type of basic micro-expression based on the total appearance time, first appearance duration, average appearance time, weight variance, weight mean and weight proportion of the type of basic micro-expression. Therefore, the facial expression feature vector of the current type of basic micro-expression is as follows:
[0065] Therefore, after obtaining the facial expression feature vector of each type of basic micro-expression in the above manner, the behavior analysis device splices the facial expression feature vectors of multiple types of basic micro-expressions to obtain a facial expression feature matrix.
[0066] The embodiment of the present invention constructs a facial expression feature vector based on the analysis and calculation of duration, frequency, weight, etc., which can comprehensively capture the comprehensive features of basic micro-expressions, effectively express the details and features of facial expressions, and provide more detailed data support for subsequent behavioral analysis.
[0067] Further, based on step 103, the inputting of the plurality of expression weight vectors into a temporal feature extraction model to obtain an expression temporal feature vector output by the temporal feature extraction model comprises: Inputting the plurality of expression weight vectors into the first hidden layer to obtain a first time series feature vector output by the first hidden layer; Inputting the first time series feature vectors into the second hidden layer respectively, to obtain a second time series feature vector output by the second hidden layer; Inputting the first time series feature vector and the second time series feature vector into the splicing layer to obtain a splicing feature matrix output by the splicing layer; Input the concatenated feature matrix into the attention layer to obtain an attention vector output by the attention layer; Performing a dot product calculation on the first time series feature vector and the attention vector through the attention layer to obtain an output result, and determining the output result as a second time series feature vector containing attention information output by the second hidden layer; The second temporal feature vector containing attention information is input into the output layer to obtain the expression temporal feature vector output by the output layer.
[0068] It should be noted that, in one embodiment, a plurality of frames of facial expression data collected by the user in a virtual scene are formed into a time series vector E={x0,x1,...,x k}, considering that the duration of each virtual task is different, the number of frames of the collected facial expression data is also different. In order to ensure the output quality, the facial expression data collected within all level time periods can be sampled, and a fixed N frame data, that is, N one-dimensional time series vectors, are sampled and input into the LSTM network to meet the input requirements of the LSTM network.
[0069] Specifically, the behavior analysis device inputs multiple expression weight vectors into the first hidden layer respectively, and the first hidden layer learns to capture the time series pattern in the input data to obtain multiple first time series feature vectors output by the first hidden layer.
[0070] Furthermore, the behavior analysis device inputs the multiple first time series feature vectors into the second hidden layer respectively, and the second hidden layer further learns and extracts higher-level time series features to obtain multiple second time series feature vectors output by the second hidden layer.
[0071] Furthermore, the behavior analysis device inputs the plurality of first time series feature vectors and the plurality of second time series feature vectors into the splicing layer, and the splicing layer splices the plurality of first time series feature vectors and the plurality of second time series feature vectors to obtain a splicing feature matrix output by the splicing layer.
[0072] Furthermore, the behavior analysis device inputs the concatenated feature matrix into the attention layer, and the attention layer weights the concatenated feature matrix to obtain an attention vector output by the attention layer, wherein the attention vector will contain the time series pattern and time series features learned in the previous layer.
[0073] It should be noted that the attention layer is mainly composed of a fully connected layer, a normalized Softmax calculation layer and a dot product calculation layer. The attention layer weights the concatenated feature matrix as follows: the concatenated feature matrix is input into the fully connected layer, and the result of the fully connected layer output is numerically circled through the Softmax calculation layer, and then the output of the fully connected layer is normalized to between 0 and 1, and the sum of all elements of the output vector of the Softmax calculation layer is 1. The above properties meet the requirements of the weight value, and the output vector of the Softmax calculation layer is further dot-producted with the first time series feature vector through the dot product calculation layer to obtain the output result, and the output result is determined as the second time series feature vector containing attention information output by the second hidden layer.
[0074] Furthermore, the behavior analysis device inputs the second temporal feature vector containing the attention information into the output layer, which performs further processing and mapping to obtain the expression temporal feature vector output by the output layer.
[0075] The embodiment of the present invention can effectively capture the temporal information in the expression weight vector through the temporal feature extraction model, and strengthen the expression of key features through the attention mechanism, thereby improving the accuracy of the characterization of facial expression features and providing more detailed data support for subsequent behavioral analysis.
[0076] Furthermore, the temporal feature extraction model is trained in the following way: Obtaining expression weight vector samples generated by multiple subjects in the virtual scene; Based on the expression weight vector samples, unsupervised learning is performed on the first initial model to obtain the temporal feature extraction model.
[0077] Specifically, the behavior analysis device obtains expression weight vector samples generated by multiple subjects in a virtual scene.
[0078] Furthermore, the behavior analysis device performs unsupervised learning on the first initial model based on the expression weight vector samples to obtain a trained time feature extraction model.
[0079] It should be noted that unsupervised learning is a machine learning method in which the model attempts to discover patterns and structures in the data without labels. In this case, the model automatically adjusts parameters to maximize the extraction of temporal features by observing the patterns and changes in expression weight vector samples.
[0080] The embodiment of the present invention utilizes a large number of expression weight vector samples and effectively captures the temporal information of the expression weight vector samples through unsupervised learning, so that the model has better generalization ability and accuracy in the task of temporal feature extraction.
[0081] Further, based on step 104, the behavior type analysis is performed based on the facial expression feature matrix and the expression time series feature vector to obtain the target behavior type of the user in the virtual scene, including: Concatenating the facial expression feature matrix and the expression time series feature vector to obtain a fused feature matrix; The fused feature matrix is input into the behavior classification model to obtain a probability vector output by the behavior classification model; each component in the probability vector represents the probability of a behavior type; the behavior classification model is obtained by model training based on the fused feature matrix samples and the behavior type labels; The behavior type corresponding to the maximum component in the probability vector is determined as the target behavior type of the user in the virtual scene.
[0082] Specifically, the behavior analysis device concatenates the facial expression feature matrix and the expression time series feature vector to obtain a fused feature matrix with richer and more comprehensive information.
[0083] Furthermore, the behavior analysis device inputs the fused feature matrix into the behavior classification model to obtain a probability vector output by the behavior classification model, wherein each component in the probability vector represents the probability of a behavior type.
[0084] It should be noted that the behavior classification model can use a multi-layer perceptron network, which mainly includes a fully connected layer and a Softmax calculation layer. The fusion feature matrix is mapped into a probability vector P={p1,p2,...,p c}, the probability vector P has c components, each component represents the probability that the input sample belongs to one of the c categories, and the calculation formula of its mapping method is as follows:
[0085] Among them, X represents the fusion feature matrix, e represents the natural logarithm, f i represents the i-th element in the output vector of the fully connected layer, and c represents that there are c elements in the output vector of the fully connected layer.
[0086] Furthermore, the behavior analysis device compares the numerical values of each component in the probability vector to obtain a numerical comparison result.
[0087] Furthermore, the behavior analysis device determines the behavior type corresponding to the maximum component in the probability vector as the target behavior type of the user in the virtual scene according to the numerical comparison result.
[0088] The embodiment of the present invention combines the static features reflected by the facial expression feature matrix and the dynamic features reflected by the expression time series feature vector to perform behavior type analysis, obtain the target behavior type of the user in the virtual scene, realize automatic recognition of the user's behavior, and improve the accuracy and objectivity of behavior analysis based on facial expressions.
[0089] Furthermore, the behavior classification model is trained in the following way: Obtaining expression weight vector samples generated by multiple subjects in the virtual scene; Based on the expression weight vector samples, determining facial expression feature matrix samples and expression time series feature vector samples; Concatenate the facial expression feature matrix samples and the expression time series feature vector samples to obtain a fused feature matrix sample; Performing behavior type labeling on the fusion feature matrix samples to obtain behavior type labels; Based on the fused feature matrix samples and the behavior type labels, the second initial model is trained to obtain the behavior classification model.
[0090] Specifically, the behavior analysis device obtains expression weight vector samples generated by multiple subjects in a virtual scene.
[0091] Furthermore, the behavior analysis device extracts facial expression features based on the expression weight vector samples to obtain facial expression feature matrix samples.
[0092] Furthermore, the behavior analysis device inputs the facial expression weight vector samples into the temporal feature extraction model to obtain the expression temporal feature vector samples output by the temporal feature extraction model.
[0093] Furthermore, the behavior analysis device concatenates the facial expression feature matrix samples and the expression time series feature vector samples to obtain a fused feature matrix sample.
[0094] Furthermore, the behavior analysis device annotates the behavior type of the fused feature matrix samples to obtain a behavior type label.
[0095] Furthermore, the behavior analysis device trains the second initial model based on the fused feature matrix samples and the behavior type labels to obtain a behavior classification model.
[0096] The embodiments of the present invention combine facial expression features and time sequence information, effectively improve the accuracy and robustness of behavior classification, and provide powerful technical support for behavior analysis.
[0097] The facial expression-based behavior analysis device provided by the present invention is described below. The facial expression-based behavior analysis device described below and the facial expression-based behavior analysis method described above can be referenced to each other.
[0098] Reference Figure 2 , Figure 2 It is a structural schematic diagram of the facial expression-based behavior analysis device provided by the present invention.
[0099] The behavior analysis device based on facial expression comprises: The acquisition module 210 is used to acquire multiple expression weight vectors generated by the user in a virtual scene; any of the expression weight vectors represents a facial expression; and any of the expression weight vectors is composed of weights of multiple types of basic micro-expressions.
[0100] The first feature extraction module 220 is used to extract facial expression features based on the multiple expression weight vectors to obtain a facial expression feature matrix.
[0101] The second feature extraction module 230 is used to input the multiple expression weight vectors into a temporal feature extraction model to obtain an expression temporal feature vector output by the temporal feature extraction model; the temporal feature extraction model is obtained by model training based on expression weight vector samples.
[0102] The behavior analysis module 240 is used to perform behavior type analysis based on the facial expression feature matrix and the expression time series feature vector to obtain the target behavior type of the user in the virtual scene.
[0103] The facial expression-based behavior analysis device provided by the present invention can reflect static features of multiple expression weight vectors generated by the user in a virtual scene by extracting facial expression features, and reflect dynamic features by extracting time series features. The user's behavior in the virtual scene can be understood more comprehensively, and the static features and dynamic features are combined to perform behavior type analysis, so as to obtain the target behavior type of the user in the virtual scene, realize automatic recognition of the user's behavior, and improve the accuracy and objectivity of the behavior analysis based on facial expressions.
[0104] Furthermore, the first feature extraction module 220 is also used for: Respectively obtaining the sampling times of the multiple basic micro-expressions; Determine a basic micro-expression corresponding to a weight greater than zero among the weights of the multiple basic micro-expressions as a target basic micro-expression; Summing up the sampling times corresponding to the multiple target basic micro-expressions to obtain the total appearance duration of the basic micro-expressions of the type; Dividing the continuous sampling times among the sampling times corresponding to the multiple target basic micro-expressions into target time periods; The first target time period is determined as the duration of the first appearance of the basic micro-expression of the type; determining the number of the plurality of target time periods as the total number of occurrences of the type of basic micro-expressions; Dividing the total appearance duration by the total number of appearances to obtain an average appearance duration of the basic micro-expression of the type; Calculating the variance of the weights corresponding to the multiple target basic micro-expressions to obtain the weight variance of the basic micro-expression of the type; Calculating the average of the weights corresponding to the multiple target basic micro-expressions to obtain the weight average of the basic micro-expressions of the type; Summing up the weights corresponding to the multiple target basic micro-expressions to obtain a first weight sum of the type of basic micro-expressions; Determine a second weight sum of each other type of basic micro-expression; the other type of basic micro-expression refers to other types of basic micro-expressions among the multiple types of basic micro-expressions except the type of basic micro-expression; Summing the first weight sum and a plurality of second weight sums to obtain a third weight sum; Dividing the first weight sum by the third weight sum to obtain the weight proportion of the basic micro-expression of the type; Based on the total appearance duration, the first appearance duration, the average appearance duration, the weight variance, the weight mean and the weight proportion of the basic micro-expression of the type, a facial expression feature vector of the basic micro-expression of the type is constructed.
[0105] Furthermore, the second feature extraction module 230 is also used for: Inputting the plurality of expression weight vectors into the first hidden layer to obtain a first time series feature vector output by the first hidden layer; Inputting the first time series feature vectors into the second hidden layer respectively, to obtain a second time series feature vector output by the second hidden layer; Inputting the first time series feature vector and the second time series feature vector into the splicing layer to obtain a splicing feature matrix output by the splicing layer; Input the concatenated feature matrix into the attention layer to obtain an attention vector output by the attention layer; Performing a dot product calculation on the first time series feature vector and the attention vector through the attention layer to obtain an output result, and determining the output result as a second time series feature vector containing attention information output by the second hidden layer; The second temporal feature vector containing attention information is input into the output layer to obtain the expression temporal feature vector output by the output layer.
[0106] Furthermore, the facial expression-based behavior analysis device is also used for: Obtaining expression weight vector samples generated by multiple subjects in the virtual scene; Based on the expression weight vector samples, unsupervised learning is performed on the first initial model to obtain the temporal feature extraction model.
[0107] Furthermore, the behavior analysis module 240 is also used for: Concatenating the facial expression feature matrix and the expression time series feature vector to obtain a fused feature matrix; The fused feature matrix is input into the behavior classification model to obtain a probability vector output by the behavior classification model; each component in the probability vector represents the probability of a behavior type; the behavior classification model is obtained by model training based on the fused feature matrix samples and the behavior type labels; The behavior type corresponding to the maximum component in the probability vector is determined as the target behavior type of the user in the virtual scene.
[0108] Furthermore, the facial expression-based behavior analysis device is also used for: Obtaining expression weight vector samples generated by multiple subjects in the virtual scene; Based on the expression weight vector samples, determining facial expression feature matrix samples and expression time series feature vector samples; Concatenate the facial expression feature matrix samples and the expression time series feature vector samples to obtain a fused feature matrix sample; Performing behavior type labeling on the fusion feature matrix samples to obtain behavior type labels; Based on the fused feature matrix samples and the behavior type labels, the second initial model is trained to obtain the behavior classification model.
[0109] Figure 3 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 3 As shown, the electronic device may include: a processor 310, a communication interface 320, a memory 330 and a communication bus 340, wherein the processor 310, the communication interface 320 and the memory 330 communicate with each other through the communication bus 340. The processor 310 may call the logic instructions in the memory 330 to execute the behavior analysis method based on facial expression, the method comprising: obtaining multiple expression weight vectors generated by the user in a virtual scene; any of the expression weight vectors represents a facial expression; any of the expression weight vectors is composed of weights of multiple types of basic micro-expressions; facial expression feature extraction is performed based on the multiple expression weight vectors to obtain a facial expression feature matrix; the multiple expression weight vectors are input into a temporal feature extraction model to obtain an expression temporal feature vector output by the temporal feature extraction model; the temporal feature extraction model is obtained by model training based on expression weight vector samples; behavior type analysis is performed based on the facial expression feature matrix and the expression temporal feature vector to obtain the target behavior type of the user in the virtual scene.
[0110] In addition, the logic instructions in the above-mentioned memory 330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product 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.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0111] On the other hand, the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the facial expression-based behavior analysis method provided in the above-mentioned embodiments, the method including: obtaining multiple expression weight vectors generated by a user in a virtual scene; any of the expression weight vectors represents a facial expression; any of the expression weight vectors is composed of weights of multiple types of basic micro-expressions; facial expression feature extraction is performed based on the multiple expression weight vectors to obtain a facial expression feature matrix; the multiple expression weight vectors are input into a timing feature extraction model to obtain an expression timing feature vector output by the timing feature extraction model; the timing feature extraction model is obtained by model training based on expression weight vector samples; behavior type analysis is performed based on the facial expression feature matrix and the expression timing feature vector to obtain the target behavior type of the user in the virtual scene.
[0112] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the facial expression-based behavior analysis method provided in the above-mentioned embodiments, the method comprising: obtaining multiple expression weight vectors generated by a user in a virtual scene; any of the expression weight vectors represents a facial expression; any of the expression weight vectors is composed of weights of multiple types of basic micro-expressions; facial expression feature extraction is performed based on the multiple expression weight vectors to obtain a facial expression feature matrix; the multiple expression weight vectors are input into a temporal feature extraction model to obtain an expression temporal feature vector output by the temporal feature extraction model; the temporal feature extraction model is obtained by model training based on expression weight vector samples; behavior type analysis is performed based on the facial expression feature matrix and the expression temporal feature vector to obtain the target behavior type of the user in the virtual scene.
[0113] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. Those of ordinary skill in the art may understand and implement the present invention without creative effort.
[0114] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0115] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A behavior analysis method based on facial expression, characterized in that: include: Obtaining multiple expression weight vectors generated by the user in a virtual scene; Any of the expression weight vectors represents a facial expression; Any of the above expression weight vectors is composed of weights of multiple types of basic micro-expressions; Extract facial expression features based on the multiple expression weight vectors to obtain a facial expression feature matrix; Inputting the plurality of expression weight vectors into a temporal feature extraction model to obtain an expression temporal feature vector output by the temporal feature extraction model; The temporal feature extraction model is obtained by training the model based on expression weight vector samples; Behavior type analysis is performed based on the facial expression feature matrix and the expression time series feature vector to obtain the target behavior type of the user in the virtual scene.
2. The facial expression-based behavior analysis method according to claim 1, characterized in that: The facial expression feature matrix is formed by splicing facial expression feature vectors of multiple types of basic micro-expressions. When facial feature extraction is performed based on the multiple expression weight vectors, the following steps are performed for multiple basic micro-expressions of the same type: Respectively obtaining the sampling times of the multiple basic micro-expressions; Determine a basic micro-expression corresponding to a weight greater than zero among the weights of the multiple basic micro-expressions as a target basic micro-expression; Summing up the sampling times corresponding to the multiple target basic micro-expressions to obtain the total appearance duration of the basic micro-expressions of the type; Dividing the continuous sampling times among the sampling times corresponding to the multiple target basic micro-expressions into target time periods; The first target time period is determined as the duration of the first appearance of the basic micro-expression of the type; determining the number of the plurality of target time periods as the total number of occurrences of the type of basic micro-expressions; Dividing the total appearance duration by the total number of appearances to obtain an average appearance duration of the basic micro-expression of the type; Calculating the variance of the weights corresponding to the multiple target basic micro-expressions to obtain the weight variance of the basic micro-expression of the type; Calculating the average of the weights corresponding to the multiple target basic micro-expressions to obtain the weight average of the basic micro-expressions of the type; Summing up the weights corresponding to the multiple target basic micro-expressions to obtain a first weight sum of the type of basic micro-expressions; Determine a second weight sum of each other type of basic micro-expression; the other type of basic micro-expression refers to other types of basic micro-expressions among the multiple types of basic micro-expressions except the type of basic micro-expression; Summing the first weight sum and a plurality of second weight sums to obtain a third weight sum; Dividing the first weight sum by the third weight sum to obtain the weight proportion of the basic micro-expression of the type; Based on the total appearance duration, the first appearance duration, the average appearance duration, the weight variance, the weight mean and the weight proportion of the basic micro-expression of the type, a facial expression feature vector of the basic micro-expression of the type is constructed.
3. The behavior analysis method based on facial expression according to claim 1, characterized in that: The temporal feature extraction model includes a first hidden layer, a second hidden layer, a concatenation layer, an attention layer and an output layer; The step of inputting the plurality of expression weight vectors into a temporal feature extraction model to obtain an expression temporal feature vector output by the temporal feature extraction model comprises: Inputting the plurality of expression weight vectors into the first hidden layer to obtain a first time series feature vector output by the first hidden layer; Inputting the first time series feature vectors into the second hidden layer respectively, to obtain a second time series feature vector output by the second hidden layer; Inputting the first time series feature vector and the second time series feature vector into the splicing layer to obtain a splicing feature matrix output by the splicing layer; Input the concatenated feature matrix into the attention layer to obtain an attention vector output by the attention layer; Performing a dot product calculation on the first time series feature vector and the attention vector through the attention layer to obtain an output result, and determining the output result as a second time series feature vector containing attention information output by the second hidden layer; The second temporal feature vector containing attention information is input into the output layer to obtain the expression temporal feature vector output by the output layer.
4. The facial expression-based behavior analysis method according to claim 3, characterized in that: The temporal feature extraction model is trained in the following way: Obtaining expression weight vector samples generated by multiple subjects in the virtual scene; Based on the expression weight vector samples, unsupervised learning is performed on the first initial model to obtain the temporal feature extraction model.
5. The facial expression-based behavior analysis method according to claim 1, characterized in that: The performing behavior type analysis based on the facial expression feature matrix and the expression time series feature vector to obtain the target behavior type of the user in the virtual scene includes: Concatenating the facial expression feature matrix and the expression time series feature vector to obtain a fused feature matrix; The fused feature matrix is input into the behavior classification model to obtain a probability vector output by the behavior classification model; each component in the probability vector represents the probability of a behavior type; the behavior classification model is obtained by model training based on the fused feature matrix samples and the behavior type labels; The behavior type corresponding to the maximum component in the probability vector is determined as the target behavior type of the user in the virtual scene.
6. The method for analyzing facial expression-based behavior according to claim 5, characterized in that: The behavior classification model is trained in the following way: Obtaining expression weight vector samples generated by multiple subjects in the virtual scene; Based on the expression weight vector samples, determining facial expression feature matrix samples and expression time series feature vector samples; Concatenate the facial expression feature matrix samples and the expression time series feature vector samples to obtain a fused feature matrix sample; Performing behavior type labeling on the fusion feature matrix samples to obtain behavior type labels; Based on the fused feature matrix samples and the behavior type labels, the second initial model is trained to obtain the behavior classification model.
7. A behavior analysis device based on facial expression, characterized in that: include: An acquisition module, used to acquire multiple expression weight vectors generated by the user in a virtual scene; Any of the expression weight vectors represents a facial expression; Any of the above expression weight vectors is composed of weights of multiple types of basic micro-expressions; A first feature extraction module, configured to extract facial expression features based on the plurality of expression weight vectors to obtain a facial expression feature matrix; A second feature extraction module, used for inputting the plurality of expression weight vectors into a temporal feature extraction model to obtain an expression temporal feature vector output by the temporal feature extraction model; The temporal feature extraction model is obtained by training the model based on expression weight vector samples; The behavior analysis module is used to perform behavior type analysis based on the facial expression feature matrix and the expression time series feature vector to obtain the target behavior type of the user in the virtual scene.
8. A device, comprising an electronic device, the electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the facial expression-based behavior analysis method according to any one of claims 1 to 6 are implemented.
9. A medium, comprising a non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the facial expression-based behavior analysis method according to any one of claims 1 to 6 are implemented.
10. A product, comprising a computer program product, wherein the computer program product comprises a computer program, characterized in that When the computer program is executed by a processor, the steps of the facial expression-based behavior analysis method according to any one of claims 1 to 6 are implemented.
