示例#1
0
 def create_encoder(self, inputs, npts):
     with tf.variable_scope('encoder_0', reuse=tf.AUTO_REUSE):
         features = mlp_conv(inputs, [128, 256])
         features_global = point_unpool(point_maxpool(features, npts, keepdims=True), npts)
         features = tf.concat([features, features_global], axis=2)
     with tf.variable_scope('encoder_1', reuse=tf.AUTO_REUSE):
         features = mlp_conv(features, [512, 1024])
         features = point_maxpool(features, npts)
     return features
示例#2
0
    def create_decoder(self, features):
        with tf.variable_scope('decoder', reuse=tf.AUTO_REUSE):
            coarse = mlp(features, [1024, 1024, self.num_coarse * 3])
            coarse = tf.reshape(coarse, [-1, self.num_coarse, 3])

        with tf.variable_scope('folding', reuse=tf.AUTO_REUSE):
            grid = tf.meshgrid(tf.linspace(-0.05, 0.05, self.grid_size),
                               tf.linspace(-0.05, 0.05, self.grid_size))
            grid = tf.expand_dims(tf.reshape(tf.stack(grid, axis=2), [-1, 2]),
                                  0)
            grid_feat = tf.tile(grid, [features.shape[0], self.num_coarse, 1])

            point_feat = tf.tile(tf.expand_dims(coarse, 2),
                                 [1, 1, self.grid_size**2, 1])
            point_feat = tf.reshape(point_feat, [-1, self.num_fine, 3])

            global_feat = tf.tile(tf.expand_dims(features, 1),
                                  [1, self.num_fine, 1])

            feat = tf.concat([grid_feat, point_feat, global_feat], axis=2)

            center = tf.tile(tf.expand_dims(coarse, 2),
                             [1, 1, self.grid_size**2, 1])
            center = tf.reshape(center, [-1, self.num_fine, 3])

            fine = mlp_conv(feat, [512, 512, 3]) + center
        return coarse, fine