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

Question about Intra-Normalization #71

Open
borongyuan opened this issue Mar 15, 2024 · 0 comments
Open

Question about Intra-Normalization #71

borongyuan opened this issue Mar 15, 2024 · 0 comments

Comments

@borongyuan
Copy link

Hi,
I noticed that for intra-normalization, it's performing L2 norm along axis 1. And axis 1 is n_clusters after reduce_sum. Based on my understanding of intra-normalization, L2 norm should be performed along feature_dim, which is axis 2. Did I misunderstand?

clusters = slim.model_variable(
'clusters', shape=[1, 1, 1, config['n_clusters'], feature_dim],
initializer=slim.initializers.xavier_initializer(), trainable=training)
residuals = clusters - tf.expand_dims(feature_map, axis=3)
residuals *= tf.expand_dims(memberships, axis=-1)
if mask is not None:
residuals *= tf.to_float(mask)[..., tf.newaxis, tf.newaxis]
descriptor = tf.reduce_sum(residuals, axis=[1, 2])
descriptor = tf.nn.l2_normalize(descriptor, axis=1) # intra-normalization
descriptor = tf.reshape(descriptor,
[batch_size, feature_dim*config['n_clusters']])
descriptor = tf.nn.l2_normalize(descriptor, axis=1)
return descriptor

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

1 participant