From 34f7401b94845315bb6552014dc781af54e2e4cf Mon Sep 17 00:00:00 2001 From: alex-nutonomy Date: Mon, 18 Mar 2019 10:51:19 -0700 Subject: [PATCH] pass voxel size and pcrange to PillarFeatureNet --- second/pytorch/builder/second_builder.py | 2 ++ second/pytorch/models/voxelnet.py | 22 +++++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/second/pytorch/builder/second_builder.py b/second/pytorch/builder/second_builder.py index 9f86e9e7..20d0d4bf 100644 --- a/second/pytorch/builder/second_builder.py +++ b/second/pytorch/builder/second_builder.py @@ -90,5 +90,7 @@ def build(model_cfg: second_pb2.VoxelNet, voxel_generator, loc_loss_ftor=loc_loss_ftor, cls_loss_ftor=cls_loss_ftor, target_assigner=target_assigner, + voxel_size=voxel_generator.voxel_size, + pc_range=voxel_generator.point_cloud_range ) return net diff --git a/second/pytorch/models/voxelnet.py b/second/pytorch/models/voxelnet.py index f113b34c..3e496727 100644 --- a/second/pytorch/models/voxelnet.py +++ b/second/pytorch/models/voxelnet.py @@ -528,6 +528,8 @@ def __init__(self, encode_rad_error_by_sin=False, loc_loss_ftor=None, cls_loss_ftor=None, + voxel_size=(0.2, 0.2, 4), + pc_range=(0, -40, -3, 70.4, 40, 1), name='voxelnet'): super().__init__() self.name = name @@ -568,11 +570,21 @@ def __init__(self, "PillarFeatureNet": PillarFeatureNet } vfe_class = vfe_class_dict[vfe_class_name] - self.voxel_feature_extractor = vfe_class( - num_input_features, - use_norm, - num_filters=vfe_num_filters, - with_distance=with_distance) + if vfe_class_name == "PillarFeatureNet": + self.voxel_feature_extractor = vfe_class( + num_input_features, + use_norm, + num_filters=vfe_num_filters, + with_distance=with_distance, + voxel_size=voxel_size, + pc_range=pc_range + ) + else: + self.voxel_feature_extractor = vfe_class( + num_input_features, + use_norm, + num_filters=vfe_num_filters, + with_distance=with_distance) print("middle_class_name", middle_class_name) if middle_class_name == "PointPillarsScatter":