SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2007.09384 · 2020

Multi-Scale Positive Sample Refinement for Few-Shot Object Detection

arXiv · PDF · Open in the Atlas

Code that ran

6 of 8 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 1 has no contract verdict; 4 failures of our instrument; 2 no recorded run); 1 of them was also run on the host, not in the jail, by the peer-agreement lane that set its level, measured 2026-11-21; 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/2007.09384.json · badge: /api/ran/2007.09384.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
jiaxi-wu/MPSR canonical (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
bohao-lee/pdc community (classifier label)
classifier basis not recorded on the link
5 ran · 2 no recorded run
FunctionStatusWhere it lives
window_partition Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
bohao-lee/pdc/models/swin_transformer.py
code served (permissive licence) · get_code("144d10b49baeb8a6")
How it ran

Ran in Syntology's jail on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 4, dtype family float, shape (8, 4, 4, 4) as a later run recorded it. The image it ran in was not recorded. The comparison behind this sample's level is a different run: the peer-agreement lane ran it again on the host, not in the jail (report dated 2026-09-04T22:38:58Z). 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 tensor with shape (B, H, W, C)
# B=2 (batch), H=8 (height), W=8 (width), C=4 (channels)
# Using distinct sizes: 2, 8, 8, 4
x = torch.randn(2, 8, 8, 4)

# window_size must divide both H and W evenly
# H=8, W=8, so window_size=4 works (8 // 4 = 2)
window_size = 4

ARGS = {
    "x": x,
    "window_size": window_size,
}
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 Tensor, ndim 4, dtype family float, shape (8, 4, 4, 4) — shape (8, 4, 4, 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
build_roi_box_head Ran
ran; our contract draft was wrong, not the code
jiaxi-wu/MPSR/maskrcnn_benchmark/modeling/roi_heads/box_head/box_head.py
code served (permissive licence) · get_code("49fb22ff17d97423")
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 ROIBoxHead. 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)

# Stand-in classes for BoxList
class BoxList:
    def __init__(self, bbox, image_size):
        self.bbox = bbox
        self.image_size = image_size
        self.extra_fields = {}
    
    def to(self, dtype=None):
        if dtype is not None:
            self.bbox = self.bbox.to(dtype=dtype)
        return self
    
    def __len__(self):
        return len(self.bbox)

# Stand-in feature extractor
class StandInFeatureExtractor(nn.Module):
    def __init__(self, out_channels=256):
        super().__init__()
        self.out_channels = out_channels
        self.fc = nn.Linear(4, out_channels)
    
    def forward(self, features, proposals=None):
        # Return two outputs: xc and xr
        batch_size = 2
        xc = torch.randn(batch_size, self.out_channels)
        xr = torch.randn(batch_size, self.out_channels)
        return xc, xr

# Stand-in predictor
class StandInPredictor(nn.Module):
    def __init__(self, in_channels=256, num_classes=81):
        super().__init__()
        self.num_classes = num_classes
        self.fc_class = nn.Linear(in_channels, num_classes)
        self.fc_box = nn.Linear(in_channels, 4)
    
    def forward(self, xc, xr=None):
        class_logits = self.fc_class(xc)
        box_regression = self.fc_box(xc)
        return class_logits, box_regression

# Stand-in post processor
class StandInPostProcessor(nn.Module):
    def forward(self, predictions, proposals):
        return proposals

# Stand-in loss evaluator
class StandInLossEvaluator(nn.Module):
    def subsample(self, proposals, targets):
        return proposals
    
    def forward(self, class_logits_list, box_regression_list, closeup_logits=None, closeup_labels=None):
        loss_classifier = torch.tensor(0.5)
        loss_box_reg = torch.tensor(0.3)
        loss_closeup = None
        if closeup_logits is not None and closeup_labels is not None:
            loss_closeup = torch.tensor(0.2)
        return loss_classifier, loss_box_reg, loss_closeup

# Stand-in config
class StandInConfig:
    def __init__(self):
        self.MODEL = type('obj', (object,), {
            'ROI_BOX_HEAD': type('obj', (object,), {
                'FEATURE_EXTRACTOR': 'ResNet50Conv5ROIFeatureExtractor',
                'PREDICTOR': 'FastRCNNPredictor',
                'POST_PROCESSOR': 'PostProcessor',
                'LOSS_EVALUATOR': 'FastRCNNLossEvaluator'
            })()
        })()

# Mock factory functions
def make_roi_box_feature_extractor(cfg, in_channels):
    return StandInFeatureExtractor(out_channels=256)

def make_roi_box_predictor(cfg, in_channels):
    return StandInPredictor(in_channels=in_channels, num_classes=81)

def make_roi_box_post_processor(cfg):
    return StandInPostProcessor()

def make_roi_box_loss_evaluator(cfg):
    return StandInLossEvaluator()

# Inject factory functions into the module namespace
import sys
current_module = sys.modules[__name__]
current_module.make_roi_box_feature_extractor = make_roi_box_feature_extractor
current_module.make_roi_box_predictor = make_roi_box_predictor
current_module.make_roi_box_post_processor = make_roi_box_post_processor
current_module.make_roi_box_loss_evaluator = make_roi_box_loss_evaluator

# Create config and in_channels
cfg = StandInConfig()
in_channels = 256

ARGS = {
    "cfg": cfg,
    "in_channels": in_channels
}
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 ROIBoxHead — a ROIBoxHead output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ROIBoxHead 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
drop_path Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
bohao-lee/pdc/models/vision_transformer.py
pointer only (licence: Apache-2.0); 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 (Apache-2.0), 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.

get_num_layer_for_mae Ran
ran on a synthesized input
bohao-lee/pdc/mmcv_custom/layer_decay_optimizer_constructor_backbone_frozen.py
code served (permissive licence) · get_code("9442eb59f6d0a7aa")
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 int, ndim 0, dtype family int, 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)

