mmlearn.datasets.sunrgbd

SUN RGB-D dataset.

Functions

convert_depth_to_disparity(depth_file, intrinsics_file, sensor_type, min_depth=0.01, max_depth=50)[source]

Load depth file and convert to disparity.

Parameters:
  • depth_file (str) – Path to the depth file.

  • intrinsics_file (str) – Intrinsics_file is a txt file supplied in SUNRGBD with sensor information Can be found at the path: os.path.join(root_dir, room_name, “intrinsics.txt”)

  • sensor_type (str) – Sensor type of the depth file.

  • min_depth (float, default=0.01) – Minimum depth value to clip the depth image.

  • max_depth (int, default=50) – Maximum depth value to clip the depth image.

Returns:

Disparity image from the depth image following the ImageBind implementation.

Return type:

torch.Tensor

Classes

SUNRGBDDataset

SUN RGB-D dataset.

class SUNRGBDDataset(root_dir, split='train', return_type='disparity', rgb_transform=None, depth_transform=None)[source]

SUN RGB-D dataset.

Parameters:
  • root_dir (str) – Path to the root directory of the dataset.

  • split ({"train", "test"}, default="train") – Split of the dataset to use.

  • return_type ({"disparity", "image"}, default="disparity") – Return type of the depth images. If “disparity”, the depth images are converted to disparity similar to the ImageBind implementation. Otherwise, return the depth image as a 3-channel image.

  • rgb_transform (Callable[[PIL.Image], torch.Tensor], default=None) – A callable that takes in an RGB PIL image and returns a transformed version of the image as a PyTorch tensor.

  • depth_transform (Callable[[PIL.Image], torch.Tensor], default=None) – A callable that takes in a depth PIL image and returns a transformed version of the image as a PyTorch tensor.

References

__getitem__(idx)[source]

Return RGB and depth images at index idx.

Return type:

Example

__len__()[source]

Return the length of the dataset.

Return type:

int

convert_depth_to_disparity(depth_file, intrinsics_file, sensor_type, min_depth=0.01, max_depth=50)[source]

Load depth file and convert to disparity.

Parameters:
  • depth_file (str) – Path to the depth file.

  • intrinsics_file (str) – Intrinsics_file is a txt file supplied in SUNRGBD with sensor information Can be found at the path: os.path.join(root_dir, room_name, “intrinsics.txt”)

  • sensor_type (str) – Sensor type of the depth file.

  • min_depth (float, default=0.01) – Minimum depth value to clip the depth image.

  • max_depth (int, default=50) – Maximum depth value to clip the depth image.

Returns:

Disparity image from the depth image following the ImageBind implementation.

Return type:

torch.Tensor