"git@developer.sourcefind.cn:OpenDAS/ollama.git" did not exist on "257ffeb99747a2bb9caed54b1d51020aca95b0ae"
Unverified Commit d7a11228 authored by yinchimaoliang's avatar yinchimaoliang Committed by GitHub
Browse files

[fix]:fix bug in dcn unittest (#130)

* Add version assert in init file.

* Fix bug in test_dcn_head.
parent 4996f4cd
...@@ -46,8 +46,8 @@ def _get_config_module(fname): ...@@ -46,8 +46,8 @@ def _get_config_module(fname):
def _get_head_cfg(fname): def _get_head_cfg(fname):
"""Grab configs necessary to create a bbox_head. """Grab configs necessary to create a bbox_head.
These are deep copied to allow for safe modification of parameters These are deep copied to allow for safe modification of parameters without
without influencing other tests. influencing other tests.
""" """
import mmcv import mmcv
config = _get_config_module(fname) config = _get_config_module(fname)
...@@ -64,8 +64,8 @@ def _get_head_cfg(fname): ...@@ -64,8 +64,8 @@ def _get_head_cfg(fname):
def _get_rpn_head_cfg(fname): def _get_rpn_head_cfg(fname):
"""Grab configs necessary to create a rpn_head. """Grab configs necessary to create a rpn_head.
These are deep copied to allow for safe modification of parameters These are deep copied to allow for safe modification of parameters without
without influencing other tests. influencing other tests.
""" """
import mmcv import mmcv
config = _get_config_module(fname) config = _get_config_module(fname)
...@@ -82,8 +82,8 @@ def _get_rpn_head_cfg(fname): ...@@ -82,8 +82,8 @@ def _get_rpn_head_cfg(fname):
def _get_roi_head_cfg(fname): def _get_roi_head_cfg(fname):
"""Grab configs necessary to create a roi_head. """Grab configs necessary to create a roi_head.
These are deep copied to allow for safe modification of parameters These are deep copied to allow for safe modification of parameters without
without influencing other tests. influencing other tests.
""" """
import mmcv import mmcv
config = _get_config_module(fname) config = _get_config_module(fname)
...@@ -100,8 +100,8 @@ def _get_roi_head_cfg(fname): ...@@ -100,8 +100,8 @@ def _get_roi_head_cfg(fname):
def _get_pts_bbox_head_cfg(fname): def _get_pts_bbox_head_cfg(fname):
"""Grab configs necessary to create a pts_bbox_head. """Grab configs necessary to create a pts_bbox_head.
These are deep copied to allow for safe modification of parameters These are deep copied to allow for safe modification of parameters without
without influencing other tests. influencing other tests.
""" """
import mmcv import mmcv
config = _get_config_module(fname) config = _get_config_module(fname)
...@@ -118,8 +118,8 @@ def _get_pts_bbox_head_cfg(fname): ...@@ -118,8 +118,8 @@ def _get_pts_bbox_head_cfg(fname):
def _get_vote_head_cfg(fname): def _get_vote_head_cfg(fname):
"""Grab configs necessary to create a vote_head. """Grab configs necessary to create a vote_head.
These are deep copied to allow for safe modification of parameters These are deep copied to allow for safe modification of parameters without
without influencing other tests. influencing other tests.
""" """
import mmcv import mmcv
config = _get_config_module(fname) config = _get_config_module(fname)
...@@ -136,8 +136,8 @@ def _get_vote_head_cfg(fname): ...@@ -136,8 +136,8 @@ def _get_vote_head_cfg(fname):
def _get_parta2_bbox_head_cfg(fname): def _get_parta2_bbox_head_cfg(fname):
"""Grab configs necessary to create a parta2_bbox_head. """Grab configs necessary to create a parta2_bbox_head.
These are deep copied to allow for safe modification of parameters These are deep copied to allow for safe modification of parameters without
without influencing other tests. influencing other tests.
""" """
config = _get_config_module(fname) config = _get_config_module(fname)
model = copy.deepcopy(config.model) model = copy.deepcopy(config.model)
...@@ -780,7 +780,6 @@ def test_dcn_center_head(): ...@@ -780,7 +780,6 @@ def test_dcn_center_head():
voxel_size = [0.2, 0.2, 8] voxel_size = [0.2, 0.2, 8]
dcn_center_head_cfg = dict( dcn_center_head_cfg = dict(
type='CenterHead', type='CenterHead',
mode='3d',
in_channels=sum([128, 128, 128]), in_channels=sum([128, 128, 128]),
tasks=[ tasks=[
dict(num_class=1, class_names=['car']), dict(num_class=1, class_names=['car']),
...@@ -868,8 +867,11 @@ def test_dcn_center_head(): ...@@ -868,8 +867,11 @@ def test_dcn_center_head():
gt_bboxes_3d = [gt_bboxes_0, gt_bboxes_1] gt_bboxes_3d = [gt_bboxes_0, gt_bboxes_1]
gt_labels_3d = [gt_labels_0, gt_labels_1] gt_labels_3d = [gt_labels_0, gt_labels_1]
loss = dcn_center_head.loss(gt_bboxes_3d, gt_labels_3d, output) loss = dcn_center_head.loss(gt_bboxes_3d, gt_labels_3d, output)
loss_sum = torch.sum(torch.stack([item for _, item in loss.items()])) for key, item in loss.items():
assert torch.isclose(loss_sum, torch.tensor(21972.1230)) if 'heatmap' in key:
assert item >= 0
else:
assert torch.sum(item) >= 0
# test get_bboxes # test get_bboxes
img_metas = [ img_metas = [
......
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