def split_matfile_to_val_list(fpath):
    """
    Load split file from NYU depth v2 site and
    extract list of indices that belong in validation set
    """
    if not os.path.isfile(fpath):
        raise IOError("Path is not a regular file (%s)" % fpath)
    
    _, ext = os.path.splitext(fpath)
    
    if ext != '.mat':
        raise IOError("Invalid file type, expecting mat file (%s)" % fpath)
    
    fieldname = 'testNdxs'
    val = io.loadmat(fpath)[fieldname]
    val -= 1 # go from 1-based to zero-based indexing
    val_list = val.ravel().tolist()
    
    return val_list
dataset/ETHPy150Open kashefy/nideep/nideep/datasets/nyudv2_to_lmdb.py/split_matfile_to_val_list/original