AMSoftmax
A simple yet effective loss function for face verification.
Install / Use
/learn @happynear/AMSoftmaxREADME
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.
Introduction

In this work, we design a new loss function which merges the merits of both NormFace and 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.
PS: If you want to try the margin scheme described in ArcFace, you may try to transplant this
layer 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, Baidu Yun .
Results
See our arXiv technical report.
3rd-Party Re-implementation
- TensorFlow: code by Joker316701882.
- TensorFlow: code by yule-li.
Related Skills
YC-Killer
2.7kA library of enterprise-grade AI agents designed to democratize artificial intelligence and provide free, open-source alternatives to overvalued Y Combinator startups. If you are excited about democratizing AI access & AI agents, please star ⭐️ this repository and use the link in the readme to join our open source AI research team.
best-practices-researcher
The most comprehensive Claude Code skills registry | Web Search: https://skills-registry-web.vercel.app
groundhog
398Groundhog's primary purpose is to teach people how Cursor and all these other coding agents work under the hood. If you understand how these coding assistants work from first principles, then you can drive these tools harder (or perhaps make your own!).
isf-agent
a repo for an agent that helps researchers apply for isf funding
