Ejemplo n.º 1
0
    def __init__(self,
                 num_classes,
                 extra_feature_channels=6,
                 width_multiplier=1):
        super().__init__()
        self.in_channels = extra_feature_channels + 3

        layers, channels_point, _ = create_pointnet_components(
            blocks=self.blocks,
            in_channels=self.in_channels,
            width_multiplier=width_multiplier)
        self.point_features = nn.Sequential(*layers)

        layers, channels_cloud = create_mlp_components(
            in_channels=channels_point,
            out_channels=[256, 128],
            classifier=False,
            dim=1,
            width_multiplier=width_multiplier)
        self.cloud_features = nn.Sequential(*layers)

        layers, _ = create_mlp_components(
            in_channels=(channels_point + channels_cloud),
            out_channels=[512, 256, 0.3, num_classes],
            classifier=True,
            dim=2,
            width_multiplier=width_multiplier)
        self.classifier = nn.Sequential(*layers)
Ejemplo n.º 2
0
    def __init__(self, num_classes=3, extra_feature_channels=1,
                 num_heading_angle_bins=12, num_size_templates=8,
                 width_multiplier=1):
        super(BoxEstimationPointDan, self).__init__()

        self.num_classes = num_classes

        self.g = PointnetG(num_classes)

        channels_point = self.g.channels_point

        self.attention_s = CALayer(64 * 64)
        self.attention_t = CALayer(64 * 64)

        layers, _ = create_mlp_components(
            in_channels=channels_point + num_classes,
            out_channels=[512, 256, (3 + num_heading_angle_bins * 2 + num_size_templates * 4)],
            classifier=True, dim=1, width_multiplier=width_multiplier
        )
        self.c1 = nn.Sequential(*layers)

        layers, _ = create_mlp_components(
            in_channels=channels_point + num_classes,
            out_channels=[512, 256, (3 + num_heading_angle_bins * 2 + num_size_templates * 4)],
            classifier=True, dim=1, width_multiplier=width_multiplier
        )
        self.c2 = nn.Sequential(*layers)
Ejemplo n.º 3
0
    def __init__(self, num_classes=3, width_multiplier=1):
        super().__init__()
        self.in_channels = 3
        self.num_classes = num_classes

        layers, channels = create_mlp_components(
            in_channels=self.in_channels,
            out_channels=self.blocks,
            classifier=False,
            dim=2,
            width_multiplier=width_multiplier)
        self.g = nn.Sequential(*layers)

        layers, _ = create_mlp_components(in_channels=(channels + num_classes),
                                          out_channels=[256, 128, 3],
                                          classifier=True,
                                          dim=1,
                                          width_multiplier=width_multiplier)
        self.r1 = nn.Sequential(*layers)

        layers, _ = create_mlp_components(in_channels=(channels + num_classes),
                                          out_channels=[256, 128, 3],
                                          classifier=True,
                                          dim=1,
                                          width_multiplier=width_multiplier)
        self.r2 = nn.Sequential(*layers)
Ejemplo n.º 4
0
    def __init__(self,
                 num_classes,
                 extra_feature_channels=7,
                 width_multiplier=1,
                 voxel_resolution_multiplier=2):
        super().__init__()
        self.in_channels = extra_feature_channels + 3

        layers, channels_point, concat_channels_point = create_pointnet_components(
            blocks=self.blocks,
            in_channels=self.in_channels,
            with_se=False,
            eps=1e-17,
            width_multiplier=width_multiplier,
            voxel_resolution_multiplier=voxel_resolution_multiplier)
        self.point_features = nn.ModuleList(layers)

        layers, channels_cloud = create_mlp_components(
            in_channels=channels_point,
            out_channels=[256, 128],
            classifier=False,
            dim=1,
            width_multiplier=width_multiplier)
        self.cloud_features = nn.Sequential(*layers)

        layers, _ = create_mlp_components(
            in_channels=(concat_channels_point + channels_cloud),
            out_channels=[512, 0.3, 256, 0.3, num_classes],
            classifier=True,
            dim=2,
            width_multiplier=width_multiplier)
        self.classifier = nn.Sequential(*layers)
