Unverified Commit 86f6183d authored by ChaimZhu's avatar ChaimZhu Committed by GitHub
Browse files

[Refactor] move voxelization to data_preprocessor and fix new ut bugs (#1671)

* mv voxelization

* update

* update full

* fix configs

* improve docstring of data_preprocessor

* fix dynamic voxel config

* remove default voxel_type in config

* fix typos

* add docstring

* fix ut

* update

* fix docstring
parent a50c71dd
......@@ -80,10 +80,8 @@ class TestPointSegClassMapping(unittest.TestCase):
def test_point_seg_class_mapping(self):
results = dict()
results['pts_semantic_mask'] = np.array([1, 2, 3, 4, 5])
point_seg_mapping_transform = PointSegClassMapping(
valid_cat_ids=[1, 2, 3],
max_cat_id=results['pts_semantic_mask'].max())
results['seg_label_mapping'] = np.array([3, 0, 1, 2, 3, 3])
point_seg_mapping_transform = PointSegClassMapping()
results = point_seg_mapping_transform(results)
assert_allclose(results['pts_semantic_mask'], np.array([0, 1, 2, 3,
3]))
......@@ -67,14 +67,14 @@ class TestInstanceSegMetric(unittest.TestCase):
def test_evaluate(self):
data_batch = self._demo_mm_inputs()
predictions = self._demo_mm_model_output()
valid_class_ids = (3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 24, 28, 33,
34, 36, 39)
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(
VALID_CLASS_IDS=valid_class_ids, CLASSES=class_labels)
seg_valid_class_ids=seg_valid_class_ids, CLASSES=class_labels)
instance_seg_metric = InstanceSegMetric()
instance_seg_metric.dataset_meta = dataset_meta
instance_seg_metric.process(data_batch, predictions)
......
......@@ -20,6 +20,7 @@ def _init_evaluate_input():
pred_instances_3d.labels_3d = torch.Tensor([0])
predictions.pred_instances_3d = pred_instances_3d
predictions.pred_instances = InstanceData()
predictions = predictions.to_dict()
return data_batch, [predictions]
......
......@@ -10,12 +10,12 @@ def test_indoor_eval():
if not torch.cuda.is_available():
pytest.skip()
seg_preds = [
torch.Tensor([
np.array([
0, 0, 1, 0, 0, 2, 1, 3, 1, 2, 1, 0, 2, 2, 2, 2, 1, 3, 0, 3, 3, 3, 3
])
]
gt_labels = [
torch.Tensor([
np.array([
0, 0, 0, 255, 0, 0, 1, 1, 1, 255, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3,
3, 255
])
......
# Copyright (c) OpenMMLab. All rights reserved.
import unittest
import numpy as np
import torch
from mmengine.data import BaseDataElement
......@@ -14,7 +15,7 @@ class TestSegMetric(unittest.TestCase):
"""Create a superset of inputs needed to run test or train batches."""
packed_inputs = []
mm_inputs = dict()
pts_semantic_mask = torch.Tensor([
pts_semantic_mask = np.array([
0, 0, 0, 255, 0, 0, 1, 1, 1, 255, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3,
3, 255
])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment