I want to compute Earth Mover's Distance between two pointclouds as loss function in Tensorflow.
pointclouds1 = tf.placeholder(tf.float32, shape=(batch_size, num_point, 3))
pointclouds2 = tf.placeholder(tf.float32, shape=(batch_size, num_point, 3))
//'3' means xyz coordinate
def get_loss(pointclouds1, pointclouds2):
loss = EMD.getEMD(pointclouds1,pointclouds2)
return loss
Unfortunately,I get the error:
File "F:\pointclouds\utils\EMD.py", line 71, in groundDistance
return np.linalg.norm(x1 - x2, norm)
File "C:\Users\xu\Anaconda3\lib\site-packages\numpy\linalg\linalg.py", line 2257, in norm
raise ValueError("Improper number of dimensions to norm.")
ValueError: Improper number of dimensions to norm.
The EMD.py is from https://github.com/chalmersgit/EMD/blob/master/EMD.py
But I can use the file to operate numpy array directly:
>>python EMD.py
EMD
We got: 160.542759771
C example got 160.54277
Success
I guess it means I cannot operate Tensor directly, so what should I do?