liveBook · Manning

Mirror

As explained in Deep Learning with JAX

An array or image transformation that reverses the order of elements along a chosen dimension.

A mirror reverses an array or image along a chosen dimension. For an image, horizontal mirroring reverses pixel order from left to right while preserving rows and color channels. section 3.1.2

Mirror an image horizontally

Use slicing to reverse the horizontal axis: `img = img[:, ::-1, :]`. The first and last axes remain unchanged, so the image keeps its vertical structure and channels. NumPy also provides `flip()` for similar transformations. section 3.1.2

Mirroring fits naturally into image preprocessing and augmentation. A training pipeline can randomly choose a horizontal flip or Gaussian noise, creating varied inputs for cat-and-dog classification. section 9.1

Figure 9.1 Scheme of the data augmentation process

Shows horizontal flipping as one branch of a simple image data-augmentation process. section 9.1

How Deep Learning with JAX covers it

How deep it goes
Explains axis selection and provides slicing and NumPy alternatives, but does not develop implementation internals.
Examples
Uses a cat image, horizontal pixel reversal, and a cat-and-dog classification augmentation pipeline.
What it assumes
Assumes familiarity with multidimensional arrays, axes, image channels, and Python-style slicing.
What you can do after
Apply it via array slicing or NumPy flip() to reverse an image dimension.
How it connects
Connects mirroring with array slicing, image preprocessing, data augmentation, Gaussian noise, and image rotation.

Also explained in

Compare how 2 books explain mirror →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with JAX. The section links point to the parts of the book it draws on.