Git Product home page Git Product logo

3d_multiview_reg's Introduction

Learning Multiview 3D Point Cloud Registration

This repository provides code and data to train and evaluate the LMPCR, the first end-to-end algorithm for multiview registration of raw point clouds in a globally consistent manner. It represents the official implementation of the paper:

*Zan Gojcic,* Caifa Zhou, Jan D. Wegner, Leonidas J. Guibas, Tolga Birdal
|EcoVision Lab ETH Zurich | Guibas Lab Stanford University|
* Equal contribution

We present a novel, end-to-end learnable, multiview 3D point cloud registration algorithm. Registration of multiple scans typically follows a two-stage pipeline: the initial pairwise alignment and the globally consistent refinement. The former is often ambiguous due to the low overlap of neighboring point clouds, symmetries and repetitive scene parts. Therefore, the latter global refinement aims at establishing the cyclic consistency across multiple scans and helps in resolving the ambiguous cases. In this paper we propose, to the best of our knowledge, the first end-to-end algorithm for joint learning of both parts of this two-stage problem. Experimental evaluation on well accepted benchmark datasets shows that our approach outperforms the state-of-the-art by a significant margin, while being end-to-end trainable and computationally less costly. Moreover, we present detailed analysis and an ablation study that validate the novel components of our approach.

LM3DPCR

Citation

If you find this code useful for your work or use it in your project, please consider citing:

@inproceedings{gojcic2020LearningMultiview,
	title={Learning Multiview 3D Point Cloud Registration},
	author={Gojcic, Zan and Zhou, Caifa and Wegner, Jan D and Guibas, Leonidas J and Birdal, Tolga},
	booktitle={International conference on computer vision and pattern recognition (CVPR)},
	year={2020}
}

Contact

If you have any questions or find any bugs, please let us know: Zan Gojcic {[email protected]}

Current state of the repository

Currently the repository contains only part of the code connected to the above mentioned publication and will be consistently updated in the course of the following days. The whole code will be available the following weeks.

NOTE: The published model is not the same as the model used in the CVPR paper. The results can therefore slightly differ from the ones in the paper. The models will be updated in the following days (with the fully converged ones).

Instructions

The code was tested on Ubuntu 18.04 with Python 3.6, pytorch 1.5, CUDA 10.1.243, and GCC 7.

Requirements

After cloning this repository, you can start by creating a virtual environment and installing the requirements by running:

conda create --name lmpr python=3.6
source activate lmpr
conda config --append channels conda-forge
conda install --file requirements.txt
conda install -c open3d-admin open3d=0.9.0.0
conda install -c intel scikit-learn
conda install pytorch torchvision cudatoolkit=10.1 -c pytorch

Our network uses FCGF feature descriptor which is based on the MinkowskiEnginge library for sparse tensors. In order to install Minkowski Engine run:

source activate lmpr
git clone https://github.com/StanfordVL/MinkowskiEngine.git
cd MinkowskiEngine
conda install numpy mkl-include
export CXX=g++-7; python setup.py install
cd ../

Finally, our network supports furthest point sampling, when sampling the interest points. To this end we require the PointNet++ library that can be installed as follows:

source activate lmpr
git clone https://github.com/erikwijmans/Pointnet2_PyTorch.git
cd Pointnet2_PyTorch
pip install -r requirements.txt
cd ../

Pretrained models

We provide the pretrained models for FCGF feature descriptor, our pairwise registration block, and jointly trained pairwise registration model. They can be downloaded using:

bash scripts/download_pretrained_models.sh

Datasets

Pairwise registration

In order to train the pairwise registration model, you have to download the full 3DMatch dataset. To (pre)-train the registration blocks you can either download the preprocessed dataset (~160GB) using

bash scripts/download_3DMatch_train.sh preprocessed

This dataset contains the pointwise correspondences established in the FCGF feature space for all point cloud pairs of 3DMatch dataset.

We also provide the raw 3DMatch data (~4.5GB) and a script to generate the preprocess training data ./scripts/extract_data.py that can be used either with the raw 3DMatch data or your personal dataset. The raw dataset can be downloaded using

bash scripts/download_3DMatch_train.sh raw

And then processed (extract FCGF feature descriptors, establish the correspondences, and save training data) using:

