Beispiel #1
0
def demo_draw(feed_dict, result, extra_info):
    reconstruct = get_env('demo.is_reconstruct', False)
    grid_desc = get_env('demo.draw.grid_desc')

    all_outputs = []
    for i in range(1000):
        name = 'canvas_step{}'.format(i)
        if name in result:
            all_outputs.append(result[name][0, :, :, 0])

    final = image.image_grid(all_outputs, grid_desc)
    final = (final * 255).astype('uint8')

    if reconstruct:
        img = feed_dict['img'][0, :, :, 0]
        h = final.shape[0]
        w = int(img.shape[1] * h / img.shape[0])
        img = (img * 255).astype('uint8')
        img = image.resize(img, (h, w))
        final = np.hstack((img, final))

    final = image.resize_minmax(final, 480, 720)

    image.imshow('demo', final)
Beispiel #2
0
 def resize_state(s):
     return image.resize(s,
                         get_env('a3c.input_shape'),
                         interpolation='NEAREST')
 def _crop_and_resize(self, img):
     img = image.imdecode(img)
     img = image.resize(img, self._img_shape)
     return img
 def resize_state(s):
     return image.grayscale(
         image.resize(s,
                      get_env('dqn.input_shape'),
                      interpolation='NEAREST'))
Beispiel #5
0
 def resize_state(s):
     return image.resize(s, (84, 84), interpolation='NEAREST')