Prototype-Aware Contrastive Knowledge Distillation for Few-Shot Anomaly Detection

Zhihao Gu (Shanghai Jiao Tong University),* Taihai Yang (East China Normal University), Lizhuang Ma (Shanghai Jiao Tong University)
The 34th British Machine Vision Conference


Knowledge distillation (KD) is widely adopted in anomaly detection but how to extend it to the few-shot setting, where a few normal samples are provided for detecting anomalies in unseen categories, has not been explored yet. To remedy this problem, we propose a novel \textit{\textbf{P}rototype-\textbf{A}ware \textbf{C}ontrastive \textbf{K}nowledge \textbf{D}istillation} (\textbf{PACKD}) framework. Specifically, we first design a prototype extraction and integration module (PEIM) to improve the generalization of the KD model by integrating prior information of a given category from the teacher network into the student network. The PEIM is trained to generate prototypes from few-shot normal samples to give priors and further uses them to guide the student to restore distillation targets. Subsequently, we adopt a novel contrastive distillation strategy to robustly distill both normal sample representations and inter-sample relations in the training phase. The negative and positive pairs are obtained from the feature correlations of the teacher and student. Comprehensive studies demonstrate that the proposed method outperforms the comparable few-shot methods on three benchmarks, even in more challenging cross-dataset scenarios.


author    = {Zhihao Gu and Taihai Yang and Lizhuang Ma},
title     = {Prototype-Aware Contrastive Knowledge Distillation for Few-Shot Anomaly Detection},
booktitle = {34th British Machine Vision Conference 2023, {BMVC} 2023, Aberdeen, UK, November 20-24, 2023},
publisher = {BMVA},
year      = {2023},
url       = {}

Copyright © 2023 The British Machine Vision Association and Society for Pattern Recognition
The British Machine Vision Conference is organised by The British Machine Vision Association and Society for Pattern Recognition. The Association is a Company limited by guarantee, No.2543446, and a non-profit-making body, registered in England and Wales as Charity No.1002307 (Registered Office: Dept. of Computer Science, Durham University, South Road, Durham, DH1 3LE, UK).

Imprint | Data Protection