question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue in Patch-Core

See original GitHub issue

Background

I have tried to run anomalib on the kaggle environment (also preparing a tutorial to contribute here for newcomers to get started with anomalib πŸ˜‰). However, with the patch-core model, I’m facing an issue.

Describe the Behaviour

When I run the script with patch-core, it kinda stuck in the following stage. And I’ve noticed that the coreset is processing on CPU (usages were high). So, it might be stuck or take lots of time to process on the CPU, which should not be.

Epoch 0:   8%|β–ˆβ–‰           | 7/90 [01:20<15:58, 11.54s/it, loss=nan]
Validation: 0it [00:00, ?it/s]A
Creating CoreSet Sampler via k-Center Greedy
Getting the coreset from the main embedding.

Reproducible Code

Other info.

Not sure if it’s the current know issue with patchcore. I’ve run the code successfully with the padim model (didn’t test the rest of the models).

I’m considering myself a beginner in pytorch/pytorch-lighting, maybe I’m missing something obvious. Also, there are lots of pytorch-lighting related UserWarning messages. IMHO, it’s annoying, can it be removed, like verbose = 0?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
daMichaelBcommented, May 15, 2022

Meanwhile the code from fix/sa/configs is merged. I have a slightly different setup and still does not work.

First I trained PatchCore on a single-GPU machine. There i always ran into Cuda-OutOfMemory as my dataset was to big for the patch-core training step. So i switched to a 8-GPU instance. I changed:

trainer:
  accelerator: dp # parallel training
  gpus: 8 # 8 gpus used

if i use the settings from fix/sa/configs it only uses one gpu and goes into OOO in training step.

Training Step πŸ†—

Now the training_step works very well with all the data. I also found that the GPU-Mem is not used anymore at all (maybe because of dp setting.

Validation Step

The validation Step however does not use any of the GPUs and it takes forever.

I get the log Applying core-set subsampling to get the embedding. and then it computes forever on CPU.

Is there any idea how to get this working @samet-akcay ? Thank you very much in advance!

1reaction
innatcommented, Apr 17, 2022

@samet-akcay running from fix/sa/configs branch fix the issue. Thanks. πŸ˜„

┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃        Test metric        ┃       DataLoader 0        ┃
┑━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚        image_AUROC        β”‚            1.0            β”‚
β”‚         image_F1          β”‚            1.0            β”‚
β”‚        pixel_AUROC        β”‚     0.984413743019104     β”‚
β”‚         pixel_F1          β”‚    0.7208729982376099     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues Β· amazon-science/patchcore-inspection - GitHub
Issues list. An error for passing parameters into PatchCore class. #52 opened last week by zhangjieTHU. (Urgent!!!) Search for the optimal threshold ofΒ ......
Read more >
Towards Total Recall in Industrial Anomaly Detection - arXiv
On the challenging, widely used MVTec AD benchmark PatchCore achieves an image-level anomaly detection AUROC score of up to 99.6\%, more thanΒ ...
Read more >
Towards Total Recall in Industrial Anomaly Detection
While PatchCore shows high effectiveness for industrial anomaly detection without the need to specif- ically adapt to the problem domain at hand, applicability....
Read more >
MVTec AD Benchmark (Anomaly Detection) - Papers With Code
Rank Model Detection AUROC Segmentation AUROC Segmentation AUPRO 1 PatchCore Large 99.6 98.2 94.9 2 MemSeg 99.56 98.84 3 PNI Ensemble 99.55 99.05
Read more >
A practical guide to anomaly detection using Anomalib
This problem faces a number of unique challenges: ... The idea of PatchCore is that if a single patch is anomalous the whole...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found