MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / ImageTransformer

Class ImageTransformer

rl2/atari/dqn_tf.py:45–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43# 2) Resize
44# 3) Crop
45class ImageTransformer:
46 def __init__(self):
47 with tf.variable_scope("image_transformer"):
48 self.input_state = tf.placeholder(shape=[210, 160, 3], dtype=tf.uint8)
49 self.output = tf.image.rgb_to_grayscale(self.input_state)
50 self.output = tf.image.crop_to_bounding_box(self.output, 34, 0, 160, 160)
51 self.output = tf.image.resize_images(
52 self.output,
53 [IM_SIZE, IM_SIZE],
54 method=tf.image.ResizeMethod.NEAREST_NEIGHBOR)
55 self.output = tf.squeeze(self.output)
56
57 def transform(self, state, sess=None):
58 sess = sess or tf.get_default_session()
59 return sess.run(self.output, { self.input_state: state })
60
61
62def update_state(state, obs_small):

Callers 1

dqn_tf.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected