API

class geosynth.GeoSynth(path: Union[str, pathlib.Path] = PosixPath('~/data/geosynth'), variant: str = 'full')
__getitem__(index)

Get exemplar at index.

Parameters

index (int) -- Index to get scene at.

Returns

Scene at index

Return type

Scene

__len__()

Return the number of exemplars in the dataset.

class geosynth.Scene(path: Union[str, pathlib.Path])

Container for datatype readers for a single exemplar.

cube_environment_map: <CubeEnvironmentMap: []>
depth: <Depth: []>
extrinsics: <Extrinsics: []>
gravity: <Gravity: []>
hdr_cube_environment_map: <HdrCubeEnvironmentMap: []>
hdr_reflectance: <HdrReflectance: []>
hdr_residual: <HdrResidual: []>
hdr_rgb: <HdrRgb: []>
hdr_shading: <HdrShading: []>
hdr_sphere_environment_map: <HdrSphereEnvironmentMap: []>
instance_segmentation: <InstanceSegmentation: []>
intrinsics: <Intrinsics: []>
layout_lines_full: <LayoutLinesFull: []>
layout_lines_occluded: <LayoutLinesOccluded: []>
layout_lines_visible: <LayoutLinesVisible: []>
lighting: <Lighting: []>
normals: <Normals: []>
reflectance: <Reflectance: []>
residual: <Residual: []>
rgb: <Rgb: []>
semantic_segmentation: <SemanticSegmentation: []>
shading: <Shading: []>
sphere_environment_map: <SphereEnvironmentMap: []>
geosynth.download(dst: Optional[Union[str, pathlib.Path]] = None, dtypes: Optional[Iterable[str]] = None, variant: str = 'demo', force: bool = False, cleanup: bool = True, progress: Optional[rich.progress.Progress] = None) pathlib.Path

Download the GeoSynth dataset.

Parameters
  • dst (PathLike) -- If None, downloads to default location ~/data/geosynth.

  • dtype (Iterable) --

    List of data types to download. For example:

    ["rgb", "depth"]
    

    Defaults to downloading all non-hdr datatypes.

  • variant (str) -- Variant of the GeoSynth dataset to download.

  • force (bool) -- Force a redownload, despite cached files. Defaults to False.

  • cleanup (bool) -- Delete downloaded zipfile(s) after downloading & unzipping. Defaults to True.

  • progress (Optional[rich.progress.Progress]) -- Optional Rich Progress object to update with progress.

Returns

dst -- The destination download directory.

Return type

Path

geosynth.instance_bbox(mask: numpy.ndarray) numpy.ndarray

Compute the normalized inclusive bounding box for a binary mask.

Parameters

mask (numpy.ndarray) -- (H, W) binary mask.

Returns

A numpy array of shape (4) representing [top_left_x, top_left_y, bottom_right_x, bottom_right_y]. All values are in range [0, 1]. If there are no True pixels, then all values are nan.

Return type

numpy.ndarray

geosynth.instance_segmentation_bboxes(instances_dict: Dict[str, numpy.ndarray]) Dict[str, numpy.ndarray]

Compute all bounding boxes for an instance segmentation dictionary.

Parameters

instances_dict (Dict[str, np.ndarray]) -- Instances mapping string labels to (N, H, W) binary masks.

Returns

Dictionary with same keys as instances_dict, but each value is an (N, 4) array where each row represents the normalized coordinates [top_left_x, top_left_y, bottom_right_x, bottom_right_y].

Return type

Dict[str, np.ndarray]