资源算法keras-triplet-center-loss

keras-triplet-center-loss

2020-04-03 | |  33 |   0 |   0

keras-triplet-center-loss

A simple Keras implementation of Triplet-Center Loss on the MNIST dataset. As a reference in this repository also implementations of other two similar losses, Center-Loss and Triplet-Loss are included.

The Center-Loss implementation is from shamangaryhttps://github.com/shamangary/Keras-MNIST-center-loss-with-visualization

The Triplet-Loss implementation is from KinWaiCheukhttps://github.com/KinWaiCheuk/Triplet-net-keras


Triplet-Center Loss

Triplet-Center Loss has been introduced by He et al. in https://arxiv.org/abs/1803.06189. It is an "hybrid" loss between Center Loss and Triplet Loss that allows to maximise inter-class distance and minimize intra-class distance.

Details

In this repository a simple implementation on the MNSIT or alternatively Fashion MNIST is shown.

Running main.py will start sequentially 4 training routines with 4 different losses:

  • Categorical Crossentropy only

  • Center-loss + Categorical Crossentropy

  • Triplet-loss + Categorical Crossentropy

  • Triplet-Center loss + Categorical Crossentropy

In Folder runs there will be the results of those models, including Tensorboard summaries. Also T-SNE is run on the embeddings to visualize how the network internal representation changes as the loss is changed.


triplet-center loss, T-SNE on internal representation (Train Data):

图片.png

Center loss, T-SNE on internal representation (Train Data):

图片.png

Triplet loss, T-SNE on internal representation (Train Data):

图片.png

As it can be seen the triplet-center loss maximises the inter-class distance as the Triplet Loss while keeping the Center-loss characteristic of minimizing intra-class distance. Another advantage of Triplet-Center loss is that it does not need advanced batching and triplet selection mining techniques as the Triplet-Loss does.

上一篇:MNIST-center-loss

下一篇:fast_center_loss

用户评价
全部评价

热门资源

  • Keras-ResNeXt

    Keras ResNeXt Implementation of ResNeXt models...

  • seetafaceJNI

    项目介绍 基于中科院seetaface2进行封装的JAVA...

  • spark-corenlp

    This package wraps Stanford CoreNLP annotators ...

  • capsnet-with-caps...

    CapsNet with capsule-wise convolution Project ...

  • inferno-boilerplate

    This is a very basic boilerplate example for pe...