Abnormal emotion recognition method based on improved grey wolf algorithm

By introducing strategies such as dynamic inertial weights, sine optimization, catfish effect and Levi flight into the gray wolf algorithm, the LSTM network parameter optimization is improved, and the problem that traditional gray wolf algorithms are prone to fall into local optimality is solved, and the accuracy and stability of emotion recognition and abnormal point detection are improved.

CN119580320AInactive Publication Date: 2025-03-07NANJING UNIV OF POSTS & TELECOMM
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411610833.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-12
Publication Date
2025-03-07
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The traditional gray wolf algorithm is prone to falling into local optimization when optimizing LSTM network parameters, and cannot fully improve the generalization ability and prediction accuracy of the model.

Method used

By introducing strategies such as dynamic inertial weights, sine optimization, catfish effect and Levi flight, we will improve the gray wolf algorithm and optimize the LSTM network parameters to improve global search capabilities and local exploration capabilities.

Benefits of technology

The improved Gray Wolf algorithm can more effectively avoid local optimal traps, improve diversity, balance exploration and development, thereby improving the accuracy and stability of emotion recognition and abnormal point detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119580320A_ABST
    Figure CN119580320A_ABST
Patent Text Reader

Abstract

The invention discloses an abnormal emotion recognition method based on an improved grey wolf algorithm. An individual emotion vector data set is input; setting improved grey wolf algorithm parameters and to-be-optimized LSTM network parameters, and setting parameter constraints; randomly initializing a population, and coding each individual; inputting a training set and decoding the individuals, and taking decoded vectors as LSTM network parameters for training; a target function is calculated on the test set, and the fitness score of each population is obtained; iteratively updating LSTM network parameters, and checking a termination condition; in the iteration process, a dynamic inertia weight and an orthogonal optimization strategy are adopted to optimize the step length of the improved grey wolf algorithm; catfish effect and Levy flight are adopted to carry out random walk optimization; and outputting the optimized LSTM network parameters. According to the improved grey wolf algorithm, a dynamic population and a self-adaptive step length strategy are introduced, so that the global search capability and the local exploration capability of an optimization process are improved, and more accurate emotion recognition and abnormal point detection are realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of emotion recognition, and in particular to an abnormal emotion recognition method based on an improved grey wolf algorithm. Background Art

[0002] In recent years, long short-term memory (LSTM) networks have been widely used in the field of emotion recognition due to their superior time series data processing capabilities. However, the performance of LSTM networks depends largely on the selection of their network parameters. Traditionally, the Grey Wolf Algorithm (GWO) is used as a tool to optimize LSTM network parameters, using its bionic group search mechanism to adjust network parameters. However, the traditional Grey Wolf Algorithm uses a fixed step size and static population in the optimization process, which easily causes the algorithm to fall into a local optimum in later iterations and cannot further improve the generalization ability and prediction accuracy of the model.

[0003] The original gray wolf optimization algorithm is a swarm intelligence algorithm based on the hunting behavior of gray wolves in nature. It performs well in solving complex optimization problems. However, the original gray wolf algorithm also has some shortcomings, which limit its performance on complex or high-dimensional problems. The following are some shortcomings of the original gray wolf algorithm: 1. Local Optima Trap The original Grey Wolf Algorithm is prone to falling into local optimal solutions during the search process, especially on complex multi-modal functions or high-dimensional problems. Since the Grey Wolf's behavior converges gradually, the search space will gradually shrink as the number of iterations increases, which may cause the algorithm to converge to the local optimal point prematurely.

[0004] 2. Insufficient balance between exploration and development The Grey Wolf Algorithm tends to over-explore in early iterations and over-exploit in later ones, resulting in a waste of computational resources in the early stages and a potential failure to fully explore undiscovered areas in the later stages. This imbalance affects the performance of the algorithm at different stages.

[0005] 3. Lack of diversity As iterations proceed, individuals in the gray wolf group may converge rapidly, resulting in reduced population diversity and reduced search efficiency, especially when facing complex high-dimensional problems. Summary of the invention

[0006] In order to solve the deficiencies in the prior art, the object of the present invention is to provide an abnormal emotion recognition method based on an improved grey wolf algorithm.

[0007] To achieve the purpose of the present invention, the technical solution adopted by the present invention is: An abnormal emotion recognition method based on an improved gray wolf algorithm comprises the following steps: (1) Input individual emotion vector dataset; (2) Set the parameters of the improved gray wolf algorithm and the LSTM network parameters to be optimized, and set parameter constraints; (3) Randomly initialize the population and encode each individual; (4) Input the training set and decode the individuals. The decoded vectors are used as LSTM network parameters for training. (5) Calculate the objective function on the test set and obtain the fitness score of each population; (6) Iteratively update the LSTM network parameters and check the termination conditions; (7) During the iteration process, the step size of the gray wolf algorithm is optimized and improved by using dynamic inertia weight and orthogonal optimization strategy; the catfish effect and Levy flight are used for random walk optimization; (8) Output the optimized LSTM network parameters.

[0008] Furthermore, in step (2), the parameters of the gray wolf algorithm are initialized, including setting the number of wolf packs, the maximum number of iterations, and the termination condition; the initial parameters of the LSTM network are set, including the hidden layer size, the number of network layers, the window length, the learning rate, the optimizer type, the weight decay factor, the dropout rate, the batch size, and the number of training rounds.

[0009] Furthermore, in step (3), a random value method is used to randomly generate multiple individuals within the constraint range to form a gray wolf population, and the population size, maximum number of iterations and early stopping conditions are set.

[0010] Furthermore, in step (4), before each iteration, the dimensions constrained to be integer values ​​are rounded to obtain a decoded code, and the dimensions constrained to be floating-point values ​​retain the original value. If the value exceeds the maximum range of the constraint, it is set to the maximum value of the constraint; if the value is less than the minimum value of the constraint, it is set to the minimum value of the constraint.

[0011] Furthermore, in step (5), contrast loss is selected as the optimization objective function to represent the fitness score of the individual. The specific calculation formula is as follows: ; in, It is a sample and The distance between them, m is the preset threshold.

[0012] Furthermore, in step (6), the termination condition is checked: whether the maximum number of iterations has been reached, or whether the early termination condition is met; if the condition is met, the iteration is stopped; otherwise, the next round of training and optimization is continued.

[0013] Furthermore, in step (7), the dynamic update of the inertia weight is expressed by the following formula: ; in, is the inertia weight of the tth generation; and The maximum and minimum values ​​of the inertia weight respectively; T is the total number of iterations of the algorithm; t is the current number of iterations; The dynamic update strategy of sine is expressed by the following formula: ; in, is the position vector of the next generation of wolves; is the position vector of the individual wolf; is the position vector of the current optimal solution; It is a random number that controls the step size, and its value is ; is the angle factor, usually in Randomly generated internally; The catfish effect is achieved by periodically randomly updating the positions of some individual wolves: ; in, is the randomly updated position of individual wolves, is a new position generated randomly; r is A random number between is the position of the i-th individual wolf; Each step length of the Lévy flight follows a heavy-tailed Lévy distribution, and its step length formula is defined as follows: ; Where l is the step size, Typically between 0 and 2, the direction of each step in the Levy flight is random, usually assumed to be uniformly distributed.

[0014] Furthermore, in step (1), constructing an individual emotion vector dataset for training includes the following steps: (1.1) Continuously collect data from the target system; (1.2) Processing the collected data to form multiple individual emotion vector sequences; (1.3) Using manual screening to mark abnormal points in the emotion vector sequence; (1.4) Based on the screening results, construct a training dataset containing normal emotions and abnormal emotions by combining the labeled abnormal samples with the normal samples; (1.5) Using the stratified sampling method, the constructed training data set is divided into a training set at a ratio of 80% and a test set at a ratio of 20%.

