allenact.embodiedai.sensors.vision_sensors
#
VisionSensor
#
class VisionSensor(Sensor[EnvType, SubTaskType])
VisionSensor.__init__
#
| __init__(mean: Optional[np.ndarray] = None, stdev: Optional[np.ndarray] = None, height: Optional[int] = None, width: Optional[int] = None, uuid: str = "vision", output_shape: Optional[Tuple[int, ...]] = None, output_channels: Optional[int] = None, unnormalized_infimum: float = -np.inf, unnormalized_supremum: float = np.inf, scale_first: bool = True, **kwargs: Any)
Initializer.
Parameters
- mean : The images will be normalized with the given mean
- stdev : The images will be normalized with the given standard deviations.
- height : If it's a non-negative integer and
width
is also non-negative integer, the image returned from the environment will be rescaled to haveheight
rows andwidth
columns using bilinear sampling. - width : If it's a non-negative integer and
height
is also non-negative integer, the image returned from the environment will be rescaled to haveheight
rows andwidth
columns using bilinear sampling. - uuid : The universally unique identifier for the sensor.
- output_shape : Optional observation space shape (alternative to
output_channels
). - output_channels : Optional observation space number of channels (alternative to
output_shape
). - unnormalized_infimum : Lower limit(s) for the observation space range.
- unnormalized_supremum : Upper limit(s) for the observation space range.
- scale_first : Whether to scale image before normalization (if needed).
- kwargs : Extra kwargs. Currently unused.
VisionSensor.height
#
| @property
| height() -> Optional[int]
Height that input image will be rescale to have.
Returns
The height as a non-negative integer or None
if no rescaling is done.
VisionSensor.width
#
| @property
| width() -> Optional[int]
Width that input image will be rescale to have.
Returns
The width as a non-negative integer or None
if no rescaling is done.
RGBSensor
#
class RGBSensor(VisionSensor[EnvType, SubTaskType], ABC)
RGBSensor.__init__
#
| __init__(use_resnet_normalization: bool = False, mean: Optional[Union[np.ndarray, Sequence[float]]] = (0.485, 0.456, 0.406), stdev: Optional[Union[np.ndarray, Sequence[float]]] = (0.229, 0.224, 0.225), height: Optional[int] = None, width: Optional[int] = None, uuid: str = "rgb", output_shape: Optional[Tuple[int, ...]] = None, output_channels: int = 3, unnormalized_infimum: float = 0.0, unnormalized_supremum: float = 1.0, scale_first: bool = True, **kwargs: Any)
Initializer.
Parameters
- use_resnet_normalization : Whether to apply image normalization with the given
mean
andstdev
. - mean : The images will be normalized with the given mean if
use_resnet_normalization
is True (default[0.485, 0.456, 0.406]
, i.e. the standard resnet normalization mean). - stdev : The images will be normalized with the given standard deviation if
use_resnet_normalization
is True (default[0.229, 0.224, 0.225]
, i.e. the standard resnet normalization standard deviation). - height: If it's a non-negative integer and
width
is also non-negative integer, the image returned from the environment will be rescaled to haveheight
rows andwidth
columns using bilinear sampling. - width: If it's a non-negative integer and
height
is also non-negative integer, the image returned from the environment will be rescaled to haveheight
rows andwidth
columns using bilinear sampling. - uuid: The universally unique identifier for the sensor.
- output_shape: Optional observation space shape (alternative to
output_channels
). - output_channels: Optional observation space number of channels (alternative to
output_shape
). - unnormalized_infimum: Lower limit(s) for the observation space range.
- unnormalized_supremum: Upper limit(s) for the observation space range.
- scale_first: Whether to scale image before normalization (if needed).
- kwargs : Extra kwargs. Currently unused.
DepthSensor
#
class DepthSensor(VisionSensor[EnvType, SubTaskType], ABC)
DepthSensor.__init__
#
| __init__(use_normalization: bool = False, mean: Optional[Union[np.ndarray, float]] = 0.5, stdev: Optional[Union[np.ndarray, float]] = 0.25, height: Optional[int] = None, width: Optional[int] = None, uuid: str = "depth", output_shape: Optional[Tuple[int, ...]] = None, output_channels: int = 1, unnormalized_infimum: float = 0.0, unnormalized_supremum: float = 5.0, scale_first: bool = True, **kwargs: Any)
Initializer.
Parameters
- config : If
config["use_normalization"]
isTrue
then the depth images will be normalized with mean 0.5 and standard deviation 0.25. If bothconfig["height"]
andconfig["width"]
are non-negative integers then the depth image returned from the environment will be rescaled to have shape (config["height"], config["width"]) using bilinear sampling. - use_normalization : Whether to apply image normalization with the given
mean
andstdev
. - mean : The images will be normalized with the given mean if
use_normalization
is True (default 0.5). - stdev : The images will be normalized with the given standard deviation if
use_normalization
is True (default 0.25). - height: If it's a non-negative integer and
width
is also non-negative integer, the image returned from the environment will be rescaled to haveheight
rows andwidth
columns using bilinear sampling. - width: If it's a non-negative integer and
height
is also non-negative integer, the image returned from the environment will be rescaled to haveheight
rows andwidth
columns using bilinear sampling. - uuid: The universally unique identifier for the sensor.
- output_shape: Optional observation space shape (alternative to
output_channels
). - output_channels: Optional observation space number of channels (alternative to
output_shape
). - unnormalized_infimum: Lower limit(s) for the observation space range.
- unnormalized_supremum: Upper limit(s) for the observation space range.
- scale_first: Whether to scale image before normalization (if needed).
- kwargs : Extra kwargs. Currently unused.