def __init__(self, filename_provider):
training_filenames = filename_provider()
self.sequence_dirs = [os.path.join(self.BASE_DATA_DIR, filename) for filename in training_filenames]
self.seq_dir_map = {}
for seq_dir in self.sequence_dirs:
associations = np.loadtxt(os.path.join(seq_dir, "associate.txt"), dtype="str", unpack=False)
groundtruth = np.loadtxt(os.path.join(seq_dir , "groundtruth.txt"), dtype="str", unpack=False)
if seq_dir not in self.seq_dir_map:
self.seq_dir_map[seq_dir] = {}
self.seq_dir_map[seq_dir]['associations'] = associations
self.seq_dir_map[seq_dir]['groundtruth'] = groundtruth
sequence_size = associations.shape[0]
twist = np.zeros((sequence_size, 6))
trans_old = np.zeros((4, 4))
for i in range(sequence_size):
quat = groundtruth[:, 1:][_find_label(groundtruth[:, 0], associations[i, 0])].astype(np.float32)
trans_new = _quat_to_transformation(quat)
if i > 0:
twist[i] = _trans_to_twist(trans_new)
else:
twist[i] = np.zeros(6)
trans_old = trans_new
self.seq_dir_map[seq_dir]['relpos'] = twist
评论列表
文章目录