SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1804.09458 · 2018

Dynamic Few-Shot Visual Learning without Forgetting

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 (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 8 have no contract verdict; 2 failures of our instrument; 3 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-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/1804.09458.json · badge: /api/ran/1804.09458.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
gidariss/FewShotWithoutForgetting canonical (classifier label)
classifier basis: census
6 ran · 3 no recorded run
jaekyeom/mabas community (classifier label)
classifier basis not recorded on the link
4 ran · 0 no recorded run
FunctionStatusWhere it lives
load_data Ran
ran; our contract draft was wrong, not the code
jaekyeom/mabas/cifar_fs_dataloader.py
pointer only (licence: MIT); the stored copy get_code serves, from few-shot-learning-on-chest-x-ray/fsl_subspace, is pointer only (licence: NONE) · get_code("4a4efe7627515cc5")
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 few-shot-learning-on-chest-x-ray/fsl_subspace, 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.

buildLabelIndex Ran
ran; our contract draft was wrong, not the code
jaekyeom/mabas/cifar_fs_dataloader.py
pointer only (licence: MIT); the stored copy get_code serves, from valeoai/moca, is pointer only (licence: NOASSERTION) · get_code("57889d72f516d105")
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 valeoai/moca, and GitHub could not classify the licence of that repository (NOASSERTION). 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.

create_model Ran
ran on a synthesized input
gidariss/FewShotWithoutForgetting/architectures/MatchingNetworksHead.py
code served (permissive licence) · get_code("55c49bbda53a3309")
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 MatchingNetwork. 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 config dict for MatchingNetwork
opt = {
    'scale_cls': 10.0
}

# Define the arguments for create_model
ARGS = {
    'opt': opt
}
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 MatchingNetwork — a MatchingNetwork output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a MatchingNetwork 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
create_model Ran
ran on a synthesized input
gidariss/FewShotWithoutForgetting/architectures/PrototypicalNetworksHead.py
code served (permissive licence) · get_code("a6e9e61e1b44f818")
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 PrototypicalNetwork. 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 config dict for the model
opt = {
    'scale_cls': 1.0
}

ARGS = {
    'opt': opt
}
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 PrototypicalNetwork — a PrototypicalNetwork output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a PrototypicalNetwork 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
create_model Ran
ran on a synthesized input
gidariss/FewShotWithoutForgetting/architectures/ResNetFeat.py
code served (permissive licence) · get_code("0350c536ac315ab1")
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 ResNet. 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)

ARGS = {
    'opt': {
        'restype': 'ResNet10',
        'userelu': True
    }
}
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 ResNet — a ResNet output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ResNet 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
create_model Ran
ran on a synthesized input
gidariss/FewShotWithoutForgetting/architectures/ResNetLike.py
code served (permissive licence) · get_code("e7d952233c878020")
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 ResNetLike. 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 math

torch.manual_seed(0)

ARGS = {
    'opt': {
        'in_planes': 3,
        'userelu': False,
        'dropout': 0.0
    }
}
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 ResNetLike — a ResNetLike output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ResNetLike 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
create_model Ran
ran on a synthesized input
jaekyeom/mabas/architectures/ClassifierWithFewShotGenerationModule.py
code served (permissive licence) · get_code("da579fffad628bee")
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 Classifier. 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

torch.manual_seed(0)

# Define the opt dict with all required parameters
opt = {
    'weight_generator_type': 'attention_based',
    'classifier_type': 'cosine',
    'nKall': 5,  # number of base classes
    'nFeat': 4,  # feature dimension
    'base_label_ids': [0, 1, 2, 3, 4],
    'scale_cls': 10.0,
    'scale_att': 10.0,
}

ARGS = {
    'opt': opt
}
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 Classifier — a Classifier output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Classifier 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
softmax_with_novel_prior Ran
ran on a synthesized input
gidariss/FewShotWithoutForgetting/algorithms/ImageNetLowShotExperiments.py
code served (permissive licence) · get_code("9480141f35f83ef2")
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

torch.manual_seed(0)

# Create small tensors for the function
batch_size = 2
num_classes = 4

# scores: shape (batch_size, num_classes) - log probabilities
scores = torch.randn(batch_size, num_classes)

# novel_inds: indices of novel classes
novel_inds = [0, 1]

# base_inds: indices of base classes
base_inds = [2, 3]

# prior_m: prior weight for novel classes (float between 0 and 1)
prior_m = 0.6

ARGS = {
    "scores": scores,
    "novel_inds": novel_inds,
    "base_inds": base_inds,
    "prior_m": prior_m,
}
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
top1accuracy Ran
ran on a synthesized input
gidariss/FewShotWithoutForgetting/algorithms/FewShot.py
code served (permissive licence) · get_code("2fb2ad87d980888f")
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

