Feature Receptive Field Visualization
Core Vision Operations DS practice problem on Onlearn.
Difficulty: easy.
Topics: Feature Receptive Field Visualization, Effective Receptive Field, Dilated Convolution, Activation Heatmaps, Kernel Size Scaling, Strided Downsampling, Computer Vision, Deep Learning, Signal Processing, Information Theory, Computational Geometry, CNN Architectures, Feature Map Analysis, Backpropagation Dynamics, Spatial Filtering, Model Interpretability.
In visual reinforcement learning, agents process raw pixel observations (such as game screens) through convolutional neural networks to extract features for decision making. A critical design consideration is the receptive field of each output feature: the region of the input that can influence a particular output neuron's value. If the receptive field is too small, the agent cannot perceive large scale patterns in the environment. If it is too large relative to the input, spatial precision is lost. Understanding and computing receptive fields helps practitioners design appropriate CNN architectures for their RL tasks. Given a 1D input of a specified size and a sequence of convolutional layers (each defined by kernel size, stride, and padding), implement a function that computes: 1. receptive field : The number of input positions that can affect a single output neuron after all layers. 2. output size : The spatial size of the output after passing through all layers sequentially. Each layer is described as a tuple (kernel size, stride, padding). Layers are applied in order from first to last. Assume integer (floor) division when computing spatial dimensions. Return the result as a dictionary with keys 'receptive field' and 'output size', both as integers.