SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2410.10587 · NeurIPS · 2024

TopoFR: A Closer Look at Topology Alignment on Face Recognition

Yang Liu, Siyuan Li, Baigui Sun, Shan Luo, Jiankang Deng, Jun Dan, Haoyu Xie

arXiv · PDF · Open in the Atlas

Code that ran

7 of 11 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 4 failures of our instrument; 4 no recorded run), measured 2026-11-22; 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/2410.10587.json · badge: /api/ran/2410.10587.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
modelscope/facechain canonical (classifier label)
classifier basis: classifier_2025
4 ran · 1 no recorded run
DanJun6737/TopoFR canonical (classifier label)
classifier basis: classifier_2025
1 ran · 2 no recorded run
copy not recorded community
not in the paper's declared repositories
2 ran · 1 no recorded run
FunctionStatusWhere it lives
PersistentHomologyCalculation Ran
ran on a synthesized input
modelscope/facechain/face_module/TopoFR/persistent_homology.py
code served (permissive licence) · get_code("97353204a3dd336d")
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 tuple. 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 numpy as np

class UnionFind:
    """
    An implementation of a Union--Find class. The class performs path
    compression by default. It uses integers for storing one disjoint
    set, assuming that vertices are zero-indexed.
    """

    def __init__(self, n_vertices):
        """
        Initializes an empty Union--Find data structure for a given
        number of vertices.
        """
        self._parent = np.arange(n_vertices, dtype=int)

    def find(self, u):
        """
        Finds and returns the parent of u with respect to the hierarchy.
        """
        if self._parent[u] == u:
            return u
        else:
            self._parent[u] = self.find(self._parent[u])
            return self._parent[u]

    def merge(self, u, v):
        """
        Merges vertex u into the component of vertex v. Note the
        asymmetry of this operation.
        """
        if u != v:
            self._parent[self.find(u)] = self.find(v)

    def roots(self):
        """
        Generator expression for returning roots, i.e. components that
        are their own parents.
        """
        for vertex, parent in enumerate(self._parent):
            if vertex == parent:
                yield vertex

class PersistentHomologyCalculation:

    def __call__(self, matrix):
        n_vertices = matrix.shape[0]
        uf = UnionFind(n_vertices)
        triu_indices = np.triu_indices_from(matrix)
        edge_weights = matrix[triu_indices]
        edge_indices = np.argsort(edge_weights, kind='stable')
        persistence_pairs = []
        for edge_index, edge_weight in zip(edge_indices, edge_weights[edge_indices]):
            u = triu_indices[0][edge_index]
            v = triu_indices[1][edge_index]
            younger_component = uf.find(u)
            older_component = uf.find(v)
            if younger_component == older_component:
                continue
            elif younger_component > older_component:
                uf.merge(v, u)
            else:
                uf.merge(u, v)
            if u < v:
                persistence_pairs.append((u, v))
            else:
                persistence_pairs.append((v, u))
        return (np.array(persistence_pairs), np.array([]))

INIT_ARGS = {}

ARGS = {
    'matrix': np.array([
        [0.0, 0.5, 0.3, 0.8],
        [0.5, 0.0, 0.2, 0.6],
        [0.3, 0.2, 0.0, 0.4],
        [0.8, 0.6, 0.4, 0.0]
    ], dtype=float)
}

if __name__ == '__main__':
    obj = PersistentHomologyCalculation(**INIT_ARGS)
    result = obj(**ARGS)
    print("Persistence pairs:", result[0])
    print("Empty array:", result[1])
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
TopologicalSignatureDistance Ran
ran on a synthesized input
modelscope/facechain/face_module/TopoFR/persistent_homology.py
code served (permissive licence) · get_code("21848401dad84d15")
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 tuple, ndim 1, 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 numpy as np

# INIT_ARGS for TopologicalSignatureDistance.__init__
INIT_ARGS = {
    'sort_selected': False,
    'use_cycles': False,
    'match_edges': None
}

