Machine Learning for Physical Systems · Lecture 7

Stencils and images

Shortcut: P

A convolution is a stencil whose numbers are learned: image filters, the heat equation, and the conductivity of a two-phase material.

A convolution slides a small grid of numbers over the image.

    The image and its feature map

    In the orange frame: the window times the kernel, then add up

    Window
    Kernel
    Products
    Sum
    1. Pick a kernel: which edges does it light up?
    2. Click a pixel of the output: check the sum by hand.
    3. Change padding and stride: how big is the output?

    Kernel

    Image

    Padding

    Stride

    Output size
    Numbers in the kernel9the same at every pixel

    Each pixel of the feature map: yi,j = Σa,b wa,b xi+a, j+b, with a and b from −1 to 1.

    More options
    Step 2: other random fields

    New pairs of the same kind and a new start for the nine numbers; the number of steps to reach the stencil varies.

    Step 4: this page against the lecture

    Runs the three networks and the solver of this page on the 30 tiles, as stored and rotated, and compares them with the lecture's Python results.

    Table: the 30 test tiles
    TileShareElongationSolver kxxSolver kyyAll imagesHorizontal only+ rotated copies

    The networks' columns: their kxx and kyy for the tile as stored (lecture, Python).

    How it is computed

    Micrograph of step 1: Samson00, ferrite (light) and pearlite (dark) in a C45 steel with 0.45 % carbon, micrograph at 500× (2012, cropped), CC BY-SA 3.0, via Wikimedia Commons; here downsampled to 96 × 96 grey values, shared under the same licence. Microstructures, conductivities and the three networks: computed for the lecture (Python, PyTorch, CPU); the networks' numbers are stored in this page.