Video facial expression category recognition method and system based on relative space-time transformation
By using a method based on spatio-temporal relative transformation, feature extraction of video facial expressions is performed, and Euclidean distance and hyperbolic distance are used for feature transformation, which solves the problem of insufficient feature extraction capabilities in the existing technology and improves the accuracy of facial expression recognition. Rate.
Patent Information
- Application Number
- CN202311250870.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-26
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2043-09-26
AI Technical Summary
Existing video facial expression recognition methods have weak feature extraction capabilities and are difficult to extract more accurate and discriminative spatio-temporal features, resulting in low recognition accuracy.
Using a method based on spatiotemporal relative transformation, the local spatial features and temporal features of the video frame image are relatively transformed through Euclidean distance and hyperbolic distance, and weighted fusion and aggregation learning are performed to generate more accurate spatiotemporal emotional features to improve human performance. Accuracy of facial expression category recognition.
It effectively extracts the spatial and temporal features of facial expression videos, reduces noise interference, and improves the accuracy and recognition effect of facial expression recognition.
Smart Images

Figure CN117238019B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of facial expression recognition, and more particularly to a method and system for video facial expression category recognition based on relative space-time transformation. Background Art
[0002] Facial expression recognition is a technology that understands human emotions from facial images or video sequences. Through facial expressions, we can understand the other person's emotions and perceive their inner psychological state. Therefore, enabling machines to recognize human emotions like humans can better promote the interaction between robots and humans and make them truly intelligent.
[0003] In the real world, facial expressions are dynamic, and video-based data can provide richer facial information. In recent years, with the introduction of many large-scale video facial expression datasets, the task of real dynamic facial expression recognition has many challenges, such as scene changes, posture changes, and different lighting.
[0004] At present, some advanced deep expression recognition models have been proposed, such as the Former-DFER method based on Transformer technology proposed by Zhao et al. and the dual-path multi-excitation collaborative network proposed by Wang et al. However, the feature extraction ability of existing video expression recognition methods is weak, and it is difficult to extract more accurate and discriminative spatiotemporal features, which makes the recognition accuracy of current methods very low, and still needs further improvement. Summary of the invention
[0005] In view of this, the present invention provides a method and system for video facial expression category recognition based on relative spatiotemporal transformation, aiming to improve feature extraction capability and further improve the accuracy of facial expression recognition in videos.
[0006] In order to achieve the above object, the present invention adopts the following technical solution:
[0007] On the one hand, the present application provides a method for video facial expression category recognition based on relative time-space transformation, comprising the following steps:
[0008] Extract local spatial features of each frame in the video;
[0009] Based on the Euclidean distance, each local spatial feature is spatially relatively transformed, and the obtained spatial relative transformation features are weighted fused and aggregated to obtain the spatial features of each frame of the image;
[0010] Based on the Euclidean distance and the hyperbolic distance, the spatial features of each frame of the image are subjected to time-series relative transformation, and the obtained time-series relative transformation features are subjected to weighted fusion and aggregation learning to obtain the spatiotemporal emotional features of the video;
[0011] The facial expression category is identified according to the spatiotemporal emotional features of the video.
[0012] Preferably, the spatial features of each frame of the image are transformed relatively in time based on the Euclidean distance to obtain the first temporal relative transformation features in the Euclidean space, and the spatial features of each frame of the image are transformed relatively in time based on the hyperbolic distance to obtain the second temporal relative transformation features in the hyperbolic space. After weighted fusion and aggregate learning of the first and second temporal relative transformation features, the spatiotemporal emotional features of the video are obtained.
[0013] Preferably, the spatial relative transformation feature is a one-dimensional vector composed of the Euclidean distance between the corresponding local spatial feature and other local spatial features;
[0014] The first temporal relative transformation feature is a one-dimensional vector composed of the Euclidean distance between the spatial feature of the corresponding frame image and the spatial features of other frame images;
[0015] The second temporal relative transformation feature is a one-dimensional vector composed of the hyperbolic distance between the corresponding frame image spatial feature and other frame image spatial features.
[0016] Preferably, when calculating the hyperbolic distance, the spatial features of each frame of the image are first mapped into the hyperbolic geometric space through the Poincare disk model according to the following formula:
[0017]
[0018] Where tanh(·) represents the hyperbolic tangent function, c represents the negative curvature of the sphere, and s fi Represents the spatial features of the i-th frame image.
[0019] Preferably, in the hyperbolic space, the hyperbolic distance between the spatial features of any two frames of images is calculated according to the following formula:
[0020]
[0021]
[0022] in, Representation characteristics hyi and hyj Hyperbolic distance, s hyi and hyj Respectively represent the temporal features corresponding to the spatial features of the i-th frame and the j-th frame images in the hyperbolic space, Represents the addition operation in hyperbolic space, where x and y represent any two points in the hyperbolic space.
[0023] Preferably, the weighted fusion process includes:
[0024] By using a fully connected layer, the attention weights of the spatial relative transformation feature / the first temporal relative transformation feature / the second temporal relative transformation feature are learned.
[0025] Use the Sigmoid function to regularize and get the corresponding attention coefficient.
[0026] The spatial transformation feature is weighted according to the corresponding attention coefficient and then concatenated with the corresponding local spatial feature to obtain a weighted spatial relative transformation feature; or
[0027] The first time series relative transformation feature / the second time series relative transformation feature are weighted according to the corresponding attention coefficient and then spliced with the image space feature of the corresponding frame to obtain a weighted time series relative transformation feature.
[0028] Preferably, the weighted fusion transformation features are aggregated and learned sequentially through multi-head attention and multi-layer perceptron; wherein,
[0029] Before aggregating and learning the spatial relative transformation features, the spatial dynamic category tokens are set and concatenated into the weighted fused spatial relative transformation features.
[0030] Before the aggregation learning of the temporal relative transformation features, the temporal dynamic category tokens are set first and spliced into the weighted fused temporal relative transformation features, and the temporal position encoding is determined and embedded into the corresponding weighted fused temporal relative transformation features.
[0031] Preferably, after obtaining the spatial features of each frame of the image, they are first sorted by time, and the temporal relative transformation features are obtained based on the sorted image spatial features.
[0032] On the other hand, the present invention discloses a video facial expression category recognition system based on relative time-space transformation, comprising:
[0033] A spatial relative transformation module is used to perform spatial relative transformation on the local spatial features of each frame of image according to the Euclidean distance to obtain spatial relative transformation features;
[0034] A spatial feature interaction module is used to perform weighted fusion and aggregation learning on the spatial relative transformation features to obtain the spatial features of each frame of the image;
[0035] A time series relative transformation module is used to perform time series transformation on the spatial features of each frame of the image according to the Euclidean distance and the hyperbolic distance to obtain time series relative transformation features;
[0036] The temporal feature interaction module is used to perform weighted fusion and aggregation learning on the temporal relative transformation features to obtain the spatiotemporal emotional features of the video.
[0037] Preferably, it also includes:
[0038] A local spatial feature extraction module, used to extract local spatial features of each frame of the video; and
[0039] The facial expression category recognition module is used to recognize the facial expression category according to the spatiotemporal emotional characteristics of the video.
[0040] It can be seen from the above technical solution that compared with the prior art, the present invention discloses a method and system for video facial expression category recognition based on relative space-time transformation, which obtains spatial relative transformation features through Euclidean space distance calculation, and uses its own learned fusion attention coefficient to weightedly splice and fuse it with the original spatial features, and encodes spatial geometric information into the spatial features, and further calculates dual temporal relative transformation features through Euclidean distance and hyperbolic distance, and uses their respective learned fusion attention coefficients to weightedly splice and fuse it with the original video temporal features, and encodes dual temporal dynamic geometric information into the temporal features to generate more accurate video expression features, and finally obtain accurate emotional categories of facial expressions in the video.
[0041] The technical solution of the present invention can better extract the spatial and temporal features of facial expression videos; thereby better focusing on important spatial and temporal features and ignoring noise; encoding spatial and temporal geometric information into temporal and spatial features can promote more effective spatiotemporal feature learning.
[0042] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings.
[0043] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0045] Figure 1 It is a flow chart of the method for video facial expression category recognition based on relative space-time transformation of the present invention;
[0046] Figure 2Flowchart for weighted fusion and aggregate learning of spatial relative transformation features;
[0047] Figure 3 It is a schematic diagram of the time-series video characteristics of the present invention;
[0048] Figure 4 Flowchart for weighted fusion and aggregate learning of temporal relative conversion features;
[0049] Figure 5 Schematic diagram of the video facial expression category recognition process based on relative spatial and temporal transformation. DETAILED DESCRIPTION
[0050] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0051] The embodiment of the present invention discloses a video facial expression category recognition method and system based on relative space-time transformation. By focusing on the spatial features and temporal features in the local features of facial expressions, the spatial and temporal geometric information is further encoded into the temporal and spatial features to reduce noise interference, accurately extract the emotional features in facial expressions, and promote the effective learning of temporal and spatial features.
[0052] like Figure 1 , the application method comprises the following steps:
[0053] Extract local spatial features of each frame in the video;
[0054] Based on the Euclidean distance, each local spatial feature is spatially relatively transformed, and the obtained spatial relative transformation features are weighted fused and aggregated to obtain the spatial features of each frame of the image;
[0055] Based on the Euclidean distance and the hyperbolic distance, the spatial features of each frame of the image are subjected to time-series relative transformation, and the obtained time-series relative transformation features are subjected to weighted fusion and aggregation learning to obtain the spatiotemporal emotional features of the video;
[0056] The facial expression category is identified according to the spatiotemporal emotional features of the video.
[0057] The following is an explanation through specific embodiments.
[0058] Embodiment 1
[0059] The first step is to extract the local spatial features of each frame in the video;
[0060] In this embodiment, convolution is used to extract local spatial features of each frame of the input facial expression video data; for example, ResNet is used as a convolution backbone network to extract features of each frame of the video image.
[0061] In one embodiment, the backbone convolutional neural network uses ResNet-18, which has 5 stages. Except for the first stage, all other stages are composed of residual blocks with different output feature scales. The spatial features of all frame images {Z1, Z2, ..., Z T}.
[0062] The second step is to perform spatial relative transformation on each local spatial feature based on the Euclidean distance, perform weighted fusion and aggregate learning on the obtained spatial relative transformation features, and obtain the spatial features of each frame of the image;
[0063] In general, step 2 includes the following steps:
[0064] S21: Calculate the Euclidean distance between two different local spatial feature blocks according to the input local spatial features;
[0065] S22: The spatial relative transformation feature of each local spatial feature is represented by a one-dimensional vector composed of the distance between the local spatial feature and other local spatial features, and all the one-dimensional vectors are connected in parallel to obtain a set of spatial relative transformation features;
[0066] S23: Calculate the fused attention coefficient of the spatial relative transformation feature based on the attention learning operation to obtain the weighted spatial relative transformation feature.
[0067] S24: concatenating the weighted spatial relative transformation feature with the corresponding original local spatial feature to obtain a weighted fused spatial relative transformation feature;
[0068] S25: Aggregate learning is performed on the weighted fused spatial relative transformation features to obtain the spatial features of the image.
[0069] The local area of the face usually conveys richer emotional information. The spatial features z of each frame image obtained by the backbone convolutional neural network i , whose dimension is c×h×w. Then for each frame of video image feature Z i , divided into L local spatial features along the spatial dimensions (h and w), namely {z1,...,z L}, where L = hw. Then the local spatial features are input into the spatial relative transformation module to learn the spatial relative transformation enhanced features.
[0070] S21, calculate the Euclidean distance between two different local spatial feature blocks
[0071] The original features do not take into account the use and preservation of the manifold geometric structure between different local features, which can well reflect the structural information of the face image and show high-level rich emotional characteristics. Therefore, the spatial relative transformation module proposed in the present invention constructs its inherent important spatial geometric structure by calculating the Euclidean distance between two different local spatial feature blocks. For any two local spatial features and, their Euclidean distance can be expressed as follows:
[0072]
[0073] Among them, m represents the dimension of the feature, Represents two local spatial features z i and z j The Euclidean distance is , and l is the total amount of local spatial features. The present invention explores the important structural relationship by calculating the distance between each spatial local feature and other spatial local features, so as to discover the useful spatial structural information related to the facial features and expressions of human faces.
[0074] S22, determining the spatial relative transformation characteristics of the local spatial characteristics according to the Euclidean distance;
[0075] For each local spatial feature, a set of Euclidean distances with other local features will be obtained, so each local spatial feature can be represented by features composed of these distances. This set of feature vectors covers the inherent similarity relationship between the local feature and other features, and can effectively express the geometric structure information between them. For this, the spatial relative transformation vector of any local spatial feature i is expressed as:
[0076] in,
[0077] Next, all the space relative transformation vectors are connected in parallel to obtain a set of corresponding space relative transformation features, which are specifically expressed as follows:
[0078]
[0079] S23, weighting the spatial relative transformation feature;
[0080] After learning and obtaining a set of spatial relative transformation features, in order to better embed the learned spatial geometric knowledge into the original spatial features, the present invention designs an effective fusion attention mechanism to adaptively learn a suitable fusion attention coefficient to find a fusion method that best combines the original features for weighted splicing. The fusion attention module is as follows: Figure 2 As shown;
[0081] Specifically, for the learned spatial relative transformation feature matrix S, it is input into a fully connected layer (FC) to adaptively learn the attention weight of any local spatial relative transformation feature vector si, and then the learned attention weight is normalized to between 0 and 1 through the Sigmoid function to obtain the final fusion attention coefficient α i , and finally obtain a set of attention weights α = {α1, α2, α3, ..., α L}Multiply it by the space relative transformation matrix S, the above process can be simply summarized as:
[0082] α=σ(FC(S))
[0083]
[0084] in Represents the element-by-element multiplication operation, and σ(·) is defined as the Sigmoid function. By adaptively adjusting and learning the weight coefficients of each local spatial relative transformation feature vector, a more comprehensive weighted spatial relative transformation feature is further integrated.
[0085] S24, concatenating the weighted spatial relative transformation feature with the corresponding original local spatial feature;
[0086] Furthermore, we consider concatenating the captured weighted spatial relative transformation features with the original features to effectively embed the learned geometric structure knowledge into the original spatial features, which is expressed as follows:
[0087]
[0088] Any eigenvector Among them, zi represents the original local feature, Represents a feature vector concatenation operation.
[0089] After the above operations, the weighted fusion spatial relative change features are finally obtained.
[0090] S25: aggregate learning of the weighted fusion spatial relative transformation features to learn the spatial features of each frame of expression image in the video;
[0091] After step S24, the weighted fused relative transformation features embedded with spatial geometric knowledge are obtained. Then, the original features and geometric knowledge of the feature matrix are effectively fused through aggregation learning, while achieving effective interaction between different local features to learn effective spatial feature representation for each frame of the image.
[0092] Specifically, we first introduce a dynamic fusion feature token s f , which is defined as:
[0093]
[0094] Then, it is spliced into the weighted fusion spatial relative transformation feature so that S R ={s f, s R1 ,s R2 , ..., s RL Then, different local spaces are aggregated and fused, and the interaction of local space information is realized through multi-head spatial attention (MHSA) to better integrate geometric knowledge into the features. The process can be described by the formula:
[0095]
[0096]
[0097] S RM =S R +LN(MHSA(S R ))
[0098] S RS =S RM +LN(MLP(S RM ))
[0099] Among them, ρ represents the Softmax function, W Qj , W Kj and W Vj represents the feature embedding matrix of the jth head, represents the multi-head spatial attention feature fusion conversion matrix, MLP represents the multi-layer perceptron, and LN(·) represents the layer normalization operation (LayerNormalization). Through the above operations, we can effectively explore and capture the important spatial features of each frame of expression image.
[0100] In one embodiment, before the third step, the spatial features of multiple frames of images are sorted in time order to form video temporal features. Figure 3 shown.
[0101] For each frame image, after spatial relative transformation, weighted fusion and aggregation learning, the learned dynamic fusion feature token s is extracted f =S RS,0 As the final feature of the frame image. Then, the features of each frame image are connected in parallel to form a set of temporal features S of the facial expression video F ={s f1 ,s f2 , ..., s fT}.
[0102] The third step is to perform a temporal relative transformation on the spatial features of each frame of the image based on the Euclidean distance and the hyperbolic distance, and to perform weighted fusion and aggregate learning on the obtained temporal relative transformation features to obtain the temporal and spatial emotional features of the video;
[0103] Video data usually contains dynamic changes in temporal information. Exploring and utilizing useful temporal geometric structure information can help effectively capture the dynamic information of facial expressions in videos, which helps to learn richer temporal information to obtain more efficient video expression features.
[0104] To this end, after obtaining the time series features, the present invention designs a dual time series relative transformation module to capture and construct useful time series geometric information from different spaces, embed it into the original time series features for weighted fusion, so that the time series features can contain richer multi-level information.
[0105] The specific steps include:
[0106] S31: Calculate the Euclidean distance between two different temporal sub-features in the input video temporal features; the temporal sub-features refer to the spatial features of each frame of the image obtained in the second step;
[0107] S32: For each time series sub-feature, the distance between the feature and other time series sub-features is used to form a one-dimensional vector to represent its corresponding Euclidean space time series relative transformation feature, and a set of Euclidean distance time series relative transformation features are obtained in parallel.
[0108] S33: Mapping the input video temporal features into a hyperbolic space to obtain a hyperbolic temporal feature, and calculating the hyperbolic distances between the temporal sub-features of the hyperbolic temporal feature;
[0109] S34: for each hyperbolic time series sub-feature, the distance between the feature and other hyperbolic time series sub-features is used to form a one-dimensional vector to represent its corresponding hyperbolic distance time series relative transformation feature, and a group of hyperbolic distance time series relative transformation features are obtained in parallel;
[0110] S35: applying the attention learning operation to calculate the fusion attention coefficients of the Euclidean and hyperbolic time series relative transformation features respectively, and obtaining the weighted time series relative transformation features;
[0111] S36: concatenating the learned weighted time series relative transformation features with the original time series features;
[0112] S37: Perform aggregate learning on the weighted fused temporal features to finally obtain the spatiotemporal emotional features of the video.
[0113] Specifically, the dual temporal relative transformation module mainly includes three parts: Euclidean distance temporal relative transformation, hyperbolic distance temporal relative transformation and fusion attention learning.
[0114] In S31, the original time series feature S F ={s f1 ,s f2 , ..., s fT} does not consider well the utilization and preservation of the dynamic temporal manifold geometry between different temporal sub-features, which can well reflect the subtle motion changes of different facial expression frames and show high-level rich emotional characteristics.
[0115] Therefore, the Euclidean distance temporal relative transformation module proposed in the present invention constructs its important temporal dynamic geometric structure by calculating the Euclidean distance between two different temporal sub-features. fi and fj , its Euclidean distance can be expressed as follows:
[0116]
[0117] Where n represents the dimension of the time series sub-feature, Represents two time series sub-features s fi and fj The present invention explores the important structural relationship by calculating the Euclidean distance between each temporal sub-feature and other temporal sub-features, so as to discover the useful temporal dynamic geometric structure information of the face video frame.
[0118] In S32, for each time series sub-feature, a set of corresponding Euclidean distances obtained from other time series sub-features will be obtained. The one-dimensional vector composed of these distances can represent the dynamic geometric information structure of the time series sub-feature. This set of feature vectors covers the intrinsic similarity relationship between the time series sub-feature and other time series features, and can effectively characterize the dynamic time series geometric changes between them. For this, the Euclidean distance time series relative transformation vector of any time series sub-feature i is expressed as:
[0119] in,
[0120] The Euclidean distance time series relative transformation vectors of all time series sub-features are connected in parallel to obtain a set of corresponding Euclidean distance time series relative transformation feature matrices, which are specifically expressed as follows:
[0121]
[0122] S33, mapping the input video time series feature into a hyperbolic space to obtain a hyperbolic time series feature;
[0123] For facial expression video data, since facial expression changes are mainly presented in some small facial action unit areas, there are subtle differences in facial expression images between different frames. The Euclidean distance is linear and symmetrical, which may ignore important features in the data and may not be able to capture the richness of video expressions and subtle action changes. Since the distance in the hyperbolic space is nonlinear and asymmetric, it can reflect the subtle differences and directionality in the data. At the same time, the hyperbolic space is highly deformable, which can better capture the similarity and distance in the data and better adapt to the dynamic changes of the data. Therefore, the hyperbolic distance time series relative transformation considers converting the original time series features into the hyperbolic space, which can enhance the differences between different frames of the video to better capture the subtle action changes of facial expressions.
[0124] For the input time series feature S F ={s f1 ,s f2 , ..., s fT}, firstly map it into the hyperbolic geometric space through the Poincareball model to obtain the hyperbolic time series feature S HY ={s hy1 ,s hy2 , ..., s hyT}. Specifically, each time series sub-feature s fi The process of mapping from Euclidean space to hyperbolic geometric space is shown in the following formula:
[0125]
[0126] Where tanh(·) represents the hyperbolic tangent function and c represents the negative curvature of the sphere. Through the above calculation, we get a set of hyperbolic time series features S HY Next, in the hyperbolic space, the hyperbolic distance between different hyperbolic time series subsequences is calculated. For any two hyperbolic time series subfeatures s hyi and hyj , its hyperbolic distance can be expressed as follows:
[0127]
[0128]
[0129] in Represents two time series sub-features s hyi and hyj The hyperbolic distance. represents an addition operation in a hyperbolic space, where x and y represent any two points in the hyperbolic space. The present invention explores important structural relationships by calculating the hyperbolic distance between each temporal sub-feature and other temporal sub-features, so as to discover useful temporal dynamic geometric structure information of face video frames.
[0130] S34, after step S33, for each time series sub-feature, a set of corresponding hyperbolic distances obtained from other time series sub-features will be obtained. The one-dimensional vector composed of these hyperbolic distances can express the dynamic geometric information structure of the time series sub-feature in the hyperbolic space, which can more clearly describe the dynamic time series geometric changes between them. Therefore, the hyperbolic distance time series relative transformation vector of any time series sub-feature i can be obtained, which is expressed as:
[0131] in,
[0132] The hyperbolic distance time series relative transformation vectors of all time series sub-features are connected in parallel to obtain a set of corresponding hyperbolic distance time series relative transformation feature matrices, which are specifically expressed as follows:
[0133]
[0134] S35, performing weighted fusion on the time series relative transformation features;
[0135] In order to better embed the learned temporal geometry knowledge into the original temporal features, the present invention deploys a dual temporal fusion attention mechanism to adaptively learn the appropriate fusion attention coefficient and weightedly fuse the dual distance temporal relative transformation features with the original temporal features. Figure 3 As shown;
[0136] Specifically, for the learned dual temporal relative transformation feature matrices V and U, we adaptively learn any temporal relative transformation feature vector v i and u i The attention weight is then normalized to between 0 and 1 through the Sigmoid function to obtain the final fusion attention coefficient β i and γ i , and finally we get two sets of attention weights β = {β1, β2, β3, ..., β T} and γ = {γ1, γ2, γ3,..., γ T}Multiply them respectively by their corresponding time-series relative transformation matrices V and U. The above process can be simply summarized as:
[0137] β=σ(FC(V)), γ=σ(FC(U))
[0138]
[0139] in, Represents the element-by-element multiplication operation, σ(·) is defined as the Sigmoid function, and the weight coefficients of each time series relative transformation feature vector are adaptively adjusted and learned to further integrate and obtain a more comprehensive weighted time series relative transformation feature.
[0140] S36. Concatenate the learned weighted time series relative transformation features with the original time series features.
[0141] Furthermore, we consider concatenating the captured dual-weighted temporal relative transformation features with the original temporal features to effectively embed the learned temporal dynamic geometric structure knowledge into the original temporal features, which is expressed as follows:
[0142]
[0143] Any eigenvector
[0144] in Represents the feature vector concatenation operation. After the above operation, the weighted fusion time series transformation feature S is finally obtained. P .
[0145] S37: Perform aggregate learning on the weighted fused temporal features to finally obtain the spatiotemporal emotional features of the video.
[0146] The weighted fused temporal features are aggregated and learned to efficiently fuse the original temporal features and dynamic geometry knowledge, while achieving effective interaction between different temporal features to obtain the final emotional feature representation of the facial expression video.
[0147] Specifically, we first introduce a dynamic category token s cls , which is defined as:
[0148]
[0149] Then, it is spliced into the weighted fusion spatial relative transformation feature to obtain the temporal feature matrix {s cls , S P1 , S P2 , ..., S PL}.
[0150] At the same time, a learnable temporal position encoding embedding e is defined pos , where pos = {1, 2, 3, ..., T}, and the temporal position information is encoded into the temporal features, so that S P ={s cls ,s P1 ,sP2 , ..., s PL}+e pos Then, different weighted fusion temporal relative transformation features are aggregated, and the interaction of different temporal information is realized through multi-head temporal attention (MHTA), while better integrating temporal dynamic geometry knowledge into the features. The process can be described by the formula:
[0151]
[0152]
[0153] S PM =S P +LN(MHTA(S P ))
[0154] S PT =S PM +LN(MLP(S PM ))
[0155] Among them, ρ represents the Softmax function, W Qj , W Kj and W Vj represents the feature embedding matrix of the jth head, represents the multi-head temporal attention feature fusion conversion matrix, MLP represents the multi-layer perceptron, and LN(·) represents the layer normalization operation (LayerNormalization).
[0156] Through aggregate learning, not only can the weighted fusion time series sub-features be interactively learned, but also the dynamic classification tokens can be cls= S PT,0 Fully select useful time series features for fusion to obtain useful classification feature representation.
[0157] Step 4: Identify facial expression categories based on the spatiotemporal emotional characteristics of the video.
[0158] In this embodiment, the spatiotemporal emotional features S of each video are obtained. PT,0 After that, it is input into the linear classifier for emotion recognition, which is expressed as:
[0159]
[0160] in Indicates the emotion category predicted by the video. In addition, video facial expression recognition belongs to the image video classification task, so it is necessary to use the back propagation optimization algorithm to optimize the classification loss to minimize it as much as possible. The training loss of this embodiment is mainly realized by the classification cross entropy loss, which is defined as:
[0161]
[0162] in Represents the true emotional label of the input video data, Y i Represents the probability of the i-th expression, so its value is either 0 or 1.
[0163] The invention discloses a method for identifying emotional categories of facial expressions in videos based on relative space-time transformation, which is implemented by an end-to-end neural network, wherein the input is a facial expression video frame, and the output is a recognized emotion type.
[0164] The overall architecture is as follows Figure 4 As shown in the figure, the proposed method first uses ResNet as the convolutional backbone network to extract features from each frame of the video image, and after spatial relative transformation, obtains the spatial relative transformation features based on Euclidean distance, and uses fusion attention to weightedly concatenate and fuse them with the original spatial features. Furthermore, the concatenated fusion features are transformed and learned to obtain the spatial features of each frame of the image.
[0165] Then, the obtained spatial features of each frame of the image are connected in parallel to form a temporal feature of a video sequence. After a double temporal relative transformation, the double temporal relative transformation features based on Euclidean distance and hyperbolic distance are obtained. The fused attention is used to weightedly splice and fused it with the original temporal features, and the spliced fusion features are transformed and learned to obtain the final video emotional features.
[0166] Finally, it is input into the last layer classifier of the neural network to obtain the predicted emotion category.
[0167] Embodiment 2
[0168] This embodiment further discloses a video facial expression category recognition system based on relative time-space transformation, and its framework diagram is as follows: Figure 5 As shown, the system includes:
[0169] A spatial relative transformation module is used to perform spatial relative transformation on the local spatial features of each frame of image according to the Euclidean distance to obtain spatial relative transformation features;
[0170] A spatial feature interaction module, used for weighted fusion and aggregation learning of the spatial relative transformation features to obtain spatial features of each frame of the image; preferably, the module is composed of a spatial Transformer;
[0171] Among them, the spatial Transformer includes vector embedding, multi-head spatial attention, the first Add&Nom layer, the multi-layer perceptron and the second Add&Nom layer in sequence;
[0172] A time series relative transformation module is used to perform time series transformation on the spatial features of each frame of the image according to the Euclidean distance and the hyperbolic distance to obtain time series relative transformation features;
[0173] A temporal feature interaction module is used to perform weighted fusion and aggregate learning on the temporal relative transformation features to obtain the spatiotemporal emotional features of the video. Preferably, the temporal feature interaction module is mainly composed of a temporal transformer;
[0174] In one embodiment, it further includes:
[0175] A local spatial feature extraction module, used to extract local spatial features of each frame of the video; and
[0176] The facial expression category recognition module is used to recognize the facial expression category according to the spatiotemporal emotional characteristics of the video.
[0177] This implementation case is implemented using the deep learning framework PyTorch, and all experiments are run on a server equipped with two NVIDIA RTX 3090 GPUs. In addition, its CPU is Intel i9-10850K, the memory is 64G, and the operating system is Ubuntu 18.04. The implementation case uses the same hyperparameter settings as ResNet18. During training, the stochastic gradient descent algorithm with a weight decay of 1e-4, a momentum of 0.9, and a batch size of 32 is used to learn the parameters. The total number of training rounds of the model is 60, and the learning rate starts at 0.01, and the learning rate is decayed to the original every 30 rounds. When training the model, only the general video data augmentation method is used, that is, the size of the input set of video frame images is scaled to 112×112, and then a copy of the size of 112×112 is randomly cropped, and finally the set of video images is horizontally flipped with a probability of 0.5. In the test phase, the images are scaled to 112×112.
[0178] Experiments show that the present invention surpasses the existing video facial expression recognition method, not only has a small number of parameters, but also achieves better performance, which also shows the high efficiency of the proposed method.
[0179] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0180] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A video facial expression category recognition method based on relative space-time transformation, characterized in that: include, Extract local spatial features of each frame in the video; Based on the Euclidean distance, each local spatial feature is spatially relatively transformed, and the obtained spatial relative transformation features are weighted fused and aggregated to obtain the spatial features of each frame of the image; the spatial relative transformation features are one-dimensional vectors composed of the Euclidean distances between the corresponding local spatial features and other local spatial features; Based on the Euclidean distance and the hyperbolic distance, the spatial features of each frame of the image are subjected to time-series relative transformation, and the obtained time-series relative transformation features are subjected to weighted fusion and aggregation learning to obtain the spatiotemporal emotional features of the video; the steps include: Based on the Euclidean distance, the spatial features of each frame of the image are relatively transformed in time to obtain the first relative temporal transformation features in the Euclidean space. Based on the hyperbolic distance, the spatial features of each frame of the image are relatively transformed in time to obtain the second relative temporal transformation features in the hyperbolic space. After weighted fusion and aggregate learning of the first relative temporal transformation features and the second relative temporal transformation features, the spatiotemporal emotional features of the video are obtained. The first temporal relative transformation feature is a one-dimensional vector composed of the Euclidean distance between the spatial feature of the corresponding frame image and the spatial features of other frame images; The second temporal relative transformation feature is a one-dimensional vector composed of the hyperbolic distance between the corresponding frame image spatial feature and other frame image spatial features; The facial expression category is identified according to the spatiotemporal emotional features of the video.
2. The method for video facial expression category recognition based on relative space-time transformation according to claim 1, characterized in that: When calculating the hyperbolic distance, the spatial features of each frame of the image are first mapped to the hyperbolic geometric space through the Poincare disk model according to the following formula: Where tanh(·) represents the hyperbolic tangent function, c represents the negative curvature of the sphere, and s fi Represents the spatial features of the i-th frame image.
3. The video facial expression category recognition method based on relative space-time transformation according to claim 2 is characterized in that: In the hyperbolic geometric space, the hyperbolic distance between the spatial features of any two frames of images is calculated according to the following formula; in, Representation features hyi and hyj Hyperbolic distance, s hyi and hyj Respectively represent the temporal features corresponding to the spatial features of the i-th frame and the j-th frame images in the hyperbolic space, Represents the addition operation in hyperbolic space, where x and y represent any two points in the hyperbolic space.
4. The method for video facial expression category recognition based on relative space-time transformation according to claim 1, characterized in that: The weighted fusion process includes: Through the fully connected layer, the attention weights of the spatial relative transformation feature, the first temporal relative transformation feature, and the second temporal relative transformation feature are learned respectively, and the Sigmoid function is used to regularize them to obtain the corresponding attention coefficients. The spatial relative transformation feature is weighted according to the corresponding attention coefficient and then concatenated with the corresponding local spatial feature to obtain a weighted spatial relative transformation feature; The first temporal relative transformation feature and the second temporal relative transformation feature are weighted according to the corresponding attention coefficients and then concatenated with the image space features of the corresponding frame to obtain the corresponding weighted temporal relative transformation feature.
5. The method for video facial expression category recognition based on relative time-space transformation according to claim 1, characterized in that: The weighted fusion transformation features are aggregated and learned through multi-head attention and multi-layer perceptron in turn; Before aggregating and learning the spatial relative transformation features, the spatial dynamic category tokens are set and concatenated into the weighted fused spatial relative transformation features. Before the aggregation learning of the temporal relative transformation features, the temporal dynamic category tokens are set first and spliced into the weighted fused temporal relative transformation features, and the temporal position encoding is determined and embedded into the corresponding weighted fused temporal relative transformation features.
6. According to the video facial expression category recognition method based on relative space-time transformation described in claim 1, after obtaining the spatial features of each frame of the image, they are first sorted by time, and the temporal relative transformation features are obtained based on the sorted image spatial features.
7. A video facial expression category recognition system based on relative time-space transformation, characterized in that: A video facial expression category recognition method based on relative space-time transformation as described in any one of claims 1 to 6 is applied, comprising: A spatial relative transformation module is used to perform spatial relative transformation on the local spatial features of each frame of image according to the Euclidean distance to obtain spatial relative transformation features; A spatial feature interaction module is used to perform weighted fusion and aggregation learning on the spatial relative transformation features to obtain the spatial features of each frame of the image; A time series relative transformation module is used to perform time series transformation on the spatial features of each frame of the image according to the Euclidean distance and the hyperbolic distance to obtain time series relative transformation features; The temporal feature interaction module is used to perform weighted fusion and aggregation learning on the temporal relative transformation features to obtain the spatiotemporal emotional features of the video.
8. The video facial expression category recognition system based on relative space-time transformation according to claim 7 is characterized in that: Also includes, A local spatial feature extraction module is used to extract the local spatial features of each frame of the video; as well as The facial expression category recognition module is used to recognize the facial expression category according to the spatiotemporal emotional characteristics of the video.
