Student Name

Degree

Master of Science in Data Science

Department

Department of Computer Science

Faculty/ School

School of Mathematics and Computer Science (SMCS)

Date of Submission

Fall 2025

Supervisor

Dr. Tahir Syed, Assistant Professor, Department of Computer Science, School of Mathematics and Computer Science

Keywords

Anomaly Detection, Few-shot Learning, Nested Representations, Matryoshka Representation Learning

Abstract

Detecting defects and anomalies occurring in industrial manufacturing is a vital aspect of quality control, a field where numerous studies have contributed benchmarks against stateof-the-art (SOTA) models designed for GPUs. This project proposes an architectural framework and model that focuses on delivering efficiency and speed for CPU-based inference. The proposed model is optimized for low-resource environments or constrained settings where access to high grade GPUs or computational hardware is either inaccessible or restricted by high costs in countries such as Pakistan.

We propose Mat-AD (Matryoshka-inspired Anomaly Detection), a lightweight fewshot framework leveraging nested representation learning for precise defect localization in industrial inspection. Our approach utilizes a frozen DINOv3 backbone to extract hierarchical visual features, concatenated in a pyramid structure to combine mid-layer local details with final-layer global context. A trainable Matryoshka Representation Learning (MRL) projector refines these fused features into nested embeddings (96D, 192D, 384D), training itself to be able to reorganize and condense information across varying dimensions. This enables adaptive efficiency for detecting anomalies at multiple resolution scales. During inference on unseen data, the framework performs a Leave-One-Out (LOO) calibration step with rotation augmentation to establish robust normal representations using a “golden” set of 10 non-anomalous images. The three nested representations create efficient memory banks at each dimension length, with categorical memory footprint going down by 75% with limited impact on performance. Anomaly scoring is then conducted via patch-level cosine similarity matching. Experimental results on the MVTec AD benchmark demonstrate competitive performance on the image level and provide interpretable anomaly heatmaps for precise localization.

Consequently, the framework offers a practical balance between detection accuracy, computational efficiency, and few-shot adaptability for real-world industrial inspection and edge device deployment.

Document Type

Restricted Access

Submission Type

Research Project

The full text of this document is only accessible to authorized users.

Share

COinS