amazon-research/patchcore-inspection - GitHub
文章推薦指數: 80 %
Towards Total Recall in Industrial Anomaly Detection. This repository contains the implementation for PatchCore as proposed in Roth et al.
Skiptocontent
{{message}}
amazon-research
/
patchcore-inspection
Public
Notifications
Fork
20
Star
143
License
Apache-2.0license
143
stars
20
forks
Star
Notifications
Code
Issues
15
Pullrequests
0
Actions
Projects
0
Wiki
Security
Insights
More
Code
Issues
Pullrequests
Actions
Projects
Wiki
Security
Insights
amazon-research/patchcore-inspection
Thiscommitdoesnotbelongtoanybranchonthisrepository,andmaybelongtoaforkoutsideoftherepository.
main
Branches
Tags
Couldnotloadbranches
Nothingtoshow
{{refName}}
default
Couldnotloadtags
Nothingtoshow
{{refName}}
default
1
branch
0
tags
Code
Latestcommit
petergehler
Mergepullrequest#11fromCveinnt/main
…
6a9a281
Jun17,2022
Mergepullrequest#11fromCveinnt/main
Addedfixtoissue#3andfixedminorspellingerrors
6a9a281
Gitstats
7
commits
Files
Permalink
Failedtoloadlatestcommitinformation.
Type
Name
Latestcommitmessage
Committime
bin
images
src/patchcore
test
.gitignore
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE
NOTICE
README.md
local_run_test.sh
pyproject.toml
requirements.txt
requirements_dev.txt
sample_evaluation.sh
sample_training.sh
setup.cfg
setup.py
tox.ini
Viewcode
TowardsTotalRecallinIndustrialAnomalyDetection
QuickGuide
In-DepthDescription
Requirements
SettingupMVTecAD
"Training"PatchCore
EvaluatingapretrainedPatchCoremodel
Expectedperformanceofpretrainedmodels
Citing
Security
License
README.md
TowardsTotalRecallinIndustrialAnomalyDetection
ThisrepositorycontainstheimplementationforPatchCoreasproposedinRothetal.(2021),https://arxiv.org/abs/2106.08265.
Italsoprovidesvariouspretrainedmodelsthatcanachieveupto99.6%image-levelanomaly
detectionAUROC,98.4%pixel-levelanomalylocalizationAUROCand>95%PROscore(althoughthe
latermetricisnotincludedforlicensereasons).
Forquestions&feedback,[email protected]!
QuickGuide
First,clonethisrepositoryandsetthePYTHONPATHenvironmentvariablewithenvPYTHONPATH=srcpythonbin/run_patchcore.py.
TotrainPatchCoreonMVTecAD(asdescribedbelow),run
datapath=/path_to_mvtec_folder/mvtecdatasets=('bottle''cable''capsule''carpet''grid''hazelnut'
'leather''metal_nut''pill''screw''tile''toothbrush''transistor''wood''zipper')
dataset_flags=($(fordatasetin"${datasets[@]}";doecho'-d'$dataset;done))
pythonbin/run_patchcore.py--gpu0--seed0--save_patchcore_model\
--log_groupIM224_WR50_L2-3_P01_D1024-1024_PS-3_AN-1_S0--log_online--log_projectMVTecAD_Resultsresults\
patch_core-bwideresnet50-lelayer2-lelayer3--faiss_on_gpu\
--pretrain_embed_dimension1024--target_embed_dimension1024--anomaly_scorer_num_nn1--patchsize3\
sampler-p0.1approx_greedy_coresetdataset--resize256--imagesize224"${dataset_flags[@]}"mvtec$datapath
whichrunsPatchCoreonMVTecimagesofsizes224x224usingaWideResNet50-backbonepretrainedon
ImageNet.Forothersamplerunswithdifferentbackbones,largerimagesorensembles,see
sample_training.sh.
GivenapretrainedPatchCoremodel(ormodelsforallMVTecADsubdatasets),thesecanbeevaluatedusing
datapath=/path_to_mvtec_folder/mvtec
loadpath=/path_to_pretrained_patchcores_models
modelfolder=IM224_WR50_L2-3_P001_D1024-1024_PS-3_AN-1_S0
savefolder=evaluated_results'/'$modelfolder
datasets=('bottle''cable''capsule''carpet''grid''hazelnut''leather''metal_nut''pill''screw''tile''toothbrush''transistor''wood''zipper')
dataset_flags=($(fordatasetin"${datasets[@]}";doecho'-d'$dataset;done))
model_flags=($(fordatasetin"${datasets[@]}";doecho'-p'$loadpath'/'$modelfolder'/models/mvtec_'$dataset;done))
pythonbin/load_and_evaluate_patchcore.py--gpu0--seed0$savefolder\
patch_core_loader"${model_flags[@]}"--faiss_on_gpu\
dataset--resize366--imagesize320"${dataset_flags[@]}"mvtec$datapath
AsetofpretrainedPatchCoresarehostedhere:addlink.Tousethem(andreplicatetraining),
checkoutsample_evaluation.shandsample_training.sh.
In-DepthDescription
Requirements
OurresultswerecomputedusingPython3.8,withpackagesandrespectiveversionnotedin
requirements.txt.Ingeneral,themajorityofexperimentsshouldnotexceed11GBofGPUmemory;
howeverusingsignificantlylargeinputimageswillincurhighermemorycost.
SettingupMVTecAD
TosetupthemainMVTecADbenchmark,downloaditfromhere:https://www.mvtec.com/company/research/datasets/mvtec-ad.
Placeitinsomelocationdatapath.Makesurethatitfollowsthefollowingdatatree:
mvtec
|--bottle
|-----|-----ground_truth
|-----|-----test
|-----|--------|------good
|-----|--------|------broken_large
|-----|--------|------...
|-----|-----train
|-----|--------|------good
|--cable
|--...
containingintotal15subdatasets:bottle,cable,capsule,carpet,grid,hazelnut,
leather,metal_nut,pill,screw,tile,toothbrush,transistor,wood,zipper.
"Training"PatchCore
PatchCoreextractsa(coreset-subsampled)memoryofpretrained,locallyaggregatedtrainingpatchfeatures:
Todoso,wehaveprovidedbin/run_patchcore.py,whichusesclicktomanageandaggregateinput
arguments.Thislookssomethinglike
pythonbin/run_patchcore.py\
--gpu
延伸文章資訊
- 1通天塔Towards Total Recall in Industrial Anomaly Detection
PatchCore提供了有竞争力的推理时间,同时在检测和本地化方面实现了最先进的性能。在标准数据集上,MVTec AD PatchCore实现了图像级异常检测AUROC得分为99.1%,比第二优...
- 2Towards Total Recall in Industrial Anomaly Detection - arXiv
On the challenging, widely used MVTec AD benchmark PatchCore achieves an image-level anomaly dete...
- 3[논문] PatchCore (Anomaly Detection) - YouTube
- 4A practical guide to anomaly detection using Anomalib
A short guide on unsupervised anomaly detection and how to apply it ... The idea of PatchCore is ...
- 5patchcore: Towards Total Recall in Industrial Anomaly Detection
patchcore论文地址简介略算法Locally aware patch features样本用xxx表示label定义:0是正常样本(nominal),1是异常样本(anomalous)。y...