.FastAIBlock

abstract type defined in module FastAI


			abstract type Block

A block describes the meaning of a piece of data in the context of a learning task. For example, for supervised learning tasks, there is an input and a target and we want to learn to predict targets from inputs. Learning to predict a cat/dog label from 2D images is a supervised image classification task that can be represented with the Blocks Image{2}() and Label(["cat", "dog"]).

Blocks are used in virtually every part of the high-level interfaces, from data processing over model creation to visualization.

Extending

Consider the following when subtyping Block. A block

  • Does not hold observation data itself. Instead they are used in conjunction with data to annotate it with some meaning.

  • If it has any fields, they should be metadata that cannot be derived from the data itself and is constant for every sample in the dataset. For example Label holds all possible classes which are constant for the learning problem.

Interfaces

There are many interfaces that can be implemented for a Block. See the docstrings of each function for more info about how to implement it.

  • checkblock (block, obs): check whether an observation is a valid block

  • mockblock (block): randomly generate an observation

  • blocklossfn (predblock, yblock): loss function for comparing two blocks

  • blockmodel (inblock, outblock[, backbone]): construct a task-specific model

  • blockbackbone (inblock): construct a backbone model that takes in specific data

  • showblock! (block, obs): visualize an observation