Engine.loader

Engine.loader(
    model,
    split,
    *,
    augmented=False,
    shuffle=False,
    only_images=False,
    for_loss=True,
)

A torch DataLoader over one split, wrapping dataset.

Parameters

Name Type Description Default
model SegmentationModel Which model’s settings to read - input_shape, batch_size and the augmentation all come from here. required
split str "train", "validation" or "test". required
augmented bool Apply the model’s augmentation. Training only: validation is read the same way every epoch, or two epochs measure different things. False
shuffle bool Shuffle between epochs. Training only, for the same reason. False
only_images bool Read images alone, with no targets. False
for_loss bool Whether these batches are going to the loss. When they are and the loss asks for one, each batch carries a third item: the signed distance map for boundary, or the foreground mask for a regression loss scoring the foreground. Both are computed in the loader’s workers rather than in the loss - the distance transform costs more than an epoch of a small 3D model - and the paths that only score or predict should not pay for either. True

Returns

Name Type Description
A torch.utils.data.DataLoader. Batches hold two items, or three when the
loss asked the loader for something.