'Parses a single tf.Example into image and label tensors.'

def parser(self, serialized_example):

    features = tf.parse_single_example(serialized_example, features={'image': tf.FixedLenFeature([], tf.string), 'label': tf.FixedLenFeature([], tf.int64)})
    image = tf.decode_raw(features['image'], tf.uint8)
    image.set_shape([((DEPTH * HEIGHT) * WIDTH)])
    image = tf.cast(tf.transpose(tf.reshape(image, [DEPTH, HEIGHT, WIDTH]), [1, 2, 0]), tf.float32)
    label = tf.cast(features['label'], tf.int32)
    image = self.preprocess(image)
    return (image, label)
