import tensorflow as tf

    # Reshape to use within a convolutional neural net.  Last dimension is for
    # 'features' - it would be 1 one for a grayscale image, 3 for an RGB image,
    # 4 for RGBA, etc.

    x_image = tf.reshape(x, [-1, FLAGS.img_width, FLAGS.img_height, FLAGS.img_channels])

    x_image = tf.cond(train, lambda: tf.map_fn(tf.image.random_flip_left_right, x_image), lambda: x_image)
    x_image = tf.cond(train, lambda: tf.map_fn(lambda x: tf.image.random_brightness(x, 0.5), x_image), lambda: x_image)

    img_summary = tf.summary.image('Input_images', x_image)

    # First convolutional layer - maps one image to 32 feature maps.
    with tf.variable_scope('Conv_1'):
        conv1 = tf.layers.conv2d(
            inputs=x_image,
            filters=32,
            kernel_size=[5,5],
            padding='same',
