cvlab-epfl / LIFT

Code release for the ECCV 2016 paper
487 stars 168 forks source link

Soft Argmax implementation #42

Closed johnwlambert closed 5 years ago

johnwlambert commented 5 years ago

Hi Dr. Yi -- question about the soft argmax mentioned in the paper. Given logits [0.1, 0.7, 0.05, 0.15], where the hard argmax would be 1, the soft argmax delivers 1.007 (as shown below). How can you use that float as a hard index (i.e. integer)? Or does the STN not need an integer to extract the patch?

import numpy as np
x = np.arange(4)
y = np.array([0.1,0.7, 0.05, 0.15])
result = np.sum( np.exp(y * 10) * x)
result / np.sum( np.exp(y * 10))
1.007140612556097

Could you also point me to where in the codebase you are performing this step? Thank you!

kmyi commented 5 years ago

Or does the STN not need an integer to extract the patch?

This is the case. You can have a look at the tf-lift repository for the full TF implementation. this implementation is just too old

johnwlambert commented 5 years ago

Got it, thanks.