How to use Gabor filters

Hi everyone.

I am working on some primitive image recognition work. Basically to detect shapes(or edges) by using Gabor filters. I saw that some Gabor filter encoder is included in Nengo Extras, but I am unable to understand how to even use it. I have some basic understanding of how to implement it in scikit-image, but Im completely perplexed in Nengo.

Can anyone help me understand this. I am also okay with creating Gabor filters (equivalent of simple cells) made from scratch using the mathematics, instead of using something prebuilt, if anyone is able to help me do that as well.

Thank you.

1 Like

You can see an example here of how to use the Gabor filters implemented in nengo-extras: https://www.nengo.ai/nengo-extras/examples/mnist_single_layer.html

If you want to implement Gabor filters in your own way, you could use the same framework (setting the ensemble.encoders parameter), or you could just directly create a nengo.Connection(ens0.neurons, ens1.neurons, transform=my_weights), where my_weights are whatever connection weights you want implementing your Gabor filters.

Hi,
Thanks for your reply.
Could you please explain what setting encoders for an ensemble actually means?
As in, when I give a weights matrix as transform in a connection, I’m essentially multiplying the output of the first ensemble with those weights and passing them to the second right?
Can you explain in simple terms like that?

In Nengo sometimes we represent connection weights in a factored form. For example, suppose you have N neurons in one ensemble and M neurons in the second ensemble. Instead of representing the connection weights between those layers with an NxM weight matrix, we can split it into an NxD and a DxM matrix (where D << M and N). This is much more efficient in terms of memory usage and communication bandwidth (we only need to communicate a D-dimensional signal between ensembles, rather than N), although you do sacrifice some representational power. Anyway, in those terms the NxD matrix is called the “decoders” and the DxM matrix is called the “encoders”. So you take the output of your first ensemble, multiply it by the decoders, then multiply that again by the encoders, and that is the input to your second ensemble.

Note that in practice we often insert another matrix in the middle, so the full story is that you have a NxD0 matrix, a D0xD1 matrix, and a D1xM matrix. The D0xD1 matrix is the transform parameter on a factored connection (ensemble->ensemble). As opposed to on a ensemble.neurons->ensemble.neurons connection, where the transform represents the full weight matrix.

You may also find this recent forum post helpful, for more discussion on the ideas surrounding this weight factoring New to Nengo & Confused about some concepts.

1 Like