Home

Awesome

Docs

AIfES for Arduino®

AIfES (Artificial Intelligence for Embedded Systems) is a platform-independent and standalone AI software framework optimized for embedded systems. The Feedforward Neural Networks (FNN) and Convolutional Neural Networks (CNN) implemented in AIfES can be freely parameterized, trained, modified or reloaded at runtime. In this version, it is optimized for the Arduino IDE and compatible to almost any Arduino board. AIfES is developed in the C programming language and uses only standard libraries based on the GNU Compiler Collection (GCC). AIfES thus runs on almost any hardware from 8-bit microcontrollers over Raspberry PI to smartphones or PCs. Not only inference of FNN and CNN is possible, but also training directly in the device. Furthermore, compatibility to other AI software frameworks such as Keras or TensorFlow is also given.

AIfES was developed by the Fraunhofer Institute for Microelectronic Circuits and Systems IMS. Additional information can be found at <www.aifes.ai>

The Fraunhofer IMS with AIfES and Arduino preapare to enter a partnership.

We are also at the Arduino Project Hub. Here you can find our new AIfES projects and examples: https://create.arduino.cc/projecthub/aifes_team

Follow us on LinkedIn to get all the latest news about AIfES: https://www.linkedin.com/showcase/aifes-ai

Dual License

For Maker and Open-Source-Projects (GNU AGPLv3):

For private projects or developers of Free Open Source Software (FOSS) under version 3 of the GNU Affero General Public License (AGPL), the AIfES version offered here can be used free of charge.

For use in commercial applications:

If AIfES is to be combined and distributed with commercially licensed software and/or if you do not wish to distribute the AIfES source code for the commercially licensed software under version 3 of the GNU Affero General Public License (AGPL), you must conclude a license agreement with Fraunhofer IMS. For more information and contact, refer to our homepage

Compatibility

AIfES in the current version supports almost all microcontroller types and Arduino boards:

Installation guides for various IDEs

We have already put the first guides to integrate AIfES in various IDEs in our GitHub repository which you can find here.

Guides for the following IDEs are available by now:

You can help us by downloading the *.docx template and write a manual for your favourite IDE. Send it as a PDF to aifes(at)ims.fraunhofer.de

Wokwi - Online Arduino and ESP32 Simulator

If you don't have any hardware available, you can also test some AIfES examples in Wokwi. The simulation is slower, of course. Here are a few examples:

ARM CMSIS

AIfES also supports the Cortex Microcontroller Software Interface Standard (CMSIS) of the ARM Cortex controllers. This standard can speed up inference and training for large FNNs. Please read the README.md in https://github.com/Fraunhofer-IMS/AIfES_for_Arduino/tree/main/src/CMSIS for more information on how to add the CMSIS library.

Python

To get you startet we developed the AIfES-Converter. It can export your FNN from Python and create the suitable AIfES code. Furthermore, it helps you with the quantization of your neural network. You can install it via pip with:

pip install AIfES-Converter

The quantization can also be done manually by using the provided Python tools in this repository. You can install them via pip with:

pip install https://github.com/Fraunhofer-IMS/AIfES_for_Arduino/raw/main/etc/python/aifes_tools.zip

Please read the README.md in https://github.com/Fraunhofer-IMS/AIfES_for_Arduino/tree/main/etc/python for more information on the AIfES pytools.

We also created some examples to show you how a tf.Keras and a PyTorch neural network can be quantized for AIfES, using the pytools https://github.com/Fraunhofer-IMS/AIfES_for_Arduino/tree/main/etc/python/examples.

Features

Have a look at our documentation for a detailed overview of the provided features with code examples.

Data types and quantization

AIfES supports the following data types:

Neural network types AIfES supports in the current version:

The number of neurons and the number of different layers can be adapted individually. Inference and training can be performed on the controller.

Inference layer

Layerf32q31q7
Denseailayer_dense_f32_default()<br>ailayer_dense_f32_cmsis()<br>ailayer_dense_f32_avr_pgm()ailayer_dense_q31_default()ailayer_dense_q7_default()<br>ailayer_dense_wt_q7_default()<br>ailayer_dense_wt_q7_cmsis()<br>ailayer_dense_q7_avr_pgm()<br>ailayer_dense_wt_q7_avr_pgm()
Inputailayer_input_f32_default()ailayer_input_q31_default()ailayer_input_q7_default()
ReLUailayer_relu_f32_default()ailayer_relu_q31_default()ailayer_relu_q7_default()<br>ailayer_relu_q7_avr_pgm()
Sigmoidailayer_sigmoid_f32_default()ailayer_sigmoid_q31_default()ailayer_sigmoid_q7_default()<br>ailayer_sigmoid_q7_avr_pgm()
Softmaxailayer_softmax_f32_default()ailayer_softmax_q31_default()ailayer_softmax_q7_default()<br>ailayer_softmax_q7_avr_pgm()
Leaky ReLUailayer_leaky_relu_f32_default()ailayer_leaky_relu_q31_default()ailayer_leaky_relu_q7_default()<br>ailayer_leaky_relu_q7_avr_pgm()
ELUailayer_elu_f32_default()ailayer_elu_q31_default()ailayer_elu_q7_default()<br>ailayer_elu_q7_avr_pgm()
Tanhailayer_tanh_f32_default()ailayer_tanh_q31_default()ailayer_tanh_q7_default()<br>ailayer_tanh_q7_avr_pgm()
Softsignailayer_softsign_f32_default()ailayer_softsign_q31_default()ailayer_softsign_q7_default()<br>ailayer_softsign_q7_avr_pgm()
Conv2Dailayer_conv2d_f32_default()
Batch Normalizationailayer_batch_norm_f32_default()
MaxPool2Dailayer_maxpool2d_f32_default()
Reshapeailayer_reshape_f32_default()
Flattenailayer_flatten_f32_default()

Training layer

Layerf32q31q7
Denseailayer_dense_f32_default()<br>ailayer_dense_f32_cmsis()<br>ailayer_dense_f32_avr_pgm()ailayer_dense_q31_default()
Inputailayer_input_f32_default()ailayer_input_q31_default()ailayer_input_q7_default()
ReLUailayer_relu_f32_default()ailayer_relu_q31_default()ailayer_relu_q7_default()
Sigmoidailayer_sigmoid_f32_default()ailayer_sigmoid_q31_default()
Softmaxailayer_softmax_f32_default()ailayer_softmax_q31_default()
Leaky ReLUailayer_leaky_relu_f32_default()ailayer_leaky_relu_q31_default()
ELUailayer_elu_f32_default()ailayer_elu_q31_default()
Tanhailayer_tanh_f32_default()ailayer_tanh_q31_default()
Softsignailayer_softsign_f32_default()ailayer_softsign_q31_default()
Conv2Dailayer_conv2d_f32_default()
Batch Normalizationailayer_batch_norm_f32_default()
MaxPool2Dailayer_maxpool2d_f32_default()
Reshapeailayer_reshape_f32_default()
Flattenailayer_flatten_f32_default()

Loss:

Lossf32q31q7
Mean Squared Error (MSE)ailoss_mse_f32_default()ailoss_mse_q31_default()
Crossentropyailoss_crossentropy_f32_default()<br>ailoss_crossentropy_sparse8_f32_default()

Optimizer:

Optimizerf32q31q7
Stochastic Gradient Descent (SGD)aiopti_sgd_f32_default()aiopti_sgd_q31_default()
Adamaiopti_adam_f32_default()

Installation

You can download and install AIfES® (search for "aifes") with the Arduino library manager. https://www.arduino.cc/en/guide/libraries

Alternatively, the manual download is also possible: Download the AIfES repository as a ZIP archive and follow these instructions: https://www.arduino.cc/en/guide/libraries

Citation

If you use this software in your work please cite it.

For your scientific work you can cite the following paper:

Plain Text:

L. Wulfert et al., "AIfES: A Next-Generation Edge AI Framework," in IEEE Transactions on Pattern Analysis and Machine Intelligence, doi: 10.1109/TPAMI.2024.3355495.
keywords: {Training;Data models;Artificial intelligence;Support vector machines;Hardware acceleration;Libraries;Performance evaluation;Machine Learning Framework;Edge AI Framework;On-Device Training;Embedded Systems;Resource-Constrained Devices;TinyML}

BibTex:

@ARTICLE{10403985,
  author={Wulfert, Lars and Kühnel, Johannes and Krupp, Lukas and Viga, Justus and Wiede, Christian and Gembaczka, Pierre and Grabmaier, Anton},
  journal={IEEE Transactions on Pattern Analysis and Machine Intelligence}, 
  title={AIfES: A Next-Generation Edge AI Framework}, 
  year={2024},
  volume={},
  number={},
  pages={1-16},
  keywords={Training;Data models;Artificial intelligence;Support vector machines;Hardware acceleration;Libraries;Performance evaluation;Machine Learning Framework;Edge AI Framework;On-Device Training;Embedded Systems;Resource-Constrained Devices;TinyML},
  doi={10.1109/TPAMI.2024.3355495}}

Roadmap

The AIfES team at Fraunhofer IMS is constantly working on new features and network types.