SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2210.01439 · 2022

Boosting Few-shot Fine-grained Recognition with Background Suppression and Foreground Alignment

arXiv · PDF · Open in the Atlas

Code that ran

8 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 5 have no contract verdict; 2 failures of our instrument; 0 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/2210.01439.json · badge: /api/ran/2210.01439.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
cser-tang-hao/bsfa-fsfg canonical (classifier label)
classifier basis not recorded on the link
8 ran · 0 no recorded run
FunctionStatusWhere it lives
AOLM Ran
ran on a synthesized input
cser-tang-hao/bsfa-fsfg/models/BAS.py
code served (permissive licence) · get_code("0daaa6ad378673ce")
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 2, 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
from skimage import measure
import math

torch.manual_seed(0)

# Create a small feature map tensor
# Shape: (batch_size, channels, height, width)
# The function uses:
# - size(-1) for width
# - size(-2) for height
# - sum along dim=1
# - mean along dim=[2,3]
# - iterates over first dimension (batch)
# - converts to numpy and reshapes to (height, width)

batch_size = 2
channels = 3
height = 12
width = 14

feature_maps = torch.randn(batch_size, channels, height, width)

ARGS = {
    "feature_maps": feature_maps
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
skimage, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 2, 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
Long_alignment Ran
ran on a synthesized input
cser-tang-hao/bsfa-fsfg/models/xcos.py
code served (permissive licence) · get_code("756937bff68ae44a")
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 5, dtype family float, shape (2, 3, 4, 5, 42) 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.functional as F

torch.manual_seed(0)

# Analyze the function:
# - support_x: shape (b, q, s, c, h, w) - used with F.normalize and view/transpose ops
# - query_x: shape (b, q, s, c, h, w) - same as support_x
# Both are normalized along dim -3, then reshaped and used in matmul operations

# Create small tensors with distinct dimension sizes:
# b=2 (batch), q=3 (query ways), s=4 (support shots), c=5 (channels), h=6 (height), w=7 (width)
b, q, s, c, h, w = 2, 3, 4, 5, 6, 7

support_x = torch.randn(b, q, s, c, h, w)
query_x = torch.randn(b, q, s, c, h, w)

ARGS = {
    "support_x": support_x,
    "query_x": query_x
}
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 5, dtype family float, shape (2, 3, 4, 5, 42) — shape (2, 3, 4, 5, 42) 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
Xcos Ran
ran on a synthesized input
cser-tang-hao/bsfa-fsfg/models/xcos.py
code served (permissive licence) · get_code("8171c1cb2f15ab8c")
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 3, dtype family float, shape (6, 4, 42) 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 Xcos expects:
# - ftrain: tensor of shape (B, n2, n1, C, H, W)
# - ftest: tensor of shape (B, n2, n1, C, H, W) or compatible

B = 2
n2 = 3
n1 = 4
C = 5
H = 6
W = 7

ftrain = torch.randn(B, n2, n1, C, H, W)
ftest = torch.randn(B, n2, n1, C, H, W)

ARGS = {
    "ftrain": ftrain,
    "ftest": ftest,
}
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 3, dtype family float, shape (6, 4, 42) — shape (6, 4, 42) 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
conv3x3 Ran
ran; our contract draft was wrong, not the code
cser-tang-hao/bsfa-fsfg/models/resnet12.py
pointer only (licence: MIT); the stored copy get_code serves, from lixiaotong97/DSU, is pointer only (licence: NONE) · get_code("fac5364e2f53c6db")
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 lixiaotong97/DSU, 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.

conv_block Ran
ran; our contract draft was wrong, not the code
cser-tang-hao/bsfa-fsfg/models/conv4.py
pointer only (licence: MIT); the stored copy get_code serves, from tiangeluo/fsl-global, is pointer only (licence: GPL-2.0) · get_code("9d556d61294bb0a8")
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 tiangeluo/fsl-global, and GPL-2.0, as GitHub detects it on that repository, is not in the permissive set Syntology serves inline. 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.

crop_featuremaps Ran
ran on a synthesized input
cser-tang-hao/bsfa-fsfg/models/BAS.py
code served (permissive licence) · get_code("82171d69d1080960")
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 4, dtype family float, shape (2, 3, 84, 84) as a later run recorded it. 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, 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.functional as F
from skimage import measure
import math

torch.manual_seed(0)

# Create small tensors for testing
# raw_imgs: batch_size=2, channels=3, height=84, width=84
raw_imgs = torch.randn(2, 3, 84, 84)

# feature_maps: batch_size=2, channels=16, height=7, width=7
# (smaller spatial dimensions so AOLM can process them)
feature_maps = torch.randn(2, 16, 7, 7)

ARGS = {
    "raw_imgs": raw_imgs,
    "feature_maps": feature_maps,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
skimage, 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, 3, 84, 84) — shape (2, 3, 84, 84) 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
drop_featuremaps Ran
ran on a synthesized input
cser-tang-hao/bsfa-fsfg/models/BAS.py
code served (permissive licence) · get_code("458baabe2b66a799")
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 4, dtype family float, shape (2, 4, 3, 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)

# Create a small feature map tensor
# Shape: (batch, channels, height, width)
# Using distinct sizes: batch=2, channels=4, height=3, width=5
feature_maps = torch.randn(2, 4, 3, 5)

ARGS = {
    "feature_maps": feature_maps
}
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 4, dtype family float, shape (2, 4, 3, 5) — shape (2, 4, 3, 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
read_image Ran
ran, honoured the contract we drafted
cser-tang-hao/bsfa-fsfg/dataset_loader/train_loader.py
pointer only (licence: MIT); the stored copy get_code serves, from suntongtongtong/benchmark-robustness-text-image-compose-retrieval, is pointer only (licence: NONE) · get_code("e3cbae59cb5ed741")
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 suntongtongtong/benchmark-robustness-text-image-compose-retrieval, 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.

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, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 1 the same month, 3 later) and 5 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
conv3x3 686 other papers
415 dated earlier, 9 the same month, 251 later, 11 same year, order not determinable · 31 only as an assembly brick
1406.2661 (2014-06)
Generative Adversarial Networks
1409.0575 (2014-09)
ImageNet Large Scale Visual Recognition Challenge
1412.6572 (2014-12)
Explaining and Harnessing Adversarial Examples
and 683 more not named here
conv_block 11 other papers
7 dated earlier, 4 later
1703.05175 (2017-03)
Prototypical Networks for Few-shot Learning
1908.05257 (2019-08)
Few-Shot Learning with Global Class Representations
1911.06045 (2019-11)
Self-Supervised Learning For Few-Shot Image Classification
and 8 more not named here
read_image 10 other papers
6 dated earlier, 4 later
1903.07071 (2019-03)
Bag of Tricks and A Strong Baseline for Deep Person Re-identification
1904.07223 (2019-04)
Joint Discriminative and Generative Learning for Person Re-identification
1905.13143 (2019-05)
Semantics-Aligned Representation Learning for Person Re-identification
and 7 more not named here

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

Few-shot fine-grained recognition (FS-FGR) aims to recognize novel fine-grained categories with the help of limited available samples. Undoubtedly, this task inherits the main challenges from both few-shot learning and fine-grained recognition. First, the lack of labeled samples makes the learned model easy to overfit. Second, it also suffers from high intra-class variance and low inter-class differences in the datasets. To address this challenging task, we propose a two-stage background suppression and foreground alignment framework, which is composed of a background activation suppression (BAS) module, a foreground object alignment (FOA) module, and a local-to-local (L2L) similarity metric. Specifically, the BAS is introduced to generate a foreground mask for localization to weaken background disturbance and enhance dominative foreground objects. The FOA then reconstructs the feature map of each support sample according to its correction to the query ones, which addresses the problem of misalignment between support-query image pairs. To enable the proposed method to have the ability to capture subtle differences in confused samples, we present a novel L2L similarity metric to further measure the local similarity between a pair of aligned spatial features in the embedding space. What's more, considering that background interference brings poor robustness, we infer the pairwise similarity of feature maps using both the raw image and the refined image. Extensive experiments conducted on multiple popular fine-grained benchmarks demonstrate that our method outperforms the existing state of the art by a large margin. The source codes are available at: https://github.com/CSer-Tang-hao/BSFA-FSFG.

For agents

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

get_harvested_code_for_paper("2210.01439")
get_code_for_paper("2210.01439")
have("2210.01439")

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

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

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

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

Connect an agent — have() is free.