Hello everyone,
I’m trying to implement a simple neural network and test how the neurons behave with a video as input. I am pretty new in Nengo and after a few weeks of research and a some attempts of different solutions I can not manage to feed the video to the neural network.
Below you will find my approach to the problem. I’m trying to feed a video (split in frames, so actually I’m feeding images) to a Neuron and connecting this one to other with a sinusoidal output to see how it behaves. I really don’t know if this is the best approach and for now on it’s not working, I got trouble with the array dimension in the “eval_points”…
I’m open to any suggestion, thank you in advance!
#Load images
images_files = glob.glob("full-path/one_clip_frames/*.jpg")
images = []
for file in images_files:
img = PIL.Image.open(file)
img_array = np.array(img.getdata()).flatten()
images.append(img_array)
img_rows, img_cols = 640, 480
img_size = 640 * 480
#number of hidden units
n_hid = 1000
ens_params = dict(
eval_points=images,
neuron_type=nengo.LIFRate(),
intercepts=nengo.dists.Choice([0.1]),
max_rates=nengo.dists.Choice([100]),
)
with nengo.Network() as model:
a = nengo.Ensemble(n_hid, img_size, **ens_params)
v = nengo.Node(np.sin)
conn = nengo.Connection(
a, v, synapse=None,
eval_points=images)
encoders = rng.normal(size=(n_hid, img_size))
a.encoders = encoders
tile(encoders.reshape(-1, img_rows, img_cols), rows=4, cols=6, grid=True)