MCPcopy Create free account
hub / github.com/ActiveVisionLab/DFNet / load_dataset

Function load_dataset

script/dm/prepare_data.py:37–84  ·  view source on GitHub ↗

load posenet training data

(args)

Source from the content-addressed store, hash-verified

35 return train_dl, val_dl, test_dl
36
37def load_dataset(args):
38 ''' load posenet training data '''
39 if args.dataset_type == 'llff':
40 if args.no_bd_factor:
41 bd_factor = None
42 else:
43 bd_factor = 0.75
44 images, poses, bds, render_poses, i_test = load_llff_data(args.datadir, args.factor,
45 recenter=True, bd_factor=bd_factor,
46 spherify=args.spherify)
47
48 hwf = poses[0,:3,-1]
49 poses = poses[:,:3,:4]
50 print('Loaded llff', images.shape, render_poses.shape, hwf, args.datadir)
51 if not isinstance(i_test, list):
52 i_test = [i_test]
53
54 if args.llffhold > 0:
55 print('Auto LLFF holdout,', args.llffhold)
56 i_test = np.arange(images.shape[0])[::args.llffhold]
57
58 i_val = i_test
59 i_train = np.array([i for i in np.arange(int(images.shape[0])) if
60 (i not in i_test and i not in i_val)])
61
62 print('DEFINING BOUNDS')
63 if args.no_ndc:
64 near = np.ndarray.min(bds) * .9
65 far = np.ndarray.max(bds) * 1.
66
67 else:
68 near = 0.
69 far = 1.
70
71 if args.finetune_unlabel:
72 i_train = i_test
73 i_split = [i_train, i_val, i_test]
74 else:
75 print('Unknown dataset type', args.dataset_type, 'exiting')
76 return
77
78 poses_train = poses[:,:3,:].reshape((poses.shape[0],12)) # get rid of last row [0,0,0,1]
79 print("images.shape {}, poses_train.shape {}".format(images.shape, poses_train.shape))
80
81 INPUT_SHAPE = images[0].shape
82 print("=====================================================================")
83 print("INPUT_SHAPE:", INPUT_SHAPE)
84 return images, poses_train, render_poses, hwf, i_split, near, far

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected