A facial expression recognition method based on visual self-attention network

By using visual self-attention network in expression recognition and integrating local image information, the problem of insufficient global feature extraction in the prior art is solved, and the accuracy and real-timeness of expression recognition are improved.

CN113033310BActive Publication Date: 2025-01-14BEIJING UNIV OF TECH
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202110210515.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-25
Publication Date
2025-01-14
Estimated Expiration
2041-02-25

AI Technical Summary

Technical Problem

The existing deep learning-based expression recognition methods mainly extract features from global images, and fail to effectively utilize local image information, resulting in a decrease in recognition accuracy under environmental interference such as facial individual attribute differences, lighting and occlusion.

Method used

Using visual self-attention network, through the transformation of the Transformer model in the field of natural language processing, a self-attention network suitable for the visual field can be constructed, which can consider the mutual influence between local images and integrate them to extract more discriminant image features.

Benefits of technology

It improves the accuracy of expression recognition, can surpass the current state-of-the-art methods on multiple popular expression data sets, and achieves real-time recognition effects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113033310B_ABST
    Figure CN113033310B_ABST
Patent Text Reader

Abstract

A method for facial expression recognition based on a visual self-attention network belongs to the field of image recognition, and enables machines to comprehensively consider local information of facial expressions similar to humans. The main process of the present invention is: S1: data preparation, inputting the training data set into the local image generation module to obtain a local image; S2: inputting the local image into the designed visual self-attention network for training to obtain a trained model; S3: sending the image to be recognized after preprocessing into the trained visual self-attention network for recognition to obtain the result. The present invention uses a visual self-attention network to pay attention to the mutual influence between local images, and can fuse the robust features of different local images to comprehensively consider the information of local images, so that the features finally expressed by the image are more robust. Experimental verification shows that the network designed by the present invention has surpassed the recognition accuracy of the most advanced methods on multiple data sets, verifying the effectiveness of the present invention.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image recognition, and in particular to an expression recognition method based on deep learning and self-attention mechanism. Background Art

[0002] Nowadays, machines are still unable to accurately understand and experience human emotions. It can be said that machines are still in the "weak" artificial intelligence stage. If machines can accurately understand human emotions and achieve human-machine interaction, they can be pushed to the "strong" artificial intelligence stage. In the field of marketing, if machines can accurately identify the degree of customer preference for a certain product, merchants can make certain marketing strategies and market decisions based on this to promote economic development; in the field of public safety, if machines can judge someone's abnormal emotions, crimes can be prevented in time; in the field of campus education, if machines can recognize the expressions made by students based on their understanding of a certain knowledge point, teachers can adjust teaching strategies and teaching progress in time; in the field of safe driving, if the human-computer interaction system can judge the driver's driving behavior and status based on the driver's expression and verbal expression, dangerous accidents can be avoided in time. Therefore, it is particularly important to study robots with emotion recognition, especially those that can accurately judge facial expressions, in real life.

[0003] According to the method of extracting facial expression features, expression recognition methods can be divided into two categories: one is the traditional expression recognition method based on artificially designed features, and the other is the expression recognition method based on deep learning. The expression recognition method using artificially designed features is relatively mature, but it can only extract artificially set features. The extracted features are relatively simple, the feature expression ability is insufficient, and the adaptability is poor. Expression recognition based on deep learning is an end-to-end learning method. It can learn the potential diverse features in the image and is robust to light changes and head deflection. In recent years, expression recognition methods based on deep learning have become mainstream. Although most methods have achieved great improvements in recognition rate, they only extract features from the global image of the expression without considering local image information. Due to the interference of external environments such as differences in human individual attributes, lighting, occlusion, etc., the global image is greatly affected, and there will be some useless information that interferes with the recognition of the model. This is an area that needs improvement.

[0004] The patent applied for by Shenzhen Dianmao Technology Co., Ltd., "A method, device and equipment for facial expression recognition based on deep learning" (patent application number 202011345478.X, publication number CN112149651A), discloses a method for facial expression recognition based on deep learning. The patent uses a generative adversarial network and original images to generate rich expression images for training the network, which alleviates the problem of model overfitting and improves the recognition accuracy. The shortcomings of the method disclosed in this patent application are: it extracts expression features from the global image, and does not integrate some local information of the face to recognize expressions like humans do, because when humans observe expressions, they first look at several local information of the face, and then comprehensively consider what the expression is. In order to make up for the shortcomings of the current recognition method and imitate the human eye's expression recognition mechanism, the present invention proposes an expression recognition method based on a visual self-attention network. Summary of the invention

[0005] In order to make the model comprehensively consider the information of different local images to improve the discriminative expression of features, the present invention proposes a self-attention network suitable for the visual field. Specifically, in order to fuse the robust features of local images, the present invention transforms the Transformer model in the field of natural language processing to form a visual self-attention network, which can take into account the mutual influence between local images, fuse different local image features with each other, and make the extracted image features have a more discriminative expression.

[0006] To achieve the above object, the technical solution adopted by the present invention is a method for facial expression recognition based on a visual self-attention network, which is implemented according to the following steps:

[0007] S1: Data preparation, inputting the training data into the local image generation module to obtain the local image;

[0008] This step is used to obtain three local expression images for each training data.

[0009] S2: Input the local image into the visual self-attention network for training to obtain a trained model;

[0010] This step trains the visual self-attention network based on the local expression images obtained in step S1, so that it can pay attention to the mutual influence between local images and integrate them with each other.

[0011] S3: The image to be recognized is preprocessed and sent to the trained visual self-attention network for recognition to obtain the result;

[0012] In this step, the image to be detected is sent to the trained visual self-attention network to obtain the recognized expression.

[0013] The specific steps of S1 include:

[0014] S1.1 Dataset preparation

[0015] The datasets used are composed of popular expression datasets CK+, Oulu-CASIA, and RAF-DB. For the first two datasets, 8 folds are taken as training data using the 10-fold cross-validation method, and the last dataset uses the given training set as training data.

[0016] S1.2 Local Image Generation Module

[0017] The local image generation module is composed of a face detection method and a data enhancement technology. The face detection method uses a face detection method based on deep learning in the Dlib library. The data enhancement technology is used to construct a local image. The data enhancement technology used includes horizontally flipping the image (simulating the mirror condition of a digital device), randomly rotating (simulating changes in face angles), adjusting brightness, contrast, saturation and chroma (simulating different lighting conditions in real life or different digital device setting parameters resulting in different images), and finally randomly cropping the image (simulating a local image) and standardizing it, thereby generating a local image.

[0018] The process in the above-mentioned partial image generation module is run three times, thereby generating three partial images.

[0019] The specific steps of S2 include:

[0020] S2.1 Composition of the Visual Self-Attention Network

[0021] The visual self-attention network is composed of a four-layer designed visual self-attention layer, a global average pooling layer and a fully connected layer structure. Each visual self-attention layer is composed of three sets of parallel visual feature extraction modules and a self-attention feature fusion mechanism. The connection relationship is that the output of the three sets of visual feature extraction modules serves as the input of the self-attention feature fusion mechanism.

[0022] S2.2 Composition of the visual feature extraction module

[0023] The three groups of parallel visual feature extraction modules described in S2.1 are all composed of a residual structure, a query vector (q) generation module, a key vector (k) generation module and a value matrix (V) generation module.

[0024] The residual structure consists of the residual module (Res Module) and the maximum pooling layer (MP) in ResNet, and their connection relationship is: Res Module, MP.

[0025] The query vector (q) generation module consists of a depthwise separable convolutional layer (DSC1) and a global average pooling layer (GP1), and their connection relationships are: DSC1, GP1.

[0026] The key vector (k) generation module consists of a depthwise separable convolutional layer (DSC2) and a global average pooling layer (GP2), and their connection relationships are: DSC2, GP2.

[0027] The value matrix (V) generation module consists of only depthwise separable convolutional layers (DSC3).

[0028] The specific structure of the visual feature extraction module consists of three parallel substructures, whose specific connection relationships are (1) residual structure, query vector generation module. (2) residual structure, key vector generation module. (3) residual structure, value matrix generation module. The output of the residual structure is also the input of the query vector generation module, key vector generation module and value matrix generation module. Therefore, the data will have three outputs after passing through the visual feature extraction module, corresponding to the query vector, key vector and value matrix. It can be obtained that the three groups of visual feature extraction modules output a total of three query vectors, three key vectors and three value matrices.

[0029] S2.3 Self-attention feature fusion mechanism

[0030] The self-attention fusion mechanism described in S2.1 is expressed as follows:

[0031] F = Softmax(QK)V

[0032] Where Q is the concatenation of the three query vectors output by the three visual feature extraction modules mentioned in S2.2; K is the concatenation of the three key vectors output by the three visual feature extraction modules; V is the concatenation of the three value matrices output by the three visual feature extraction modules; Softmax refers to the Softmax function.

[0033] The detailed parameters of each submodule of the visual feature extraction module are as follows:

[0034] The residual module in the residual structure consists of two convolutional layers stacked together. The convolution kernel size of the two convolutional layers is 3×3, and the stride and padding are set to 1. Each convolutional layer is normalized by the Batch Normalization function, and the activation function is set to the Relu activation function. The window size of the maximum pooling layer is 2×2, and the stride is 1.

[0035] The depthwise separable convolution layers in the query vector generation module, key vector generation module, and value matrix generation module are all composed of depthwise convolution and pointwise convolution of the same structure, where the number of output channels of the depthwise convolution is equal to the number of input channels, the convolution kernel size is set to 3×3, the convolution step is set to 1, and the number of convolution groups is set to the number of input channels. The convolution kernel size in the pointwise convolution is set to 1×1, and the convolution step is set to 1. The Batch Normalization function is used for normalization after the depthwise convolution, and the activation function is the Relu6 activation function.

[0036] The number of input and output channels of each of the four visual self-attention layers is set as follows:

[0037] The number of input channels of the first layer is set to 3, and the number of output channels is set to 64.

[0038] The number of input channels of the second layer is set to 64, and the number of output channels is set to 128.

[0039] The number of input channels of the third layer is set to 128, and the number of output channels is set to 256.

[0040] The number of input channels of the fourth layer is set to 256, and the number of output channels is set to 512.

[0041] The fully connected layer structure is composed as follows:

[0042] The fully connected layer structure consists of two fully connected layers. The output of the first fully connected layer is the input of the second fully connected layer. The number of input units of the first fully connected layer is 512, and the number of output units is 256. The number of input units of the second fully connected layer is 256, and the number of output units is 7. The Dropout method is used after the first fully connected layer to prevent overfitting, and the parameter is set to 0.5.

[0043] The specific connection relationship between the components in the visual self-attention network is as follows:

[0044] The first visual self-attention layer, the second visual self-attention layer, the third visual self-attention layer, the fourth visual self-attention layer, the global average pooling layer, and the fully connected layer are connected in sequence. The input of the global average pooling layer only takes the first output of the fourth visual self-attention layer.

[0045] The three local images generated in S1.2 are the input of the first visual self-attention layer.

[0046] The preprocessing method in S3 in S3 is to use the TenCrop method in Pytorch to convert the input image into 10 local images of 40×40 pixels.

[0047] Beneficial effects:

[0048] (1) The visual self-attention network is similar to the human eye mechanism and can pay attention to the mutual influence between local images. It can also fuse the robust features of different local images to comprehensively consider the information of local images, making the features finally expressed by the image more robust, making up for the shortcomings of existing expression recognition methods and achieving discriminative representation of image features.

[0049] (2) The recognition accuracy of the present invention on multiple popular expression datasets CK+, Oulu-CASIA, and RAF-DB can surpass the current most advanced methods, improving the accuracy of expression recognition. It also meets the real-time requirements in actual expression recognition test experiments and achieves a relatively high recognition accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 This is a flowchart of the steps of the expression recognition method based on the visual self-attention network;

[0051] Figure 2 is a schematic diagram of the local image generation module;

[0052] Figure 3 It is a schematic diagram of the visual self-attention feature extraction module;

[0053] Figure 4 It is the overall architecture of the visual self-attention network; DETAILED DESCRIPTION

[0054] The present invention is further described in detail below in conjunction with the accompanying drawings and specific implementations.

[0055] like Figure 1 This is a flow chart of the steps of the expression recognition method based on the visual self-attention network. The specific implementation plan is:

[0056] S1: Data preparation: input the training data into the local image generation module to obtain the local image. The specific steps include:

[0057] S1.1 Dataset preparation

[0058] The data set used by the present invention comprises CK+, Oulu-CASIA, and RAF-DB three data sets, wherein the CK+ data set comprises 981 facial expression pictures in total, Oulu-CASIA comprises 1420 facial expression pictures in total, and RAF-DB comprises 12271 facial expression images in total as training data, and 3068 facial expression images as test data. Since the CK+ and Oulu-CASIA data sets are relatively small, the validity of the proposed method on these two data sets is verified by the 10-fold cross validation method in the experiment, 80% of which is used for training, and 20% of which is used for testing. And for the RAF-DB data set, the training set and test set provided are directly used for training and testing respectively.

[0059] S1.2 Local Image Generation Module

