mednet.models.normalizer

Functions to compute normalisation factors based on dataloaders.

Functions

make_cocov1_normalizer()

Return the stock COCO v1 normalisation weights from torchvision.

make_imagenet_normalizer()

Return the stock ImageNet normalisation weights from torchvision.

make_z_normalizer(dataloader)

Compute mean and standard deviation from a dataloader.

mednet.models.normalizer.make_z_normalizer(dataloader)[source]

Compute mean and standard deviation from a dataloader.

This function will input a dataloader, and compute the mean and standard deviation by image channel. It will work for both monochromatic, and color inputs with 2, 3 or more color planes.

Parameters:

dataloader (DataLoader) – A torch Dataloader from which to compute the mean and std.

Return type:

Normalize

Returns:

An initialized normalizer.

mednet.models.normalizer.make_imagenet_normalizer()[source]

Return the stock ImageNet normalisation weights from torchvision.

The weights are wrapped in a torch module. This normalizer only works for RGB (color) images.

Return type:

Normalize

Returns:

An initialized normalizer.

mednet.models.normalizer.make_cocov1_normalizer()[source]

Return the stock COCO v1 normalisation weights from torchvision.

The weights are wrapped in a torch module. This normalizer only works for RGB (color) images.

Return type:

Normalize

Returns:

An initialized normalizer.