Skip to content

Commit b925786

Browse files
Squashed 'tinyml-modelzoo/' changes from 7a936b55..c4c185f2
c4c185f2 fixed broken links REVERT: 7a936b55 TINYML_ALGO-706 git-subtree-dir: tinyml-modelzoo git-subtree-split: c4c185f2a8fe0f5323ec5af635d73414547f7d1c
1 parent e47fe15 commit b925786

18 files changed

Lines changed: 628 additions & 19 deletions

File tree

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,6 @@ xcuserdata/
5050
data/
5151
!data/datasets/readme.txt
5252
!data/checkpoints/readme.txt
53-
!data/downloads/readme.txt
53+
!data/downloads/readme.txt
54+
# Added by code-review-graph
55+
.code-review-graph/

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@ These applications are designed for specific use cases with optimized models and
260260
| **ac_arc_fault** | arc_fault | F280013, F280015, F28003, F28004, F2837, F28P55, F28P65, MSPM0G3507, MSPM0G3519, MSPM0G5187, MSPM33C32, F29H85, AM13E2, AM263 | Detect AC arc faults in electrical systems |
261261
| **dc_arc_fault** | arc_fault | F280013, F280015, F28003, F28004, F2837, F28P55, F28P65, MSPM0G3507, MSPM0G3519, MSPM0G5187, MSPM33C32, F29H85, AM13E2, AM263 | Detect DC arc faults from current waveforms for electrical safety |
262262
| **ecg_classification** | ecg_classification | MSPM0G3507, MSPM0G5187, MSPM0G3519 | Classify normal vs anomalous heartbeats from ECG signals |
263-
| **gearbox_fault_detection** | gearbox_fault | MSPM0G3507, MSPM0G3519, MSPM0G5187 | Classify gearbox operating conditions (healthy vs broken tooth) from vibration data |
263+
| **fall_detection_classification** | classification | MSPM0G5187 | Detect and classify Human Fall vs Activities of Daily Living (ADL) |
264+
| **gearbox_fault_detection** | classification | MSPM0G3507, MSPM0G3519, MSPM0G5187 | Classify gearbox operating conditions (healthy vs broken tooth) from vibration data |
264265
| **blower_imbalance** | motor_fault | F280013, F280015, F28003, F28004, F2837, F28P55, F28P65, MSPM0G3507, MSPM0G3519, MSPM0G5187, MSPM33C32, F29H85, AM13E2, AM263 | Detect blade imbalance in HVAC blowers using 3-phase motor currents |
265266
| **fan_blade_fault_classification** | motor_fault | F280013, F280015, F28003, F28004, F2837, F28P55, F28P65, MSPM0G3507, MSPM0G3519, MSPM0G5187, MSPM33C32, F29H85, AM13E2, AM263, CC1312, CC1314, CC1352, CC1354, CC2755, CC35X1 | Detect faults in BLDC fans from accelerometer data |
266267
| **motor_bearing_fault** | motor_fault | F280013, F280015, F28003, F28004, F2837, F28P55, F28P65, MSPM0G3507, MSPM0G3519, MSPM0G5187, MSPM33C32, F29H85, AM13E2, AM263 | Classify 5 bearing fault types + normal operation from vibration data |
@@ -275,7 +276,7 @@ These applications are designed for specific use cases with optimized models and
275276
- Regression: 5 examples (1 base + 4 real-world applications)
276277
- Forecasting: 3 examples (1 base + 2 real-world applications)
277278
- Anomaly Detection: 6 examples (1 base + 5 application variants)
278-
- **Application-Specific Tasks** (11 examples): arc_fault (2), motor_fault (3), grid_fault_detection (1), gearbox_fault_detection (1), mosfet_temp_prediction (1), pir_detection (1), ecg_classification (1), image_classification (1)
279+
- **Application-Specific Tasks** (12 examples): arc_fault (2), motor_fault (3), grid_fault_detection (1), gearbox_fault_detection (1), mosfet_temp_prediction (1), pir_detection (1), ecg_classification (1), image_classification (1), fall_detection_classification (1)
279280

280281
---
281282