source activate lmpr
python ./scripts/extract_data.py \
			--source_path ./data/train_data/ \
			--target_path ./data/train_data/ \
			--dataset 3d_match \
			--model ./pretrained/fcgf/model_best.pth \
			--voxel_size 0.025 \
			--n_correspondences 20000 \
			--inlier_threshold 0.05 \
			--extract_features \
			--extract_correspondences \
			--extract_precomputed_training_data \
			--with_cuda \

bash scripts/download_preprocessed_3DMatch.sh

Training

Current release supports only training the pairwise registration network. The repository will be further updated in the next weeks. In order to train the pairwise registration network from scratch using the precomputed data run

source activate lmpr
python train.py ./configs/pairwise_registration/OANet.yaml

The training parameters can be set in ./configs/pairwise_registration/OANet.yaml.

In order to fine tune the pairwise registration network in an end-to-end manner (including the FCGF block), the raw data has to be used. The code to sample the batches will be released in the next weeks.

Evaluation

We provide the scripts for the automatic evaluation of our method on the 3DMatch and Redwood dataset. The results for our method can differ slightly from the results in the CVPR paper as we have retrained the model. Due to the different implementation the results for RANSAC might also differ slightly from the results of the official evaluation script.

3DMatch

To evaluate on 3DMatch you can either download the raw evaluation data (~450MB) using

bash scripts/download_3DMatch_eval.sh raw

or the processed data together with the results for our method and RANSAC (~2.7GB) using

bash scripts/download_3DMatch_eval.sh preprocessed

If you download the raw data you first have to process it (extract features and correspondences)

source activate lmpr
python ./scripts/extract_data.py \
			--source_path ./data/eval_data/ \
			--target_path ./data/eval_data/ \
			--dataset 3d_match \
			--model ./pretrained/fcgf/model_best.pth \
			--voxel_size 0.025 \
			--n_correspondences 5000 \
			--extract_features \
			--extract_correspondences \
			--with_cuda \

Then you can run the pairwise registration evaluation using our RegBlock (with all points) as

source activate lmpr
python ./scripts/benchmark_pairwise_registration.py \
		--source ./data/eval_data/ \
		--dataset 3d_match \
		--method RegBlock \
		--model ./pretrained/RegBlock/model_best.pt \
		--only_gt_overlap \

This script assumes that the correspondences were already estimated using ./scripts/extract_data.py and only benchmarks the registration algorithms. To improve efficiency the registration parameters will only be computed for the ground truth overlapping pairs, when the flag --only_gt_overlap is set. This does not change the registration recall, which is used as the primary evaluation metric. In order to run the estimation on all n choose 2 pairs simply omit the --only_gt_overlap (results in ~10 times longer computation time on 3DMatch dataset)

Redwood

To evaluate the generalization performance of our method on redwood you can again either download the raw evaluation data (~1.3GB) using

bash scripts/download_redwood_eval.sh raw

or the processed data together with the results for our method and RANSAC (~2.9GB) using

bash scripts/download_redwood_eval.sh preprocessed

The rest of the evaluation follow the same procedure as for 3DMatch, you simply have to replace the dataset argument with --dataset redwood

NOTE: Using the currently provided model the performance is slightly worse then reported in the paper. The model will be updated in the following days.

Demo

Pairwise registration demo can be run after downloading the pretrained models as

source activate lmpr
python ./scripts/pairwise_demo.py \
		./configs/pairwise_registration/demo/config.yaml \
		--source_pc ./data/demo/pairwise/raw_data/cloud_bin_0.ply \
		--target_pc ./data/demo/pairwise/raw_data/cloud_bin_1.ply \
		--model pairwise_reg.pt \
		--verbose \
		--visualize

which will register the two point clouds, visualize them before and after the registration, and save the estimated transformation parameters.

3d_multiview_reg's People

Contributors

tolgabirdal avatar zgojcic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

3d_multiview_reg's Issues

shape mismatch

When I run ./scripts/extract_data.py, I got the error:
IndexError: shape mismatch: indexing arrays could not be broadcast together with shapes (201306,3) (201306,)

Processing of Scannet dataset

Hi, I would like to have further information about the Scannet dataset you used for the multiview experiments.

  1. Do you have a list of frames used for the evaluation?
  2. Are the settings for pairwise matching the same as what is provided in that used by pairwise_demo.py? Also, it possible to provide the pairwise transformations used?

Thanks!

TypeError: __init__() got an unexpected keyword argument 'has_bias'

