Vision models

nengo_extras.vision.Gabor([theta, freq, …])

Describes a random generator for Gabor filters.

nengo_extras.vision.Mask(image_shape)

Describes a sparse receptive-field mask for encoders.

nengo_extras.vision.ciw_encoders(n_encoders, …)

Computed Input Weights (CIW) method for encoders from data.

nengo_extras.vision.cd_encoders_biases(…)

Constrained difference (CD) method for encoders from data.

nengo_extras.vision.percentile_biases(…[, …])

Pick biases such that neurons are active for a percentile of inputs.

class nengo_extras.vision.Gabor(theta=Uniform(low=- 3.141592653589793, high=3.141592653589793), freq=Uniform(low=0.2, high=2), phase=Uniform(low=- 3.141592653589793, high=3.141592653589793), sigma_x=Choice(options=array([0.45])), sigma_y=Choice(options=array([0.45])))[source]

Describes a random generator for Gabor filters.

class nengo_extras.vision.Mask(image_shape)[source]

Describes a sparse receptive-field mask for encoders.

Parameters
image_shape2- or 3-tuple

Shape of the input image, either (height, width) or (channels, height, width).

nengo_extras.vision.ciw_encoders(n_encoders, trainX, trainY, rng=numpy.random, normalize_data=True, normalize_encoders=True)[source]

Computed Input Weights (CIW) method for encoders from data.

Parameters
n_encodersint

Number of encoders to generate.

trainX(n_samples, n_dimensions) array-like

Training features.

trainY(n_samples,) array-like

Training labels.

Returns
encoders(n_encoders, n_dimensions) array

Generated encoders.

References

1

McDonnell, M. D., Tissera, M. D., Vladusich, T., Van Schaik, A., Tapson, J., & Schwenker, F. (2015). Fast, simple and accurate handwritten digit classification by training shallow neural network classifiers with the “Extreme learning machine” algorithm. PLoS ONE, 10(8), 1-20. doi:10.1371/journal.pone.0134254

nengo_extras.vision.cd_encoders_biases(n_encoders, trainX, trainY, rng=numpy.random, mask=None, norm_min=0.05, norm_tries=10)[source]

Constrained difference (CD) method for encoders from data.

Parameters
n_encodersint

Number of encoders to generate.

trainX(n_samples, n_dimensions) array-like

Training features.

trainY(n_samples,) array-like

Training labels.

Returns
encoders(n_encoders, n_dimensions) array

Generated encoders.

biases(n_encoders,) array

Generated biases. These are biases assuming f = G[E * X + b], and are therefore more like Nengo’s intercepts.

References

1

McDonnell, M. D., Tissera, M. D., Vladusich, T., Van Schaik, A., Tapson, J., & Schwenker, F. (2015). Fast, simple and accurate handwritten digit classification by training shallow neural network classifiers with the “Extreme learning machine” algorithm. PLoS ONE, 10(8), 1-20. doi:10.1371/journal.pone.0134254

nengo_extras.vision.percentile_biases(encoders, trainX, percentile=50)[source]

Pick biases such that neurons are active for a percentile of inputs.

class nengo_extras.convnet.PresentJitteredImages(images, presentation_time, output_shape, jitter_std=None, jitter_tau=None, **kwargs)[source]

Camera input

To use these classes, you will have to install GStreamer and some Python dependencies:

sudo apt install python-gst-1.0
pip install vext vext.gi

nengo_extras.camera.CameraPipeline([device, …])

nengo_extras.camera.CameraData(width, height)

nengo_extras.camera.Camera([width, height, …])

class nengo_extras.camera.CameraPipeline(device='/dev/video0', width=640, height=480)[source]
class nengo_extras.camera.CameraData(width, height, channels=3, keep_aspect=True)[source]
class nengo_extras.camera.Camera(width=256, height=256, offset=- 128, device='/dev/video0', cam_width=640, cam_height=480)[source]