{"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/amc-loss-angular-margin-contrastive-loss-for","title":"AMC-Loss: Angular Margin Contrastive Loss for Improved Explainability in Image Classification","arxiv_id":"2004.09805","date":"2020-04-21","proceeding":null,"authors":["Hongjun Choi","Anirudh Som","Pavan Turaga"],"abstract":"Deep-learning architectures for classification problems involve the cross-entropy loss sometimes assisted with auxiliary loss functions like center loss, contrastive loss and triplet loss. These auxiliary loss functions facilitate better discrimination between the different classes of interest. However, recent studies hint at the fact that these loss functions do not take into account the intrinsic angular distribution exhibited by the low-level and high-level feature representations. This results in less compactness between samples from the same class and unclear boundary separations between data clusters of different classes. In this paper, we address this issue by proposing the use of geometric constraints, rooted in Riemannian geometry. Specifically, we propose Angular Margin Contrastive Loss (AMC-Loss), a new loss function to be used along with the traditional cross-entropy loss. The AMC-Loss employs the discriminative angular distance metric that is equivalent to geodesic distance on a hypersphere manifold such that it can serve a clear geometric interpretation. We demonstrate the effectiveness of AMC-Loss by providing quantitative and qualitative results. We find that although the proposed geometrically constrained loss-function improves quantitative results modestly, it has a qualitatively surprisingly beneficial effect on increasing the interpretability of deep-net decisions as seen by the visual explanations generated by techniques such as the Grad-CAM. Our code is available at https://github.com/hchoi71/AMC-Loss.","url_abs":"https://arxiv.org/abs/2004.09805v1","url_pdf":"https://arxiv.org/pdf/2004.09805v1.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":"amc-loss-angular-margin-contrastive-loss-for","repo_url":"https://github.com/hchoi71/AMC-Loss","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"tf","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"classification","task_name":"General Classification"},{"task_slug":"image-classification","task_name":"Image Classification"},{"task_slug":null,"task_name":"Triplet"},{"task_slug":"image-classification","task_name":"image-classification"}],"methods":[{"method_slug":"interpretability","method_name":"Interpretability"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2004.09805","atlas_url":"https://app.syntology.ai/?focus=2004.09805","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2004.09805"}},"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/hchoi71/AMC-Loss","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":1,"unverified":4},"by_repo_kind":{"official":{"samples":5,"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":0,"samples":[{"code_sha256_prefix":"f126bc3a9ac50bcb","entry":"reuse","repo":"hchoi71/AMC-Loss","repo_kind":"official","path":"Train_AMC.py","file_url":"https://github.com/hchoi71/AMC-Loss/blob/HEAD/Train_AMC.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f126bc3a9ac50bcb"}},{"code_sha256_prefix":"858b964b6f6e3807","entry":"ema_variable_scope","repo":"hchoi71/AMC-Loss","repo_kind":"official","path":"utils.py","file_url":"https://github.com/hchoi71/AMC-Loss/blob/HEAD/utils.py","link_basis":"first_harvest_node","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":"858b964b6f6e3807"}},{"code_sha256_prefix":"5a30aefe53a9d152","entry":"load_cifar10","repo":"hchoi71/AMC-Loss","repo_kind":"official","path":"dataset.py","file_url":"https://github.com/hchoi71/AMC-Loss/blob/HEAD/dataset.py","link_basis":"first_harvest_node","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":"5a30aefe53a9d152"}},{"code_sha256_prefix":"d1663043431bd74c","entry":"lrelu","repo":"hchoi71/AMC-Loss","repo_kind":"official","path":"utils.py","file_url":"https://github.com/hchoi71/AMC-Loss/blob/HEAD/utils.py","link_basis":"first_harvest_node","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":"d1663043431bd74c"}},{"code_sha256_prefix":"7e3dbd1d8ec95770","entry":"to_one_hot","repo":"hchoi71/AMC-Loss","repo_kind":"official","path":"dataset.py","file_url":"https://github.com/hchoi71/AMC-Loss/blob/HEAD/dataset.py","link_basis":"first_harvest_node","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":"7e3dbd1d8ec95770"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}