Python provider.getDataFiles() Examples

The following are 7 code examples of provider.getDataFiles(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module provider , or try the search function .
Example #1
Source File: config.py    From AlignNet-3D with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def load_config(filename):
    global globalConfig
    assert filename.endswith('.json')
    name = os.path.basename(filename)[:-5]
    with open(filename, 'r') as handle:
        dump_to_namespace(configGlobal, json.load(handle))
    configGlobal.__dict__["name"] = name
    configGlobal.data.__dict__["basename"] = os.path.basename(configGlobal.data.basepath)
    configGlobal.logging.__dict__["logdir"] = configGlobal.logging.basedir + f'/{name}'
    if configGlobal.evaluation.has('special'):
        if configGlobal.evaluation.special.mode == 'icp':
            configGlobal.logging.__dict__["logdir"] = configGlobal.logging.basedir + f'/icp_{configGlobal.data.basename}/{name}'

    TRAIN_INDICES = provider.getDataFiles(f'{configGlobal.data.basepath}/split/train.txt')
    VAL_INDICES = provider.getDataFiles(f'{configGlobal.data.basepath}/split/val.txt')
    configGlobal.data.__dict__["ntrain"] = len(TRAIN_INDICES)
    configGlobal.data.__dict__["nval"] = len(VAL_INDICES) 
Example #2
Source File: generate_dataset.py    From pointnet-registration-framework with MIT License 5 votes vote down vote up
def getDataFiles(self, list_filename):
		return [line.rstrip() for line in open(list_filename)] 
Example #3
Source File: estimate_mean_ins_size.py    From ASIS with MIT License 5 votes vote down vote up
def estimate(area):
    LOG_DIR = 'log{}'.format(area)
    num_classes = 13
    file_path = "data/train_hdf5_file_list_woArea{}.txt".format(area)

    train_file_list = provider.getDataFiles(file_path) 

    mean_ins_size = np.zeros(num_classes)
    ptsnum_in_gt = [[] for itmp in range(num_classes)]

    train_data = []
    train_group = []
    train_sem = []
    for h5_filename in train_file_list:
        cur_data, cur_group, _, cur_sem = provider.loadDataFile_with_groupseglabel_stanfordindoor(h5_filename)
        cur_data = np.reshape(cur_data, [-1, cur_data.shape[-1]])
        cur_group = np.reshape(cur_group, [-1])
        cur_sem = np.reshape(cur_sem, [-1])

        un = np.unique(cur_group)
        for ig, g in enumerate(un):
            tmp = (cur_group == g)
            sem_seg_g = int(stats.mode(cur_sem[tmp])[0])
            ptsnum_in_gt[sem_seg_g].append(np.sum(tmp))

    for idx in range(num_classes):
        mean_ins_size[idx] = np.mean(ptsnum_in_gt[idx]).astype(np.int)

    print(mean_ins_size)
    np.savetxt(os.path.join(LOG_DIR, 'mean_ins_size.txt'),mean_ins_size) 
Example #4
Source File: ply_dataset.py    From chainer-pointnet with MIT License 5 votes vote down vote up
def get_train_dataset(num_point=1024):
    print('get train num_point ', num_point)
    train_files = provider.getDataFiles(
        os.path.join(BASE_DIR, 'data/modelnet40_ply_hdf5_2048/train_files.txt'))
    return ConcatenatedDataset(
        *(PlyDataset(filepath, num_point=num_point, augment=True) for filepath in train_files)) 
Example #5
Source File: ply_dataset.py    From chainer-pointnet with MIT License 5 votes vote down vote up
def get_test_dataset(num_point=1024):
    print('get test num_point ', num_point)
    test_files = provider.getDataFiles(
        os.path.join(BASE_DIR, 'data/modelnet40_ply_hdf5_2048/test_files.txt'))
    return ConcatenatedDataset(
        *(PlyDataset(filepath, num_point=num_point, augment=False) for filepath in test_files)) 
Example #6
Source File: generate_dataset.py    From pcrnet with MIT License 5 votes vote down vote up
def getDataFiles(self, list_filename):
		return [line.rstrip() for line in open(list_filename)] 
Example #7
Source File: visualization.py    From scanobjectnn with MIT License 4 votes vote down vote up
def visualize_fv_pc_clas():
    num_points = 1024
    n_classes = 40
    clas = 'person'
    #Create new gaussian
    subdev = 5
    variance = 0.04
    export = False
    display = True
    exp_path = '/home/itzikbs/PycharmProjects/fisherpointnet/paper_images/'

    shape_names = provider.getDataFiles( \
        os.path.join(BASE_DIR, 'data/modelnet' + str(n_classes) + '_ply_hdf5_2048/shape_names.txt'))
    shape_dict = {shape_names[i]: i for i in range(len(shape_names))}

    gmm = utils.get_grid_gmm(subdivisions=[subdev, subdev, subdev], variance=variance)
    # compute fv
    w = tf.constant(gmm.weights_, dtype=tf.float32)
    mu = tf.constant(gmm.means_, dtype=tf.float32)
    sigma = tf.constant(gmm.covariances_, dtype=tf.float32)

    for clas in shape_dict:
        points = provider.load_single_model_class(clas=clas, ind=0, test_train='train', file_idxs=0, num_points=1024,
                                                  n_classes=n_classes)
        points = np.expand_dims(points,0)

        points_tensor = tf.constant(points, dtype=tf.float32)  # convert points into a tensor
        fv_tensor = tf_util.get_fv_minmax(points_tensor, w, mu, sigma, flatten=False)

        sess = tf_util.get_session(2)
        with sess:
            fv = fv_tensor.eval()
        #
        # visualize_single_fv_with_pc(fv_train, points, label_title=clas,
        #                      fig_title='fv_pc', type='paper', pos=[750, 800, 0, 0], export=export,
        #                      filename=BASE_DIR + '/paper_images/fv_pc_' + clas)

        visualize_fv(fv, gmm, label_title=[clas], max_n_images=5, normalization=True, export=export, display=display,
                     filename=exp_path + clas+'_fv', n_scales=1, type='none', fig_title='Figure')
        visualize_pc(points, label_title=clas, fig_title='figure', export=export, filename=exp_path +clas+'_pc')
        plt.close('all')

    #plt.show()