How to Implement Center Loss and Other Running Averages of Labeled Embeddings
<p>A recent paper (<a href="http://ydwen.github.io/papers/WenECCV16.pdf" rel="noreferrer">here</a>) introduced a secondary loss function that they called center loss. It is based on the distance between the embeddings in a batch and the running average embedding for each of the respective classes. There has been some discussion in the TF Google groups (<a href="https://groups.google.com/a/tensorflow.org/forum/#!topic/discuss/0Am9FCdFAxg" rel="noreferrer">here</a>) regarding how such embedding centers can be computed and updated. I've put together some code to generate class-average embeddings in my answer below. </p>

<p>Is this the best way to do this?</p>