The OCAtari Environments
- class ocatari.core.OCAtari(env_name, mode='ram', hud=False, obs_mode='ori', render_mode=None, render_oc_overlay=False, *args, **kwargs)[source]
The OCAtari environment. Initialize it to get a Atari environments with objects tracked.
- Parameters:
env_name (str) – The name of the Atari gymnasium environment e.g. “Pong” or “PongNoFrameskip-v5”
mode (str) – The detection method type: one of raw, ram, or vision, or both (i.e. ram + vision)
hud (bool) – Whether to include or not objects from the HUD (e.g. scores, lives)
obs_mode (str) – Define the observation mode. Set to dqn (84x84, grayscaled), ori (210x160x3, RGB image), obj (#Objectsx4). dqn and ori are also organized in a stack of the last 4 frames.
the remaining *args and **kwargs will be passed to the gymnasium.make function.
- close(*args, **kwargs)[source]
After the user has finished using the environment, close contains the code necessary to “clean up” the environment. See env.close() for gymnasium details.
- property dqn_obs
The 4 (grey+down)scaled last frames (84x84) of the environment, used notably by dqn agents as states.
- Type:
torch.tensor
- get_ram()[source]
Returns the RAM state
- Returns:
The 128 list of RAM bytes
- Return type:
list of 128 uint8 values
- property objects
A list of the object present in the environment. The objects are either ocatari.vision.GameObject or ocatari.ram.GameObject, depending on the extraction method.
- Type:
list of GameObjects
- property ocstate
A list of the object present in the environment. The objects are either ocatari.vision.GameObject or ocatari.ram.GameObject, depending on the extraction method.
- Type:
list of GameObjects
- render()[source]
Compute the render frames (as specified by render_mode during the initialization of the environment). If activated, adds an overlay visualizing object properties like position, velocity vector, orientation, name, etc. See env.render() for gymnasium details.
- reset(*args, **kwargs)[source]
Resets the buffer and environment to an initial internal state, returning an initial observation and info. See env.reset() for gymnasium details.
- set_ram(target_ram_position, new_value)[source]
Directly set a given value at a targeted RAM position.
- step(*args, **kwargs)[source]
Run one timestep of the environment’s dynamics using the agent actions. Extracts the objects, using RAM or vision based on the mode variable set at initialization. Fills the buffer if obs_mode was not None at initialization. The observations follow the obs_mode. The method runs the Atari environment env.step() method
- Parameters:
action (int) – The action to perform at this step.