zhen8838 / Circle-Loss

Tensorflow2 implementation of CircleLoss. Support class-level, sparse class-level, pair-wise labels
MIT License
108 stars 40 forks source link

Any idea of using circle loss in a generative model? #4

Closed parap1uie-s closed 4 years ago

parap1uie-s commented 4 years ago

Hi, thanks for the awesome implementation of Circle Loss.

We know that metric learning methods can essentially create a generative model, like main_emmbed.py, we could acquire emmbeding layer's output with 3D-vector to print a spherical map.

However, I noticed that the output of the complete model was generated by a 10-dimensional fully connected layer, which means that the model is a discriminant model.

Is there any way to directly use the output of the embedding layer as a generative model to achieve classification? Like np.argmin(distance) (prototypical network)?

zhen8838 commented 4 years ago

不好意思,我对于prototypical network不太了解。如果想使用向量距离进行分类首先需要确定分类阈值。

  1. circle loss中倒数第二层的输出为特征向量,最后的dense层的权重W实际上学习分类中心,我觉得可以先按正常的流程训练分类模型,然后计算输出特征向量与权重W的相似度进行分类(这样和正常的分类实际没区别)。

  2. 可以考虑结合胶囊网络的分类方法: 把多分类问题转换多个二分类问题,不过这样得修改原本的circle loss计算方式。

  3. 可以考虑类似人脸识别的方法,用配对样本进行训练。训练结束后可以用一些同类数据算出特征向量的分布中心,未知样本的特征向量可以和分类中心向量进行相似度计算再分类。

parap1uie-s commented 4 years ago

我明白了。最后一个全连接层里权值矩阵,本身就是类似于anchor一样的聚类中心。多谢