项目作者: koshian2

项目描述 :
Unofficial implementation of "Max-margin Class Imbalanced Learning with Gaussian Affinity"
高级语言: Python
项目地址: git://github.com/koshian2/affinity-loss.git
创建时间: 2019-02-05T12:21:57Z
项目社区:https://github.com/koshian2/affinity-loss

开源协议:MIT License

下载


Affinity-loss

Unofficial implementation of “Max-margin Class Imbalanced Learning with Gaussian Affinity” by TensorFlow, Keras.

Munawar Hayat, Salman Khan, Waqas Zamir, Jianbing Shen, Ling Shao. Max-margin Class Imbalanced Learning with Gaussian Affinity. 2019. https://arxiv.org/abs/1901.07711

How to use

Use “Clustering Affinity” Layer:

  1. from affinity_loss import *
  2. x = ClusteringAffinity(10, 1, 10.0)(some_input) # n_classes, n_centroids, sigma

Be sure that the output dimension is one more than the number of classes. This is to pass the diversity regularizer to the loss function. Use “affinity_loss” loss function on compiling.

  1. model.compile("adam", affinity_loss(0.75), [acc]) # lambda

Reimplementation

MNIST, lambda=0.75, sigma=10. Evaluate on macro f1-score.

# samples per class on test data Softmax Affinity m=1 Affinity m=5
500 99.28% 99.39% 99.33%
200 99.03% 99.20% 99.12%
100 98.79% 98.97% 98.75%
50 98.20% 98.54% 98.65%
20 98.56% 98.36% 98.85%
10 97.83% 98.27% 98.85%

More details(Japanese)