mexca.video.anfl
Action unit (AU) relationship-aware node feature learning (ANFL).
Implementation of the ANFL module from the paper:
Luo, C., Song, S., Xie, W., Shen, L., Gunes, H. (2022). Learning multi-dimentionsal edge feature-based AU relation graph for facial action unit recognition. arXiv. https://arxiv.org/pdf/2205.01782.pdf
Code adapted from the OpenGraphAU code base (licensed under Apache 2.0).
Module Contents
Classes
Apply a graph neural network (GNN) layer. |
|
Generate action unit (AU) features. |
|
Generate action unit (AU) activations from AU features using a facial graph. |
|
Apply AU relationship-aware node feature learning (ANFL). |
- class mexca.video.anfl.GNN(in_features: int, n_nodes: int, n_neighbors: int = 4)[source]
Apply a graph neural network (GNN) layer.
Transform action unit (AU) features using digraph connectivity. Inputs and outputs correspond to AU features.
- Parameters:
Notes
See eq. 1 in the corresponding paper. Functions \({g, r}\) are linear and the nonlinear activation function \(\sigma\) is ReLU. Linear layer weights are initialized with \(N(0, \sqrt{\frac{2}{out\_features}})\). Batch norm weights are initialized as 1 and biases as 0.
- class mexca.video.anfl.AUFeatureGenerator(in_features: int, out_features: int = 27)[source]
Generate action unit (AU) features.
Inputs correspond to face representations (embeddings) and outputs to AU features.
- Parameters:
Notes
AU specific features are generated by individual linear and global average pooling transformations.
- class mexca.video.anfl.FacialGraphGenerator(in_features: int, n_main_nodes: int = 27, n_sub_nodes: int = 14, n_neighbors: int = 4)[source]
Generate action unit (AU) activations from AU features using a facial graph.
Inputs correspond to AU features and outputs to AU activations. Main plus sub nodes represent facial AUs. Sub nodes represent left and right activations of AUs 1, 2, 4, 6, 10, 12, and 14.
- Parameters:
Notes
First applies a graph neural network (
GNN()
) transformation to AU features. Transformed features are fed into similarity calculating (SC) layers for main and sub nodes as in eq. 2 of the corresponding paper. Sub node activations are calulated based on matching main node features. SC layer weights are initialized using Glorot initialization (seetorch.nn.init.xavier_uniform()
).
- class mexca.video.anfl.ANFL(in_features: int, n_main_aus: int = 27, n_sub_aus: int = 14, n_neighbors: int = 4)[source]
Apply AU relationship-aware node feature learning (ANFL).
Transform face representations into facial action unit (AU) activations. Inputs correspond to facial representations (embeddings) and outputs to AU activations.
- Parameters:
Notes
First generates AU features from face representations (see
AUFeatureGenerator()
) and then transforms them into activations using a facial graph (seeFacialGraphGenerator()
).