Can patch numbers stand in for pixels?

Each 64 × 64 satellite image is stored as 256 numbers that point into one shared vocabulary of small patches. Pick an image and see how much of it survives being rebuilt from those numbers.

The question

A EuroSAT satellite image is 64 × 64 colour pixels, 12,288 values in all. Cut it into 256 squares of 4 × 4 pixels and replace each square with the number of the most similar patch in a shared vocabulary of patches (a codebook). Can the image be rebuilt from those 256 numbers alone?

The answer

Approximately. Together with the shared vocabulary, the 256 numbers rebuild an approximation of each image, and some fine detail is lost. A larger vocabulary (a larger codebook size K) can preserve finer detail.

Pick a test image

Every dot is one of the 2,400 test images, which were kept out of the classifier's training. Click a dot on either map and that image is rebuilt in the “Rebuilt from its patch numbers” panel.

The shared vocabulary every image is rebuilt from

This vocabulary is the codebook. Each entry, called a codeword, is one 4 × 4 RGB patch, and every image is rebuilt from this same set. Click a codeword to outline every place the selected image uses it; click a patch in either picture to highlight its codeword here.

Rebuilt from its patch numbers

Original pixels64 × 64 RGB · click a 4 × 4 patch
Reconstructed from numbersRebuilt in your browser from the 256 numbers and the codebook

How to read the pictures. The white box marks the selected patch; yellow boxes mark every patch that uses the same codeword. Drag the “Reveal original over reconstruction” slider to slide the original over the rebuild. “Show grayscale error” replaces the rebuild with the pixel error: the mean absolute RGB difference × 4, capped at 255, so black means little error and brighter means more.