SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 136730727 · ECCV · 2022

Self-Supervised Sparse Representation for Video Anomaly Detection

Tyng-Luh Liu, Jhih-Ciang Wu, He-Yen Hsieh, Ding-Jie Chen, Chiou-Shann Fuh

Open in the Atlas

Code that ran

9 of 12 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, 2 violated it and 4 have no contract verdict; 3 failures of our instrument; 3 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/136730727.json · badge: /api/ran/136730727.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
louisYen/S3R canonical (classifier label)
classifier basis: census
9 ran · 3 no recorded run
FunctionStatusWhere it lives
all_gather Ran
ran; our contract draft was wrong, not the code
louisYen/S3R/anomaly/apis/comm.py
code served (permissive licence) · get_code("ddef00a51cfbcab3")
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. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 pickle
import torch
import torch.distributed as dist
import functools

torch.manual_seed(0)

# Mock distributed backend for single-process execution
class MockGroup:
    pass

# Set up minimal distributed state
if not dist.is_available():
    pass
elif not dist.is_initialized():
    pass

# Prepare test data - picklable objects of different types
test_data_1 = {"key": "value", "number": 42}
test_data_2 = [1, 2, 3, 4, 5]
test_data_3 = "test_string"

# For the function to work, we need to handle the distributed calls gracefully
# Since this is single-process, we'll use a mock group or None
group = None

ARGS = {
    "data": {"tensor_data": torch.randn(2, 4), "metadata": "test"},
    "group": None
}
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 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
color Ran
ran on a synthesized input
louisYen/S3R/anomaly/apis/utils.py
code served (permissive licence) · get_code("e0abd0fd9d76a9db")
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 str. 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 numpy as np
from termcolor import colored

torch.manual_seed(0)

ARGS = {
    'text': 'Hello World',
    'txt_color': 'green',
    'attrs': ['bold']
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, termcolor, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
gather Ran
ran; our contract draft was wrong, not the code
louisYen/S3R/anomaly/apis/comm.py
code served (permissive licence) · get_code("7f14194e77340fc7")
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. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 pickle
import torch.distributed as dist

torch.manual_seed(0)

# Since we're not actually running distributed training, we need to mock
# the distributed backend. For a single-process setup, the gather function
# will return [data] immediately due to get_world_size() == 1.

# Create some picklable test data
test_data = {
    "tensor": torch.randn(2, 4),
    "list": [1, 2, 3],
    "string": "test_value",
    "nested": {"a": 1, "b": 2}
}

ARGS = {
    "data": test_data,
    "dst": 0,
    "group": None
}
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 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
hard_shrink_relu Ran
ran; our contract draft was wrong, not the code
louisYen/S3R/anomaly/models/modules/memory_module.py
code served (permissive licence) · get_code("9a26454b2ff613bb")
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
import torch.nn as nn
from torch.nn import functional as F

torch.manual_seed(0)

# Create a small input tensor (batch_size=2, features=4)
input_tensor = torch.randn(2, 4)

# Define parameters
lambd = 0.5
epsilon = 1e-12

# Construct ARGS dict with all parameters
ARGS = {
    "input": input_tensor,
    "lambd": lambd,
    "epsilon": epsilon,
}
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
minmax_norm Ran
ran on a synthesized input
louisYen/S3R/utils.py
code served (permissive licence) · get_code("7f5912ffa33612d9")
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 activation map tensor
# Shape: (batch=2, channels=4) - typical activation map dimensions
act_map = torch.randn(2, 4)

# Define ARGS dict with all parameters
ARGS = {
    "act_map": act_map,
    "min_val": None,
    "max_val": None,
}
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
reduce_dict Ran
ran, violated the contract we drafted
louisYen/S3R/anomaly/apis/comm.py
code served (permissive licence) · get_code("2a3280757ce5a198")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) 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 torch
import torch.distributed as dist

torch.manual_seed(0)

# Create a simple input dictionary with tensor values
# The function expects all values to be tensors that can be stacked
input_dict = {
    'loss': torch.tensor(2.5),
    'accuracy': torch.tensor(0.85),
    'metric_a': torch.tensor(1.2),
}

# The average parameter is a boolean
average = True

ARGS = {
    'input_dict': input_dict,
    'average': average
}
Setup block drafted by
a language model, Claude Sonnet 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 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
setup_logger Ran
ran on a synthesized input
louisYen/S3R/anomaly/apis/logger.py
code served (permissive licence) · get_code("1c84425de2a04b0c")
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 Logger. 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 logging
import os
import sys
import time
import tempfile

# Create a temporary directory for logging
temp_dir = tempfile.mkdtemp()

