Observation dictionary key 'vision' contains only lists with zeros


#1

SOLVED

Hi,

I’m just starting out with the OpenAI universe with example code:

import gym
import universe  # register the universe environments
import numpy as np

env = gym.make('flashgames.DuskDrive-v0')
env.configure(remotes=1)  # automatically creates a local docker container
observation_n = env.reset()
counter = 0
while True:
  counter += 1
  action_n = [[('KeyEvent', 'ArrowUp', True)] for ob in observation_n]  # your agent here
  observation_n, reward_n, done_n, info = env.step(action_n)
  #for i in range(len(observation_n)):
  if observation_n[0]:
    print("Observation: ")
    print observation_n[0].get("vision")
  print("Reward: ", reward_n, "Steps: ", counter)
  env.render()#

The ‘observation_n[0]’ dictionary key ‘vision’ contains only lists with zeros. When I print out the value of the ‘vision’ key, this is what it contains:

[[[0 0 0]
  [0 0 0]
  [0 0 0]
  ..., 
  [0 0 0]
  [0 0 0]
  [0 0 0]]

 [[0 0 0]
  [0 0 0]
  [0 0 0]
  ..., 
  [0 0 0]
  [0 0 0]
  [0 0 0]]

 [[0 0 0]
  [0 0 0]
  [0 0 0]
  ..., 
  [0 0 0]
  [0 0 0]
  [0 0 0]]

 ..., 
 [[0 0 0]
  [0 0 0]
  [0 0 0]
  ..., 
  [0 0 0]
  [0 0 0]
  [0 0 0]]

 [[0 0 0]
  [0 0 0]
  [0 0 0]
  ..., 
  [0 0 0]
  [0 0 0]
  [0 0 0]]

 [[0 0 0]
  [0 0 0]
  [0 0 0]
  ..., 
  [0 0 0]
  [0 0 0]
  [0 0 0]]]

I’m testing the “flashgames.DuskDrive-v0”, but I’m getting the exact same output with other environments. As far as I understand it should contain the pixel values, but this is all that I can get. Probably doing something wrong. Does anyone has an idea why this is? Thanks!

Sorry! No worries. I figured out what’s happening.

In case someone else gets puzzled, the value at the key ‘vision’ for a returned observation is a 768 by 1024 by 3 list/array with RGB values in the third dimension. Just wasn’t familiar with how python prints long multi dimensional lists, which is why I got confused with the previous output.