def _modify_observation(self, observation):
# convert color to grayscale using luma component
observation = (
observation[:, :, 0] * 0.299 + observation[:, :, 1] * 0.587 +
observation[:, :, 2] * 0.114
)
observation = cv2.resize(
observation, (84, 110), interpolation=cv2.INTER_AREA
)
observation = observation[18:102, :]
assert observation.shape == (84, 84)
# convert to values between 0 and 1
observation = np.array(observation, dtype=np.uint8)
return observation
评论列表
文章目录