Skip to content

Commit fc679dc

Browse files
authored
solve bc breaking (#1908)
1 parent 6d3518d commit fc679dc

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

mmdet3d/models/data_preprocessors/data_preprocessor.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@
1313
from mmdet3d.registry import MODELS
1414
from mmdet3d.utils import OptConfigType
1515
from mmdet.models import DetDataPreprocessor
16-
from mmdet.models.utils.misc import samplelist_boxtype2tensor
1716
from .utils import multiview_img_stack_batch
1817

1918

20-
2119
@MODELS.register_module()
2220
class Det3DDataPreprocessor(DetDataPreprocessor):
2321
"""Points / Image pre-processor for point clouds / vision-only / multi-
@@ -90,7 +88,6 @@ def __init__(self,
9088
seg_pad_value=seg_pad_value,
9189
bgr_to_rgb=bgr_to_rgb,
9290
rgb_to_bgr=rgb_to_bgr,
93-
boxtype2tensor=boxtype2tensor,
9491
batch_augments=batch_augments)
9592
self.voxel = voxel
9693
self.voxel_type = voxel_type
@@ -170,9 +167,14 @@ def simple_process(self, data: dict, training: bool = False) -> dict:
170167
'pad_shape': pad_shape
171168
})
172169

173-
if self.boxtype2tensor:
170+
if hasattr(self, 'boxtype2tensor') and self.boxtype2tensor:
171+
from mmdet.models.utils.misc import \
172+
samplelist_boxtype2tensor
174173
samplelist_boxtype2tensor(data_samples)
175-
174+
elif hasattr(self, 'boxlist2tensor') and self.boxlist2tensor:
175+
from mmdet.models.utils.misc import \
176+
samplelist_boxlist2tensor
177+
samplelist_boxlist2tensor(data_samples)
176178
if self.pad_mask:
177179
self.pad_gt_masks(data_samples)
178180

mmdet3d/models/layers/spconv/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
except ImportError:
77
IS_SPCONV2_AVAILABLE = False
88
else:
9-
if hasattr(spconv, '__version__') and spconv.__version__ >= '2.0.0':
9+
if hasattr(spconv,
10+
'__version__') and spconv.__version__ >= '2.0.0' and hasattr(
11+
spconv, 'pytorch'):
1012
IS_SPCONV2_AVAILABLE = register_spconv2()
1113
else:
1214
IS_SPCONV2_AVAILABLE = False

0 commit comments

Comments
 (0)