3.4. Running Examples

This guide explains how to find, understand, and run the example configurations included with Tiny ML Tensorlab.

3.4.1. Finding Examples

Examples are located in two places:

  1. tinyml-modelzoo/examples/ - Primary location, recommended entry point

  2. tinyml-modelmaker/examples/ - Additional examples

List available examples:

ls tinyml-modelzoo/examples/

# Output:
# ac_arc_fault/
# blower_imbalance/
# dc_arc_fault/
# ecg_arrhythmia/
# ecg_classification/
# fan_fault/
# grid_stability/
# generic_timeseries_classification/
# hvac_temp_forecast/
# motor_bearing_fault/
# motor_speed_regression/
# pmsm_temp_forecast/
# ...

3.4.2. Running an Example

Basic Command:

cd tinyml-modelzoo
./run_tinyml_modelzoo.sh examples/<example_name>/config.yaml

Examples:

# Hello World (simplest)
./run_tinyml_modelzoo.sh examples/generic_timeseries_classification/config.yaml

# DC Arc Fault Detection
./run_tinyml_modelzoo.sh examples/dc_arc_fault/config.yaml

# Motor Bearing Fault Classification
./run_tinyml_modelzoo.sh examples/motor_bearing_fault/config.yaml

# PMSM Temperature Forecasting
./run_tinyml_modelzoo.sh examples/pmsm_temp_forecast/config.yaml

3.4.3. Example Directory Structure

Each example folder typically contains:

example_name/
├── config.yaml          # Main configuration
├── config_device2.yaml  # Alternative device config (optional)
└── readme.md            # Example-specific documentation (optional)

3.4.4. Understanding Example Configs

Most examples have a similar structure. Here’s how to read them:

1. Identify the Task Type

common:
  task_type: 'generic_timeseries_classification'  # or regression, etc.

2. Check the Dataset

dataset:
  dataset_name: 'dc_arc_fault_example_dsk'
  # URL means data will be downloaded automatically
  input_data_path: 'https://software-dl.ti.com/...'

3. Review Feature Extraction

data_processing_feature_extraction:
  feature_extraction_name: 'FFT1024Input_256Feature_1Frame_Full_Bandwidth'
  variables: 1  # Number of input channels

4. Check the Model

training:
  model_name: 'ArcFault_model_200_t'  # Model architecture
  training_epochs: 20

5. Verify Target Device

common:
  target_device: 'F28P55'  # Which MCU to compile for

3.4.5. Customizing Examples

Change Target Device:

common:
  target_device: 'MSPM0G3507'  # Change to your device

Use a Different Model:

training:
  model_name: 'CLS_4k_NPU'  # Try a different model size

Disable Compilation (for faster iteration):

compilation:
  enable: False

Train Longer:

training:
  training_epochs: 50  # Increase from default

3.4.6. Output Location

All outputs go to:

../tinyml-modelmaker/data/projects/<dataset_name>/run/<run_name>/

For example, running dc_arc_fault example produces:

../tinyml-modelmaker/data/projects/dc_arc_fault_example_dsk/run/2024-01-15_14-30-00/ArcFault_model_200_t/

3.4.7. Example Categories

Classification Examples:

  • generic_timeseries_classification - Waveform classification (beginner)

  • dc_arc_fault - DC arc fault detection

  • ac_arc_fault - AC arc fault detection

  • motor_bearing_fault - 6-class bearing fault

  • fan_fault - Fan blade fault detection

  • ecg_classification - ECG arrhythmia detection

  • grid_stability - Power grid stability

Regression Examples:

  • motor_speed_regression - Predict motor speed

  • torque_measurement - Predict motor torque

Forecasting Examples:

  • pmsm_temp_forecast - PMSM rotor temperature

  • hvac_temp_forecast - Indoor temperature prediction

Anomaly Detection Examples:

  • dc_arc_fault_ad - Arc fault using autoencoder

  • ecg_anomaly - ECG anomaly detection

  • motor_bearing_ad - Bearing anomaly

3.4.8. Running Multiple Examples

Create a script to run multiple examples:

#!/bin/bash
# run_all_examples.sh

examples=(
  "generic_timeseries_classification"
  "dc_arc_fault"
  "motor_bearing_fault"
)

for example in "${examples[@]}"; do
  echo "Running $example..."
  ./run_tinyml_modelzoo.sh examples/$example/config.yaml
done

3.4.9. Troubleshooting Examples

“Dataset download failed”

Check your internet connection. Try downloading manually:

wget <dataset_url> -O dataset.zip
unzip dataset.zip

Then update config with local path:

dataset:
  input_data_path: '/path/to/extracted/dataset'

“Out of memory”

Reduce batch size:

training:
  batch_size: 64  # Reduce from 256

“Compilation failed”

Check environment variables are set correctly. Or skip compilation for now:

compilation:
  enable: False

3.4.10. Next Steps