olympus.tasks.segmentation module

class olympus.tasks.segmentation.Segmentation(classifier, optimizer, lr_scheduler, dataloader, criterion, nclasses, device=None, storage=None, preprocessor=None, metrics=None)[source]

Bases: olympus.tasks.task.Task

Train a model to recognize a range of classes

Attributes:
classifier: Module

Module taking sample image and returning the probability of each pixel belonging to a range of classes

optimizer: Optimizer

Optimizer taking model’s parameters

criterion: Module

Function evaluating the quality of the model’s predictions, also named cost function or loss function

lr_scheduler: LRSchedule

Learning Scheduler, updates the learning rates periodically

dataloader: Iterator

Batch sample iterator used to train the model

preprocessor: Preprocessor

Set of functions that transform the inputs before it is given to the model

device:

Acceleration device to run the task on

storage: Storage

Where to save checkpoints in case of failures

Methods

eval_loss(batch) This is used to compute validation and test loss
fit(epochs[, context]) Execute a single batch
get_current_space() Get currently defined parameter space
get_space() Return hyper parameter space
init([optimizer, lr_schedule, model, uid])
Parameters:
load_state_dict(state[, strict]) Try to load a previous unfinished state to resume
state_dict([destination, prefix, keep_vars]) Save a state the task can go back to if an error occur
confusion_matrix  
epoch  
parameters  
predict  
predict_log_probabilities  
predict_scores  
report  
resumed  
set_device  
step  
summary  
confusion_matrix(batch, target)[source]
epoch(epoch, context)[source]
eval_loss(batch)[source]

This is used to compute validation and test loss

fit(epochs, context=None)[source]

Execute a single batch

Parameters:
epoch: int

current step in the training process

context: dict

Optional Context

Notes

You should wrap whatever code you have here inside a BadResumeGuard to prevent users from resuming a failed task that can have a bad states

To resume a task, you need to create a clean one with the same hyper parameters. It will pickup automatically where at its last checkpoint

get_current_space()[source]

Get currently defined parameter space

get_space()[source]

Return hyper parameter space

init(optimizer=None, lr_schedule=None, model=None, uid=None)[source]
Parameters:
optimizer: Dict

Optimizer hyper parameters!s

lr_shchedule: Dict

lr schedule hyper parameters

model: Dict

model hyper parameters

trial_id: Optional[str]

trial id to use for logging. When using orion usually it already created a trial for us we just need to append to it

load_state_dict(state, strict=True)[source]

Try to load a previous unfinished state to resume

Notes

You should wrap whatever code you have here inside a BadResumeGuard to prevent users from resuming a failed task that can have a bad states

To resume a task, you need to create a clean one with the same hyper parameters. It will pickup automatically where at its last checkpoint

model
parameters()[source]
predict(batch, target=None)[source]
predict_log_probabilities(batch)[source]
predict_scores(batch)[source]
state_dict(destination=None, prefix='', keep_vars=False)[source]

Save a state the task can go back to if an error occur

step(step, input, context)[source]