{"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/improving-deep-metric-learning-by-divide-and","title":"Improving Deep Metric Learning by Divide and Conquer","arxiv_id":"2109.04003","date":"2021-09-09","proceeding":null,"authors":["Artsiom Sanakoyeu","Pingchuan Ma","Vadim Tschernezki","Björn Ommer"],"abstract":"Deep metric learning (DML) is a cornerstone of many computer vision applications. It aims at learning a mapping from the input domain to an embedding space, where semantically similar objects are located nearby and dissimilar objects far from another. The target similarity on the training data is defined by user in form of ground-truth class labels. However, while the embedding space learns to mimic the user-provided similarity on the training data, it should also generalize to novel categories not seen during training. Besides user-provided groundtruth training labels, a lot of additional visual factors (such as viewpoint changes or shape peculiarities) exist and imply different notions of similarity between objects, affecting the generalization on the images unseen during training. However, existing approaches usually directly learn a single embedding space on all available training data, struggling to encode all different types of relationships, and do not generalize well. We propose to build a more expressive representation by jointly splitting the embedding space and the data hierarchically into smaller sub-parts. We successively focus on smaller subsets of the training data, reducing its variance and learning a different embedding subspace for each data subset. Moreover, the subspaces are learned jointly to cover not only the intricacies, but the breadth of the data as well. Only after that, we build the final embedding from the subspaces in the conquering stage. The proposed algorithm acts as a transparent wrapper that can be placed around arbitrary existing DML methods. Our approach significantly improves upon the state-of-the-art on image retrieval, clustering, and re-identification tasks evaluated using CUB200-2011, CARS196, Stanford Online Products, In-shop Clothes, and PKU VehicleID datasets.","url_abs":"https://arxiv.org/abs/2109.04003v1","url_pdf":"https://arxiv.org/pdf/2109.04003v1.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":"improving-deep-metric-learning-by-divide-and","repo_url":"https://github.com/compvis/metric-learning-divide-and-conquer-improved","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"image-retrieval","task_name":"Image Retrieval"},{"task_slug":"metric-learning","task_name":"Metric Learning"},{"task_slug":"retrieval","task_name":"Retrieval"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2109.04003","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2109.04003"}},"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/compvis/metric-learning-divide-and-conquer-improved","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"unverified":16},"by_repo_kind":{"official":{"samples":16,"ran":0,"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":"f35dabf7a95feead","entry":"empty_if_default","repo":"compvis/metric-learning-divide-and-conquer-improved","repo_kind":"official","path":"experiment/margin_loss_resnet50.py","file_url":"https://github.com/compvis/metric-learning-divide-and-conquer-improved/blob/HEAD/experiment/margin_loss_resnet50.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":"f35dabf7a95feead"}},{"code_sha256_prefix":"7e2ff61e53717e1a","entry":"fetch_recall","repo":"compvis/metric-learning-divide-and-conquer-improved","repo_kind":"official","path":"eval_model.py","file_url":"https://github.com/compvis/metric-learning-divide-and-conquer-improved/blob/HEAD/eval_model.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":"7e2ff61e53717e1a"}},{"code_sha256_prefix":"b38d84edfb1e99ae","entry":"index_dataset","repo":"compvis/metric-learning-divide-and-conquer-improved","repo_kind":"official","path":"dataset/npairs.py","file_url":"https://github.com/compvis/metric-learning-divide-and-conquer-improved/blob/HEAD/dataset/npairs.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":"b38d84edfb1e99ae"}},{"code_sha256_prefix":"d9a66474dd07a91d","entry":"is_match","repo":"compvis/metric-learning-divide-and-conquer-improved","repo_kind":"official","path":"browse_results.py","file_url":"https://github.com/compvis/metric-learning-divide-and-conquer-improved/blob/HEAD/browse_results.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":"d9a66474dd07a91d"}},{"code_sha256_prefix":"cfde26759e9d9c42","entry":"make_args","repo":"compvis/metric-learning-divide-and-conquer-improved","repo_kind":"official","path":"experiment/base.py","file_url":"https://github.com/compvis/metric-learning-divide-and-conquer-improved/blob/HEAD/experiment/base.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":"cfde26759e9d9c42"}},{"code_sha256_prefix":"12d14d2613022a8b","entry":"merge_clusters","repo":"compvis/metric-learning-divide-and-conquer-improved","repo_kind":"official","path":"utils.py","file_url":"https://github.com/compvis/metric-learning-divide-and-conquer-improved/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":"12d14d2613022a8b"}},{"code_sha256_prefix":"88137d9a7fe8cbfe","entry":"parse_bool","repo":"compvis/metric-learning-divide-and-conquer-improved","repo_kind":"official","path":"experiment/margin_loss_resnet50.py","file_url":"https://github.com/compvis/metric-learning-divide-and-conquer-improved/blob/HEAD/experiment/margin_loss_resnet50.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":"88137d9a7fe8cbfe"}},{"code_sha256_prefix":"aa9272a8a0d334bf","entry":"parse_clustering_method","repo":"compvis/metric-learning-divide-and-conquer-improved","repo_kind":"official","path":"experiment/margin_loss_resnet50.py","file_url":"https://github.com/compvis/metric-learning-divide-and-conquer-improved/blob/HEAD/experiment/margin_loss_resnet50.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":"aa9272a8a0d334bf"}},{"code_sha256_prefix":"38ac9dc17918d04e","entry":"preprocess_features","repo":"compvis/metric-learning-divide-and-conquer-improved","repo_kind":"official","path":"metriclearning/faissext.py","file_url":"https://github.com/compvis/metric-learning-divide-and-conquer-improved/blob/HEAD/metriclearning/faissext.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":"38ac9dc17918d04e"}},{"code_sha256_prefix":"93db13d8a6478b7c","entry":"reassign_clusters","repo":"compvis/metric-learning-divide-and-conquer-improved","repo_kind":"official","path":"dataset/loader.py","file_url":"https://github.com/compvis/metric-learning-divide-and-conquer-improved/blob/HEAD/dataset/loader.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":"93db13d8a6478b7c"}},{"code_sha256_prefix":"094e0f4940c1d413","entry":"reserve_faiss_gpu_memory","repo":"compvis/metric-learning-divide-and-conquer-improved","repo_kind":"official","path":"metriclearning/faissext.py","file_url":"https://github.com/compvis/metric-learning-divide-and-conquer-improved/blob/HEAD/metriclearning/faissext.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":"094e0f4940c1d413"}},{"code_sha256_prefix":"6f559a6380486ff9","entry":"run","repo":"compvis/metric-learning-divide-and-conquer-improved","repo_kind":"official","path":"collect_env_info.py","file_url":"https://github.com/compvis/metric-learning-divide-and-conquer-improved/blob/HEAD/collect_env_info.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":"6f559a6380486ff9"}},{"code_sha256_prefix":"ab7aeddfa9e9fb2e","entry":"run_and_parse_first_match","repo":"compvis/metric-learning-divide-and-conquer-improved","repo_kind":"official","path":"collect_env_info.py","file_url":"https://github.com/compvis/metric-learning-divide-and-conquer-improved/blob/HEAD/collect_env_info.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":"ab7aeddfa9e9fb2e"}},{"code_sha256_prefix":"84905132fbc263e3","entry":"run_and_read_all","repo":"compvis/metric-learning-divide-and-conquer-improved","repo_kind":"official","path":"collect_env_info.py","file_url":"https://github.com/compvis/metric-learning-divide-and-conquer-improved/blob/HEAD/collect_env_info.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":"84905132fbc263e3"}},{"code_sha256_prefix":"8b0a5832a7d73092","entry":"sample_from_class","repo":"compvis/metric-learning-divide-and-conquer-improved","repo_kind":"official","path":"dataset/npairs.py","file_url":"https://github.com/compvis/metric-learning-divide-and-conquer-improved/blob/HEAD/dataset/npairs.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":"8b0a5832a7d73092"}},{"code_sha256_prefix":"f9c73077030737d4","entry":"train_kmeans","repo":"compvis/metric-learning-divide-and-conquer-improved","repo_kind":"official","path":"metriclearning/faissext.py","file_url":"https://github.com/compvis/metric-learning-divide-and-conquer-improved/blob/HEAD/metriclearning/faissext.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":"f9c73077030737d4"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}