Patchcore fails to train with a large dataset #802
Replies: 1 comment 5 replies
-
First of all, PatchCore only needs to be trained for a single epoch. The model uses a fixed backbone with frozen weights to extract features from the training images, which are collected in a memory bank. At inference time, the features of the inference images are compared to the features in the memory bank. So the training does not involve fine-tuning of the neural network weights, and training for multiple epochs will not improve results. With very large datasets you might run into memory issues within the first epoch. That's because PatchCore has to store the extracted features from all images in the training set in memory in order to create the memory bank. This means that the memory use of PatchCore scales with the size of the dataset. For larger datasets you might have to consider subsampling your dataset or using a more memory-efficient algorithm. |
Beta Was this translation helpful? Give feedback.
-
Hello, I have a pcb dataset with about 1000 good images (and set the image size to 224x224) and when training with Patchcore, the training crashes after 2 epochs with the error
CUDA out of memory...
(similar to #434) and so I had to trim the dataset to around 200 images to get it to work, which obviously affected the training.Now, I tried the training with the same dataset on Fastflow and it could successfully train with 1000 images.
And now I'm just curious to know if there is a reason why Patchcore fails with the large number of images?
Beta Was this translation helpful? Give feedback.
All reactions