Closed fedoracy closed 2 years ago
You should be able to use faiss_cpu
by simply not including the --faiss_on_gpu
-flag, e.g.
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 --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
instead of
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
Many thanks!
With faiss-cpu=1.7.2/1.7.1, got AttributeError: Traceback (most recent call last):
main()
File "/home/username/anaconda3/envs/patchcore/lib/python3.8/site-packages/click/core.py", line 1130, in call
return self.main(args, kwargs)
File "/home/username/anaconda3/envs/patchcore/lib/python3.8/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/home/username/anaconda3/envs/patchcore/lib/python3.8/site-packages/click/core.py", line 1689, in invoke
return _process_result(rv)
File "/home/username/anaconda3/envs/patchcore/lib/python3.8/site-packages/click/core.py", line 1626, in _process_result
value = ctx.invoke(self._result_callback, value, ctx.params)
File "/home/username/anaconda3/envs/patchcore/lib/python3.8/site-packages/click/core.py", line 760, in invoke
return __callback(args, **kwargs)
File "bin/run_patchcore.py", line 97, in run
PatchCore.fit(dataloaders["training"])
File "/home/username/anaconda3/envs/patchcore/lib/python3.8/site-packages/patchcore-0.1.0-py3.8.egg/patchcore/patchcore.py", line 153, in fit
File "/home/username/anaconda3/envs/patchcore/lib/python3.8/site-packages/patchcore-0.1.0-py3.8.egg/patchcore/patchcore.py", line 176, in _fill_memory_bank
File "/home/username/anaconda3/envs/patchcore/lib/python3.8/site-packages/patchcore-0.1.0-py3.8.egg/patchcore/common.py", line 330, in fit
File "/home/username/anaconda3/envs/patchcore/lib/python3.8/site-packages/patchcore-0.1.0-py3.8.egg/patchcore/common.py", line 59, in fit
File "/home/username/anaconda3/envs/patchcore/lib/python3.8/site-packages/patchcore-0.1.0-py3.8.egg/patchcore/common.py", line 45, in _create_index
AttributeError: module 'faiss' has no attribute 'GpuIndexFlatL2'
File "bin/run_patchcore.py", line 435, in