-
-
Notifications
You must be signed in to change notification settings - Fork 615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug Report] Composing RGBImgPartialObsWrapper with ViewSizeWrapper doesn't give the correct observation. #468
Comments
Thanks for raising the issue, Testing with your script import gymnasium as gym
from minigrid.wrappers import ViewSizeWrapper, RGBImgPartialObsWrapper
import matplotlib.pyplot as plt
env = gym.make("BabyAI-GoToRedBall-v0", render_mode="rgb_array")
obs, _ = env.reset(seed=123)
print(f'base image shape: {obs["image"].shape}') # (7,7,3)
env = RGBImgPartialObsWrapper(env)
obs, _ = env.reset(seed=123)
print(f'RGBImgPartialObsWrapper: {obs["image"].shape}') # (56, 56, 3)
env = ViewSizeWrapper(env, 5)
obs, _ = env.reset(seed=123)
print(f'ViewSizeWrapper: {obs["image"].shape}') # (5, 5, 3) It seems like the order of the wrappers matters the most. If you change the order then you get the whole grid. @NishanthVAnand Does this change of order fix the issue? |
Not quite. The final observation is an RGB image of |
@NishanthVAnand Could you provide an example script of what you expect and what you get |
I have printed import gymnasium as gym
from minigrid.wrappers import ViewSizeWrapper, RGBImgPartialObsWrapper
import matplotlib.pyplot as plt
env = gym.make("BabyAI-GoToRedBall-v0", render_mode="rgb_array")
obs, _ = env.reset(seed=123)
print(f'base image shape: {obs["image"].shape}') # (7,7,3)
base image shape: (7, 7, 3) print(obs["image"][0])
array([[2, 5, 0],
[1, 0, 0],
[1, 0, 0],
[1, 0, 0],
[1, 0, 0],
[1, 0, 0],
[6, 1, 0]], dtype=uint8) env = RGBImgPartialObsWrapper(env)
obs, _ = env.reset(seed=123)
print(f'RGBImgPartialObsWrapper: {obs["image"].shape}') # (56, 56, 3)
RGBImgPartialObsWrapper: (56, 56, 3) from PIL import Image
Image.fromarray(obs["image"]) env = ViewSizeWrapper(env, 5)
obs, _ = env.reset(seed=123)
print(f'ViewSizeWrapper: {obs["image"].shape}') # (5, 5, 3)
ViewSizeWrapper: (5, 5, 3) print(obs["image"][0])
array([[1, 0, 0],
[1, 0, 0],
[5, 1, 0],
[7, 0, 0],
[1, 0, 0]], dtype=uint8) As you can see, the final output ( |
Describe the bug
The default view of the agent is
7x7
which can be changed using theViewSizeWrapper
by passing theagent_view_size
argument. But, when it is used alongside with theRGBImgPartialObsWrapper
,ViewSizeWrapper
doesn't have any effect and the observation defaults to7x7
Code example
System Info
Describe the characteristic of your environment:
pip
and I am using the latest version (3.0.0
).Additional context
Add any other context about the problem here.
Checklist
The text was updated successfully, but these errors were encountered: