Augmentations
-
packnet_sfm.datasets.augmentations.
colorjitter_sample
(sample, parameters, prob=1.0)[source] Jitters input images as data augmentation.
- Parameters
sample (dict) – Input sample
parameters (tuple (brightness, contrast, saturation, hue)) – Color jittering parameters
prob (float) – Jittering probability
- Returns
sample – Jittered sample
- Return type
dict
-
packnet_sfm.datasets.augmentations.
duplicate_sample
(sample)[source] Duplicates sample images and contexts to preserve their unaugmented versions.
- Parameters
sample (dict) – Input sample
- Returns
sample – Sample including [+”_original”] keys with copies of images and contexts.
- Return type
dict
-
packnet_sfm.datasets.augmentations.
resize_depth
(depth, shape)[source] Resizes depth map.
- Parameters
depth (np.array [h,w]) – Depth map
shape (tuple (H,W)) – Output shape
- Returns
depth – Resized depth map
- Return type
np.array [H,W]
-
packnet_sfm.datasets.augmentations.
resize_image
(image, shape, interpolation=1)[source] Resizes input image.
- Parameters
image (Image.PIL) – Input image
shape (tuple [H,W]) – Output shape
interpolation (int) – Interpolation mode
- Returns
image – Resized image
- Return type
Image.PIL
-
packnet_sfm.datasets.augmentations.
resize_sample
(sample, shape, image_interpolation=1)[source] Resizes a sample, including image, intrinsics and depth maps.
- Parameters
sample (dict) – Dictionary with sample values
shape (tuple (H,W)) – Output shape
image_interpolation (int) – Interpolation mode
- Returns
sample – Resized sample
- Return type
dict
-
packnet_sfm.datasets.augmentations.
resize_sample_image_and_intrinsics
(sample, shape, image_interpolation=1)[source] Resizes the image and intrinsics of a sample
- Parameters
sample (dict) – Dictionary with sample values
shape (tuple (H,W)) – Output shape
image_interpolation (int) – Interpolation mode
- Returns
sample – Resized sample
- Return type
dict
-
packnet_sfm.datasets.augmentations.
to_tensor
(image, tensor_type='torch.FloatTensor')[source] Casts an image to a torch.Tensor
-
packnet_sfm.datasets.augmentations.
to_tensor_sample
(sample, tensor_type='torch.FloatTensor')[source] Casts the keys of sample to tensors.
- Parameters
sample (dict) – Input sample
tensor_type (str) – Type of tensor we are casting to
- Returns
sample – Sample with keys cast as tensors
- Return type
dict