Bläddra i källkod

Update README wrt pixel observations

Maxime Chevalier-Boisvert 5 år sedan
förälder
incheckning
2828f43f4c
1 ändrade filer med 20 tillägg och 10 borttagningar
  1. 20 10
      README.md

+ 20 - 10
README.md

@@ -99,7 +99,7 @@ cd torch-rl
 python3 -m scripts.train --env MiniGrid-Empty-8x8-v0 --algo ppo
 ```
 
-## Design
+## Wrappers
 
 MiniGrid is built to support tasks involving natural language and sparse rewards.
 The observations are dictionaries, with an 'image' field, partially observable
@@ -107,15 +107,25 @@ view of the environment, a 'mission' field which is a textual string
 describing the objective the agent should reach to get a reward, and a 'direction'
 field which can be used as an optional compass. Using dictionaries makes it
 easy for you to add additional information to observations
-if you need to, without having to force everything into a single tensor.
-If your RL code expects one single tensor for observations, please take a look at
-`FlatObsWrapper` in
-[gym_minigrid/wrappers.py](/gym_minigrid/wrappers.py).
-
-The partially observable view of the environment uses a compact and efficient
-encoding, with just 3 input values per visible grid cell, 7x7x3 values total.
-If you want to obtain an array of RGB pixels instead, see the `get_obs_render` method in
-[gym_minigrid/minigrid.py](gym_minigrid/minigrid.py).
+if you need to, without having to encode everything into a single tensor.
+
+There are a variery of wrappers to change the observation format available in [gym_minigrid/wrappers.py](/gym_minigrid/wrappers.py). If your RL code expects one single tensor for observations, take a look at
+`FlatObsWrapper`. There is also an `ImgObsWrapper` that gets rid of the 'mission' field in observations,
+leaving only the image field tensor.
+
+Please note that the default observation format is a partially observable view of the environment using a
+compact and efficient encoding, with 3 input values per visible grid cell, 7x7x3 values total.
+These values are **not pixels**. If you want to obtain an array of RGB pixels as observations instead,
+use the `RGBImgPartialObsWrapper`. You can use it as follows:
+
+```
+env = gym.make('MiniGrid-Empty-8x8-v0')
+env = RGBImgPartialObsWrapper(env) # Get pixel observations
+env = ImgObsWrapper(env) # Get rid of the 'mission' field
+obs = env.reset() # This now produces an RGB tensor only
+```
+
+## Design
 
 Structure of the world:
 - The world is an NxM grid of tiles