{"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/exact-feature-distribution-matching-for","title":"Exact Feature Distribution Matching for Arbitrary Style Transfer and Domain Generalization","arxiv_id":"2203.07740","date":"2022-03-15","proceeding":"CVPR 2022 1","authors":["Yabin Zhang","Minghan Li","Ruihuang Li","Kui Jia","Lei Zhang"],"abstract":"Arbitrary style transfer (AST) and domain generalization (DG) are important yet challenging visual learning tasks, which can be cast as a feature distribution matching problem. With the assumption of Gaussian feature distribution, conventional feature distribution matching methods usually match the mean and standard deviation of features. However, the feature distributions of real-world data are usually much more complicated than Gaussian, which cannot be accurately matched by using only the first-order and second-order statistics, while it is computationally prohibitive to use high-order statistics for distribution matching. In this work, we, for the first time to our best knowledge, propose to perform Exact Feature Distribution Matching (EFDM) by exactly matching the empirical Cumulative Distribution Functions (eCDFs) of image features, which could be implemented by applying the Exact Histogram Matching (EHM) in the image feature space. Particularly, a fast EHM algorithm, named Sort-Matching, is employed to perform EFDM in a plug-and-play manner with minimal cost. The effectiveness of our proposed EFDM method is verified on a variety of AST and DG tasks, demonstrating new state-of-the-art results. Codes are available at https://github.com/YBZh/EFDM.","url_abs":"https://arxiv.org/abs/2203.07740v2","url_pdf":"https://arxiv.org/pdf/2203.07740v2.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":"exact-feature-distribution-matching-for","repo_url":"https://github.com/ybzh/efdm","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"exact-feature-distribution-matching-for","repo_url":"https://github.com/zhongliangguo/acdm","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"domain-generalization","task_name":"Domain Generalization"},{"task_slug":"style-transfer","task_name":"Style Transfer"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/style-transfer-on-stylebench","task":"Style Transfer","dataset":"StyleBench","model":"EFDM","rank_in_archive_order":7,"of":7,"metrics":{"CLIP Score":"0.561"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2203.07740","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2203.07740"}},"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":"deterministic:regex_extraction","url":"https://github.com/KaiyangZhou/mixstyle-release","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/zhongliangguo/acdm","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/ybzh/efdm","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"deterministic:regex_extraction","url":"https://github.com/YBZh/EFDM","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_draft_wrong":1,"ran_fixture":2,"ran":1,"unverified":11},"by_repo_kind":{"official":{"samples":14,"ran":3,"repositories":1},"listed":{"samples":1,"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":"16679a24b9881031","entry":"adaptive_instance_normalization","repo":"YBZh/EFDM","repo_kind":"official","path":"ArbitraryStyleTransfer/function.py","file_url":"https://github.com/YBZh/EFDM/blob/HEAD/ArbitraryStyleTransfer/function.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"16679a24b9881031"}},{"code_sha256_prefix":"38eaf8511dc7bc9c","entry":"calc_mean_std","repo":"YBZh/EFDM","repo_kind":"official","path":"ArbitraryStyleTransfer/function.py","file_url":"https://github.com/YBZh/EFDM/blob/HEAD/ArbitraryStyleTransfer/function.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"38eaf8511dc7bc9c"}},{"code_sha256_prefix":"ba26afd892405335","entry":"compute_ci95","repo":"YBZh/EFDM","repo_kind":"official","path":"DomainGeneralization/imcls/parse_test_res.py","file_url":"https://github.com/YBZh/EFDM/blob/HEAD/DomainGeneralization/imcls/parse_test_res.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":"ba26afd892405335"}},{"code_sha256_prefix":"6d8ec9b9ea1ce367","entry":"efdm","repo":"zhongliangguo/acdm","repo_kind":"listed","path":"efdm.py","file_url":"https://github.com/zhongliangguo/acdm/blob/HEAD/efdm.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6d8ec9b9ea1ce367"}},{"code_sha256_prefix":"b37397d52a07f40e","entry":"adaptive_mean_normalization","repo":"YBZh/EFDM","repo_kind":"official","path":"ArbitraryStyleTransfer/function.py","file_url":"https://github.com/YBZh/EFDM/blob/HEAD/ArbitraryStyleTransfer/function.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":"b37397d52a07f40e"}},{"code_sha256_prefix":"f0b768ed9d252a84","entry":"imagedata_kwargs","repo":"YBZh/EFDM","repo_kind":"official","path":"DomainGeneralization/reid/default_config.py","file_url":"https://github.com/YBZh/EFDM/blob/HEAD/DomainGeneralization/reid/default_config.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":"f0b768ed9d252a84"}},{"code_sha256_prefix":"bd41824b39412f93","entry":"init_pretrained_weights","repo":"YBZh/EFDM","repo_kind":"official","path":"DomainGeneralization/reid/models/osnet_db.py","file_url":"https://github.com/YBZh/EFDM/blob/HEAD/DomainGeneralization/reid/models/osnet_db.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":"bd41824b39412f93"}},{"code_sha256_prefix":"56fbe35b933005f0","entry":"lua_recursive_source","repo":"YBZh/EFDM","repo_kind":"official","path":"ArbitraryStyleTransfer/torch_to_pytorch.py","file_url":"https://github.com/YBZh/EFDM/blob/HEAD/ArbitraryStyleTransfer/torch_to_pytorch.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":"56fbe35b933005f0"}},{"code_sha256_prefix":"d3e1b4b879ea0786","entry":"optimizer_kwargs","repo":"YBZh/EFDM","repo_kind":"official","path":"DomainGeneralization/reid/default_config.py","file_url":"https://github.com/YBZh/EFDM/blob/HEAD/DomainGeneralization/reid/default_config.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":"d3e1b4b879ea0786"}},{"code_sha256_prefix":"1991f5d9f34aa70f","entry":"osnet_x0_75","repo":"YBZh/EFDM","repo_kind":"official","path":"DomainGeneralization/reid/models/osnet_db.py","file_url":"https://github.com/YBZh/EFDM/blob/HEAD/DomainGeneralization/reid/models/osnet_db.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":"1991f5d9f34aa70f"}},{"code_sha256_prefix":"7a3189c6c0125d89","entry":"osnet_x1_0","repo":"YBZh/EFDM","repo_kind":"official","path":"DomainGeneralization/reid/models/osnet_db.py","file_url":"https://github.com/YBZh/EFDM/blob/HEAD/DomainGeneralization/reid/models/osnet_db.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":"7a3189c6c0125d89"}},{"code_sha256_prefix":"69140e8e79dae940","entry":"search_sorted","repo":"YBZh/EFDM","repo_kind":"official","path":"DomainGeneralization/reid/models/mixhm.py","file_url":"https://github.com/YBZh/EFDM/blob/HEAD/DomainGeneralization/reid/models/mixhm.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":"69140e8e79dae940"}},{"code_sha256_prefix":"7e2ea00ab6257df1","entry":"simplify_source","repo":"YBZh/EFDM","repo_kind":"official","path":"ArbitraryStyleTransfer/torch_to_pytorch.py","file_url":"https://github.com/YBZh/EFDM/blob/HEAD/ArbitraryStyleTransfer/torch_to_pytorch.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":"7e2ea00ab6257df1"}},{"code_sha256_prefix":"939a94cc6cecc770","entry":"test_transform","repo":"YBZh/EFDM","repo_kind":"official","path":"ArbitraryStyleTransfer/view.py","file_url":"https://github.com/YBZh/EFDM/blob/HEAD/ArbitraryStyleTransfer/view.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":"939a94cc6cecc770"}},{"code_sha256_prefix":"977724699467d6ae","entry":"videodata_kwargs","repo":"YBZh/EFDM","repo_kind":"official","path":"DomainGeneralization/reid/default_config.py","file_url":"https://github.com/YBZh/EFDM/blob/HEAD/DomainGeneralization/reid/default_config.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":"977724699467d6ae"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}