SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · Du_On-the-Fly_Category_Discovery_CVPR_2023_paper · CVPR · 2023

On-the-fly Category Discovery

Timothy Hospedales, Yi-Zhe Song, Dongliang Chang, Zhanyu Ma, Kongming Liang, Ruoyi Du

Open in the Atlas

Code that ran

8 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 2 have no contract verdict; 6 failures of our instrument; 3 no recorded run), measured 2026-11-24; 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/Du_On-the-Fly_Category_Discovery_CVPR_2023_paper.json · badge: /api/ran/Du_On-the-Fly_Category_Discovery_CVPR_2023_paper.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
PRIS-CV/On-the-fly-Category-Discovery canonical (classifier label)
classifier basis: census
8 ran · 3 no recorded run
FunctionStatusWhere it lives
cluster_acc Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
PRIS-CV/On-the-fly-Category-Discovery/project_utils/cluster_utils.py
pointer only (licence: MIT); the stored copy get_code serves, from HaiyangZheng/PHE, is pointer only (licence: NONE) · get_code("569a0b5d2369b072")
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 HaiyangZheng/PHE, 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.

drop_path Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
PRIS-CV/On-the-fly-Category-Discovery/vision_transformer.py
pointer only (licence: MIT); the stored copy get_code serves, from gladzhang/Xformer, is pointer only (licence: NONE) · get_code("55120f2026b56aa2")
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 gladzhang/Xformer, 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.

evaluate_clustering Ran
ran; our contract draft was wrong, not the code
PRIS-CV/On-the-fly-Category-Discovery/project_utils/cluster_utils.py
code served (permissive licence) · get_code("15d2b95b53f6db9a")
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 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

np.random.seed(0)

# Create small synthetic clustering data
n_samples = 50

# y_true: ground truth labels (0, 1, 2)
y_true = np.array([0] * 17 + [1] * 16 + [2] * 17, dtype=int)

# y_pred: predicted labels with some clustering assignments
y_pred = np.array([0] * 16 + [1] * 17 + [2] * 17, dtype=int)