# ARGS for TopologicalSignatureDistance.forward
# The forward method expects two distance matrices
# These should be square symmetric matrices representing pairwise distances
# Using small size: 5x5 distance matrices

distances1 = torch.rand(5, 5)
# Make symmetric
distances1 = (distances1 + distances1.T) / 2
# Zero diagonal
distances1.fill_diagonal_(0)

distances2 = torch.rand(5, 5)
# Make symmetric
distances2 = (distances2 + distances2.T) / 2
# Zero diagonal
distances2.fill_diagonal_(0)

ARGS = {
    'distances1': distances1,
    'distances2': distances2
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
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)
UnionFind Ran
ran on a synthesized input
modelscope/facechain/face_module/TopoFR/persistent_homology.py
code served (permissive licence) · get_code("64fde28f43d7eedb")
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 NoneType. 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 numpy as np

class UnionFind:
    """
    An implementation of a Union--Find class. The class performs path
    compression by default. It uses integers for storing one disjoint
    set, assuming that vertices are zero-indexed.
    """

    def __init__(self, n_vertices):
        """
        Initializes an empty Union--Find data structure for a given
        number of vertices.
        """
        self._parent = np.arange(n_vertices, dtype=int)

    def find(self, u):
        """
        Finds and returns the parent of u with respect to the hierarchy.
        """
        if self._parent[u] == u:
            return u
        else:
            self._parent[u] = self.find(self._parent[u])
            return self._parent[u]

    def merge(self, u, v):
        """
        Merges vertex u into the component of vertex v. Note the
        asymmetry of this operation.
        """
        if u != v:
            self._parent[self.find(u)] = self.find(v)

    def roots(self):
        """
        Generator expression for returning roots, i.e. components that
        are their own parents.
        """
        for vertex, parent in enumerate(self._parent):
            if vertex == parent:
                yield vertex


INIT_ARGS = {
    'n_vertices': 8
}

ARGS = {
    'u': 2,
    'v': 5
}

METHOD = 'merge'

if __name__ == '__main__':
    uf = UnionFind(**INIT_ARGS)
    uf.merge(**ARGS)
    result = list(uf.roots())
    print(f"Roots after merge: {result}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type NoneType — a NoneType output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a NoneType 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
compute_distance_matrix Ran
ran; our contract draft was wrong, not the code
modelscope/facechain/face_module/TopoFR/persistent_homology.py
code served (permissive licence) · get_code("b1f7845a6d23b0c3")
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, 2) 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 shape (batch=2, channels=3, height=4, width=4)
# This will be flattened to (2, 48) in the function
x = torch.randn(2, 3, 4, 4)

# p parameter for the norm (default is 2 for L2 norm)
p = 2

ARGS = {
    "x": x,
    "p": p,
}
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, 2) — shape (2, 2) 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
divideIntoNstrand Ran
ran; our contract draft was wrong, not the code
DanJun6737/TopoFR/eval_ijbc_ms1mv2.py
pointer only (licence: NONE) · get_code("2da848988b60d9cc")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, DanJun6737/TopoFR 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.

register_corrector Ran
ran; our contract draft was wrong, not the code
this paper's copy was not recorded; identical code first harvested from yang-song/score_sde_pytorch
pointer only · get_code("a05b1d0cf3f508b4")
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.

register_predictor Ran
ran; our contract draft was wrong, not the code
this paper's copy was not recorded; identical code first harvested from yang-song/score_sde_pytorch
pointer only · get_code("473066ddf62a075a")
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.

compute_topological_loss Not yet run
unverified (harvested, no recorded run)
modelscope/facechain/face_module/TopoFR/persistent_homology.py
code served (permissive licence) · get_code("a3ac26a1a2a72f40")
How it ran

no invocation recorded.

get_predictor Not yet run
unverified (harvested, no recorded run)
this paper's copy was not recorded; identical code first harvested from yang-song/score_sde_pytorch
pointer only · get_code("a58facb8fe71823a")
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. No invocation recorded.

read_template_media_list Not yet run
unverified (harvested, no recorded run)
DanJun6737/TopoFR/eval_ijbc_ms1mv2.py
pointer only (licence: NONE) · get_code("e60885cdbeb940b6")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, DanJun6737/TopoFR 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.

read_template_pair_list Not yet run
unverified (harvested, no recorded run)
DanJun6737/TopoFR/eval_ijbc_ms1mv2.py
pointer only (licence: NONE) · get_code("897480715a729925")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, DanJun6737/TopoFR 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 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 6 are also present in other papers whose code we hold (6 with at least one paper dated earlier, 3 the same month, 6 later) and 5 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_predictor 16 other papers
13 dated earlier, 1 the same month, 2 later · 1 only as an assembly brick
2006.09011 (2020-06)
Improved Techniques for Training Score-Based Generative Models
2105.14080 (2021-05)
Gotta Go Fast When Generating Data with Score-Based Models
2112.07068 (2021-12)
Score-Based Generative Modeling with Critically-Damped Langevin Diffusion
and 13 more not named here
register_corrector 15 other papers
13 dated earlier, 1 the same month, 1 later · 2 only as an assembly brick
2006.09011 (2020-06)
Improved Techniques for Training Score-Based Generative Models
2011.13456 (2020-11)
Score-Based Generative Modeling through Stochastic Differential Equations
2105.14080 (2021-05)
Gotta Go Fast When Generating Data with Score-Based Models
and 12 more not named here
register_predictor 15 other papers
13 dated earlier, 1 the same month, 1 later · 2 only as an assembly brick
2006.09011 (2020-06)
Improved Techniques for Training Score-Based Generative Models
2011.13456 (2020-11)
Score-Based Generative Modeling through Stochastic Differential Equations
2105.14080 (2021-05)
Gotta Go Fast When Generating Data with Score-Based Models
and 12 more not named here
divideIntoNstrand 4 other papers
3 dated earlier, 1 later
1801.07698 (2018-01)
ArcFace: Additive Angular Margin Loss for Deep Face Recognition
aaai_20057 (2022 (year only))
FedFR: Joint Optimization Federated Framework for Generic and Personalized Face Recognition
2309.16298 (2023-09)
At Which Training Stage Does Code Data Help LLMs Reasoning?
and 1 more not named here
read_template_media_list 2 other papers
1 dated earlier, 1 later
aaai_20057 (2022 (year only))
FedFR: Joint Optimization Federated Framework for Generic and Personalized Face Recognition
2609.02644 (2026-09)
Learning to Attract and Repel: Dual Quality Margin Learning for Face Recognition (DQM-Face)
read_template_pair_list 2 other papers
1 dated earlier, 1 later
1801.07698 (2018-01)
ArcFace: Additive Angular Margin Loss for Deep Face Recognition
2609.02644 (2026-09)
Learning to Attract and Repel: Dual Quality Margin Learning for Face Recognition (DQM-Face)

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

The field of face recognition (FR) has undergone significant advancements with the rise of deep learning. Recently, the success of unsupervised learning and graph neural networks has demonstrated the effectiveness of data structure information. Considering that the FR task can leverage large-scale training data, which intrinsically contains significant structure information, we aim to investigate how to encode such critical structure information into the latent space. As revealed from our observations, directly aligning the structure information between the input and latent spaces inevitably suffers from an overfitting problem, leading to a structure collapse phenomenon in the latent space. To address this problem, we propose TopoFR, a novel FR model that leverages a topological structure alignment strategy called PTSA and a hard sample mining strategy named SDE. Concretely, PTSA uses persistent homology to align the topological structures of the input and latent spaces, effectively preserving the structure information and improving the generalization performance of FR model. To mitigate the impact of hard samples on the latent space structure, SDE accurately identifies hard samples by automatically computing structure damage score (SDS) for each sample, and directs the model to prioritize optimizing these samples. Experimental results on popular face benchmarks demonstrate the superiority of our TopoFR over the state-of-the-art methods.

For agents

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

get_harvested_code_for_paper("2410.10587")
get_code_for_paper("2410.10587")
have("2410.10587")

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

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

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

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

Connect an agent — have() is free.