ARGS = {
    'name': 'test_logger',
    'save_dir': temp_dir,
    'distributed_rank': 0,
    'filename': 'test.log'
}
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 Logger — a Logger output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Logger 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
sigmoid Ran
ran, violated the contract we drafted
louisYen/S3R/anomaly/datasets/video_dataset.py
pointer only (licence: MIT); the stored copy get_code serves, from XPixelGroup/SEAL, is pointer only (licence: NONE) · get_code("f35babe3912ec8b1")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from XPixelGroup/SEAL, and GitHub detected no licence in that repository 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.

softmax Ran
ran on a synthesized input
louisYen/S3R/anomaly/datasets/video_dataset.py
code served (permissive licence) · get_code("1f745b756264a9ef")
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, 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 numpy as np

# Create a small scores array with shape (2, 4) - batch size 2, 4 dimensions
scores = np.array([
    [1.0, 2.0, 3.0, 0.5],
    [0.1, 0.2, 0.3, 0.4]
], dtype=np.float32)

# Test with axis=1 (softmax over dimensions)
axis = 1

ARGS = {
    "scores": scores,
    "axis": axis
}
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, 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
inference Not yet run
unverified (harvested, no recorded run)
louisYen/S3R/anomaly/engine/inference.py
code served (permissive licence) · get_code("05843d539916e238")
How it ran

no invocation recorded.

process_feat Not yet run
unverified (harvested, no recorded run)
louisYen/S3R/utils.py
code served (permissive licence) · get_code("14ff324a8acdd140")
How it ran

no invocation recorded.

setup_tblogger Not yet run
unverified (harvested, no recorded run)
louisYen/S3R/anomaly/apis/logger.py
code served (permissive licence) · get_code("80f924f2a6263f7b")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 8 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 0 the same month, 6 later) and 4 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
all_gather 16 other papers
1 dated earlier, 15 later
2108.02833 (2021-08)
Elaborative Rehearsal for Zero-shot Action Recognition
2023.findings-emnlp.644 (2023 (year only))
VIP5: Towards Multimodal Foundation Models for Recommendation
and 13 more not named here
reduce_dict 15 other papers
3 dated earlier, 9 later, 3 same year, order not determinable
2003.04030 (2020-03)
Learning Delicate Local Representations for Multi-Person Pose Estimation
2004.01946 (2020-04)
Weakly-Supervised Mesh-Convolutional Hand Reconstruction in the Wild
2108.02833 (2021-08)
Elaborative Rehearsal for Zero-shot Action Recognition
and 12 more not named here
gather 14 other papers
1 dated earlier, 13 later
2108.02833 (2021-08)
Elaborative Rehearsal for Zero-shot Action Recognition
2023.findings-emnlp.644 (2023 (year only))
VIP5: Towards Multimodal Foundation Models for Recommendation
and 11 more not named here
sigmoid 12 other papers
3 dated earlier, 8 later, 1 same year, order not determinable · 1 only as an assembly brick
1506.02640 (2015-06)
You Only Look Once: Unified, Real-Time Object Detection
1602.01783 (2016-02)
Asynchronous Methods for Deep Reinforcement Learning
2106.12930 (2021-06)
VinDr-SpineXR: A deep learning framework for spinal lesions detection and classification from radiographs
and 9 more not named here
hard_shrink_relu 2 other papers
1 dated earlier, 1 later
1904.02639 (2019-04)
Memorizing Normality to Detect Anomaly: Memory-augmented Deep Autoencoder for Unsupervised Anomaly Detection
2307.00755 (2023-07)
Graph-level Anomaly Detection via Hierarchical Memory Networks
color 1 other paper
1 later
aaai_28539 (2024 (year only))
HR-Pro: Point-Supervised Temporal Action Localization via Hierarchical Reliability Propagation
minmax_norm 1 other paper
1 same year, order not determinable
136640328 (2022 (year only))
Scale-aware Spatio-temporal Relation Learning for Video Anomaly Detection
process_feat 1 other paper
1 same year, order not determinable
136640328 (2022 (year only))
Scale-aware Spatio-temporal Relation Learning for Video Anomaly Detection

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

Video anomaly detection (VAD) aims at localizing unexpected actions or activities in a video sequence. Existing mainstream VAD techniques are based on either the one-class formulation, which assumes all training data are normal, or weakly-supervised, which requires only video-level normal/anomaly labels. To establish a unified approach to solving the two VAD settings, we introduce a self-supervised sparse representation (S3R) framework that models the concept of anomaly at feature level by exploring the synergy between dictionary-based representation and self-supervised learning. With the learned dictionary, S3R facilitates two coupled modules, en-Normal and de-Normal, to reconstruct snippetlevel features and filter out normal-event features. The self-supervised techniques also enable generating samples of pseudo normal/anomaly to train the anomaly detector. We demonstrate with extensive experiments that S3R achieves new state-of-the-art performances on popular benchmark datasets for both one-class and weakly-supervised VAD tasks. Our code is publicly available at https://github.com/louisYen/S3R.

For agents

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

get_harvested_code_for_paper("136730727")
get_code_for_paper("136730727")
have("136730727")

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

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

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

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

Connect an agent — have() is free.