yamle.data.transforms module#
- class yamle.data.transforms.JointCompose(transforms)[source]#
Bases:
ComposeThis class is a wrapper for the torchvision Compose class, which applies transformations to both the data and the target.
- Parameters:
transforms¶ (List[Callable]) – List of transformations to apply to the data and the target.
- class yamle.data.transforms.FromOneHot[source]#
Bases:
objectThis class converts one-hot encoded targets to class labels.
- class yamle.data.transforms.JointResize(height, width)[source]#
Bases:
objectPerform resizing if the input is larger or smaller than the limiting height/width.
The input is interpolated using the bilinear interpolation method. The target is interpolated using the nearest neighbour interpolation method.
- class yamle.data.transforms.JointCenterCrop(height, width)[source]#
Bases:
objectPerform center cropping if the input is larger than the limiting height/width.
- class yamle.data.transforms.JointNormalize(mean, std)[source]#
Bases:
objectPerform normalization on the input and leave the target unchanged.
- class yamle.data.transforms.JointToTensor(img_dtype=torch.float32, target_dtype=torch.int64)[source]#
Bases:
objectConvert the input and target to tensors.
- class yamle.data.transforms.JointTargetSqueeze(dim)[source]#
Bases:
objectSqueeze the target tensor.
- Parameters:
dim¶ (int) – The dimension to squeeze.
- class yamle.data.transforms.TargetToUnit(scale=1.0)[source]#
Bases:
objectConverts the target image to meters.
- Parameters:
scale¶ (float) – Scale factor to convert the target image.
- class yamle.data.transforms.ClassificationDatasetSubset(dataset, indices)[source]#
Bases:
objectThis class takes a subset of a dataset specified by a list of indices corresponding to the subset of the classes.
It creates a Subset object from the torch.utils.data package. It goes through the entire dataset and checks which indices correspond to the subset of the classes. It then creates a list of indices corresponding to the subset. Finally, it creates a Subset object from the dataset and the list of indices.