def get_data(self): itr = 0 for iden, partial, complete in self.ds.get_data(): partial_centroid = np.mean(partial, axis=0) if self.use_partial: itn_input = partial else: itn_input = resample_pcd(complete, self.sample_size) if self.is_training: if self.train_perturb_list is not None: R = quat2rotm(self.train_perturb_list[itr]) else: R = random_rotation(self.so3_perturb) else: R = quat2rotm(self.valid_perturb_list[itr]) itr += 1 itn_input = itn_input @ R.T itn_input = itn_input - partial_centroid gt_transformation = np.eye(4) gt_transformation[0:3, 0:3] = R gt_transformation[0:3, 3] = -partial_centroid yield iden, itn_input, gt_transformation
def test_rand(self): rotm_1 = euldeg2rotm(23, 82, 13) q = rotm2quat(rotm_1) rotm_2 = quat2rotm(q) assert np.all(np.isclose(rotm_1, rotm_2)) rotm_1 = euldeg2rotm(-240, 428, -888) q = rotm2quat(rotm_1) rotm_2 = quat2rotm(q) assert np.all(np.isclose(rotm_1, rotm_2))
def test_rand(self): q_1 = euldeg2quat(23, 82, 13) rotm = quat2rotm(q_1) q_2 = rotm2quat(rotm) assert np.all(np.isclose(q_1, q_2)) or np.all(np.isclose(-q_1, q_2)) q_1 = euldeg2quat(-240, 428, -888) rotm = quat2rotm(q_1) q_2 = rotm2quat(rotm) assert np.all(np.isclose(q_1, q_2)) or np.all(np.isclose(-q_1, q_2))
def test_rand(self): q = euldeg2quat(23, 82, 13) rotm_gt = euldeg2rotm(23, 82, 13) rotm = quat2rotm(q) assert np.all(np.isclose(rotm, rotm_gt)) q = euldeg2quat(-240, 428, -888) rotm_gt = euldeg2rotm(-240, 428, -888) rotm = quat2rotm(q) assert np.all(np.isclose(rotm, rotm_gt))
def test_unnormalized(self): q = euldeg2quat(2, -45, 21) * 5 rotm_gt = euldeg2rotm(2, -45, 21) rotm = quat2rotm(q) assert np.all(np.isclose(rotm, rotm_gt))
def test_z180(self): q = euldeg2quat(0, 0, 180) rotm_gt = euldeg2rotm(0, 0, 180) rotm = quat2rotm(q) assert np.all(np.isclose(rotm, rotm_gt))
def test_x90(self): q = euldeg2quat(90, 0, 0) rotm_gt = euldeg2rotm(90, 0, 0) rotm = quat2rotm(q) assert np.all(np.isclose(rotm, rotm_gt))
def test_identity(self): q = euldeg2quat(0, 0, 0) rotm_gt = euldeg2rotm(0, 0, 0) rotm = quat2rotm(q) assert np.all(np.isclose(rotm, rotm_gt))