A pixel is an individual spatial element representing visual information at a location in an image. Pixel values encode signal intensity and form the image’s structured data. section 13.2.2 section 13.1
In the MNIST representation:
- Each image is a 28-by-28 matrix, containing 784 pixel positions. section 13.2.2 section 13.1
- Each pixel is represented by an integer from 0 to 255 rather than an arbitrary fractional value. section 13.1
- Flattening the matrix places the pixel values in a PyTorch tensor that can be processed by machine-learning models. section 13.2.2
Pixels and image similarity
An RBF kernel can compare handwritten digits by measuring differences between corresponding pixel values. This may assign high covariance to images with similar strokes even when their labels differ, while assigning low covariance to visually different images sharing a label. Pixel-level similarity therefore does not necessarily capture higher-level visual patterns. section 13.2.3
>>> train_x[0, :]
tensor([ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 18,
18, 18, 126, 136, 175, 26, 166, 255, 247, 127, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 30, 36, 94, 154, 170, 253,
253, 253, 253, 253, 225, 172, 253, 242, 195, 64, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 49, 238, 253, 253, 253, 253, 253,
253, 253, 253, 251, 93, 82, 82, 56, 39, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 18, 219, 253, 253, 253, 253, 253,
198, 182, 247, 241, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 80, 156, 107, 253, 253, 205,
11, 0, 43, 154, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 1, 154, 253, 90,
[output truncated]
Inspecting the tensor exposes individual pixel values directly, including the many low-signal entries surrounding handwritten strokes. section 13.2.2









