CLI train

The help documentation is available in the terminal from:

peerannot train --help

All computer vision models that can be used for training are available through the Torchvision library and can be found running:

peerannot modelinfo --help

peerannot train

Train a classification neural network given a dataset path, an output name and the number of classes

peerannot train [OPTIONS] [DATAPATH]

Options

-o, --output-name <output_name>

Name of the generated results file

-K, --n-classes <n_classes>

Number of classes to separate

--labels <labels>

Path to file of labels

-optim, --optimizer <optimizer>

Optimizer for the neural network

--model <model>

Name of neural network to use. The list is available at peerannot modelinfo

--metadata_path <metadata_path>

Path to the metadata of the dataset if different than default

--img-size <img_size>

Size of image (square)

--data-augmentation

Perform data augmentation on training set with a random choice between RandomAffine(shear=15), RandomHorizontalFlip(0.5) and RandomResizedCrop

Default:

False

--path-remove <path_remove>

Path to file of index to prune from the training set

--pretrained

Use torch available weights to initialize the network

Default:

False

--n-epochs <n_epochs>

Number of training epochs

--lr <lr>

Learning rate

--momentum <momentum>

Momentum for the optimizer

--decay <decay>

Weight decay for the optimizer

--scheduler <scheduler>

Use a multistepscheduler for the learning rate by default. To use the cosine annealing use the keyword ‘cosine’

Default:

'multistep'

-m, --milestones <milestones>

Milestones for the learning rate decay scheduler

--n-params <n_params>

Number of parameters for the logistic regression only

--lr-decay <lr_decay>

Learning rate decay for the scheduler

--num-workers <num_workers>

Number of workers

--batch-size <batch_size>

Batch size

--freeze

Freeze all layers of the network except for the last one

Default:

False

--seed <seed>

random state

Arguments

DATAPATH

Optional argument