[Feature Request] SB3 compatible version of Gym's FrameStack wrapper
See original GitHub issue🚀 Feature
A version of Gym’s FrameStack
wrapper that returns the stacked observations as (channel*n_stack, height, width)
.
Motivation
The VecFrameStack
in SB3 returns stacked observations as (channel*n_stack, height, width)
, while the non-vectorized version in
Gym returns the observations as (n_stack, height, width, channel)
. Using the non-vectorized version with e.g. the NatureCnn feature extractor is not possible (fails assert
in https://github.com/DLR-RM/stable-baselines3/blob/master/stable_baselines3/common/torch_layers.py#L67).
Pitch
Either
- add a non-vectorized
FrameStack
wrapper (as has been done withMonitor
), or - add a compatibility layer to Gym’s
FrameStack
that assembles the the observations correctly.
### Checklist
- I have checked that there is no similar issue in the repo (required)
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
Gym Wrappers - Stable Baselines3 Contrib docs!
Additional Gym Wrappers to enhance Gym environments. ... class sb3_contrib.common.wrappers. ... GoalEnv ) 1D observation spaces are supported for now.
Read more >Stable Baselines Documentation - Read the Docs
Stable Baselines is a set of improved implementations of Reinforcement Learning (RL) algorithms based on OpenAI Baselines. Warning: This ...
Read more >Kirsten Crane (@k_n_crane) / Twitter
... one of our most requested feature, is now on SB3 Contrib master branch =)! It was benchmarked against PPO with frame-stack on...
Read more >stable-baselines Changelog - pyup.io
Fixed a bug in ``HindsightExperienceReplayWrapper``, where the openai-gym signature for ... Added ``version.txt`` to manage version number in an easier way
Read more >The ICLR Blog Track ·
CartPole-v1 from Gym was his chosen simulation environment, and before long, Jon made PPO work with CartPole-v1 .
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can skip obs normalization in that case by passing
norm_obs=False
(you may need SB3 master version), or as suggested in #693 invert the wrappers (that would be equivalent to doing frame stack on each single env and then normalizing)Reasonable request, but in what situation would you want to apply
FrameStack
as an individual wrapper per env? On a quick thought this is useful if you want to add some wrappers afterFrameStack
to do some mods, but these could also be done in a vectorized fashion.SB3 is built solely around “vectorized” envs as you can always turn single env into a vectorized env of size one, which simplifies the code. If the wrapper is not used in/for SB3 specifically, there is little reason to add it here tbh.