Face image classification method based on hierarchical pseudo 3D attention convolutional neural network

Through the hierarchical pseudo-3D attention convolutional neural network combined with the pseudo-3D convolution module, attention module and global context module, the high-dimensional and low-dimensional features of the face image are extracted, solving the low accuracy of face image classification in the existing technology. problem, achieving efficient face image classification.

CN113343865BActive Publication Date: 2024-09-06SHAANXI NORMAL UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110659025.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-15
Publication Date
2024-09-06
Estimated Expiration
2041-06-15

AI Technical Summary

Technical Problem

It is difficult for the existing technology to simultaneously capture the high-dimensional features of the detailed parts of the face and the low-dimensional features of the edge contours in face image classification, resulting in low classification accuracy and poor feature utilization. It is also difficult for the softmax loss function to achieve high-precision recognition.

Method used

Using a hierarchical pseudo-3D attention convolutional neural network, through the pseudo-3D convolution module, attention module and global context module, combined with the sigmoid and softmax functions, the high-dimensional and low-dimensional features of the image are extracted, and the network is optimized through the joint loss function , reduce model parameters and improve feature separation.

Benefits of technology

It effectively improves the accuracy and feature utilization of face image classification, solves the problems of low accuracy and poor feature utilization of existing networks, and is suitable for the classification of color face images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113343865B
    Figure CN113343865B
Patent Text Reader

Abstract

The present invention discloses a facial image classification method based on a hierarchical pseudo three-dimensional attention convolutional neural network, comprising: preprocessing a color facial image to be classified; performing geometric normalization processing on the preprocessed color facial image to be classified; constructing a hierarchical pseudo three-dimensional attention convolutional neural network and training it, wherein the hierarchical pseudo three-dimensional attention convolutional neural network comprises three input layers, one convolution layer, one maximum pooling layer, 16 pseudo three-dimensional attention modules consisting of a pseudo three-dimensional convolution module, an attention module and a global context module, one global averaging layer and one output layer; and inputting the geometrically normalized color facial image to be classified into the hierarchical pseudo three-dimensional attention convolutional neural network for classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of image recognition, and in particular relates to a face image classification method based on a hierarchical pseudo three-dimensional attention convolutional neural network. Background Art

[0002] Color face image classification is an important task in the field of computer vision, and the attention mechanism has always played an important role in image classification. At present, many scholars have improved the network structure by improving the attention mechanism. They have adjusted the channel attention by squeezing and stimulating the attention network. First, global average pooling is used to squeeze the global features into the channel features, and then a simple gate mechanism is used and stimulated by the sigmoid function. Finally, the corresponding channel product is multiplied, which greatly improves the network performance without increasing the computational cost. However, this method does not consider the importance of global context information to position encoding, which is crucial for capturing object structure in computer vision tasks and can effectively improve the network's image classification performance. Other scholars have proposed coordinate attention, which obtains position information by averaging pooling operations in different directions and combines channel information to improve the classification performance of the network. However, it is difficult to obtain the global receptive field by using only pooling in different directions, and it is also difficult to capture deeper features through two-dimensional image data. Three-dimensional data will make the network parameters too complicated, resulting in the network being very easy to overfit. In addition, the softmax loss function in the existing popular network cannot perform high-precision recognition and classification of faces well. Summary of the invention

[0003] In view of the deficiencies in the prior art, the purpose of the present invention is to provide a face image classification method based on a hierarchical pseudo three-dimensional attention convolutional neural network, which can simultaneously extract high-dimensional features of facial details and low-dimensional features of edge contours, thereby achieving accurate classification of faces.

[0004] To achieve the above objectives, the present disclosure provides the following technical solutions:

[0005] A face image classification method based on a hierarchical pseudo three-dimensional attention convolutional neural network comprises the following steps:

[0006] S100: preprocessing the color face image to be classified;

[0007] S200: performing geometric normalization processing on the preprocessed color face image to be classified;

[0008] S300: constructing a hierarchical pseudo three-dimensional attention convolutional neural network and training it, wherein the hierarchical pseudo three-dimensional attention convolutional neural network includes three input layers, one convolution layer, one maximum pooling layer, 16 pseudo three-dimensional attention modules consisting of pseudo three-dimensional convolution modules, attention modules and global context modules, one global averaging layer and one output layer;

[0009] S400: Inputting the color face image to be classified after geometric normalization processing into the hierarchical pseudo three-dimensional attention convolutional neural network for classification.

[0010] Preferably, the pseudo three-dimensional convolution module consists of one convolution layer with a convolution kernel size of 1×1×1 and two convolution layers with convolution kernel sizes of 3×3×1 and 1×1×3 respectively.

[0011] Preferably, the attention module comprises:

[0012] In the first unit, two feature matrices are obtained by convolving the pseudo three-dimensional convolution module with 3×3×3 and 5×5×5 convolution kernels respectively. The two feature matrices are subjected to maximum pooling and average pooling respectively and cascaded to obtain two cascade feature matrices. The two cascade feature matrices are subjected to multi-convolution to obtain the output feature matrix.

[0013] The second unit is used to squeeze the output feature matrix into the channel by global average pooling. After nonlinear processing, the sigmoid function is used to obtain two weight feature matrices, and the parameters of the weight feature matrix are updated with back propagation;

[0014] The third unit is used to multiply the two weight feature matrices with the two output feature matrices in the first unit respectively to obtain two feature matrices with attention weights, and finally perform cascade and 1×1 convolution operations to obtain the output feature matrix of the attention module.

[0015] Preferably, the attention module is expressed as:

[0016]

[0017] s=Fz(z,W)=δ(BN(z))

[0018] Among them, D, H and W are the depth, height and width of the output feature matrix, K is the output feature matrix of the first unit, i, j, k are the element values ​​of the depth, height and width of K respectively, z is the squeezed feature matrix obtained after the GAP layer, δ is the ReLU nonlinear activation function, BN is the batch normalization operation, and s is the output weight matrix.

[0019] Preferably, the global context module includes:

[0020] Unit 4: Linearly transform the output feature matrix of the attention module by using a convolution kernel size of 1×1×1 and a Reshape function to obtain a linearly transformed feature matrix. Then, the linearly transformed feature matrix is ​​processed using a softmax function to obtain weights at different positions on the feature matrix. Finally, the weights are multiplied by the linearly transformed feature matrix to obtain a global context feature matrix.

[0021] Unit 5, performs feature transformation on the global context feature matrix through a nonlinear transformation layer consisting of batch normalization and ReLU activation function and a convolution layer with a convolution kernel size of 1×1 to obtain the global context feature matrix after feature transformation;

[0022] The sixth unit is used to add the global context feature matrix after feature transformation to the output feature matrix of the attention module to obtain the output feature matrix of the global context module.

[0023] Preferably, the global context module is represented as:

[0024]

[0025] Where x is the output feature matrix of the global context module, V is a 1×1×1 convolution, ReLU represents the activation function, GN is the group normalization function, N is the number of positions in the feature matrix, e is the base of the natural logarithm function, j, m are all possible positions in the feature matrix, and x j , x m The pixel value at a certain position in the global context feature matrix, t represents the weight of the x matrix, tx j and tx m It is the output value obtained by calculating the feature matrix after the global average pooling operation.

[0026] Preferably, in step S300, the layered pseudo three-dimensional attention convolutional neural network is trained by the following steps:

[0027] S301: Select a number of color face images for sample division, dividing them into training samples and verification samples;

[0028] S302: performing preprocessing and geometric normalization processing on the training samples and the verification samples in sequence to obtain new training samples and verification samples;

[0029] S303: Using new training samples to train the hierarchical pseudo three-dimensional attention convolutional neural network through forward propagation and back propagation, and verifying the trained hierarchical pseudo three-dimensional attention convolutional neural network through new verification samples.

[0030] Preferably, the color face images to be classified and the training samples and verification samples are preprocessed by using a histogram equalization method and a median filtering method.

[0031] Preferably, the normalization processing of the color face images to be classified and the training samples and the verification samples is performed in the following manner:

[0032] S3001: calibrate feature points, using the [x, y]=ginput(3) function provided by Matlab to calibrate the three feature points of the eyes and nose;

[0033] S3002: Rotate the image according to the coordinate values ​​of the two eyes to ensure the consistency of the face direction, wherein the distance between the two eyes is set to d and the midpoint is set to O.

[0034] S3003: Determine a rectangular feature area based on the facial feature points and the geometric model, take the midpoint O as the reference, cut d on the left and right sides, and take 0.5d and 1.5d rectangular areas in the vertical direction for cropping;

[0035] S3004: Performing a scale transformation on the face sub-region image to obtain a uniform size and realize geometric normalization of the image.

[0036] Preferably, the performance of the hierarchical pseudo three-dimensional attention convolutional neural network is evaluated by the following indicators:

[0037] Accuracy

[0038]

[0039] Accuracy

[0040]

[0041] Mistakenly predicting other classes as the proportion of this class

[0042]

[0043] Recall

[0044]

[0045] Among them, TP means the correct prediction is this class, FP means the wrong prediction of other classes is this class, TN means the correct prediction is other classes, and FN means the wrong prediction of this class is other classes.

[0046] Compared with the prior art, the present invention has the following beneficial effects:

[0047] 1. Through effective data preprocessing, the memory burden can be greatly reduced;

[0048] 2. Compared with existing methods, the pseudo three-dimensional convolution module can effectively reduce the model parameters of deep neural networks. The attention module can obtain attention weights, so that the network can capture more separable features. Finally, the global context module is used to realize global feature modeling, improve the classification effect, and solve the problems of low accuracy and poor feature utilization of existing networks. It is suitable for the classification of color face images. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 It is a flow chart of a method for facial image classification based on a hierarchical pseudo three-dimensional attention convolutional neural network provided by an embodiment of the present disclosure;

[0050] Figure 2 is a schematic diagram of a hierarchical pseudo three-dimensional attention convolutional neural network structure provided by another embodiment of the present disclosure;

[0051] Figure 3 is a schematic diagram of the structure of a pseudo three-dimensional attention module provided by another embodiment of the present disclosure;

[0052] Figure 4 is a schematic diagram of an attention module provided by another embodiment of the present disclosure;

[0053] Figure 5 is a face image to be classified provided by another embodiment of the present disclosure;

[0054] Figure 6 is a preprocessed face image to be classified provided by another embodiment of the present disclosure;

[0055] Figure 7 Another embodiment of the present disclosure provides a method of obtaining a classification result by using the method of the present disclosure;

[0056] Figure 8 Another embodiment of the present disclosure provides a method for obtaining classification results using an existing method. DETAILED DESCRIPTION

[0057] The following will refer to the accompanying drawings Figures 1 to 8 Specific embodiments of the present disclosure are described in detail. Although specific embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0058] It should be noted that certain words are used in the specification and claims to refer to specific components. Those skilled in the art should understand that technicians may use different nouns to refer to the same component. This specification and claims do not use the difference in nouns as a way to distinguish components, but use the difference in the functions of the components as the criterion for distinction. As mentioned throughout the specification and claims, "including" or "comprising" is an open term, so it should be interpreted as "including but not limited to". The subsequent description of the specification is a preferred embodiment of the present invention, but the description is based on the general principles of the specification and is not used to limit the scope of the present invention. The scope of protection of the present disclosure shall be determined by the attached claims.

[0059] To facilitate understanding of the embodiments of the present disclosure, further explanation will be given below using specific embodiments as examples in conjunction with the accompanying drawings, and each of the accompanying drawings does not constitute a limitation on the embodiments of the present disclosure.

[0060] In one embodiment, if Figure 1 As shown, a face image classification method based on a hierarchical pseudo three-dimensional attention convolutional neural network includes the following steps:

[0061] S100: preprocessing the color face image to be classified;

[0062] S200: performing geometric normalization processing on the preprocessed color face image to be classified;

[0063] S300: constructing a hierarchical pseudo three-dimensional attention convolutional neural network and training it, wherein the hierarchical pseudo three-dimensional attention convolutional neural network includes three input layers, one convolution layer, one maximum pooling layer, 16 pseudo three-dimensional attention modules consisting of pseudo three-dimensional convolution modules, attention modules and global context modules, one global averaging layer and one output layer;

[0064] S400: Inputting the color face image to be classified after geometric normalization processing into the hierarchical pseudo three-dimensional attention convolutional neural network for classification.

[0065] In this embodiment, the model parameters of the deep neural network can be effectively reduced through the pseudo three-dimensional convolution module, the attention weight can be obtained through the attention module, so that the network can capture more separable features, and the global context module can realize global feature modeling, thereby improving the classification effect. This embodiment can solve the problems of low accuracy and poor feature utilization of the existing network by adding a pseudo three-dimensional attention module to the existing network, and is suitable for the classification of color face images.

[0066] In another embodiment, the pseudo three-dimensional convolution module is composed of one convolution layer with a convolution kernel size of 1×1×1 and two convolution layers with convolution kernel sizes of 3×3×1 and 1×1×3 respectively.

[0067] This embodiment not only reduces the number of network parameters to a great extent by splitting the pseudo three-dimensional convolution module into two-dimensional + one-dimensional forms, but also achieves the effect of 3D convolution to efficiently extract three-dimensional features. Because facial details are generally represented as high-dimensional features, and edge contours are generally represented as low-dimensional features, it is difficult for existing three-dimensional networks to use the above two types of features at the same time, and the pseudo three-dimensional convolution module can well combine the two, alleviating the problem that the above two types of features cannot be fully utilized.

[0068] In another embodiment, the attention module includes:

[0069] In the first unit, two feature matrices are obtained by convolving the pseudo three-dimensional convolution module with 3×3×3 and 5×5×5 convolution kernels respectively. The two feature matrices are subjected to maximum pooling and average pooling respectively and cascaded to obtain two cascade feature matrices. The two cascade feature matrices are subjected to multi-convolution to obtain the output feature matrix.

[0070] The second unit is used to squeeze the output feature matrix into the channel by global average pooling. After nonlinear processing, the sigmoid function is used to obtain two weight feature matrices, and the parameters of the weight feature matrix are updated with back propagation;

[0071] The third unit is used to multiply the two weight feature matrices with the two output feature matrices in the first unit respectively to obtain two feature matrices with attention weights, and finally perform cascade and 1×1 convolution operations to obtain the output feature matrix of the attention module.

[0072] In another embodiment, the attention module is represented as:

[0073]

[0074] s=Fz(z,W)=δ(BN(z))

[0075] Among them, D, H and W are the depth, height and width of the output feature matrix, K is the output feature matrix of the first unit, i, j, k are the element values ​​of the depth, height and width of K respectively, z is the squeezed feature matrix obtained after the GAP layer, δ is the ReLU nonlinear activation function, BN is the batch normalization operation, and s is the output weight matrix.

[0076] In another embodiment, the global context module includes:

[0077] Unit 4: Linearly transform the output feature matrix of the attention module by using a convolution kernel size of 1×1×1 and a Reshape function to obtain a linearly transformed feature matrix. Then, the linearly transformed feature matrix is ​​processed using a softmax function to obtain weights at different positions on the feature matrix. Finally, the weights are multiplied by the linearly transformed feature matrix to obtain a global context feature matrix.

[0078] Unit 5, performs feature transformation on the global context feature matrix through a nonlinear transformation layer consisting of batch normalization and ReLU activation function and a convolution layer with a convolution kernel size of 1×1 to obtain the global context feature matrix after feature transformation;

[0079] The sixth unit is used to add the global context feature matrix after feature transformation to the output feature matrix of the attention module to obtain the output feature matrix of the global context module.

[0080] In another embodiment, the global context module is represented as:

[0081]

[0082] Where x is the output feature matrix of the global context module, V is a 1×1×1 convolution, ReLU represents the activation function, GN is the group normalization function, N is the number of positions in the feature matrix, e is the base of the natural logarithm function, j, m are all possible positions in the feature matrix, and x j , x m The pixel value at a certain position in the global context feature matrix, t represents the weight of the x matrix, tx j and tx m It is the output value obtained by calculating the feature matrix after the global average pooling operation.

[0083] In another embodiment, in step S300, the layered pseudo three-dimensional attention convolutional neural network is trained by the following steps:

[0084] S301: Select a number of color face images for sample division, dividing them into training samples and verification samples;

[0085] S302: performing preprocessing and geometric normalization processing on the training samples and the verification samples in sequence to obtain new training samples and verification samples;

[0086] S303: Using new training samples to train the hierarchical pseudo three-dimensional attention convolutional neural network through forward propagation and back propagation, and verifying the trained hierarchical pseudo three-dimensional attention convolutional neural network through new verification samples.

[0087] In this embodiment, the present disclosure also proposes a new joint loss function as the objective function to optimize the network. The loss function value represents the training error of the training set. We can gradually reduce the training error by optimizing the loss function. The loss function can be expressed as:

[0088]

[0089]

[0090] L union =λL CS +L Arc

[0091] Among them, L CS Represents the center loss, which is used to optimize the intra-class distance, L Arc It is used to optimize the distance between classes, N is the number of categories, is the center of the ith category, x i represents the i-th category, s is a characteristic scale, and is L2 regularized x i Then expand it, here we take s = 10, is the angle of the i-th category, m is the penalty term, λ is the smoothing term, e is the natural logarithm base, θ j is the weight vector and the feature vector x i The angle between union is the joint loss function; the back-propagation operation is based on the chain rule to calculate the gradient of the loss function for all weights in the network, multiply this gradient by a learning rate α (α = 0.01, 0.005, 0.001...), invert it and add it to the weight to realize the weight parameter update.

[0092] The loss function of the existing method ignores the separability of capturing features of different classes, resulting in some images with similar features being unable to be distinguished. The loss function proposed in this embodiment adds constraints, which not only constrains the same class, that the extracted features should be highly similar in the same class, but also constrains the separability between different classes, that the features extracted between different classes should have large differences.

[0093] In another embodiment, the color face images to be classified and the training samples and verification samples are preprocessed by using a histogram equalization method and a median filtering method.

[0094] In this embodiment, preprocessing the image by using the histogram equalization method includes the following steps:

[0095] (1) Find the pixel value r contained in the image k (k=0, 1, 2, ..., L-1), the pixel value range is [0, 255];

[0096] (2) Count the number of pixels n for each pixel value k (k=0, 1, 2,..., L-1);

[0097] (3) presenting the number of pixels for each pixel value in the form of a histogram;

[0098] (4) Calculate the transformation function, that is:

[0099]

[0100] (5) Use the transformation function to calculate the pixel value output after mapping;

[0101] (6) Count the number of pixels of the new pixel value after mapping;

[0102] (7) Obtaining a histogram of the output image, and obtaining an image after histogram equalization. In addition, this embodiment can also achieve the same preprocessing effect as the histogram equalization method through the computing innovation method disclosed in the present invention, specifically:

[0103] Select a face image I of size m*n and process it as follows:

[0104]

[0105]

[0106]

[0107] Where I1, I2, and I3 are the intermediate stages of the method, m and n are the image sizes, corresponding to the number of rows and columns, respectively, i and j represent the i-th row and j-th column, and I ij represents the element value of the i-th row and j-th column, trim is the threshold, here trim=10 is selected, α is the regularization term, α=0.1, tanh is the activation function, min is the minimum function, |I ij | is the absolute value of the value in the i-th row and j-th column.

[0108] After the above preprocessing, the image needs to be further preprocessed by median filtering, which specifically includes the following steps:

[0109] (1) Slide the filter template (a sliding window containing several points) in the image, and make the center of the template coincide with the position of a random pixel in the image. Repeat the above operation until all pixels are processed.

[0110] (2) Obtain the pixel values ​​of each corresponding pixel in the template and arrange these pixel values ​​from small to large.

[0111] Median filtering generally uses a sliding window containing several points, and replaces the grayscale value of the specified point (usually the center point of the window) with the median of the grayscale values ​​of each point in the window. If there are an odd number of elements in the window, the median takes the grayscale value of the middle element after the elements are sorted by grayscale value. If there are an even number of elements in the window, the median takes the average grayscale value of the two middle elements after the elements are sorted by grayscale value. Because the image is a two-dimensional signal, the window shape and size of the median filter have a great influence on the filter effect. Different window shapes and sizes are often used for different image contents and different application requirements. After median filtering, image noise, such as salt and pepper noise, can be effectively removed.

