{"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/towards-interpretable-deep-metric-learning","title":"Towards Interpretable Deep Metric Learning with Structural Matching","arxiv_id":"2108.05889","date":"2021-08-12","proceeding":"ICCV 2021 10","authors":["Wenliang Zhao","Yongming Rao","Ziyi Wang","Jiwen Lu","Jie zhou"],"abstract":"How do the neural networks distinguish two images? It is of critical importance to understand the matching mechanism of deep models for developing reliable intelligent systems for many risky visual applications such as surveillance and access control. However, most existing deep metric learning methods match the images by comparing feature vectors, which ignores the spatial structure of images and thus lacks interpretability. In this paper, we present a deep interpretable metric learning (DIML) method for more transparent embedding learning. Unlike conventional metric learning methods based on feature vector comparison, we propose a structural matching strategy that explicitly aligns the spatial embeddings by computing an optimal matching flow between feature maps of the two images. Our method enables deep models to learn metrics in a more human-friendly way, where the similarity of two images can be decomposed to several part-wise similarities and their contributions to the overall similarity. Our method is model-agnostic, which can be applied to off-the-shelf backbone networks and metric learning methods. We evaluate our method on three major benchmarks of deep metric learning including CUB200-2011, Cars196, and Stanford Online Products, and achieve substantial improvements over popular metric learning methods with better interpretability. Code is available at https://github.com/wl-zhao/DIML","url_abs":"https://arxiv.org/abs/2108.05889v1","url_pdf":"https://arxiv.org/pdf/2108.05889v1.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":"towards-interpretable-deep-metric-learning","repo_url":"https://github.com/wl-zhao/diml","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"metric-learning","task_name":"Metric Learning"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/metric-learning-on-cars196","task":"Metric Learning","dataset":"CARS196","model":"ProxyAnchor + DIML","rank_in_archive_order":22,"of":36,"metrics":{"R@1":"87.01"},"uses_additional_data":true},{"leaderboard":"/sota/metric-learning-on-cub-200-2011","task":"Metric Learning","dataset":"CUB-200-2011","model":"MS + DIML","rank_in_archive_order":16,"of":30,"metrics":{"R@1":"68.15"},"uses_additional_data":false},{"leaderboard":"/sota/metric-learning-on-stanford-online-products-1","task":"Metric Learning","dataset":"Stanford Online Products","model":"Margin + DIML","rank_in_archive_order":27,"of":33,"metrics":{"R@1":"79.26"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2108.05889","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2108.05889"}},"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/wl-zhao/diml","reach":{"status":"ok"}},{"provenance":"deterministic:regex_extraction","url":"https://github.com/wl-zhao/DIML","reach":{"status":"ok"}}],"summary":{"ran_fixture":2},"by_repo_kind":{"official":{"samples":2,"ran":2,"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":"6e35f0f82a513888","entry":"Sinkhorn","repo":"wl-zhao/diml","repo_kind":"official","path":"utilities/diml.py","file_url":"https://github.com/wl-zhao/diml/blob/HEAD/utilities/diml.py","link_basis":"plan_row","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"6e35f0f82a513888"}},{"code_sha256_prefix":"6d4678768f974bda","entry":"calc_similarity","repo":"wl-zhao/DIML","repo_kind":"official","path":"utilities/diml.py","file_url":"https://github.com/wl-zhao/DIML/blob/HEAD/utilities/diml.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"6d4678768f974bda"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}