torch.manual_seed(0)

# The function expects:
# - output: a tensor with shape (batch_size, num_classes) that has a max operation on dim=1
# - target: a tensor with shape (batch_size,) or broadcastable to match pred after view(-1)

batch_size = 2
num_classes = 4

# Create output tensor: shape (2, 4) - logits or probabilities
output = torch.randn(batch_size, num_classes)

# Create target tensor: shape (2,) - class indices
target = torch.randint(0, num_classes, (batch_size,))

ARGS = {
    "output": output,
    "target": target,
}
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 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
top1accuracy Ran
ran on a synthesized input
jaekyeom/mabas/algorithms/FewShot.py
code served (permissive licence) · get_code("200772de4b6b9600")
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

torch.manual_seed(0)

# Create output tensor: shape (batch_size, num_classes)
# The function calls output.max(dim=1), so it needs 2D tensor with class dimension
output = torch.randn(2, 4)

# Create target tensor: shape (batch_size,)
# The function compares pred (flattened) with target (flattened)
target = torch.randint(0, 4, (2,))

ARGS = {
    "output": output,
    "target": target,
}
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
L2SquareDist Not yet run
unverified (harvested, no recorded run)
gidariss/FewShotWithoutForgetting/architectures/PrototypicalNetworksHead.py
code served (permissive licence) · get_code("0adaefcc023d86e1")
How it ran

no invocation recorded.

compute_top1_and_top5_accuracy Not yet run
unverified (harvested, no recorded run)
gidariss/FewShotWithoutForgetting/algorithms/ImageNetLowShotExperiments.py
code served (permissive licence) · get_code("0579910fda20b6c9")
How it ran

no invocation recorded.

create_model Not yet run
unverified (harvested, no recorded run)
gidariss/FewShotWithoutForgetting/architectures/ClassifierWithFewShotGenerationModule.py
code served (permissive licence) · get_code("fefd560d36d2d370")
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 12 distinct functions with an identity, 4 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 4 later) and 8 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
buildLabelIndex 6 other papers
1 dated earlier, 5 later
1803.07728 (2018-03)
Unsupervised Representation Learning by Predicting Image Rotations
1905.01102 (2019-05)
Generating Classification Weights with GNN Denoising Autoencoders for Few-Shot Learning
1906.02944 (2019-06)
Learning Adaptive Classifiers Synthesis for Generalized Few-Shot Learning
and 3 more not named here
load_data 4 other papers
4 later
1906.02944 (2019-06)
Learning Adaptive Classifiers Synthesis for Generalized Few-Shot Learning
1911.06045 (2019-11)
Self-Supervised Learning For Few-Shot Image Classification
ijcai2020_0377 (2020 (year only))
Consistent MetaReg: Alleviating Intra-task Discrepancy for Better Meta-knowledge
and 1 more not named here
compute_top1_and_top5_accuracy 1 other paper
1 later
1905.01102 (2019-05)
Generating Classification Weights with GNN Denoising Autoencoders for Few-Shot Learning
softmax_with_novel_prior 1 other paper
1 later
1905.01102 (2019-05)
Generating Classification Weights with GNN Denoising Autoencoders for Few-Shot Learning

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

The human visual system has the remarkably ability to be able to effortlessly learn novel concepts from only a few examples. Mimicking the same behavior on machine learning vision systems is an interesting and very challenging research problem with many practical advantages on real world vision applications. In this context, the goal of our work is to devise a few-shot visual learning system that during test time it will be able to efficiently learn novel categories from only a few training data while at the same time it will not forget the initial categories on which it was trained (here called base categories). To achieve that goal we propose (a) to extend an object recognition system with an attention based few-shot classification weight generator, and (b) to redesign the classifier of a ConvNet model as the cosine similarity function between feature representations and classification weight vectors. The latter, apart from unifying the recognition of both novel and base categories, it also leads to feature representations that generalize better on "unseen" categories. We extensively evaluate our approach on Mini-ImageNet where we manage to improve the prior state-of-the-art on few-shot recognition (i.e., we achieve 56.20% and 73.00% on the 1-shot and 5-shot settings respectively) while at the same time we do not sacrifice any accuracy on the base categories, which is a characteristic that most prior approaches lack. Finally, we apply our approach on the recently introduced few-shot benchmark of Bharath and Girshick [4] where we also achieve state-of-the-art results. The code and models of our paper will be published on: https://github.com/gidariss/FewShotWithoutForgetting

For agents

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

get_harvested_code_for_paper("1804.09458")
get_code_for_paper("1804.09458")
have("1804.09458")

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

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

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

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

Connect an agent — have() is free.