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

[Feature] Support visualization and browse_dataset on nuScenes Mono-3D dataset #542

Merged
merged 15 commits into from
May 26, 2021

Conversation

Wuziyi616
Copy link
Contributor

@Wuziyi616 Wuziyi616 commented May 14, 2021

As NuScenesMonoDataset inherits from 2D CocoDataset, to be coherent with the visualization setting in MMDet3D:

  • I add eval_pipeline for its config file
  • I add some functions to NuScenesMonoDataset to support data loading in visualization (e.g. _extract_data) following Custom3DDataset
  • In order to correctly visualize the mono boxes, I add a hacking function to mmdet3d/core/bbox/structures/utils.py named mono_cam_box2vis

To support Mono-3D in browse_dataset, I let users specify the task of the dataset instead of inferring from config (which is troublesome).

Since we don't have kitti mono config in the current codebase, I didn't test the code on it. But I believe it will work well as KittiMono inherits from NusMono.

@Wuziyi616 Wuziyi616 added the WIP label May 14, 2021
@Wuziyi616 Wuziyi616 requested a review from Tai-Wang May 14, 2021 02:51
@codecov
Copy link

codecov bot commented May 14, 2021

Codecov Report

Merging #542 (949f1a8) into master (b3a6346) will increase coverage by 0.07%.
The diff coverage is 59.11%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #542      +/-   ##
==========================================
+ Coverage   50.77%   50.85%   +0.07%     
==========================================
  Files         197      197              
  Lines       14923    15038     +115     
  Branches     2426     2445      +19     
==========================================
+ Hits         7577     7647      +70     
- Misses       6851     6885      +34     
- Partials      495      506      +11     
Flag Coverage Δ
unittests 50.85% <59.11%> (+0.07%) ⬆️

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

Impacted Files Coverage Δ
mmdet3d/apis/__init__.py 100.00% <ø> (ø)
mmdet3d/core/bbox/__init__.py 100.00% <ø> (ø)
mmdet3d/datasets/kitti_dataset.py 74.90% <ø> (ø)
mmdet3d/datasets/sunrgbd_dataset.py 74.71% <ø> (ø)
mmdet3d/models/detectors/single_stage_mono3d.py 16.48% <25.00%> (+1.20%) ⬆️
mmdet3d/apis/test.py 15.78% <33.33%> (-0.43%) ⬇️
mmdet3d/apis/inference.py 53.62% <36.58%> (-5.58%) ⬇️
mmdet3d/datasets/nuscenes_mono_dataset.py 38.43% <65.45%> (+5.10%) ⬆️
mmdet3d/core/visualizer/show_result.py 66.38% <66.66%> (-0.57%) ⬇️
mmdet3d/core/visualizer/image_vis.py 74.07% <95.00%> (+15.45%) ⬆️
... and 2 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 b3a6346...949f1a8. Read the comment docs.

@Wuziyi616
Copy link
Contributor Author

Some examples:
n008-2018-08-01-15-16-36-0400__CAM_BACK__1533151603537558_pred
n008-2018-08-01-15-16-36-0400__CAM_BACK__1533151603537558_gt
n015-2018-07-24-11-22-45+0800__CAM_BACK__1532402927637525_pred
n015-2018-07-24-11-22-45+0800__CAM_BACK__1532402927637525_gt

docs/0_demo.md Outdated Show resolved Hide resolved
docs/useful_tools.md Outdated Show resolved Hide resolved
mmdet3d/core/bbox/structures/utils.py Outdated Show resolved Hide resolved
mmdet3d/core/visualizer/image_vis.py Show resolved Hide resolved
mmdet3d/core/visualizer/image_vis.py Outdated Show resolved Hide resolved
mmdet3d/core/visualizer/image_vis.py Outdated Show resolved Hide resolved
mmdet3d/core/visualizer/image_vis.py Outdated Show resolved Hide resolved
@yezhen17
Copy link
Collaborator

Please solve the conflicts.


def mono_cam_box2vis(cam_box):
"""This is a post-processing function on the bboxes from Mono-3D task. If
we want to perform projection visualization, we need to:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is mainly because Nus 3D boxes have three rotation angles (yaw, pitch, roll), but we assume the later two are \pi / 2 and 0 and only predict yaw.

@@ -56,46 +56,31 @@ def project_pts_on_img(points,
cv2.waitKey(100)


def project_bbox3d_on_img(bboxes3d,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I remove this function as it is not used in the codebase. Its name is very ambiguous since we already have project_camera/lidar/depth_bbox now. Also it works almost the same as draw_lidar_bbox3d_on_img.

return results_dict

def show(self, results, out_dir):
@staticmethod
def _get_data(results, key):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In other 3D datasets, we have these functions to enable data loading from eval_pipeline. However, as NusMono inherited from 2D datasets, I have to duplicate these functions here. Kind of ugly I think.

Copy link
Member

Choose a reason for hiding this comment

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

Can we move it out of a specific class as a single utilized function if most of them in different classes are very similar?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Will do this in a new PR.

help='Whether to visualize multi-modality data. If True, we will show '
'both 3D point clouds with 3D bounding boxes and 2D images with '
'projected bounding boxes.')
'--task',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I let user specify the task here.

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 now @Tai-Wang.

docs/0_demo.md Outdated Show resolved Hide resolved
Copy link
Member

@Tai-Wang Tai-Wang left a comment

Choose a reason for hiding this comment

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

Can we further compress the browse_dataset_mono.png (mainly because the resolution of nuScenes is a little high), which almost has a similar size with demo videos

@Wuziyi616
Copy link
Contributor Author

Can we further compress the browse_dataset_mono.png (mainly because the resolution of nuScenes is a little high), which almost has a similar size with demo videos

Done.

@ZwwWayne ZwwWayne merged commit c81426a into open-mmlab:master May 26, 2021
@Wuziyi616 Wuziyi616 deleted the mono_vis_demo branch May 26, 2021 06:36
tpoisonooo pushed a commit to tpoisonooo/mmdetection3d that referenced this pull request Sep 5, 2022
* Add mmrotate regression test

* update regression test script
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.

4 participants