[0015] Furthermore, the emotion data collection includes the steps of: (1) The camera uses the opencv model for sensorless data collection; (2) Use the RetinaFace model for face detection; (3) Use Dlib to extract facial features and form 128-dimensional feature values; (4) Using cosine similarity to confirm face identity; (5) Use Resnet to classify micro-expressions based on facial features; (6) Add a 3-dimensional extended vector based on the 7-dimensional vector to form an individual emotion vector.

[0016] The beneficial effect of the present invention is that, compared with the prior art, the improved gray wolf algorithm of the present invention improves the global search capability and local exploration capability of the optimization process by introducing dynamic population and adaptive step size strategy. On the basis of constructing anomaly detection data set, the improved gray wolf algorithm is used to optimize the LSTM network parameters to achieve more accurate emotion recognition and anomaly detection. The present invention not only has stronger expressiveness in capturing the overall picture of emotions, but also improves the prediction accuracy and stability of the model through intelligent optimization means, and has broad application prospects. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 It is a flow chart of the abnormal emotion recognition method based on the improved grey wolf algorithm described in the present invention; Figure 2 It is a schematic diagram of individual encoding and decoding; Figure 3 It is a flow chart for constructing individual emotion vector dataset; Figure 4 It is a flow chart of emotion data collection. DETAILED DESCRIPTION

[0018] The technical solution of the present invention is further described below in conjunction with the accompanying drawings and embodiments. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the protection scope of this application.

[0019] like Figure 1 As shown, the abnormal emotion recognition method based on the improved gray wolf algorithm of the present invention comprises the following specific steps: (1) Input individual emotion vector dataset; (2) Set the parameters of the improved gray wolf algorithm and the LSTM network parameters to be optimized, and set parameter constraints; Initialize the parameters of the gray wolf algorithm, set the number of wolves to 30, the maximum number of iterations to 100, and the termination condition to an optimization rate of less than 1% after 10 iterations, as the starting point for subsequent optimization of the LSTM network parameters.

[0020] Set the initial parameters of the LSTM network, including hidden layer size, number of network layers, window length, learning rate, optimizer type, weight decay factor, dropout rate, batch size, number of training rounds, etc.

[0021] And set parameter constraints, the hidden layer size is 20 to 512, which is an integer value; the number of network layers is 2 to 10, which is an integer value; the window length is 1-100, which is a floating point value; the learning rate is 0.0001 to 0.01, which is a floating point value; the optimizer type [Adam, SGD, RMSprop], encoded as [1,2,3], is an integer value; the weight decay factor is 0 to 0.01, which is a floating point value; the Dropout rate is 0.2 to 0.5, which is a floating point value; the batch size is 16 to 128, which is an integer value; the number of training rounds is 10 to 100, which is an integer value.

[0022] (3) Randomly initialize the population and encode each individual; The random value method is used to randomly generate a population within the constraints, and the population size, maximum number of iterations and early stopping conditions are set. Multiple individuals are generated by random initialization to form a gray wolf population, and each individual is evaluated. Figure 2 As shown, the algorithm is encoded in the parameters of the LSTM that need to be optimized.

[0023] (4) Input the training set and decode the individuals. The decoded vectors are used as LSTM network parameters for training. like Figure 2 As shown in FIG. 1 , the randomly generated individual vectors are decoded and passed into the LSTM network as input data to train the LSTM network.

[0024] Before each iteration, the dimensions constrained to integer values ​​are rounded to obtain the decoded code, and the dimensions constrained to floating-point values ​​are retained with the original values, ensuring that each dimension is within its constraint range. If it exceeds the maximum range of the constraint, it is set to the maximum value of the constraint; if it is less than the minimum value of the constraint, it is set to the minimum value of the constraint.

[0025] (5) Calculate the objective function on the test set and obtain the fitness score of each population; When the LSTM model is used for outlier detection tasks, the objective function (loss function) is a key part of model training, which directly affects the performance of the model and its ability to detect outliers. When based on representation learning methods, contrast loss can be used to enhance the ability to distinguish outliers. Its purpose is to separate the representations of normal samples and abnormal samples, and to detect outliers by minimizing the distance between normal samples and maximizing the distance between normal and abnormal samples.

[0026] Based on this, contrast loss is selected as the optimization objective function to represent the individual fitness score. The specific calculation formula is as follows:

[0027] in, It is a sample and The distance between them, m is a preset threshold. In most practical applications, the value of m is usually set between 1 and 10. The present invention selects m=5.

[0028] For the output results of each LSTM network, the fitness of each individual is calculated based on the training set to evaluate its performance. According to different fitness standards (such as error minimization), the fitness of the individuals in the population is sorted, and the individuals with better fitness are selected as the basis for the next round of optimization.

[0029] (6) Iteratively update the LSTM network parameters and check the termination conditions; In each round of iteration, the individual location information is updated according to the hunting strategy of the gray wolf algorithm, that is, the LSTM network parameters are optimized. Check the termination condition: determine whether the maximum number of iterations has been reached, or whether the early termination condition is met (such as the error reaches a predetermined threshold). If the condition is met, stop the iteration; otherwise, continue with the next round of training and optimization. Test the trained LSTM network model and calculate the prediction accuracy.

[0030] (7) During the iteration process, the step size of the gray wolf algorithm is optimized and improved by using dynamic inertia weight and orthogonal optimization strategy; the catfish effect and Levy flight are used for random walk optimization; Dynamic Inertia Weight In order to improve the algorithm's balancing ability, a dynamic inertia weight is added. The inertia weight affects the algorithm's trade-off between global and local search. The dynamic update of the inertia weight can be expressed by the following formula: ; in, is the inertia weight of the generation; and are the maximum and minimum values ​​of the inertia weight respectively; T is the total number of iterations of the algorithm; t is the current number of iterations.

[0031] Sine Optimization Sine and cosine optimization is used to perform a larger global search in the early stages, and avoid falling into local optimality by dynamically adjusting the search step size. The dynamic update strategy of sine can be expressed by the following formula: ; in, is the position vector of the next generation of wolves; is the position vector of the individual wolf; is the position vector of the current optimal solution; It is a random number that controls the step size, and its value is ; is the angle factor, usually Randomly generated.

[0032] Catfish effect The catfish effect simulates the introduction of new, randomly generated wolves ("catfish") into the gray wolf pack to stimulate the vitality of the population and prevent the algorithm from converging prematurely. This is achieved by periodically randomly updating the positions of some individual wolves: ; in, is the randomly updated position of individual wolves, is a new position generated randomly; r is A random number between is the position of the i-th individual wolf.

[0033] Levi Flight Lévy Flight is a random motion model that describes the phenomenon of alternating short-distance movements and occasional long-distance jumps during a random walk. This movement pattern is widely present in nature, such as animal foraging behavior, price fluctuations in financial markets, and particle diffusion in fluid dynamics. Unlike traditional random walks, the step length of each step in Lévy flight obeys a Lévy distribution with a heavy-tailed distribution, which means that most steps are short, but occasionally very long jumps occur. The tail of the Lévy distribution decays slowly, allowing longer step lengths to appear. Its step length formula is defined as follows: ; Where l is the step size, Typically between 0 and 2. Larger Values ​​close to 2 indicate more concentrated step sizes, while smaller Higher values ​​indicate more long-distance jumps. In Levy flight, the direction of each step is random, usually assumed to be uniformly distributed. Thus, the agent can move in any direction at each step.

[0034] Introducing dynamic inertia weights can balance the process of exploration and development. By increasing the weight value in the early stage of the algorithm, more exploration is encouraged, and gradually reducing the weight in the later stage, the convergence of the algorithm is promoted and over-exploration is avoided.

[0035] Sine optimization introduces a sinusoidal function to dynamically adjust the way the gray wolf updates its position, allowing the algorithm to transition more smoothly between the exploration phase and the exploitation phase, thereby improving the global search capability.

[0036] By introducing the catfish effect, new individuals can be added to the group to increase the diversity of the population. The principle of the catfish effect is to stimulate the vitality of other gray wolf individuals by injecting foreign competitors into the group, thus preventing the population from falling into a local optimum too early.

[0037] By introducing Lévy flight, the exploration ability of the gray wolf can be enhanced. The long jump characteristics of Lévy flight allow the gray wolf to make long-distance jumps in the search space, thus breaking the local optimal trap and improving the global search ability.

[0038] By introducing dynamic inertia weight, sinusoidal optimization, catfish effect and Levy flight, the shortcomings of the original Grey Wolf Algorithm, such as local optimal trap, insufficient diversity, exploration and development balance problem and slow convergence speed, can be effectively solved. These optimization methods enhance the performance of the Grey Wolf Algorithm on complex optimization problems, making it more robust and efficient in searching for the global optimal solution.

[0039] (8) Output optimized LSTM network parameters; Finally, the optimal parameters of the LSTM network optimized by the Grey Wolf Algorithm are output and applied to the actual task of predicting abnormal points of individual emotion vector data, and warnings are issued for the identified abnormal information.

[0040] like Figure 3 As shown, constructing an individual emotion vector dataset for training includes the following steps: (1) Data collection phase: Data collection of the target system for 30 consecutive days to obtain time series data of system operation; (2) Emotion vector sequence generation stage: The collected data is processed using the above method to form multiple individual emotion vector sequences; (3) Outlier screening and confirmation stage: The outliers in the emotion vector sequence are marked by manual screening, and the outliers are confirmed by personnel with professional experience; (4) Training data set construction phase: Based on the screening results, a training data set containing normal emotions and abnormal emotions is constructed. By combining the labeled abnormal samples with the normal samples, it is ensured that the abnormal points in the training data set are fully expressed while avoiding the problem of data imbalance. (5) Dataset division stage: Using the stratified sampling method, the constructed training dataset is divided into 80% training set and 20% test set to ensure the distribution consistency of abnormal samples in the training set and test set, thereby improving the generalization ability of the model.

[0041] like Figure 4 As shown, emotional data collection includes the following steps: (1) The camera uses the opencv model for sensorless data collection; Through the camera device, video data of the surrounding environment is collected in real time, and the system automatically runs in the background and captures facial images.

[0042] (2) Use the RetinaFace model for face detection; The RetinaFace model is used to detect the face position in real time from the video frame and extract the face area. Once the face is detected, the face key points are further used to perform geometric correction on the face. The specific method is to measure the angle between the left and right eyes of the person and rotate the image by this angle to ensure that the face can maintain a consistent posture at different angles for subsequent analysis.

[0043] (3) Use Dlib to extract facial features and form 128-dimensional feature values; Use the Dlib feature point detection algorithm to accurately locate the important feature points of eyebrows, eyes, mouth, and nose on the face, and convert the face into 128-dimensional feature value data.

[0044] (4) Using cosine similarity to confirm face identity; Add a face template and use Dlib feature points to parse the face feature vector. Use cosine similarity to calculate the real-time collected face 128-dimensional features and compare them with the template features. Select the one with the largest cosine similarity as the collected person. The cosine similarity calculation formula is as follows:

[0045] and They respectively represent the components of the vector template 128-dimensional vector A and the collected face 128-dimensional vector B.

[0046] (5) Use Resnet to classify micro-expressions based on facial features; The Resnet micro-expression classification model is trained on a public dataset to classify micro-expressions using the extracted 128-dimensional facial features. Micro-expressions are classified into seven specific emotion types, including: happiness, sadness, anger, disgust, fear, contempt, and calmness.

[0047] (6) Add a 3-dimensional extended vector based on the 7-dimensional vector to form an individual emotion vector; Emotional Dimension Extension Method Based on the above 7 types of emotions, they are further divided into positive emotions (happy, calm), negative emotions (sad, angry and fear) and complex-contempt emotions (disgust and contempt). Positive emotions usually bring positive psychological experiences, negative emotions usually bring negative psychological experiences, which may cause discomfort, tension or pressure. Complex-contempt emotions belong to complex negative emotions, which usually involve strong negative evaluation or resistance to others or things, manifested as contempt and disgust. According to the above 3 special emotions, the individual emotion vectors are expanded to form a 10-dimensional emotion vector (happy, sad, angry, disgust, fear, contempt, calm, positive emotions, negative emotions, complex-contempt emotions).

