Integrating kNN with Foundation Models for Adaptable and Privacy-Aware Image Classification

Sebastian Doerrich,Tobias Archut,Francesco Di Salvo,Christian Ledig
2024-02-20
Abstract:Traditional deep learning models implicity encode knowledge limiting their transparency and ability to adapt to data changes. Yet, this adaptability is vital for addressing user data privacy concerns. We address this limitation by storing embeddings of the underlying training data independently of the model weights, enabling dynamic data modifications without retraining. Specifically, our approach integrates the $k$-Nearest Neighbor ($k$-NN) classifier with a vision-based foundation model, pre-trained self-supervised on natural images, enhancing interpretability and adaptability. We share open-source implementations of a previously unpublished baseline method as well as our performance-improving contributions. Quantitative experiments confirm improved classification across established benchmark datasets and the method's applicability to distinct medical image classification tasks. Additionally, we assess the method's robustness in continual learning and data removal scenarios. The approach exhibits great promise for bridging the gap between foundation models' performance and challenges tied to data privacy. The source code is available at
Computer Vision and Pattern Recognition,Machine Learning,Image and Video Processing
What problem does this paper attempt to address?
This paper aims to address the issues encountered by traditional deep learning models in image classification, especially their knowledge encoding methods that limit transparency and adaptability to data variations. As users' concerns about data privacy have increased, this adaptability has become crucial. The paper proposes a method that combines a k-nearest neighbors (k-NN) classifier with a visual base model based on self-supervised pretraining to improve interpretability and adaptability. By independently storing the embeddings of the training data instead of model weights, dynamic data modifications can be made without retraining. Specifically, this method contributes in the following ways: 1. Providing an open-source implementation of an undisclosed benchmark method and improving its performance. 2. Combining state-of-the-art base models with a more flexible data storage system to achieve few-shot adaptation in medical image analysis. 3. Experimentally validating the method's applicability in terms of data privacy, such as task incremental learning and data removal, while maintaining model performance. The paper demonstrates through experiments that the proposed method improves classification performance on standard benchmark datasets and its applicability in medical image classification tasks. Additionally, it evaluates robustness in scenarios involving continual learning and data removal, showcasing the potential to narrow the gap between model performance and data adaptability while satisfying data privacy requirements.