imitation.util.video_wrapper#

Wrapper to record rendered video frames from an environment.

Classes

VideoWrapper(env, directory[, single_video])

Creates videos from wrapped environment by calling render after each timestep.

class imitation.util.video_wrapper.VideoWrapper(env, directory, single_video=True)[source]#

Bases: Wrapper

Creates videos from wrapped environment by calling render after each timestep.

__init__(env, directory, single_video=True)[source]#

Builds a VideoWrapper.

Parameters
  • env (Env) – the wrapped environment.

  • directory (Path) – the output directory.

  • single_video (bool) – if True, generates a single video file, with episodes concatenated. If False, a new video file is created for each episode. Usually a single video file is what is desired. However, if one is searching for an interesting episode (perhaps by looking at the metadata), then saving to different files can be useful.

close()[source]#

Closes the wrapper and env.

Return type

None

directory: Path#
episode_id: int#
reset(*, seed=None, options=None)[source]#

Uses the reset() of the env that can be overwritten to change the returned data.

Return type

Tuple[TypeVar(WrapperObsType), Dict[str, Any]]

single_video: bool#
step(action)[source]#

Uses the step() of the env that can be overwritten to change the returned data.

Return type

Tuple[TypeVar(WrapperObsType), SupportsFloat, bool, bool, Dict[str, Any]]

video_recorder: Optional[VideoRecorder]#