def __init__(self, input_channels=6, do_interpolation=False): super().__init__() print('PNv2_ASAP-1') self.do_interpolation = do_interpolation self.SA_modules = nn.ModuleList() channel_in = input_channels skip_channel_list = [input_channels] for k in range(NPOINTS.__len__()): mlps = MLPS[k].copy() channel_out = 0 for idx in range(mlps.__len__()): mlps[idx] = [channel_in] + mlps[idx] channel_out += mlps[idx][-1] self.SA_modules.append( PointnetSAModuleMSG(npoint=NPOINTS[k], radii=RADIUS[k], nsamples=NSAMPLE[k], mlps=mlps, use_xyz=True, bn=True)) skip_channel_list.append(channel_out) channel_in = channel_out self.tem_sa1 = PointnetSAModule(mlp=MLP1, npoint=NPOINT1, nsample=NSAMPLE1, radius=RADIUS1) self.fuse_layer1_atten = nn.Conv1d(MLP1[-1] * 2, 2, kernel_size=1, stride=1) self.fuse_layer1 = nn.Conv1d(MLP1[-1], 384, kernel_size=1, stride=1) self.tem_fp1 = PointnetFPModule(mlp=FP_MLP1) self.tem_dropout = nn.Dropout(DP_RATIO) self.FP_modules = nn.ModuleList() for k in range(FP_MLPS.__len__()): pre_channel = FP_MLPS[ k + 1][-1] if k + 1 < len(FP_MLPS) else channel_out self.FP_modules.append( PointnetFPModule(mlp=[pre_channel + skip_channel_list[k]] + FP_MLPS[k])) cls_layers = [] pre_channel = FP_MLPS[0][-1] for k in range(0, CLS_FC.__len__()): cls_layers.append(pt_utils.Conv1d(pre_channel, CLS_FC[k], bn=True)) pre_channel = CLS_FC[k] cls_layers.append(pt_utils.Conv1d(pre_channel, 20, activation=None)) cls_layers.insert(1, nn.Dropout(0.5)) self.cls_layer = nn.Sequential(*cls_layers)
def __init__(self, input_channels=6): super().__init__() self.SA_modules = nn.ModuleList() channel_in = input_channels skip_channel_list = [input_channels] for k in range(NPOINTS.__len__()): # k = 0,1,2,3 mlps = MLPS[k].copy() # mlps=MLPS[0], MLPS[1], MLPS[2], MLPS[3] channel_out = 0 for idx in range(mlps.__len__()): # idx = 0,1 mlps[idx] = [channel_in] + mlps[ idx] #mlps=[0] = [0, 16, 16, 32] mlps[1] = [0, 32, 32, 64] channel_out += mlps[idx][-1] # channel_out = 32+64 = 96 self.SA_modules.append( PointnetSAModuleMSG( npoint=NPOINTS[k], radii=RADIUS[k], nsamples=NSAMPLE[k], mlps=mlps, #[[0, 16, 16, 32], [0, 32, 32, 64]] use_xyz=True, bn=True)) skip_channel_list.append(channel_out) channel_in = channel_out self.FP_modules = nn.ModuleList() for k in range(FP_MLPS.__len__()): pre_channel = FP_MLPS[ k + 1][-1] if k + 1 < len(FP_MLPS) else channel_out self.FP_modules.append( PointnetFPModule(mlp=[pre_channel + skip_channel_list[k]] + FP_MLPS[k])) cls_layers = [] pre_channel = FP_MLPS[0][-1] for k in range(0, CLS_FC.__len__()): cls_layers.append(pt_utils.Conv1d(pre_channel, CLS_FC[k], bn=True)) pre_channel = CLS_FC[k] cls_layers.append(pt_utils.Conv1d(pre_channel, 1, activation=None)) cls_layers.insert(1, nn.Dropout(0.5)) self.cls_layer = nn.Sequential(*cls_layers)