This is the Arduino® compatible port of the AIfES machine learning framework, developed and maintained by Fraunhofer Institute for Microelectronic Circuits and Systems.

Overview

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) 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 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.

Dual License

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

For private projects or developers of Free Open Source Software (FOSS) under version 3 of the GNU General Public License (GPL), 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 General Public License (GPL), 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:

  • 8-Bit-Microcontroller
  • 16-Bit-Microcontroller
  • 32-Bit-Microcontroller
  • 64-Bit-Microcontroller

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 install the Arduino_CMSIS-DSP library in the Arduino IDE.

Features

Data types and quantization

AIfES supports the following data types: F32: 32 Bit float

We are currently working on Q31 (32 Bit integer) and Q7 (8 Bit integer) support. We will release these features in the near future. Stay tuned!

Neural network types AIfES supports in the current version:

  • Feedforward Neural Network (FNN) inference and training
  • Other network types are in progress (see roadmap)

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

Layer f32
ailayer_dense.h Dense ailayer_dense_f32_default()
ailayer_dense_f32_cmsis()
ailayer_input.h Input ailayer_input_f32_default()
ailayer_relu.h ReLU ailayer_relu_f32_default()
ailayer_sigmoid.h Sigmoid ailayer_sigmoid_f32_default()
ailayer_softmax.h Softmax ailayer_softmax_f32_default()
ailayer_leaky_relu.h Leaky ReLU ailayer_leaky_relu_f32_default()
ailayer_elu.h ELU ailayer_elu_f32_default()
ailayer_tanh.h Tanh ailayer_tanh_f32_default()
ailayer_softsign.h Softsign ailayer_softsign_f32_default()

Training layer

Layer f32
ailayer_dense.h Dense ailayer_dense_f32_default()
ailayer_dense_f32_cmsis()
ailayer_input.h Input ailayer_input_f32_default()
ailayer_relu.h ReLU ailayer_relu_f32_default()
ailayer_sigmoid.h Sigmoid ailayer_sigmoid_f32_default()
ailayer_softmax.h Softmax ailayer_softmax_f32_default()
ailayer_leaky_relu.h Leaky ReLU ailayer_leaky_relu_f32_default()
ailayer_elu.h ELU ailayer_elu_f32_default()
ailayer_tanh.h Tanh ailayer_tanh_f32_default()
ailayer_softsign.h Softsign ailayer_softsign_f32_default()

Loss

Loss f32
ailoss_mse.h Mean Squared Error (MSE) ailoss_mse_f32_default()
ailoss_crossentropy.h Crossentropy ailoss_crossentropy_f32_default()

Optimizer

Optimizer f32
aiopti_sgd.h Stochastic Gradient Descent (SGD) aiopti_sgd_f32_default()
aiopti_adam.h Adam aiopti_adam_f32_default()

Installation

Download the AIfES repository as a ZIP archive and follow these instructions: https://www.arduino.cc/en/guide/libraries

Roadmap

The AIfES team at Fraunhofer IMS is constantly working on new features and network types. The next feature you can look forward to is:

Convolutional Neural Networks (ConvNet)

Soon, classical ConvNets can be executed and trained in AIfES.

Comments
  • Help with inference on Arduino (outputs are 0)

    Help with inference on Arduino (outputs are 0)

    Hi! I have a sequential model from Keras and I'm trying to deploy it to Arduino Uno using AIfES.

    This is my model in Keras:

    Model: "sequential_2"
    _________________________________________________________________
     Layer (type)                Output Shape              Param #   
    =================================================================
     input (Dense)               (None, 10)                510       
                                                                     
     dense_2 (Dense)             (None, 10)                110       
                                                                     
     output (Dense)              (None, 5)                 55        
                                                                     
    =================================================================
    Total params: 675
    Trainable params: 675
    Non-trainable params: 0
    ________________________________________________________________
    

    However, my outputs are 0. Can you check if my configuration in Arduino is correct?

    // Tensor for the input data
      uint16_t input_shape[] = {DATA_COUNT, INPUTS};                      // Definition of the input shape
      aitensor_t input_tensor = AITENSOR_2D_F32(input_shape, input_data); // Creation of the input AIfES tensor with two dimensions and data type F32 (float32)
    
      // Tensor for the output data
      float output_data[DATA_COUNT * OUTPUTS];          // Output data
      uint16_t output_shape[2] = {DATA_COUNT, OUTPUTS}; // Definition of the output shape
      aitensor_t output_tensor = AITENSOR_2D_F32(output_shape, output_data);
    
      // ---------------------------------- Layer definition ---------------------------------------
    
      uint16_t input_layer_shape[] = {1, INPUTS};                                  // Definition of the input layer shape (The 1 must remain here regardless of the number of data sets)
      ailayer_input_f32_t input_layer = AILAYER_INPUT_F32_M(2, input_layer_shape); // Creation of the AIfES input layer
      ailayer_dense_f32_t dense_layer_1 = AILAYER_DENSE_F32_M(NEURONS_1, W0_data, b0_data);
      ailayer_relu_f32_t relu_layer_1 = AILAYER_RELU_F32_M(); // Hidden activation function
      ailayer_dense_f32_t dense_layer_2 = AILAYER_DENSE_F32_M(NEURONS_2, W1_data, b1_data);
      ailayer_relu_f32_t relu_layer_2 = AILAYER_RELU_F32_M(); // Output activation function
      ailayer_dense_f32_t output_layer = AILAYER_DENSE_F32_M(OUTPUTS, W2_data, b2_data);
      ailayer_relu_f32_t relu_output_layer = AILAYER_RELU_F32_M();
    
      ailoss_mse_t mse_loss; // Loss: mean squared error
    
      // --------------------------- Define the structure of the model ----------------------------
    
      aimodel_t model; // AIfES model
      ailayer_t *x;    // Layer object from AIfES, contains the layers
    
      // Passing the layers to the AIfES model
      model.input_layer = ailayer_input_f32_default(&input_layer);
      x = ailayer_dense_f32_default(&dense_layer_1, model.input_layer);
      x = ailayer_relu_f32_default(&relu_layer_1, x);
      x = ailayer_dense_f32_default(&dense_layer_2, x);
      x = ailayer_relu_f32_default(&relu_layer_2, x);
      x = ailayer_dense_f32_default(&output_layer, x);
      model.output_layer = ailayer_relu_f32_default(&relu_output_layer, x);
    
      // Add the loss to the AIfES model
      model.loss = ailoss_mse_f32_default(&mse_loss, model.output_layer);
    
      aialgo_compile_model(&model); // Compile the AIfES model
    
    

    Thank you!!!

    opened by expeon07 4
  • Feature Request: Support for Arduino PortentaH7 Vision and Sound

    Feature Request: Support for Arduino PortentaH7 Vision and Sound

    Really impressed with this Arduino Library so far.

    Any plans for future support for the Portenta Vision Shields?

    I hve some draft examples using Edge Impulse or my own generic ML @rocksetta methods converting from TensorflowJS to TensorflowMicro c header files.

    opened by hpssjellis 3
  • Recurrent NNs

    Recurrent NNs

    Really appreciate the work you guys are doing here. Library is great and a strong alternative to Tensorflow Lite Micro - arguably even better given how easy it is to load and update new weights. Since a lot of sensor data makes sense with time as a dimension, it begs the question though; is there any chance we are getting support for recurrent neural networks? More specifically GRUs and LSTMs.

    Regards.

    opened by andres-ulloa 1
  • Fix bug in aifes_config.h

    Fix bug in aifes_config.h

    Hello,

    While trying to compile AIfES on an STM32 Nucleo-64 board (STM32L476RG), I got the following error, after including the library in my project:

    Description	Resource	Path	Location	Type
    expected identifier or '(' before '=' token	ailoss_crossentropy_default.c	/AIfES_TestBug/AIfES_for_Arduino/src/basic/default/ailoss	line 28	C/C++ Problem
    expected identifier or '(' before '=' token	ailoss_crossentropy_default.c	/AIfES_TestBug/AIfES_for_Arduino/src/basic/default/ailoss	line 52	C/C++ Problem
    expected identifier or '(' before '=' token	aimath_f32_default.c	/AIfES_TestBug/AIfES_for_Arduino/src/basic/default/aimath	line 29	C/C++ Problem
    expected identifier or '(' before '=' token	aimath_f32_default.c	/AIfES_TestBug/AIfES_for_Arduino/src/basic/default/aimath	line 30	C/C++ Problem
    expected identifier or '(' before '=' token	aimath_q31_default.c	/AIfES_TestBug/AIfES_for_Arduino/src/basic/default/aimath	line 28	C/C++ Problem
    expected identifier or '(' before '=' token	aimath_q31_default.c	/AIfES_TestBug/AIfES_for_Arduino/src/basic/default/aimath	line 29	C/C++ Problem
    expected identifier or '(' before '=' token	aimath_q31_default.c	/AIfES_TestBug/AIfES_for_Arduino/src/basic/default/aimath	line 443	C/C++ Problem
    expected identifier or '(' before '=' token	aimath_q7_default.c	/AIfES_TestBug/AIfES_for_Arduino/src/basic/default/aimath	line 28	C/C++ Problem
    expected identifier or '(' before '=' token	aimath_q7_default.c	/AIfES_TestBug/AIfES_for_Arduino/src/basic/default/aimath	line 29	C/C++ Problem
    expected identifier or '(' before '=' token	aimath_q7_default.c	/AIfES_TestBug/AIfES_for_Arduino/src/basic/default/aimath	line 30	C/C++ Problem
    make: *** [AIfES_for_Arduino/src/basic/default/ailoss/subdir.mk:22: AIfES_for_Arduino/src/basic/default/ailoss/ailoss_crossentropy_default.o] Error 1	AIfES_TestBug		 	C/C++ Problem
    make: *** [AIfES_for_Arduino/src/basic/default/aimath/subdir.mk:25: AIfES_for_Arduino/src/basic/default/aimath/aimath_f32_default.o] Error 1	AIfES_TestBug		 	C/C++ Problem
    make: *** [AIfES_for_Arduino/src/basic/default/aimath/subdir.mk:25: AIfES_for_Arduino/src/basic/default/aimath/aimath_q31_default.o] Error 1	AIfES_TestBug		 	C/C++ Problem
    make: *** [AIfES_for_Arduino/src/basic/default/aimath/subdir.mk:25: AIfES_for_Arduino/src/basic/default/aimath/aimath_q7_default.o] Error 1	AIfES_TestBug		 	C/C++ Problem
    make: *** Waiting for unfinished jobs....	AIfES_TestBug		 	C/C++ Problem
    

    Going back to the sources, I found that this is caused by an incomplete macro inside:

    AIfES_for_Arduino/src/aifes_config.h
    line 96:  #define AISTRING_STORAGE_WRAPPER(S) 
    

    Replacing line 96 with:

    #define AISTRING_STORAGE_WRAPPER(S)     const char S[]
    

    seems to fix the problem (which occurs at line 29, 30 of "src/basic/default/aimath/aimath_f32_default.c").

    opened by dnadalini 1
  • BiDirectional networks

    BiDirectional networks

    we would like to try out the AIfES framework to evaluate the execution of a model built with Keras. Can BiDirectional network models from Keras be translated into an implementation that runs, for example, on a Portenta H7?

    opened by droneconnect 1
  • Linear regression training problem

    Linear regression training problem

    Hello, I would like to ask some questions, forgive my English is not good. When I was doing the linear regression training, the value of the Loss function appeared to be fixed at a certain value. For my case, it will always be 14.25. Of course, the trained model did not succeed, and the the predicted value of the model before training is also always 0. But after several failures, I accidentally touched the analog pin during setup(), and then the training was successful. The following is the log of my training model, one succeeded (random seed: 641), the other failed (random seed: 17) Training fail: training_fail.txt

    Training success: training_success.txt

    I think it should be the random seed that caused the initial model weight setting problem. Is my idea correct?

    opened by s1498n089 2
  • Multiclasstraining on PC

    Multiclasstraining on PC

    Hi I want to train a NN for the MNIST dataset on the PC. How can I implement a training of a NN with multiple output neurons. When I am editing the example (link) and change the output layer to 10 neurons the inference of the model stops with an error (Process returned -1073741819 (0xC0000005) execution time : 0.485 s) Are there any changes I need to be especially aware of?

    opened by konegen 11
