vrf_cs¶
- class vtem.vrf.vrf_cs(shape, dtype=<type 'numpy.float64'>, dx=0.0625, dy=0.0625, scale=1, domain=None)¶
Centre Surround RFs
Methods
compute_Ds(Mx, My) Parameters: compute_Dsw(d_Ds, Mx, My, h_norm) Compute the weighting matrix of the “correlation” between each two RFs compute_dirich_space(d_Ds, Mx, My, Px, Py, ...) Compute the spatial reconstruction functions compute_dirich_space_fft(d_Ds, Mx, My, Px, ...) filter(V) Filter a video V generate_visual_receptive_fields([...]) Generate a batch of centre surround filters from parameters set in self get_cs_parameters([dilations, alpha0, b0, ...]) Create a set of parameters for a family of Centre Surround filters load_parameters([num_neurons, h_alpha, ...]) Load Centre Surround parameters to GPU - __init__(shape, dtype=<type 'numpy.float64'>, dx=0.0625, dy=0.0625, scale=1, domain=None)¶
Parameters: shape : list
2-tuple indicating the shape (number of pixels in (height,width) / (y,x) ) of RF
dtype : type, optional
numpy dtype to use for RF calculations. If not specified , will default to np.float64
dx : float
spatial resolution in x direction, distance between two pixels
dy: float
spatial resolution in y direction, distance between two pixels
scale : float
scale up the shape by scale and scale down dx,dy by scale effectively increase the resoltuion of the RFs
domain : list
list of 2, [a,b], specifying the domain to cover RFs in default parameter settings a in x direction, b in y direction
Notes
The coordinate system is given by the following:
row (width / X) major -----------------------------------------> width | Y | ^--------------------> | |--------------------> | |--------------------> | |--------------------> X | | v height
- compute_Ds(Mx, My)¶
Parameters: Mx : integer
Order in the x dimension
My : integer
Order in the y dimension
Returns: The dirichlet coefficients of all gabor filters with order Mx, My
in the format of PitchArray with shape (num_neurons, 2*Mx+1, 2*My+1)
- compute_Dsw(d_Ds, Mx, My, h_norm)¶
Compute the weighting matrix of the “correlation” between each two RFs
Parameters: d_Ds : PitchArray
containing dirichlet coefficient most possibly created by compute_Ds
Mx : integer
order in the x direction
My : integer
order in the y direction
Returns: PitchArray with shape (num_neurons, num_neurons)
- compute_dirich_space(d_Ds, Mx, My, Px, Py, Sx, Sy, Wx, Wy, x_start=None, y_start=None)¶
Compute the spatial reconstruction functions
Parameters: d_Ds : PitchArray
containing dirichlet coefficient most possibly created by compute_Ds
Mx : integer
Order in the x direction
My : integer
Order in the y direction
Px : integer
number of pixels in reconstruction functions in x direction
Py : integer
number of pixels in reconstruction functions in y direction
Sx : float
spatial domain in degree of reconstruction functions in x direction
Sy : float
spatial domain in degree of reconstruction functions in y direction
Wx : float
spatial bandwidth in x direction
Wy : float
spatial bandwidth in y direction
x_start : float, optional
indicating the starting degree in x direction
y_start : float, optional
indicating the starting degree in y direction
output: PitchArray with shape (num_neurons, Px, Py)
- filter(V)¶
Filter a video V Must set up parameters of CS RF first
Parameters: V : 3D ndarray, with shape (num_frames, Px, Py)
Returns: the filtered output by the gabor filters specified in self
output is a PitchArray with shape (num_neurons, num_frames),
jth row of which is the output of jth gabor filter
- generate_visual_receptive_fields(startbias=0, N_filters=None, x_start=None, y_start=None)¶
Generate a batch of centre surround filters from parameters set in self
Parameters: start_bias : integer, optional
start the the (start_bias)th filter
N_filters : integer, optional
generate N_filters filters
x_start : float
indicating the starting degree in x direction
y_start : float
indicating the starting degree in y direction
- get_cs_parameters(dilations=[1, 0, -1, -2, -3], alpha0=2.0, b0=1.0, b0scalebase=1.0, sigma_center=0.5, sigma_surround=0.8)¶
Create a set of parameters for a family of Centre Surround filters
Parameters: dilation : list, optional
a list containing the dilation parameter m
num_rotations : list, optional
number of rotations of each (dilation, translation_x, translation_y) pair
alpha0 : np.float64, optional
base factor of dilation
b0 : np.float64, optional
base factor of translation
b0scalebase : np.float64, optional
effective translation in each dilation will be b0 * (alpha0**dilations[i]) * b0scalebase**(-dilations[i])
sigma_center : float, optional
standard deviation of the center
sigma_surround : float, optional
standard deviation of the surround
- load_parameters(num_neurons=None, h_alpha=None, h_x0=None, h_y0=None, set=0, sigma_center=0.5, sigma_surround=0.8)¶
Load Centre Surround parameters to GPU
num_neurons, h_alpha, h_l, h_x0, h_y0, h_ab must be specified together or unspecified together
Parameters: num_neurons : integer
total number of neurons
h_alpha : ndarray of float64
containing dilation parameters alpha = alpha0**(m)
h_l : ndarray of float64
containing rotation parameters l (angles)
h_x0 : ndarray of float64
containing translation parameters x0
h_y0 : ndarray of float64
containing translation parameters y0
h_ab : ndarray of int32
containing 0 or 1, 0 for real part, 1 for imaginary part jth gabor filter will be generated according to h_alpha[j], h_l[j], h_n[j], h_k[j] and h_ab[j]
set : integer
0 if self parameters has not been set, 1 if they have been set by get_gabor_parameters or other manner)
sigma_center : float, optional
standard deviation of the center
sigma_surround : float, optional
standard deviation of the surround