Today, I have face a problem about TyperError as follow when I run ‘python3 ./scripts/pairwise_demo.py ./configs/pairwise_registration/demo/config.yaml --source_pc ./data/demo/pairwise/raw_data/cloud_bin_0.ply --target_pc ./data/demo/pairwise/raw_data/cloud_bin_1.ply --model pairwise_reg.pt --verbose --visualize’。
"""
File "/home/wyu/WORKS/PycharmProjects/pythonProject/3D_multiview_reg/lib/descriptor/fcgf.py", line 125, in init
dimension=D)
TypeError: init() got an unexpected keyword argument 'has_bias'
"""
Please help me, thanks.

Questions for building environment for project

Hello, thanks for the current release.however, following questions happened: python: can't open file 'setup.py': [Errno 2] No such file or directory, when exporting 'CXX=g++-7; python setup.py install'.How can i solve this problem?

color information in the descriptor

Currently, only the coord info are used for training to generate the descriptor, did you also try to include the color information, i think it should be helpful in some difficult case also

Multiview registration

Hi,

thanks for sharing your code ! Am I under the correct assumption that the current state of the repo does not support multiview registration but only pairwise registration ?

It would also be nice if you could provide some demo code to test registration performance with point clouds from custom images.

Thanks for any information
Alexander

Threshold for losses different than original FCGF

Hi, you state that you keep the FCGF parameters the same as in the original paper. In your code positive and negative thresholds for contrastive_hardest_negative_loss are like this.

# For FCGF loss we keep the parameters the same as in the original paper

self.pos_thresh = 1.4
self.neg_thresh = 0.1

However in original FCGF code default threshold parameters are opposite. https://github.com/chrischoy/FCGF/blob/f0863a9ba4a29f677c0ddd2248cf4e56b9318add/config.py#L34

trainer_arg.add_argument('--neg_thresh', type=float, default=1.4)
trainer_arg.add_argument('--pos_thresh', type=float, default=0.1)

Did you use your parameters to train FCGF descriptor? If it is a design choice could you elaborate more?

Thank you!

Point cloud generation

Hey,

Thank you for your great work! Could you tell a bit more about the ScanNet evaluation?

  1. Did you generate each point cloud from a single RGBD frame?
  2. In the evaluation of ScanNet, how did you decide which frames to choose?

Best,
Zhengdi

How well does it generalize?

I'm currently trying out your method with scans of a foot.
Unfortunately it's not really working yet and I played around with different voxel sizes and different scans.

In terms of dimension and surface characteristics it's quite different compared to the office datasets used for training. So I'm not completely surprised that it doesn't work out of the box.

Do you think that this is to be expected? Would training be the only way to solve my problem here or are there maybe other things that I didn't consider yet? Would you expect an improvement with the multiview part? I'm currently considering 3-4 scans of a foot from different perspectives, so overlap is not huge here...

Please let me know it you need some scans or if this question is not appropriate here!

Docker Guide

Thank you for the sharing the wonderful work.

Is there any way to create dockerfile for the environment?

Since the the repos that are used keep changing the support version?

Questions for Datasets

Hi,
When I run the "bash scripts/download_3DMatch_train.sh preprocessed" and "bash scripts/download_3DMatch_train.sh raw"

I get this error.

Connectingtoshare.phys.ethz.ch(share.phys.ethz.ch)|129.132.80.27|:443... connected HTTP request sent, awaiting response... 403 Forbidden
2023-03-20 16:21:34 ERR0R 403: Forbidden.

unzip:cannot findoropen3dmatch raw.zip,3d match raw.zip.zip or 3d match raw.zip.ZIP rm:cannot remove '3d match raw.zip': No such file or directory

What is the reason of this?

Best Regards

Inputs must be sparse tensors when processing raw eval data

Hi!
Thanks for sharing your very promising work!

I'm trying to follow your instructions to download and process (feature extraction) your evaluation data.
However when calling extract_data.py as in your example, I'm getting the following output:

2020-07-13 15:09:05 824982bf9848 root[13462] INFO Starting feature extraction
2020-07-13 15:09:05 824982bf9848 root[13462] INFO ['./data/eval_data/3d_match/raw_data/kitchen', './data/eval_data/3d_match/raw_data/sun3d-home_at-home_at_scan1_2013_jan_1', './data/eval_data/3d_match/raw_data/sun3d-home_md-home_md_scan9_2012_sep_30', './data/eval_data/3d_match/raw_data/sun3d-hotel_uc-scan3', './data/eval_data/3d_match/raw_data/sun3d-hotel_umd-maryland_hotel1', './data/eval_data/3d_match/raw_data/sun3d-hotel_umd-maryland_hotel3', './data/eval_data/3d_match/raw_data/sun3d-mit_76_studyroom-76-1studyroom2', './data/eval_data/3d_match/raw_data/sun3d-mit_lab_hj-lab_hj_tea_nov_2_2012_scan1_erika']
2020-07-13 15:09:05 824982bf9848 root[13462] INFO 0 / 60: kitchen_000
/content/drive/My Drive/Dev/DL/colab_data/3D_multiview_reg/scripts/utils.py:118: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).
  coords = torch.tensor(coords, dtype=torch.int32)

