{"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/deep-cosine-metric-learning-for-person-re","title":"Deep Cosine Metric Learning for Person Re-Identification","arxiv_id":"1812.00442","date":"2018-12-02","proceeding":null,"authors":["Nicolai Wojke","Alex Bewley"],"abstract":"Metric learning aims to construct an embedding where two extracted features\ncorresponding to the same identity are likely to be closer than features from\ndifferent identities. This paper presents a method for learning such a feature\nspace where the cosine similarity is effectively optimized through a simple\nre-parametrization of the conventional softmax classification regime. At test\ntime, the final classification layer can be stripped from the network to\nfacilitate nearest neighbor queries on unseen individuals using the cosine\nsimilarity metric. This approach presents a simple alternative to direct metric\nlearning objectives such as siamese networks that have required sophisticated\npair or triplet sampling strategies in the past. The method is evaluated on two\nlarge-scale pedestrian re-identification datasets where competitive results are\nachieved overall. In particular, we achieve better generalization on the test\nset compared to a network trained with triplet loss.","url_abs":"http://arxiv.org/abs/1812.00442v1","url_pdf":"http://arxiv.org/pdf/1812.00442v1.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":"deep-cosine-metric-learning-for-person-re","repo_url":"https://github.com/nwojke/cosine_metric_learning","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"tf","reach":{"status":"ok","spdx":"GPL-3.0"}},{"paper_slug":"deep-cosine-metric-learning-for-person-re","repo_url":"https://github.com/ace19-dev/image-retrieval-tf","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"tf","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"deep-cosine-metric-learning-for-person-re","repo_url":"https://github.com/ace19-dev/mvcnn-tf","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"tf","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"deep-cosine-metric-learning-for-person-re","repo_url":"https://github.com/seovchinnikov/cosine_softmax_keras","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"tf","reach":{"status":"ok"}},{"paper_slug":"deep-cosine-metric-learning-for-person-re","repo_url":"https://github.com/PaddlePaddle/PaddleDetection","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"paddle","reach":null}],"tasks":[{"task_slug":"classification","task_name":"General Classification"},{"task_slug":"metric-learning","task_name":"Metric Learning"},{"task_slug":"person-re-identification","task_name":"Person Re-Identification"},{"task_slug":null,"task_name":"Triplet"}],"methods":[{"method_slug":"softmax","method_name":"Softmax"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/1812.00442","atlas_url":"https://app.syntology.ai/?focus=1812.00442","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1812.00442"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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/ace19-dev/mvcnn-tf","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/PaddlePaddle/PaddleDetection","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/nwojke/cosine_metric_learning","reach":{"status":"ok","spdx":"GPL-3.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/seovchinnikov/cosine_softmax_keras","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/ace19-dev/image-retrieval-tf","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"unverified":10},"by_repo_kind":{"listed":{"samples":10,"ran":0,"repositories":2}},"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":0,"samples":[{"code_sha256_prefix":"cfbf106c4ab1fc93","entry":"batch_norm","repo":"ace19-dev/mvcnn-tf","repo_kind":"listed","path":"nets/resnet_model.py","file_url":"https://github.com/ace19-dev/mvcnn-tf/blob/HEAD/nets/resnet_model.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"cfbf106c4ab1fc93"}},{"code_sha256_prefix":"d682a9593710857e","entry":"bytes_feature","repo":"ace19-dev/mvcnn-tf","repo_kind":"listed","path":"dataset_tools/dataset_util.py","file_url":"https://github.com/ace19-dev/mvcnn-tf/blob/HEAD/dataset_tools/dataset_util.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"d682a9593710857e"}},{"code_sha256_prefix":"00d606fe5c48bd93","entry":"conv2d_fixed_padding","repo":"ace19-dev/mvcnn-tf","repo_kind":"listed","path":"nets/resnet_model.py","file_url":"https://github.com/ace19-dev/mvcnn-tf/blob/HEAD/nets/resnet_model.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"00d606fe5c48bd93"}},{"code_sha256_prefix":"49a38fb7813724f6","entry":"create_cmc_probe_and_gallery","repo":"ace19-dev/mvcnn-tf","repo_kind":"listed","path":"dataset_tools/create_gallery.py","file_url":"https://github.com/ace19-dev/mvcnn-tf/blob/HEAD/dataset_tools/create_gallery.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"49a38fb7813724f6"}},{"code_sha256_prefix":"7fa95a4ad6afe798","entry":"fixed_padding","repo":"ace19-dev/mvcnn-tf","repo_kind":"listed","path":"nets/resnet_model.py","file_url":"https://github.com/ace19-dev/mvcnn-tf/blob/HEAD/nets/resnet_model.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"7fa95a4ad6afe798"}},{"code_sha256_prefix":"f71f0250b77f35ea","entry":"get_best_checkpoint","repo":"ace19-dev/image-retrieval-tf","repo_kind":"listed","path":"checkmate.py","file_url":"https://github.com/ace19-dev/image-retrieval-tf/blob/HEAD/checkmate.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f71f0250b77f35ea"}},{"code_sha256_prefix":"328d17201d9a0e68","entry":"int64_feature","repo":"ace19-dev/mvcnn-tf","repo_kind":"listed","path":"dataset_tools/dataset_util.py","file_url":"https://github.com/ace19-dev/mvcnn-tf/blob/HEAD/dataset_tools/dataset_util.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"328d17201d9a0e68"}},{"code_sha256_prefix":"f6d735872f4495ed","entry":"int64_list_feature","repo":"ace19-dev/mvcnn-tf","repo_kind":"listed","path":"dataset_tools/dataset_util.py","file_url":"https://github.com/ace19-dev/mvcnn-tf/blob/HEAD/dataset_tools/dataset_util.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"f6d735872f4495ed"}},{"code_sha256_prefix":"6c47cda0103014b7","entry":"se_block","repo":"ace19-dev/image-retrieval-tf","repo_kind":"listed","path":"nets/attention_module.py","file_url":"https://github.com/ace19-dev/image-retrieval-tf/blob/HEAD/nets/attention_module.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6c47cda0103014b7"}},{"code_sha256_prefix":"f1bb5951659fa4c5","entry":"view_pooling","repo":"ace19-dev/mvcnn-tf","repo_kind":"listed","path":"model.py","file_url":"https://github.com/ace19-dev/mvcnn-tf/blob/HEAD/model.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"f1bb5951659fa4c5"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}