{"id":13958417,"url":"https://github.com/MediaBrain-SJTU/RegAD","last_synced_at":"2025-07-20T23:31:24.899Z","repository":{"id":46139943,"uuid":"510700699","full_name":"MediaBrain-SJTU/RegAD","owner":"MediaBrain-SJTU","description":"[ECCV2022 Oral] Registration based Few-Shot Anomaly Detection","archived":false,"fork":false,"pushed_at":"2022-09-07T06:38:18.000Z","size":7474,"stargazers_count":257,"open_issues_count":10,"forks_count":40,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-08-09T13:18:46.968Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MediaBrain-SJTU.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-05T11:08:26.000Z","updated_at":"2024-07-17T06:03:43.000Z","dependencies_parsed_at":"2022-09-06T19:12:11.906Z","dependency_job_id":null,"html_url":"https://github.com/MediaBrain-SJTU/RegAD","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MediaBrain-SJTU%2FRegAD","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MediaBrain-SJTU%2FRegAD/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MediaBrain-SJTU%2FRegAD/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MediaBrain-SJTU%2FRegAD/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MediaBrain-SJTU","download_url":"https://codeload.github.com/MediaBrain-SJTU/RegAD/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226845020,"owners_count":17691143,"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":[],"created_at":"2024-08-08T13:01:33.212Z","updated_at":"2024-11-28T01:32:00.421Z","avatar_url":"https://github.com/MediaBrain-SJTU.png","language":"Python","funding_links":[],"categories":["对象检测、分割"],"sub_categories":["网络服务_其他"],"readme":"# Registration based Few-Shot Anomaly Detection\n\nThis is an official implementation of “Registration based Few-Shot Anomaly Detection” (RegAD) with PyTorch, accepted by ECCV 2022 (Oral).\n\n[Paper Link](https://arxiv.org/abs/2207.07361)\n\n```\n@inproceedings{huang2022regad,\n  title={Registration based Few-Shot Anomaly Detection}\n  author={Huang, Chaoqin and Guan, Haoyan and Jiang, Aofan and Zhang, Ya and Spratlin, Michael and Wang, Yanfeng},\n  booktitle={European Conference on Computer Vision (ECCV)},\n  year={2022}\n}\n```\n\n\u003ccenter\u003e\u003cimg src=\"figures/intro_final.png \"width=\"80%\"\u003e\u003c/center\u003e\n\n**Abstract**:  This paper considers few-shot anomaly detection (FSAD), a practical yet under-studied setting for anomaly detection (AD), where only a limited number of normal images are provided for each category at training. So far, existing FSAD studies follow the one-model-per-category learning paradigm used for standard AD, and the inter-category commonality has not been explored. Inspired by how humans detect anomalies, i.e., comparing an image in question to normal images, we here leverage registration, an image alignment task that is inherently generalizable across categories, as the proxy task, to train a category-agnostic anomaly detection model. During testing, the anomalies are identified by comparing the registered features of the test image and its corresponding support (normal) images. As far as we know, this is the first FSAD method that trains a single generalizable model and requires no re-training or parameter fine-tuning for new categories. \n\n**Keywords**: Anomaly Detection, Few-Shot Learning, Registration\n\n## Get Started\n\n### Environment\n- python \u003e= 3.7.11\n- pytorch \u003e= 1.11.0\n- torchvision \u003e= 0.12.0\n- numpy \u003e= 1.19.5\n- scipy \u003e= 1.7.3\n- skimage \u003e= 0.19.2\n- matplotlib \u003e= 3.5.2\n- kornia \u003e= 0.6.5\n- tqdm\n\n### Files Preparation\n\n1. Download the MVTec dataset [here](https://www.mvtec.com/company/research/datasets/mvtec-ad). \n2. Download the support dataset for few-shot anomaly detection on [Google Drive](https://drive.google.com/file/d/1AZcc77cmDfkWA8f8cs-j-CUuFFQ7tPoK/view?usp=sharing) or [Baidu Disk](https://pan.baidu.com/s/1GZAqtscOaPliaFCiSKlViA) (i9rx)\nand unzip the dataset. For those who have problem downloading the support set, please optional download categories of capsule and grid on [Baidu Disk](https://pan.baidu.com/s/1fFwAB__bV0ja38B4w3JnXQ) (pll9) and [Baidu Disk](https://pan.baidu.com/s/1_--hXPPnlv3Tv7HHd4HRZQ) (ns0n).\n    ```\n    tar -xvf support_set.tar\n    ```\n    We hope the followers could use these support datasets to make a fair comparison between different methods.\n3. Download the pre-train models on [Google Drive](https://drive.google.com/file/d/1guZBh40btPRmxcnY_lud88V1NoT-eWWX/view?usp=sharing) or [Baidu Disk](https://pan.baidu.com/s/1w7-6zicbZA6ysHMSpTHNhg) (4qyo)\nand unzip the checkpoint files.\n    ```\n    tar -xvf save_checkpoints.tar\n    ```\n  After the preparation work, the whole project should have the following structure:\n\n  ```\n  ./RegAD\n  ├── README.md\n  ├── train.py                                  # training code\n  ├── test.py                                   # testing code\n  ├── MVTec                                     # MVTec dataset files\n  │   ├── bottle\n  │   ├── cable\n  │   ├── ...                  \n  │   └── zippper\n  ├── support_set                               # MVTec support dataset files\n  │   ├── 2\n  │   ├── 4                 \n  │   └── 8\n  ├── models                                    # models and backbones\n  │   ├── stn.py  \n  │   └── siamese.py\n  ├── losses                                    # losses\n  │   └── norm_loss.py  \n  ├── datasets                                  # dataset                      \n  │   └── mvtec.py\n  ├── save_checkpoints                          # model checkpoint files                  \n  └── utils                                     # utils\n      ├── utils.py\n      └── funcs.py\n  ```\n\n### Quick Start\n\n```python\npython test.py --obj $target-object --shot $few-shot-number --stn_mode rotation_scale\n```\n\nFor example, if run on the category `bottle` with `k=2`:\n```python\npython test.py --obj bottle --shot 2 --stn_mode rotation_scale\n```\n\n## Training\n\n```python\npython train.py --obj $target-object --shot $few-shot-number --data_type mvtec --data_path ./MVTec/ --epochs 50 --batch_size 32 --lr 0.0001 --momentum 0.9 --inferences 10 --stn_mode rotation_scale \n```\n\nFor example, to train a RegAD model on the MVTec dataset on `bottle` with `k=2`, simply run:\n\n```python\npython train.py --obj bottle --shot 2 --data_type mvtec --data_path ./MVTec/ --epochs 50 --batch_size 32 --lr 0.0001 --momentum 0.9 --inferences 10 --stn_mode rotation_scale \n```\n\nThen you can run the evaluation using:\n```python\npython test.py --obj bottle --shot 2 --stn_mode rotation_scale\n```\n\n## Results\n\nResults of few-shot anomaly detection and localization with k=2:\n\n\u003cdiv style=\"text-align: center;\"\u003e\n\u003ctable\u003e\n\u003ctr\u003e\u003ctd\u003eAUC (%)\u003c/td\u003e \u003ctd colspan=\"2\"\u003eDetection\u003c/td\u003e \u003ctd colspan=\"2\"\u003eLocalization\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003eK=2\u003c/td\u003e \u003ctd\u003eRegAD\u003c/td\u003e \u003ctd\u003eInplementation\u003c/td\u003e \u003ctd\u003eRegAD\u003c/td\u003e \u003ctd\u003eInplementation\u003c/td\u003e\u003c/tr\u003e\n\u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r0'\u003e\n\u003ctd height='21' class='x21' width='90' style='height:16pt;width:67.5pt;'\u003ebottle\u003c/td\u003e\n\u003ctd class='x23' width='90' style='width:67.5pt;'\u003e99.4\u003c/td\u003e\n\u003ctd class='x22' width='90' style='width:67.5pt;'\u003e\u003cb\u003e99.7\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23' width='90' style='width:67.5pt;'\u003e98.0\u003c/td\u003e\n\u003ctd class='x22' width='90' style='width:67.5pt;'\u003e\u003cb\u003e98.6\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r1'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003ecable\u003c/td\u003e\n\u003ctd class='x23'\u003e65.1\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e69.8\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e91.7\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e94.2\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r2'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003ecapsule\u003c/td\u003e\n\u003ctd class='x23'\u003e67.5\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e68.6\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e97.3\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e97.6\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r3'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003ecarpet\u003c/td\u003e\n\u003ctd class='x23'\u003e96.5\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e96.7\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e98.9\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e98.9\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r4'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003egrid\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e84.0\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e79.1\u003c/td\u003e\n\u003ctd class='x23'\u003e77.4\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e77.5\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r5'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003ehazelnut\u003c/td\u003e\n\u003ctd class='x23'\u003e96.0\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e96.3\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e98.1\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e98.2\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r6'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003eleather\u003c/td\u003e\n\u003ctd class='x23'\u003e99.4\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e100\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e98.0\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e99.2\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r7'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003emetal_nut\u003c/td\u003e\n\u003ctd class='x23'\u003e91.4\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e94.2\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e96.9\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e98.0\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r8'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003epill\u003c/td\u003e\n\u003ctd class='x23'\u003e\u003cb\u003e81.3\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e66.1\u003c/td\u003e\n\u003ctd class='x23'\u003e93.6\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e97.0\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r9'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003escrew\u003c/td\u003e\n\u003ctd class='x23'\u003e52.5\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e53.9\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e94.4\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e94.1\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r10'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003etile\u003c/td\u003e\n\u003ctd class='x23'\u003e94.3\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e98.9\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e94.3\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e95.1\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r11'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003etoothbrush\u003c/td\u003e\n\u003ctd class='x23'\u003e86.6\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e86.8\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e98.2\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e98.2\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r12'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003etransistor\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e86.0\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e82.2\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e93.4\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e93.3\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r13'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003ewood\u003c/td\u003e\n\u003ctd class='x23'\u003e99.2\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e99.8\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e93.5\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e96.5\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r14'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003ezipper\u003c/td\u003e\n\u003ctd class='x23'\u003e86.3\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e90.9\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e95.1\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e98.3\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r15'\u003e\n\u003ctd height='21' class='x23' style='height:16pt;'\u003eaverage\u003c/td\u003e\n\u003ctd class='x22' x:fmla=\"=AVERAGE(B1:B15)\"\u003e\u003cb\u003e85.7\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23' x:fmla=\"=AVERAGE(C1:C15)\"\u003e85.5\u003c/td\u003e\n\u003ctd class='x23' x:fmla=\"=AVERAGE(D1:D15)\"\u003e94.6\u003c/td\u003e\n\u003ctd class='x22' x:fmla=\"=AVERAGE(E1:E15)\"\u003e\u003cb\u003e95.6\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\nResults of few-shot anomaly detection and localization with k=4:\n\n\u003cdiv style=\"text-align: center;\"\u003e\n\u003ctable\u003e\n\u003ctr\u003e\u003ctd\u003eAUC (%)\u003c/td\u003e \u003ctd colspan=\"2\"\u003eDetection\u003c/td\u003e \u003ctd colspan=\"2\"\u003eLocalization\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003eK=4\u003c/td\u003e \u003ctd\u003eRegAD\u003c/td\u003e \u003ctd\u003eInplementation\u003c/td\u003e \u003ctd\u003eRegAD\u003c/td\u003e \u003ctd\u003eInplementation\u003c/td\u003e\u003c/tr\u003e\n\u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r0'\u003e\n\u003ctd height='21' class='x21' width='90' style='height:16pt;width:67.5pt;'\u003ebottle\u003c/td\u003e\n\u003ctd class='x22' width='90' style='width:67.5pt;'\u003e\u003cb\u003e99.4\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23' width='90' style='width:67.5pt;'\u003e99.3\u003c/td\u003e\n\u003ctd class='x23' width='90' style='width:67.5pt;'\u003e98.4\u003c/td\u003e\n\u003ctd class='x22' width='90' style='width:67.5pt;'\u003e\u003cb\u003e98.5\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r1'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003ecable\u003c/td\u003e\n\u003ctd class='x23'\u003e76.1\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e82.9\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e92.7\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e95.5\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r2'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003ecapsule\u003c/td\u003e\n\u003ctd class='x23'\u003e72.4\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e77.3\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e97.6\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e98.3\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r3'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003ecarpet\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e97.9\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e97.9\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e98.9\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e98.9\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r4'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003egrid\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e91.2\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e87\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e85.7\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e85.7\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r5'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003ehazelnut\u003c/td\u003e\n\u003ctd class='x23'\u003e95.8\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e95.9\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e98.0\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e98.4\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r6'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003eleather\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e100\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e99.9\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e99.1\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e99\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r7'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003emetal_nut\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e94.6\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e94.3\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e97.8\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e96.5\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r8'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003epill\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e80.8\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e74.0\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e97.4\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e97.4\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r9'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003escrew\u003c/td\u003e\n\u003ctd class='x23'\u003e56.6\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e59.3\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e95.0\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e96.0\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r10'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003etile\u003c/td\u003e\n\u003ctd class='x23'\u003e95.5\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e98.2\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e\u003cb\u003e94.9\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e92.6\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r11'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003etoothbrush\u003c/td\u003e\n\u003ctd class='x23'\u003e90.9\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e91.1\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e98.5\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e98.5\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r12'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003etransistor\u003c/td\u003e\n\u003ctd class='x23'\u003e85.2\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e85.5\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e93.8\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e93.5\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r13'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003ewood\u003c/td\u003e\n\u003ctd class='x24'\u003e98.6\u003c/td\u003e\n\u003ctd class='x25'\u003e\u003cb\u003e98.9\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x24'\u003e94.7\u003c/td\u003e\n\u003ctd class='x25'\u003e\u003cb\u003e96.3\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r14'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003ezipper\u003c/td\u003e\n\u003ctd class='x23'\u003e88.5\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e95.8\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e94.0\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e98.6\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r15'\u003e\n\u003ctd height='21' class='x23' style='height:16pt;'\u003eaverage\u003c/td\u003e\n\u003ctd class='x23' x:fmla=\"=AVERAGE(B1:B15)\"\u003e88.2\u003c/td\u003e\n\u003ctd class='x22' x:fmla=\"=AVERAGE(C1:C15)\"\u003e\u003cb\u003e89.2\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23' x:fmla=\"=AVERAGE(D1:D15)\"\u003e95.8\u003c/td\u003e\n\u003ctd class='x22' x:fmla=\"=AVERAGE(E1:E15)\"\u003e\u003cb\u003e96.2\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\u003c/table\u003e\n\u003c/div\u003e\n\nResults of few-shot anomaly detection and localization with k=8:\n\n\u003cdiv style=\"text-align: center;\"\u003e\n\u003ctable\u003e\n\u003ctr\u003e\u003ctd\u003eAUC (%)\u003c/td\u003e \u003ctd colspan=\"2\"\u003eDetection\u003c/td\u003e \u003ctd colspan=\"2\"\u003eLocalization\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003eK=8\u003c/td\u003e \u003ctd\u003eRegAD\u003c/td\u003e \u003ctd\u003eInplementation\u003c/td\u003e \u003ctd\u003eRegAD\u003c/td\u003e \u003ctd\u003eInplementation\u003c/td\u003e\u003c/tr\u003e\n\u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r0'\u003e\n\u003ctd height='21' class='x21' width='90' style='height:16pt;width:67.5pt;'\u003ebottle\u003c/td\u003e\n\u003ctd class='x22' width='90' style='width:67.5pt;'\u003e\u003cb\u003e99.8\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x22' width='90' style='width:67.5pt;'\u003e\u003cb\u003e99.8\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23' width='90' style='width:67.5pt;'\u003e97.5\u003c/td\u003e\n\u003ctd class='x22' width='90' style='width:67.5pt;'\u003e\u003cb\u003e98.5\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r1'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003ecable\u003c/td\u003e\n\u003ctd class='x23'\u003e80.6\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e81.5\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e94.9\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e95.8\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r2'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003ecapsule\u003c/td\u003e\n\u003ctd class='x23'\u003e76.3\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e78.4\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e98.2\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e98.4\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r3'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003ecarpet\u003c/td\u003e\n\u003ctd class='x23'\u003e98.5\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e98.6\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e98.9\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e98.9\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r4'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003egrid\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e91.5\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e91.5\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e88.7\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e88.7\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r5'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003ehazelnut\u003c/td\u003e\n\u003ctd class='x23'\u003e96.5\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e97.3\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e98.5\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e98.5\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r6'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003eleather\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e100\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e100\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e98.9\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e99.3\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r7'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003emetal_nut\u003c/td\u003e\n\u003ctd class='x23'\u003e98.3\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e98.6\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e96.9\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e98.3\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r8'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003epill\u003c/td\u003e\n\u003ctd class='x23'\u003e\u003cb\u003e80.6\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e77.8\u003c/td\u003e\n\u003ctd class='x23'\u003e\u003cb\u003e97.8\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e97.7\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r9'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003escrew\u003c/td\u003e\n\u003ctd class='x23'\u003e63.4\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e65.8\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e97.1\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e97.3\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r10'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003etile\u003c/td\u003e\n\u003ctd class='x23'\u003e97.4\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e99.6\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e95.2\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e96.1\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r11'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003etoothbrush\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e98.5\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e96.6\u003c/td\u003e\n\u003ctd class='x22'\u003e98.7\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e99.0\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r12'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003etransistor\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e93.4\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e90.3\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e96.8\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e95.9\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r13'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003ewood\u003c/td\u003e\n\u003ctd class='x23'\u003e99.4\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e99.5\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e94.6\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e96.5\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r14'\u003e\n\u003ctd height='21' class='x21' style='height:16pt;'\u003ezipper\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e94.0\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23'\u003e93.4\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e97.4\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x22'\u003e\u003cb\u003e97.4\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr height='21' style='mso-height-source:userset;height:16pt' id='r15'\u003e\n\u003ctd height='21' class='x23' style='height:16pt;'\u003eaverage\u003c/td\u003e\n\u003ctd class='x23' x:fmla=\"=AVERAGE(B1:B15)\"\u003e\u003cb\u003e91.2\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x22' x:fmla=\"=AVERAGE(C1:C15)\"\u003e\u003cb\u003e91.2\u003c/b\u003e\u003c/td\u003e\n\u003ctd class='x23' x:fmla=\"=AVERAGE(D1:D15)\"\u003e96.8\u003c/td\u003e\n\u003ctd class='x22' x:fmla=\"=AVERAGE(E1:E15)\"\u003e\u003cb\u003e97.1\u003c/b\u003e\u003c/td\u003e\n \u003c/tr\u003e\u003c/table\u003e\n\u003c/div\u003e\n\n## Visualization\n\u003ccenter\u003e\u003cimg src=\"figures/results.png \"width=\"60%\"\u003e\u003c/center\u003e\n\n## Acknowledgement\nWe borrow some codes from [SimSiam](https://github.com/facebookresearch/simsiam), [STN](https://github.com/YotYot/CalibrationNet/blob/2446a3bcb7ff4aa1e492adcde62a4b10a33635b4/models/configurable_stn_no_stereo.py) and [PaDiM](https://github.com/xiahaifeng1995/PaDiM-Anomaly-Detection-Localization-master)\n\n## Contact\n\nIf you have any problem with this code, please feel free to contact **huangchaoqin@sjtu.edu.cn**.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMediaBrain-SJTU%2FRegAD","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMediaBrain-SJTU%2FRegAD","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMediaBrain-SJTU%2FRegAD/lists"}