def get_image_info(dataPath='./thor_DB_msdn.json', imageDir='./images', depth_image=False):
    print('-- get image info --')
    print('image path : {}'.format(imageDir))
    with open(dataPath, 'r') as f:
        DB = json.load(f)
    print('data read complete')
    len_DB = len(DB)
    print('DB len:', len_DB)
    max_value = 255.0
    mean = np.zeros(3)
    std = np.zeros(3)
    start_time = time.time()
    for (idx, data) in enumerate(DB):
        if (((idx % 1000) == 0) and (idx != 0)):
            dt = (time.time() - start_time)
            print('data preprocessing... ({}/{}), {} fps, {}s left..'.format(idx, len(DB), round((1000.0 / dt), 2), ((len(DB) - idx) * round((dt / 1000.0), 4))))
            start_time = time.time()
        if depth_image:
            if ('path' in data):
                img_fn = data['depth_path']
            elif ('image_file' in data):
                img_fn = data['depth_file']
            else:
                raise Exception('where is the image path !!')
        elif ('path' in data):
            img_fn = data['path']
        elif ('image_file' in data):
            img_fn = data['image_file']
        else:
            raise Exception('where is the image path !!')
        img = cv2.imread(osp.join(imageDir, img_fn))
        for i in range(3):
            mean[i] += (img[:, :, i].mean() / max_value)
            std[i] += (img[:, :, i].std() / max_value)
    mean /= len_DB
    std /= len_DB
    print('mean :', mean.round(3))
    print('std :', std.round(3))
    return (mean, std)
def get_image_info(dataPath='./thor_DB_msdn.json', imageDir='./images', depth_image=False):
    print('-- get image info --')
    print('image path : {}'.format(imageDir))
    with open(dataPath, 'r') as f:
        DB = json.load(f)
    print('data read complete')
    len_DB = len(DB)
    print('DB len:', len_DB)
    max_value = 255.0
    mean = np.zeros(3)
    std = np.zeros(3)
    start_time = time.time()
    for (idx, data) in enumerate(DB):
        if (((idx % 1000) == 0) and (idx != 0)):
            dt = (time.time() - start_time)
            print('data preprocessing... ({}/{}), {} fps, {}s left..'.format(idx, len(DB), round((1000.0 / dt), 2), ((len(DB) - idx) * round((dt / 1000.0), 4))))
            start_time = time.time()
        if depth_image:
            if ('path' in data):
                img_fn = data['depth_path']
            elif ('image_file' in data):
                img_fn = data['depth_file']
            else:
                raise Exception('where is the image path !!')
        elif ('path' in data):
            img_fn = data['path']
        elif ('image_file' in data):
            img_fn = data['image_file']
        else:
            raise Exception('where is the image path !!')
        img = cv2.imread(osp.join(imageDir, img_fn))
        for i in range(3):
            mean[i] += (img[:, :, i].mean() / max_value)
            std[i] += (img[:, :, i].std() / max_value)
    mean /= len_DB
    std /= len_DB
    print('mean :', mean.round(3))
    print('std :', std.round(3))
    return (mean, std)