Skip to main content

Introduction

PatchCore is a CNN-based model that uses a backbone network pretrained on large natural image datasets (ImageNet) for feature extraction. PatchCore uses a network ϕ\phi pre-trained on ImageNet. As the features at specific network hierarchies play an important role, we use ϕi,j=ϕj(xi)\phi_{i,j} = \phi_j(x_i) to denote the features for image xiXx_i \in X (with dataset XX) and hierarchy-level jj of the pre-trained network ϕ\phi. If not noted otherwise, jj indexes feature maps from ResNet-like architectures, such as ResNet-50 or WideResNet-50, with j{1,2,3,4}j \in \{1, 2, 3, 4\} indicating the final output of respective spatial resolution blocks.

Key Features

  • Patch-based Approach: Operates on image patches rather than whole images
  • Coreset Sampling: Reduces memory requirements by selecting representative patches
  • Pretrained Features: Leverages features from networks pretrained on ImageNet

How It Works

  1. Feature Extraction: Extract patch-level features from intermediate layers of a pretrained CNN
  2. Memory Bank Construction: Build a memory bank of nominal patch features
  3. Coreset Reduction: Apply coreset sampling to reduce memory requirements while maintaining coverage
  4. Anomaly Scoring: For test images, compute distance to nearest neighbors in the memory bank

Cold Start Considerations

PatchCore relies heavily on a representative set of nominal features to work. During cold start scenarios, since there is limited nominal data, PatchCore’s coreset reduction strategy cannot be properly applied. A simpler strategy such as random sampling can be used to build the initial nominal feature set.
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.