Releases(2.1.1)
  • 2.1.1(Jan 12, 2022)

  • 2.1.0(Jan 10, 2022)

    Add new features and bugfixes to the Arduino compatible port of the AIfES framework.

    What is new:

    • Add integer quantization support for 8-bit (Q7) and 32-bit (Q31) integers
    • Add AVR controller specific functions to work with data directly from the program memory
    • Extend Arm CMSIS support for Cortex controllers
    • Print output and logs default to the Serial.print() function
    • Refactor configurations
    Source code(tar.gz)
    Source code(zip)
  • 2.0.0(Jul 5, 2021)

Owner
null
This is a product / project developed by a team of Five Members including Mithilesh Ghadge for the Engineering Clinics at Vellore Institute Of Technology

UltrasonicSensorGlasses-for-blind-people This is a product / project developed by a team of Five Members including Mithilesh Ghadge for the Engineerin

Mithilesh Ghadge 2 Oct 14, 2021
Fully Featured Time Circuits Display from Back to the Future

Time Circuits Display This Time Circuits Display has been meticulously reproduced to be as accurate as possible to the one seen in the Delorean Time M

John 64 Dec 29, 2022
CS:APP is an excellent material for learning computer systems and systems programming

CS:APP is an excellent material for learning computer systems and systems programming. However, it is inconvenient to use a virtual machine for self-learners. In this repo, I build a Docker image with most pre-requistes installed and attached all lab materials in it.

