SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2108.08165 · ICCV · 2021

Generalized and Incremental Few-Shot Learning by Explicit Learning and Calibration without Forgetting

Bernt Schiele, Hilde Kuehne, Anna Kukleva

arXiv · PDF · Open in the Atlas

Code that ran

10 of 13 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (3 of them constructed an object rather than computing a result; 3 honoured the contract we drafted, 0 violated it and 4 have no contract verdict; 3 failures of our instrument; 3 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/2108.08165.json · badge: /api/ran/2108.08165.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
annusha/lcwof canonical (classifier label)
classifier basis: census
2 ran · 1 no recorded run
annusha/LCwoF community
Papers with Code archive
8 ran · 2 no recorded run
FunctionStatusWhere it lives
Meter Ran
ran on a synthesized input · constructed an object; no result was computed
annusha/LCwoF/mini_imgnet/episode_training_clean.py
code served (permissive licence) · get_code("1d34df9e4341284e")
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 an instance of its own class, Meter: the run constructed the object and did not call it, so no result was computed. 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 numpy as np
import logging

logging.basicConfig(level=logging.DEBUG)

ARGS = {
    'mode': 'train',
    'name': 'loss'
}
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 Meter — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Meter 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
Precision Ran
ran on a synthesized input · constructed an object; no result was computed
annusha/LCwoF/mini_imgnet/episode_training_clean.py
code served (permissive licence) · get_code("694356acaabb8f42")
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 an instance of its own class, Precision: the run constructed the object and did not call it, so no result was computed. 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 numpy as np
from collections import defaultdict

torch.manual_seed(0)

# Create minimal opt object with required attributes
class Opt:
    def __init__(self):
        self.repr_learning = False
        self.model_name = 'resnet'
        self.base_cl = True

opt_instance = Opt()

# Inject opt into the module namespace for the function
import sys
current_module = sys.modules[__name__]
current_module.opt = opt_instance

ARGS = {
    'mode': 'test',
    'ses': [0, 1, 2]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Precision — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Precision 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
Viz Ran
ran on a synthesized input · constructed an object; no result was computed
annusha/LCwoF/mini_imgnet/episode_training_clean.py
code served (permissive licence) · get_code("373de0d7d664a0f9")
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 an instance of its own class, Viz: the run constructed the object and did not call it, so no result was computed. 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)

# The Viz class __init__ only sets self.env = None
# So we need to provide arguments for __init__ if it has any parameters
# Looking at the code, __init__(self) has no parameters besides self

# Therefore, ARGS should be empty since there are no parameters to pass
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 Viz — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Viz 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
adjust_lr Ran
ran, honoured the contract we drafted
annusha/LCwoF/mini_imgnet/episode_training_clean.py
code served (permissive licence) · get_code("db8232296a32d4c7")
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 torch.nn as nn
import torch.optim as optim

torch.manual_seed(0)

# Create a minimal model
class TinyModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

# Instantiate the model
model = TinyModel()

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

# Define old learning rate
old_lr = 0.1

# Define factor (optional, has default)
factor = 0.1

ARGS = {
    'optimizer': optimizer,
    'old_lr': old_lr,
    'factor': factor
}
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 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
am Ran
ran, honoured the contract we drafted
annusha/LCwoF/mini_imgnet/episode_training_clean.py
code served (permissive licence) · get_code("c56a0c2cc164834d")
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 numpy as np

torch.manual_seed(0)

# The function am(a, b) computes the arithmetic mean of two values
# It simply adds them and divides by 2
# Both a and b should be numeric types (int, float, or tensor)

# Create small tensors for a and b
a = torch.randn(2, 4)
b = torch.randn(2, 4)

ARGS = {
    "a": a,
    "b": b,
}
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 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
conv3x3 Ran
ran; our contract draft was wrong, not the code
annusha/lcwof/mini_imgnet/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.

hm Ran
ran, honoured the contract we drafted
annusha/LCwoF/mini_imgnet/episode_training_clean.py
code served (permissive licence) · get_code("97d75a6bfbfeb6a9")
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 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 hm(a, b) computes the harmonic mean: 2*a*b/(a+b)
# It expects two numeric values or tensors that support multiplication and addition

a = torch.tensor(3.0)
b = torch.tensor(5.0)

ARGS = {
    "a": a,
    "b": b,
}
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 Tensor, 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
load_few_shot Ran
ran on a synthesized input
annusha/lcwof/mini_imgnet/update_arg_parse.py
code served (permissive licence) · get_code("606ebc63d184a29c")
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 2, 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 json
import tempfile
import os

# Create a temporary JSON file with the expected structure
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, "few_shot_data.json")

