MCPcopy Create free account
hub / github.com/diviswen/Cycle4Completion / load_completion_data

Function load_completion_data

utils/data_provider.py:10–58  ·  view source on GitHub ↗
(path, batch_size, encode, npoint=2048, split='split_pcl2pcl.txt')

Source from the content-addressed store, hash-verified

8import glob
9
10def load_completion_data(path, batch_size, encode, npoint=2048, split='split_pcl2pcl.txt'):
11 save_path_train = os.path.join(path,"partial")
12 save_path_gt = os.path.join(path,"complete")
13 f_lidar = glob.glob(os.path.join(save_path_train, '*.npy'))
14 new_dataset = []
15 gt_dataset = []
16 test_dataset = []
17 test_dataset_gt = []
18
19 a = np.loadtxt('./dataset/3depn/'+split, str)
20
21 b = []
22 for i in a:
23 if int(i[:8]) == int(encode):
24 i = i[9:]
25 b.append(i)
26 for i in f_lidar:
27 raw_lidar = np.load(i)
28 file = i.split('/')[-1].split('.')[0][:-5]+".npy"
29 gt_lidar = np.load(os.path.join(save_path_gt,file))
30 if file[:-4] in b:
31 test_dataset.append(raw_lidar)
32 test_dataset_gt.append(gt_lidar)
33 else:
34 new_dataset.append(raw_lidar)
35 gt_dataset.append(gt_lidar)
36 new_dataset = np.array(new_dataset)
37 gt_dataset = np.array(gt_dataset)
38 test_dataset = np.array(test_dataset)
39 test_dataset_gt = np.array(test_dataset_gt)
40 batch_dataset = []
41 batch_dataset_gt = []
42 test_batch_dataset = []
43 test_batch_dataset_gt = []
44 i=0
45 while i+batch_size<=new_dataset.shape[0]:
46 batch_dataset.append(new_dataset[i:i+batch_size])
47 batch_dataset_gt.append(gt_dataset[i:i+batch_size])
48 i = i + batch_size
49 i=0
50 while i+batch_size<=test_dataset.shape[0]:
51 test_batch_dataset.append(test_dataset[i:i+batch_size])
52 test_batch_dataset_gt.append(test_dataset_gt[i:i+batch_size])
53 i = i + batch_size
54 batch_dataset = np.array(batch_dataset)
55 batch_dataset_gt = np.array(batch_dataset_gt)
56 test_batch_dataset = np.array(test_batch_dataset)
57 test_batch_dataset_gt = np.array(test_batch_dataset_gt)
58 return batch_dataset, batch_dataset_gt, test_batch_dataset, test_batch_dataset_gt
59
60
61def rotate_point_cloud_and_gt(batch_data,batch_gt=None):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected