Skip to content
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] RGBImgObsWrapper hardcodes highlight parameter #382

Closed
1 task done
thesofakillers opened this issue Jul 24, 2023 · 3 comments · Fixed by #388
Closed
1 task done

[Bug Report] RGBImgObsWrapper hardcodes highlight parameter #382

thesofakillers opened this issue Jul 24, 2023 · 3 comments · Fixed by #388

Comments

@thesofakillers
Copy link
Contributor

Describe the bug
When using RGBImgObsWrapper on an environment initialized with highlight=False, the images in the observation will still be rendered with highlight=True. This is because True highlighting is hardcoded in RGBImgObsWrapper, instead of respecting what is set by the environment being wrapped:

rgb_img = self.get_frame(highlight=True, tile_size=self.tile_size)

Instead of highlight=True, that should say highlight=self.env.highlight or equivalent.

Code example

from minigrid.wrappers import RGBImgObsWrapper
import gymnasium as gym
import matplotlib.pyplot as plt

env = gym.make("BabyAI-GoToLocal-v0", highlight=False)
env = RGBImgObsWrapper(env)

obs, _ = env.reset()
plt.imshow(obs['image'])

The plotted image will still show a highlight around the agent, despite us having specified not to highlight the agent's view.

System Info
Describe the characteristic of your environment:

  • Describe how minigrid was installed (pip, docker, source, ...)
    pip install minigrid
  • What OS/version of Linux you're using. Note that while we will accept PRs to improve Window's support, we do not officially support it.
    MacOS Catalina 10.15.7
  • Python version
    3.8.16

Additional context
Perhaps related: #162, #326

Checklist

  • I have checked that there is no similar issue in the repo (required)
@thesofakillers
Copy link
Contributor Author

I can submit a PR with the proposed fix if this is welcome.

@pseudo-rnd-thoughts
Copy link
Member

Thanks, yes that would be great.
Does highlight default to True in environments?

@thesofakillers
Copy link
Contributor Author

thesofakillers commented Jul 29, 2023

Yes highlight defaults to true in environments.
See here:

highlight: bool = True,

I'll open a PR on Monday

EDIT: PR opened, see #388

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants