ARM-software/CMSIS-NN

How to implement a neural network by using CMSIS-NN?

Raise-me-up opened this issue · 4 comments

Is there any tutorial? I am confused about the cmsis-nn transform of nn.lstm, nn.layernorm, nn.prelu etc。

@Raise-me-up thanks for the question. CMSIS-NN is an optimization library that provides optimization for some of the ML operators in TensorFlow Lite for Microcontrollers framework.

https://github.com/ARM-software/CMSIS-NN/tree/main/Examples has some examples to see how one can get started on it.

@felix-johnny Thanks for your reply! I have read your example. However, it is based on Tensorflow lite micro library, and I just want to implement a neural network by using cmsis-nn purely, not the third party library. Are there any other examples?

@Raise-me-up Sorry, there isn't one..CMSIS-NN is not a ML framework(like Tensor Flow Lite for Microcontrollers(TFLM)) but rather an optimization library. It implements int8 optimizations as per TFLM's int8 quantization spec and uses TFLM's reference kernels as fallback when there are operators in a network that are not supported by CMSIS-NN.

If you are starting off with a tflite model, you could potentially extract the hyper parameters and make your own version of interface like in https://github.com/tensorflow/tflite-micro/tree/main/tensorflow/lite/micro/kernels/cmsis_nn . This creates complexity, overhead and the loss scalability and robustness. The upside will be a few kB's of program memory saved.
I hope that helps answer a few thoughts.

@felix-johnny OK! Thanks for your detailed reply!