# Analyze the function:
# - var_name: string parameter used for startswith() and in() checks, and split operations
# - num_encoder_layers: int parameter used in arithmetic
# - num_decoder_layers: int parameter (appears in signature but not used in function body)
# - num_max_layer: int parameter used in arithmetic

# Test cases for var_name parameter:
test_cases = [
    'backbone.cls_token',
    'backbone.mask_token',
    'backbone.pos_embed',
    'backbone.patch_embed.something',
    'backbone.blocks.0.weight',
    'backbone.blocks.5.bias',
    'roi_head.bbox_head.norm.layer',
    'roi_head.bbox_head.decoder_embed.weight',
    'roi_head.bbox_head.decoder_blocks.2.conv',
    'roi_head.bbox_head.det_token',
    'some.other.parameter',
]

# Choose representative test values
var_name = 'backbone.blocks.3.weight'
num_encoder_layers = 12
num_decoder_layers = 8
num_max_layer = 24

ARGS = {
    'var_name': var_name,
    'num_encoder_layers': num_encoder_layers,
    'num_decoder_layers': num_decoder_layers,
    'num_max_layer': num_max_layer,
}
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 int, ndim 0, dtype family int, 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
get_num_layer_for_vit Ran
ran, honoured the contract we drafted
bohao-lee/pdc/mmcv_custom/layer_decay_optimizer_constructor.py
code served (permissive licence) · get_code("24385f6e21ea88d7")
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 int, ndim 0, dtype family int, 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
import torch.nn as nn

torch.manual_seed(0)

# The function takes two parameters:
# 1. var_name: a string representing a variable name
# 2. num_max_layer: an integer representing the maximum number of layers

# Looking at the function body:
# - var_name is compared against strings and used with string operations like startswith() and split()
# - num_max_layer is used as an integer for arithmetic

# We'll test with a realistic var_name from a Vision Transformer backbone
var_name = "backbone.blocks.5.attn.qkv.weight"
num_max_layer = 12

