centorloss论文阅读

在对人脸centorloss论文的阅读做的笔记如下

目的:
enhance the discriminative power of the deeply learned features
增强特征的判别能力
思想:
     聚类,联合损失函数

方法论:

    图示显示数据的分布
原理:

    将softmaxloss和centorloss两个损失函数联合起来就行监督

相关:
    tripletloss,focalloss,Large-Margin Softmax Loss
数据集:
LFW,YFW,Megaface

关键句子
1. With the joint supervision of softmax loss and center loss,we can train a robust CNNs
联合监督
2. 

图像解读


1.网络采用的是resnet作为基底

2.网络采用多个loss共同训练


1. 这个图像是以lenet作为实验来看的

2. 为了简单fc5的输出是只有两个(称为两维),一个数字叫一个特征

作者[1]写了作者开发的心路历程,很不错。可以参考一下。

代码[2]也已经放出来了


部分伪代码

#-*-coding:utf-8-*-
'''
author:dezan zhao
date  :2018-01-26
paper :A Discriminative Feature Learning Approach for Deep Face Recognition
note  :just for study,not comercial
'''
import numpy.linalg as LA
import math
import numpy as np
'''
功能:
	计算soft-loss:计算一个特征向量的softmax值
输入:
	y:输入特征向量
	k:真实的标签值
输出:
	softmax值
'''
softmax(y,k):
	exp_sum = np.exp(y).sum() 
	return math.exp(y[k])/exp_sum
SOFTMAX(Y,K):
	out = []
	for i in range(len(K)):
		exp_sum = np.exp(Y[i],K[i])
		out.append(exp_sum)
	return out
softmax_loss(Y,N):
	np.log(softmax())
'''
#计算center-loss
输入:
	x:向量
	c_y:the y[i] class center of deep features
输出:
	
'''
center_loss(x,c_y):
	return value = (LA.norm(x-c_y)**2)/2.0
	
[1] centerloss实战源码

posted @ 2018-01-26 15:05  开往春天的拖拉机  阅读(164)  评论(0编辑  收藏  举报