Skip to content

Cropping of NoInv Crafter for POBAX - set to first 27 rows #39

@Sathya98

Description

@Sathya98

I was looking into running the No Inventory crafter environment for some playing around, and looked into the environment wrapper in pobax/envs/wrappers/pixel.py - and noticed the following:

@functools.partial(jax.jit, static_argnums=(0, 2))
def get_obs(self, obs, normalize):
    if not normalize:
        obs *= 255
    assert len(obs.shape) == 4
    obs = obs[:,:27, :, :]
    return obs

def observation_space(self, params):
    low, high = 0, 255
    if self.normalize:
        high = 1
    return spaces.Dict({
        "obs": spaces.Box(
            low=low,
            high=high,
            shape=(
                27,
                33,
                3,
            ),
        )
    })

I ran the following code to initialize the env:

import jax
from pobax.envs import get_env

num_envs = 4
rng = jax.random.PRNGKey(0)
env, env_params = get_env("craftax_pixels", rng, num_envs=num_envs)

rngs = jax.random.split(rng, num_envs)
obs, state = env.reset(rngs, env_params)

print(obs.obs.shape)

and I see that the shape is (4, 27, 110, 3), and not (4, 27, 33, 3) as described in the paper. And I could not spot a resize operation to change the scaling from 10px to 3px as stated in any of the wrappers/files. How do we fix this? Was a resize missing?

Image: version in code
Image

Image: full obs version
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions