mednet.data.typing

Defines most common types used in code.

Module Attributes

Sample

Definition of a sample.

Transform

A callable that transforms tensors into (other) tensors.

TransformSequence

A sequence of transforms.

DatabaseSplit

The definition of a database split.

ConcatDatabaseSplit

The definition of a complex database split composed of several other splits.

DataLoader

Our own augmentation definition of a pytorch DataLoader.

Classes

Dataset()

Our own definition of a pytorch Dataset.

RawDataLoader()

A loader object can load samples from storage.

mednet.data.typing.Sample

Definition of a sample.

First parameter

The actual data that is input to the model

Second parameter

A dictionary containing a named set of meta-data. One the most common is the target entry.

alias of tuple[Mapping[str, Any], Mapping[str, Any]]

class mednet.data.typing.RawDataLoader[source]

Bases: object

A loader object can load samples from storage.

sample(sample)[source]

Load whole samples from media.

Parameters:

sample (Any) – Information about the sample to load. Implementation dependent.

Return type:

tuple[Mapping[str, Any], Mapping[str, Any]]

mednet.data.typing.Transform

A callable that transforms tensors into (other) tensors.

Typically used in data-processing pipelines inside pytorch.

alias of Callable[[Tensor], Tensor]

mednet.data.typing.TransformSequence

A sequence of transforms.

alias of Sequence[Callable[[Tensor], Tensor]]

mednet.data.typing.DatabaseSplit

The definition of a database split.

A database split maps dataset (subset) names to sequences of objects that, through a RawDataLoader, eventually becomes a Sample in the processing pipeline.

alias of Mapping[str, Sequence[Any]]

mednet.data.typing.ConcatDatabaseSplit

The definition of a complex database split composed of several other splits.

A database split maps dataset (subset) names to sequences of objects that, through a RawDataLoader, eventually becomes a Sample in the processing pipeline. Objects of this subtype allow the construction of complex splits composed of cannibalized parts of other splits. Each split may be assigned a different RawDataLoader.

alias of Mapping[str, Sequence[tuple[Sequence[Any], RawDataLoader]]]

class mednet.data.typing.Dataset[source]

Bases: Dataset[tuple[Mapping[str, Any], Mapping[str, Any]]], Iterable, Sized

Our own definition of a pytorch Dataset.

We iterate over Sample objects in this case. Our datasets always provide a dunder len method.

targets()[source]

Return the integer targets for all samples in the dataset.

Return type:

list[int | list[int]]

mednet.data.typing.DataLoader[source]

Our own augmentation definition of a pytorch DataLoader.

We iterate over Sample objects in this case.

alias of DataLoader[tuple[Mapping[str, Any], Mapping[str, Any]]]