Inject spikes into SpiNNaker from DVS in nrp


#1

Dear All,

I try to inject spikes from the DVS model in gazebo into
a population of neurons called Populationes.dvs_on
on SpiNNaker. While the DVS output looks quite
correct I get some weard output from the dvs_on
population. Both outputs should look the more or the
less the same but they don’t.

DVS output ( driving through a corridor of cylinders):

dvs_on population output:

Here are the functions I use to inject the spikes into SpiNNaker and to put the
spikes from SpiNNaker into a csv file. Both functions are modified from other
versions I found at the NRP. What could be wrong in the connections?

Best regards,
Thorben Schoepe

Python Transfer Function

“”"
This module contains the transfer function that transforms DVS address events
to spikes and input them to a population of neurons
“”"
from dvs_msgs.msg import EventArray
import numpy as np
@nrp.MapRobotPublisher(‘dvs_rendered’, Topic(’/dvs_rendered’, sensor_msgs.msg.Image))
@nrp.MapRobotSubscriber(“dvs”, Topic(‘spikerobot/edvs/events’, EventArray))
@nrp.MapSpikeSource(“input_neurons”, nrp.brain.Populationes.dvs_on, nrp.injector, weight = 50, n=1)
@nrp.Robot2Neuron()
def dvs_to_robot(t, dvs, input_neurons, dvs_rendered):
event_msg = dvs.value
amplitudes = np.zeros(nrp.config.brain_root.input_shape[0] * nrp.config.brain_root.input_shape[1])
if event_msg is None:
input_neurons.amplitude = amplitudes
return

#There are too many events - we randomly select a subset of them
n_events_to_keep = min(100, len(event_msg.events))
filtered_events = np.random.choice(event_msg.events, n_events_to_keep, replace=False)
rendered_img = np.zeros((nrp.config.brain_root.input_shape[0], nrp.config.brain_root.input_shape[1], 3), dtype=np.uint8)
# set high amplitude for neurons that spiked
for event in filtered_events:
    rescaled_event = (np.array((event.y, event.x)) * nrp.config.brain_root.scaling_factor).astype(int)
    rendered_img[rescaled_event[0]][rescaled_event[1]] = (event.polarity * 255, 255, 0)
    idx = rescaled_event[0] * nrp.config.brain_root.input_shape[1] + rescaled_event[1]
    amplitudes[idx] = 1
input_neurons.amplitude = amplitudes
#active_neurons = input_neurons[active_neurons].amplitude = 1
input_neurons.inject_spikes()
#msg_frame = CvBridge().cv2_to_imgmsg(rendered_img, 'rgb8')
#dvs_rendered.send_message(msg_frame)

Python Transfer Function

“”"
This module contains the transfer function that receives
spikes from the SpiNNaker and saves them into a csv file
“”"

@nrp.MapCSVRecorder(“recorder”, filename=“dvs_on_spikes.csv”, headers=[“id”,“time”])
@nrp.MapSpikeSink(“record_neurons”, nrp.brain.Populationes.dvs_on, nrp.spike_recorder)
@nrp.Neuron2Robot(triggers=[“record_neurons”])

def csv_spike_monitor_2(t, recorder, record_neurons):
for timing in record_neurons.times:
recorder.record_entry(
timing[0],
timing[1]
)


#2

I think I am pretty close to find the problem myself.
Is the command input_neurons.inject_spikes()
simply sending the number n of spikes to each
neuron of the population Populationes.dvs_on ?
That would mean that I would have to define
the connector matrix every time this function
is called so that only neurons receive spikes
which should receive one.

Do you know how I can define the connector
in the injector?

Best regards,
Thorben Schoepe