SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2303.14679 · CVPR · 2023

ZBS: Zero-shot Background Subtraction via Instance-level Background Modeling and Foreground Selection

Tao Yu, Chaoyang Zhao, Ming Tang, Jinqiao Wang, Yongqi An, Xu Zhao, Haiyun Guo

arXiv · PDF · Open in the Atlas

Code that ran

7 of 9 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; 3 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 3 failures of our instrument; 2 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/2303.14679.json · badge: /api/ran/2303.14679.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
CASIA-IVA-Lab/ZBS canonical (classifier label)
classifier basis not recorded on the link
7 ran · 2 no recorded run
FunctionStatusWhere it lives
convert_bbox_to_z Ran
ran; our contract draft was wrong, not the code
CASIA-IVA-Lab/ZBS/sort_zbs.py
code served (permissive licence) · get_code("38fac8a2c4b91f17")
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 (4, 1) 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 a bbox in the form [x1, y1, x2, y2]
# which represents top-left and bottom-right corners of a bounding box

# Create a valid bounding box
# x1=10, y1=20, x2=50, y2=80
bbox = np.array([10, 20, 50, 80])

ARGS = {
    "bbox": bbox
}
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 (4, 1) — shape (4, 1) 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_clip_embeddings Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
CASIA-IVA-Lab/ZBS/detic/predictor.py
code served (permissive licence) · get_code("1f211df98dc51cee")
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 (4, 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 torch
import torch.nn as nn
from unittest.mock import Mock

torch.manual_seed(0)

class MockTextEncoder(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(10, 4)
    
    def forward(self, texts):
        # texts is a list of strings
        # return a tensor of shape (batch_size, embedding_dim)
        batch_size = len(texts)
        # Simulate encoding: return tensor of shape (batch_size, 4)
        return self.linear(torch.randn(batch_size, 10))

def mock_build_text_encoder(pretrain=True):
    return MockTextEncoder()

# Monkey-patch the detic module structure
import sys
from types import ModuleType

detic = ModuleType('detic')
detic.modeling = ModuleType('detic.modeling')
detic.modeling.text = ModuleType('detic.modeling.text')
detic.modeling.text.text_encoder = ModuleType('detic.modeling.text.text_encoder')
detic.modeling.text.text_encoder.build_text_encoder = mock_build_text_encoder

sys.modules['detic'] = detic
sys.modules['detic.modeling'] = detic.modeling
sys.modules['detic.modeling.text'] = detic.modeling.text
sys.modules['detic.modeling.text.text_encoder'] = detic.modeling.text.text_encoder

ARGS = {
    'vocabulary': ['cat', 'dog', 'bird'],
    'prompt': 'a '
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
detic, 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 (4, 3) — shape (4, 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_fed_loss_inds Ran
ran; our contract draft was wrong, not the code
CASIA-IVA-Lab/ZBS/detic/modeling/utils.py
code served (permissive licence) · get_code("bb583e07209fe58b")
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 1, dtype family int, shape (5,) 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)

# gt_classes: a tensor of class indices
gt_classes = torch.tensor([0, 1, 2, 1, 0], dtype=torch.long)

# num_sample_cats: number of categories to sample
num_sample_cats = 5

# C: number of classes (total number of categories)
C = 8

# weight: optional weight tensor for classes, should have length C
weight = torch.ones(C, dtype=torch.float32)

ARGS = {
    "gt_classes": gt_classes,
    "num_sample_cats": num_sample_cats,
    "C": C,
    "weight": weight,
}
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 1, dtype family int, shape (5,) — shape (5,) 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
iou_batch Ran
ran, honoured the contract we drafted
CASIA-IVA-Lab/ZBS/sort_zbs.py
code served (permissive licence) · get_code("1c3448b2f86e709f")
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

# Create sample bounding boxes in format [x1, y1, x2, y2]
# bb_test: batch of test bounding boxes
bb_test = np.array([
    [10.0, 20.0, 50.0, 60.0],
    [15.0, 25.0, 55.0, 65.0]
], dtype=np.float32)

# bb_gt: batch of ground truth bounding boxes
bb_gt = np.array([
    [12.0, 22.0, 52.0, 62.0],
    [20.0, 30.0, 60.0, 70.0],
    [100.0, 100.0, 150.0, 150.0]
], dtype=np.float32)

ARGS = {
    "bb_test": bb_test,
    "bb_gt": bb_gt
}
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
linear_assignment Ran
ran, honoured the contract we drafted
CASIA-IVA-Lab/ZBS/sort_zbs.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from nilesh0109/PedestrianTracking, is pointer only (licence: NONE) · get_code("6265d3c1647dda9b")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from nilesh0109/PedestrianTracking, 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.

load_class_freq Ran
ran, honoured the contract we drafted
CASIA-IVA-Lab/ZBS/detic/modeling/utils.py
code served (permissive licence) · get_code("1f6e4c3da7b82979")
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 1, dtype family float, shape (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 torch
import json
import tempfile
import os

torch.manual_seed(0)

# Create a temporary directory and a mock LVIS metadata file
temp_dir = tempfile.mkdtemp()
metadata_path = os.path.join(temp_dir, 'lvis_v1_train_cat_info.json')

# Create mock category info with id and image_count
cat_info_data = [
    {'id': 1, 'image_count': 100},
    {'id': 2, 'image_count': 250},
    {'id': 3, 'image_count': 50},
]

with open(metadata_path, 'w') as f:
    json.dump(cat_info_data, f)

ARGS = {
    'path': metadata_path,
    'freq_weight': 1.0,
}
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 1, dtype family float, shape (3,) — shape (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
match_name_keywords Ran
ran, violated the contract we drafted
CASIA-IVA-Lab/ZBS/detic/custom_solver.py
code served (permissive licence) · get_code("c15434906f804d7f")
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

torch.manual_seed(0)

# The function match_name_keywords checks if any string in name_keywords
# is contained in the string n. It takes:
# - n: a string to search in
# - name_keywords: an iterable of strings to search for

n = "layer.weight.bias"
name_keywords = ["weight", "bias", "norm"]

ARGS = {
    "n": n,
    "name_keywords": name_keywords,
}
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 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
compute_average_precision Not yet run
unverified (harvested, no recorded run)
CASIA-IVA-Lab/ZBS/detic/evaluation/oideval.py
code served (permissive licence) · get_code("2e0a799ccbd489e7")
How it ran

no invocation recorded.

select_roi Not yet run
unverified (harvested, no recorded run)
CASIA-IVA-Lab/ZBS/video_roi.py
code served (permissive licence) · get_code("408481b0831c8f2d")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 8 are also present in other papers whose code we hold (8 with at least one paper dated earlier, 0 the same month, 5 later) and 1 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
match_name_keywords 13 other papers
5 dated earlier, 8 later
2010.04159 (2020-10)
Deformable DETR: Deformable Transformers for End-to-End Object Detection
2111.04076 (2021-11)
Direct Multi-view Multi-person 3D Pose Estimation
2206.11134 (2022-06)
Open Vocabulary Object Detection with Proposal Mining and Prediction Equalization
and 10 more not named here
compute_average_precision 11 other papers
6 dated earlier, 5 later
aaai_6793 (2020 (year only))
Background Suppression Network for Weakly-Supervised Temporal Action Localization
2006.07976 (2020-06)
Actor-Context-Actor Relation Network for Spatio-Temporal Action Localization
2107.06592 (2021-07)
Is Someone Speaking? Exploring Long-term Temporal Features for Audio-visual Active Speaker Detection
and 8 more not named here
get_fed_loss_inds 10 other papers
4 dated earlier, 6 later
2206.11134 (2022-06)
Open Vocabulary Object Detection with Proposal Mining and Prediction Equalization
2207.03482 (2022-07)
Bridging the Gap between Object and Image-level Representations for Open-Vocabulary Detection
2207.13080 (2022-07)
DETRs with Hybrid Matching
and 7 more not named here
load_class_freq 7 other papers
3 dated earlier, 4 later
2206.11134 (2022-06)
Open Vocabulary Object Detection with Proposal Mining and Prediction Equalization
2207.13080 (2022-07)
DETRs with Hybrid Matching
2211.12914 (2022-11)
Open-vocabulary Attribute Detection
and 4 more not named here
convert_bbox_to_z 4 other papers
4 dated earlier
1602.00763 (2016-02)
Simple Online and Realtime Tracking
1612.01465 (2016-12)
ArtTrack: Articulated Multi-person Tracking in the Wild
and 1 more not named here
get_clip_embeddings 4 other papers
2 dated earlier, 2 later
2206.11134 (2022-06)
Open Vocabulary Object Detection with Proposal Mining and Prediction Equalization
2207.13080 (2022-07)
DETRs with Hybrid Matching
2312.14494 (2023-12)
Revisiting Few-Shot Object Detection with Vision-Language Models
and 1 more not named here
iou_batch 1 other paper
1 dated earlier
1602.00763 (2016-02)
Simple Online and Realtime Tracking
linear_assignment 1 other paper
1 dated earlier
1602.00763 (2016-02)
Simple Online and Realtime Tracking

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

Background subtraction (BGS) aims to extract all moving objects in the video frames to obtain binary foreground segmentation masks. Deep learning has been widely used in this field. Compared with supervised-based BGS methods, unsupervised methods have better generalization. However, previous unsupervised deep learning BGS algorithms perform poorly in sophisticated scenarios such as shadows or night lights, and they cannot detect objects outside the predefined categories. In this work, we propose an unsupervised BGS algorithm based on zero-shot object detection called Zero-shot Background Subtraction (ZBS). The proposed method fully utilizes the advantages of zero-shot object detection to build the open-vocabulary instance-level background model. Based on it, the foreground can be effectively extracted by comparing the detection results of new frames with the background model. ZBS performs well for sophisticated scenarios, and it has rich and extensible categories. Furthermore, our method can easily generalize to other tasks, such as abandoned object detection in unseen environments. We experimentally show that ZBS surpasses state-of-the-art unsupervised BGS methods by 4.70% F-Measure on the CDnet 2014 dataset. The code is released at https://github.com/CASIA-IVA-Lab/ZBS.

For agents

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

get_harvested_code_for_paper("2303.14679")
get_code_for_paper("2303.14679")
have("2303.14679")

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

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

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

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

Connect an agent — have() is free.