I'm attempting to filter a matrix that represents a point cloud in tensorflow. It is an n x 3 matrix.
I only want to keep rows with z > eps. This corresponds to column index 2 of the matrix.
I have the following code:
import numpy as np
import tensorflow as tf
point_cloud = tf.placeholder(tf.float32, shape=[None,3])
eps = tf.placeholder(tf.float32)
mask = tf.greater(point_cloud[:,2], eps)
reduced_cloud = tf.boolean_mask(point_cloud, mask)
init = tf.global_variables_initializer()
with tf.Session() as sess:
sess.run(init)
_cloud = np.random.rand(5000,3)
feed = {point_cloud:_cloud, eps:0.0025}
_filtered = sess.run(reduced_cloud, feed_dict=feed)
When I run the above code I get this:
ValueError: Number of mask dimensions must be specified, even if some dimensions are None. E.g. shape=[None] is ok, but shape=None is not.
I don't understand the error message, having tried to specify shape in a number of places with no success, and the documentation seems to suggest the boolean_mask only works with np.arrays. Is there any way to do this entirely on the tensorflow graph?