Ejemplo n.º 5
0
    def __init__(self, num_classes=3, extra_feature_channels=1,
                 num_heading_angle_bins=12, num_size_templates=8,
                 width_multiplier=1, voxel_resolution_multiplier=1):
        super(BoxEstimationSimpleDanNet, self).__init__()

        self.in_channels = 3
        self.num_classes = num_classes
        blocks = ((128, 2, None), (256, 1, None), (512, 1, None))

        layers, channels_point, _ = create_pointnet_components(
            blocks=blocks, in_channels=self.in_channels, with_se=False, normalize=True, eps=1e-15,
            width_multiplier=width_multiplier, voxel_resolution_multiplier=voxel_resolution_multiplier
        )
        self.g = nn.Sequential(*layers)

        layers, _ = create_mlp_components(
            in_channels=channels_point + num_classes,
            out_channels=[512, 256, (3 + num_heading_angle_bins * 2 + num_size_templates * 4)],
            classifier=True, dim=1, width_multiplier=width_multiplier
        )
        self.c1 = nn.Sequential(*layers)

        layers, _ = create_mlp_components(
            in_channels=channels_point + num_classes,
            out_channels=[512, 256, (3 + num_heading_angle_bins * 2 + num_size_templates * 4)],
            classifier=True, dim=1, width_multiplier=width_multiplier
        )
        self.c2 = nn.Sequential(*layers)
Ejemplo n.º 6
0
    def __init__(self, num_classes, extra_feature_channels, channels_sa_features, \
        sa_in_channels, width_multiplier=1, voxel_resolution_multiplier=1):
        super().__init__()
        self.in_channels = extra_feature_channels + 3

        # only use extra features in the last fp module
        sa_in_channels[0] = extra_feature_channels
        fp_layers, channels_fp_features = create_pointnet2_fp_modules(
            fp_blocks=self.fp_blocks,
            in_channels=channels_sa_features,
            sa_in_channels=sa_in_channels,
            with_se=False,
            width_multiplier=width_multiplier,
            voxel_resolution_multiplier=voxel_resolution_multiplier)
        self.fp_layers = nn.ModuleList(fp_layers)

        layers, _ = create_mlp_components(in_channels=channels_fp_features,
                                          out_channels=[64, 0.5, num_classes],
                                          classifier=True,
                                          dim=2,
                                          width_multiplier=width_multiplier)
        self.classifier = nn.Sequential(*layers)

        layers, _ = create_mlp_components(in_channels=channels_fp_features,
                                          out_channels=[64, 0.5, 32, 3],
                                          classifier=True,
                                          dim=2,
                                          width_multiplier=width_multiplier)
        self.reconstructor = nn.Sequential(*layers)
Ejemplo n.º 7
0
Archivo: pvcnn.py Proyecto: fsx05021/3D
    def __init__(self,
                 num_classes,
                 num_shapes,
                 extra_feature_channels=3,
                 width_multiplier=1,
                 voxel_resolution_multiplier=1):
        super().__init__()
        assert extra_feature_channels >= 0
        self.in_channels = extra_feature_channels + 3
        self.num_shapes = num_shapes

        layers, channels_point, concat_channels_point = create_pointnet_components(
            blocks=self.blocks,
            in_channels=self.in_channels,
            with_se=True,
            normalize=False,
            width_multiplier=width_multiplier,
            voxel_resolution_multiplier=voxel_resolution_multiplier)
        self.point_features = nn.ModuleList(layers)

        layers, _ = create_mlp_components(
            in_channels=(num_shapes + channels_point + concat_channels_point),
            out_channels=[256, 0.2, 256, 0.2, 128, num_classes],
            classifier=True,
            dim=2,
            width_multiplier=width_multiplier)
        self.classifier = nn.Sequential(*layers)
Ejemplo n.º 8
0
    def __init__(self, num_classes, sa_blocks, fp_blocks, extra_feature_channels,
                 width_multiplier=1, voxel_resolution_multiplier=1):
        super().__init__()
        self.in_channels = extra_feature_channels + 3
        self.num_classes = num_classes

        sa_layers, sa_in_channels, channels_sa_features, _ = create_pointnet2_sa_components(
            sa_blocks=sa_blocks, extra_feature_channels=extra_feature_channels, with_se=False,
            width_multiplier=width_multiplier, voxel_resolution_multiplier=voxel_resolution_multiplier
        )
        self.sa_layers = nn.ModuleList(sa_layers)

        # use one hot vector in the first fp module
        sa_in_channels[-1] += num_classes
        fp_layers, channels_fp_features = create_pointnet2_fp_modules(
            fp_blocks=fp_blocks, in_channels=channels_sa_features, sa_in_channels=sa_in_channels, with_se=False,
            width_multiplier=width_multiplier, voxel_resolution_multiplier=voxel_resolution_multiplier
        )
        self.fp_layers = nn.ModuleList(fp_layers)

        layers, _ = create_mlp_components(
            in_channels=channels_fp_features, out_channels=[128, 0.3, 2],
            classifier=True, dim=2, width_multiplier=width_multiplier
        )
        self.classifier = nn.Sequential(*layers)
Ejemplo n.º 9
0
    def __init__(self,
                 num_classes,
                 point_blocks,
                 cloud_blocks,
                 extra_feature_channels,
                 width_multiplier=1,
                 voxel_resolution_multiplier=1):
        super().__init__()
        self.in_channels = extra_feature_channels + 3
        self.num_classes = num_classes

        layers, channels_point, _ = create_pointnet_components(
            blocks=point_blocks,
            in_channels=self.in_channels,
            with_se=False,
            width_multiplier=width_multiplier,
            voxel_resolution_multiplier=voxel_resolution_multiplier)
        self.point_features = nn.Sequential(*layers)

        layers, channels_cloud, _ = create_pointnet_components(
            blocks=cloud_blocks,
            in_channels=channels_point,
            with_se=False,
            width_multiplier=width_multiplier,
            voxel_resolution_multiplier=voxel_resolution_multiplier)
        self.cloud_features = nn.Sequential(*layers)

        layers, _ = create_mlp_components(
            in_channels=(channels_point + channels_cloud + num_classes),
            out_channels=[512, 256, 128, 128, 0.5, 2],
            classifier=True,
            dim=2,
            width_multiplier=width_multiplier)
        self.classifier = nn.Sequential(*layers)
Ejemplo n.º 10
0
    def __init__(self,
                 num_classes,
                 blocks,
                 num_heading_angle_bins,
                 num_size_templates,
                 width_multiplier=1,
                 voxel_resolution_multiplier=1):
        super().__init__()
        self.in_channels = 3
        self.num_classes = num_classes

        layers, channels_point, _ = create_pointnet_components(
            blocks=blocks,
            in_channels=self.in_channels,
            with_se=False,
            normalize=True,
            eps=1e-15,
            width_multiplier=width_multiplier,
            voxel_resolution_multiplier=voxel_resolution_multiplier)
        self.features = nn.Sequential(*layers)

        layers, _ = create_mlp_components(
            in_channels=channels_point + num_classes,
            out_channels=[
                512, 256,
                (3 + num_heading_angle_bins * 2 + num_size_templates * 4)
            ],
            classifier=True,
            dim=1,
            width_multiplier=width_multiplier)
        self.classifier = nn.Sequential(*layers)
Ejemplo n.º 11
0
    def __init__(self,
                 num_classes,
                 sa_blocks,
                 num_heading_angle_bins,
                 num_size_templates,
                 width_multiplier=1,
                 voxel_resolution_multiplier=1):
        super().__init__()
        self.in_channels = 3
        self.num_classes = num_classes

        sa_layers, _, channels_sa_features, num_centers = create_pointnet2_sa_components(
            sa_blocks=sa_blocks,
            extra_feature_channels=0,
            with_se=False,
            width_multiplier=width_multiplier,
            voxel_resolution_multiplier=voxel_resolution_multiplier)
        self.features = nn.Sequential(*sa_layers)

        layers, _ = create_mlp_components(
            in_channels=(channels_sa_features * num_centers + num_classes),
            out_channels=[
                512, 256,
                (3 + num_heading_angle_bins * 2 + num_size_templates * 4)
            ],
            classifier=True,
            dim=1,
            width_multiplier=width_multiplier)
        self.classifier = nn.Sequential(*layers)
Ejemplo n.º 12
0
    def __init__(self, num_classes, num_shapes, sa_blocks, fp_blocks, with_one_hot_shape_id=True,
                 extra_feature_channels=3, width_multiplier=1, voxel_resolution_multiplier=1):
        super().__init__()
        assert extra_feature_channels >= 0

        self.in_channels = extra_feature_channels + 3
        self.num_shapes = num_shapes
        self.with_one_hot_shape_id = with_one_hot_shape_id

        sa_layers, sa_in_channels, channels_sa_features, _ = create_pointnet2_sa_components(
            sa_blocks=sa_blocks, extra_feature_channels=extra_feature_channels, width_multiplier=width_multiplier
        )
        self.sa_layers = nn.ModuleList(sa_layers)

        # use one hot vector in the last fp module
        sa_in_channels[0] += num_shapes if with_one_hot_shape_id else 0
        fp_layers, channels_fp_features = create_pointnet2_fp_modules(
            fp_blocks=fp_blocks, in_channels=channels_sa_features, sa_in_channels=sa_in_channels,
            width_multiplier=width_multiplier, voxel_resolution_multiplier=voxel_resolution_multiplier
        )
        self.fp_layers = nn.ModuleList(fp_layers)

        layers, _ = create_mlp_components(in_channels=channels_fp_features, out_channels=[128, 0.5, num_classes],
                                       classifier=True, dim=2, width_multiplier=width_multiplier)
        self.classifier = nn.Sequential(*layers)
Ejemplo n.º 13
0
    def __init__(self, num_classes=3, width_multiplier=1):
        super().__init__()
        self.g = CenterRegressionPointDanGenerator(num_classes,
                                                   width_multiplier)
        channels = self.g.channels

        self.attention_s = CALayer(64 * 64)
        self.attention_t = CALayer(64 * 64)

        layers, _ = create_mlp_components(in_channels=(channels + num_classes),
                                          out_channels=[256, 128, 3],
                                          classifier=True,
                                          dim=1,
                                          width_multiplier=width_multiplier)
        self.r1 = nn.Sequential(*layers)

        layers, _ = create_mlp_components(in_channels=(channels + num_classes),
                                          out_channels=[256, 128, 3],
                                          classifier=True,
                                          dim=1,
                                          width_multiplier=width_multiplier)
        self.r2 = nn.Sequential(*layers)
Ejemplo n.º 14
0
    def __init__(self, num_classes, width_multiplier):
        super().__init__()
        self.in_channels = 3
        self.num_classes = num_classes

        layers, channels = create_mlp_components(
            in_channels=self.in_channels,
            out_channels=self.blocks1,
            classifier=False,
            dim=2,
            width_multiplier=width_multiplier)
        self.pre = nn.Sequential(*layers)

        self.node = adapt_layer_off()

        layers, channels = create_mlp_components(
            in_channels=2 * channels,
            out_channels=self.blocks2,
            classifier=False,
            dim=2,
            width_multiplier=width_multiplier)
        self.features = nn.Sequential(*layers)
        self.channels = channels
Ejemplo n.º 15
0
    def __init__(self,
                 num_classes,
                 extra_feature_channels=7,
                 width_multiplier=1,
                 voxel_resolution_multiplier=1
                 ):  #extra  channel features ändrat 19/2
        super().__init__()
        self.in_channels = extra_feature_channels + 3

        sa_layers, sa_in_channels, channels_sa_features, _ = create_pointnet2_sa_components(
            sa_blocks=self.sa_blocks,
            extra_feature_channels=extra_feature_channels,
            with_se=True,
            width_multiplier=width_multiplier,
            voxel_resolution_multiplier=voxel_resolution_multiplier,
            eps=1e-17)
        self.sa_layers = nn.ModuleList(sa_layers)

        # only use extra features in the last fp module
        sa_in_channels[0] = extra_feature_channels
        fp_layers, channels_fp_features = create_pointnet2_fp_modules(
            fp_blocks=self.fp_blocks,
            in_channels=channels_sa_features,
            sa_in_channels=sa_in_channels,
            with_se=True,
            width_multiplier=width_multiplier,
            voxel_resolution_multiplier=voxel_resolution_multiplier,
            eps=1e-17)
        self.fp_layers = nn.ModuleList(fp_layers)

        layers, _ = create_mlp_components(in_channels=channels_fp_features,
                                          out_channels=[128, 0.5, num_classes],
                                          classifier=True,
                                          dim=2,
                                          width_multiplier=width_multiplier)
        self.classifier = nn.Sequential(*layers)