https://github.com/happynear/amsoftmax
A simple yet effective loss function for face verification.
https://github.com/happynear/amsoftmax
deep-learning face-recognition loss-functions metric-learning softmax
Last synced: 5 months ago
JSON representation
A simple yet effective loss function for face verification.
- Host: GitHub
- URL: https://github.com/happynear/amsoftmax
- Owner: happynear
- License: mit
- Created: 2017-12-30T06:56:41.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-03T02:13:10.000Z (almost 8 years ago)
- Last Synced: 2025-01-16T10:26:24.450Z (over 1 year ago)
- Topics: deep-learning, face-recognition, loss-functions, metric-learning, softmax
- Language: Matlab
- Homepage:
- Size: 1.04 MB
- Stars: 488
- Watchers: 35
- Forks: 129
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Additive Margin Softmax for Face Verification
by Feng Wang, Weiyang Liu, Haijun Liu, Jian Cheng
The paper is available as a technical report at [arXiv](https://arxiv.org/abs/1801.05599).
### Introduction

In this work, we design a new loss function which merges the merits of both [NormFace](https://github.com/happynear/NormFace) and [SphereFace](https://github.com/wy1iu/sphereface). It is much easier to understand and train, and outperforms the previous state-of-the-art loss function (SphereFace) by 2-5% on MegaFace.
### Citation
If you find **AM-Softmax** useful in your research, please consider to cite:
@article{Wang_2018_amsoftmax,
title = {Additive Margin Softmax for Face Verification},
author = {Wang, Feng and Liu, Weiyang and Liu, Haijun and Cheng, Jian},
journal = {arXiv preprint arXiv:1801.05599},
year = {2018}
}
### Training
**Requirements:** My Caffe version https://github.com/happynear/caffe-windows. This version can also be compiled in Linux.
The prototxt file is in `./prototxt`. The batch size is set to 256. If your GPU's memory is not sufficient enough, you may set `iter_size: 2` in `face_solver.prototxt` and `batch_size: 128` in `face_train_test.prototxt`.
The dataset used for training is CASIA-Webface. We removed 59 identities that are duplicated with LFW (17) and MegaFace Set 1 (42). This is why the final inner-product layer's output is `10516`. The list of the duplicated identities can be found in https://github.com/happynear/FaceDatasets.
All other settings are the same with SphereFace. Please refer to the details in [SphereFace's repository](https://github.com/wy1iu/sphereface).
PS: If you want to try the margin scheme described in [ArcFace](https://arxiv.org/abs/1801.07698), you may try to transplant [this
layer](https://github.com/happynear/caffe-windows/blob/experiment/src/caffe/layers/label_specific_margin.cu) in the `experiment` branch of my Caffe repository. `LabelSpecificHardMarginForward()` is the kernel function for `cos(theta+m)`.
### Model and Training Log
Feature normalized, s=30, m=0.35: [OneDrive](https://stduestceducn-my.sharepoint.com/:u:/g/personal/201411020102_std_uestc_edu_cn/ER-9FNdXCXtPlZAwZQwFmW0BdMVUjG8_y9IodYfoHVYXSg?e=QBG13o), [Baidu Yun](https://pan.baidu.com/s/1hulG7QW) .
### Results
See our [arXiv technical report](https://arxiv.org/abs/1801.05599).
### 3rd-Party Re-implementation
- TensorFlow: [code](https://github.com/Joker316701882/Additive-Margin-Softmax) by [Joker316701882](https://github.com/Joker316701882).
- TensorFlow: [code](https://github.com/yule-li/CosFace) by [yule-li](https://github.com/yule-li).