Exemplo n.º 1
0
 def __init__(self, *, npoint: int, radii: List[float], nsamples: List[int], mlps: List[List[int]], bn: bool = True, use_xyz: bool = True):
     super().__init__()
     assert len(radii) == len(nsamples) == len(mlps)
     self.npoint = npoint
     self.groupers = nn.ModuleList()
     self.mlps = nn.ModuleList()
     for i in range(len(radii)):
         radius = radii[i]
         nsample = nsamples[i]
         self.groupers.append(
             pointops.QueryAndGroup(radius, nsample, use_xyz=use_xyz)
             if npoint is not None else pointops.GroupAll(use_xyz)
         )
         mlp_spec = mlps[i]
         if use_xyz:
             mlp_spec[0] += 3
         self.mlps.append(pt_util.SharedMLP(mlp_spec, bn=bn))
Exemplo n.º 2
0
 def __init__(self,
              npoint=None,
              nsample=None,
              mlp=None,
              mlp2=None,
              bn=True,
              use_xyz=True,
              use_bn=True):
     super().__init__()
     self.npoint = npoint
     self.grouper = pointops.QueryAndGroup(
         nsample=nsample, use_xyz=use_xyz
     ) if npoint is not None else pointops.GroupAll(use_xyz)
     if use_xyz:
         mlp[0] += 3
     if npoint is not None:
         mlp_tmp = pt_util.SharedMLP([mlp[0]] + mlp2, bn=use_bn)
         mlp_tmp.add_module('weight', (pt_util.SharedMLP(
             [mlp2[-1], mlp[0]], bn=False, activation=None)))
         self.afa = _AFAModule(mlp=mlp_tmp)
     self.mlp = pt_util.SharedMLP(mlp, bn=bn)
Exemplo n.º 3
0
    def __init__(self, *, npoint: int, radii: List[float], nsamples: List[int], sp_knns: List[int], sp_nums: List[int], mlps: List[List[int]], bn: bool = True, use_xyz: bool = True):
        super().__init__()
        assert len(radii) == len(nsamples) == len(mlps)
        self.npoint = npoint
        self.groupers = nn.ModuleList()
        self.sp_knnquery = nn.ModuleList()
        self.sp_knngroup = nn.ModuleList()
        self.sp_knnquery_for_3rd = nn.ModuleList()
        self.sp_group = nn.ModuleList() 
        self.sp_knnquery3 = nn.ModuleList() 
        self.sp_knngroup3 = nn.ModuleList() 
        
        self.mlps_1d = nn.ModuleList() 
        self.mlps_delta_xyz = nn.ModuleList() 
        self.mlps_delta_fea = nn.ModuleList()
        self.mlps_w = nn.ModuleList()
        self.mlps_new = nn.ModuleList() 

        self.mlps_delta_xyz2 = nn.ModuleList()
        self.mlps_w2 = nn.ModuleList() 
        self.mlps_w3 = nn.ModuleList()
        self.mlps_sp_fea3 = nn.ModuleList()
        
        self.list_sp_num = []     


        for i in range(len(radii)):
            radius = radii[i]
            nsample = nsamples[i]
            sp_knn = sp_knns[i]
            sp_num = sp_nums[i]
            print('radius: {} nsample: {} sp_knn: {} sp_num: {}'.format(radius, nsample, sp_knn, sp_num))
            self.groupers.append(
                pointops.PointNL_QueryAndGroup(radius, nsample, use_xyz=use_xyz)
                if npoint is not None else pointops.GroupAll(use_xyz)
            )
            self.sp_knnquery.append(
                pointops.SP_KNNQuery(nsample=sp_knn)
            )
            self.sp_knnquery_for_3rd.append(
                pointops.SP_KNNQuery(nsample=sp_num)
            )
            self.sp_knngroup.append(
                pointops.SP_KNNGroup_V1(use_xyz=use_xyz)
            )
            self.sp_knnquery3.append(
                pointops.SP_KNNQuery(nsample=sp_knn)
            )
            self.sp_knngroup3.append(
                pointops.SP_KNNGroup_V1(use_xyz=use_xyz)
            )
            self.sp_group.append(
                pointops.SP_Group()
            )

            self.list_sp_num.append(sp_num)


            mlp_spec = mlps[i]
            if use_xyz:
                mlp_spec[0] += 0
            
            self.mlps_1d.append(pt_util.SharedMLP_1d(mlp_spec, bn=bn))
            self.mlps_delta_xyz.append(pt_util.SharedMLP([3, 32, 16], bn=bn))
            self.mlps_delta_xyz2.append(pt_util.SharedMLP([3, 32, 16], bn=bn)) 

            self.mlps_w.append(pt_util.SharedMLP([mlp_spec[-1]+3, 32, 64, mlp_spec[-1]+16], bn=bn))
            self.mlps_w2.append(pt_util.SharedMLP([mlp_spec[-1]+16+3, 64, mlp_spec[-1]+16*2], bn=bn)) 
            self.mlps_w3.append(pt_util.SharedMLP([mlp_spec[-1]+16*2, 32, 64, mlp_spec[-1]+16*2], bn=bn))
            
            self.mlps_sp_fea3.append(pt_util.SharedMLP([mlp_spec[-1]+16*2+3, 32, 64, mlp_spec[-1]], bn=bn))

            if i<2:
                self.mlps_new.append(pt_util.SharedMLP_1d([mlp_spec[-1]*7+16*8, 256, mlp_spec[-1]], bn=bn))
            elif i==2:
                self.mlps_new.append(pt_util.SharedMLP_1d([mlp_spec[-1]*7+16*8, 512, mlp_spec[-1]], bn=bn)) 
            else:
                self.mlps_new.append(pt_util.SharedMLP_1d([mlp_spec[-1]*7+16*8, 1024, mlp_spec[-1]], bn=bn))