Guochao Xie 57 Nov 11, 2022
Resources and forum for the Chinese community, maintained and moderated by CoinSummer & PL.

Awesome Filecoin 请注意:本文中的链接并非全部是官方链接,部分链接是第三方链接,有些甚至是收费链接,请大家注意区分。 1. Website 1.1 浏览器 FilFox - 6Block 团队开发的 Filecoin 浏览器 Filscan - IPFS原力团队开发的 Filecoi

Filecoin 413 Jan 4, 2023
Packages for simulating the Tethys-class Long-Range AUV (LRAUV) from the Monterey Bay Aquarium Research Institute (MBARI).

LRAUV Simulation This repository contains packages for simulating the Tethys-class Long-Range AUV (LRAUV) from the Monterey Bay Aquarium Research Inst

Open Robotics 31 Dec 22, 2022
Additional components for ESP-IDF, maintained by Espressif

Espressif IDF Extra Components This repository aims to store ESP-IDF extra components which have been seperated and uploaded into IDF Component Manage

Espressif Systems 37 Jan 4, 2023
This is the git repository for the FFTW library for computing Fourier transforms (version 3.x), maintained by the FFTW authors.

This is the git repository for the FFTW library for computing Fourier transforms (version 3.x), maintained by the FFTW authors.

FFTW 2.3k Dec 27, 2022
VE482 "Operating System" Coursework @UM-SJTU Joint Institute

VE482 Operating System Coursework Coursework for VE482 Operating System @UM-SJTU Joint Institute Basic Info Professor: Manuel Charlemagne Semester: 20

Kexuan Huang 3 Sep 7, 2022
Celeborn is a Userland API Unhooker that I developed for learning Windows APIs and Syscall implementations

Celeborn is a Userland API Unhooker that I developed for learning Windows APIs and Syscall implementations. It mainly detects and patches hooking instructions in NTDLL.dll file. All PRs are welcome!

Furkan Göksel 101 Nov 11, 2022
Arduino core for GD32 devices, community developed, based on original GigaDevice's core

GD32 Arduino Core (New) This is a Arduino core is based off of the original GigaDevice core that was provided by the company in early June 2021 (see h

null 46 Dec 24, 2022
Professor Terence Parr has taught us how to create a virtual machine Now it is time to pwn virtual machine

My First real world CTF Simple Virtual Machine Challenge description Professor Terence Parr has taught us how to create a virtual machine Now it is ti

null 1 Feb 17, 2022
Hobbyist Operating System targeting x86_64 systems. Includes userspace, Virtual File System, An InitFS (tarfs), Lua port, easy porting, a decent LibC and LibM, and a shell that supports: piping, file redirection, and more.

SynnixOS Epic Hobby OS targeting x86_64 CPUs, it includes some hacked together functionality for most essential OSs although, with interactivity via Q

RaidTheWeb 42 Oct 28, 2022
NDS port of the uxn virtual machine

uxnds Quick and simple port of the uxn virtual machine to the NDS console. By default, uxnds will run /uxn/boot.rom. It also supports reading files fr

Adrian Siekierka 106 Dec 12, 2022
A port of the Uxn virtual machine to the ESP32

Uxn An assembler and emulator for the Uxn stack-machine, written in ANSI C. Build Linux To build the Uxn emulator, you must have SDL2. If you wish to

Maxime ANDRÉ 27 Mar 24, 2022
Port of the uxn virtual machine to Atari computers (800/1200XL)

uxnatr Port of the uxn virtual machine to Atari computers (800/1200XL). This project's objective is to implement an interpreter (and possibly a compil

João Felipe Santos 6 Jan 20, 2022
Arduino firmware for DIY haptic gloves. Officially compatible with LucidVR gloves.

lucidgloves-firmware This repo contains the arduino firmware as well as the STL files for Prototype 3 of the LucidVR glove prototype. This is a finger

null 1.6k Jan 9, 2023
ESP32 S2 C++ host library compatible with arduino, esp-idf.

Info I would like to announce USB host library for esp32 S2 compatible with arduino, esp-idf and PIO (when pio will be updated to most recent esp-idf)

null 17 Nov 15, 2022
Arduino/ESP32 firmware for DIY haptic gloves. Officially compatible with LucidVR gloves.

Arduino/ESP32 firmware for DIY haptic gloves. Officially compatible with LucidVR gloves.

null 1.6k Jan 8, 2023
Arduino-compatible development platform whose primary function is a clock

MakeTime Arduino-compatible development platform whose primary function is a clock Description MakeTime is a clock that uses a ring of 24 RGB LEDs to

null 3 Oct 11, 2021