# Create sample data matching the structure expected by load_few_shot
data = {
    "train": [
        {"id": 1, "text": "sample train 1"},
        {"id": 2, "text": "sample train 2"}
    ],
    "few_shot": [
        {"id": 3, "text": "sample few shot 1"},
        {"id": 4, "text": "sample few shot 2"}
    ],
    "few_shot_train": [
        "file1.txt",
        "file2.txt"
    ]
}

with open(temp_file, 'w') as f:
    json.dump(data, f)

ARGS = {
    "path": temp_file
}
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 tuple, ndim 2, 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
visdom_plot_losses Ran
ran; our contract draft was wrong, not the code
annusha/LCwoF/mini_imgnet/episode_training_clean.py
code served (permissive licence) · get_code("734b599ac298081d")
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 str. 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 numpy as np

class MockVisdom:
    def __init__(self):
        self.env = None
        self.lines = {}
        self.window_opts = {}
    
    def line(self, X, Y, win, update, name):
        """Mock line plotting method"""
        if win not in self.lines:
            self.lines[win] = {}
        self.lines[win][name] = {'X': X, 'Y': Y}
    
    def update_window_opts(self, win, opts):
        """Mock window options update method"""
        self.window_opts[win] = opts

viz = MockVisdom()

ARGS = {
    'viz': viz,
    'win': 'loss_window',
    'it': 42,
    'zero_nan': True,
    'xylabel': ('epoch', 'loss'),
    'train_loss': 0.5,
    'val_loss': 0.3,
    'test_metric': 0.0
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
visdom_scatter_update Ran
ran; our contract draft was wrong, not the code
annusha/LCwoF/mini_imgnet/episode_training_clean.py
code served (permissive licence) · get_code("75594f59772b57c0")
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 str. 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 numpy as np

class MockVisdom:
    def scatter(self, X, Y, win, update, name):
        pass
    
    def update_window_opts(self, win, opts):
        pass

viz = MockVisdom()

ARGS = {
    'viz': viz,
    'win': 'test_window',
    'x': 5,
    'xylabel': ('episode', 'precision'),
    'accuracy': 0.92,
    'loss': 0.15
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
Training Not yet run
unverified (harvested, no recorded run)
annusha/LCwoF/mini_imgnet/episode_training_clean.py
code served (permissive licence) · get_code("1fa76092363e9543")
How it ran

no invocation recorded.

get_classes Not yet run
unverified (harvested, no recorded run)
annusha/lcwof/mini_imgnet/create_episodes.py
code served (permissive licence) · get_code("5251b5bd5881ebf2")
How it ran

no invocation recorded.

set_bn_eval Not yet run
unverified (harvested, no recorded run)
annusha/LCwoF/mini_imgnet/episode_training_clean.py
code served (permissive licence) · get_code("ce274f35d81dafd6")
How it ran

no invocation recorded.

Also present in other papers' code

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

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

Both generalized and incremental few-shot learning have to deal with three major challenges: learning novel classes from only few samples per class, preventing catastrophic forgetting of base classes, and classifier calibration across novel and base classes. In this work we propose a three-stage framework that allows to explicitly and effectively address these challenges. While the first phase learns base classes with many samples, the second phase learns a calibrated classifier for novel classes from few samples while also preventing catastrophic forgetting. In the final phase, calibration is achieved across all classes. We evaluate the proposed framework on four challenging benchmark datasets for image and video few-shot classification and obtain state-of-theart results for both generalized and incremental few shot learning.

For agents

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

get_harvested_code_for_paper("2108.08165")
get_code_for_paper("2108.08165")
have("2108.08165")

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

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

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

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

Connect an agent — have() is free.