[0060] like Figure 2 FIG. 1 is a schematic diagram of a local image generation module. Specifically, the process of generating a local image is as follows: the first step is to use the deep learning-based face detection method in the Dlib library to detect the face of the original image; the second step is to intercept the detected face and change the intercepted face to 48×48 pixels using a bilinear interpolation algorithm; the third step is to horizontally flip the intercepted image (simulating the mirror condition of a digital device); the fourth step is to randomly rotate the image after the third step (simulating the change in the angle of the face), with the rotation angle between -90 degrees and 90 degrees; the fifth step is to The brightness, contrast, saturation and chromaticity of the image after the fourth step are changed, and the change parameter is set to 0.2 (to simulate different lighting conditions in real life or different settings of digital devices that lead to different images); in the sixth step, the image after the fifth step is randomly cropped (to simulate a local image), and the size of the random crop is 40×40 pixels; in the seventh step, the image generated in the sixth step is standardized, and the standardized mean is set to [0.485, 0.456, 0.406], and the standard deviation is set to [0.229, 0.224, 0.225].

[0061] By running the above process of generating local images from step 4 to step 7 three times, three local images can be obtained, which are then sent to the visual self-attention network to be introduced next.

[0062] S2: Input the local image into the visual self-attention network for training to obtain a trained model. The specific implementation plan is as follows:

[0063] S2.1 Composition of the Visual Self-Attention Network

[0064] The visual self-attention network consists of four layers of visual self-attention layers, global average pooling and fully connected layer structures stacked in sequence. The visual self-attention layer is composed of three groups of parallel visual feature extraction modules and self-attention feature fusion mechanism. The connection relationship is that the output of the three groups of visual feature extraction modules serves as the input of the self-attention feature fusion mechanism.

[0065] S2.2 Composition of the visual feature extraction module

[0066] Figure 3 This is a schematic diagram of the visual self-attention feature extraction module. Its specific construction steps are as follows:

[0067] The visual feature extraction module is composed of a residual structure, a query vector (q) generation module, a key vector (k) generation module, and a value matrix (V) generation module. In order to better extract features and prevent overfitting problems, the residual module in ResNet is used in the residual structure, such as Figure 3 As shown in Res Module in , MP stands for the maximum pooling operation, and the residual module and the maximum pooling form the residual structure. In order to reduce the number of model parameters, Figure 3 DSC1, DSC2, and DSC3 in the figure all use depthwise separable convolution operations and use global average pooling to calculate the linear embedding expression of the image. DSC1 and GP1 form the query vector (q) generation module, and DSC2 and GP2 form the key vector (k) generation module. The input data is calculated by DSC3 to obtain the value matrix (V). Figure 3 The output of the residual structure shown is also the input of the query vector generation module, the key vector generation module and the value matrix generation module. Therefore, the data will have three outputs after passing through the visual feature extraction module, namely the query vector, the key vector and the value matrix. Thus, three groups of visual feature extraction modules output three query vectors q 11 ,q 12 ,q 13 , three key vectors k 11 ,k 12 ,k 13 and three value matrices V 11 ,V 12 ,V 13 .

[0068] In each specific independent structure, the residual module in the residual structure consists of two convolutional layers. The convolution kernel size of the two convolutional layers is 3×3, the stride and padding are set to 1, and the two convolutional layers are normalized by the BatchNormalization function, and the activation function is set to the Relu activation function. The window size of the maximum pooling layer is 2×2, and the stride is 1. The depthwise separable convolutional layers in the query vector generation module, the key vector generation module, and the value matrix generation module are all composed of depthwise convolution and pointwise convolution of the same structure, where the number of output channels of the depthwise convolution is equal to the number of input channels, the convolution kernel size is set to 3×3, the convolution step is set to 1, and the number of convolution groups is set to the number of input channels. The convolution kernel size in the pointwise convolution is set to 1×1, and the convolution step is set to 1. The depthwise convolution is normalized by the Batch Normalization function, and the activation function is the Relu6 activation function.

[0069] S2.3 The self-attention feature fusion mechanism is expressed as follows:

[0070] F(Q,K,V)=Softmax(QK)V

[0071] Where Q is the concatenation of the three query vectors mentioned in S2.2, i.e., Q = (q 11 ,q 12 ,q 13 ) T ; K is the concatenation of the three key vectors mentioned in S2.2, that is, K = (k 11 ,k 12 ,k 13 ) T ; V is composed of the three value matrices mentioned in S2.2, that is, V = (V 11 ,V 12 ,V 13 ) T ; Softmax refers to the Softmax function. Q and K represent the feature expressions of the three local images. First, the matrix dot product of Q and K is used to calculate the mutual influence between the local images, and then the Softmax calculation is performed to obtain the influence of the remaining local images on the local image itself. Finally, multiplying by V can fuse the features of the remaining local images into the features of the own image.

