SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2207.10988 · ECCV · 2022

Few-shot Object Counting and Detection

Minh Hoai, Thanh Nguyen, Khoi Nguyen, Chau Pham

arXiv · PDF · Open in the Atlas

Code that ran

4 of 4 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 4 have no contract verdict; 0 failures of our instrument; 0 no recorded run), measured 2026-11-23; 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.10988.json · badge: /api/ran/2207.10988.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
VinAIResearch/Counting-DETR canonical (classifier label)
classifier basis not recorded on the link
4 ran · 0 no recorded run
FunctionStatusWhere it lives
addmm_flop_jit Ran
ran on a synthesized input
VinAIResearch/Counting-DETR/src/CountDETR_147_1st_stage/compute_flops_and_speeds.py
code served (permissive licence) · get_code("14e8dbf043b639ef")
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 Counter. 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 typing
from collections import Counter

torch.manual_seed(0)

# Mock torch._C.Value objects that have the required interface
class MockJITValue:
    def __init__(self, shape=None, scalar_type=None):
        self.shape = shape
        self.scalar_type = scalar_type
    
    def isCompleteTensor(self):
        return self.shape is not None
    
    def type(self):
        return MockJITType(self.shape, self.scalar_type)

class MockJITType:
    def __init__(self, shape=None, scalar_type=None):
        self.shape = shape
        self.scalar_type = scalar_type
    
    def sizes(self):
        return self.shape if self.shape else []
    
    def kind(self):
        return self.scalar_type if self.scalar_type else 'TensorType'

# Create mock inputs: [bias, input_tensor, weight]
# The function uses inputs[1:3], so we need at least 3 inputs
# inputs[1] should be shape [batch_size, input_dim] = [2, 4]
# inputs[2] should be shape [input_dim, output_dim] = [4, 3]
input_tensor_mock = MockJITValue(shape=[2, 4])
weight_tensor_mock = MockJITValue(shape=[4, 3])
bias_mock = MockJITValue(shape=[3])

inputs = [bias_mock, input_tensor_mock, weight_tensor_mock]

# Create mock outputs (not used by the function but required as parameter)
output_mock = MockJITValue(shape=[2, 3])
outputs = [output_mock]

ARGS = {
    'inputs': inputs,
    'outputs': outputs
}
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 Counter — a Counter output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Counter 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
bmm_flop_jit Ran
ran on a synthesized input
VinAIResearch/Counting-DETR/src/CountDETR_147_1st_stage/compute_flops_and_speeds.py
code served (permissive licence) · get_code("02f479a7ced90f58")
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 Counter. 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
from collections import Counter

torch.manual_seed(0)

# Mock jit Value class that supports the interface needed by get_shape and bmm_flop_jit
class MockJitValue:
    def __init__(self, shape):
        self._shape = shape
        self._is_tensor = True
    
    def isCompleteTensor(self):
        return self._is_tensor
    
    def type(self):
        return self
    
    def sizes(self):
        return self._shape
    
    def kind(self):
        return 'TensorType'

class MockJitValueScalar:
    def __init__(self, kind_str):
        self._kind = kind_str
        self._is_tensor = False
    
    def isCompleteTensor(self):
        return self._is_tensor
    
    def type(self):
        return self
    
    def kind(self):
        return self._kind

# Create mock inputs for bmm_flop_jit
# The function expects:
# - inputs: list of jit Value objects
# - outputs: list of jit Value objects (not actually used in the function)

# First input: shape [T=2, batch_size=3, input_dim=4]
input_1 = MockJitValue([2, 3, 4])

# Second input: shape [T=2, batch_size=3, output_dim=5]
input_2 = MockJitValue([2, 3, 5])

inputs = [input_1, input_2]
outputs = [MockJitValue([2, 3, 5])]

ARGS = {
    'inputs': inputs,
    'outputs': outputs
}
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 Counter — a Counter output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Counter 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_shape Ran
ran on a synthesized input
VinAIResearch/Counting-DETR/src/CountDETR_147_1st_stage/compute_flops_and_speeds.py
code served (permissive licence) · get_code("4c68885935dfa85d")
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
import typing

torch.manual_seed(0)

# Create a mock JIT value object that behaves like torch._C.Value
class MockJITValue:
    def __init__(self, is_tensor=True, sizes=None, type_kind=None):
        self._is_tensor = is_tensor
        self._sizes = sizes if sizes is not None else [2, 4]
        self._type_kind = type_kind
    
    def isCompleteTensor(self):
        return self._is_tensor
    
    def type(self):
        return self
    
    def sizes(self):
        return self._sizes
    
    def kind(self):
        return self._type_kind

# Test with a complete tensor value
val = MockJITValue(is_tensor=True, sizes=[2, 4], type_kind=None)

ARGS = {
    "val": val
}
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
intersection_over_union Ran
ran on a synthesized input
VinAIResearch/Counting-DETR/src/CountDETR_147_2nd_stage/eval_all.py
code served (permissive licence) · get_code("a6c12500497d66b1")
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

# The function computes intersection over union for two boxes
# boxes_1 and boxes_2 are expected to be array-like with indexing [0], [1], [2], [3]
# representing x_min, y_min, x_max, y_max coordinates

boxes_1 = np.array([10.0, 20.0, 50.0, 80.0])
boxes_2 = np.array([30.0, 40.0, 70.0, 100.0])

ARGS = {
    "boxes_1": boxes_1,
    "boxes_2": boxes_2,
}
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 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

Also present in other papers' code

Of 4 samples lifted from this paper's linked repositories, 4 carry a function identity and 0 do not. Of the 4 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 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.

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

Repositories linked to this paper

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

Abstract

We tackle a new task of few-shot object counting and detection. Given a few exemplar bounding boxes of a target object class, we seek to count and detect all objects of the target class. This task shares the same supervision as the few-shot object counting but additionally outputs the object bounding boxes along with the total object count. To address this challenging problem, we introduce a novel twostage training strategy and a novel uncertainty-aware few-shot object detector: Counting-DETR. The former is aimed at generating pseudo ground-truth bounding boxes to train the latter. The latter leverages the pseudo ground-truth provided by the former but takes the necessary steps to account for the imperfection of pseudo ground-truth. To validate the performance of our method on the new task, we introduce two new datasets named FSCD-147 and FSCD-LVIS. Both datasets contain images with complex scenes, multiple object classes per image, and a huge variation in object shapes, sizes, and appearance. Our proposed approach outperforms very strong baselines adapted from few-shot object counting and few-shot object detection with a large margin in both counting and detection metrics. The code and models are available at https://github.com/VinAIResearch/Counting-DETR.

For agents

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

get_harvested_code_for_paper("2207.10988")
get_code_for_paper("2207.10988")
have("2207.10988")

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

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

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

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

Connect an agent — have() is free.