MCPcopy Create free account
hub / github.com/charlesq34/pointnet / input_transform_net

Function input_transform_net

models/transform_nets.py:10–52  ·  view source on GitHub ↗

Input (XYZ) Transform Net, input is BxNx3 gray image Return: Transformation matrix of size 3xK

(point_cloud, is_training, bn_decay=None, K=3)

Source from the content-addressed store, hash-verified

8import tf_util
9
10def input_transform_net(point_cloud, is_training, bn_decay=None, K=3):
11 """ Input (XYZ) Transform Net, input is BxNx3 gray image
12 Return:
13 Transformation matrix of size 3xK """
14 batch_size = point_cloud.get_shape()[0].value
15 num_point = point_cloud.get_shape()[1].value
16
17 input_image = tf.expand_dims(point_cloud, -1)
18 net = tf_util.conv2d(input_image, 64, [1,3],
19 padding='VALID', stride=[1,1],
20 bn=True, is_training=is_training,
21 scope='tconv1', bn_decay=bn_decay)
22 net = tf_util.conv2d(net, 128, [1,1],
23 padding='VALID', stride=[1,1],
24 bn=True, is_training=is_training,
25 scope='tconv2', bn_decay=bn_decay)
26 net = tf_util.conv2d(net, 1024, [1,1],
27 padding='VALID', stride=[1,1],
28 bn=True, is_training=is_training,
29 scope='tconv3', bn_decay=bn_decay)
30 net = tf_util.max_pool2d(net, [num_point,1],
31 padding='VALID', scope='tmaxpool')
32
33 net = tf.reshape(net, [batch_size, -1])
34 net = tf_util.fully_connected(net, 512, bn=True, is_training=is_training,
35 scope='tfc1', bn_decay=bn_decay)
36 net = tf_util.fully_connected(net, 256, bn=True, is_training=is_training,
37 scope='tfc2', bn_decay=bn_decay)
38
39 with tf.variable_scope('transform_XYZ') as sc:
40 assert(K==3)
41 weights = tf.get_variable('weights', [256, 3*K],
42 initializer=tf.constant_initializer(0.0),
43 dtype=tf.float32)
44 biases = tf.get_variable('biases', [3*K],
45 initializer=tf.constant_initializer(0.0),
46 dtype=tf.float32)
47 biases += tf.constant([1,0,0,0,1,0,0,0,1], dtype=tf.float32)
48 transform = tf.matmul(net, weights)
49 transform = tf.nn.bias_add(transform, biases)
50
51 transform = tf.reshape(transform, [batch_size, 3, K])
52 return transform
53
54
55def feature_transform_net(inputs, is_training, bn_decay=None, K=64):

Callers 2

get_modelFunction · 0.90
get_modelFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected