11. Bring Your Own Model

This section explains how to use your own neural network with Tiny ML ModelZoo 1.5.0. There are two approaches.

Add a custom model to the ModelZoo

Create a new architecture that plugs into the full pipeline (training, quantization, compilation). You add a model class and a model description, then point a config YAML at it. Follow the step-by-step guide.

Bring Your Own Model (BYOM)
Compile an existing ONNX model

You already have a trained model from another framework. Skip the dataset and training steps and compile the ONNX file for a TI device.

Compilation Only

11.1. Contents

11.2. Which approach do I need?

  • Use the ModelZoo approach when you want ModelMaker to train, quantize and test the model with your dataset, or when you want the model to show up with the other ModelZoo models.

  • Use compilation only when the model is already trained (and, for NPU devices, already quantized) and you only need the compiled library for the device.

Important

Adding a model to the ModelZoo edits files in the tinyml-modelzoo source tree, so it needs the clone install (pip install -e .). See Clone Installation. Compile-only needs just the normal install (Wheel Installation).

11.3. Model requirements

NPU devices (for example F28P55): models have to follow the NPU rules to be accelerated, such as channel counts that are multiples of 4 and limits on kernel sizes. The full list is in NPU Configuration Guidelines for TI Neural Network Compiler. Layers that do not meet the rules fall back to the CPU.

Non-NPU devices: the architecture is more flexible, but keep the total parameter count within the device memory, and use layers the compiler supports. You can check the memory footprint before training with Memory Estimation.