def backbone_pointnet2(self, X_pc, is_train=None): import helper_pointnet2 as pnet2 points_num = tf.shape(X_pc)[1] l0_xyz = X_pc[:,:,0:3] l0_points = X_pc[:,:,3:9] l1_xyz, l1_points, l1_indices = pnet2.pointnet_sa_module(l0_xyz, l0_points, npoint=1024, radius=0.1, nsample=32, mlp=[32, 32, 64], mlp2=None, group_all=False, is_training=None, bn_decay=None, scope='layer1') l2_xyz, l2_points, l2_indices = pnet2.pointnet_sa_module(l1_xyz, l1_points, npoint=256, radius=0.2, nsample=64, mlp=[64, 64, 128], mlp2=None, group_all=False, is_training=None, bn_decay=None, scope='layer2') l3_xyz, l3_points, l3_indices = pnet2.pointnet_sa_module(l2_xyz, l2_points, npoint=64, radius=0.4, nsample=128, mlp=[128, 128, 256], mlp2=None, group_all=False, is_training=None, bn_decay=None, scope='layer3') l4_xyz, l4_points, l4_indices = pnet2.pointnet_sa_module(l3_xyz, l3_points, npoint=None, radius=None, nsample=None, mlp=[256, 256, 512], mlp2=None, group_all=True, is_training=None, bn_decay=None, scope='layer4') # Feature Propagation layers l3_points = pnet2.pointnet_fp_module(l3_xyz, l4_xyz, l3_points, l4_points, [256, 256], is_training=None, bn_decay=None, scope='fa_layer1') l2_points = pnet2.pointnet_fp_module(l2_xyz, l3_xyz, l2_points, l3_points, [256, 256], is_training=None, bn_decay=None,scope='fa_layer2') l1_points = pnet2.pointnet_fp_module(l1_xyz, l2_xyz, l1_points, l2_points, [256, 128], is_training=None, bn_decay=None,scope='fa_layer3') l0_points = pnet2.pointnet_fp_module(l0_xyz, l1_xyz, tf.concat([l0_xyz, l0_points], axis=-1), l1_points,[128, 128, 128, 128], is_training=None, bn_decay=None, scope='fa_layer4') global_features = tf.reshape(l4_points, [-1, 512]) point_features = l0_points # sem l0_points = l0_points[:,:,None,:] sem1 = Ops.xxlu(Ops.conv2d(l0_points, k=(1, 1), out_c=128, str=1, pad='VALID', name='sem1'), label='lrelu') sem2 = Ops.xxlu(Ops.conv2d(sem1, k=(1, 1), out_c=64, str=1, pad='VALID', name='sem2'), label='lrelu') sem2 = Ops.dropout(sem2, keep_prob=0.5, is_train=is_train, name='sem2_dropout') sem3 = Ops.conv2d(sem2, k=(1, 1), out_c=self.sem_num, str=1, pad='VALID', name='sem3') sem3 = tf.reshape(sem3, [-1, points_num, self.sem_num]) self.y_psem_logits = sem3 y_sem_pred = tf.nn.softmax(self.y_psem_logits, name='y_sem_pred') return point_features, global_features, y_sem_pred
def backbone_pointnet(self, X_pc, is_train): [_, _, points_cc] = X_pc.get_shape() points_num = tf.shape(X_pc)[1] X_pc = tf.reshape(X_pc, [-1, points_num, int(points_cc), 1]) l1 = Ops.xxlu(Ops.conv2d(X_pc, k=(1, points_cc), out_c=64, str=1, pad='VALID', name='l1'), label='lrelu') l2 = Ops.xxlu(Ops.conv2d(l1, k=(1, 1), out_c=64, str=1, pad='VALID', name='l2'), label='lrelu') l3 = Ops.xxlu(Ops.conv2d(l2, k=(1, 1), out_c=64, str=1, pad='VALID', name='l3'), label='lrelu') l4 = Ops.xxlu(Ops.conv2d(l3, k=(1, 1), out_c=128, str=1, pad='VALID', name='l4'), label='lrelu') l5 = Ops.xxlu(Ops.conv2d(l4, k=(1, 1), out_c=1024, str=1, pad='VALID', name='l5'), label='lrelu') global_features = tf.reduce_max(l5, axis=1, name='maxpool') global_features = tf.reshape(global_features, [-1, int(l5.shape[-1])]) point_features = tf.reshape(l5, [-1, points_num, int(l5.shape[-1])]) #### sem g1 = Ops.xxlu(Ops.fc(global_features, out_d=256, name='semg1'), label='lrelu') g2 = Ops.xxlu(Ops.fc(g1, out_d=128, name='semg2'), label='lrelu') sem1 = tf.tile(g2[:,None,None,:], [1, points_num, 1, 1]) sem1 = tf.concat([l5, sem1], axis=-1) sem1 = Ops.xxlu(Ops.conv2d(sem1, k=(1,1), out_c=512, str=1, pad='VALID', name='sem1'), label='lrelu') sem2 = Ops.xxlu(Ops.conv2d(sem1, k=(1, 1), out_c=256, str=1, pad='VALID', name='sem2'), label='lrelu') sem3 = Ops.xxlu(Ops.conv2d(sem2, k=(1, 1), out_c=128, str=1, pad='VALID', name='sem3'), label='lrelu') sem3 = Ops.dropout(sem3, keep_prob=0.5, is_train=is_train, name='sem3_dropout') sem4 = Ops.conv2d(sem3, k=(1, 1), out_c=self.sem_num, str=1, pad='VALID', name='sem4') sem4 = tf.reshape(sem4, [-1, points_num, self.sem_num]) self.y_psem_logits = sem4 y_sem_pred = tf.nn.softmax(self.y_psem_logits, name='y_sem_pred') return point_features, global_features, y_sem_pred