Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhance] Move ScanNet point alignment from data pre-processing to pipeline #439

Merged
merged 12 commits into from
May 11, 2021

Conversation

Wuziyi616
Copy link
Contributor

In the original ScanNet pre-processing script for the detection task, the point cloud scene is aligned according to axis_align_matrix in the annotation (see here). However, ScanNet test set doesn't have such alignment matrix, so people don't do such alignment in the semantic segmentation task (because they need to submit the test set results to online benchmark, while det only test and reports on val set). In order for ScanNet seg and set to share one pre-processed data, we decided to move the alignment step to pipeline.

@Wuziyi616
Copy link
Contributor Author

Wuziyi616 commented Apr 13, 2021

  • Modify ScanNet pre-processing scripts to save the axis_align_matrix to data_info.pkl
  • Support Box.rotate function when input is angle or rotation_matrix, add unittest for it
  • Add GlobalAlignment function to pipeline, which supports align points by affine transformation
  • Modify ScanNetDataset to support axis_align_matrix loading, modify ScanNet config file
  • Modify show function to support pipeline usage

@codecov
Copy link

codecov bot commented Apr 13, 2021

Codecov Report

Merging #439 (43c8453) into master (3640070) will increase coverage by 0.57%.
The diff coverage is 88.88%.

❗ Current head 43c8453 differs from pull request most recent head a9cc7fd. Consider uploading reports for the commit a9cc7fd to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master     #439      +/-   ##
==========================================
+ Coverage   50.66%   51.24%   +0.57%     
==========================================
  Files         189      187       -2     
  Lines       14455    13857     -598     
  Branches     2366     2243     -123     
==========================================
- Hits         7324     7101     -223     
+ Misses       6638     6280     -358     
+ Partials      493      476      -17     
Flag Coverage Δ
unittests 51.24% <88.88%> (+0.57%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
mmdet3d/core/points/base_points.py 82.28% <ø> (+1.14%) ⬆️
mmdet3d/datasets/scannet_dataset.py 87.61% <38.46%> (-6.95%) ⬇️
mmdet3d/core/bbox/structures/base_box3d.py 75.00% <100.00%> (ø)
mmdet3d/core/bbox/structures/cam_box3d.py 77.23% <100.00%> (+4.58%) ⬆️
mmdet3d/core/bbox/structures/depth_box3d.py 84.09% <100.00%> (+0.75%) ⬆️
mmdet3d/core/bbox/structures/lidar_box3d.py 84.21% <100.00%> (+1.06%) ⬆️
mmdet3d/datasets/__init__.py 100.00% <100.00%> (ø)
mmdet3d/datasets/pipelines/__init__.py 100.00% <100.00%> (ø)
mmdet3d/datasets/pipelines/transforms_3d.py 87.29% <100.00%> (+0.36%) ⬆️
mmdet3d/models/detectors/fcos_mono3d.py 83.33% <0.00%> (-16.67%) ⬇️
... and 26 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3640070...a9cc7fd. Read the comment docs.

@Wuziyi616 Wuziyi616 added the WIP label Apr 14, 2021
@Wuziyi616 Wuziyi616 changed the title [Enhance] Move ScanNet point alignment from data pre-processing to pipeline [WIP] [Enhance] Move ScanNet point alignment from data pre-processing to pipeline Apr 15, 2021
@Wuziyi616 Wuziyi616 linked an issue Apr 16, 2021 that may be closed by this pull request
@Wuziyi616
Copy link
Contributor Author

Wuziyi616 commented Apr 20, 2021

After discussing with Wenwei @ZwwWayne, we decided to extract both aligned and unaligned_bbox during pre-processing of ScanNet dataset. For the aligned bbox, they are stored in info with the same key as before (e.g. gt_boxes_upright_depth, dimension), while for the unaligned bbox, they are stored with unaligned_ marked keys (e.g. unaligned_gt_boxes_upright_depth).

As aligned bbox are stored with the same keys, we can keep most of the code unchanged (e.g. dataset.evaluate()). If we would like to support 3D instance segmentation on ScanNet in the future, we will need the unaligned_bbox infos.

@Wuziyi616
Copy link
Contributor Author

Wuziyi616 commented Apr 20, 2021

I have checked the correctness of processed data by testing a pre-trained VoteNet on it and got mAP_25, mAP_50 close to the originally reported values (<1%). I think the data is OK to use. The visualization is also correct.

@Wuziyi616 Wuziyi616 force-pushed the scannet_align_point branch 2 times, most recently from 4ad1a51 to 957a838 Compare April 20, 2021 13:43
Copy link
Contributor Author

@Wuziyi616 Wuziyi616 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this PR is ready for review. @Tai-Wang @ZwwWayne Thanks.

@Wuziyi616 Wuziyi616 removed the WIP label Apr 21, 2021
@@ -197,9 +219,6 @@ def _convert_to_label(self, mask):
mask = np.load(mask)
else:
mask = np.fromfile(mask, dtype=np.long)
# first filter out unannotated points (labeled as 0)
mask = mask[mask != 0]
# then convert to [0, 20) labels
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove these lines to be consistent with data pre-processing steps.

@Wuziyi616
Copy link
Contributor Author

Wuziyi616 commented May 8, 2021

I have trained a VoteNet on the new processed ScanNet data. The results are as follows:

Data AP@0.25 AP@0.5
Old 62.90 39.91
New 62.35 40.59

I think this result is very close to original training behavior.

@ZwwWayne ZwwWayne merged commit 83b3c38 into open-mmlab:master May 11, 2021
@Wuziyi616 Wuziyi616 deleted the scannet_align_point branch May 11, 2021 13:45
@Wuziyi616 Wuziyi616 restored the scannet_align_point branch May 11, 2021 13:47
@Wuziyi616 Wuziyi616 deleted the scannet_align_point branch May 11, 2021 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Point cloud alignment in data loading pipeline
3 participants