https://github.com/aaltoml/flatfsl

Code for "Flatness Improves Backbone Generalisation in Few-shot Classification", WACV 2025.

https://github.com/aaltoml/flatfsl

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.3%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Code for "Flatness Improves Backbone Generalisation in Few-shot Classification", WACV 2025.

Basic Info
  • Host: GitHub
  • Owner: AaltoML
  • License: mit
  • Language: Python
  • Default Branch: main
  • Size: 229 KB
Statistics
  • Stars: 1
  • Watchers: 3
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created over 1 year ago · Last pushed over 1 year ago
Metadata Files
Readme License

README.md

Flatness Improves Backbone Generalisation in Few-shot Classification

A reference implementation for the methods in the following paper:

Rui Li, Martin Trapp, Marcus Klasson, and Arno Solin (2025). Flatness Improves Backbone Generalisation in Few-shot Classification. In Winter Conference on Applications of Computer Vision (WACV).

We introduce a simple yet effective training protocol for the backbone in few-shot classification. We show that flatness-aware backbone training combined with vanilla fine-tuning results in a simpler yet competitive baseline compared to the state-of-the-art. We present theoretical and empirical results indicating that careful backbone training is crucial in FSC.

bar plot Average test accuracy on the Meta-Dataset benchmark for different backbone training under the same adaptation: empirical risk minimisation (ERM) without information fusion, with fine-tuning, or with knowledge distillation; sharpness-aware minimisation (SAM) without information fusion or with fine-tuning.

Dependencies

This code requires the following: * PyTorch 1.13.1 * TensorFlow 2.8.1

Usage

  • Clone or download this repository.
  • Setup Meta-Dataset:
    • Follow the the "User instructions" in the Meta-Dataset repository for "Installation" and "Downloading and converting datasets".
  • After setting up Meta-Dataset, backbone can be trained with SAM using train_vanilla_sam.py
    • Change line 54 to load MetaDatasetEpisodeReader, MetaDatasetBatchReader.
  • To select backbone for evaluation, run select_backbone.py.
    • Save the trained backbones in saved_model/sam/{dataset}.pth or change line 22.
    • Change line 12 to load MetaDatasetEpisodeReader.

Acknowledgements

We thank authors of Meta-Dataset, PARC, SAM and SUR for their source code.

License

This software is provided under the MIT license. See the accompanying LICENSE file for details.

Owner

  • Name: AaltoML
  • Login: AaltoML
  • Kind: organization
  • Location: Finland

Machine learning group at Aalto University lead by Prof. Solin

GitHub Events

Total
  • Watch event: 1
  • Member event: 1
  • Push event: 2
  • Create event: 1
Last Year
  • Watch event: 1
  • Member event: 1
  • Push event: 2
  • Create event: 1