[0048] Individual emotion vector quantization method In the Resnet sentiment classification task, the Softmax layer is a key component for multi-class classification, which converts the output of the model into the probability distribution of each sentiment category. Taking 7 sentiment categories (happy, sad, angry, disgusted, fearful, contemptuous, calm) as an example, the following describes the process of obtaining sentiment feature components from the Softmax layer.

[0049] In the Resnet model, after forward propagation, the output of the last layer of the network is called logits, denoted by Z. These logits are unnormalized scores, usually arbitrary real numbers. For the 7 sentiment classification problems, the model will output 7 logits components:

[0050] in, arrive Represent the prediction scores of the model for each sentiment category. The score indicating happiness, A score indicating sadness, The score indicating anger, The score indicating disgust, The score indicating fear, A score expressing contempt, A score indicating calmness.

[0051] The Softmax function is used to convert logits into probability distribution, ensuring that the sum of the probabilities of all sentiment categories is 1. The formula of the Softmax function is as follows:

[0052] The probability of each emotion category obtained by the Softmax layer is the corresponding feature component. For the seven emotion classification tasks, the output of Softmax is:

[0053] Among them, each The probability corresponding to a certain emotion category. It indicates the probability that the model predicts that the input sample is "happy", represents the probability that the model predicts that the input sample is "sad", represents the probability that the model predicts that the input sample is "angry", It indicates the probability that the model predicts that the input sample is "disgusting", represents the probability that the model predicts that the input sample is "fear", represents the probability that the model predicts that the input sample is "contemptuous", Represents the probability that the model predicts that the input sample is "calm".

[0054] The formula for calculating positive emotions is as follows:

[0055] The formula for calculating negative emotions is as follows:

[0056] The calculation formula for complex-contempt emotions is as follows:

[0057] Based on this, an expanded 10-dimensional emotion feature vector containing special emotions is constructed: .

[0058] The beneficial effect of the present invention is that, compared with the prior art, the improved gray wolf algorithm of the present invention improves the global search capability and local exploration capability of the optimization process by introducing dynamic population and adaptive step size strategy. On the basis of constructing anomaly detection data set, the improved gray wolf algorithm is used to optimize the LSTM network parameters to achieve more accurate emotion recognition and anomaly detection. The present invention not only has stronger expressiveness in capturing the overall picture of emotions, but also improves the prediction accuracy and stability of the model through intelligent optimization means, and has broad application prospects.

[0059] The applicant of the present invention has made a detailed explanation and description of the implementation examples of the present invention in conjunction with the drawings in the specification. However, those skilled in the art should understand that the above implementation examples are only preferred implementation schemes of the present invention, and the detailed description is only to help readers better understand the spirit of the present invention, but not to limit the scope of protection of the present invention. On the contrary, any improvements or modifications based on the inventive spirit of the present invention should fall within the scope of protection of the present invention.

Claims

1. An abnormal emotion recognition method based on an improved grey wolf algorithm, characterized in that: Includes steps: (1) Input individual emotion vector dataset; (2) Set the parameters of the improved gray wolf algorithm and the LSTM network parameters to be optimized, and set parameter constraints; (3) Randomly initialize the population and encode each individual; (4) Input the training set and decode the individuals. The decoded vectors are used as LSTM network parameters for training. (5) Calculate the objective function on the test set and obtain the fitness score of each population; (6) Iteratively update the LSTM network parameters and check the termination conditions; (7) During the iteration process, the step size of the gray wolf algorithm is optimized and improved by using dynamic inertia weight and orthogonal optimization strategy; the catfish effect and Levy flight are used for random walk optimization; (8) Output the optimized LSTM network parameters.

2. The abnormal emotion recognition method based on the improved gray wolf algorithm according to claim 1 is characterized in that: In step (2), the parameters of the gray wolf algorithm are initialized, including the number of wolf packs, the maximum number of iterations, and the termination condition; the initial parameters of the LSTM network are set, including the hidden layer size, the number of network layers, the window length, the learning rate, the optimizer type, the weight decay factor, the dropout rate, the batch size, and the number of training rounds.

