Skip to content

Conversation

Pzzzzz5142
Copy link

@Pzzzzz5142 Pzzzzz5142 commented Dec 30, 2022

Motivation

Add InstanceSegMetric to MMEval

pr in mmdetection3d: openmmlab/mmdetection3d

Modification

  • mmeval/metrics/instance_seg.py
  • mmeval/metrics/_vendor/scannet/README.md
  • mmeval/metrics/_vendor/scannet/init.py
  • mmeval/metrics/_vendor/scannet/evaluate_semantic_instance.py
  • mmeval/metrics/_vendor/scannet/util_3d.py
  • tests/test_metrics/test_instance_seg.py

@CLAassistant
Copy link

CLAassistant commented Dec 30, 2022

CLA assistant check
All committers have signed the CLA.

- pts_semantic_mask(numpy.ndarray): Ground truth semantic masks.
"""
for prediction, groundtruth in zip(predictions, groundtruths):
self._results.append((deepcopy(prediction), deepcopy(groundtruth)))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why we need deepcopy~

Copy link
Author

@Pzzzzz5142 Pzzzzz5142 Jan 5, 2023

Choose a reason for hiding this comment

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

If we don't use deepcopy, the metric itself will change the value of the tensor inplace which may cause confusion.

@Pzzzzz5142 Pzzzzz5142 requested a review from ice-tong January 17, 2023 06:02
Comment on lines 161 to 172
gt_semantic_masks = []
gt_instance_masks = []
pred_instance_masks = []
pred_instance_labels = []
pred_instance_scores = []

for result_pred, result_gt in results:
gt_semantic_masks.append(result_gt['pts_semantic_mask'])
gt_instance_masks.append(result_gt['pts_instance_mask'])
pred_instance_masks.append(result_pred['pts_instance_mask'])
pred_instance_labels.append(result_pred['instance_labels'])
pred_instance_scores.append(result_pred['instance_scores'])
Copy link
Collaborator

Choose a reason for hiding this comment

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

A suggestion that simplify the code~

Suggested change
gt_semantic_masks = []
gt_instance_masks = []
pred_instance_masks = []
pred_instance_labels = []
pred_instance_scores = []
for result_pred, result_gt in results:
gt_semantic_masks.append(result_gt['pts_semantic_mask'])
gt_instance_masks.append(result_gt['pts_instance_mask'])
pred_instance_masks.append(result_pred['pts_instance_mask'])
pred_instance_labels.append(result_pred['instance_labels'])
pred_instance_scores.append(result_pred['instance_scores'])
gt_semantic_masks = [gt['pts_semantic_mask'] for _, gt in results]
gt_instance_masks = [gt['pts_instance_mask'] for _, gt in results]
pred_instance_masks = [pred['pts_instance_mask'] for pred, _ in results]
pred_instance_labels = [pred['instance_labels'] for pred, _ in results]
pred_instance_scores = [pred['instance_scores'] for pred, _ in results]

Copy link
Author

Choose a reason for hiding this comment

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

In this way, we would do 5 for loops, which may be time consuming.

Comment on lines 21 to 32
Example:
>>> import numpy as np
>>> from mmeval import InstanceSegMetric
>>> seg_valid_class_ids = (3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 24,
>>> 28, 33, 34, 36, 39)
>>> class_labels = ('cabinet', 'bed', 'chair', 'sofa', 'table', 'door',
... 'window', 'bookshelf', 'picture', 'counter', 'desk',
... 'curtain', 'refrigerator', 'showercurtrain', 'toilet',
... 'sink', 'bathtub', 'garbagebin')
>>> dataset_meta = dict(
... seg_valid_class_ids=seg_valid_class_ids, classes=class_labels)
>>>
Copy link
Collaborator

Choose a reason for hiding this comment

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

The example is too complicated and needs to be simplified~

Copy link
Author

Choose a reason for hiding this comment

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

It is hard to simplify it for this metric need many code to generate input.

infos.append(info)
return infos

def rename_gt(self, gt_semantic_masks, gt_instance_masks, valid_class_ids):
Copy link
Collaborator

Choose a reason for hiding this comment

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

The rename in function name rename_gt seems a bit weird, what is be renamed?

Copy link
Author

Choose a reason for hiding this comment

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

It seems that this function rename the input ground truth in order to evaluate in ScanNet protocol provided by ScanNet repo.

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.

3 participants