Everything here rests on embeddings
Almost every method in this lesson works the same way underneath, and seeing that once makes the rest predictable.
Run the images through a trained model and take an intermediate representation, typically the vector just before the classification head. That vector is an embedding, and its useful property is that the model learned to place semantically similar images near each other, because that is what made classification possible.
So distance in embedding space approximates visual and semantic similarity. Two photographs of the same street corner land close together. A photograph and a diagram of the same object land further apart than the photographs but closer than either is to a picture of a dog.
Once a dataset has embeddings, a set of otherwise hard questions become geometry. Which images are unusual becomes which points are far from everything. Which images are redundant becomes which points are nearly coincident. Which images are similar to this one becomes nearest neighbours.
The embedding model matters and is often left at a default. A general-purpose model gives general-purpose similarity, which is usually what you want for exploration. For a domain where the meaningful differences are subtle, a model trained on that domain gives sharper structure.

