{"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/cross-contrastive-feature-perturbation-for","title":"Cross Contrasting Feature Perturbation for Domain Generalization","arxiv_id":"2307.12502","date":"2023-07-24","proceeding":"ICCV 2023 1","authors":["Chenming Li","Daoan Zhang","Wenjian Huang","JianGuo Zhang"],"abstract":"Domain generalization (DG) aims to learn a robust model from source domains that generalize well on unseen target domains. Recent studies focus on generating novel domain samples or features to diversify distributions complementary to source domains. Yet, these approaches can hardly deal with the restriction that the samples synthesized from various domains can cause semantic distortion. In this paper, we propose an online one-stage Cross Contrasting Feature Perturbation (CCFP) framework to simulate domain shift by generating perturbed features in the latent space while regularizing the model prediction against domain shift. Different from the previous fixed synthesizing strategy, we design modules with learnable feature perturbations and semantic consistency constraints. In contrast to prior work, our method does not use any generative-based models or domain labels. We conduct extensive experiments on a standard DomainBed benchmark with a strict evaluation protocol for a fair comparison. Comprehensive experiments show that our method outperforms the previous state-of-the-art, and quantitative analyses illustrate that our approach can alleviate the domain shift problem in out-of-distribution (OOD) scenarios.","url_abs":"https://arxiv.org/abs/2307.12502v2","url_pdf":"https://arxiv.org/pdf/2307.12502v2.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":"cross-contrastive-feature-perturbation-for","repo_url":"https://github.com/hackmebroo/ccfp","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}},{"paper_slug":"cross-contrastive-feature-perturbation-for","repo_url":"https://github.com/hackmebroo/cross-contrasting-feature-perturbation-for-domain-generalization","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"domain-generalization","task_name":"Domain Generalization"}],"methods":[{"method_slug":"focus","method_name":"Focus"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2307.12502","atlas_url":"https://app.syntology.ai/?focus=2307.12502","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2307.12502"}},"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/hackmebroo/ccfp","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/hackmebroo/cross-contrasting-feature-perturbation-for-domain-generalization","reach":null}],"summary":{"ran":10,"ran_fixture":3,"ran_draft_wrong":3,"ran_honours":1,"unverified":8},"by_repo_kind":{"official":{"samples":25,"ran":17,"repositories":2}},"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":25,"samples":[{"code_sha256_prefix":"d4ab1855fefe42b4","entry":"Algorithm","repo":"hackmebroo/cross-contrasting-feature-perturbation-for-domain-generalization","repo_kind":"official","path":"algorithms.py","file_url":"https://github.com/hackmebroo/cross-contrasting-feature-perturbation-for-domain-generalization/blob/HEAD/algorithms.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d4ab1855fefe42b4"}},{"code_sha256_prefix":"81427628d9da40b5","entry":"DistributionUncertainty","repo":"hackmebroo/cross-contrasting-feature-perturbation-for-domain-generalization","repo_kind":"official","path":"algorithms.py","file_url":"https://github.com/hackmebroo/cross-contrasting-feature-perturbation-for-domain-generalization/blob/HEAD/algorithms.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"81427628d9da40b5"}},{"code_sha256_prefix":"d797b51129873a03","entry":"LDP","repo":"hackmebroo/cross-contrasting-feature-perturbation-for-domain-generalization","repo_kind":"official","path":"algorithms.py","file_url":"https://github.com/hackmebroo/cross-contrasting-feature-perturbation-for-domain-generalization/blob/HEAD/algorithms.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d797b51129873a03"}},{"code_sha256_prefix":"f96170b86db20ebd","entry":"MNIST_CNN","repo":"hackmebroo/cross-contrasting-feature-perturbation-for-domain-generalization","repo_kind":"official","path":"algorithms.py","file_url":"https://github.com/hackmebroo/cross-contrasting-feature-perturbation-for-domain-generalization/blob/HEAD/algorithms.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"f96170b86db20ebd"}},{"code_sha256_prefix":"f9d8f82d3edc5026","entry":"MNIST_CNN_tea","repo":"hackmebroo/cross-contrasting-feature-perturbation-for-domain-generalization","repo_kind":"official","path":"algorithms.py","file_url":"https://github.com/hackmebroo/cross-contrasting-feature-perturbation-for-domain-generalization/blob/HEAD/algorithms.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"f9d8f82d3edc5026"}},{"code_sha256_prefix":"04b8476374907676","entry":"PermuteAdaptiveInstanceNorm2d","repo":"hackmebroo/cross-contrasting-feature-perturbation-for-domain-generalization","repo_kind":"official","path":"algorithms.py","file_url":"https://github.com/hackmebroo/cross-contrasting-feature-perturbation-for-domain-generalization/blob/HEAD/algorithms.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"04b8476374907676"}},{"code_sha256_prefix":"7d65990d684d50e8","entry":"adaptive_instance_normalization","repo":"hackmebroo/ccfp","repo_kind":"official","path":"networks.py","file_url":"https://github.com/hackmebroo/ccfp/blob/HEAD/networks.py","link_basis":"plan_row","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"7d65990d684d50e8"}},{"code_sha256_prefix":"7dc5cc1a5cc56434","entry":"calc_mean_std","repo":"hackmebroo/ccfp","repo_kind":"official","path":"networks.py","file_url":"https://github.com/hackmebroo/ccfp/blob/HEAD/networks.py","link_basis":"plan_row","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"7dc5cc1a5cc56434"}},{"code_sha256_prefix":"fac5364e2f53c6db","entry":"conv3x3","repo":"hackmebroo/ccfp","repo_kind":"official","path":"resnet_mixstyle.py","file_url":"https://github.com/hackmebroo/ccfp/blob/HEAD/resnet_mixstyle.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":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"fac5364e2f53c6db"}},{"code_sha256_prefix":"fbb8c05a0a7696ec","entry":"distance","repo":"hackmebroo/ccfp","repo_kind":"official","path":"lib/misc.py","file_url":"https://github.com/hackmebroo/ccfp/blob/HEAD/lib/misc.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"fbb8c05a0a7696ec"}},{"code_sha256_prefix":"d6d6cc53be32629d","entry":"format_mean","repo":"hackmebroo/ccfp","repo_kind":"official","path":"collect_results.py","file_url":"https://github.com/hackmebroo/ccfp/blob/HEAD/collect_results.py","link_basis":"plan_row","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d6d6cc53be32629d"}},{"code_sha256_prefix":"53fac8d8d949e72b","entry":"get_test_records","repo":"hackmebroo/ccfp","repo_kind":"official","path":"model_selection.py","file_url":"https://github.com/hackmebroo/ccfp/blob/HEAD/model_selection.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"53fac8d8d949e72b"}},{"code_sha256_prefix":"71a3a61ceed99bf3","entry":"hashable","repo":"hackmebroo/ccfp","repo_kind":"official","path":"lib/query.py","file_url":"https://github.com/hackmebroo/ccfp/blob/HEAD/lib/query.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"71a3a61ceed99bf3"}},{"code_sha256_prefix":"1fdaff04251a0d51","entry":"l2_between_dicts","repo":"hackmebroo/ccfp","repo_kind":"official","path":"lib/misc.py","file_url":"https://github.com/hackmebroo/ccfp/blob/HEAD/lib/misc.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"1fdaff04251a0d51"}},{"code_sha256_prefix":"2f8af5779e1edcb6","entry":"make_selector_fn","repo":"hackmebroo/ccfp","repo_kind":"official","path":"lib/query.py","file_url":"https://github.com/hackmebroo/ccfp/blob/HEAD/lib/query.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"2f8af5779e1edcb6"}},{"code_sha256_prefix":"17202e0de9779f70","entry":"proj","repo":"hackmebroo/ccfp","repo_kind":"official","path":"lib/misc.py","file_url":"https://github.com/hackmebroo/ccfp/blob/HEAD/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":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"17202e0de9779f70"}},{"code_sha256_prefix":"196cab71d7129d62","entry":"remove_batch_norm_from_resnet","repo":"hackmebroo/ccfp","repo_kind":"official","path":"networks.py","file_url":"https://github.com/hackmebroo/ccfp/blob/HEAD/networks.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"196cab71d7129d62"}},{"code_sha256_prefix":"f1069937af8d8db4","entry":"CCFP","repo":"hackmebroo/cross-contrasting-feature-perturbation-for-domain-generalization","repo_kind":"official","path":"algorithms.py","file_url":"https://github.com/hackmebroo/cross-contrasting-feature-perturbation-for-domain-generalization/blob/HEAD/algorithms.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"f1069937af8d8db4"}},{"code_sha256_prefix":"50d94f70eea6617f","entry":"ERM","repo":"hackmebroo/cross-contrasting-feature-perturbation-for-domain-generalization","repo_kind":"official","path":"algorithms.py","file_url":"https://github.com/hackmebroo/cross-contrasting-feature-perturbation-for-domain-generalization/blob/HEAD/algorithms.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"50d94f70eea6617f"}},{"code_sha256_prefix":"9e043048978eb855","entry":"Featurizer","repo":"hackmebroo/cross-contrasting-feature-perturbation-for-domain-generalization","repo_kind":"official","path":"algorithms.py","file_url":"https://github.com/hackmebroo/cross-contrasting-feature-perturbation-for-domain-generalization/blob/HEAD/algorithms.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"9e043048978eb855"}},{"code_sha256_prefix":"05738dcd81fa595f","entry":"ResNet","repo":"hackmebroo/cross-contrasting-feature-perturbation-for-domain-generalization","repo_kind":"official","path":"algorithms.py","file_url":"https://github.com/hackmebroo/cross-contrasting-feature-perturbation-for-domain-generalization/blob/HEAD/algorithms.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"05738dcd81fa595f"}},{"code_sha256_prefix":"675b4e8d991b4e8d","entry":"ResNet_tea","repo":"hackmebroo/cross-contrasting-feature-perturbation-for-domain-generalization","repo_kind":"official","path":"algorithms.py","file_url":"https://github.com/hackmebroo/cross-contrasting-feature-perturbation-for-domain-generalization/blob/HEAD/algorithms.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"675b4e8d991b4e8d"}},{"code_sha256_prefix":"b0bc80b1655a6802","entry":"get_algorithm_class","repo":"hackmebroo/ccfp","repo_kind":"official","path":"algorithms.py","file_url":"https://github.com/hackmebroo/ccfp/blob/HEAD/algorithms.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b0bc80b1655a6802"}},{"code_sha256_prefix":"d0ea85d74c20dea9","entry":"get_dataset_class","repo":"hackmebroo/ccfp","repo_kind":"official","path":"datasets.py","file_url":"https://github.com/hackmebroo/ccfp/blob/HEAD/datasets.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d0ea85d74c20dea9"}},{"code_sha256_prefix":"73f32252eedba6a4","entry":"num_environments","repo":"hackmebroo/ccfp","repo_kind":"official","path":"datasets.py","file_url":"https://github.com/hackmebroo/ccfp/blob/HEAD/datasets.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"73f32252eedba6a4"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}