[0112] In another embodiment, the geometric normalization processing of the color face image to be classified and the training sample and the verification sample is performed in the following manner:

[0113] S3001: calibrate feature points, using the [x, y]=ginput(3) function provided by Matlab to calibrate the three feature points of the eyes and nose;

[0114] S3002: Rotate the image according to the coordinate values ​​of the two eyes to ensure the consistency of the face direction, wherein the distance between the two eyes is set to d and the midpoint is set to O.

[0115] S3003: Determine a rectangular feature area based on the facial feature points and the geometric model, take the midpoint O as the reference, cut d on the left and right sides, and take 0.5d and 1.5d rectangular areas in the vertical direction for cropping;

[0116] S3004: Performing a scale transformation on the face sub-region image to obtain a uniform size and realize geometric normalization of the image.

[0117] In another embodiment, the performance of the hierarchical pseudo three-dimensional attention convolutional neural network is evaluated by the following indicators:

[0118] Accuracy

[0119]

[0120] Accuracy

[0121]

[0122] Mistakenly predicting other classes as the proportion of this class

[0123]

[0124] Recall

[0125]

[0126] Among them, TP means the correct prediction is this class, FP means the wrong prediction of other classes is this class, TN means the correct prediction is other classes, and FN means the wrong prediction of this class is other classes.

[0127] The technical effect of the technical solution of the present disclosure is described below in conjunction with experimental data.

[0128] A total of 10,000 color face images of 200 people were selected from the PubFig dataset, of which 5,000 color face images were used as training samples, 2,000 images were used as verification samples, and 3,000 images were used as samples to be classified.

[0129] The training samples are used to train the attention networks including ResNet-50 and PEDCC, and then the samples to be classified are input into each trained network for testing. The test results are shown in Table 1:

[0130] Table 1

[0131]

[0132] As can be seen from Table 1, we used resnet-50 as the baseline model for demonstration. It can be seen that the accuracy of the technical solution disclosed in the present invention is as high as 98.33%, and the precision is as high as 99.3%, both of which are better than the existing popular methods.

[0133] To further verify the superiority of the method disclosed in this disclosure, we selected several images from 3000 samples to be classified for illustrative purposes. Figure 5 shown.

[0134] right Figure 5 After preprocessing the image shown, we get Figure 6 The image shown in FIG. 1 is classified by using the method disclosed in the present disclosure and the existing method respectively. The classification results are shown in FIG. Figure 7 and Figure 8 As shown by Figure 7 It can be seen that the method disclosed in the present invention can be used to classify facial images very accurately, and facial images belonging to one person are grouped into one column, while deviations will occur when using existing methods.

[0135] Although the embodiments of the present invention are described above in conjunction with the accompanying drawings, the present invention is not limited to the above specific embodiments and application fields, and the above specific embodiments are only illustrative and instructive, rather than restrictive. A person of ordinary skill in the art can also make many forms under the guidance of this specification and without departing from the scope of protection of the claims of the present invention, all of which belong to the protection of the present invention.

Claims

1. A face image classification method based on a hierarchical pseudo three-dimensional attention convolutional neural network, comprising the following steps: S100: preprocessing the color face image to be classified; S200: performing geometric normalization processing on the preprocessed color face image to be classified; S300: constructing a hierarchical pseudo three-dimensional attention convolutional neural network and training it, wherein the hierarchical pseudo three-dimensional attention convolutional neural network includes three input layers, one convolution layer, one maximum pooling layer, 16 pseudo three-dimensional attention modules consisting of pseudo three-dimensional convolution modules, attention modules and global context modules, one global averaging layer and one output layer; S400: inputting the color face image to be classified after geometric normalization processing into the hierarchical pseudo three-dimensional attention convolutional neural network for classification; in, The pseudo three-dimensional convolution module consists of one convolution layer with a convolution kernel size of 1×1×1 and two convolution layers with convolution kernel sizes of 3×3×1 and 1×1×3 respectively; The attention module comprises: In the first unit, two feature matrices are obtained by convolving the pseudo three-dimensional convolution module with 3×3×3 and 5×5×5 convolution kernels respectively. The two feature matrices are subjected to maximum pooling and average pooling respectively and cascaded to obtain two cascade feature matrices. The two cascade feature matrices are subjected to multi-convolution to obtain the output feature matrix. The second unit is used to squeeze the output feature matrix into the channel by global average pooling. After nonlinear processing, the sigmoid function is used to obtain two weight feature matrices, and the parameters of the weight feature matrix are updated with back propagation; The third unit is used to multiply the two weight feature matrices with the two output feature matrices in the first unit respectively to obtain two feature matrices with attention weights, and finally perform cascade and 1×1 convolution operations to obtain the output feature matrix of the attention module; The global context module includes: Unit 4: Linearly transform the output feature matrix of the attention module by using a convolution kernel size of 1×1×1 and a Reshape function to obtain a linearly transformed feature matrix. Then, the linearly transformed feature matrix is ​​processed using a softmax function to obtain weights at different positions on the feature matrix. Finally, the weights are multiplied by the linearly transformed feature matrix to obtain a global context feature matrix. Unit 5, performs feature transformation on the global context feature matrix through a nonlinear transformation layer consisting of batch normalization and ReLU activation function and a convolution layer with a convolution kernel size of 1×1 to obtain the global context feature matrix after feature transformation; The sixth unit is used to add the global context feature matrix after feature transformation to the output feature matrix of the attention module to obtain the output feature matrix of the global context module.

2. The method according to claim 1, in, The attention module is expressed as: , , Among them, D, H and W are the depth, height and width of the output feature matrix, K is the output feature matrix of the first unit, i, j, k are the element values ​​of the depth, height and width of K respectively, z is the squeezed feature matrix obtained after the GAP layer, δ is the ReLU nonlinear activation function, BN is the batch normalization operation, and s is the output weight matrix.

3. The method according to claim 1, in, The global context module is represented as: , in, is the output feature matrix of the global context module, is a 1×1×1 convolution, represents the activation function, is the group normalization function, is the number of positions in the feature matrix, is the base of the natural logarithm function, , are all possible positions in the feature matrix, , The pixel value of a certain position in the global context feature matrix, t represents The weight of the matrix, tx j and tx m It is the output value obtained by calculating the feature matrix after the global average pooling operation.

4. The method according to claim 1, in, In step S300, the layered pseudo three-dimensional attention convolutional neural network is trained by the following steps: S301: Select a number of color face images for sample division, dividing them into training samples and verification samples; S302: performing preprocessing and geometric normalization processing on the training samples and the verification samples in sequence to obtain new training samples and verification samples; S303: Using new training samples to train the hierarchical pseudo three-dimensional attention convolutional neural network through forward propagation and back propagation, and verifying the trained hierarchical pseudo three-dimensional attention convolutional neural network through new verification samples.

5. The method according to claim 4, in, The color face images to be classified and the training samples and verification samples are preprocessed by using a histogram equalization method and a median filtering method.

6. The method according to claim 4, in, The color face images to be classified and the normalization processing of the training samples and the verification samples are performed in the following manner: S3001: Calibrate feature points. Use the [x,y] = ginput(3) function provided by Matlab to calibrate the three feature points of the eyes and nose. S3002: Rotate the image according to the coordinate values ​​of the two eyes to ensure the consistency of the face direction, wherein the distance between the two eyes is d and the midpoint is O; S3003: Determine a rectangular feature area based on the facial feature points and the geometric model, take the midpoint O as the reference, cut d on the left and right sides, and take 0.5d and 1.5d rectangular areas in the vertical direction for cropping; S3004: Performing a scale transformation on the face sub-region image to obtain a uniform size and realize geometric normalization of the image.

7. The method according to claim 4, in, The performance of the hierarchical pseudo 3D attention convolutional neural network is evaluated by the following metrics: Accuracy: , Accuracy: , The proportion of incorrectly predicting other classes as this class: , Recall: , Among them, TP means the correct prediction is this class, FP means the wrong prediction of other classes is this class, TN means the correct prediction is other classes, and FN means the wrong prediction of this class is other classes.