INNER CODE UNIT · Python
extract
introlab/rtabmap · corelib/src/python/rtabmap_netvlad.py:53
def extract(image):
print(f"NetVLAD python extract{image.shape}")
global image_batch
global net_out
global sess
global dim
if(image.shape[2] == 1):
image = np.dstack((image, image, image))
batch = np.expand_dims(image, axis=0)
result = sess.run(net_out, feed_dict={image_batch: batch})
# All that needs to be done (only valid for NetVLAD+whitening networks!)
# to reduce the dimensionality of the NetVLAD representation below 4096 to D
# is to keep the first D dimensions and L2-normalize.
if(result.shape[1] > dim):
v = result[:, :dim]