RECEPTIVE FIELD

Ch 4 ▸ Channels ▸ Module 1/4

  1. 1Color images
  2. 2Kernels with depth
  3. 3Many kernels
  4. 41×1 convolutions

Color images.

🔒 This module is locked

It builds on Putting it together. Pass that module’s knowledge check to unlock it, or skip ahead if you already know the material.

Go to Putting it together

A screen makes every color by mixing three lights: red, green and blue. So a color image stores three numbers per pixel: how much red, how much green and how much blue. Each is between 0 and 1, as with gray. (0, 0, 0) is black, (1, 1, 1) is white, and (1, 1, 0), full red and full green with no blue, is yellow.

Three grids

Group those numbers by color instead of by pixel, and the image comes apart into three grids, each the size of the image. A channel is one of those grids: one number per pixel, all measuring the same thing. A color image has three channels, red, green and blue, usually written R, G and B. A grayscale image is the special case with one channel.

So a 32×32 color image is 3×32×32=3,0723 \times 32 \times 32 = 3{,}072 numbers. Its size is written with three numbers, height × width × channels: 32×32×3.

FIG 4.1 ▸ ONE IMAGE, THREE CHANNELS3 × 32×32 = 3,072 NUMBERS

COLOR

=

■ R · 1.00

■ G · 0.84

■ B · 0.20

▸ PIXEL (8, 15) · R 1.00 · G 0.84 · B 0.20

Draw as
Each channel is a grid of its own, one number per pixel from 0 to 1. Drawn in gray, white means a lot of that color and black means none. Point at any pixel to read its three values.

Figure 4.1 shows the duck’s three channels in gray. Each one is an ordinary grayscale image, and you read it the same way: white means a lot of that color, black means none.

The red channel can’t tell the duck from the sky: the duck is white there, and the sky, at 0.77, is nearly as light. The blue channel does better. The duck is dark in it, around 0.2, and the sky and water are bright, 0.84 and up. But what really marks a yellow duck is a combination: lots of red and little blue. Red minus blue is 0.80 on the duck’s body, −0.17 on the sky and −0.65 on the water, a wider gap than either channel gives on its own. The next module builds a kernel that computes it.

Switch the figure to tinted to draw each channel in its own color.

Adding the light back up

The three channels are separate grids, but on a screen they shine from the same spot. Figure 4.2 draws each channel as a plane of its own colored light, red, green or blue, and stacks the planes in space. Wherever planes overlap on screen, their light adds. Drag to turn the stack.

FIG 4.2 ▸ THREE PLANES OF LIGHTDRAG TO TURN

▸ ALL THREE: THE FULL COLOR DUCK WHERE THEY OVERLAP

Channels
Each plane is one channel, drawn as light of its own color: red, green or blue, brighter where the value is higher. Where planes overlap on screen, their light adds. When every pixel's three lights line up, they add back to the color duck. Turn the stack while the planes are apart, and they slide out of line into fringes of single colors.

Press “Stack, from above”. The planes sit on top of each other, every pixel’s red, green and blue line up, and the light adds back to the color duck. Red light plus green light, with little blue, is yellow: that’s the body. All three at nearly full strength is the pale sky.

Now pull the planes apart and turn the stack. The three copies of the duck slide out of line, and the overlap breaks up. Where only the red plane covers a spot, you see red; where red and green overlap without blue, yellow; where all three line up, the true color. Then press “Apart, from above”. Looking straight down, the planes line up again however far apart they are, and the color duck comes back.

Switch channels off to see what the others add up to. Without blue, the sky turns a yellowish green, because its pale color is red and green light with blue on top. Without red, the duck turns green. Each channel holds one part of every pixel’s color, and the image needs all three.

Channels are just stacked maps

Nothing in the definition of a channel says it has to be a color. It’s any grid of numbers the size of the image, stacked with others. That matters later in this chapter: a convolution layer’s output is also a stack of channels, and those channels don’t mean red, green or blue. They mean whatever their kernels compute.

Knowledge check ▸ 4 questions

Before you move on.

Answer every question correctly to unlock the next module. A wrong answer gets a hint, and you can try again as many times as you like.

  1. 1How many numbers make up a 64×64 color image?

  2. 2A pixel’s color is (0.9, 0.6, 0.3). What value does it have in the green channel?

  3. 3What is a channel?

  4. 4Which color is (1, 1, 0)?

0 of 4 answered correctly.

🔒 Next module: Kernels with depth