PyTorch helpers (albumentations.pytorch)

Transforms

class albumentations.pytorch.transforms.ToTensor(num_classes=1, sigmoid=True, normalize=None)[source]

Convert image and mask to torch.Tensor and divide by 255 if image or mask are uint8 type. WARNING! Please use this with care and look into sources before usage.

Parameters:
  • num_classes (int) – only for segmentation
  • sigmoid (bool, optional) – only for segmentation, transform mask to LongTensor or not.
  • normalize (dict, optional) – dict with keys [mean, std] to pass it into torchvision.normalize