Hi, I’m Duc.
I’m trying to convert Keras to SNN and then running on Loihi.I have a question about choosing layer for converting input signals into spikes.
#Dense Layer
Input layer
inp = tf.keras.Input(shape=(28, 28, 1), name=“input”)
Dense layer to transform input into spike-like signals
to_spikes_layer = tf.keras.layers.Dense(
units=64, # Small number of neurons for spike-like representation
activation=tf.nn.relu,
name=“to-spikes”,
)
to_spikes = to_spikes_layer(tf.keras.layers.Flatten(name=“flatten_input”)(inp))
#Conv 1x1 Layer
Input layer
inp = tf.keras.Input(shape=(28, 28, 1), name=“input”)
Conv2D layer to transform image into spike-like signals
to_spikes_layer = tf.keras.layers.Conv2D(
filters=3, # 3 neurons per pixel
kernel_size=1,
strides=1,
activation=tf.nn.relu,
use_bias=False,
name=“to-spikes”,
)
to_spikes = to_spikes_layer(inp)
Flatten the output of the Conv2D layer
flatten = tf.keras.layers.Flatten(name=“flatten”)(to_spikes)
Can all of you give me a real answer to this question? I don’t understand deeply enough to explain why should I use Conv 1x1 instead of Dense Layer? And when I use Dense Layer as convert input signals to spikes layer, result running on Loihi was really bad but I don’t know the reasons why?
Tks!