{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/cosface-large-margin-cosine-loss-for-deep","title":"CosFace: Large Margin Cosine Loss for Deep Face Recognition","arxiv_id":"1801.09414","date":"2018-01-29","proceeding":"CVPR 2018 6","authors":["Hao Wang","Yitong Wang","Zheng Zhou","Xing Ji","Dihong Gong","Jingchao Zhou","Zhifeng Li","Wei Liu"],"abstract":"Face recognition has made extraordinary progress owing to the advancement of\ndeep convolutional neural networks (CNNs). The central task of face\nrecognition, including face verification and identification, involves face\nfeature discrimination. However, the traditional softmax loss of deep CNNs\nusually lacks the power of discrimination. To address this problem, recently\nseveral loss functions such as center loss, large margin softmax loss, and\nangular softmax loss have been proposed. All these improved losses share the\nsame idea: maximizing inter-class variance and minimizing intra-class variance.\nIn this paper, we propose a novel loss function, namely large margin cosine\nloss (LMCL), to realize this idea from a different perspective. More\nspecifically, we reformulate the softmax loss as a cosine loss by $L_2$\nnormalizing both features and weight vectors to remove radial variations, based\non which a cosine margin term is introduced to further maximize the decision\nmargin in the angular space. As a result, minimum intra-class variance and\nmaximum inter-class variance are achieved by virtue of normalization and cosine\ndecision margin maximization. We refer to our model trained with LMCL as\nCosFace. Extensive experimental evaluations are conducted on the most popular\npublic-domain face recognition datasets such as MegaFace Challenge, Youtube\nFaces (YTF) and Labeled Face in the Wild (LFW). We achieve the state-of-the-art\nperformance on these benchmarks, which confirms the effectiveness of our\nproposed approach.","url_abs":"http://arxiv.org/abs/1801.09414v2","url_pdf":"http://arxiv.org/pdf/1801.09414v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"cosface-large-margin-cosine-loss-for-deep","repo_url":"https://github.com/PaddlePaddle/PLSC","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"paddle","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"cosface-large-margin-cosine-loss-for-deep","repo_url":"https://github.com/cvqluu/Additive-Margin-Softmax-Loss-Pytorch","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"unanswered"}},{"paper_slug":"cosface-large-margin-cosine-loss-for-deep","repo_url":"https://github.com/cvqluu/Angular-Penalty-Softmax-Losses-Pytorch","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"cosface-large-margin-cosine-loss-for-deep","repo_url":"https://github.com/guppykang/joshFaceV2","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"cosface-large-margin-cosine-loss-for-deep","repo_url":"https://github.com/vitoralbiero/face_analysis_pytorch","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"unanswered"}},{"paper_slug":"cosface-large-margin-cosine-loss-for-deep","repo_url":"https://github.com/vnbot2/arcface","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"unanswered"}},{"paper_slug":"cosface-large-margin-cosine-loss-for-deep","repo_url":"https://github.com/Armxyz1/Results-on-RFW","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":null},{"paper_slug":"cosface-large-margin-cosine-loss-for-deep","repo_url":"https://github.com/Faceplugin-ltd/FaceRecognition-Android","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"none","reach":{"status":"ok"}},{"paper_slug":"cosface-large-margin-cosine-loss-for-deep","repo_url":"https://github.com/PaddlePaddle/PaddleClas","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"paddle","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"cosface-large-margin-cosine-loss-for-deep","repo_url":"https://github.com/Recognito-Vision/Android-FaceRecognition-FaceLivenessDetection","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"none","reach":{"status":"ok"}},{"paper_slug":"cosface-large-margin-cosine-loss-for-deep","repo_url":"https://github.com/RocketFlash/easy_metric_learning/tree/master/tools","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"face-identification","task_name":"Face Identification"},{"task_slug":"face-recognition","task_name":"Face Recognition"},{"task_slug":"face-verification","task_name":"Face Verification"}],"methods":[{"method_slug":"softmax","method_name":"Softmax"}],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/face-identification-on-megaface","task":"Face Identification","dataset":"MegaFace","model":"CosFace","rank_in_archive_order":9,"of":13,"metrics":{"Accuracy":"82.72%"},"uses_additional_data":false},{"leaderboard":"/sota/face-verification-on-megaface","task":"Face Verification","dataset":"MegaFace","model":"CosFace","rank_in_archive_order":8,"of":12,"metrics":{"Accuracy":"96.65%"},"uses_additional_data":false},{"leaderboard":"/sota/face-verification-on-youtube-faces-db","task":"Face Verification","dataset":"YouTube Faces DB","model":"CosFace","rank_in_archive_order":3,"of":12,"metrics":{"Accuracy":"97.6%"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=1801.09414","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1801.09414"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/vnbot2/arcface","reach":{"status":"unanswered"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/Armxyz1/Results-on-RFW","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/PaddlePaddle/PaddleClas","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/cvqluu/Additive-Margin-Softmax-Loss-Pytorch","reach":{"status":"unanswered"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/vitoralbiero/face_analysis_pytorch","reach":{"status":"unanswered"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/PaddlePaddle/PLSC","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/Recognito-Vision/Android-FaceRecognition-FaceLivenessDetection","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/guppykang/joshFaceV2","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/Faceplugin-ltd/FaceRecognition-Android","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/RocketFlash/easy_metric_learning/tree/master/tools","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/cvqluu/Angular-Penalty-Softmax-Losses-Pytorch","reach":null}],"summary":{"ran_fixture":1,"unverified":1},"by_repo_kind":{"listed":{"samples":1,"ran":1,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":2,"samples":[{"code_sha256_prefix":"ce762591ddb43822","entry":"cropping","repo":"guppykang/joshFaceV2","repo_kind":"listed","path":"cosFace/lfw_eval.py","file_url":"https://github.com/guppykang/joshFaceV2/blob/HEAD/cosFace/lfw_eval.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ce762591ddb43822"}},{"code_sha256_prefix":"e984e4da60619384","entry":"get_embeds","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"e984e4da60619384"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}