Computer vision practice problems
30 problems · 0 solved
Computer vision models treat an image as a grid of numbers and slide small filters over it to find edges, textures and objects. A convolution is like moving a small stencil across a picture and recording how well each patch matches it. These problems ask you to write the core image operations by hand, which builds a strong feel for shapes and indexing. You will write a 2D convolution with stride and padding, unfold patches with im2col, track feature map sizes through dilated convolutions, implement max pooling forward and backward, build a Gaussian kernel, detect edges with Sobel filters, resize an image with bilinear interpolation, convert between NHWC and NCHW layouts, implement a transposed convolution, remove duplicate detections with IoU and non-max suppression, and assign anchor boxes for detector training. Start with the Easy problems on convolution and layout conversion. Then do pooling, im2col and resizing, and finish with transposed convolution, NMS and anchor matching. Vision roles in industry, from retail to manufacturing, still rely on these building blocks, and interviewers often ask you to code convolution or NMS without a library.
Easy 8
- Write a 2D convolution with stride and padding
- Track feature map sizes through a stack of dilated convolutions
- Convert an image batch from NHWC to NCHW
- Build a normalised 2D Gaussian kernel
- Compare parameters and multiply-adds of standard vs depthwise separable conv
- Compute the receptive field of a stack of conv layers
- Center-crop a U-Net skip connection and concatenate
- Horizontally flip and crop an image together with its boxes
Medium 13
- Max pooling forward and backwardPro
- Detect edges with Sobel filters and a magnitude thresholdPro
- Unfold image patches with im2colPro
- Resize an image with bilinear interpolationPro
- Run a depthwise separable conv block forwardPro
- Implement average pooling forward and backward with overlapping windowsPro
- Apply a squeeze-and-excitation block to feature mapsPro
- Generate anchor boxes over a feature map gridPro
- Compute IoU and generalized IoU for box pairsPro
- Blur an image with a separable Gaussian filter and reflect paddingPro
- Trace tensor shapes and parameter counts through a LeNet-style CNNPro
- Implement pixel shuffle (depth to space) upsamplingPro
- Encode ground-truth boxes as regression deltas from anchorsPro
Hard 9
- Remove duplicate detections with IoU and non-max suppressionPro
- Assign anchor boxes to ground-truth objects for detector trainingPro
- Implement a single-channel transposed convolutionPro
- Implement a multi-channel grouped conv2d with stride, padding and dilationPro
- Implement the backward pass of a strided multi-channel conv2dPro
- Build an Inception module: four branches concatenated on channelsPro
- Rescore overlapping detections with Gaussian soft-NMSPro
- Implement RoI max pooling for region featuresPro
- Build YOLO-style training targets on a grid with anchorsPro