liveBook · Manning

Digital image

As explained in Bayesian Optimization in Action

Image data is numerical or symbolic data representing visual content, typically as arrays of pixel values.

A digital image can be represented as a tensor of pixel values. In the MNIST example, each handwritten digit is stored as a 28 × 28 image, flattened into a 784-element PyTorch tensor for model processing. Each value represents a pixel’s signal: 0 denotes the background, while larger values indicate brighter regions. section 13.2.2

Working with image data commonly involves these transformations:

  • Convert images to PyTorch tensors and normalize their pixel values. section 13.2.4
  • Flatten two-dimensional images into feature vectors when using models that expect tabular inputs. section 13.2.2
  • Reshape vectors back into grids and visualize them as heat maps. section 13.2.2
  • Treat pixel similarity cautiously: images with similar pixel patterns can represent different digits, while differently arranged pixels can share a label. section 13.2.3

MNIST image representation

A handwritten digit is loaded with torchvision, converted to a tensor, and stored as a flattened vector. Reshaping the first vector to 28 × 28 and displaying it with imshow reveals the original digit as a heat map. section 13.2.2 section 13.2.4

How Bayesian Optimization in Action covers it

How deep it goes
Defines pixels, tensor shapes, normalization, flattening, and visualization, then demonstrates why raw pixel similarity can mislead.
Examples
Uses MNIST handwritten digits, 28 × 28 pixel arrays, heat-map visualizations, and three contrasting digit examples.
What you can do after
Apply it via PyTorch and torchvision to load, normalize, reshape, visualize, and prepare image tensors for models.
How it connects
Connects digital images to tensors, pixels, normalization, heat maps, Gaussian processes, kernels, and classification labels.

Also explained in

Compare how 16 books explain digital image →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Bayesian Optimization in Action. The section links point to the parts of the book it draws on.