{"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/domain-aware-triplet-loss-in-domain","title":"Domain-aware Triplet loss in Domain Generalization","arxiv_id":"2303.01233","date":"2023-03-01","proceeding":null,"authors":["Kaiyu Guo","Brian Lovell"],"abstract":"Despite much progress being made in the field of object recognition with the advances of deep learning, there are still several factors negatively affecting the performance of deep learning models. Domain shift is one of these factors and is caused by discrepancies in the distributions of the testing and training data. In this paper, we focus on the problem of compact feature clustering in domain generalization to help optimize the embedding space from multi-domain data. We design a domainaware triplet loss for domain generalization to help the model to not only cluster similar semantic features, but also to disperse features arising from the domain. Unlike previous methods focusing on distribution alignment, our algorithm is designed to disperse domain information in the embedding space. The basic idea is motivated based on the assumption that embedding features can be clustered based on domain information, which is mathematically and empirically supported in this paper. In addition, during our exploration of feature clustering in domain generalization, we note that factors affecting the convergence of metric learning loss in domain generalization are more important than the pre-defined domains. To solve this issue, we utilize two methods to normalize the embedding space, reducing the internal covariate shift of the embedding features. The ablation study demonstrates the effectiveness of our algorithm. Moreover, the experiments on the benchmark datasets, including PACS, VLCS and Office-Home, show that our method outperforms related methods focusing on domain discrepancy. In particular, our results on RegnetY-16 are significantly better than state-of-the-art methods on the benchmark datasets. Our code will be released at https://github.com/workerbcd/DCT","url_abs":"https://arxiv.org/abs/2303.01233v1","url_pdf":"https://arxiv.org/pdf/2303.01233v1.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":"domain-aware-triplet-loss-in-domain","repo_url":"https://github.com/workerbcd/dct","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"clustering","task_name":"Clustering"},{"task_slug":"domain-generalization","task_name":"Domain Generalization"},{"task_slug":"metric-learning","task_name":"Metric Learning"},{"task_slug":"object-recognition","task_name":"Object Recognition"},{"task_slug":null,"task_name":"Triplet"}],"methods":[{"method_slug":"triplet-loss","method_name":"Triplet Loss"}],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/domain-generalization-on-office-home","task":"Domain Generalization","dataset":"Office-Home","model":"D-Triplet(RegNetY-16GF)","rank_in_archive_order":13,"of":45,"metrics":{"Average Accuracy":"82.6"},"uses_additional_data":false},{"leaderboard":"/sota/domain-generalization-on-office-home","task":"Domain Generalization","dataset":"Office-Home","model":"D-Triplet(Resnet-50)","rank_in_archive_order":32,"of":45,"metrics":{"Average Accuracy":"70.3"},"uses_additional_data":false},{"leaderboard":"/sota/domain-generalization-on-pacs-2","task":"Domain Generalization","dataset":"PACS","model":"D-Triplet(RegNetY-16GF)","rank_in_archive_order":4,"of":133,"metrics":{"Average Accuracy":"97.6"},"uses_additional_data":false},{"leaderboard":"/sota/domain-generalization-on-pacs-2","task":"Domain Generalization","dataset":"PACS","model":"D-Triplet(Resnet-50)","rank_in_archive_order":39,"of":133,"metrics":{"Average Accuracy":"87.3"},"uses_additional_data":false},{"leaderboard":"/sota/domain-generalization-on-vlcs","task":"Domain Generalization","dataset":"VLCS","model":"D-Triplet(RegNetY-16GF)","rank_in_archive_order":6,"of":37,"metrics":{"Average Accuracy":"82.9"},"uses_additional_data":false},{"leaderboard":"/sota/domain-generalization-on-vlcs","task":"Domain Generalization","dataset":"VLCS","model":"D-Triplet(Resnet-50)","rank_in_archive_order":26,"of":37,"metrics":{"Average Accuracy":"79.3"},"uses_additional_data":false}],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2303.01233","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2303.01233"}},"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/workerbcd/dct","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":5,"ran_draft_wrong":1,"ran_honours":1,"unverified":5},"by_repo_kind":{"official":{"samples":12,"ran":7,"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":"c8980fa1301b0ca7","entry":"get_module","repo":"workerbcd/dct","repo_kind":"official","path":"domainbed/backbones/new_networks.py","file_url":"https://github.com/workerbcd/dct/blob/HEAD/domainbed/backbones/new_networks.py","link_basis":"harvester_set","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":"c8980fa1301b0ca7"}},{"code_sha256_prefix":"71a3a61ceed99bf3","entry":"hashable","repo":"workerbcd/dct","repo_kind":"official","path":"domainbed/lib/query.py","file_url":"https://github.com/workerbcd/dct/blob/HEAD/domainbed/lib/query.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"71a3a61ceed99bf3"}},{"code_sha256_prefix":"2f597a2077a1c95d","entry":"levelize","repo":"workerbcd/dct","repo_kind":"official","path":"domainbed/lib/logger.py","file_url":"https://github.com/workerbcd/dct/blob/HEAD/domainbed/lib/logger.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2f597a2077a1c95d"}},{"code_sha256_prefix":"2f8af5779e1edcb6","entry":"make_selector_fn","repo":"workerbcd/dct","repo_kind":"official","path":"domainbed/lib/query.py","file_url":"https://github.com/workerbcd/dct/blob/HEAD/domainbed/lib/query.py","link_basis":"harvester_set","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":"2f8af5779e1edcb6"}},{"code_sha256_prefix":"4fa2b54178fcc1df","entry":"random_pairs_of_minibatches","repo":"workerbcd/dct","repo_kind":"official","path":"domainbed/lib/misc.py","file_url":"https://github.com/workerbcd/dct/blob/HEAD/domainbed/lib/misc.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"4fa2b54178fcc1df"}},{"code_sha256_prefix":"12c23ce22097acd0","entry":"to_minibatch","repo":"workerbcd/dct","repo_kind":"official","path":"domainbed/algorithms/algorithms.py","file_url":"https://github.com/workerbcd/dct/blob/HEAD/domainbed/algorithms/algorithms.py","link_basis":"plan_row","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"12c23ce22097acd0"}},{"code_sha256_prefix":"5dd6a674fbe45a89","entry":"to_row","repo":"workerbcd/dct","repo_kind":"official","path":"domainbed/lib/misc.py","file_url":"https://github.com/workerbcd/dct/blob/HEAD/domainbed/lib/misc.py","link_basis":"harvester_set","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":"5dd6a674fbe45a89"}},{"code_sha256_prefix":"0ca4d46da891e3df","entry":"accuracy_from_loader","repo":"workerbcd/dct","repo_kind":"official","path":"domainbed/evaluator.py","file_url":"https://github.com/workerbcd/dct/blob/HEAD/domainbed/evaluator.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":"0ca4d46da891e3df"}},{"code_sha256_prefix":"83e280af851073dd","entry":"build_blocks","repo":"workerbcd/dct","repo_kind":"official","path":"domainbed/backbones/new_networks.py","file_url":"https://github.com/workerbcd/dct/blob/HEAD/domainbed/backbones/new_networks.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":"83e280af851073dd"}},{"code_sha256_prefix":"480b953f8f91b3b1","entry":"default_hparams","repo":"workerbcd/dct","repo_kind":"official","path":"domainbed/hparams_registry.py","file_url":"https://github.com/workerbcd/dct/blob/HEAD/domainbed/hparams_registry.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":"480b953f8f91b3b1"}},{"code_sha256_prefix":"86798fbb2fc042f5","entry":"make_weights_for_balanced_classes","repo":"workerbcd/dct","repo_kind":"official","path":"domainbed/lib/misc.py","file_url":"https://github.com/workerbcd/dct/blob/HEAD/domainbed/lib/misc.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":"86798fbb2fc042f5"}},{"code_sha256_prefix":"dbeb3657dc35373d","entry":"random_hparams","repo":"workerbcd/dct","repo_kind":"official","path":"domainbed/hparams_registry.py","file_url":"https://github.com/workerbcd/dct/blob/HEAD/domainbed/hparams_registry.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":"dbeb3657dc35373d"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}