'Setup data layer according to parameters:
- nyud_dir: path to NYUDv2 dir
- split: train / val / test
- tops: list of tops to output from {color, depth, hha, label}
- randomize: load in random order (default: True)
- seed: seed for randomization (default: None / current time)
for NYUDv2 semantic segmentation.
example: params = dict(nyud_dir="/path/to/NYUDVOC2011", split="val",
tops=[\'color\', \'hha\', \'label\'])'

def setup(self, bottom, top):

    params = eval(self.param_str)
    self.nyud_dir = params['nyud_dir']
    self.split = params['split']
    self.tops = params['tops']
    self.random = params.get('randomize', True)
    self.seed = params.get('seed', None)
    self.data = {}
    self.mean_bgr = np.array((116.19, 97.203, 92.318), dtype=np.float32)
    self.mean_hha = np.array((132.431, 94.076, 118.477), dtype=np.float32)
    self.mean_logd = np.array((7.844,), dtype=np.float32)
    if (len(top) != len(self.tops)):
        raise Exception('Need    to    define    {}    tops    for    all    outputs.')
    if (len(bottom) != 0):
        raise Exception('Do    not    define    a    bottom.')
    split_f = '{}/{}.txt'.format(self.nyud_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))
