Using the funcs.py file

We will next code funcs.py by completing the following steps:

  1. Import packages: First, we import the required packages:
import numpy as npimport sysimport tensorflow as tf
  1. Complete the ImageProcess() class: Then, convert the 210 x 160 x 3 RGB image from the Atari emulator to an 84 x 84 grayscale image. For this, we create an ImageProcess() class and use TensorFlow utility functions, such as rgb_to_grayscale() to convert RGB to grayscale, crop_to_bounding_box() to crop the image to the region of interest, resize_images() to resize the image to the desired 84 x 84 size, and squeeze() to remove a dimension from the input. The process() function of the class will carry out the operations by invoking the sess.run() function ...

Get TensorFlow Reinforcement Learning Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.