Computer Vision
Convolutional and pooling layers, classic CNN architectures (Inception, ResNet residual blocks), and test-time augmentation.
20 questions
JuniorTheoryVery commonWhy does a CNN need far fewer parameters than a dense net on the same image?
Why does a CNN need far fewer parameters than a dense net on the same image?
A dense layer gives every pixel its own weight, so its parameter count scales with image size. A conv layer learns one small kernel and reuses it at every position — cost depends only on kernel size and channels, and one feature is found anywhere.
Common mistakes
- ✗Attributing the saving to pooling rather than to weight sharing in convolutions
- ✗Thinking conv kernels are hand-designed and fixed rather than learned
- ✗Believing a conv layer holds a separate kernel per spatial position
Follow-up questions
- →How does weight sharing relate to detecting a feature anywhere in the image?
- →When would a dense layer still be the right choice on image data?
JuniorTheoryVery commonWhat is a convolutional layer in a CNN?
What is a convolutional layer in a CNN?
The core building block of a CNN. It holds learnable filters (kernels); each filter spans ALL input channels and slides over the input, taking a dot product with each patch to produce one feature-map value. Multiple filters give multiple output channels.
Common mistakes
- ✗Thinking a filter sees one channel, when it spans all input channels
- ✗Confusing a conv layer with a fully-connected layer
- ✗Believing conv filters are fixed rather than learned
Follow-up questions
- →How does the number of filters relate to the output channel count?
- →Why does weight sharing make convolutions efficient for images?
JuniorTheoryVery commonWhat is a pooling layer in a CNN and what is it for?
What is a pooling layer in a CNN and what is it for?
Pooling downsamples a feature map: it splits the map into small w×h blocks and applies a fixed function per block — usually max or average. It has NO learnable parameters. Goals: enlarge later convolutions' receptive field, add invariance to small shifts, and speed up compute.
Common mistakes
- ✗Thinking pooling has learnable parameters
- ✗Believing pooling increases rather than reduces spatial size
- ✗Forgetting pooling adds translation invariance, not just speed
Follow-up questions
- →When would average pooling be preferred over max pooling?
- →How does pooling enlarge the receptive field of later convolutions?
MiddleTheoryVery commonFine-tuning a pretrained CNN on 2000 images — what do you freeze, and in what order unfreeze?
Fine-tuning a pretrained CNN on 2000 images — what do you freeze, and in what order unfreeze?
With that little data, first replace the head and train it alone with the backbone frozen. Then unfreeze top-down, deepest blocks first, at a much lower learning rate. Early layers hold generic edges worth keeping; late task-specific layers must adapt.
Common mistakes
- ✗Unfreezing the whole backbone at the original learning rate on tiny data
- ✗Inverting the hierarchy — treating early layers as the task-specific ones
- ✗Skipping the head-only warmup, so random head gradients wreck pretrained weights
Follow-up questions
- →Why does an untrained head damage the backbone if unfrozen immediately?
- →How should batch-norm layers be handled while the backbone is frozen?
JuniorTheoryCommonHow do kernel size, stride and padding determine a conv layer's output shape?
How do kernel size, stride and padding determine a conv layer's output shape?
Each spatial side becomes floor((W − K + 2P)/S) + 1. Kernel size K sets how much context one output sees, padding P protects border pixels and can preserve the size, stride S downsamples. Output channels equal the filter count, independent of all three.
Common mistakes
- ✗Forgetting padding is counted twice (2P) — once on each side
- ✗Thinking stride enlarges the feature map instead of downsampling it
- ✗Tying the output channel count to the input channels rather than the filter count
Follow-up questions
- →What padding keeps the output size equal to the input for a 3×3 kernel?
- →How does a stride of 2 compare with a pooling layer for downsampling?
JuniorTheoryCommonWhich image augmentations are safe for a task and which silently change the label?
Which image augmentations are safe for a task and which silently change the label?
An augmentation is safe only if the label survives it under that task's semantics. Flips break digits, crops cut characters out of OCR targets, and colour jitter destroys diagnostic hue in medical images. Choose from the task, not a default list.
Common mistakes
- ✗Applying a default augmentation pipeline without checking the task's label semantics
- ✗Believing a CNN is fully invariant to flips and rotations
- ✗Assuming stronger augmentation is always better regularization
Follow-up questions
- →Why is a horizontal flip unsafe for digit or character recognition?
- →How would you validate that an augmentation preserved the label?
JuniorTheoryCommonWhat is a neuron's receptive field in a CNN, and what makes it grow?
What is a neuron's receptive field in a CNN, and what makes it grow?
It is the input region that can influence one output activation. Depth grows it additively, stride and pooling multiply the growth of all layers above them, and dilation spreads a kernel's taps apart to widen it without extra weights.
Common mistakes
- ✗Inverting the direction — it is input pixels, not downstream neurons
- ✗Thinking only kernel size matters and ignoring stride and pooling
- ✗Assuming depth leaves the receptive field unchanged
Follow-up questions
- →Why does a stride of 2 multiply rather than add to receptive-field growth?
- →How does the sparse-kernel technique
dilated convolutionwiden the field without more weights?
MiddleTheoryCommonWhat is a depthwise-separable convolution and how much compute does it save?
What is a depthwise-separable convolution and how much compute does it save?
It splits a standard convolution into a depthwise step — one k×k filter per input channel, no channel mixing — then a 1×1 pointwise convolution that mixes channels. Cost falls to roughly 1/N + 1/k², so a 3×3 layer gets about 8–9× cheaper.
Common mistakes
- ✗Thinking the depthwise step already mixes channels
- ✗Omitting the 1×1 pointwise step, which is what restores channel mixing
- ✗Attributing the saving to lower precision or to smaller inputs
Follow-up questions
- →Why does the saving depend on the output channel count N?
- →What accuracy trade-off comes with this factorization?
MiddleTheoryCommonWhen do you pick a one-stage detector over a two-stage one like Faster R-CNN?
When do you pick a one-stage detector over a two-stage one like Faster R-CNN?
The proposal stage filters a few hundred likely regions first, so the head sees a balanced, well-localized set — better accuracy on small or crowded objects. One-stage detectors score a dense anchor grid in one pass, for tight latency budgets.
Common mistakes
- ✗Thinking the proposal stage is a speed optimization rather than an accuracy one
- ✗Believing the two families differ only in where suppression happens
- ✗Assuming two-stage detectors cannot be trained end to end
Follow-up questions
- →How does a dense anchor grid create the foreground-background imbalance?
- →What does non-maximum suppression (
NMS) do to overlapping predicted boxes?
MiddleDebuggingCommonA CNN at 98% on curated validation collapses on user phone photos — find and fix the cause.
A CNN at 98% on curated validation collapses on user phone photos — find and fix the cause.
Validation is drawn only from studio shots, so it never sees the deployment distribution, and the inference transform skips the normalization used in training. Fix both — match the serving transform to training and validate on real phone photos.
Open full question →Common mistakes
- ✗Calling it overfitting when the evaluation set itself is unrepresentative
- ✗Thinking normalization only matters during training
- ✗Retuning a threshold on a split that shares the wrong distribution
Follow-up questions
- →How would you monitor input distribution shift in production?
- →Why must the serving transform be identical to the training transform?
MiddleTheoryCommonWhy do modern CNNs stack two 3×3 convolutions instead of using one 5×5?
Why do modern CNNs stack two 3×3 convolutions instead of using one 5×5?
Both reach a 5×5 receptive field, but two 3×3 layers use 18C² weights against 25C² and insert a nonlinearity between them, so the composition is more expressive. The extra activation and smaller parameter budget are the gain, not field size.
Common mistakes
- ✗Thinking the stacked form enlarges the receptive field beyond 5×5
- ✗Forgetting the intermediate nonlinearity is what adds expressiveness
- ✗Believing a 3×3 convolution downsamples by default
Follow-up questions
- →How do the parameter counts 18C² and 25C² arise?
- →What changes if you remove the activation between the two 3×3 layers?
MiddleTheoryCommonWhat does a Vision Transformer do instead of convolutions, and why is it data-hungry?
What does a Vision Transformer do instead of convolutions, and why is it data-hungry?
It cuts the image into fixed patches, embeds each as a token, adds positional encodings and runs global self-attention, so patches interact from layer one. It has no locality or translation equivariance prior, so those come from huge data or pretraining.
Common mistakes
- ✗Thinking a Vision Transformer keeps the convolutional locality prior
- ✗Believing attention is computed only within a patch
- ✗Attributing the data hunger to parameter count rather than missing inductive bias
Follow-up questions
- →How do strong augmentation and distillation cut the data requirement?
- →Why are positional encodings needed when attention treats patches as a set?
SeniorTheoryCommonWhat is a residual block and how does it fight vanishing/exploding gradients?
What is a residual block and how does it fight vanishing/exploding gradients?
Deep nets suffer vanishing/exploding gradients: chain-rule backprop multiplies many small (or large) factors, so the signal shrinks or blows up before reaching early layers. A residual block adds an identity skip that bypasses a couple of layers, computing F(x) + x — a gradient highway that lets ResNets go deep.
Common mistakes
- ✗Thinking the skip connection adds parameters rather than an identity path
- ✗Believing it computes F(x) without the +x term
- ✗Confusing the skip connection with feature concatenation
Follow-up questions
- →Why does the identity path specifically help gradients flow backward?
- →What must match between x and F(x) for the addition to work?
MiddleTheoryOccasionalHow is the image-text model CLIP trained, and why does zero-shot classification fall out?
How is the image-text model CLIP trained, and why does zero-shot classification fall out?
Two encoders map images and captions into one shared embedding space, trained contrastively — matched pairs in a batch pulled together, all other pairings pushed apart. Zero-shot follows by embedding class names as prompts and taking the nearest.
Common mistakes
- ✗Thinking CLIP is a supervised classifier over a fixed label set
- ✗Forgetting the in-batch negatives are what shape the shared space
- ✗Assuming zero-shot needs generated captions rather than prompt embeddings
Follow-up questions
- →Why does prompt wording change zero-shot accuracy?
- →How does batch size affect the quality of contrastive training?
MiddleTheoryOccasionalTranslation invariance versus equivariance in a CNN — which component gives which?
Translation invariance versus equivariance in a CNN — which component gives which?
Convolution is equivariant — shift the input and the feature map shifts the same way. Pooling, especially global pooling, turns that into approximate invariance by discarding where the response fired. Flatten into a dense head destroys both.
Common mistakes
- ✗Swapping the two terms — convolution gives equivariance, not invariance
- ✗Believing a CNN is exactly, rather than approximately, shift-invariant
- ✗Forgetting a flatten into a dense head reintroduces position dependence
Follow-up questions
- →Why is global average pooling more shift-tolerant than a flatten?
- →What breaks equivariance at the borders when padding is used?
MiddleCodeOccasionalWrite a function returning the receptive field of a conv stack from kernels and strides.
Write a function returning the receptive field of a conv stack from kernels and strides.
Walk the layers front to back keeping a running jump, the product of the strides so far. Start with rf = 1 and jump = 1; for each layer do rf += (k − 1) × jump, then jump ×= s. Each layer adds k − 1 pixels scaled by the preceding downsampling.
Open full question →Common mistakes
- ✗Ignoring stride and simply multiplying the kernel sizes
- ✗Adding k instead of k − 1 for each layer
- ✗Applying the current layer's stride before adding its kernel contribution
Follow-up questions
- →How does the formula change when a layer uses dilation?
- →Why is the running jump the product of all preceding strides?
MiddleDesignOccasionalYou already trained a CNN for image classification. How can you squeeze out a higher score without retraining the model? Describe the technique and what it costs.
You already trained a CNN for image classification. How can you squeeze out a higher score without retraining the model? Describe the technique and what it costs.
Use Test-Time Augmentation (TTA): at inference run the model on several augmented views — crops, rotations, flips — and average the predictions. No retraining is needed; the cost is ≈N× forward passes, and augmentations must preserve the label.
Common mistakes
- ✗Fine-tuning on the test set, which leaks labels
- ✗Choosing augmentations that change the true label (e.g. flips for digits)
- ✗Forgetting TTA multiplies inference cost by the number of views
Follow-up questions
- →Which augmentations are unsafe for a given task, and why?
- →How does averaging probabilities across views reduce error?
MiddleTheoryOccasionalHow does the segmentation architecture U-Net differ from a classifier, and what do its skips restore?
How does the segmentation architecture U-Net differ from a classifier, and what do its skips restore?
A classifier collapses the map to one label. U-Net adds a decoder that upsamples back to full resolution, predicting a class per pixel. Skip connections carry high-resolution encoder features across, restoring boundaries downsampling destroyed.
Common mistakes
- ✗Thinking skips exist only for gradient flow, not for spatial detail
- ✗Assuming a deep encoder alone preserves boundary precision
- ✗Confusing per-pixel prediction with per-image classification
Follow-up questions
- →How does semantic segmentation differ from instance segmentation?
- →Why do object boundaries blur when the encoder skips are removed?
MiddleTheoryOccasionalHow do you enlarge the receptive field without adding depth, and what does each option cost?
How do you enlarge the receptive field without adding depth, and what does each option cost?
Dilation spreads kernel taps apart, widening the field at unchanged parameters and resolution, but it samples sparsely and can cause gridding. Pooling or stride widen it cheaply while discarding detail. A bigger kernel keeps detail but costs grow quadratically.
Common mistakes
- ✗Thinking dilation adds parameters or changes output resolution
- ✗Believing a bigger kernel's cost grows linearly with its side
- ✗Missing that pooling and stride buy the field by discarding detail
Follow-up questions
- →What causes gridding artefacts in a stack of equally dilated convolutions?
- →When is losing spatial resolution to pooling an acceptable trade?
SeniorTheoryOccasionalWhat is the GoogLeNet Inception module, and what makes the dimension-reduced version practical?
What is the GoogLeNet Inception module, and what makes the dimension-reduced version practical?
It applies several kernel sizes in parallel (1×1, 3×3, 5×5) plus 3×3 max-pooling and concatenates the outputs, so one layer captures multi-scale features. The naive version explodes the channel count; the fix inserts 1×1 convolutions as a bottleneck to cut channels cheaply so the net can go deep.
Common mistakes
- ✗Thinking the parallel branches run sequentially instead of in parallel
- ✗Believing 1×1 convs change spatial size rather than channel count
- ✗Missing that the naive module's channel blow-up is what blocks depth
Follow-up questions
- →Why does a 1×1 convolution reduce channels without losing spatial resolution?
- →How does multi-scale parallel filtering help compared to a single kernel size?