BVLC / caffe

Caffe: a fast open framework for deep learning.
http://caffe.berkeleyvision.org/
Other
34.03k stars 18.7k forks source link

Suggestion: Reshape layer in a hilbert fashion #6833

Closed Bjohnson131 closed 2 years ago

Bjohnson131 commented 5 years ago

the Hilbert curve is a linear, descretizable, curve where increasing the iteration size (ie: the dimensionality) preserves the relative distance to other nodes.

It can be used to transform a 1-Dimensional unit vector into a 2-dimensional or 3-dimensional matrix. The curve can create 2x2, 4x4, 8x8, etc matrices from a 1-Dimensional "String", however, Odd sizes (2x4, 4x6, 4x8, and more) can be created if the creation is stopped prematurely

As for the usefulness: Say that you have a sequence of data that is stored in a flat 1-dimensional "String" of values from an accelerator, barometer, or the like taken over some time. Normally, you'd have to use dense layers as the only way to process these values. Using a Hilbert projection, you can apply 2D convolution to the data, where the distance from the node/neuron that's being filtered is directly proportional to how far away the values are from the node/neuron (in this case, 2d distance is represented as a change in time).

This is not only useful, as it is equivalent in most cases to a "1-D convolution", but other image processing techniques (pooling and deconvolution) can be applied with great effect as well.

When I'm home, I'll upload an example.