Skip to content

RenderImagesWrapper

Full path: schola.sb3.utils.RenderImagesWrapper

schola.sb3.utils.RenderImagesWrapper

RenderImagesWrapper

RenderImagesWrapper(venv)

Bases: VecEnvWrapper

Renders image observations to an interactive matplotlib window. It assumes that the observations are square RGB images, and attempts to reshape any box observation to 3xLxL.

Parameters

venv (VecEnv) : The vectorized environment being wrapped.

Methods

ItemDescription
init
close
convert_to_plt_formatConvert to a format supported by matplotlib.
reset
step
step_async
step_wait
update_imagesUpdates the images in the plt window with the given observations.

init

__init__(venv)

Parameters

venv (VecEnv)


close

close()

convert_to_plt_format

convert_to_plt_format(obs)

Convert to a format supported by matplotlib. (e.g. (W,H), (W,H,3), and (W,H,4)). No Chanels or Chanels last, from Chanels first.

Parameters

obs (np.ndarray) : The observation to convert.

Returns

The converted observation.

Return type: np.ndarray


reset

reset()

Returns

VecEnvObs


step

step(action)

Parameters

action (ndarray)

Returns

Tuple[VecEnvObs, ndarray, ndarray, List[Dict]]


step_async

step_async(actions)

Parameters

actions (ndarray)

Returns

None


step_wait

step_wait()

Returns

Tuple[VecEnvObs, ndarray, ndarray, List[Dict]]


update_images

update_images(obs)

Updates the images in the plt window with the given observations.

Parameters

obs (Dict[str,np.ndarray]) : Maps the names of the observations to the observation data.

Returns

The original observation.

Return type: Dict[str,np.ndarray]