'Setup data layer according to parameters:
- siftflow_dir: path to SIFT Flow dir
- split: train / val / test
- randomize: load in random order (default: True)
- seed: seed for randomization (default: None / current time)
for semantic segmentation of object and geometric classes.
example: params = dict(siftflow_dir="/path/to/siftflow", split="val")'

def setup(self, bottom, top):

    params = eval(self.param_str)
    self.siftflow_dir = params['siftflow_dir']
    self.split = params['split']
    self.mean = np.array((114.578, 115.294, 108.353), dtype=np.float32)
    self.random = params.get('randomize', True)
    self.seed = params.get('seed', None)
    if (len(top) != 3):
        raise Exception('Need    to    define    three    tops:    data,    semantic    label,    and    geometric    label.')
    if (len(bottom) != 0):
        raise Exception('Do    not    define    a    bottom.')
    split_f = '{}/{}.txt'.format(self.siftflow_dir, self.split)
    self.indices = open(split_f, 'r').read().splitlines()
    self.idx = 0
    if ('train' not in self.split):
        self.random = False
    if self.random:
        random.seed(self.seed)
        self.idx = random.randint(0, (len(self.indices) - 1))