Traceback (most recent call last):
  File "./scripts/extract_data.py", line 363, in <module>
    logger.info('Feature extraction completed')
  File "./scripts/extract_data.py", line 88, in extract_features_batch
    
  File "/content/drive/My Drive/Dev/DL/colab_data/3D_multiview_reg/scripts/utils.py", line 125, in extract_features
    return return_coords, model(stensor).F
  File "/usr/local/envs/lmpr/lib/python3.6/site-packages/torch/nn/modules/module.py", line 550, in __call__
    result = self.forward(*input, **kwargs)
  File "/content/drive/My Drive/Dev/DL/colab_data/3D_multiview_reg/lib/descriptor/fcgf.py", line 257, in forward
    out = ME.cat((out_s4_tr, out_s4))
  File "/usr/local/envs/lmpr/lib/python3.6/site-packages/MinkowskiEngine-0.4.3-py3.6-linux-x86_64.egg/MinkowskiEngine/MinkowskiOps.py", line 67, in cat
    assert isinstance(s, SparseTensor), "Inputs must be sparse tensors."
AssertionError: Inputs must be sparse tensors.

Do you have an idea why I'm seeing this or am I missing something?

Problem with dataset.

Hello author,because of the network,I can't use your script files to download the dataset.So I download it from the 3DMatch(http://3dmatch.cs.princeton.edu/).However I noticed that the extract_data.py will need .ply file.And I can only get .png file.So is that mean I should get the some .ply files like the raw pointcloud.Then I can use extract_data.py to get some attribute like features,etc.

Question on new release of the multiview 3D point cloud registration part

Hello, thanks for the current release. I have finished the demo part and got a perfect pairwise registration result. But the current release only supports training the pairwise registration network, and is it possible to update the new release on the multiview 3D point cloud registration part not only for the pairwise?

Key Error

Hi,
When I use my data-set (extract_data.py) ,

python ./scripts/extract_data.py
--source_path ./data/train_data/
--target_path ./data/train_data/
--dataset 3d_match
--model ./pretrained/fcgf/model_best.pth
--voxel_size 0.025
--n_correspondences 20000
--inlier_threshold 0.05
--extract_features
--extract_correspondences
--extract_precomputed_training_data
--with_cuda \

it creates "correspond and features" but afterwards I get this error.

Traceback (most recent call last):
File "./scripts/extract_data.py", line 373, in
args.target_path, args.inlier_threshold, args.voxel_size)
File "./scripts/extract_data.py", line 254, in extract_precomputed_training_data
xs = data['xs']
File "/usr/local/lib/python3.6/dist-packages/numpy/lib/npyio.py", line 266, in getitem
raise KeyError("%s is not a file in the archive" % key)
KeyError: 'xs is not a file in the archive'

What is the reason of this?

Best Regards

IndexError

when I run 3DMatch
python ./scripts/benchmark_pairwise_registration.py
--source ./data/eval_data/
--dataset 3d_match
--method RegBlock
--model ./pretrained/RegBlock/model_best.pt
--only_gt_overlap \

I get the following error
File "./scripts/benchmark_pairwise_registration.py", line 421, in
evaluate_registration_performance(eval_data,
File "./scripts/benchmark_pairwise_registration.py", line 313, in evaluate_registration_performance
ext_traj_est, ext_traj_gt = extract_corresponding_trajectors(est_pairs,gt_pairs,est_traj, gt_traj)
File "/home/san/Desktop/3D_multiview_reg-master/lib/utils.py", line 514, in extract_corresponding_trajectors
est_pairs = est_pairs[:,0:2]
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

What is problem?

Best Regards

Result of the pointcloud after registration

Hello author,I have train the model and get the model_best.pt. And I try to eval it.However I can't see the result about the pointcloud file after registration like .ply. So I want to know how can I see the result in paper like the globally aligned point clouds
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.