示例#1
0
    training_sampler.calibration(training_loader, verbose=True)
    test_sampler.calibration(test_loader, verbose=True)

    # Optional debug functions
    # debug_timing(training_dataset, training_loader)
    # debug_timing(test_dataset, test_loader)
    # debug_upsampling(training_dataset, training_loader)

    print('\nModel Preparation')
    print('*****************')

    # Define network model
    t1 = time.time()
    net = KPFCNN(config, training_dataset.label_values,
                 training_dataset.ignored_labels)
    net = nn.DataParallel(net.cuda())
    # net = net.cuda()

    debug = False
    if debug:
        print('\n*************************************\n')
        print(net)
        print('\n*************************************\n')
        for param in net.parameters():
            if param.requires_grad:
                print(param.shape)
        print('\n*************************************\n')
        print("Model size %i" %
              sum(param.numel()
                  for param in net.parameters() if param.requires_grad))
        print('\n*************************************\n')
示例#2
0
        dset = KITTIMapDataset("test",
                               cfg,
                               config_d3feat=config,
                               root=config.root)
        # dset = ThreeDMatchTestset(root=config.root,
        #                    downsample=config.downsample,
        #                    config=config,
        #                    last_scene=False,
        #                )
        dloader, _ = get_dataloader(
            dataset=dset,
            batch_size=1,
            shuffle=False,
            num_workers=config.num_workers,
        )
        generate_features(model.cuda(), dloader, config, args.chosen_snapshot)

    def test_kitti(model, dataset, config):
        # self.sess.run(dataset.test_init_op)
        import sys
        use_random_points = False
        icp_save_path = "d3feat_output"
        if use_random_points:
            num_keypts = 5000
            # icp_save_path = f'geometric_registration_kitti/D3Feat_{self.experiment_str}-rand{num_keypts}'
        else:
            num_keypts = 250
            # icp_save_path = f'geometric_registration_kitti/D3Feat_{self.experiment_str}-pred{num_keypts}'
        if not os.path.exists(icp_save_path):
            os.mkdir(icp_save_path)
    # Calibrate samplers
    training_sampler.calibration(training_loader, verbose=True)
    test_sampler.calibration(test_loader, verbose=True)

    # debug_timing(training_dataset, training_loader)
    # debug_timing(test_dataset, test_loader)
    # debug_class_w(training_dataset, training_loader)

    print('\nModel Preparation')
    print('*****************')

    # Define network model
    t1 = time.time()
    net = KPFCNN(config, training_dataset.label_values,
                 training_dataset.ignored_labels)
    net = torch.nn.DataParallel(net.cuda())
    debug = False
    if debug:
        print('\n*************************************\n')
        print(net)
        print('\n*************************************\n')
        for param in net.parameters():
            if param.requires_grad:
                print(param.shape)
        print('\n*************************************\n')
        print("Model size %i" %
              sum(param.numel()
                  for param in net.parameters() if param.requires_grad))
        print('\n*************************************\n')

    # Define a trainer class