These receptive fields are derived from scale-space theory, specifically in the paper Normative theory of visual receptive fields by Lindeberg, 2021.

For use in spiking / binary signals, see the paper on Translation and Scale Invariance for Event-Based Object tracking by Pedersen et al., 2023


gaussian_kernel(x, s, c)

Efficiently creates a 2d gaussian kernel.

spatial_receptive_field(angle, ratio, size)

Creates a (size x size) receptive field kernel


Creates a number of receptive field with 1st directional derivatives. The parameters decide the number of combinations to scan over, i. e. the number of receptive fields to generate. Specifically, we generate derivatives * (n_angles * n_scales * (n_ratios - 1) + n_scales) fields. The (n_ratios - 1) + n_scales terms exist because at ratio = 1, fields are perfectly symmetrical, and there is therefore no reason to scan over the angles and scales for ratio = 1. However, n_scales receptive fields still need to be added (one for each scale-space). Finally, the derivatives * term comes from the addition of spatial derivatives. Arguments: n_scales (int): Number of scaling combinations (the size of the receptive field) drawn from a logarithmic distribution n_angles (int): Number of angular combinations (the orientation of the receptive field) n_ratios (int): Number of eccentricity combinations (how "flat" the receptive field is) size (int): The size of the square kernel in pixels derivatives (Union[int, List[Tuple[int, int]]]): The spatial derivatives to include. Defaults to 0 (no derivatives). Can either be a number, in which case 1 + 2 ** n derivatives will be made (except when 0, see below). Example: derivatives=0 omits derivatives Example: derivatives=1 provides 2 spatial derivatives + 1 without derivation Or a list of tuples specifying the derivatives in both spatial dimensions Example: derivatives=[(0, 0), (1, 2)] provides two outputs, one without derivation and one \(\partial_x \partial^2_y\).

temporal_scale_distribution(n_scales[, ...])

Provides temporal scales according to [Lindeberg2016].