Python gym.ObservationWrapper() Examples
The following are 30
code examples of gym.ObservationWrapper().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
gym
, or try the search function
.
Example #1
Source File: atari_wrappers.py From sonic_contest with MIT License | 6 votes |
def __init__(self, env): """Warp frames to 84x84 as done in the Nature paper and later work.""" gym.ObservationWrapper.__init__(self, env) self.width = 84 self.height = 84 self.observation_space = spaces.Box(low=0, high=255, shape=(self.height, self.width, 1), dtype=np.uint8) #print("Load Keras Model!!!") # Load Keras model #self.json_name = './retro-movies/architecture_level_classifier_v5.json' #self.weight_name = './retro-movies/model_weights_level_classifier_v5.h5' #self.levelcls_model = model_from_json(open(self.json_name).read()) #self.levelcls_model.load_weights(self.weight_name, by_name=True) ##self.levelcls_model.load_weights(self.weight_name) #print("Done Loading Keras Model!!!") #self.mean_pixel = [103.939, 116.779, 123.68] #self.warmup = 1000 #self.interval = 500 #self.counter = 0 #self.num_inference = 0 #self.max_inference = 5 self.level_pred = []
Example #2
Source File: dopamine_connector.py From training_results_v0.5 with Apache License 2.0 | 6 votes |
def __init__(self, env, size=84): """Based on WarpFrame from openai baselines atari_wrappers.py. Dopamine also uses cv2.resize(..., interpolation=cv2.INTER_AREA). Args: env: TODO(konradczechowski): Add doc-string. size: TODO(konradczechowski): Add doc-string. """ gym.ObservationWrapper.__init__(self, env) self.width = size self.height = size assert env.observation_space.dtype == np.uint8 self.observation_space = spaces.Box( low=0, high=255, shape=(self.height, self.width, env.observation_space.shape[2]), dtype=np.uint8)
Example #3
Source File: dopamine_connector.py From training_results_v0.5 with Apache License 2.0 | 6 votes |
def __init__(self, env, size=84): """Based on WarpFrame from openai baselines atari_wrappers.py. Dopamine also uses cv2.resize(..., interpolation=cv2.INTER_AREA). Args: env: TODO(konradczechowski): Add doc-string. size: TODO(konradczechowski): Add doc-string. """ gym.ObservationWrapper.__init__(self, env) self.width = size self.height = size assert env.observation_space.dtype == np.uint8 self.observation_space = spaces.Box( low=0, high=255, shape=(self.height, self.width, env.observation_space.shape[2]), dtype=np.uint8)
Example #4
Source File: atari_wrappers.py From chainerrl with MIT License | 6 votes |
def __init__(self, env, channel_order='hwc'): """Warp frames to 84x84 as done in the Nature paper and later work. To use this wrapper, OpenCV-Python is required. """ if not _is_cv2_available: raise RuntimeError('Cannot import cv2 module. Please install OpenCV-Python to use WarpFrame.') # NOQA gym.ObservationWrapper.__init__(self, env) self.width = 84 self.height = 84 shape = { 'hwc': (self.height, self.width, 1), 'chw': (1, self.height, self.width), } self.observation_space = spaces.Box( low=0, high=255, shape=shape[channel_order], dtype=np.uint8)
Example #5
Source File: openai_atari_wrapper.py From cherry with Apache License 2.0 | 5 votes |
def __init__(self, env): """Warp frames to 84x84 as done in the Nature paper and later work.""" gym.ObservationWrapper.__init__(self, env) self.width = 84 self.height = 84 self.observation_space = spaces.Box(low=0, high=255, shape=(self.height, self.width, 1), dtype=np.uint8)
Example #6
Source File: envs.py From dal with MIT License | 5 votes |
def __init__(self, env): """Warp frames to 84x84 as done in the Nature paper and later work.""" gym.ObservationWrapper.__init__(self, env) self.width = 11 self.height = 11 # self.observation_space = spaces.Box(low=0, high=1, # shape=(self.height, self.width, 6), dtype=np.float32) self.observation_space = spaces.Box(low=0, high=1, shape=(6, self.width, self.height), dtype=np.float32)
Example #7
Source File: atari_wrappers.py From gail-tf with MIT License | 5 votes |
def __init__(self, env): """Warp frames to 84x84 as done in the Nature paper and later work.""" gym.ObservationWrapper.__init__(self, env) self.res = 84 self.observation_space = spaces.Box(low=0, high=255, shape=(self.res, self.res, 1))
Example #8
Source File: atari_wrappers.py From rl_algorithms with MIT License | 5 votes |
def __init__(self, env, width=84, height=84, grayscale=True): """Warp frames to 84x84 as done in the Nature paper and later work.""" gym.ObservationWrapper.__init__(self, env) self.width = width self.height = height self.grayscale = grayscale if self.grayscale: self.observation_space = spaces.Box( low=0, high=255, shape=(self.height, self.width, 1), dtype=np.uint8 ) else: self.observation_space = spaces.Box( low=0, high=255, shape=(self.height, self.width, 3), dtype=np.uint8 )
Example #9
Source File: atari_wrappers.py From rl_algorithms with MIT License | 5 votes |
def __init__(self, env): gym.ObservationWrapper.__init__(self, env) self.observation_space = gym.spaces.Box( low=0, high=1, shape=env.observation_space.shape, dtype=np.float32 )
Example #10
Source File: atari_wrappers.py From ray with Apache License 2.0 | 5 votes |
def __init__(self, env, dim): """Warp frames to the specified size (dim x dim).""" gym.ObservationWrapper.__init__(self, env) self.width = dim self.height = dim self.observation_space = spaces.Box( low=0, high=255, shape=(self.height, self.width, 1), dtype=np.uint8)
Example #11
Source File: utils.py From dal with MIT License | 5 votes |
def __init__(self, env): """Warp frames to 84x84 as done in the Nature paper and later work.""" gym.ObservationWrapper.__init__(self, env) self.width = 88 self.height = 88 self.observation_space = spaces.Box(low=0, high=1, shape=(6, self.width, self.height), dtype=np.float32)
Example #12
Source File: openai_atari_wrapper.py From cherry with Apache License 2.0 | 5 votes |
def __init__(self, env): gym.ObservationWrapper.__init__(self, env)
Example #13
Source File: atari_wrappers.py From rl-attack with MIT License | 5 votes |
def __init__(self, env): """Warp frames to 84x84 as done in the Nature paper and later work.""" gym.ObservationWrapper.__init__(self, env) self.res = 84 self.observation_space = spaces.Box(low=0, high=255, shape=(self.res, self.res, 1))
Example #14
Source File: sonic_on_ray.py From sonic-on-ray with Apache License 2.0 | 5 votes |
def __init__(self, env): """Warp frames to 84x84 as done in the Nature paper and later work.""" gym.ObservationWrapper.__init__(self, env) self.width = 80 self.height = 80 self.observation_space = spaces.Box(low=0, high=255, shape=(self.height, self.width, 1), dtype=np.uint8)
Example #15
Source File: atari_wrappers.py From ray with Apache License 2.0 | 5 votes |
def __init__(self, env, dim): """Warp frames to the specified size (dim x dim).""" gym.ObservationWrapper.__init__(self, env) self.width = dim self.height = dim self.observation_space = spaces.Box( low=0, high=255, shape=(self.height, self.width, 1), dtype=np.uint8)
Example #16
Source File: atari_wrappers.py From self-imitation-learning with MIT License | 5 votes |
def __init__(self, env): """Warp frames to 84x84 as done in the Nature paper and later work.""" gym.ObservationWrapper.__init__(self, env) self.width = 84 self.height = 84 self.observation_space = spaces.Box(low=0, high=255, shape=(self.height, self.width, 1), dtype=np.uint8)
Example #17
Source File: atari_wrappers.py From ray with Apache License 2.0 | 5 votes |
def __init__(self, env): gym.ObservationWrapper.__init__(self, env) self.observation_space = gym.spaces.Box( low=0, high=1, shape=env.observation_space.shape, dtype=np.float32)
Example #18
Source File: utils.py From dal with MIT License | 5 votes |
def __init__(self, env): """Warp frames to 84x84 as done in the Nature paper and later work.""" gym.ObservationWrapper.__init__(self, env) self.width = 88 self.height = 88 self.observation_space = spaces.Box(low=0, high=1, shape=(6, self.width, self.height), dtype=np.float32)
Example #19
Source File: retro_wrappers.py From pytorch-pommerman-rl with MIT License | 5 votes |
def __init__(self, env): """ Downsample images by a factor of ratio """ gym.ObservationWrapper.__init__(self, env) (oldh, oldw, _oldc) = env.observation_space.shape self.observation_space = spaces.Box(low=0, high=255, shape=(oldh, oldw, 1), dtype=np.uint8)
Example #20
Source File: ppo_atari_visual.py From cleanrl with MIT License | 5 votes |
def __init__(self, env): gym.ObservationWrapper.__init__(self, env) self.observation_space = gym.spaces.Box(low=0, high=1, shape=env.observation_space.shape, dtype=np.float32)
Example #21
Source File: c51_atari.py From cleanrl with MIT License | 5 votes |
def __init__(self, env): gym.ObservationWrapper.__init__(self, env) self.observation_space = gym.spaces.Box(low=0, high=1, shape=env.observation_space.shape, dtype=np.float32)
Example #22
Source File: dqn_atari_visual.py From cleanrl with MIT License | 5 votes |
def __init__(self, env): gym.ObservationWrapper.__init__(self, env) self.observation_space = gym.spaces.Box(low=0, high=1, shape=env.observation_space.shape, dtype=np.float32)
Example #23
Source File: ppo_atari.py From cleanrl with MIT License | 5 votes |
def __init__(self, env): gym.ObservationWrapper.__init__(self, env) self.observation_space = gym.spaces.Box(low=0, high=1, shape=env.observation_space.shape, dtype=np.float32)
Example #24
Source File: dqn_atari.py From cleanrl with MIT License | 5 votes |
def __init__(self, env): gym.ObservationWrapper.__init__(self, env) self.observation_space = gym.spaces.Box(low=0, high=1, shape=env.observation_space.shape, dtype=np.float32)
Example #25
Source File: atari_wrappers.py From torchbeast with Apache License 2.0 | 5 votes |
def __init__(self, env): gym.ObservationWrapper.__init__(self, env) self.observation_space = gym.spaces.Box(low=0, high=1, shape=env.observation_space.shape, dtype=np.float32)
Example #26
Source File: atari_wrappers.py From MOREL with MIT License | 5 votes |
def __init__(self, env): gym.ObservationWrapper.__init__(self, env)
Example #27
Source File: atari_wrappers.py From MOREL with MIT License | 5 votes |
def __init__(self, env): """Warp frames to 84x84 as done in the Nature paper and later work.""" gym.ObservationWrapper.__init__(self, env) self.width = 84 self.height = 84 self.observation_space = spaces.Box(low=0, high=255, shape=(self.height, self.width, 1), dtype=np.uint8)
Example #28
Source File: atari_wrapper.py From pytorch-nec with MIT License | 5 votes |
def __init__(self, env): """Warp frames to 84x84 as done in the Nature paper and later work.""" gym.ObservationWrapper.__init__(self, env) self.width = 84 self.height = 84 self.observation_space = spaces.Box( low=0, high=255, shape=(self.height, self.width, 1))
Example #29
Source File: common.py From rltime with Apache License 2.0 | 5 votes |
def __init__(self, env, size=(84, 84, 1)): gym.ObservationWrapper.__init__(self, env) if isinstance(size, list): size = tuple(size) self.size = size assert(len(size) == 3) assert(size[-1] in (1, 3)), "WarpFrame supports 1 or 3 channel output" self.observation_space = gym.spaces.Box( low=0, high=255, shape=(self.size[1], self.size[0], self.size[2]), dtype=np.uint8)
Example #30
Source File: atari_wrappers.py From ICML2019-TREX with MIT License | 5 votes |
def __init__(self, env): gym.ObservationWrapper.__init__(self, env) self.observation_space = gym.spaces.Box(low=0, high=1, shape=env.observation_space.shape, dtype=np.float32)