ARGS = {
    "y_true": y_true,
    "y_pred": y_pred,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, sklearn — 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: none by the harness; any seed is in the setup block
get_file Ran
ran on a synthesized input
PRIS-CV/On-the-fly-Category-Discovery/project_utils/slurm_out_parser.py
code served (permissive licence) · get_code("142c0ce9982cbf82")
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 tempfile
import os

# Create a temporary file with some test content
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt')
temp_file.write("line 1\n")
temp_file.write("line 2\n")
temp_file.write("line 3\n")
temp_file.close()

# Store the path for use in ARGS
temp_path = temp_file.name

ARGS = {
    "path": temp_path
}

# Clean up will happen after function execution
# (In production code, use try/finally or context manager)
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
get_scheduler Ran
ran on a synthesized input
PRIS-CV/On-the-fly-Category-Discovery/project_utils/schedulers.py
code served (permissive licence) · get_code("8d59d5daedcdf3f8")
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 CosineAnnealingWarmupRestarts_New. 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
import math

torch.manual_seed(0)

# Create a minimal model
model = nn.Linear(4, 3)

# Create an optimizer
optimizer = torch.optim.SGD(model.parameters(), lr=0.1)

# Create args object with all necessary attributes
class Args:
    def __init__(self):
        self.scheduler = 'cosine_warm_restarts_warmup'
        self.epochs = 100
        self.lr = 0.1
        self.num_restarts = 2
        self.steps = [30, 60, 90]

args = Args()

ARGS = {
    'optimizer': optimizer,
    'args': 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 CosineAnnealingWarmupRestarts_New — a CosineAnnealingWarmupRestarts_New output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a CosineAnnealingWarmupRestarts_New 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
purity_score Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
PRIS-CV/On-the-fly-Category-Discovery/project_utils/cluster_utils.py
code served (permissive licence) · get_code("1645ca2fb55ce1f8")
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
from sklearn import metrics

# purity_score computes clustering purity by:
# 1. Creating a contingency matrix from y_true and y_pred
# 2. Finding the max value in each column (axis=0)
# 3. Summing those maxes and dividing by total sum
#
# Parameters:
# - y_true: ground truth labels (array-like)
# - y_pred: predicted cluster labels (array-like)

# Create small example data
np.random.seed(0)

# Ground truth labels: 10 samples, 3 true classes
y_true = np.array([0, 0, 0, 0, 1, 1, 1, 2, 2, 2])

# Predicted clusters: 10 samples, 4 predicted clusters
y_pred = np.array([0, 0, 1, 1, 1, 2, 2, 2, 3, 3])

ARGS = {
    "y_true": y_true,
    "y_pred": y_pred,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — 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
strip_state_dict Ran
ran; our contract draft was wrong, not the code
PRIS-CV/On-the-fly-Category-Discovery/project_utils/general_utils.py
code served (permissive licence) · get_code("bc2c748ee9fffddf")
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 torch
import torch.nn as nn

torch.manual_seed(0)

# Create a sample state_dict with 'module.' prefixed keys
# This simulates a DataParallel model's state_dict
state_dict = {
    'module.layer1.weight': torch.randn(4, 3),
    'module.layer1.bias': torch.randn(4),
    'module.layer2.weight': torch.randn(5, 4),
    'layer3.weight': torch.randn(2, 5),  # Already without 'module.' prefix
}

ARGS = {
    'state_dict': state_dict,
    'strip_key': 'module.'
}
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 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
transform_moco_state_dict Ran
ran; our contract draft was wrong, not the code
PRIS-CV/On-the-fly-Category-Discovery/project_utils/general_utils.py
code served (permissive licence) · get_code("443a6ab0aca3d0e3")
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 torch
import torch.nn as nn

torch.manual_seed(0)

# Construct a mock MoCo state dict with the expected structure
# The function expects keys starting with 'module.encoder_q.'
mock_moco_state_dict = {
    'module.encoder_q.conv1.weight': torch.randn(64, 3, 7, 7),
    'module.encoder_q.bn1.weight': torch.randn(64),
    'module.encoder_q.bn1.bias': torch.randn(64),
    'module.encoder_q.layer1.0.conv1.weight': torch.randn(64, 64, 3, 3),
    'module.encoder_q.layer1.0.bn1.weight': torch.randn(64),
    'module.encoder_q.fc.0.weight': torch.randn(2048, 512),
    'module.encoder_q.fc.0.bias': torch.randn(2048),
    'module.encoder_q.fc.1.weight': torch.randn(2048),
    'module.encoder_q.fc.2.weight': torch.randn(128, 2048),
    'module.encoder_q.fc.2.bias': torch.randn(128),
    'other_key.weight': torch.randn(10, 10),  # This will be skipped
}

num_classes = 10

ARGS = {
    'obj': mock_moco_state_dict,
    'num_classes': num_classes,
}
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 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_dino_head_weights Not yet run
unverified (harvested, no recorded run)
PRIS-CV/On-the-fly-Category-Discovery/project_utils/general_utils.py
code served (permissive licence) · get_code("aacf96bb3684f3d0")
How it ran

no invocation recorded.

vit_small Not yet run
unverified (harvested, no recorded run)
PRIS-CV/On-the-fly-Category-Discovery/vision_transformer.py
code served (permissive licence) · get_code("995a10f898196998")
How it ran

no invocation recorded.

vit_tiny Not yet run
unverified (harvested, no recorded run)
PRIS-CV/On-the-fly-Category-Discovery/vision_transformer.py
code served (permissive licence) · get_code("996780ba4be89ba3")
How it ran

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, 11 are also present in other papers whose code we hold (11 with at least one paper dated earlier, 0 the same month, 6 later) and 0 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
drop_path 224 other papers
66 dated earlier, 78 later, 79 same year, order not determinable, 1 undated · 38 only as an assembly brick
2003.12039 (2020-03)
RAFT: Recurrent All-Pairs Field Transforms for Optical Flow
2007.09384 (2020-07)
Multi-Scale Positive Sample Refinement for Few-Shot Object Detection
2010.11929 (2020-10)
An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
and 221 more not named here
vit_tiny 33 other papers
8 dated earlier, 13 later, 11 same year, order not determinable, 1 undated
2201.02609 (2022-01)
Generalized Category Discovery
2202.11929 (2022-02)
Word Segmentation on Discovered Phone Units with Dynamic Programming and Self-Supervised Scoring
2203.08414 (2022-03)
Unsupervised Semantic Segmentation by Distilling Feature Correspondences
and 30 more not named here
vit_small 22 other papers
6 dated earlier, 7 later, 8 same year, order not determinable, 1 undated
2201.02609 (2022-01)
Generalized Category Discovery
2202.11929 (2022-02)
Word Segmentation on Discovered Phone Units with Dynamic Programming and Self-Supervised Scoring
2203.08414 (2022-03)
Unsupervised Semantic Segmentation by Distilling Feature Correspondences
and 19 more not named here
cluster_acc 7 other papers
1 dated earlier, 3 later, 3 same year, order not determinable
2201.02609 (2022-01)
Generalized Category Discovery
2305.06144 (2023-05)
Learning Semi-supervised Gaussian Mixture Models for Generalized Category Discovery
2308.11063 (2023-08)
MetaGCD: Learning to Continually Learn in Generalized Category Discovery
and 4 more not named here
purity_score 7 other papers
1 dated earlier, 3 later, 3 same year, order not determinable
2201.02609 (2022-01)
Generalized Category Discovery
2305.06144 (2023-05)
Learning Semi-supervised Gaussian Mixture Models for Generalized Category Discovery
2308.11063 (2023-08)
MetaGCD: Learning to Continually Learn in Generalized Category Discovery
and 4 more not named here
evaluate_clustering 5 other papers
1 dated earlier, 1 later, 3 same year, order not determinable
2201.02609 (2022-01)
Generalized Category Discovery
2305.06144 (2023-05)
Learning Semi-supervised Gaussian Mixture Models for Generalized Category Discovery
2308.11063 (2023-08)
MetaGCD: Learning to Continually Learn in Generalized Category Discovery
and 2 more not named here
strip_state_dict 4 other papers
2 dated earlier, 2 same year, order not determinable
2110.06207 (2021-10)
Open-Set Recognition: A Good Closed-Set Classifier is All You Need
2201.02609 (2022-01)
Generalized Category Discovery
2308.11063 (2023-08)
MetaGCD: Learning to Continually Learn in Generalized Category Discovery
and 1 more not named here
transform_moco_state_dict 4 other papers
2 dated earlier, 2 same year, order not determinable
2110.06207 (2021-10)
Open-Set Recognition: A Good Closed-Set Classifier is All You Need
2201.02609 (2022-01)
Generalized Category Discovery
2308.11063 (2023-08)
MetaGCD: Learning to Continually Learn in Generalized Category Discovery
and 1 more not named here
get_dino_head_weights 3 other papers
1 dated earlier, 2 same year, order not determinable
2201.02609 (2022-01)
Generalized Category Discovery
2308.11063 (2023-08)
MetaGCD: Learning to Continually Learn in Generalized Category Discovery
2310.19776 (2023-10)
Learn to Categorize or Categorize to Learn? Self-Coding for Generalized Category Discovery
get_file 1 other paper
1 dated earlier
2110.06207 (2021-10)
Open-Set Recognition: A Good Closed-Set Classifier is All You Need
get_scheduler 1 other paper
1 dated earlier
2110.06207 (2021-10)
Open-Set Recognition: A Good Closed-Set Classifier is All You Need

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

Repositories linked to this paper

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

Abstract

Although machines have surpassed humans on visual recognition problems, they are still limited to providing closed-set answers. Unlike machines, humans can cognize novel categories at the first observation. Novel category discovery (NCD) techniques, transferring knowledge from seen categories to distinguish unseen categories, aim to bridge the gap. However, current NCD methods assume a transductive learning and offline inference paradigm, which restricts them to a pre-defined query set and renders them unable to deliver instant feedback. In this paper, we study on-the-fly category discovery (OCD) aimed at making the model instantaneously aware of novel category samples (i.e., enabling inductive learning and streaming inference). We first design a hash coding-based expandable recognition model as a practical baseline. Afterwards, noticing the sensitivity of hash codes to intra-category variance, we further propose a novel Sign-Magnitude dIsentangLEment (SMILE) architecture to alleviate the disturbance it brings. Our experimental results demonstrate the superiority of SMILE against our baseline model and prior art. Our code is available at https://github.com/PRIS-CV/On-the-fly-Category-Discovery.

For agents

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

get_harvested_code_for_paper("Du_On-the-Fly_Category_Discovery_CVPR_2023_paper")
get_code_for_paper("Du_On-the-Fly_Category_Discovery_CVPR_2023_paper")
have("Du_On-the-Fly_Category_Discovery_CVPR_2023_paper")

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

curl https://syntology.ai/api/ran/Du_On-the-Fly_Category_Discovery_CVPR_2023_paper.json

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

[![Syntology run record](https://syntology.ai/api/ran/Du_On-the-Fly_Category_Discovery_CVPR_2023_paper.svg)](https://syntology.ai/paper/Du_On-the-Fly_Category_Discovery_CVPR_2023_paper)

Connect an agent — have() is free.