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

Label visualization #1050

Merged
merged 7 commits into from
Dec 1, 2021
Merged

Conversation

MilkClouds
Copy link
Contributor

@MilkClouds MilkClouds commented Nov 14, 2021

Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.

Motivation

Please describe the motivation of this PR and the goal you want to achieve through this PR.

At first, I wanted to visualize result of object detection for group free 3d(including colorization for label)
After I knew there's somewhat problem in overall mmdetection3d visualization process, I fixed some

Modification

Please briefly describe what modification is made in this PR.

Added show, score_thr argument to mmdet3d/apis/test.py/single_gpu_test, and basic 3 model of mmdetection3d
Added colorization for lable on show_result function
Since I only know a little about detector model among basic 3 model, I simply added show and score_thr and didn't used score_thr argument except detector base model(I've fully implemented show, score_thr only on detector base model). I expect someone else implement feature about this.

BC-breaking (Optional)

Does the modification introduce changes that break the back-compatibility of the downstream repos?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.

Use cases (Optional)

If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.

You can see colorized(depend on label) when execute test.py with --show option
Example) python tools/test.py configs/groupfree3d/groupfree3d_8x4_scannet-3d-18class-w2x-L12-O512.py \ checkpoints/groupfree3d_8x4_scannet-3d-18class-w2x-L12-O512_20210702_220204-187b71c7.pth \ --show --show-dir ./data/scannet/show_results

Also I removed bounding boxes with low confidence, using score_thr

ScreenCapture

Checklist

  1. Pre-commit or other linting tools are used to fix the potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  3. If the modification has potential influence on downstream projects, this PR should be tested with downstream projects.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

@CLAassistant
Copy link

CLAassistant commented Nov 14, 2021

CLA assistant check
All committers have signed the CLA.

@MilkClouds
Copy link
Contributor Author

since I'm trying pre-commit, please wait a while..

else:
palette = np.random.randint(
0, 255, size=(pred_labels.max() + 1, 3)) / 256
S = {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

S -> str_labels

S[i].append(pred_bboxes[j])
for i in S:
vis.add_bboxes(
bbox3d=np.array(S[i]),
Copy link
Collaborator

Choose a reason for hiding this comment

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

A little bit confused with S. If it is from label, why it is passed to bbox3d?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

S is a dictionary, which key is lable and value is list of bounding boxes corresponding to label.
Since I've revised a scripts, please check again.

@@ -60,7 +60,7 @@ def forward(self, return_loss=True, **kwargs):
else:
return self.forward_test(**kwargs)

def show_results(self, data, result, out_dir):
def show_results(self, data, result, out_dir, show=False, score_thr=0.3):
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to update docstring for show and score_thr. Besides, please kindly explain why set the default value of score_thr to 0.3. Or why not just set score_dir to -1 or None to show all results by default for bc-breaking?

Copy link
Collaborator

Choose a reason for hiding this comment

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

we need to avoid BC-breaking

Copy link
Contributor Author

Choose a reason for hiding this comment

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

value 0.3 of score_thr is from mmdetection3d\mmdet3d\apis\test.py\single_gpu_test's default parameter show_score_thr. I've revised score_thr of detectors/base.py default value to None.

@@ -89,6 +90,7 @@ def show_result(points,
filename (str): Filename of the current frame.
show (bool): Visualize the results online. Defaults to False.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please update the docstring for show, snapshot, and pred_labels with optional sign after the variable type.

For example:
show (bool, optional): ... ....

@@ -178,7 +178,7 @@ def aug_test(self, imgs, img_metas, rescale=False):

return [bbox_list]

def show_results(self, data, result, out_dir):
def show_results(self, data, result, out_dir, show=False, score_thr=None):
"""Results visualization.

Args:
Copy link
Contributor

@wHao-Wu wHao-Wu Nov 24, 2021

Choose a reason for hiding this comment

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

Please also update the docstring here for show and score_thr.

ignore_index=None):
ignore_index=None,
show=False,
score_thr=None):
"""Results visualization.

Args:
Copy link
Contributor

@wHao-Wu wHao-Wu Nov 24, 2021

Choose a reason for hiding this comment

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

Please also update the docstring here for show and score_thr.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated all docstring.

@ZwwWayne ZwwWayne merged commit f84a17b into open-mmlab:master Dec 1, 2021
@Tai-Wang Tai-Wang mentioned this pull request Jun 5, 2022
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