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