Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Open Neural Network Exchange to C compiler.
| Date | Stars |
|---|---|
| 2026-07-31 | 403 |
| 2026-08-02 | 403 |
| 2026-08-04 | 404 |
| 2026-08-05 | 406 |
| 2026-08-06 | 406 |
Today
— stars today
This week
— stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.00%/day
onnx2c ====== Onnx2c is a [ONNX](https://onnx.ai) to C compiler. It will read an ONNX file, and generate C code to be included in your project. Onnx2c's target is "Tiny ML", meaning running the inference on microcontrollers. To make this easier, the generated code: - Does not `#include <stdio.h>` (i.e. no `printf()`s) - Compile-time allocates buffers. Does not use dynamic memory allocation or (much) stack memory - Has no library requirements except standard C maths library. (Floating point hardware recommended!) - Should be compiler-friendly allowing the C compiler optimize the output as well as it can - Is contained in one single C file for easier project management The idea behind onnx2c is to be an easy-to-use tool with no learning curve. If you can export your trained neural network to an ONNX file (e.g. PyTorch and Tensorflow both can) and you have a working microcontroller project, then joining the two with onnx2c should be easy. To make all of the above easier to achieve, there are some non-goals for onnx2c: - ONNX specification coverage. (For now, 91 out of 166 ONNX Operands are at least partially implemented). - accelerators - backpropagation (i.e. training) Building -------- Make sure you have ProtocolBuffers libraries installed, e.g.: - Ubuntu: `apt install libprotobuf-dev protobuf-compiler` - MacOS: `brew install protobuf` Get the sources: ``` git clone https://github.com/kraiskil/onnx2c.git cd onnx2c git submodule update --init ``` then run a standard CMake build ``` mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release .. make onnx2c ``` ### FAQ #### Getting `error: ‘class onnx::ModelProto’ has no member named ‘ParseFromIstream’;` ? If you have ProtoBuf 3.6 or earlier, you need the following modification to `onnx/onnx/onnx.proto` - remove the last lines (i.e. option `optimize_for = LITE_RUNTIME;`) With ProtoBuf 3.12 (e.g. Ubuntu 20.10 onwards) this modification is not needed. Versions between 3.6 and 3.12 are uninvestigated. #### Seeing build error `void* __builtin_memset ... is out of the bounds ...` ? On (at least) protobuf 3.6, which ships as default on Ubuntu 20.04, the build fails when onnx2c is build in `Release` mode. Change the buildstep above to `cmake -DCMAKE_BUILD_TYPE=Debug ..` Or update your protobuf. See kraiskil/onnx2c#39 and onnx/onnx#4756. Usage ----- The build creates `onnx2c` binary. Run `./onnx2c [your ONNX model file] > model.c` At the end of the `model.c` there is a function called 'void entry(...)'. Call that from your main program to run inference. Function parameters are named as in your ONNX model. Using the compiler `-ffast-math` (or equivalent) when compiling onnx2c-generated code increases computation speed. See the [GCC wiki on floating point maths](https://gcc.gnu.org/wiki/FloatingPointMath) for details. Onnx2c has a few optimization passes that modify the generated output: - Tensor unionization to wrap intermediate tensors in unions to help the compiler re-use the heap memory. - Removing `Cast` nodes, by modifying their predecessor node's output tensor. - Optimization for AVR processors to put constants into instruction memory. Floating-point output precision can be configured with `--precision N`. If omitted, onnx2c uses a precision of `20`. `./onnx2c -h` prints out all available command line options. onnx2c prints a log on stdout. Log level can be given with the `-l N` command line option. Logging levels are - 0 Fatal errors only - 1 Warnings where onnx2c might not be correctly implemented - 2 Generic info (default level in the Release build) - 3 Debug: high level trace of what onnx2c does useful debugging the model - 4 Trace: detailed info useful for debugging onnx2c There is a [helper script](scripts/) to initially run any `.onnx` on a MCU development board. This is intended as a tool when designing the network to see if it will fit the target, before starting training the network. See the script sources and [the onnx2c developm
Excerpt of 7,682 characters
Read on GitHubWould you bet a product on this? Bounded 0–100 and slow moving.
matched fp:d7980cb5bdcf03fa, llm:Description and topics: 'Open Neural Network Exchange to C compiler', targets Tiny ML/microcontrollers; topics include machine-learning, microcontroller, neural-network, onnx, edge-computing; README explains ONNX to C code generation for inference on microcontrollers.
matched fp:d7980cb5bdcf03fa, llm:Description and topics: 'Open Neural Network Exchange to C compiler', targets Tiny ML/microcontrollers; topics include machine-learning, microcontroller, neural-network, onnx, edge-computing; README explains ONNX to C code generation for inference on microcontrollers.
matched fp:d7980cb5bdcf03fa, llm:Description and topics: 'Open Neural Network Exchange to C compiler', targets Tiny ML/microcontrollers; topics include machine-learning, microcontroller, neural-network, onnx, edge-computing; README explains ONNX to C code generation for inference on microcontrollers.