Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to find indices of the points which are sampled with 'farthest data sampling' method? #32

Open
ashar6194 opened this issue Apr 17, 2018 · 1 comment

Comments

@ashar6194
Copy link

Or how exactly should we sample the corresponding label of each single point?

@oafolabi
Copy link

Yes, you may have to get the tensor that does that operation. For example, you may do something similar to the following:

You may restore the session and get the placeholders like this :

sess = tf.Session(config=config)

init = tf.global_variables_initializer()
sess.run(init)

saver = tf.train.import_meta_graph(META_GRAPH)
saver.restore(sess, tf.train.latest_checkpoint(LOG_DIR))

# We can now access the default graph where all our metadata has been loaded
graph = tf.get_default_graph()

# tmp = graph.get_operations()

# tmp = [n.name for n in graph.as_graph_def().node]

# print tmp

 
# placeholders we need
farthest_points_pl = graph.get_tensor_by_name('layer1/FarthestPointSample:0')
pointclouds_pl = graph.get_tensor_by_name('Placeholder:0')
pred_pl = graph.get_tensor_by_name('fc2/BiasAdd:0')

is_training_pl = graph.get_tensor_by_name('Placeholder_3:0')

META_GRAPH and LOG_DIR are directory paths you define.

Then run a forward pass:

TEST_DATASET = scannet_dataset.ScannetDatasetWholeScene(...)
batch_data, batch_label, batch_smpw = TEST_DATASET[scene_idx]
feed_dict = {pointclouds_pl: batch_data,
            is_training_pl: False}
farthest_points, pred_val = sess.run([farthest_points_pl,pred_pl], feed_dict=feed_dict)

farthest_points should give you something close to what you're looking for. Please see

def pointnet_sa_module(xyz, points, npoint, radius, nsample, mlp, mlp2, group_all, is_training, bn_decay, scope, bn=True, pooling='max', knn=False, use_xyz=True, use_nchw=False):

and it's containing file for more info.

Hopefully that helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants