Beispiel #1
0
 def __init__(self):
     super(PointNet2ClsSsg, self).__init__()
     self.sa1 = PointNetSetAbstraction(npoint=512,
                                       radius=0.2,
                                       nsample=32,
                                       in_channel=3,
                                       mlp=[64, 64, 128],
                                       group_all=False)
     self.sa2 = PointNetSetAbstraction(npoint=128,
                                       radius=0.4,
                                       nsample=64,
                                       in_channel=128 + 3,
                                       mlp=[128, 128, 256],
                                       group_all=False)
     self.sa3 = PointNetSetAbstraction(npoint=None,
                                       radius=None,
                                       nsample=None,
                                       in_channel=256 + 3,
                                       mlp=[256, 512, 1024],
                                       group_all=True)
     self.fc1 = nn.Linear(1024, 512)
     self.bn1 = nn.BatchNorm1d(512)
     self.drop1 = nn.Dropout(0.4)
     self.fc2 = nn.Linear(512, 256)
     self.bn2 = nn.BatchNorm1d(256)
     self.drop2 = nn.Dropout(0.4)
     self.fc3 = nn.Linear(256, 40)
Beispiel #2
0
    def __init__(self, feature_size=128, normal_channel=True):
        super(get_model, self).__init__()
        in_channel = 6 if normal_channel else 3
        self.normal_channel = normal_channel
        self.sa1 = PointNetSetAbstraction(npoint=512,
                                          radius=0.2,
                                          nsample=32,
                                          in_channel=in_channel,
                                          mlp=[64, 64, 128],
                                          group_all=False)
        self.sa2 = PointNetSetAbstraction(npoint=128,
                                          radius=0.4,
                                          nsample=64,
                                          in_channel=128 + 3,
                                          mlp=[128, 128, 256],
                                          group_all=False)
        self.sa3 = PointNetSetAbstraction(npoint=None,
                                          radius=None,
                                          nsample=None,
                                          in_channel=256 + 3,
                                          mlp=[256, 512, 1024],
                                          group_all=True)

        self.projection_head = nn.Sequential(nn.Linear(1024, 512),
                                             nn.BatchNorm1d(512), nn.ReLU(),
                                             nn.Dropout(0.4),
                                             nn.Linear(512, 256),
                                             nn.BatchNorm1d(256), nn.ReLU(),
                                             nn.Dropout(0.4),
                                             nn.Linear(256, feature_size))
Beispiel #3
0
 def __init__(self, num_class, normal_channel=True):
     super(get_model, self).__init__()
     in_channel = 6 if normal_channel else 3
     self.normal_channel = normal_channel
     self.sa1 = PointNetSetAbstraction(npoint=512,
                                       radius=0.2,
                                       nsample=32,
                                       in_channel=in_channel,
                                       mlp=[64, 64, 128],
                                       group_all=False)
     self.sa2 = PointNetSetAbstraction(npoint=128,
                                       radius=0.4,
                                       nsample=64,
                                       in_channel=128 + 3,
                                       mlp=[128, 128, 256],
                                       group_all=False)
     self.sa3 = PointNetSetAbstraction(npoint=None,
                                       radius=None,
                                       nsample=None,
                                       in_channel=256 + 3,
                                       mlp=[256, 512, 1024],
                                       group_all=True)
     self.fc1 = nn.Linear(1024, 512)
     self.bn1 = nn.BatchNorm1d(512)
     self.drop1 = nn.Dropout(0.4)
     self.fc2 = nn.Linear(512, 256)
     self.bn2 = nn.BatchNorm1d(256)
     self.drop2 = nn.Dropout(0.4)
     self.fc3 = nn.Linear(256, num_class)
 def __init__(self):
     super(FeatureExtractor_1, self).__init__()
     self.in_channel = 3
     self.sa1 = PointNetSetAbstraction(npoint=1024,
                                       radius=0.2,
                                       nsample=32,
                                       in_channel=self.in_channel,
                                       mlp=[64, 64, 128],
                                       group_all=False)
     self.sa2 = PointNetSetAbstraction(npoint=512,
                                       radius=0.2,
                                       nsample=32,
                                       in_channel=128 + self.in_channel,
                                       mlp=[128, 128, 256],
                                       group_all=False)
     self.sa3 = PointNetSetAbstraction(npoint=128,
                                       radius=0.2,
                                       nsample=32,
                                       in_channel=256 + self.in_channel,
                                       mlp=[256, 256, 512],
                                       group_all=False)
     self.sa4 = PointNetSetAbstraction(npoint=1,
                                       radius=0.2,
                                       nsample=32,
                                       in_channel=512 + self.in_channel,
                                       mlp=[512, 512, 1920],
                                       group_all=False)
