Esempio n. 1
0
    # Save results
    filename = f'3dmatch-stats_{method.__class__.__name__}'
    if os.path.isdir(config.out_dir):
        out_file = os.path.join(config.out_dir, filename)
    else:
        out_file = filename  # save it on the current directory
    print(f'Saving the stats to {out_file}')
    np.savez("./result.txt", stats=stats, names=method_names)
    analyze_stats(stats, mask, method_names)


if __name__ == '__main__':
    config = get_config()
    print(config)

    dgr = DeepGlobalRegistration(config)

    methods = [dgr]
    method_names = ['ATOO']

    path = "/data/xiaoshua/will/cross-source-dataset/"

    dset = CrosssourceDataset(path)
    data_loader = torch.utils.data.DataLoader(dset,
                                              batch_size=1,
                                              shuffle=False,
                                              collate_fn=lambda x: x,
                                              pin_memory=False,
                                              drop_last=True)

    evaluate(methods, method_names, data_loader, config, debug=True)
                  "ResUNetBN2C-feat32-3dmatch-v0.05.pth")]

# Check if the weights and file exist and download
if not os.path.isfile('redkitchen_000.ply'):
    print('Downloading weights and pointcloud files...')
    for f in DOWNLOAD_LIST:
        print(f"Downloading {f}")
        urlretrieve(f[0] + f[1], f[1])

if __name__ == '__main__':
    config = get_config()
    if config.weights is None:
        config.weights = DOWNLOAD_LIST[-1][-1]

    # preprocessing
    pcd0 = o3d.io.read_point_cloud(config.pcd0)
    pcd0.estimate_normals()
    pcd1 = o3d.io.read_point_cloud(config.pcd1)
    pcd1.estimate_normals()

    # registration
    dgr = DeepGlobalRegistration(config)
    T01 = dgr.register(pcd0, pcd1)

    o3d.visualization.draw_geometries([pcd0, pcd1])

    pcd0.transform(T01)
    print(T01)

    o3d.visualization.draw_geometries([pcd0, pcd1])