https://github.com/rucksikaar/color_initial_letter_recognition
Recognize handwritten letters with Neuton TinyML. This repository contains the C library (TinyML model) and the Arduino sketch file that can be used to embed the model in your microcontroller.
https://github.com/rucksikaar/color_initial_letter_recognition
arduino c tinyml
Last synced: 29 days ago
JSON representation
Recognize handwritten letters with Neuton TinyML. This repository contains the C library (TinyML model) and the Arduino sketch file that can be used to embed the model in your microcontroller.
- Host: GitHub
- URL: https://github.com/rucksikaar/color_initial_letter_recognition
- Owner: RucksikaaR
- License: mit
- Created: 2023-11-29T12:15:04.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-29T12:15:49.000Z (over 2 years ago)
- Last Synced: 2025-03-16T14:22:52.343Z (about 1 year ago)
- Topics: arduino, c, tinyml
- Language: C
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# How to integrate Neuton into your firmware project
## Include header file
Copy all files from this archive to your project and include header file:
``` C
#include "neuton.h"
```
The library contains functions to get model information such as:
* task type (regression, classification, etc.);
* neurons and weights count;
* window buffer size;
* input and output features count;
* model size and RAM usage;
* float support flag;
* quantization level.
Main functions are:
* `neuton_model_set_inputs` - to set input values;
* `neuton_model_run_inference` - to make predictions.
## Set input values
Make an array with model inputs. Inputs count and order should be the same as in the training dataset.
``` C
input_t inputs[] = {
feature_0,
feature_1,
// ...
feature_N
};
```
Pass this array to `neuton_model_set_inputs` function.
If digital signal processing option was selected on the platform, you should call `neuton_model_set_inputs` multiple times for each sample to fill internal window buffer. Function will return `0` when buffer is full, this indicates that model is ready for prediction.
## Make prediction
When buffer is ready, you should call `neuton_model_run_inference` with two arguments:
* pointer to `index` of predicted class;
* pointer to neural net `outputs` (dimension of array can be read using `neuton_model_outputs_count` function).
For regression task output value will be stored at `outputs[0]`.
For classification task `index` will contain class index with maximal probability, `outputs` will contain probabilities of each class. Thus, you can get predicted class probability at `outputs[index]`.
Function will return `0` on successful prediction.
``` C
if (neuton_model_set_inputs(inputs) == 0)
{
uint16_t index;
float* outputs;
if (neuton_model_run_inference(&index, &outputs) == 0)
{
// code for handling prediction result
}
}
```
## Map predicted results on the required values (for Classification task type)
Inference results are encoded (0…n). For mapping on your classes, use dictionaries `binary_target_dict_csv.csv / multi_target_dict_csv.csv`.
## Integration with Tensorflow, ONNX
Neuton also offers additional options of integration and interaction with your model.
This archive provides you with Tensorflow and ONNX formats of the model.
You can find them in `converted_models` folder.