[0072] After the data passes through the self-attention feature fusion mechanism, the expression of the local images after mutual fusion can be obtained, where the feature expression of the ith local image after mutual fusion is: Out i =F(Q,K,V)[:,i,:,:,:], after obtaining the mutually fused feature expressions, they can be sent to the next visual self-attention layer to extract deeper fused features.

[0073] S2.4 Composition of the Visual Self-Attention Network

[0074] like Figure 4 It is the structure of the visual self-attention network, which is composed of the above four layers of visual self-attention layer, global average pooling layer and fully connected layer connected in sequence. The number of input and output channels of each layer of the visual self-attention layer is set as follows:

[0075] The number of input channels of the first layer is set to 3, and the number of output channels is set to 64;

[0076] The number of input channels of the second layer is set to 64, and the number of output channels is set to 128;

[0077] The number of input channels of the third layer is set to 128, and the number of output channels is set to 256;

[0078] The number of input channels of the fourth layer is set to 256, and the number of output channels is set to 512.

[0079] The fully connected layer structure consists of two fully connected layers. The output of the first fully connected layer is the input of the second fully connected layer. The number of input units of the first fully connected layer is 512, and the number of output units is 256. The number of input units of the second fully connected layer is 256, and the number of output units is 7. The Dropout method is used after the first fully connected layer to prevent overfitting, and the parameter is set to 0.5.

[0080] S2.5 Training of Visual Self-Attention Network

[0081] In terms of model parameters, the batch size was set to 128, the learning rate was initially set to 0.0001, the model was trained using cross entropy classification loss and Adam optimizer, the number of training times was set to 210 times, and the learning rate was reduced to 0.1 times the original value every 70 times the model was trained.

[0082] S3: The image to be identified is preprocessed and sent to the trained visual self-attention network for identification to obtain experimental results, wherein the preprocessing method is to use the TenCrop method in Pytorch to convert the input image into 10 local images of 40×40 pixels, and then send the above-obtained image to the visual self-attention network for identification. The experimental results show that the average accuracy of the model designed by the present invention on the CK+ and Oulu-CASIA datasets in 10-fold cross validation is 99.7% and 97.256%, respectively, and the accuracy on the RAF-DB test dataset is 86.28%, both of which exceed the accuracy of the current most advanced methods.

[0083] For those skilled in the art, the present invention is not limited to the details of the above-mentioned embodiments, and the present invention can be implemented in other specific forms without departing from the spirit and scope of the present invention. In addition, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention, and these improvements and modifications should also be regarded as the protection scope of the present invention. Therefore, the attached claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.

Claims

1. A facial expression recognition method based on a visual self-attention network, characterized in that: The method is implemented in the following steps: S1: Data preparation, inputting the training data into the local image generation module to obtain the local image; S2: Input the local image into the visual self-attention network for training to obtain a trained model; the visual self-attention network is composed of 4 designed visual self-attention layers, global average pooling layers and fully connected layer structures, where each visual self-attention layer is composed of three sets of parallel visual feature extraction modules and self-attention feature fusion mechanisms, and the connection relationship is that the outputs of the three sets of visual feature extraction modules are used as the inputs of the self-attention feature fusion mechanism; S3: The image to be recognized is preprocessed and sent to the trained visual self-attention network for recognition to obtain the result; The three groups of parallel visual feature extraction modules are composed of a residual structure, a query vector generation module, a key vector generation module and a value matrix generation module; The residual structure consists of the residual module Res Module in ResNet and the maximum pooling layer MP, and its connection relationship is: ResModule, MP; The query vector q generation module consists of a depthwise separable convolutional layer DSC1 and a global average pooling layer GP1, and their connection relationships are: DSC1, GP1; The key vector k generation module is composed of a depthwise separable convolutional layer DSC2 and a global average pooling layer GP2, and their connection relationships are: DSC2, GP2; The value matrix V generation module consists only of the depthwise separable convolutional layer DSC3; The specific structure of the visual feature extraction module includes three parallel substructures, and their specific connection relationships are (1) residual structure, query vector generation module; (2) residual structure, key vector generation module; (3) residual structure, value matrix generation module; the output of the residual structure is also the input of the query vector generation module, key vector generation module and value matrix generation module; therefore, the data will have three outputs after passing through the visual feature extraction module, corresponding to the query vector, key vector and value matrix, so the three groups of visual feature extraction modules output a total of three query vectors, three key vectors and three value matrices; The self-attention feature fusion mechanism is: F = Softmax(QK)V Where Q is the concatenation of three query vectors output by three groups of visual feature extraction modules; K is the concatenation of three key vectors output by three groups of visual feature extraction modules; V is the concatenation of three value matrices output by three groups of visual feature extraction modules; Softmax refers to the Softmax function.

