How ssthurai/tinyml works
Main Components
• Projects: Clearly mark three separate projects (MCUNet, NetAug, TinyTL). (Even though MCUNet appears as its own folder, the file tree details for NetAug and TinyTL are more elaborate; nonetheless, they all are part of the overall TinyML initiative.)
• Experiment/Training Pipelines:
– For NetAug, modules like train.py, eval.py, and a suite of bash scripts (located in netaug/bash) are responsible for triggering training and evaluation tasks.
– For TinyTL, look at tinytl_fgvc_train.py, the experiment scripts (under tinytl/exp_scripts) and dataset setup scripts (tinytl/dataset_setup_scripts).
• Configuration and Setup:
– NetAug makes use of configuration files (e.g., netaug/configs/default.yaml and netaug/configs/netaug.yaml) to standardize experiments.
– TinyTL uses dataset setup scripts for initializing and managing datasets.
• Model Architectures:
– In NetAug, models are defined in two subdirectories: “models/base” (baseline architectures) and “models/netaug” (augmented modifications). In TinyTL, the core neural network and module definitions reside in tinytl/tinytl/model.
• Utility and Support Modules:
– Shared utilities such as learning rate schedulers, distributed training utilities, and evaluation metrics are found under netaug/utils and tinytl’s utils.
• Data Handling:
– In TinyTL, there is a dedicated “data_providers” module to handle dataset-specific configurations and processing.
Relationships and Flows
• Model & Utility Interaction: Illustrate how training scripts rely on the “models” for network architecture and “utils” for tasks like learning rate scheduling, distributed computing support, and metric evaluation.
• Data Pipeline: For TinyTL, indicate how the “data_providers” module fetches and preprocesses data, feeding it to model training and evaluation components.
• Modular Design: Emphasize the separation of concerns by showing that each project segment (NetAug and TinyTL) has its own dedicated configuration, experiment scripts, models, and utilities, though they might share common design principles inherent to TinyML (e.g., memory-efficiency, modularity).
Architectural Patterns and Design Principles
– Top Layer: Experiment orchestration (bash scripts, training scripts)
– Middle Layer: Model definitions (base networks versus augmented models) and configuration management.
– Bottom Layer: Utility modules (data handling, evaluation, distributed support) and any lower-level hardware abstraction.
• Modularity & Separation of Concerns: Indicate how each project branch encapsulates its functionality while serving the common goal of efficient on-device learning.
• Extensibility: Identify extension points (such as “models/netaug/utils.py” or “tinytl/tinytl/data_providers”) where further methods or modules might be added for new TinyML tasks.
Final Assembly
• Branch down to represent each project (NetAug, TinyTL, MCUNet) in separate sections, with internal structures showing experiment scripts, configuration management, model architectures, and supporting utilities.