10.3. Exporting Models

This page describes how to take a model out of Model Composer for deployment on a TI MCU, and how to continue in the command line with Tiny ML ModelZoo.

Note

The export options below follow the 1.4.0 guide and were not re-verified against the current web UI. Check the Export page of the live application for the formats it offers.

10.3.1. Export options

Format

Description

CCS project

A Code Composer Studio project that you import and build.

Artifacts only

Compiled model library and headers for use in an existing project.

ONNX model

Float and/or quantized ONNX file for analysis or custom pipelines.

Configuration

YAML file for the command line flow.

10.3.2. Importing a CCS project

  1. Download the exported ZIP.

  2. In Code Composer Studio choose File > Import > CCS Projects and select the archive.

  3. Build and flash.

See CCS Integration Guide.

10.3.3. Using artifacts in an existing project

The compiled model is mod.a with the interface header tvmgen_default.h (as in the command line flow, see Deploying a ModelZoo Run to an SDK Example (Golden-Vector Check)). Add the files to your project, set the include path, add the library to the linker settings and call the model from your code. Use the feature extraction code and test vectors from the same export, because files from different runs do not match.

10.3.4. Continuing in the command line

Use the exported configuration to reproduce or refine the run with Tiny ML ModelZoo 1.5.0:

  1. Install Tiny ML ModelZoo as described in Installation. For quick use, install the wheel (pip install https://software-dl.ti.com/C2000/esd/mcu_ai/wheel/tinyml_modelzoo-1.5.0-py3-none-any.whl). To add or change models, clone https://github.com/TexasInstruments/tinyml-modelzoo and run pip install -e . there.

  2. Copy the exported YAML into a working folder and check it against How to Create a ModelZoo Config YAML. Make sure that dataset.input_data_path points to your dataset, and that training.model_name is a model from Model Zoo Reference. A configuration exported from an older Model Composer version may use names that were removed.

  3. Run it:

cd tinyml-modelzoo
./run_tinyml_modelzoo.sh /path/to/exported_config.yaml

Results are written to ./data/projects/<project_name>/run/<date-time>/<model_name>/. See Understanding the Run Output.

Example of an exported configuration (shape only; the values are from a 1.4.0 example):

common:
  task_type: 'generic_timeseries_classification'
  target_device: 'F28P55'
dataset:
  dataset_name: 'dc_arc_fault_example_dsk'
data_processing_feature_extraction:
  feature_extraction_name: 'FFT1024Input_256Feature_1Frame_Full_Bandwidth'
  variables: 1
training:
  model_name: 'CLS_4k_NPU'
  training_epochs: 30
  batch_size: 256
testing:
  enable: True
compilation:
  enable: True

10.3.5. Export troubleshooting

  • Export is unavailable until training and compilation have finished.

  • If a CCS import fails, check the CCS and SDK versions, or use the artifacts-only export.

  • If the model does not behave on the device, check that the target device matches and compare against the golden vectors. See Common Errors.

10.3.6. Next steps