def __init__(self, args):
     self.results = []
     self.resultsPath = get_xivo_output_filename(args.dump,
                                                 args.dataset,
                                                 args.seq,
                                                 cam_id=args.cam_id,
                                                 sen=args.sen)
Example #2
0
        self.seq = seq
        self.est = EstimatorData(estimator_results)

    def plot_cov(self, ind):
        plt.figure()
        plt.title("{} covariance for timestep {}".format(self.seq, ind))
        ax = plt.gca()
        im = ax.imshow(self.est.P[:, :, ind], cmap='RdBu')
        ax.figure.colorbar(im, ax=ax)

    def user_select_plot(self):
        while True:
            print("Index range: {} to {}".format(self.est.start_ind,
                                                 self.est.end_ind))
            index = int(input("Select a timestep: "))
            self.plot_cov(index)
            plt.show()


if __name__ == "__main__":
    args = parser.parse_args()

    estimator_data = get_xivo_output_filename(args.dump,
                                              args.dataset,
                                              args.seq,
                                              cam_id=args.cam_id,
                                              sen=args.sen)

    CP = CovariancePlot(estimator_data, args.seq)
    CP.user_select_plot()
Example #3
0
)
parser.add_argument("-use_weights", default=False, action="store_true")
parser.add_argument("-cov_type", default="WTV")
args = parser.parse_args()

estimator_datafiles = []
estimators = []
test_estimators = []
test_datafiles = []

# Load data
for cam_id in [0, 1]:
    for seq in ["room1", "room2", "room3", "room4", "room5", "room6"]:

        estimator_datafile = get_xivo_output_filename(args.dump,
                                                      args.dataset,
                                                      seq,
                                                      cam_id=cam_id)
        seq_est = EstimatorData(estimator_datafile,
                                adjust_startend_to_samplecov=True)

        if seq == "room6":
            test_datafiles.append(estimator_datafile)
            test_estimators.append(seq_est)
        else:
            estimator_datafiles.append(estimator_datafile)
            estimators.append(seq_est)

weights = {}
if args.use_weights:
    weights["weightW"] = 10.
    weights["weightT"] = 10.
sigmas = [np.zeros((0, 1)) for cov_type in cov_list]
df = [state_size(cov_type) for cov_type in cov_list]

num_timesteps = 0
num_1sigma = {cov_type: np.zeros(df[k]) for k, cov_type in enumerate(cov_list)}
num_2sigma = {cov_type: np.zeros(df[k]) for k, cov_type in enumerate(cov_list)}
num_3sigma = {cov_type: np.zeros(df[k]) for k, cov_type in enumerate(cov_list)}

for cam_id in [0, 1]:
    for seq in ["room6"]:

        print("Cam {}, {}".format(cam_id, seq))

        estimator_data = get_xivo_output_filename(args.dump,
                                                  "tumvi",
                                                  seq,
                                                  cam_id=cam_id)
        gt_data = get_xivo_gt_filename(args.dump, "tumvi", seq)

        if args.cov_source == "original":
            adjust = False
        else:
            adjust = True
        calib = CovarianceCalibration(seq,
                                      gt_data,
                                      estimator_data,
                                      three_sigma=False,
                                      start_ind=0,
                                      end_ind=None,
                                      cov_type=args.cov_type,
                                      point_cloud_registration="horn",
        sigmas = np.zeros(0)

        # Get neural network name, input mode, and covariance prediction type
        with open(neural_net + ".pkl", "rb") as fid:
            net_params = pickle.load(fid)
            network_input_mode = net_params["input_mode"]
            network_cov_type = net_params["cov_type"]
            assert (network_cov_type == args.cov_type)
        neural_net_name = neural_net.split('/')[-1]

        # Collect tumvi data
        for i, cam_id in enumerate(cam_ids):
            for j, seq in enumerate(sequences):

                idx_1 = i * len(sequences) + j
                estimator_data = get_xivo_output_filename(
                    covdumpdir, "tumvi", seq, cam_id)
                gt_data = get_xivo_gt_filename(covdumpdir, "tumvi", seq)

                calib = CovarianceCalibration(
                    seq,
                    gt_data,
                    estimator_data,
                    three_sigma=False,
                    start_ind=0,
                    end_ind=None,
                    point_cloud_registration='horn',
                    plot_timesteps=False,
                    cov_type=network_cov_type,
                    adjust_startend_to_samplecov=True)
                calib.align_gt_to_est()
                calib.compute_errors()