SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2204.00964 · CVPR · 2022

AdaFace: Quality Adaptive Margin for Face Recognition

Xiaoming Liu, Minchul Kim, Anil Jain

arXiv · PDF · Open in the Atlas

Code that ran

17 of 22 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (2 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 1 violated it and 11 have no contract verdict; 3 failures of our instrument; 5 no recorded run), measured 2026-11-22; 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/2204.00964.json · badge: /api/ran/2204.00964.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
Armxyz1/Results-on-RFW community
Papers with Code archive
7 ran · 3 no recorded run
RocketFlash/easy_metric_learning community
Papers with Code archive
4 ran · 0 no recorded run
sithu31296/EasyFace community
Papers with Code archive
2 ran · 0 no recorded run
tomas-gajarsky/facetorch community
Papers with Code archive
2 ran · 0 no recorded run
mk-minchul/adaface marked official in Papers with Code
Papers with Code archive
1 ran · 0 no recorded run
copy not recorded community
not in the paper's declared repositories
1 ran · 0 no recorded run
leondgarse/Keras_insightface community
Papers with Code archive
0 ran · 2 no recorded run
FunctionStatusWhere it lives
AdaFace Ran
ran on a synthesized input
sithu31296/EasyFace/easyface/recognition/heads/adaface.py
code served (permissive licence) · get_code("fdd08128d4e32cda")
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 torch
import math
from torch import nn, Tensor

def l2_norm(x, dim=1):
    norm = torch.norm(x, 2, dim, keepdim=True)
    output = torch.div(x, norm)
    return output

class AdaFace(nn.Module):

    def __init__(self, embedding_size=512, num_classes=70722, m=0.4, h=0.333, s=64, t_alpha=0.01) -> None:
        super().__init__()
        self.m = m
        self.h = h
        self.s = s
        self.t_alpha = t_alpha
        self.eps = 0.001
        self.kernel = nn.Parameter(torch.Tensor(embedding_size, num_classes))
        self.kernel.data.uniform_(-1, 1).renorm_(2, 1, 1e-05).mul_(100000.0)
        self.register_buffer('batch_mean', torch.ones(1) * 20)
        self.register_buffer('batch_std', torch.ones(1) * 100)

    def forward(self, feats: Tensor, norms: Tensor, label: Tensor) -> Tensor:
        kernel_norm = l2_norm(self.kernel, dim=0)
        cosine = torch.mm(feats, kernel_norm).clamp(-1 + self.eps, 1 - self.eps)
        safe_norms = torch.clip(norms, min=0.001, max=100)
        with torch.no_grad():
            mean = safe_norms.mean().detach()
            std = safe_norms.std().detach()
            self.batch_mean = mean * self.t_alpha + (1 - self.t_alpha) * self.batch_mean
            self.batch_std = std * self.t_alpha + (1 - self.t_alpha) * self.batch_std
        margin_scaler = (safe_norms - self.batch_mean) / (self.batch_std + self.eps)
        margin_scaler = margin_scaler * self.h
        margin_scaler = torch.clip(margin_scaler, -1, 1)
        m_arc = torch.zeros(label.shape[0], cosine.shape[1], device=cosine.device).scatter_(1, label.view(-1, 1), 1.0)
        g_angular = self.m * margin_scaler * -1
        m_arc = m_arc * g_angular
        theta = cosine.acos()
        theta_m = torch.clip(theta + m_arc, self.eps, math.pi - self.eps)
        cosine = theta_m.cos()
        m_cos = torch.zeros(label.shape[0], cosine.shape[1], device=cosine.device).scatter_(1, label.view(-1, 1), 1.0)
        g_add = self.m + self.m * margin_scaler
        m_cos = m_cos * g_add
        cosine = cosine - m_cos
        scaled_cosine_m = cosine * self.s
        return scaled_cosine_m


INIT_ARGS = {
    'embedding_size': 4,
    'num_classes': 3,
    'm': 0.4,
    'h': 0.333,
    's': 64,
    't_alpha': 0.01
}

ARGS = {
    'feats': torch.randn(2, 4),
    'norms': torch.randn(2, 1).abs() + 0.1,
    'label': torch.tensor([0, 2])
}

model = AdaFace(**INIT_ARGS)
output = model(**ARGS)
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)
AdaFace Ran
ran on a synthesized input
RocketFlash/easy_metric_learning/src/model/margin/adaface.py
code served (permissive licence) · get_code("25446533fe6fcf5d")
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 torch
import torch.nn as nn
from torch.nn import Parameter
import math

def build_one_hot(label, num_classes, device, dtype=torch.float32):
    """Build one-hot or mixed-label weights for margin heads."""
    if is_mixed_label(label):
        label1, label2, lam = label
        one_hot = torch.zeros(label1.size(0), num_classes, device=device, dtype=dtype)
        lam1 = torch.full((label1.size(0), 1), float(lam), device=device, dtype=dtype)
        lam2 = torch.full((label2.size(0), 1), float(1 - lam), device=device, dtype=dtype)
        one_hot.scatter_add_(1, label1.view(-1, 1).long(), lam1)
        one_hot.scatter_add_(1, label2.view(-1, 1).long(), lam2)
    else:
        one_hot = torch.zeros(label.size(0), num_classes, device=device, dtype=dtype)
        one_hot.scatter_(1, label.view(-1, 1).long(), 1)
    return one_hot

def is_mixed_label(label):
    return isinstance(label, (list, tuple))

def l2_norm(input_x, axis=1):
    norm = torch.norm(input_x, 2, axis, True)
    output = torch.div(input_x, norm)
    return output

class AdaFace(nn.Module):
    """
    Implementation of adaface
    Implementation taken from: https://github.com/mk-minchul/AdaFace
    """

    def __init__(self, in_features=512, out_features=70722, m=0.4, h=0.333, s=64.0, t_alpha=1.0, ls_eps=0.0, use_batchnorm=False):
        super(AdaFace, self).__init__()
        self.classnum = out_features
        self.in_features = in_features
        self.out_features = out_features
        self.kernel = Parameter(torch.Tensor(in_features, out_features))
        self.kernel.data.uniform_(-1, 1).renorm_(2, 1, 1e-05).mul_(100000.0)
        self.m = m
        self.eps = 0.001
        self.h = h
        self.s = s
        self.use_batchnorm = use_batchnorm
        self.t_alpha = t_alpha
        self.ls_eps = ls_eps
        if self.use_batchnorm:
            self.norm_layer = nn.BatchNorm1d(1, eps=self.eps, momentum=self.t_alpha, affine=False)
        else:
            self.register_buffer('t', torch.zeros(1))
            self.register_buffer('batch_mean', torch.ones(1) * 20)
            self.register_buffer('batch_std', torch.ones(1) * 100)

    def forward(self, x, label):
        norms = torch.norm(x, 2, -1, keepdim=True)
        embbedings = x / norms
        kernel_norm = l2_norm(self.kernel, axis=0)
        cosine = torch.mm(embbedings, kernel_norm)
        cosine = cosine.clamp(-1 + self.eps, 1 - self.eps)
        safe_norms = torch.clip(norms, min=0.001, max=100)
        safe_norms = safe_norms.clone().detach()
        if self.use_batchnorm:
            margin_scaler = self.norm_layer(safe_norms)
        else:
            with torch.no_grad():
                mean = safe_norms.mean().detach()
                std = safe_norms.std().detach()
                self.batch_mean = mean * self.t_alpha + (1 - self.t_alpha) * self.batch_mean
                self.batch_std = std * self.t_alpha + (1 - self.t_alpha) * self.batch_std
            margin_scaler = (safe_norms - self.batch_mean) / (self.batch_std + self.eps)
            margin_scaler = margin_scaler * self.h
            margin_scaler = torch.clip(margin_scaler, -1, 1)
        m_arc = build_one_hot(label, self.out_features, device=cosine.device, dtype=cosine.dtype)
        if self.ls_eps > 0:
            m_arc = (1 - self.ls_eps) * m_arc + self.ls_eps / self.out_features
        g_angular = self.m * margin_scaler * -1
        m_arc = m_arc * g_angular
        theta = cosine.acos()
        theta_m = torch.clip(theta + m_arc, min=self.eps, max=math.pi - self.eps)
        cosine = theta_m.cos()
        m_cos = build_one_hot(label, self.out_features, device=cosine.device, dtype=cosine.dtype)
        g_add = self.m + self.m * margin_scaler
        m_cos = m_cos * g_add
        cosine = cosine - m_cos
        scaled_cosine_m = cosine * self.s
        return scaled_cosine_m


INIT_ARGS = {
    'in_features': 4,
    'out_features': 3,
    'm': 0.4,
    'h': 0.333,
    's': 64.0,
    't_alpha': 1.0,
    'ls_eps': 0.0,
    'use_batchnorm': False,
}

