DLPipelines.ContextType
abstract type Context

Represents a context in which a data transformation is made. This allows using dispatching for varying behavior, for example, to apply augmentations only during training or use non-destructive cropping during inference.

Available contexts are Training, Validation and Inference.

DLPipelines.MethodDatasetType
methoddataset(data, method, context)

Transform data container data of samples into a data container of (x, y)-pairs. Maps encode(method, context, sample) over the observations in data.

DLPipelines.methoddatasetType
methoddataset(data, method, context)

Transform data container data of samples into a data container of (x, y)-pairs. Maps encode(method, context, sample) over the observations in data.

DLPipelines.checkmethodMethod
checkmethod(method, sample, model; device = identity)
checkmethod(method; device = identity)

Check if method conforms to the DLPipelines.jl interfaces. sample and model are used for testing. If you have implemented the testing interface and don't supply these as arguments, mocksample(method) and mockmodel(method) will be used.

Checks core and interpretation interfaces.

DLPipelines.checkmethod_coreMethod
checkmethod_core(method, sample, model; device = identity)
checkmethod_core(method; device = identity)

Check if method conforms to the core interface. sample and model are used for testing. If you have implemented the testing interface and don't supply these as arguments, mocksample(method) and mockmodel(method) will be used.

DLPipelines.checkmethod_interpretationMethod
checkmethod_interpretation(method, sample, model; device = identity)
checkmethod_interpretation(method; device = identity)

Check if method conforms to the core interface. sample and model are used for testing. If you have implemented the testing interface and don't supply these as arguments, mocksample(method) and mockmodel(method) will be used.

DLPipelines.decodeŷFunction
decodeŷ(method, context, ŷ) -> target

Decodes a model output into a target.

DLPipelines.encodeFunction
encode(method, context, sample) -> (x, y)
encode(method, context, (input, target)) -> (x, y)

Encode a sample containing both input and target.

If sample is a Tuple of (input, target), the default behavior is to pass them to encodeinput and encodetarget.

Remarks

  • When should I implement encode vs. encodeinput and encodetarget?

    In simple cases like image classification we can encode the inputs and targets separately and you should prefer encodeinput and encodetarget. The default implementation for encode when given an (input, target)-tuple is to delegate to encodeinput and encodetarget.

    In other cases like semantic segmentation, however, we want to apply stochastic augmentations to both image and segmentation mask. In that case you need to encode both at the same time using encode.

    Another situation where encode is needed is when sample is not a tuple of (input, target), for example a Dict that includes additional information. encode still needs to return an (x, y)-tuple, though.

DLPipelines.encodetargetFunction
encodetarget(task, target; augment = false, inference = false) -> y

Encode target into a representation that a model for task outputs.

DLPipelines.methoddataloadersFunction
methoddataloaders(data, method)
methoddataloaders(traindata, validdata, method[, batchsize; shuffle = true, dlkwargs...])

Create training and validation DataLoaders from two data containers (traindata, valdata). If only one container data is passed, splits it into two with pctgvalid% of the data going into the validation split.

Keyword arguments

  • batchsize = 16
  • shuffle = true: Whether to shuffle the training data container
  • validbsfactor: Factor to multiply batchsize for validation data loader with (validation batches can be larger since no GPU memory is needed for the backward pass)

All remaining keyword arguments are passed to DataLoader.

DLPipelines.methodmodelFunction
methodmodel(method, backbone)

Construct a model for method from a backbone architecture, for example by attaching a method-specific head model.

DLPipelines.predictMethod
predict(method, model, input[; device, context])

Predict a target from input using model. Optionally apply function device to x before passing to model and use context instead of the default context Inference.

DLPipelines.predictbatchMethod
predictbatch(method, model, inputs[; device, context])

Predict targets from a vector of inputs using model by batching them. Optionally apply function device to batch before passing to model and use context instead of the default Inference.

DLPipelines.shouldbatchMethod
shouldbatch(method) = true

Whether models for method take in batches of inputs. Default is true.