SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2207.09679 · ECCV · 2022

Explaining Deepfake Detection by Analysing Image Matching

Jin Wang, Haoqiang Fan, Jiajun Liang, Renhe Ji, Shichao Dong

arXiv · PDF · Open in the Atlas

Code that ran

9 of 10 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; 1 honoured the contract we drafted, 0 violated it and 8 have no contract verdict; 0 failures of our instrument; 1 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/2207.09679.json · badge: /api/ran/2207.09679.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
megvii-research/fst-matching canonical (classifier label)
classifier basis not recorded on the link
9 ran · 1 no recorded run
FunctionStatusWhere it lives
get_align_transform Ran
ran on a synthesized input
megvii-research/fst-matching/dataset/augmentor.py
code served (permissive licence) · get_code("f802693722b539f1")
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 ndarray, ndim 2, dtype family float, shape (2, 3) 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 numpy as np

# The function takes two parameters: lm and mf
# Both are used with indexing like [:, 0] and [:, 1], so they need to be 2D arrays
# They are used with .mean(), arithmetic operations, and .sum()
# This suggests they should be numpy arrays with shape (N, 2) where N >= 1

# Create small landmark and model face point arrays
# lm: landmark points (source)
lm = np.array([
    [1.0, 2.0],
    [3.0, 4.0],
    [5.0, 6.0]
], dtype=np.float32)

# mf: model face points (target)
mf = np.array([
    [2.0, 3.0],
    [4.0, 5.0],
    [6.0, 7.0]
], dtype=np.float32)

ARGS = {
    "lm": lm,
    "mf": mf
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (2, 3) — shape (2, 3) 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_masks_sampleshapley Ran
ran on a synthesized input
megvii-research/fst-matching/lib/shapley.py
code served (permissive licence) · get_code("3a0087aeb85ec40f")
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 dict. 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
from itertools import combinations, chain
from keras.utils import to_categorical

np.random.seed(0)

# Analyze the function:
# - clist: a list of patch ids, used with len(clist) and indexing
# - cIdx: an integer index into clist
# - m: number of samples (default 100)
# The function uses:
#   - len(clist) to get d
#   - clist[idx] to access elements
#   - turn_list(clist[idx]) which converts to list or wraps int
#   - to_categorical with num_classes=d
#   - np.random.permutation(d)
#   - np.sum on categorical arrays

# Create small test data
clist = [0, 1, 2, 3]  # 4 patches, small list
cIdx = 1  # index to calculate Shapley for
m = 5  # small number of samples for testing

ARGS = {
    "clist": clist,
    "cIdx": cIdx,
    "m": m,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
keras, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
get_mean_face Ran
ran on a synthesized input
megvii-research/fst-matching/dataset/augmentor.py
code served (permissive licence) · get_code("51b5fee4353c751f")
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 (5, 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
import numpy as np

torch.manual_seed(0)

# Construct mf as a tensor with shape (num_landmarks, 2)
# The function indexes mf[:, 0] and mf[:, 1], and accesses mf[0][1]
# So mf should be a 2D tensor
mf = torch.randn(5, 2, dtype=torch.float32)

# face_width: a scalar representing the width of the face
face_width = 100.0

# canvas_size: a scalar representing the size of the canvas
canvas_size = 200.0

ARGS = {
    "mf": mf,
    "face_width": face_width,
    "canvas_size": canvas_size,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, 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 (5, 2) — shape (5, 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
get_sampleshapley Ran
ran on a synthesized input
megvii-research/fst-matching/lib/shapley.py
code served (permissive licence) · get_code("9a6a819b8799d9b9")
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 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

# Create a sample positions_dict with the structure expected by get_sampleshapley
# The dict maps tuples to lists/arrays of position vectors
positions_dict = {
    (0, 0): np.array([[0, 1, 0, 1], [1, 0, 1, 0]]),  # 2 samples, 4 features
    (0, 1): np.array([[1, 1, 0, 0], [0, 0, 1, 1]]),  # 2 samples, 4 features
    (1, 0): np.array([[1, 0, 0, 1]]),                 # 1 sample, 4 features
}

ARGS = {
    "positions_dict": positions_dict
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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: none by the harness; any seed is in the setup block
parse_labels Ran
ran on a synthesized input
megvii-research/fst-matching/lib/extract_frames_ldm_ff++.py
code served (permissive licence) · get_code("ddc308c78d7a16f0")
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 tuple, ndim 1, dtype family int; 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

torch.manual_seed(0)

ARGS = {
    'video_path': 'path/to/videos/original/42.mp4'
}
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 tuple, ndim 1, dtype family int — 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: none by the harness; any seed is in the setup block
parse_video_path Ran
ran, honoured the contract we drafted
megvii-research/fst-matching/lib/extract_frames_ldm_ff++.py
code served (permissive licence) · get_code("3e055bd3cc6af898")
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 list, 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 os
import tempfile
from pathlib import Path

# Create a temporary directory structure that mimics FaceForensics++
temp_dir = tempfile.mkdtemp()
VIDEO_PATH = temp_dir

# Create directory structure for Original dataset
original_path = os.path.join(VIDEO_PATH, 'original_sequences', 'youtube', 'c23', 'videos')
os.makedirs(original_path, exist_ok=True)

# Create directory structure for manipulated datasets
for dataset_name in ['FaceShifter', 'Face2Face', 'Deepfakes', 'FaceSwap', 'NeuralTextures']:
    manip_path = os.path.join(VIDEO_PATH, 'manipulated_sequences', dataset_name, 'c40', 'videos')
    os.makedirs(manip_path, exist_ok=True)

# Create dummy video files
for i in range(3):
    Path(os.path.join(original_path, f'video_{i}.mp4')).touch()
    for dataset_name in ['FaceShifter', 'Face2Face', 'Deepfakes', 'FaceSwap', 'NeuralTextures']:
        manip_path = os.path.join(VIDEO_PATH, 'manipulated_sequences', dataset_name, 'c40', 'videos')
        Path(os.path.join(manip_path, f'video_{i}.mp4')).touch()

# Update the module-level VIDEO_PATH for the function
import sys
import types
module = types.ModuleType('test_module')
module.VIDEO_PATH = VIDEO_PATH
module.glob = __import__('glob').glob

# Execute function in context with updated VIDEO_PATH
exec("""
from glob import glob

def parse_video_path(dataset, compression):
    if dataset == 'Original':
        dataset_path = f'{VIDEO_PATH}/original_sequences/youtube/{compression}/videos/'
    elif dataset in ['FaceShifter', 'Face2Face', 'Deepfakes', 'FaceSwap', 'NeuralTextures']:
        dataset_path = f'{VIDEO_PATH}/manipulated_sequences/{dataset}/{compression}/videos/'
    else:
        raise NotImplementedError
    movies_path_list = sorted(glob(dataset_path + '*.mp4'))
    print('{} : videos are exist in {}'.format(len(movies_path_list), dataset))
    return movies_path_list
""", {'VIDEO_PATH': VIDEO_PATH, 'glob': __import__('glob').glob})

ARGS = {
    'dataset': 'Original',
    'compression': 'c23'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list 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: none by the harness; any seed is in the setup block
rand_range Ran
ran on a synthesized input
megvii-research/fst-matching/dataset/augmentor.py
code served (permissive licence) · get_code("c4c3096d3681398d")
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 float, 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 numpy as np

# Create a random number generator
rng = np.random.RandomState(42)

# Define arguments for rand_range function
ARGS = {
    'rng': rng,
    'lo': 0.0,
    'hi': 10.0
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, 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
stability Ran
ran on a synthesized input
megvii-research/fst-matching/lib/quantitive_indicators.py
code served (permissive licence) · get_code("ff8a4f12bdd8f4e7")
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 float64, ndim 0, 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 numpy as np
import torch

torch.manual_seed(0)

# The function expects three dicts mapping keys to numpy arrays or array-like objects
# Keys in raw_score contain 'raw', and corresponding keys in c23_score and c40_score
# are formed by replacing 'raw' with 'c23' and 'c40' respectively

raw_score = {
    'layer_raw_1': np.random.randn(2, 4),
    'layer_raw_2': np.random.randn(3, 5),
}

c23_score = {
    'layer_c23_1': np.random.randn(2, 4),
    'layer_c23_2': np.random.randn(3, 5),
}

c40_score = {
    'layer_c40_1': np.random.randn(2, 4),
    'layer_c40_2': np.random.randn(3, 5),
}

ARGS = {
    'raw_score': raw_score,
    'c23_score': c23_score,
    'c40_score': c40_score,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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
turn_list Ran
ran on a synthesized input
megvii-research/fst-matching/lib/shapley.py
code served (permissive licence) · get_code("8cfb0a3d002fc213")
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 list, ndim 1, dtype family int; 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

torch.manual_seed(0)

# The function turn_list takes a single parameter 's'
# It checks if s is a list, returns it as-is
# If s is an int, wraps it in a list
# Otherwise returns None implicitly

# Test case 1: s is a list
s_list = [1, 2, 3, 4]

# Test case 2: s is an int
s_int = 42

# We'll use the int case since it exercises the function
ARGS = {
    "s": s_int
}
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 list, ndim 1, dtype family int — a list 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: none by the harness; any seed is in the setup block
load_config Not yet run
unverified (harvested, no recorded run)
megvii-research/fst-matching/lib/util.py
code served (permissive licence) · get_code("3e5d9e6d9edda3a8")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 2 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 2 later) and 8 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
load_config 1 other paper
1 later
2606.19184 (2026-06)
When AUC Misleads: Polarization-Aware Evaluation of Deepfake Detectors under Domain Shift
parse_video_path 1 other paper
1 later
2606.19184 (2026-06)
When AUC Misleads: Polarization-Aware Evaluation of Deepfake Detectors under Domain Shift

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

This paper aims to interpret how deepfake detection models learn artifact features of images when just supervised by binary labels. To this end, three hypotheses from the perspective of image matching are proposed as follows. 1. Deepfake detection models indicate real/fake images based on visual concepts that are neither source-relevant nor targetrelevant, that is, considering such visual concepts as artifact-relevant. 2. Besides the supervision of binary labels, deepfake detection models implicitly learn artifact-relevant visual concepts through the FST-Matching (i.e. the matching f ake, source, target images) in the training set. 3. Implicitly learned artifact visual concepts through the FST-Matching in the raw training set are vulnerable to video compression. In experiments, the above hypotheses are verified among various DNNs. Furthermore, based on this understanding, we propose the FST-Matching Deepfake Detection Model to boost the performance of forgery detection on compressed videos. Experiment results show that our method achieves great performance, especially on highly-compressed (e.g. c40) videos.

For agents

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

get_harvested_code_for_paper("2207.09679")
get_code_for_paper("2207.09679")
have("2207.09679")

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

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

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

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

Connect an agent — have() is free.