ARGS = {
    'x': torch.randn(2, 4),
    'label': torch.tensor([0, 1]),
}

if __name__ == '__main__':
    model = AdaFace(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Output: {output}")
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)
AdaFace Ran
ran on a synthesized input
mk-minchul/adaface/head.py
code served (permissive licence) · get_code("775e2b18a7335c45")
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 torch
from torch.nn import Module, Parameter
import math

def l2_norm(input, axis=1):
    norm = torch.norm(input, 2, axis, True)
    output = torch.div(input, norm)
    return output

class AdaFace(Module):

    def __init__(self, embedding_size=512, classnum=70722, m=0.4, h=0.333, s=64.0, t_alpha=1.0):
        super(AdaFace, self).__init__()
        self.classnum = classnum
        self.kernel = Parameter(torch.Tensor(embedding_size, classnum))
        self.kernel.data.uniform_(-1, 1).renorm_(2, 1, 1e-05).mul_(100000.0)
        self.m = m
        self.eps = 0.001
        self.h = h
        self.s = s
        self.t_alpha = t_alpha
        self.register_buffer('t', torch.zeros(1))
        self.register_buffer('batch_mean', torch.ones(1) * 20)
        self.register_buffer('batch_std', torch.ones(1) * 100)
        print('\nAdaFace with the following property')
        print('self.m', self.m)
        print('self.h', self.h)
        print('self.s', self.s)
        print('self.t_alpha', self.t_alpha)

    def forward(self, embbedings, norms, label):
        kernel_norm = l2_norm(self.kernel, axis=0)
        cosine = torch.mm(embbedings, kernel_norm)
        cosine = cosine.clamp(-1 + self.eps, 1 - self.eps)
        safe_norms = torch.clip(norms, min=0.001, max=100)
        safe_norms = safe_norms.clone().detach()
        with torch.no_grad():
            mean = safe_norms.mean().detach()
            std = safe_norms.std().detach()
            self.batch_mean = mean * self.t_alpha + (1 - self.t_alpha) * self.batch_mean
            self.batch_std = std * self.t_alpha + (1 - self.t_alpha) * self.batch_std
        margin_scaler = (safe_norms - self.batch_mean) / (self.batch_std + self.eps)
        margin_scaler = margin_scaler * self.h
        margin_scaler = torch.clip(margin_scaler, -1, 1)
        m_arc = torch.zeros(label.size()[0], cosine.size()[1], device=cosine.device)
        m_arc.scatter_(1, label.reshape(-1, 1), 1.0)
        g_angular = self.m * margin_scaler * -1
        m_arc = m_arc * g_angular
        theta = cosine.acos()
        theta_m = torch.clip(theta + m_arc, min=self.eps, max=math.pi - self.eps)
        cosine = theta_m.cos()
        m_cos = torch.zeros(label.size()[0], cosine.size()[1], device=cosine.device)
        m_cos.scatter_(1, label.reshape(-1, 1), 1.0)
        g_add = self.m + self.m * margin_scaler
        m_cos = m_cos * g_add
        cosine = cosine - m_cos
        scaled_cosine_m = cosine * self.s
        return scaled_cosine_m


INIT_ARGS = {
    'embedding_size': 4,
    'classnum': 3,
    'm': 0.4,
    'h': 0.333,
    's': 64.0,
    't_alpha': 1.0
}

ARGS = {
    'embbedings': torch.randn(2, 4),
    'norms': torch.randn(2, 1).abs() + 0.1,
    'label': torch.tensor([0, 2])
}

if __name__ == '__main__':
    model = AdaFace(**INIT_ARGS)
    output = model(**ARGS)
    print("Output shape:", output.shape)
    print("Output:", output)
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)
BasicBlockIR Ran
ran on a synthesized input
Armxyz1/Results-on-RFW/AdaFace/backbones/net.py
pointer only (licence: NONE) · get_code("d9cbf9097e9b2f3b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, Armxyz1/Results-on-RFW when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

BasicBlockIRSE Ran
ran on a synthesized input
Armxyz1/Results-on-RFW/AdaFace/backbones/net.py
pointer only (licence: NONE) · get_code("c7ff115d76b10e48")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, Armxyz1/Results-on-RFW when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

BottleneckIR Ran
ran on a synthesized input
Armxyz1/Results-on-RFW/AdaFace/backbones/net.py
pointer only (licence: NONE) · get_code("5ff2d0550242806c")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, Armxyz1/Results-on-RFW when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

BottleneckIRSE Ran
ran on a synthesized input
Armxyz1/Results-on-RFW/AdaFace/backbones/net.py
pointer only (licence: NONE) · get_code("e880b0d152ae66fd")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, Armxyz1/Results-on-RFW when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

Flatten Ran
ran on a synthesized input
Armxyz1/Results-on-RFW/AdaFace/backbones/net.py
pointer only (licence: NONE) · get_code("3f852d5b1c843b52")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, Armxyz1/Results-on-RFW when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

MagFaceIResNet100 Ran
ran on a synthesized input · constructed an object; no result was computed
tomas-gajarsky/facetorch/model_defs/verify_model.py
code served (permissive licence) · get_code("28bfa34e142cf7bf")
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, MagFaceIResNet100: 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

torch.manual_seed(0)

# MagFaceIResNet100 takes no arguments in __init__
ARGS = {}
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 MagFaceIResNet100 — 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 MagFaceIResNet100 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
SEModule Ran
ran on a synthesized input
Armxyz1/Results-on-RFW/AdaFace/backbones/net.py
pointer only (licence: NONE) · get_code("20b077f2201866aa")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, Armxyz1/Results-on-RFW when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

_MagFaceIBasicBlock Ran
ran on a synthesized input · constructed an object; no result was computed
tomas-gajarsky/facetorch/model_defs/verify_model.py
code served (permissive licence) · get_code("1d1184e941b3a490")
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, _MagFaceIBasicBlock: 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

torch.manual_seed(0)

# Create a small downsample module that matches the expected behavior
class SimpleDownsample(nn.Module):
    def forward(self, x):
        return x[:, :, ::2, ::2]  # Spatial downsampling

# Build ARGS dict with all parameters for _MagFaceIBasicBlock
ARGS = {
    "inplanes": 4,
    "planes": 8,
    "stride": 2,
    "downsample": SimpleDownsample(),
}
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 _MagFaceIBasicBlock — 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 _MagFaceIBasicBlock 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
build_one_hot Ran
ran; our contract draft was wrong, not the code
RocketFlash/easy_metric_learning/src/model/margin/adaface.py
code served (permissive licence) · get_code("00fcae2b28b19dbb")
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) and returned Tensor, ndim 2, dtype family float, shape (2, 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)

# Case 1: Regular label (not mixed)
label_regular = torch.tensor([0, 2], dtype=torch.long)
num_classes = 4
device = 'cpu'
dtype = torch.float32