2. According to the method for facial expression recognition based on visual self-attention network described in claim 1, it is characterized in that: The specific steps of S1 include: S1.1 Data preparation The data used are composed of the public expression datasets CK+, Oulu-CASIA, and RAF-DB. The first two datasets use the 10-fold cross-validation method to take 8 folds as training data, and the last dataset uses the given training set as training data; S1.2 Local Image Generation Module The local image generation module is composed of a face detection method and a data enhancement technology. The face detection method uses a face detection method based on deep learning in the Dlib library. The data enhancement technology is used to construct a local image. The data enhancement technology used includes horizontally flipping the image, randomly rotating it, adjusting the brightness, contrast, saturation and chroma, and finally randomly cropping and standardizing the image. The process in the above-mentioned partial image generation module is run three times, thereby generating three partial images.

3. According to the expression recognition method based on visual self-attention network described in claim 1, it is characterized in that: The detailed parameters of each component in the visual feature extraction module are as follows: The residual module in the residual structure consists of two convolutional layers stacked together. The convolution kernel size of the two convolutional layers is 3×3, and the step size and padding are both set to 1. Each convolutional layer is normalized by the Batch Normalization function, and the activation function is set to the Relu activation function; the window size of the maximum pooling layer is 2×2, and the step size is 1; The depthwise separable convolution layers in the query vector generation module, key vector generation module and value matrix generation module are all composed of depthwise convolution and pointwise convolution with the same structure, where the number of output channels of the depthwise convolution is equal to the number of input channels, the convolution kernel size is set to 3×3, the convolution step is set to 1, and the number of convolution groups is set to the number of input channels; the convolution kernel size in the pointwise convolution is set to 1×1, and the convolution step is set to 1; the Batch Normalization function is used for normalization after the depthwise convolution, and the activation function is the Relu6 activation function.

4. According to the expression recognition method based on visual self-attention network described in claim 1, it is characterized in that: The number of input and output channels of each layer in the 4 layers of visual self-attention layer is set as follows: The number of input channels of the first layer is set to 3, and the number of output channels is set to 64; The number of input channels of the second layer is set to 64, and the number of output channels is set to 128; The number of input channels of the third layer is set to 128, and the number of output channels is set to 256; The number of input channels of the fourth layer is set to 256, and the number of output channels is set to 512.

5. A method for facial expression recognition based on a visual self-attention network according to claim 1, characterized in that: The fully connected layer structure is composed as follows: The fully connected layer structure consists of two fully connected layers. The output of the first fully connected layer is the input of the second fully connected layer. The number of input units of the first fully connected layer is 512, and the number of output units is 256; the number of input units of the second fully connected layer is 256, and the number of output units is 7; the Dropout method is used after the first fully connected layer to prevent overfitting, and the parameter is set to 0.

5.

6. A method for facial expression recognition based on a visual self-attention network according to claim 1, characterized in that: The specific connection relationship between the components in the visual self-attention network is as follows: The first visual self-attention layer, the second visual self-attention layer, the third visual self-attention layer, the fourth visual self-attention layer, the global average pooling layer, and the fully connected layer are connected in sequence; The input of the global average pooling layer only takes the first output of the fourth visual self-attention layer.

7. A method for facial expression recognition based on a visual self-attention network according to claim 1, characterized in that: The three generated local images are the input of the first visual self-attention layer.

8. A method for facial expression recognition based on a visual self-attention network according to claim 1, characterized in that: The preprocessing method in S3 is to use the TenCrop method in Pytorch to convert the input image into 10 local images of 40×40 pixels.

Citation Information

Patent Citations

  • Facial expression recognition method, device and equipment based on deep learning

    CN112149651A

  • A deep learning-based method, device, and equipment for facial expression recognition

    CN112149651B

  • Electroencephalogram emotion recognition method based on attention mechanism

    CN110610168A

  • Video sequence expression recognition system and method based on self-attention enhanced CNN

    CN111523462A