ZhangJUJU / keras-CosineSoftmax-Layer

Implementation of CosineSoftmax Layer for keras:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

keras-CosineSoftmax-Layer

Implementation of CosineSoftmax Layer for keras (softmax with normalized weights and normalized activations):

I changed keras' Dense layer to implement Cosine Metric Learning as proposed in:

Wojke, Nicolai and Bewley, Alex (2018) Deep Cosine Metric Learning for Person Re-Identification. In: IEEE Winter Conference on Applications of Computer Vision (WACV). [Manuscript accepted for publication]

Implementation details:

I changed the following function:

output = K.dot(inputs, self.kernel)

to

output = K.dot(K.l2_normalize(inputs), K.l2_normalize(self.kernel))

and set the default activation function to "softmax" and "use_bias" to False

About

Implementation of CosineSoftmax Layer for keras:


Languages

Language:Python 100.0%