ARGS = {
    'label': label_regular,
    'num_classes': num_classes,
    'device': device,
    'dtype': dtype
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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, shape (2, 4) — shape (2, 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
get_block Ran
ran, honoured the contract we drafted
this paper's copy was not recorded; identical code first harvested from LIVIAETS/bah-dataset
pointer only · get_code("ad5dbf57f3ea2633")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_blocks Ran
ran, honoured the contract we drafted
Armxyz1/Results-on-RFW/AdaFace/backbones/net.py
pointer only (licence: NONE) · get_code("e82dfb7d2386721b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, Armxyz1/Results-on-RFW when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

is_mixed_label Ran
ran, violated the contract we drafted
RocketFlash/easy_metric_learning/src/model/margin/adaface.py
code served (permissive licence) · get_code("ef4ec1a6ba91a991")
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) and returned bool, ndim 0, dtype family float, shape () 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
import numpy as np

torch.manual_seed(0)

# The function is_mixed_label checks if label is an instance of list or tuple
# We need to provide a value for the 'label' parameter

# Test case 1: label as a list (should return True)
label_list = [1, 2, 3]

# Test case 2: label as a tuple (should return True)
label_tuple = (1, 2, 3)

# Test case 3: label as a tensor (should return False)
label_tensor = torch.tensor([1, 2, 3])

# Test case 4: label as a scalar (should return False)
label_scalar = 5

# For ARGS, we'll use a list as the label since the function accepts any label
ARGS = {
    "label": [1, 2, 3]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () 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
l2_norm Ran
ran; our contract draft was wrong, not the code
sithu31296/EasyFace/easyface/recognition/heads/adaface.py
code served (permissive licence) · get_code("32e701066e89cd01")
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 2, dtype family float, shape (2, 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)

# Create a small tensor with batch size 2 and feature dimension 4
x = torch.randn(2, 4)

# Define the arguments dictionary
ARGS = {
    "x": x,
    "dim": 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 Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 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
l2_norm Ran
ran; our contract draft was wrong, not the code
RocketFlash/easy_metric_learning/src/model/margin/adaface.py
code served (permissive licence) · get_code("27524a6bac90b755")
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) and returned Tensor, ndim 2, dtype family float, shape (2, 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)

# Create a small tensor for input_x
# Shape: (batch_size=2, features=4)
input_x = torch.randn(2, 4)

# axis parameter for normalization
axis = 1

ARGS = {
    "input_x": input_x,
    "axis": axis,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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, shape (2, 4) — shape (2, 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
AdaFaceLoss Not yet run
unverified (harvested, no recorded run)
leondgarse/Keras_insightface/losses.py
code served (permissive licence) · get_code("bf12a79527a79d4a")
How it ran

no invocation recorded.

ArcfaceLossSimple Not yet run
unverified (harvested, no recorded run)
leondgarse/Keras_insightface/losses.py
code served (permissive licence) · get_code("40d45aa734161334")
How it ran

no invocation recorded.

Backbone Not yet run
unverified (harvested, no recorded run)
Armxyz1/Results-on-RFW/AdaFace/backbones/net.py
pointer only (licence: NONE) · get_code("f3ef8c1d9f566160")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, Armxyz1/Results-on-RFW when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Bottleneck Not yet run
unverified (harvested, no recorded run)
Armxyz1/Results-on-RFW/AdaFace/backbones/net.py
pointer only (licence: NONE) · get_code("c9258e60d2cf27ee")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, Armxyz1/Results-on-RFW when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

initialize_weights Not yet run
unverified (harvested, no recorded run)
Armxyz1/Results-on-RFW/AdaFace/backbones/net.py
pointer only (licence: NONE) · get_code("dd1764dcd0628ab8")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, Armxyz1/Results-on-RFW when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Also present in other papers' code

Of 22 samples lifted from this paper's linked repositories, 22 carry a function identity and 0 do not. Of the 22 distinct functions with an identity, 3 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 2 later) and 19 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.

FunctionAlso present inEarliest-datedOthers named
get_block
brick of this paper's assembly: helper
27 other papers
12 dated earlier, 15 later
1804.07573 (2018-04)
MobileFaceNets: Efficient CNNs for Accurate Real-Time Face Verification on Mobile Devices
1903.08527 (2019-03)
Accurate 3D Face Reconstruction with Weakly-Supervised Learning: From Single Image to Image Set
1907.10830 (2019-07)
U-GAT-IT: Unsupervised Generative Attentional Networks with Adaptive Layer-Instance Normalization for Image-to-Image Translation
and 24 more not named here
get_blocks
brick of this paper's assembly: helper
3 other papers
3 later
2405.15020 (2024-05)
AdjointDEIS: Efficient Gradients for Diffusion Models
2408.05939 (2024-08)
UniPortrait: A Unified Framework for Identity-Preserving Single- and Multi-Human Image Personalization
2501.01790 (2025-01)
Ingredients: Blending Custom Photos with Video Diffusion Transformers
ArcfaceLossSimple
brick of this paper's assembly: helper
1 other paper
1 dated earlier · 1 only as an assembly brick
2103.06627 (2021-03)
MagFace: A Universal Representation for Face Recognition and Quality Assessment

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-22.

Repositories linked to this paper

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

Abstract

Recognition in low quality face datasets is challenging because facial attributes are obscured and degraded. Advances in margin-based loss functions have resulted in enhanced discriminability of faces in the embedding space. Further, previous studies have studied the effect of adaptive losses to assign more importance to misclassified (hard) examples. In this work, we introduce another aspect of adaptiveness in the loss function, namely the image quality. We argue that the strategy to emphasize misclassified samples should be adjusted according to their image quality. Specifically, the relative importance of easy or hard samples should be based on the sample's image quality. We propose a new loss function that emphasizes samples of different difficulties based on their image quality. Our method achieves this in the form of an adaptive margin function by approximating the image quality with feature norms. Extensive experiments show that our method, AdaFace, improves the face recognition performance over the state-ofthe-art (SoTA) on four datasets (IJB-B, IJB-C, IJB-S and TinyFace). Code and models are released in Supp.

For agents

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

get_harvested_code_for_paper("2204.00964")
get_code_for_paper("2204.00964")
have("2204.00964")

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

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

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

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

Connect an agent — have() is free.