Open JR9124 opened 5 years ago
I see you closed this, did you find the problem ? If not, let me know and I will look into it.
The sum of Q in get_3DmFV in utils.py is not equal to 1 while you enforce the sum of Q to be 1 in get_3dmfv in tf_util.py. That's the reason. BTW, do you think is it effective of reshaping fv to be [batch_size, 20, resresres] instead of [batch_size, 20, res, res, res] and training by deep neural network? Thanks!
It is my experience that it will not be as effective since you will lose the prior knowledge of the spatial connections. Regarding the sum to one. They should be the same. I will look into it and try to push a fix soon. (the numpy version was not used in the paper and was created just for visualization purposes).
Thanks for your advice. I have tested the code by changing
w_p = p_per_point Q = w_p # enforcing the assumption that the sum is 1
to
w_p = np.multiply(p_per_point, batch_w) Q = w_p / np.tile(np.expand_dims(np.sum(w_p, axis=-1), -1), [1, 1, n_gaussians])
then, the results obtained by get_3DmFV in utils.py and get_3dmfv in tf_util.py are the same.
thinks for sharing you work In utils.py and tf_util.py, you have realized 3DmFV using numpy and tensorflow. However, I find there is a little different between them. In utils.py(line 292 to 294), you directly assigned:
However, after I use the following code to test (test data is car_130.txt from your 3DmFV-Tutorial-master), I get different results (by the above analysis, I think Q_per_d, Q_per_d0 and Q_per_d1 should equal to each other).
` n_gaussians = 8
variance = np.square(1.0/n_gaussians)
gmm = utils.get_grid_gmm(subdivisions=[n_gaussians, n_gaussians, n_gaussians], variance=variance)
points = utils.load_point_cloud_from_txt('car_130.txt')
points = np.expand_dims(points, axis=0)
import tensorflow as tf
n_batches = points.shape[0]
n_points = points.shape[1]
ngaussians = gmm.means.shape[0]
D = gmm.means_.shape[1]
w_p = p_per_point Q = w_p # enforcing the assumption that the sum is 1 Q_per_d = np.tile(np.expand_dims(Q, -1), [1, 1, 1, D]) while in tf_util.py(line 610 to 613), you did this: w_p = tf.multiply(p_per_point,batch_w) Q = w_p/tf.tile(tf.expand_dims(tf.reduce_sum(w_p, axis=-1), -1),[1, 1, n_gaussians]) Q_per_d = tf.tile(tf.expand_dims(Q, -1), [1, 1, 1, D]) I think the two operations can achieve the same result as elements in batch_w are all the same value and both numerator and denominator of the following equation have the same w which can be eliminated, thus to enforce the assumption(line 610 and 612 in tf_util.py) is not necessary.
` I think get_3dmfv in tf_util.py can help to get right 3DmFV, but after analysis, I haven't found wrong place in get_3DmFV( in utils.py ), so could you tell me the reason? thank you!