SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2205.01782 · IJCAI · 2022

Learning Multi-dimensional Edge Feature-based AU Relation Graph for Facial Action Unit Recognition

Linlin Shen, Siyang Song, Cheng Luo, Weicheng Xie, Hatice Gunes

arXiv · PDF · Open in the Atlas

Code that ran

7 of 7 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (4 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 6 have no contract verdict; 1 failure of our instrument; 0 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2205.01782.json · badge: /api/ran/2205.01782.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
tomas-gajarsky/facetorch community
Papers with Code archive
5 ran · 0 no recorded run
CVI-SZU/ME-GraphAU community
Papers with Code archive
2 ran · 0 no recorded run
FunctionStatusWhere it lives
AUHead Ran
ran on a synthesized input
tomas-gajarsky/facetorch/model_defs/au_model.py
code served (permissive licence) · get_code("2feb320e2c23be1a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import math
import torch
import torch.nn as nn
import torch.nn.functional as F

# Copy the classes from the provided code
class GNN(nn.Module):

    def __init__(self, in_channels, num_classes, neighbor_num=4):
        super().__init__()
        self.in_channels = in_channels
        self.num_classes = num_classes
        self.neighbor_num = neighbor_num
        self.relu = nn.ReLU()
        self.U = nn.Linear(in_channels, in_channels)
        self.V = nn.Linear(in_channels, in_channels)
        self.bnv = nn.BatchNorm1d(num_classes)
        self.U.weight.data.normal_(0, math.sqrt(2.0 / in_channels))
        self.V.weight.data.normal_(0, math.sqrt(2.0 / in_channels))
        self.bnv.weight.data.fill_(1)
        self.bnv.bias.data.zero_()

    def forward(self, x):
        b, n, c = x.shape
        si = x.detach()
        si = torch.einsum('b i j , b j k -> b i k', si, si.transpose(1, 2))
        threshold = si.topk(k=self.neighbor_num, dim=-1, largest=True)[0][:, :, -1].reshape(b, n, 1)
        adj = (si >= threshold).float()
        A = _normalize_digraph(adj)
        aggregate = torch.einsum('b i j, b j k->b i k', A, self.V(x))
        return self.relu(x + self.bnv(aggregate + self.U(x)))

class LinearBlock(nn.Module):

    def __init__(self, in_features, out_features=None, drop=0.0):
        super().__init__()
        out_features = out_features or in_features
        self.fc = nn.Linear(in_features, out_features)
        self.bn = nn.BatchNorm1d(out_features)
        self.relu = nn.ReLU(inplace=True)
        self.drop = nn.Dropout(drop)
        self.fc.weight.data.normal_(0, math.sqrt(2.0 / out_features))
        self.bn.weight.data.fill_(1)
        self.bn.bias.data.zero_()

    def forward(self, x):
        x = self.drop(x)
        x = self.fc(x).permute(0, 2, 1).contiguous()
        x = self.relu(self.bn(x)).permute(0, 2, 1).contiguous()
        return x

def _normalize_digraph(A: torch.Tensor) -> torch.Tensor:
    node_degrees = A.detach().sum(dim=-1)
    degs_inv_sqrt = node_degrees ** (-0.5)
    norm_degs_matrix = torch.diag_embed(degs_inv_sqrt).to(dtype=A.dtype)
    return torch.bmm(torch.bmm(norm_degs_matrix, A), norm_degs_matrix)

class AUHead(nn.Module):

    def __init__(self, in_channels, num_main_classes=27, num_sub_classes=14):
        super().__init__()
        self.in_channels = in_channels
        self.num_main_classes = num_main_classes
        self.num_sub_classes = num_sub_classes
        layers = [LinearBlock(in_channels, in_channels) for _ in range(num_main_classes)]
        self.main_class_linears = nn.ModuleList(layers)
        self.gnn = GNN(in_channels, num_main_classes)
        self.main_sc = nn.Parameter(torch.zeros(num_main_classes, in_channels))
        self.sub_sc = nn.Parameter(torch.zeros(num_sub_classes, in_channels))
        self.sub_list = [0, 1, 2, 4, 7, 8, 11]
        self.relu = nn.ReLU()
        nn.init.xavier_uniform_(self.main_sc)
        nn.init.xavier_uniform_(self.sub_sc)

    def forward(self, x):
        f_u = [layer(x).unsqueeze(1) for layer in self.main_class_linears]
        f_u = torch.cat(f_u, dim=1)
        f_v = f_u.mean(dim=-2)
        f_v = self.gnn(f_v)
        b, n, c = f_v.shape
        main_sc = F.normalize(self.relu(self.main_sc), p=2, dim=-1)
        main_cl = (F.normalize(f_v, p=2, dim=-1) * main_sc.reshape(1, n, c)).sum(dim=-1)
        sub_cl = []
        for i, index in enumerate(self.sub_list):
            main_au = F.normalize(f_v[:, index], p=2, dim=-1)
            sc_l = F.normalize(self.relu(self.sub_sc[2 * i]), p=2, dim=-1)
            sc_r = F.normalize(self.relu(self.sub_sc[2 * i + 1]), p=2, dim=-1)
            sub_cl.append((main_au * sc_l.reshape(1, c)).sum(dim=-1, keepdim=True))
            sub_cl.append((main_au * sc_r.reshape(1, c)).sum(dim=-1, keepdim=True))
        return torch.cat([main_cl, torch.cat(sub_cl, dim=-1)], dim=-1)

INIT_ARGS = {
    'in_channels': 4,
    'num_main_classes': 27,
    'num_sub_classes': 14,
}

ARGS = {
    'x': torch.randn(2, 27, 4),
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
CrossAttn Ran
ran on a synthesized input · constructed an object; no result was computed
CVI-SZU/ME-GraphAU/model/graph_edge_model.py
code served (permissive licence) · get_code("183ee9ac63fa9c42")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, CrossAttn: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import math

torch.manual_seed(0)

# The function signature is:
# def forward(self, y, x):
# where y and x are tensors that will be:
# - passed through linear layers expecting in_channels input dimension
# - used in matmul operations with compatible shapes

in_channels = 8

# Create the model instance
model = nn.Module()

# Define small tensors for the forward pass
# y will be the query input, x will be the key/value input
# Shapes: (batch_size, seq_len, in_channels) for typical attention
batch_size = 2
seq_len_y = 3
seq_len_x = 4

y = torch.randn(batch_size, seq_len_y, in_channels)
x = torch.randn(batch_size, seq_len_x, in_channels)

ARGS = {
    "in_channels": in_channels,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type CrossAttn — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a CrossAttn output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
GEM Ran
ran on a synthesized input
CVI-SZU/ME-GraphAU/model/graph_edge_model.py
code served (permissive licence) · get_code("bb7a676b77dee7d2")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 4, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import math

class CrossAttn(nn.Module):
    """ cross attention Module"""

    def __init__(self, in_channels):
        super(CrossAttn, self).__init__()
        self.in_channels = in_channels
        self.linear_q = nn.Linear(in_channels, in_channels // 2)
        self.linear_k = nn.Linear(in_channels, in_channels // 2)
        self.linear_v = nn.Linear(in_channels, in_channels)
        self.scale = (self.in_channels // 2) ** (-0.5)
        self.attend = nn.Softmax(dim=-1)
        self.linear_k.weight.data.normal_(0, math.sqrt(2.0 / (in_channels // 2)))
        self.linear_q.weight.data.normal_(0, math.sqrt(2.0 / (in_channels // 2)))
        self.linear_v.weight.data.normal_(0, math.sqrt(2.0 / in_channels))

    def forward(self, y, x):
        query = self.linear_q(y)
        key = self.linear_k(x)
        value = self.linear_v(x)
        dots = torch.matmul(query, key.transpose(-2, -1)) * self.scale
        attn = self.attend(dots)
        out = torch.matmul(attn, value)
        return out

class GEM(nn.Module):

    def __init__(self, in_channels, num_classes):
        super(GEM, self).__init__()
        self.in_channels = in_channels
        self.num_classes = num_classes
        self.FAM = CrossAttn(self.in_channels)
        self.ARM = CrossAttn(self.in_channels)
        self.edge_proj = nn.Linear(in_channels, in_channels)
        self.bn = nn.BatchNorm2d(self.num_classes * self.num_classes)
        self.edge_proj.weight.data.normal_(0, math.sqrt(2.0 / in_channels))
        self.bn.weight.data.fill_(1)
        self.bn.bias.data.zero_()

    def forward(self, class_feature, global_feature):
        B, N, D, C = class_feature.shape
        global_feature = global_feature.repeat(1, N, 1).view(B, N, D, C)
        feat = self.FAM(class_feature, global_feature)
        feat_end = feat.repeat(1, 1, N, 1).view(B, -1, D, C)
        feat_start = feat.repeat(1, N, 1, 1).view(B, -1, D, C)
        feat = self.ARM(feat_start, feat_end)
        edge = self.bn(self.edge_proj(feat))
        return edge

INIT_ARGS = {
    'in_channels': 8,
    'num_classes': 3
}

ARGS = {
    'class_feature': torch.randn(2, 3, 5, 8),
    'global_feature': torch.randn(2, 5, 8)
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
GNN Ran
ran on a synthesized input · constructed an object; no result was computed
tomas-gajarsky/facetorch/model_defs/au_model.py
code served (permissive licence) · get_code("871d4585235c0cf7")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, GNN: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import math

torch.manual_seed(0)

ARGS = {
    "in_channels": 4,
    "num_classes": 3,
    "neighbor_num": 2,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type GNN — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a GNN output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
LinearBlock Ran
ran on a synthesized input · constructed an object; no result was computed
tomas-gajarsky/facetorch/model_defs/au_model.py
code served (permissive licence) · get_code("12681ff944eff063")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, LinearBlock: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import math
import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    "in_features": 4,
    "out_features": 3,
    "drop": 0.1,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type LinearBlock — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a LinearBlock output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
OpenGraphAU Ran
ran on a synthesized input · constructed an object; no result was computed
tomas-gajarsky/facetorch/model_defs/au_model.py
code served (permissive licence) · get_code("ceba7e37e845cfc5")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, OpenGraphAU: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import math

torch.manual_seed(0)

ARGS = {
    "num_main_classes": 27,
    "num_sub_classes": 14,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
timm, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type OpenGraphAU — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a OpenGraphAU output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
_normalize_digraph Ran
ran; our contract draft was wrong, not the code
tomas-gajarsky/facetorch/model_defs/au_model.py
code served (permissive licence) · get_code("3fd8be2d40a50da3")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 3, dtype family float, shape (2, 4, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# A is a batch of adjacency matrices
# The function expects shape (batch_size, num_nodes, num_nodes)
# batch_size=2, num_nodes=4
A = torch.randn(2, 4, 4)

# Ensure A is non-negative (typical for adjacency matrices)
A = torch.abs(A)

ARGS = {
    "A": A,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 4, 4) — shape (2, 4, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 7 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

The activations of Facial Action Units (AUs) mutually influence one another. While the relationship between a pair of AUs can be complex and unique, existing approaches fail to specifically and explicitly represent such cues for each pair of AUs in each facial display. This paper proposes an AU relationship modelling approach that deep learns a unique graph to explicitly describe the relationship between each pair of AUs of the target facial display. Our approach first encodes each AU's activation status and its association with other AUs into a node feature. Then, it learns a pair of multi-dimensional edge features to describe multiple task-specific relationship cues between each pair of AUs. During both node and edge feature learning, our approach also considers the influence of the unique facial display on AUs' relationship by taking the full face representation as an input. Experimental results on BP4D and DISFA datasets show that both node and edge feature learning modules provide large performance improvements for CNN and transformer-based backbones, with our best systems achieving the state-of-the-art AU recognition results. Our approach not only has a strong capability in modelling relationship cues for AU recognition but also can be easily incorporated into various backbones. Our PyTorch code is made available at https://github.com/CVI-SZU/ME-GraphAU.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2205.01782")
get_code_for_paper("2205.01782")
have("2205.01782")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2205.01782.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2205.01782.svg)](https://syntology.ai/paper/2205.01782)

Connect an agent — have() is free.