3. The abnormal emotion recognition method based on the improved gray wolf algorithm according to claim 1 is characterized in that: In step (3), a random value method is used to randomly generate multiple individuals within the constraints to form a gray wolf population, and the population size, maximum number of iterations and early stopping conditions are set.

4. The abnormal emotion recognition method based on the improved gray wolf algorithm according to claim 1 is characterized in that: In step (4), before each iteration, the dimensions constrained to be integer values ​​are rounded to obtain the decoded code. The dimensions constrained to be floating-point values ​​retain the original value. If the value exceeds the maximum range of the constraint, it is set to the maximum value of the constraint; if the value is less than the minimum value of the constraint, it is set to the minimum value of the constraint.

5. The abnormal emotion recognition method based on the improved gray wolf algorithm according to claim 1 is characterized in that: In step (5), contrast loss is selected as the optimization objective function to represent the fitness score of the individual. The specific calculation formula is as follows: ; in, It is a sample and The distance between them, m is the preset threshold.

6. The abnormal emotion recognition method based on the improved gray wolf algorithm according to claim 1 is characterized in that: In step (6), check the termination condition: determine whether the maximum number of iterations has been reached, or whether the early termination condition is met; If the conditions are met, the iteration is stopped; otherwise, the next round of training and optimization is continued.

7. The abnormal emotion recognition method based on the improved gray wolf algorithm according to claim 1 is characterized in that: In step (7), the dynamic update of inertia weight is expressed by the following formula: ; in, is the inertia weight of the tth generation; and The maximum and minimum values ​​of the inertia weight respectively; T is the total number of iterations of the algorithm; t is the current number of iterations; The dynamic update strategy of sine is expressed by the following formula: ; in, is the position vector of the next generation of wolves; is the position vector of the individual wolf; is the position vector of the current optimal solution; It is a random number that controls the step size, and its value is ; is the angle factor, usually in Randomly generated internally; The catfish effect is achieved by periodically randomly updating the positions of some individual wolves: ; in, is the randomly updated position of individual wolves, is a new position generated randomly; r is A random number between is the position of the i-th individual wolf; Each step length of the Lévy flight follows a heavy-tailed Lévy distribution, and its step length formula is defined as follows: ; Where l is the step size, Typically between 0 and 2, the direction of each step in the Levy flight is random, usually assumed to be uniformly distributed.

8. The abnormal emotion recognition method based on the improved gray wolf algorithm according to claim 1 is characterized in that: In step (1), constructing an individual emotion vector dataset for training includes the following steps: (1.1) Continuously collect data from the target system; (1.2) Processing the collected data to form multiple individual emotion vector sequences; (1.3) Using manual screening to mark abnormal points in the emotion vector sequence; (1.4) Based on the screening results, construct a training dataset containing normal emotions and abnormal emotions by combining the labeled abnormal samples with the normal samples; (1.5) Using the stratified sampling method, the constructed training data set is divided into a training set at a ratio of 80% and a test set at a ratio of 20%.

9. The abnormal emotion recognition method based on the improved gray wolf algorithm according to claim 8 is characterized in that: Emotional data collection, including the following steps: (1) The camera uses the opencv model for sensorless data collection; (2) Use the RetinaFace model for face detection; (3) Use Dlib to extract facial features and form 128-dimensional feature values; (4) Using cosine similarity to confirm face identity; (5) Use Resnet to classify micro-expressions based on facial features; (6) Add a 3-dimensional extended vector based on the 7-dimensional vector to form an individual emotion vector.

Citation Information

Patent Citations

  • Method and system for optimizing LSTM neural network model through grey wolf algorithm

    CN115034126A

  • Lung cancer prediction method for improving moth fire suppression algorithm based on sine and cosine mechanism

    CN115458167A

  • Multi-feature outdoor environment emotion recognition method based on attention mechanism

    CN116343284A

  • Lithium ion battery health state prediction method based on IBES-DELM

    CN118259186A