Unverified Commit ed3c1ebd authored by VVsssssk's avatar VVsssssk Committed by GitHub
Browse files

[Fix] Fix PartA2 bug (#1538)



* [Fix] fixed compatibility of MMCV (#1508)

* fixed GPG key error

* fixed compatibility of MMCV

* fix parta2 bug
Co-authored-by: default avatarWenwei Zhang <40779233+ZwwWayne@users.noreply.github.com>
Co-authored-by: default avataratinfinity <dandelion1124@gmail.com>
parent 36a0d19e
......@@ -90,6 +90,7 @@ data = dict(
pipeline=train_pipeline,
modality=input_modality,
classes=class_names,
box_type_3d='LiDAR',
test_mode=False)),
val=dict(
type=dataset_type,
......@@ -100,6 +101,7 @@ data = dict(
pipeline=test_pipeline,
modality=input_modality,
classes=class_names,
box_type_3d='LiDAR',
test_mode=True),
test=dict(
type=dataset_type,
......@@ -110,6 +112,7 @@ data = dict(
pipeline=test_pipeline,
modality=input_modality,
classes=class_names,
box_type_3d='LiDAR',
test_mode=True))
# Part-A2 uses a different learning rate from what SECOND uses.
......
......@@ -30,7 +30,8 @@ class TwoStage3DDetector(Base3DDetector, TwoStageDetector):
'please use "init_cfg" instead')
backbone.pretrained = pretrained
self.backbone = build_backbone(backbone)
self.train_cfg = train_cfg
self.test_cfg = test_cfg
if neck is not None:
self.neck = build_neck(neck)
......
......@@ -11,6 +11,7 @@ else:
from mmcv.runner import BaseModule, auto_fp16
from mmdet3d.ops import SparseBasicBlock, make_sparse_convmodule
from mmdet3d.ops.sparse_block import replace_feature
from ..builder import MIDDLE_ENCODERS
......@@ -168,10 +169,11 @@ class SparseUNet(BaseModule):
:obj:`SparseConvTensor`: Upsampled feature.
"""
x = lateral_layer(x_lateral)
x.features = torch.cat((x_bottom.features, x.features), dim=1)
x = replace_feature(x, torch.cat((x_bottom.features, x.features),
dim=1))
x_merge = merge_layer(x)
x = self.reduce_channel(x, x_merge.features.shape[1])
x.features = x_merge.features + x.features
x = replace_feature(x, x_merge.features + x.features)
x = upsample_layer(x)
return x
......@@ -191,8 +193,7 @@ class SparseUNet(BaseModule):
n, in_channels = features.shape
assert (in_channels % out_channels
== 0) and (in_channels >= out_channels)
x.features = features.view(n, out_channels, -1).sum(dim=2)
x = replace_feature(x, features.view(n, out_channels, -1).sum(dim=2))
return x
def make_encoder_layers(self, make_block, norm_cfg, in_channels):
......
......@@ -2,7 +2,15 @@
import numpy as np
import torch
from mmcv.cnn import ConvModule, normal_init
from mmcv.ops import SparseConvTensor, SparseMaxPool3d, SparseSequential
from mmdet3d.ops.spconv import IS_SPCONV2_AVAILABLE
if IS_SPCONV2_AVAILABLE:
from spconv.pytorch import (SparseConvTensor, SparseMaxPool3d,
SparseSequential)
else:
from mmcv.ops import SparseConvTensor, SparseMaxPool3d, SparseSequential
from mmcv.runner import BaseModule
from torch import nn as nn
......@@ -252,7 +260,7 @@ class PartA2BboxHead(BaseModule):
sparse_idx[:, 2], sparse_idx[:, 3]]
seg_features = seg_feats[sparse_idx[:, 0], sparse_idx[:, 1],
sparse_idx[:, 2], sparse_idx[:, 3]]
coords = sparse_idx.int()
coords = sparse_idx.int().contiguous()
part_features = SparseConvTensor(part_features, coords, sparse_shape,
rcnn_batch_size)
seg_features = SparseConvTensor(seg_features, coords, sparse_shape,
......
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