Closed wangk98 closed 2 years ago
The most probable reason to your issue is that your working directory is no the correct one. That's why throwing this error. And another thing is change datapath from "/path/to/data/from/mvtec" to your working machine's absolute path/relative path to your downloaded full mvtec dataset.
Python needs to know where the module is. You are probably not calling from within the repository root (where src/
) is. You can also specify the absolute path in your call:
env PYTHONPATH=where/my/patch/core/is/src python where/my/patch/core/is/bin/run_patchcore.py ...
or set it
export PYTHONPATH=$PYTHONPATH:where/my/patch/core/is/src
or pip install it.
I input env PYTHONPATH=src python bin/run_patchcore.py and when i input datapath=/path/to/data/from/mvtec datasets=('bottle' 'cable' 'capsule' 'carpet' 'grid' 'hazelnut' 'leather' 'metal_nut' 'pill' 'screw' 'tile' 'toothbrush' 'transistor' 'wood' 'zipper') dataset_flags=($(for dataset in "${datasets[@]}"; do echo '-d '"${dataset}"; done)) python bin/run_patchcore.py --gpu 0 --seed 0 --save_patchcore_model --log_group IM224_WR50_L2-3_P01_D1024-1024_PS-3_AN-1_S0 --log_online --log_project MVTecAD_Results results \ patch_core -b wideresnet50 -le layer2 -le layer3 --faiss_on_gpu --pretrain_embed_dimension 1024 --target_embed_dimension 1024 --anomaly_scorer_num_nn 1 --patchsize 3 sampler -p 0.1 approx_greedy_coreset dataset --resize 256 --imagesize 224 "${dataset_flags[@]}" mvtec $datapath it shows : Traceback (most recent call last): File "bin/run_patchcore.py", line 10, in
import patchcore.backbones
ModuleNotFoundError: No module named 'patchcore'