Beispiel #5
0
    def __init__(self, out_dim, normal_channel=False):
        super(PointReg_dcp, self).__init__()
        in_channel = 3 if normal_channel else 0
        self.normal_channel = normal_channel
        self.sa1 = PointNetSetAbstractionMsg(
            512, [0.1, 0.2, 0.4], [16, 32, 128], in_channel,
            [[32, 32, 64], [64, 64, 128], [64, 96, 128]])
        self.sa2 = PointNetSetAbstractionMsg(
            128, [0.2, 0.4, 0.8], [32, 64, 128], 320,
            [[64, 64, 128], [128, 128, 256], [128, 128, 256]])
        self.sa3 = PointNetSetAbstraction(None, None, None, 640 + 3,
                                          [256, 256, 512], True)

        self.sa1_x = PointNetSetAbstractionMsg(
            512, [0.1, 0.2, 0.4], [16, 32, 128], -1,
            [[32, 32, 64], [64, 64, 128], [64, 96, 128]])
        self.sa2_x = PointNetSetAbstractionMsg(
            128, [0.2, 0.4, 0.8], [32, 64, 128], 319,
            [[64, 64, 128], [128, 128, 256], [128, 128, 256]])
        self.sa3_x = PointNetSetAbstraction(None, None, None, 640 + 2,
                                            [256, 256, 512], True)

        self.fc1 = nn.Linear(1024, 512)
        self.bn1 = nn.BatchNorm1d(512)
        self.drop1 = nn.Dropout(0.4)
        self.fc2 = nn.Linear(1024, 512)
        self.bn2 = nn.BatchNorm1d(512)
        self.drop2 = nn.Dropout(0.5)
        self.fc3 = nn.Linear(512, 256)
        self.bn3 = nn.BatchNorm1d(256)
        self.drop3 = nn.Dropout(0.5)
        self.fc4 = nn.Linear(256, out_dim)
 def __init__(self, num_classes):
     super(get_model, self).__init__()
     self.sa1 = PointNetSetAbstraction(1024, 0.1, 32, 9 + 3, [32, 32, 64], False)
     self.sa2 = PointNetSetAbstraction(256, 0.2, 32, 64 + 3, [64, 64, 128], False)
     self.sa3 = PointNetSetAbstraction(64, 0.4, 32, 128 + 3, [128, 128, 256], False)
     self.sa4 = PointNetSetAbstraction(16, 0.8, 32, 256 + 3, [256, 256, 512], False)
     self.fp4 = PointNetFeaturePropagation(768, [256, 256]) # note: 768=512+256 equals mlp[-1] from last sa(i.e. sa4) + sa3's output channel(256)  
     self.fp3 = PointNetFeaturePropagation(384, [256, 256])
     self.fp2 = PointNetFeaturePropagation(320, [256, 128])
     self.fp1 = PointNetFeaturePropagation(128, [128, 128, 128])
     self.conv1 = nn.Conv1d(128, 128, 1)
     self.bn1 = nn.BatchNorm1d(128)
     self.drop1 = nn.Dropout(0.5)
     self.conv2 = nn.Conv1d(128, num_classes, 1)
 def __init__(
     self,
     num_class,
     normal_channel=True,
 ):
     # super(get_model,self) 首先找到 get_model 的父类(就是类 nn.Module),然后把类 get_model 的对象转换为类 nn.Module 的对象
     super(get_model, self).__init__()
     # 如果增加法向量信息,则 in_channel = 3
     in_channel = 3 if normal_channel else 0
     self.normal_channel = normal_channel
     # 有三层特征提取
     self.sa1 = PointNetSetAbstractionMsg(
         512, [0.1, 0.2, 0.4], [16, 32, 128], in_channel,
         [[32, 32, 64], [64, 64, 128], [64, 96, 128]])
     self.sa2 = PointNetSetAbstractionMsg(
         128, [0.2, 0.4, 0.8], [32, 64, 128], 320,
         [[64, 64, 128], [128, 128, 256], [128, 128, 256]])
     self.sa3 = PointNetSetAbstraction(None, None, None, 640 + 3,
                                       [256, 512, 1024], True)
     # 有三个全连接层,最后输出指定维数的特征向量
     self.fc1 = nn.Linear(1024, 512)
     self.bn1 = nn.BatchNorm1d(512)
     self.drop1 = nn.Dropout(0.4)
     self.fc2 = nn.Linear(512, 256)
     self.bn2 = nn.BatchNorm1d(256)
     self.drop2 = nn.Dropout(0.5)
     self.fc3 = nn.Linear(256, num_class)
 def __init__(self, cfg):
     super().__init__()
     n_points, k, n_c, d_points, dropout = cfg.num_point, cfg.model.nneighbor, cfg.num_class, cfg.input_dim, cfg.model.dropout
     device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
     # initial MLP
     self.fc1 = nn.Linear(d_points, 32)
     self.fc2 = nn.Linear(32, 32)
     # point transformers
     self.pt1 = TransformerBlock(32, cfg.model.transformer_dim, k, dropout,
                                 device)
     self.td1 = PointNetSetAbstraction(n_points // 4,
                                       0,
                                       k,
                                       35, [64, 64],
                                       group_all=False,
                                       knn=True)
     self.pt2 = TransformerBlock(64, cfg.model.transformer_dim, k, dropout,
                                 device)
     self.td2 = PointNetSetAbstraction(n_points // 16,
                                       0,
                                       k,
                                       67, [128, 128],
                                       group_all=False,
                                       knn=True)
     self.pt3 = TransformerBlock(128, cfg.model.transformer_dim, k, dropout,
                                 device)
     self.td3 = PointNetSetAbstraction(n_points // 64,
                                       0,
                                       k,
                                       131, [256, 256],
                                       group_all=False,
                                       knn=True)
     self.pt4 = TransformerBlock(256, cfg.model.transformer_dim, k, dropout,
                                 device)
     self.td4 = PointNetSetAbstraction(n_points // 256,
                                       0,
                                       k,
                                       259, [512, 512],
                                       group_all=False,
                                       knn=True)
     self.pt5 = TransformerBlock(512, cfg.model.transformer_dim, k, dropout,
                                 device)
     # final MLP
     self.fc3 = nn.Linear(512, 256)
     self.fc4 = nn.Linear(256, 64)
     self.fc5 = nn.Linear(64, n_c)
Beispiel #9
0
 def __init__(self, num_classes):
     super(PointNet2SemSeg, self).__init__()
     self.sa1 = PointNetSetAbstraction(1024, 0.1, 32, 6 + 3, [32, 32, 64],
                                       False)
     self.sa2 = PointNetSetAbstraction(256, 0.2, 32, 64 + 3, [64, 64, 128],
                                       False)
     self.sa3 = PointNetSetAbstraction(64, 0.4, 32, 128 + 3,
                                       [128, 128, 256], False)
     self.sa4 = PointNetSetAbstraction(16, 0.8, 32, 256 + 3,
                                       [256, 256, 512], False)
     self.fp4 = PointNetFeaturePropagation(768, [256, 256])
     self.fp3 = PointNetFeaturePropagation(384, [256, 256])
     self.fp2 = PointNetFeaturePropagation(320, [256, 128])
     self.fp1 = PointNetFeaturePropagation(128, [128, 128, 128])
     self.conv1 = nn.Conv1d(128, 128, 1)
     self.bn1 = nn.BatchNorm1d(128)
     self.drop1 = nn.Dropout(0.5)
     self.conv2 = nn.Conv1d(128, num_classes, 1)
Beispiel #10
0
 def __init__(self, k, nneighbor, channels) -> None:
     super().__init__()
     self.sa = PointNetSetAbstraction(k,
                                      0,
                                      nneighbor,
                                      channels[0],
                                      channels[1:],
                                      group_all=False,
                                      knn=True)
 def __init__(self, num_class, normal_channel=True):
     super(get_model, self).__init__()
     in_channel = 3 if normal_channel else 0
     self.normal_channel = normal_channel
     self.sa1 = PointNetSetAbstractionMsg(512, [0.1, 0.2, 0.4], [16, 32, 128], in_channel,[[32, 32, 64], [64, 64, 128], [64, 96, 128]])
     self.sa2 = PointNetSetAbstractionMsg(128, [0.2, 0.4, 0.8], [32, 64, 128], 320,[[64, 64, 128], [128, 128, 256], [128, 128, 256]])
     self.sa3 = PointNetSetAbstraction(None, None, None, 640 + 3, [256, 512, 1024], True)
     self.fc1 = nn.Linear(1024, 512)
     self.bn1 = nn.BatchNorm1d(512)
     self.drop1 = nn.Dropout(0.4)
     self.fc2 = nn.Linear(512, 256)
     self.bn2 = nn.BatchNorm1d(256)
     self.drop2 = nn.Dropout(0.5)
     self.fc3 = nn.Linear(256, num_class)
Beispiel #12
0
 def __init__(self):
     super(PointNet2ClsMsg, self).__init__()
     self.sa1 = PointNetSetAbstractionMsg(
         512, [0.1, 0.2, 0.4], [16, 32, 128], 0,
         [[32, 32, 64], [64, 64, 128], [64, 96, 128]])
     self.sa2 = PointNetSetAbstractionMsg(
         128, [0.2, 0.4, 0.8], [32, 64, 128], 320,
         [[64, 64, 128], [128, 128, 256], [128, 128, 256]])
     self.sa3 = PointNetSetAbstraction(None, None, None, 640 + 3,
                                       [256, 512, 1024], True)
     self.fc1 = nn.Linear(1024, 512)
     self.bn1 = nn.BatchNorm1d(512)
     self.drop1 = nn.Dropout(0.4)
     self.fc2 = nn.Linear(512, 256)
     self.bn2 = nn.BatchNorm1d(256)
     self.drop2 = nn.Dropout(0.4)
     self.fc3 = nn.Linear(256, 40)