template.runner.process_activation package¶
Submodules¶
template.runner.process_activation.activation module¶
-
class
template.runner.process_activation.activation.
Activation
(log_folder, model_name, dataset, process_size, save_cover, no_cuda)[source]¶ Bases:
object
-
add_epoch
(epoch_number, epoch_accuracy, model)[source]¶ This method collect, compute and save all activation data (and mean activation data) from a given epoch
- Parameters
epoch_number (int) – Epoch number of the processing.
epoch_accuracy (int) – Epoch accuracy retrived by the last training.
model (Torch.nn.model) – PyTorch model trained.
- Returns
- Return type
-
template.runner.process_activation.evaluate module¶
template.runner.process_activation.process_activation module¶
This file is the template for the boilerplate of train/test of a DNN for image classification
There are a lot of parameter which can be specified to modify the behaviour and they should be used instead of hard-coding stuff.
template.runner.process_activation.train module¶
-
template.runner.process_activation.train.
train
(train_loader, model, criterion, optimizer, writer, epoch, no_cuda=False, log_interval=25, **kwargs)[source]¶ Training routine
- Parameters
train_loader (torch.utils.data.DataLoader) – The dataloader of the train set.
model (torch.nn.module) – The network model being used.
criterion (torch.nn.loss) – The loss function used to compute the loss of the model.
optimizer (torch.optim) – The optimizer used to perform the weight update.
writer (tensorboardX.writer.SummaryWriter) – The tensorboard writer object. Used to log values on file for the tensorboard visualization.
epoch (int) – Number of the epoch (for logging purposes).
no_cuda (boolean) – Specifies whether the GPU should be used or not. A value of ‘True’ means the CPU will be used.
log_interval (int) – Interval limiting the logging of mini-batches. Default value of 10.
- Returns
top1.avg – Accuracy of the model of the evaluated split
- Return type
-
template.runner.process_activation.train.
train_one_mini_batch
(model, criterion, optimizer, input_var, target_var, loss_meter, acc_meter)[source]¶ This routing train the model passed as parameter for one mini-batch
- Parameters
model (torch.nn.module) – The network model being used.
criterion (torch.nn.loss) – The loss function used to compute the loss of the model.
optimizer (torch.optim) – The optimizer used to perform the weight update.
input_var (torch.autograd.Variable) – The input data for the mini-batch
target_var (torch.autograd.Variable) – The target data (labels) for the mini-batch
loss_meter (AverageMeter) – Tracker for the overall loss
acc_meter (AverageMeter) – Tracker for the overall accuracy
- Returns
acc (float) – Accuracy for this mini-batch
loss (float) – Loss for this mini-batch