tezvyn:

Uses of the 1x1 convolution

AI-drafted, machine-checkedSource: interviewintermediate
WHAT IT TESTS

channel-wise operations and efficient design.

OUTLINE

a 1x1 conv is a per-pixel linear combination across channels; it reshapes channel depth cheaply and adds nonlinearity. Uses: dimensionality reduction in bottlenecks and channel mixing.

WHAT THIS TESTS Whether you realize convolutions act across channels, not just space, and can see why a one-pixel kernel is a powerful design tool rather than a trivial identity.

A GOOD ANSWER COVERS A one by one convolution has a kernel that spans one spatial position but the full input depth. At each pixel it computes a learned weighted sum across all input channels, producing one output channel per filter. So with C in input channels and C out filters, it maps each pixel's C in dimensional vector to a C out dimensional one, a per-pixel fully connected layer applied identically everywhere. It does not mix spatial neighbors. Its usefulness: it changes channel dimensionality cheaply, so you can squeeze channels down before an expensive three by three convolution and expand them after, drastically cutting computation, as in ResNet bottlenecks. It also mixes information across channels and, combined with an activation, injects additional nonlinearity and representational depth, as in Network in Network and Inception modules.

COMMON WRONG ANSWERS Saying it does nothing because the kernel is one pixel; it performs a meaningful cross-channel transform. Thinking it changes spatial size; it preserves height and width. Forgetting it adds parameters and a nonlinearity.

LIKELY FOLLOW-UPS How does a bottleneck block use one by one convolutions to save FLOPs. Why is a one by one conv equivalent to a per-pixel dense layer. How does Inception use them. How does this relate to pointwise convolution in depthwise separable layers.

ONE CONCRETE EXAMPLE A ResNet bottleneck takes a two-fifty-six channel input, applies a one by one conv to reduce it to sixty-four channels, runs a three by three conv on those sixty-four channels, then a one by one conv to expand back to two-fifty-six. The two cheap one by one layers shrink and restore depth around the costly three by three, cutting the operation count by several times compared to convolving three by three over all two-fifty-six channels directly.

Read the original → cs231n.github.io

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.