This section provides a tutorial on building a working environment for LibFewShot from scratch.

Get the LibFewShot library

Use the following command to get LibFewShot:

cd ~
git clone

Configure the LibFewShot environment

The environment can be configured in any of the following ways:

  1. conda(recommend)

    cd <path-to-LibFewShot> # cd in `LibFewShot` directory
    conda env create -f requirements.yaml
  2. pip

    cd <path-to-LibFewShot> # cd in `LibFewShot` directory
    pip install -r requirements.txt
  3. or whatever works for you as long as the following package version conditions are meet:

    numpy >= 1.19.5
    pandas >= 1.1.5
    Pillow >= 8.1.2
    PyYAML >= 5.4.1
    scikit-learn >= 0.24.1
    scipy >= 1.5.4
    tensorboard >= 2.4.1
    torch >= 1.5.0
    torchvision >= 0.6.0
    python >= 3.6.0

Test the installation

  1. modify

    # -*- coding: utf-8 -*-
    import sys
    sys.dont_write_bytecode = True
    from core.config import Config
    from core import Trainer
    if __name__ == "__main__":
        config = Config("./config/test_install.yaml").get_config_dict()
        trainer = Trainer(config)
  2. modify data_root in config/headers/data.yaml to the path of the dataset to be used.

  3. run code

  4. If the first output is correct, it means that LibFewShot has been successfully installed.


For model training and code modification, please see the train/test methods already integrated in LibFewShot and other sections of the tutorial.