habitat.core.utils module

A module providing some disconnected core utilities.

Classes

class DatasetFloatJSONEncoder
JSON Encoder that sets a float precision for a space saving purpose and encodes ndarray and quaternion. The encoder is compatible with JSON version 2.0.9.
class DatasetJSONEncoder
Extension of base JSONEncoder to handle common Dataset types: numpy array, numpy quaternion, Omegaconf, and dataclass.
class Singleton
This metatclass creates Singleton objects by ensuring only one instance is created and any call is directed to that instance. The mro() function and following dunders, EXCEPT __call__, are inherited from the the stdlib Python library, which defines the “type” class.

Functions

def not_none_validator(self: typing.Any, attribute: attr._make.Attribute, value: typing.Optional[typing.Any]) -> None
Attr validator to raise a ValueError if a particular attribute’s value is None.
def tile_images(images: typing.List[numpy.ndarray]) -> numpy.ndarray
Tile multiple images into single image

Function documentation

def habitat.core.utils.not_none_validator(self: typing.Any, attribute: attr._make.Attribute, value: typing.Optional[typing.Any]) -> None

Attr validator to raise a ValueError if a particular attribute’s value is None.

Parameters
self The calling attrs class instance.
attribute The attribute to check in order to provide a precise error message.
value The value to check.

See https://www.attrs.org/en/stable/examples.html#validators

def habitat.core.utils.tile_images(images: typing.List[numpy.ndarray]) -> numpy.ndarray

Tile multiple images into single image

NOTE: “candidate for deprecation”: possible duplicate function at habitat-lab/habitat/utils/visualizations/utils.py

param images:
list of images where each image has dimension (height x width x channels)
return:
tiled image (new_height x width x channels)