ARGS = {
    "var_name": var_name,
    "num_max_layer": num_max_layer
}
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 int, ndim 0, dtype family int, 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
window_reverse Ran
ran; our contract draft was wrong, not the code
bohao-lee/pdc/models/swin_transformer.py
code served (permissive licence) · get_code("61bf152e6a42a184")
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 Tensor, ndim 4, dtype family float, shape (2, 8, 12, 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

torch.manual_seed(0)

# Parameters for window_reverse
# windows: (num_windows*B, window_size, window_size, C)
# The function expects windows to be partitioned from an image of size (B, H, W, C)
# where the image is divided into non-overlapping windows of size window_size x window_size

B = 2  # batch size
H = 8  # image height
W = 12  # image width
window_size = 4  # window size
C = 3  # number of channels

# Calculate number of windows
num_windows_h = H // window_size  # 2
num_windows_w = W // window_size  # 3
num_windows = num_windows_h * num_windows_w  # 6

# windows shape: (num_windows*B, window_size, window_size, C)
# = (6*2, 4, 4, 3) = (12, 4, 4, 3)
windows = torch.randn(num_windows * B, window_size, window_size, C)

ARGS = {
    "windows": windows,
    "window_size": window_size,
    "H": H,
    "W": W,
}
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 Tensor, ndim 4, dtype family float, shape (2, 8, 12, 3) — shape (2, 8, 12, 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
vit_small Not yet run
unverified (harvested, no recorded run)
bohao-lee/pdc/models/vision_transformer.py
code served (permissive licence) · get_code("a8f99539dbbaa617")
How it ran

no invocation recorded.

vit_tiny Not yet run
unverified (harvested, no recorded run)
bohao-lee/pdc/models/vision_transformer.py
code served (permissive licence) · get_code("1b5e2f11314f237d")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 8 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 0 the same month, 7 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
window_reverse 227 other papers
3 dated earlier, 224 later · 34 only as an assembly brick
1608.03983 (2016-08)
SGDR: Stochastic Gradient Descent with Warm Restarts
1711.10925 (2017-11)
Deep Image Prior
2003.13678 (2020-03)
Designing Network Design Spaces
and 224 more not named here
drop_path 224 other papers
1 dated earlier, 222 later, 1 undated · 38 only as an assembly brick
2003.12039 (2020-03)
RAFT: Recurrent All-Pairs Field Transforms for Optical Flow
2010.11929 (2020-10)
An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
2012.12877 (2020-12)
Training data-efficient image transformers & distillation through attention
and 221 more not named here
window_partition 223 other papers
3 dated earlier, 220 later · 32 only as an assembly brick
1706.03762 (2017-06)
Attention Is All You Need
1711.10925 (2017-11)
Deep Image Prior
2003.13678 (2020-03)
Designing Network Design Spaces
and 220 more not named here
get_num_layer_for_vit 5 other papers
5 later
2212.04246 (2022-12)
ViTPose++: Vision Transformer for Generic Body Pose Estimation
2312.00752 (2023-12)
Mamba: Linear-Time Sequence Modeling with Selective State Spaces
and 2 more not named here
build_roi_box_head 2 other papers
2 dated earlier
1904.01355 (2019-04)
FCOS: Fully Convolutional One-Stage Object Detection
2002.10200 (2020-02)
ABCNet: Real-time Scene Text Spotting with Adaptive Bezier-Curve Network
get_num_layer_for_mae 1 other paper
1 later
aaai_28502 (2024 (year only))
Spatial Transform Decoupling for Oriented Object Detection
vit_small 1 other paper
1 later
aaai_28502 (2024 (year only))
Spatial Transform Decoupling for Oriented Object Detection
vit_tiny 1 other paper
1 later
aaai_28502 (2024 (year only))
Spatial Transform Decoupling for Oriented Object 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-21.

Repositories linked to this paper

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

Abstract

Few-shot object detection (FSOD) helps detectors adapt to unseen classes with few training instances, and is useful when manual annotation is time-consuming or data acquisition is limited. Unlike previous attempts that exploit few-shot classification techniques to facilitate FSOD, this work highlights the necessity of handling the problem of scale variations, which is challenging due to the unique sample distribution. To this end, we propose a Multi-scale Positive Sample Refinement (MPSR) approach to enrich object scales in FSOD. It generates multi-scale positive samples as object pyramids and refines the prediction at various scales. We demonstrate its advantage by integrating it as an auxiliary branch to the popular architecture of Faster R-CNN with FPN, delivering a strong FSOD solution. Several experiments are conducted on PASCAL VOC and MS COCO, and the proposed approach achieves state of the art results and significantly outperforms other counterparts, which shows its effectiveness. Code is available at https://github.com/jiaxi-wu/MPSR.

For agents

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

get_harvested_code_for_paper("2007.09384")
get_code_for_paper("2007.09384")
have("2007.09384")

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

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

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

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

Connect an agent — have() is free.