This project modifies a Convolutional Neural Network (CNN) to output a feature vector instead of a probability distribution.
By extracting and saving feature vectors from the training dataset, you can efficiently perform cosine similarity search to retrieve the most similar image in the dataset—along with its label.
Essentially, this transforms the CNN into an indexing model that tells you:
- What the model predicts.
- Where the model learned that information.
This idea is inspired by:
Lloyd Watts | Solving The Billion-Dollar Problems in AI: LLM Explainability/Hallucinations and More
We trained our CNN on the MNIST dataset, and here’s what the results look like: