Issue in online learning

Hello,
I am trying to implement online learning like Keyword spotting example. I am using MNIST dataset. I separated training data (0 to 6 labels) and for online learning i will use 7, 8 and 9 labels.

Model:
model_keras = keras.models.Sequential([
keras.layers.Rescaling(1./255, input_shape = (28,28,1)),
keras.layers.Conv2D(filters=32, kernel_size=3),
keras.layers.ReLU(),
keras.layers.Conv2D(filters=32, kernel_size=3),
keras.layers.ReLU(),
keras.layers.Flatten(),
keras.layers.Dense(7)
],‘mnistnet’)

I checked my model compatibility. i quantize and convert the model into akida. I add fully connected layer for edge learning.
But when i try to compile the akida model it shows an error.


ValueError Traceback (most recent call last)
Cell In[19], line 3
1 # Compile Akida model with learning parameters
2 from akida import AkidaUnsupervised
----> 3 akida_model.compile(optimizer=AkidaUnsupervised(num_weights=num_weights,
4 num_classes=num_classes,
5 learning_competition=0.1))
6 akida_model.summary()

ValueError: Only layers receiving binary inputs can be trained.

Can anyone help me to solve the issue.
Thanks

1 Like

Hello @Rashedul,

I am not sure what you mean by “online learning”.
Also, just to be sure you are on the correct path, Akida learning blocks are only for Brainchip hardware. Is it what you expect?

Best,

Louis

Hello @louis,
Thanks for getting back to me.
I was trying to implement the edge learning example given in the Akida edge learning for keyword spotting page. Yes, I am using Brainchip hardware for learning.

I used the MNIST dataset and trained and quantized the model using ‘keras’ and ‘cnn2snn’, as mentioned in the link. For initial training, I used the MNIST 0-6 label dataset and the remaining for edge learning. Unfortunately, when I tried to compile the model before initiating edge learning, I got ‘ValueError: Only layers receiving binary inputs can be trained. ’ I have attached my Jupyter Notebook file for your reference.
MNIST Edge learning

Regards,
Rashedul

Hi @Rashedul
Edge Impulse has not yet supported Edge Learning capabilities for Akida. It is going to be added in the coming weeks.
However, regarding your problem, to fix the issue you need to make sure the last layer is FullyConnected layer. Please refer to the BrainChip documentation for details.

Best regards,
Matt

Hello @mateusz ,
I am a little confused now. I am just trying to implement the example shown in [ Akida edge learning for keyword spotting ]. Instead of downloading a pre-trained model as shown in the example, I am using the MNIST dataset and training it by myself using the MetaTF framework. I tried to follow all the steps shown in the example as well. I quantized the model and replaced the last layer with a fully connected layer as described, but I got the error.

I have a couple of doubts:

1.Can I build my own model and implement edge learning instead of downloading a pre-trained quantized model?
2. As mentioned in the document, I used MetaTF and cnn2snn to train and quantize the model. However, I do not think I have received binary spikes in the last year. How do you quantize your model to produce the appropriate binary spikes?

Regards,
Rashedul

@Rashedul
For these Akida/MetaTF-specific questions, I have to redirect you to BrainChip support. Please contact them. If you don’t get any response, let us know, we will try through other channels.

Best regards,
Matt

@mateusz Thanks. I will let you know.

Regards,
Rashedul

Hello, I am new here.
I guess this discussion is about online learnings.
Can u suggest me where I can start learning coding as a biginner?

@leni
I am also a newbie, but I am not sure which type of coding you want to learn. If you want to learn spiking, I think SnnTorch will be a good place to start. If you want to learn Akida, I would say simply try to implement their example.

Regards,
Rashedul

1 Like

I want to learn programming.
like HTML,Jawa and all.

Which platform must be useful?

@leni
I think you can start from this site.
https://www.w3schools.com/

1 Like

Thank you!
It’s free of cost too!! :smiley:

Hello @mateusz

I tried reaching the support group last week but did not receive any response. Do you have any other suggestions for me?

Regards,
Rashedul

Hi @Rashedul
Sorry for the late response. I will check internally to see how we can help.

Best regards,
Matt