December 2017
Intermediate to advanced
536 pages
14h 23m
English
As mentioned in the previous recipe, Q learning to balance CartPole, for Atari games such as Pac-Man or Breakout, we need to preprocess the observation state space, which consists of 33,600 pixels with 3 RGB values. Each of these pixels can take any value between 0 and 255. Our preprocess function should be able to quantize the pixel possible values and, at the same time, reduce the observation state space.
We make use of Scipy's imresize function to downsample the image. The following functions preprocess the image before it is fed to the DQN:
def preprocess(img): img_temp = img[31:195] # Choose the important area of the image img_temp = img_temp.mean(axis=2) # Convert to Grayscale# # Downsample image using nearest neighbour ...
Read now
Unlock full access