GrayScaleObservation
- class GrayScaleObservation(env, keep_dim=True, key='img')[source]
Bases:
ObservationWrapper
Convert the image observation from RGB to gray scale.
Mostly the same as the open ai gym implementation except this allows for the wrapper to be applied to a single element inside a Dict observation.
- __init__(env, keep_dim=True, key='img')[source]
Initialze an object.
- Parameters:
env (gym environment) – Environment to wrap.
keep_dim (bool, optional) – Flag indicating if the channel dimension should be kept. The default is True.
key (string, optional) – Key in teh dictionary corresponding to the image. The default is ‘img’.
Methods
Initialze an object.
Returns the class name of the wrapper.
Closes the environment.
Generates the proper observation.
render
Resets the environment, returning a modified observation using
self.observation()
.Seeds the environment.
Returns a modified observation using
self.observation()
after callingenv.step()
.Attributes
Returns the action space of the environment.
Returns the environment metadata.
Returns the environment np_random.
Returns the observation space of the environment.
Returns the environment render_mode.
Return the reward range of the environment.
Returns the environment specification.
Returns the base environment of the wrapper.
- classmethod class_name()
Returns the class name of the wrapper.
- close()
Closes the environment.
- reset(**kwargs)
Resets the environment, returning a modified observation using
self.observation()
.
- seed(seed=None)
Seeds the environment.
- step(action)
Returns a modified observation using
self.observation()
after callingenv.step()
.
- property action_space: Space[ActType]
Returns the action space of the environment.
- property metadata: dict
Returns the environment metadata.
- property np_random: RandomNumberGenerator
Returns the environment np_random.
- property observation_space: Space
Returns the observation space of the environment.
- property render_mode: str | None
Returns the environment render_mode.
- property reward_range: Tuple[SupportsFloat, SupportsFloat]
Return the reward range of the environment.
- property spec
Returns the environment specification.
- property unwrapped: Env
Returns the base environment of the wrapper.