Diwa
Lightweight implementation of Artificial Neural Network for resource-constrained environments
|
Diwa is a lightweight library providing a simple implementation of Feedforward Artificial Neural Networks (ANNs) for microcontrollers such as ESP32, ESP8266, RP2040, and similar development boards (specially boards with PSRAM); it is also compatible for desktop environments (Windows, MacOS, and Linux-based OSes), WebAssembly, and even PSP gaming consoles. It is designed for resource-constrained environments but can be used with non-Arduino platform projects, offering a streamlined solution for tasks that require neural network capabilities.
Diwa stands out as a straightforward and effective solution for implementing artificial neural networks on microcontrollers. Key features include:
Diwa is primarily intended for lightweight applications. For more intricate tasks, consider using advanced machine learning libraries on more powerful platforms.
See live demo on Wokwi.
Diwa are tested on the following architecture/platform:
Arch/Platform | Remarks |
---|---|
✅ ESP32-WROOM ✅ ESP32-WROVER | NodeMCU DevKit (Automatically using PSRAM available) |
✅ ESP8266 | Wokwi Emulation |
✅ RP2040 | Raspberry Pi Pico (RP2040) |
🔼 PSP | PPSSPP Emulator (Diwa::loadFromFile and Diwa::saveToFile not yet supported) |
✅ Desktop Environments | Works perfectly on Windows, MacOS, and Linux. |
✅ WebAssembly (WASM) | Tested via Emscripten |
To start using Diwa library in your Arduino projects, follow these simple steps:
diwa
and click "Install."Alternatively, you can follow the steps below:
Documents\Arduino\libraries\
~/Documents/Arduino/libraries/
~/Arduino/libraries/
Using Diwa on C++ projects might be quite different depending on what build tools you are using.
lib
folder.To do this, your project must be a git repository.
lib/diwa/src
folder on your project's Makefile
.*.cpp
files on the build source files.[!NOTE] Alternatively, you can download the
*.deb
file from the release page to install Diwa as a shared library on Debian-based operating systems.
Same on every C++ projects, depending on your build process, this might be quite different on some instances.
--std=c++17
on the compiler arguments.src
folder on the include arguments.*.cpp
files from the src
folder on compilation.Or you can check the examples/psp_xor/build.bat for reference.
To access the examples:
File > Examples > diwa
to see the list of available examples.Here's a full example usage for an Arduino environment.
Contributions and feedback are all welcome to enhance this library. If you encounter any issues, have suggestions for improvements, or would like to contribute code, please do so.
Copyright 2023 - Nathanne Isip
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.