@@ -290,7 +291,7 @@ These applications are designed for specific use cases with optimized models and
290291
| 3 | [motor_bearing_fault](examples/motor_bearing_fault/) | Multivariate | Classify 5 bearing fault types + normal operation from vibration data. |
291292
| 4 | [blower_imbalance](examples/blower_imbalance/) | Multivariate | Detect blade imbalance in HVAC blowers using 3-phase motor currents. |
292293
| 5 | [fan_blade_fault_classification](examples/fan_blade_fault_classification/) | Multivariate | Detect faults in BLDC fans from accelerometer data. |
293-
| 6 | [gearbox_fault_detection](examples/gearbox_fault_detection/) | Multivariate | Classify gearbox operating conditions (healthy vs broken tooth) from vibration. |
294+
| 6 | [gearbox_fault_detection](examples/gearbox_fault_detection/) | Multivariate | Classify gearbox operating conditions (healthy vs broken tooth) from vibration. |
294295
| 7 | [electrical_fault](examples/electrical_fault/) | Multivariate | Classify transmission line faults using voltage and current (2-class and 6-class variants). |
295296
| 8 | [grid_stability](examples/grid_stability/) | Multivariate | Predict power grid stability from node parameters. |
296297
| 9 | [gas_sensor](examples/gas_sensor/) | Multivariate | Identify gas type and concentration from sensor array data. |
@@ -299,6 +300,7 @@ These applications are designed for specific use cases with optimized models and
299300
| 12 | [nilm_appliance_usage_classification](examples/nilm_appliance_usage_classification/) | Multivariate | Non-Intrusive Load Monitoring - identify active appliances. |
300301
| 13 | [PLAID_nilm_classification](examples/PLAID_nilm_classification/) | Multivariate | Appliance identification using the PLAID dataset. |
301302
| 14 | [pir_detection](examples/pir_detection/) | Multivariate | Detect presence/motion using PIR sensor data. |
303+
| 15 | [fall_detection_classification](examples/fall_detection_classification/) | Multivariate | Detect and classify Human Fall vs Activities of Daily Living (ADL). |
302304

303305
### Regression Examples
304306

@@ -469,9 +471,7 @@ Key steps:
469471

