@@ -140,18 +140,20 @@ def kf_traj_eval(npz_path, plot_parent_dir,plot_name, stream, logger,printer):
140140 return ape_statistics , s , r_a , t_a
141141
142142
143- def full_traj_eval (traj_filler , mapper , plot_parent_dir , plot_name , stream ,logger ,printer ):
143+ def full_traj_eval (traj_filler , mapper , plot_parent_dir , plot_name , stream , logger , printer , fast_mode = False ):
144144 traj_est_inv , dino_feats = traj_filler (stream )
145145 traj_est_lietorch = traj_est_inv .inv ()
146146 traj_est = traj_est_lietorch .matrix ().data .cpu ().numpy ()
147147
148- # ## refine non-keyframe-traj from the mapping
149- # for i in tqdm(range(traj_est.shape[0])):
150- # img_feat = dino_feats[i]
151- # w2c_refined = mapper.refine_pose_non_key_frame(i,
152- # torch.tensor(np.linalg.inv(traj_est[i])),
153- # features=img_feat)
154- # traj_est[i] = np.linalg.inv(w2c_refined.cpu().numpy())
148+ if not fast_mode :
149+ # refine non-keyframe-traj from the mapping
150+ # this is time-consuming with minimal tracking improvement
151+ for i in tqdm (range (traj_est .shape [0 ])):
152+ img_feat = dino_feats [i ]
153+ w2c_refined = mapper .refine_pose_non_key_frame (i ,
154+ torch .tensor (np .linalg .inv (traj_est [i ])),
155+ features = img_feat )
156+ traj_est [i ] = np .linalg .inv (w2c_refined .cpu ().numpy ())
155157
156158 kf_num = traj_filler .video .counter .value
157159 kf_timestamps = traj_filler .video .timestamp [:kf_num ].cpu ().int ().numpy ()
0 commit comments