SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2409.06305 · 2024

High-Performance Few-Shot Segmentation with Foundation Models: An Empirical Study

arXiv · PDF · Open in the Atlas

Code that ran

7 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; 0 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 6 failures of our instrument; 1 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/2409.06305.json · badge: /api/ran/2409.06305.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
dut-csj/foundationfss canonical (classifier label)
classifier basis: census
7 ran · 1 no recorded run
FunctionStatusWhere it lives
extract_feat_chossed Ran
ran; our contract draft was wrong, not the code
dut-csj/foundationfss/model/dino_clip.py
code served (permissive licence) · get_code("bc73631b5423a475")
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. 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 torch.nn.functional as F

torch.manual_seed(0)

# Build a minimal backbone that matches the function's usage
class MinimalAttention(nn.Module):
    def __init__(self, dim):
        super().__init__()
        self.in_proj_weight = nn.Parameter(torch.randn(3 * dim, dim))
        self.in_proj_bias = nn.Parameter(torch.randn(3 * dim))
        self.out_proj = nn.Linear(dim, dim)
    
    def forward(self, x):
        return self.out_proj(x)

class MinimalResBlock(nn.Module):
    def __init__(self, dim):
        super().__init__()
        self.ln_1 = nn.LayerNorm(dim)
        self.attn = MinimalAttention(dim)
        self.ln_2 = nn.LayerNorm(dim)
        self.mlp = nn.Sequential(
            nn.Linear(dim, dim * 2),
            nn.GELU(),
            nn.Linear(dim * 2, dim)
        )
        self.ls_2 = nn.Identity()
    
    def forward(self, x):
        x = x + self.attn(self.ln_1(x))
        x = x + self.ls_2(self.mlp(self.ln_2(x)))
        return x

class MinimalTransformer(nn.Module):
    def __init__(self, dim, num_layers):
        super().__init__()
        self.layers = num_layers
        self.resblocks = nn.ModuleList([MinimalResBlock(dim) for _ in range(num_layers)])
    
    def forward(self, x):
        for block in self.resblocks:
            x = block(x)
        return x

class MinimalBackbone(nn.Module):
    def __init__(self, img_channels, patch_dim, embed_dim, num_layers):
        super().__init__()
        self.conv1 = nn.Conv2d(img_channels, embed_dim, kernel_size=2, stride=2)
        self.positional_embedding = nn.Parameter(torch.randn(1, patch_dim * patch_dim, embed_dim))
        self.patch_dropout = nn.Identity()
        self.ln_pre = nn.LayerNorm(embed_dim)
        self.transformer = MinimalTransformer(embed_dim, num_layers)
    
    def forward(self, x):
        return x

# Create minimal test data
batch_size = 2
img_channels = 3
img_size = 4
embed_dim = 4
num_layers = 3

img = torch.randn(batch_size, img_channels, img_size, img_size)
backbone = MinimalBackbone(img_channels, 2, embed_dim, num_layers)

ARGS = {
    "img": img,
    "backbone": backbone
}
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 — a list output has no array shape of its own; none is 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
extract_feat_res Ran
ran; our contract draft was wrong, not the code
dut-csj/foundationfss/model/base/feature.py
code served (permissive licence) · get_code("5e71dad5278d69a0")
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. 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)

# Build a minimal ResNet-like backbone that satisfies the function's usage
class MinimalBottleneck(nn.Module):
    def __init__(self, in_channels, out_channels, has_downsample=False):
        super().__init__()
        self.conv1 = nn.Conv2d(in_channels, out_channels, 1)
        self.bn1 = nn.BatchNorm2d(out_channels)
        self.relu = nn.ReLU(inplace=True)
        self.conv2 = nn.Conv2d(out_channels, out_channels, 3, padding=1)
        self.bn2 = nn.BatchNorm2d(out_channels)
        self.conv3 = nn.Conv2d(out_channels, out_channels, 1)
        self.bn3 = nn.BatchNorm2d(out_channels)
        
        if has_downsample:
            self.downsample = nn.Sequential(
                nn.Conv2d(in_channels, out_channels, 1),
                nn.BatchNorm2d(out_channels)
            )
        else:
            self.downsample = nn.Identity()

class MinimalResNet(nn.Module):
    def __init__(self):
        super().__init__()
        self.conv1 = nn.Conv2d(3, 64, 7, stride=2, padding=3)
        self.bn1 = nn.BatchNorm2d(64)
        self.relu = nn.ReLU(inplace=True)
        self.maxpool = nn.MaxPool2d(kernel_size=3, stride=2, padding=1)
        
        # Create layer1, layer2, layer3, layer4 with bottleneck blocks
        self.layer1 = nn.ModuleList([
            MinimalBottleneck(64, 64, has_downsample=False),
            MinimalBottleneck(64, 64, has_downsample=False)
        ])
        self.layer2 = nn.ModuleList([
            MinimalBottleneck(64, 128, has_downsample=True),
            MinimalBottleneck(128, 128, has_downsample=False)
        ])
        self.layer3 = nn.ModuleList([
            MinimalBottleneck(128, 256, has_downsample=True),
            MinimalBottleneck(256, 256, has_downsample=False)
        ])
        self.layer4 = nn.ModuleList([
            MinimalBottleneck(256, 512, has_downsample=True),
            MinimalBottleneck(512, 512, has_downsample=False)
        ])

# Create backbone
backbone = MinimalResNet()
backbone.eval()

# Create input image tensor (batch=2, channels=3, height=4, width=4)
img = torch.randn(2, 3, 4, 4)

# feat_ids: indices to collect features from
feat_ids = [1, 3]

# bottleneck_ids: which bottleneck block in each layer
bottleneck_ids = [0, 1, 0, 1]

# lids: which layer (1, 2, 3, or 4)
lids = [1, 1, 2, 2]

ARGS = {
    'img': img,
    'backbone': backbone,
    'feat_ids': feat_ids,
    'bottleneck_ids': bottleneck_ids,
    'lids': lids
}
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 — a list output has no array shape of its own; none is 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
extract_feat_vgg Ran
ran; our contract draft was wrong, not the code
dut-csj/foundationfss/model/base/feature.py
code served (permissive licence) · get_code("cda8eb3e776a0591")
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. 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 minimal VGG-like backbone
class MinimalVGG(nn.Module):
    def __init__(self):
        super().__init__()
        self.features = nn.Sequential(
            nn.Conv2d(3, 16, kernel_size=3, padding=1),
            nn.ReLU(inplace=True),
            nn.Conv2d(16, 32, kernel_size=3, padding=1),
            nn.ReLU(inplace=True),
            nn.MaxPool2d(kernel_size=2, stride=2),
            nn.Conv2d(32, 64, kernel_size=3, padding=1),
            nn.ReLU(inplace=True),
        )
    
    def forward(self, x):
        return self.features(x)

# Create input image tensor (batch_size=2, channels=3, height=4, width=4)
img = torch.randn(2, 3, 4, 4)

# Create backbone model
backbone = MinimalVGG()

# Define feature layer indices to extract
feat_ids = [1, 4, 6]

# Optional parameters (not used in function body but part of signature)
bottleneck_ids = None
lids = None

ARGS = {
    "img": img,
    "backbone": backbone,
    "feat_ids": feat_ids,
    "bottleneck_ids": bottleneck_ids,
    "lids": lids,
}
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 — a list output has no array shape of its own; none is 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_finetune_optimizer Ran
ran; our contract draft was wrong, not the code
dut-csj/foundationfss/common/my_optim.py
code served (permissive licence) · get_code("0787eafcc2177118")
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 AdamW. 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 torch.optim as optim

torch.manual_seed(0)

class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.backbone = nn.Sequential(
            nn.Linear(4, 8),
            nn.ReLU(),
            nn.Linear(8, 4)
        )
        self.head = nn.Sequential(
            nn.Linear(4, 2),
            nn.ReLU()
        )
        self.output = nn.Linear(2, 1)
    
    def forward(self, x):
        x = self.backbone(x)
        x = self.head(x)
        x = self.output(x)
        return x

class Args:
    def __init__(self):
        self.lr = 0.0005

model = SimpleModel()
args = Args()

ARGS = {
    'args': args,
    'model': model
}
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 AdamW — a AdamW output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a AdamW 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
mean Ran
ran, violated the contract we drafted
dut-csj/foundationfss/common/utils.py
code served (permissive licence) · get_code("2fbd545597570f15")
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 float, 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
import numpy as np

torch.manual_seed(0)

# The function 'mean' takes parameter 'x' and:
# - calls sum(x)
# - calls len(x)
# - performs division and comparison operations
# So 'x' should be a collection (list, tuple, etc.) of numeric values

# Create a simple list of numbers
x = [1.0, 2.0, 3.0, 4.0, 5.0]

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, 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
to_cpu Ran
ran; our contract draft was wrong, not the code
dut-csj/foundationfss/common/utils.py
code served (permissive licence) · get_code("a3d18d17a48bf937")
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 (2, 4) 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)

# Create a small tensor on CPU
tensor = torch.randn(2, 4, requires_grad=True)

ARGS = {
    "tensor": tensor
}
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 2, dtype family float, shape (2, 4) — shape (2, 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
to_cuda Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
dut-csj/foundationfss/common/utils.py
code served (permissive licence) · get_code("8c6947459806ae3b")
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. 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 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)

batch = {
    "input_ids": torch.randint(0, 100, (2, 4)),
    "attention_mask": torch.ones(2, 4),
    "logits": torch.randn(2, 3),
    "loss": torch.tensor(0.5),
}

ARGS = {
    "batch": batch
}
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
extract_feat_chossed_clip Not yet run
unverified (harvested, no recorded run)
dut-csj/foundationfss/common/cliptest.py
code served (permissive licence) · get_code("23b2328dffee1082")
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, 5 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 0 the same month, 0 later) and 3 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
mean 7 other papers
7 dated earlier
2007.10587 (2020-07)
Learning to Compose Hypercolumns for Visual Correspondence
2308.13469 (2023-08)
RestNet: Boosting Cross-Domain Few-Shot Segmentation with Residual Transformation Network
2312.15731 (2023-12)
Adaptive FSS: A Novel Few-Shot Segmentation Framework via Prototype Enhancement
and 4 more not named here
to_cpu 6 other papers
6 dated earlier
2308.13469 (2023-08)
RestNet: Boosting Cross-Domain Few-Shot Segmentation with Residual Transformation Network
2312.15731 (2023-12)
Adaptive FSS: A Novel Few-Shot Segmentation Framework via Prototype Enhancement
2402.17614 (2024-02)
Adapt Before Comparison: A New Perspective on Cross-Domain Few-Shot Segmentation
and 3 more not named here
to_cuda 5 other papers
5 dated earlier
2308.13469 (2023-08)
RestNet: Boosting Cross-Domain Few-Shot Segmentation with Residual Transformation Network
2312.15731 (2023-12)
Adaptive FSS: A Novel Few-Shot Segmentation Framework via Prototype Enhancement
2402.17614 (2024-02)
Adapt Before Comparison: A New Perspective on Cross-Domain Few-Shot Segmentation
and 2 more not named here
extract_feat_res 3 other papers
3 dated earlier
2207.10866 (2022-07)
Cost Aggregation with 4D Convolutional Swin Transformer for Few-Shot Segmentation
2308.13469 (2023-08)
RestNet: Boosting Cross-Domain Few-Shot Segmentation with Residual Transformation Network
2405.15265 (2024-05)
Cross-Domain Few-Shot Semantic Segmentation via Doubly Matching Transformation
extract_feat_vgg 3 other papers
3 dated earlier
2207.10866 (2022-07)
Cost Aggregation with 4D Convolutional Swin Transformer for Few-Shot Segmentation
2308.13469 (2023-08)
RestNet: Boosting Cross-Domain Few-Shot Segmentation with Residual Transformation Network
2405.15265 (2024-05)
Cross-Domain Few-Shot Semantic Segmentation via Doubly Matching Transformation

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

Existing few-shot segmentation (FSS) methods mainly focus on designing novel support-query matching and self-matching mechanisms to exploit implicit knowledge in pre-trained backbones. However, the performance of these methods is often constrained by models pre-trained on classification tasks. The exploration of what types of pre-trained models can provide more beneficial implicit knowledge for FSS remains limited. In this paper, inspired by the representation consistency of foundational computer vision models, we develop a FSS framework based on foundation models. To be specific, we propose a simple approach to extract implicit knowledge from foundation models to construct coarse correspondence and introduce a lightweight decoder to refine coarse correspondence for fine-grained segmentation. We systematically summarize the performance of various foundation models on FSS and discover that the implicit knowledge within some of these models is more beneficial for FSS than models pre-trained on classification tasks. Extensive experiments on two widely used datasets demonstrate the effectiveness of our approach in leveraging the implicit knowledge of foundation models. Notably, the combination of DINOv2 and DFN exceeds previous state-of-the-art methods by 17.5% on COCO-20i. Code is available at https://github.com/DUT-CSJ/FoundationFSS.

For agents

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

get_harvested_code_for_paper("2409.06305")
get_code_for_paper("2409.06305")
have("2409.06305")

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

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

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

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

Connect an agent — have() is free.