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 centerpoint #252

Merged
merged 25 commits into from
Apr 1, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
fac97d3
bump version to v0.4.0
RunningLeon Feb 28, 2022
4944564
[Enhancement] Make rewriter more powerful (#150)
SingleZombie Mar 1, 2022
63a998f
Torchscript support (#159)
AllentDan Mar 7, 2022
61b0146
Merge branch 'master' into dev-v0.4.0
Mar 8, 2022
31402ff
Update supported mmseg models (#181)
RunningLeon Mar 8, 2022
9553b8c
[Features]Support mmdet3d (#103)
VVsssssk Mar 10, 2022
987d48c
[Enhancement] Update pad logic in detection heads (#168)
Mar 14, 2022
00ca2a3
[Enhancement] Additional arguments support for OpenVINO Model Optimiz…
SemyonBevzuk Mar 15, 2022
167400c
[Enhancement] Switch to statically typed Value::Any (#209)
lzhangzz Mar 17, 2022
5e9f0cb
support for centerpoint
Mar 18, 2022
5ec6f73
Merge branch 'dev-v0.4.0' of https://github.com/open-mmlab/mmdeploy i…
Mar 18, 2022
ea0d0cf
[Enhancement] TensorRT DCN support (#205)
Mar 21, 2022
a3323ce
Merge branch 'dev-v0.4.0' of https://github.com/open-mmlab/mmdeploy i…
Mar 21, 2022
1a22a63
add docstring and dcn model support
Mar 22, 2022
896e512
add centerpoint ut and docs
Mar 23, 2022
ac046d9
Merge branch 'master' of https://github.com/open-mmlab/mmdeploy into …
Mar 24, 2022
fd44c6c
Merge branch 'dev-v0.4.0' of https://github.com/open-mmlab/mmdeploy i…
Mar 30, 2022
bc4449b
add config and fix input rank
Mar 30, 2022
66054f8
fix merge error
Mar 30, 2022
28d240d
fix a bug
Mar 30, 2022
b700f38
Merge branch 'dev-v0.4.0' of https://github.com/open-mmlab/mmdeploy i…
Mar 31, 2022
807331e
fix comment
Apr 1, 2022
47b8e6e
[Doc] update benchmark add supported-model-list (#286)
AllentDan Apr 1, 2022
ca68e87
Merge branch 'master' of https://github.com/open-mmlab/mmdeploy into …
Apr 1, 2022
61c0654
fix ut
Apr 1, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mmdeploy/codebase/mmdet3d/deploy/voxel_detection_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def post_process(model_cfg: Union[str, mmcv.Config],
elif 'pts_bbox_head' in model_cfg.model.keys():
head_cfg = dict(**model_cfg.model['pts_bbox_head'])
else:
raise
raise NotImplementedError('Not supported model.')
head_cfg['train_cfg'] = None
head_cfg['test_cfg'] = model_cfg.model['test_cfg']
head = build_head(head_cfg)
Expand Down
49 changes: 20 additions & 29 deletions mmdeploy/codebase/mmdet3d/models/centerpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,13 @@ def centerpoint__get_bbox(ctx,
list[dict]: Decoded bbox, scores and labels after nms.
"""
rets = []
# common_heads = self.task_heads[0].heads
batch_size = 1
scores_range = [0]
bbox_range = [0]
dir_range = [0]
self.test_cfg = self.test_cfg['pts']
for i, task_head in enumerate(self.task_heads):
scores_range.append(scores_range[i] + self.num_classes[i])
bbox_range.append(bbox_range[i] +
8 if 'vel' in task_head.heads.keys() else 6)
bbox_range.append(bbox_range[i] + 8)
dir_range.append(dir_range[i] + 2)
for task_id in range(len(self.num_classes)):
num_class_with_bg = self.num_classes[task_id]
Expand Down Expand Up @@ -129,11 +126,6 @@ def centerpoint__get_bbox(ctx,
dir_range[task_id]:dir_range[task_id + 1],
...][:, 1].unsqueeze(1)

# if 'vel' in preds_dict[0]:
# batch_vel = preds_dict[0]['vel']
# else:
# batch_vel = None

temp = self.bbox_coder.decode(
batch_heatmap,
batch_rots,
Expand All @@ -148,26 +140,25 @@ def centerpoint__get_bbox(ctx,
batch_cls_preds = [box['scores'] for box in temp]
batch_cls_labels = [box['labels'] for box in temp]
if self.test_cfg['nms_type'] == 'circle':
ret_task = []
for i in range(batch_size):
boxes3d = temp[i]['bboxes']
scores = temp[i]['scores']
labels = temp[i]['labels']
centers = boxes3d[:, [0, 1]]
boxes = torch.cat([centers, scores.view(-1, 1)], dim=1)
keep = torch.tensor(
circle_nms(
boxes.detach().cpu().numpy(),
self.test_cfg['min_radius'][task_id],
post_max_size=self.test_cfg['post_max_size']),
dtype=torch.long,
device=boxes.device)

boxes3d = boxes3d[keep]
scores = scores[keep]
labels = labels[keep]
ret = dict(bboxes=boxes3d, scores=scores, labels=labels)
ret_task.append(ret)

boxes3d = temp[0]['bboxes']
scores = temp[0]['scores']
labels = temp[0]['labels']
centers = boxes3d[:, [0, 1]]
boxes = torch.cat([centers, scores.view(-1, 1)], dim=1)
keep = torch.tensor(
circle_nms(
boxes.detach().cpu().numpy(),
self.test_cfg['min_radius'][task_id],
post_max_size=self.test_cfg['post_max_size']),
dtype=torch.long,
device=boxes.device)

boxes3d = boxes3d[keep]
scores = scores[keep]
labels = labels[keep]
ret = dict(bboxes=boxes3d, scores=scores, labels=labels)
ret_task = [ret]
rets.append(ret_task)
else:
rets.append(
Expand Down
13 changes: 9 additions & 4 deletions tests/test_codebase/test_mmdet3d/test_mmdet3d_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,17 @@ def test_pointpillars_scatter(backend_type: Backend):

def get_centerpoint():
from mmdet3d.models.detectors.centerpoint import CenterPoint
model_cfg = load_config('data/model_cfg.py')[0]
model_cfg = load_config(
'tests/test_codebase/test_mmdet3d/data/model_cfg.py')[0]
model = CenterPoint(**model_cfg.centerpoint_model)
model.requires_grad_(False)
return model


def get_centerpoint_head():
from mmdet3d.models import builder
model_cfg = load_config('data/model_cfg.py')[0]
model_cfg = load_config(
'tests/test_codebase/test_mmdet3d/data/model_cfg.py')[0]
model_cfg.centerpoint_model.pts_bbox_head.test_cfg = model_cfg.\
centerpoint_model.test_cfg
head = builder.build_head(model_cfg.centerpoint_model.pts_bbox_head)
Expand All @@ -144,9 +146,12 @@ def test_centerpoint(backend_type: Backend):
output_names=['outputs']),
codebase_config=dict(
type=Codebase.MMDET3D.value, task=Task.VOXEL_DETECTION.value)))
model_cfg = load_config('data/model_cfg.py')[0]
model_cfg = load_config(
'tests/test_codebase/test_mmdet3d/data/model_cfg.pytests/'
VVsssssk marked this conversation as resolved.
Show resolved Hide resolved
'test_codebase/test_mmdet3d/data/model_cfg.py')[0]
VVsssssk marked this conversation as resolved.
Show resolved Hide resolved
voxeldetection = VoxelDetection(model_cfg, deploy_cfg, 'cpu')
inputs, data = voxeldetection.create_input('data/kitti/kitti_000008.bin')
inputs, data = voxeldetection.create_input(
'tests/test_codebase/test_mmdet3d/data/kitti/kitti_000008.bin')

with RewriterContext(
cfg=deploy_cfg,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ def setup_class(cls):
deploy_cfg = mmcv.Config({
'onnx_config': {
'input_names': ['voxels', 'num_points', 'coors'],
'output_names': ['scores', 'bbox_preds', 'dir_scores']
'output_names': ['scores', 'bbox_preds', 'dir_scores'],
'opset_version': 11
},
'backend_config': {
'type': 'tensorrt'
}
})

Expand Down Expand Up @@ -71,7 +75,7 @@ def test_forward_and_show_result(self):


@backend_checker(Backend.ONNXRUNTIME)
def test_build_pose_detection_model():
def test_build_voxel_detection_model():
from mmdeploy.utils import load_config
model_cfg_path = 'tests/test_codebase/test_mmdet3d/data/model_cfg.py'
model_cfg = load_config(model_cfg_path)[0]
Expand Down