Skip to content

SB3 and gymnasium adapters: image_key, for camera observations - #3

Merged
tactino merged 1 commit into
mainfrom
feat/image-observations
Oct 2, 2026
Merged

tactino merged 1 commit into
mainfrom
feat/image-observations

Conversation

@tactino

@tactino tactino commented Oct 2, 2026

Copy link
Copy Markdown
Member

Image observations for PlugRLVecEnv (SB3) and PlugRLVectorEnv (gymnasium), for plugrl-server's E53, which compares SB3's CnnPolicy on Atari in-process and through the bridge.

  • image_key. The observation is that one image, in the dtype the client sent. observation_space_of turns a uint8 batch into Box(0, 255, [H, W, C], uint8), which SB3's is_image_space accepts, so CnnPolicy and VecTransposeImage apply. terminal_observation (SB3) and final_obs (gymnasium) follow.
  • Without image_key, nothing changes: state_keys are flattened into float32, with the same space.
  • Discrete action spaces were already handled, by accident: prod(()) is 1, so an action crosses as one float per env. The new SB3 test now pins that down.
  • Tests: 18 pass. The two new ones run against a fake client that sends a uint8 [4, 4, 1] frame.

…ete action spaces

With image_key, the observation is that one image as the client sent it.
A uint8 [H, W, C] frame gives a uint8 Box(0, 255), which SB3's CnnPolicy
and gymnasium take as an image. terminal_observation and final_obs follow.
Without it nothing changes: state_keys flattened into float32.

Discrete action spaces work as they are: an action crosses as one float per
env. Two tests, with a fake client that sends a uint8 frame.
@tactino
tactino merged commit e636a79 into main Oct 2, 2026
2 checks passed
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 this pull request may close these issues.

1 participant