-
-
Notifications
You must be signed in to change notification settings - Fork 827
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
Add rendering wrapper with noise #1243
base: main
Are you sure you want to change the base?
Conversation
I'm certainly interested in these wrappers, my only worry is that I don't want to add features that are uncommonly used and just add more wrappers to update which can be just part of a more specialised repo. @sparisi Are these common wrappers within the literature? Why are these applied to the render and not the observation? |
@pseudo-rnd-thoughts I have a version where they are implemented as observation wrappers, but
At least, that's based on my understanding of the current wrappers. Side note. As I wrote, my wrappers do not work with "rgb_array_list" rendering. I can't find how this rendering works, ie, where the frames are concatenated into list. My guess is that this is used for vectorized environments and video rendering, but I cannot find exactly where/how they are called. Ideally, my wrappers should be called right after the environment is rendered and before frames are put into the list of frames. |
I remembered a version of the @sparisi would you be interested in changing this to be more observation focused? Or do you think that only rendering is important? For |
@pseudo-rnd-thoughts |
I agree with the idea that if applying noise to an image observation, then we also apply noise to the rendering. To implement, I would have an argument |
Great, will do it. What do you mean with "image Boxes"? I thought Box was the classic continuous (non-image) space. Do you mean applying white noise to small-dimensional observation space as well? Like, adding noise to the default (non-image) LunarLander space? I can also do that. |
If users used the |
Description
Added two wrappers that add white noise to the rendering of the environments.
The first simply randomly add white noise to every pixel according to some probability.
The second adds biggers "patches" (the number of patches depends on the size of the patch and on what percentage of pixels we want to mask).
Noise is different at every step.
This is not a fix, but a new feature. It allows for noisy pixel observations and can easily make the environment partially-observable (especially the "patch" version). Helpful to turn MDPs into POMDPs from pixels.
The reasons why I added it as a rendering wrapper and not an observation wrapper are:
However, it currently does not work with "rgb_array_list", because the
render()
function expects a single frame but it receives a list of frames. I couldn't figure out how "rgb_array_list" work. The best thing would be to have the noise added right after the frame is created and before it is appened to the list, but I couldn't find where this happens. I am happy to look more into this and make this even more generic.One example of learning from pixels with noisy observation would be (
matplotlib
is just to show the noisy frame):I am not sure if the name "ObstructedView" is the best, I am happy to rename it to a better fit.
Type of change
Please delete options that are not relevant.
Screenshots
Here are some screenshots of the wrapper in action
Checklist:
pre-commit
checks withpre-commit run --all-files
(seeCONTRIBUTING.md
instructions to set it up)