470472
- [TI's Neural Network Compiler Documentation](https://software-dl.ti.com/mctools/nnc/mcu/users_guide/)
471473
- [NPU Configuration Guidelines](docs/NPU_CONFIGURATION_GUIDELINES.md) - Design models optimized for TI NPU acceleration
472-
- [Edge AI Studio Model Composer](https://dev.ti.com/modelcomposer/) - No-code GUI for model development
473-
- [Understanding the Config File](../tinyml-modelmaker/docs/UnderstandingConfigFile.md)
474-
- [Dataset Format Guide](../tinyml-modelmaker/docs/DatasetFormat_Timeseries_Classification.md)
474+
- [Edge AI Studio for MCUs](https://www.ti.com/tool/download/EDGE-AI-STUDIO-MCU/) - No-code GUI for data collection & model development
475475

476476
---
477477

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
common:
2+
target_module: vision
3+
task_type: image_classification
4+
target_device: MSPM0G5187
5+
dataset:
6+
dataset_name: coffee_bean_classification
7+
input_data_path: https://software-dl.ti.com/C2000/esd/mcu_ai/01_04_00/datasets/coffee_bean_classification.zip
8+
data_processing_feature_extraction:
9+
feature_extraction_name: CoffeeBean_Default
10+
training:
11+
model_name: MobileNetV1_58k_NPU
12+
batch_size: 64
13+
training_epochs: 30
14+
num_gpus: 0
15+
quantization: 2
16+
learning_rate: 0.1
17+
testing: {}
18+
compilation: {}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
common:
2+
task_type: generic_timeseries_classification
3+
target_device: MSPM0G5187
4+
dataset:
5+
dataset_name: fall_detection_classification
6+
input_data_path: https://software-dl.ti.com/C2000/esd/mcu_ai/01_04_00/datasets/fall_detection_classification.zip
7+
data_processing_feature_extraction:
8+
feat_ext_transform: [ 'FFT_Q15', 'Q15_SCALE', 'Q15_MAG', 'DC_REMOVE', 'BIN_Q15', 'CONCAT']
9+
frame_size: 256
10+
feature_size_per_frame: 8
11+
num_frame_concat: 8
12+
variables: 3
13+
q15_scale_factor: 5
14+
normalize_bin: True
15+
stacking: '2D1'
16+
training:
17+
model_name: CLS_6k_NPU
18+
batch_size: 256
19+
training_epochs: 50
20+
num_gpus: 0
21+
testing: {}
22+
compilation: {}
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# Human Fall Detection Classification
2+
3+
## Overview
4+
5+
The Human Fall Detection Classification application is an Edge AI solution that classifies human movement into two states: Activities of Daily Living (ADL) or Fall, using accelerometer data in real-time. This enables safety monitoring on embedded devices and provides immediate alerts in belt-mounted safety systems for vulnerable individuals such as elderly users or industrial workers.
6+
7+
## Problem and Solution
8+
9+
- Falls are a leading cause of injury and fatality among elderly individuals and in industrial environments
10+
- Traditional fall detection systems rely on cloud connectivity or bulky wearable hardware
11+
- Early and accurate fall detection enables timely emergency response and reduces injury severity
12+
- Edge AI enables real-time fall classification directly on resource-constrained microcontrollers without cloud connectivity
13+
14+
## Key Performance Targets
15+
16+
- Real-time classification of human movement into ADL or Fall
17+
- High accuracy on accelerometer-based fall detection (≥97.5%)
18+
- Low memory footprint suitable for MCU deployment
19+
20+
## System Components
21+
22+
**1. Hardware:**
23+
24+
- MSPM0G5187 microcontroller with integrated NPU https://www.ti.com/product/MSPM0G5187
25+
- TIDA-010997 EdgeAI Boosterpack with BMI270 accelerometer
26+
27+
**2. Software:**
28+
29+
- Code Composer Studio 12.x or later
30+
- MSPM0 SDK 2.11.00 or later
31+
- TI Edge AI Studio
32+
33+
## Dataset Information
34+
35+
The example uses the **SisFall** dataset as the primary training dataset:
36+
37+
- **Source:** [SisFall: A Fall and Normal Movement Dataset](https://www.mdpi.com/1424-8220/17/1/198)
38+
- **Classes:** 2 (ADL, Fall)
39+
- **Total Files:** ~4500
40+
41+
Each file contains readings from three sensors:
42+
- **ADXL345** — 13-bit triaxial accelerometer
43+
- **ITG3200** — triaxial gyroscope
44+
- **MMA8451Q** — triaxial accelerometer
45+
46+
### Data Cleaning and Preprocessing
47+
48+
The SisFall dataset contains data from three sensors, but only the **ADXL345 accelerometer** data is used for this example to match the single-accelerometer hardware setup (BMI270 on TIDA-010997). The following cleaning and preprocessing steps are applied:
49+
50+
**1. Sensor Filtering:**
51+
- Only ADXL345 (13-bit triaxial accelerometer) columns are retained
52+
- ITG3200 (gyroscope) and MMA8451Q (accelerometer) columns are discarded
53+
54+
**2. Bit-Depth Scaling:**
55+
- The ADXL345 is a 13-bit accelerometer, while the target hardware uses the BMI270 which is a 16-bit accelerometer
56+
- To match the input resolution expected by the firmware, all ADXL345 readings are scaled up from 13-bit to 16-bit resolution using the formula: `scaled_value = raw_value * (2^16 / 2^13) = raw_value * 8`
57+
- This ensures consistency between the training data distribution and the live sensor data fed during inference on the MCU
58+
59+
**3. Format Conversion:**
60+
- The cleaned and scaled dataset is converted into a format compatible with tinyml-tensorlab for model training
61+
- Each file is parsed, labeled (ADL or Fall), and exported into the required input structure
62+
63+
## Feature Extraction Pipeline
64+
65+
1. Sensor Input: 3-axis accelerometer data (x, y, z) from ADXL345 (scaled to 16-bit)
66+
2. Real FFT: 256-point FFT using ARM CMSIS-DSP
67+
3. Complex Magnitude Calculation
68+
4. DC Removal
69+
5. Binning: Average 16 adjacent FFT bins → 8 features
70+
6. Frame Concatenation: Stack 8 frames (64 total features per axis)
71+
72+
## Model Architecture
73+
74+
A generic time-series classification CNN model is used:
75+
76+
| Model | Parameters | Flash (kB) | RAM (kB) | Inference Latency (NPU) | Accuracy |
77+
|-------|-----------|------------|----------|--------------------------|----------|
78+
| **CLS_6k** | ~6,000 | 14 | 0.7 | 0.67 ms | 97.65% |
79+
80+
_NOTE: The above statistics was measured on LP-MSPM0G5187 Launchpad_
81+
82+
The model uses:
83+
- INT8 quantization for reduced memory footprint
84+
- 3-channel input (x, y, z axes)
85+
86+
## Training and Deployment Process
87+
88+
NOTE: Running the config yaml handles everything including dataset loading, data cleaning, feature extraction, training, quantization, and compilation.
89+
90+
1. **Training:**
91+
- Use TI Edge AI Studio (GUI) or tinyml-tensorlab (CLI)
92+
- Batch size: 256
93+
- Training epochs: 50
94+
95+
2. **Quantization:**
96+
- INT8 quantization for reduced model size
97+
- Maintains accuracy while enabling MCU deployment
98+
99+
3. **Compilation:**
100+
- TI Neural Network Compiler converts the trained model
101+
- Generates model artifacts for device deployment
102+
103+
## How to Run
104+
105+
After completing the repository setup, run the following command from the `tinyml-modelzoo` directory:
106+
107+
**Windows:**
108+
```bash
109+
.\run_tinyml_modelzoo.bat examples\fall_detection_classification\config_MSPM0.yaml
110+
```
111+
112+
**Linux:**
113+
```bash
114+
./run_tinyml_modelzoo.sh examples/fall_detection_classification/config_MSPM0.yaml
115+
```
116+
117+
## References
118+
119+
- [SisFall Dataset](https://www.mdpi.com/1424-8220/17/1/198)
120+
- [TI Neural Network Compiler User Guide](https://software-dl.ti.com/mctools/nnc/mcu/users_guide/)
121+
- [TI Model Training Guide](https://github.com/TexasInstruments/tinyml-tensorlab/tree/main)
122+
- [EdgeAI Software Guide](https://dev.ti.com/tirex/explore/node?node=A__AKCnvqDed-Plz2JO5Umb3Q__MSPM0-SDK__a3PaaoK__LATEST)

examples/forecasting_pmsm_rotor_temp/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ training:
1919
batch_size: 256
2020
training_epochs: 20
2121
num_gpus: 0
22-
quantization: 1
22+
quantization: 2
2323
optimizer: adam
2424
learning_rate: 0.005
2525
output_int: false

examples/forecasting_pmsm_rotor_temp/config_MSPM0.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ training:
1919
batch_size: 256
2020
training_epochs: 20
2121
num_gpus: 0
22-
quantization: 1
22+
quantization: 2
2323
optimizer: adam
2424
learning_rate: 0.005
2525
output_int: false

examples/generic_timeseries_forecasting/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ training:
1919
batch_size: 32
2020
training_epochs: 50
2121
num_gpus: 1
22-
quantization: 1
22+
quantization: 2
2323
optimizer: adam
2424
output_int: false
2525
testing: {}

examples/generic_timeseries_regression/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ training:
1919
lambda_reg: 0.01
2020
num_gpus: 1
2121
quantization: 2 # 0 for float model, 2 for 8 bit quantized model
22-
partial_quantization: False # input batchnorm, first conv/linear layer and last fc layer are not quantized, default is False
22+
auto_quantization: True
2323
testing: {}
2424
compilation: {}

examples/generic_timeseries_regression/readme.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ training:
137137
lambda_reg: 0.01
138138
num_gpus: 1 # 1 when using gpu if using cpu use 0
139139
quantization: 2 # 0 for float model, 2 for 8 bit quantized model
140-
partial_quantization: True # input batchnorm, first conv/linear layer and last fc layer are not quantized, default is False
140+
auto_quantization: True
141141
```
142142

143143
### `compile` and `test` section
@@ -209,18 +209,18 @@ For the generic_timeseries_regression dataset the results on the test set are
209209
For Float Model Configuration is :
210210
```yaml
211211
quantization: 0
212-
partial_quantization: False
212+
auto_quantization: False
213213
```
214214
For Partially Quantized Model configuration is:
215215
```yaml
216216
quantization: 2
217-
partial_quantization: True
217+
auto_quantization: True
218218
```
219219

220220
For Fully Quantized Model configuration is:
221221
```yaml
222222
quantization: 2
223-
partial_quantization: False
223+
auto_quantization: False
224224
```
225225

226226
## Running on Device

0 commit comments

Comments
 (0)