{"id":19932199,"url":"https://github.com/amazon-science/crossnorm-selfnorm","last_synced_at":"2025-05-03T11:31:34.130Z","repository":{"id":47154921,"uuid":"395724167","full_name":"amazon-science/crossnorm-selfnorm","owner":"amazon-science","description":"CrossNorm and SelfNorm for Generalization under Distribution Shifts, ICCV 2021","archived":false,"fork":false,"pushed_at":"2021-09-10T22:27:16.000Z","size":485,"stargazers_count":129,"open_issues_count":2,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-07T15:03:59.484Z","etag":null,"topics":["computer-vision","domain-adaptation","domain-generalization","iccv-2021","model-robustness","natural-language-processing","normalization"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amazon-science.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-13T16:40:01.000Z","updated_at":"2025-04-04T15:46:44.000Z","dependencies_parsed_at":"2022-09-15T09:20:33.916Z","dependency_job_id":null,"html_url":"https://github.com/amazon-science/crossnorm-selfnorm","commit_stats":null,"previous_names":["amazon-research/crossnorm-selfnorm"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amazon-science%2Fcrossnorm-selfnorm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amazon-science%2Fcrossnorm-selfnorm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amazon-science%2Fcrossnorm-selfnorm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amazon-science%2Fcrossnorm-selfnorm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amazon-science","download_url":"https://codeload.github.com/amazon-science/crossnorm-selfnorm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252184257,"owners_count":21707918,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["computer-vision","domain-adaptation","domain-generalization","iccv-2021","model-robustness","natural-language-processing","normalization"],"created_at":"2024-11-12T23:09:22.350Z","updated_at":"2025-05-03T11:31:33.777Z","avatar_url":"https://github.com/amazon-science.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## CrossNorm (CN) and SelfNorm (SN) (Accepted at ICCV 2021)\n\nThis is the official PyTorch implementation of our [CNSN paper](https://arxiv.org/abs/2102.02811), in which we propose CrossNorm (CN) and SelfNorm (SN), two simple, effective, and complementary normalization techniques to improve generalization robustness under distribution shifts.\n![](./vis/cnsn-framework.png)\n```\n@article{tang2021cnsn,\n  title={CrossNorm and SelfNorm for Generalization under Distribution Shifts},\n  author={Zhiqiang Tang, Yunhe Gao, Yi Zhu, Zhi Zhang, Mu Li, Dimitris Metaxas},\n  journal={arXiv preprint arXiv:2102.02811},\n  year={2021}\n}\n```\n\n## Install dependencies\n  ```shell\n  conda create --name cnsn python=3.7\n  conda activate cnsn\n  conda install numpy\n  conda install pytorch==1.2.0 torchvision==0.4.0 cudatoolkit=10.0 -c pytorch\n  ```\n\n\n## Prepare datasets\n- Download CIFAR-10-C and CIFAR-100-C datasets with:\n\n    ```\n    mkdir -p ./data\n    curl -O https://zenodo.org/record/2535967/files/CIFAR-10-C.tar\n    curl -O https://zenodo.org/record/3555552/files/CIFAR-100-C.tar\n    tar -xvf CIFAR-100-C.tar -C data/\n    tar -xvf CIFAR-10-C.tar -C data/\n    ```\n\n- Download ImageNet-C with:\n\n    ```\n    mkdir -p ./data/ImageNet-C\n    curl -O https://zenodo.org/record/2235448/files/blur.tar\n    curl -O https://zenodo.org/record/2235448/files/digital.tar\n    curl -O https://zenodo.org/record/2235448/files/noise.tar\n    curl -O https://zenodo.org/record/2235448/files/weather.tar\n    tar -xvf blur.tar -C data/ImageNet-C\n    tar -xvf digital.tar -C data/ImageNet-C\n    tar -xvf noise.tar -C data/ImageNet-C\n    tar -xvf weather.tar -C data/ImageNet-C\n    ```\n\n## Usage\nWe have included sample scripts in `cifar10-scripts`, `cifar100-scripts`, and `imagenet-scripts`. \nFor example, there are 5 scripts for CIFAR-100 and WideResNet: \n\n1. `./cifar100-scripts/wideresnet/run-cn.sh`\n   \n2. `./cifar100-scripts/wideresnet/run-sn.sh`\n   \n3. `./cifar100-scripts/wideresnet/run-cnsn.sh`\n   \n4. `./cifar100-scripts/wideresnet/run-cnsn-consist.sh` (Use CNSN with JSD consistency regularization)\n   \n5. `./cifar100-scripts/wideresnet/run-cnsn-augmix.sh` (Use CNSN with AugMix)\n\n\n## Pretrained models\n- Pretrained ResNet-50 ImageNet classifiers are available:\n1. [ResNet-50 + CN](https://drive.google.com/file/d/1F-2uW1-zkPNg38PhxGmdYc8O3eow7IFG/view?usp=sharing)\n2. [ResNet-50 + SN](https://drive.google.com/file/d/1ErWPFGUnkgOPKKjwgyNaAAocCWCw1R4I/view?usp=sharing)\n3. [ResNet-50 + CNSN](https://drive.google.com/file/d/1Y-r2ET518jBwe2F-qG80glE32C6KQNHg/view?usp=sharing)\n4. [ResNet-50 + CNSN + IBN + AugMix](https://drive.google.com/file/d/1Uov7bRZYY7q38FBXn3Q1HwWr8PnGKase/view?usp=sharing).\n\n\n- Results of the above 4 ResNet-50 models on ImageNet:\n\n|         | +CN | +SN   | +CNSN   | +CNSN+IBN+AugMix |\n| :-------- |:---------:| :----:| :----:| :---: |\n| Top-1 err | 23.3 | 23.7 | 23.3 | 22.3 |\n| mCE   | 75.1     | 73.8 | 69.7 | 62.8 |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famazon-science%2Fcrossnorm-selfnorm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famazon-science%2Fcrossnorm-selfnorm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famazon-science%2Fcrossnorm-selfnorm/lists"}