code: def preprocess(self, img):
          
          # Crop, down-sample, erase background and set foreground to 1.
          # See https://gist.github.com/karpathy/a4166c7fe253700972fcbc77e4ea32c5
          img = img[35:195]
          img = img[::2, ::2, 0]
          img[img == 144] = 0
          img[img == 109] = 0
          img[img != 0] = 1
          curr = np.expand_dims(img.astype(np.float).ravel(), axis=0)
          # Subtract the last preprocessed image.
          diff = (curr - self.prev if self.prev is not None
                  else np.zeros((1, curr.shape[1])))
          self.prev = curr
          return diff
docs: Preprocess a 210x160x3 uint8 frame into a 6400 (80x80) (1 x input_size)
          float vector.