3.2. First Example
A detailed walkthrough of DC arc fault detection, from config to compiled model.
3.2.1. Overview
DC arc faults are dangerous electrical arcs in DC systems (solar, batteries).
The model classifies windows of current samples as class_0_normal or class_1_arc.
The outputs shown below are from a real run of this example on the F28P55 with
CLS_1k_NPU.
3.2.2. Step 1: The Configuration
examples/dc_arc_fault/config_dsk.yaml (comments omitted):
common:
task_type: arc_fault
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_1k_NPU
batch_size: 32
training_epochs: 10
num_gpus: 0
early_stopping: true
early_stopping_patience: 5
testing: {}
compilation: {}
commontask_type: arc_faultselects the arc fault classification task andtarget_device: F28P55is an NPU device.datasetdataset_name: dc_arc_fault_example_dskis a built-in dataset preset that is downloaded and extracted automatically.data_processing_feature_extractionA 1024-point FFT per frame with 256 features, one frame, one variable (current).
trainingThe 1K-parameter NPU classification model. Training stops early when validation accuracy has not improved for 5 epochs.
3.2.3. Step 2: Run
./run_tinyml_modelzoo.sh examples/dc_arc_fault/config_dsk.yaml
run_tinyml_modelzoo.bat examples\dc_arc_fault\config_dsk.yaml
./run_tinyml_modelzoo.ps1 examples/dc_arc_fault/config_dsk.yaml
The console shows, in order: dataset download, feature extraction, float training, quantization-aware training, testing, and compilation.
3.2.4. Step 3: Read the Training Log
The log reports validation accuracy per epoch and a summary of the best epoch, with
accuracy, F1 score, AUC ROC and the confusion matrix. When early stopping triggers,
the log says so (Early stopping at epoch N: no improvement for 5 epochs) and the
best checkpoint is kept. The test-set result is printed as Test Data Evaluation Accuracy.
3.2.5. Step 4: Examine the Output Folder
The output goes to ./data/projects/dc_arc_fault_example_dsk/run/<date-time>/CLS_1k_NPU/.
Path |
Contents |
|---|---|
|
Float model ( |
|
Quantized model, golden vectors, |
|
|
|
Bundle with everything a device project needs |
|
Compiler log with the memory usage of the model library |
Every item is explained in Understanding the Run Output.
3.2.6. Step 5: Customize
training:
model_name: CLS_4k_NPU # a larger model (check the model name exists in the model zoo)
common:
target_device: F2837 # a non-NPU C2000 device
Use your own data by changing the dataset section (see How to Create a ModelZoo Config YAML and Bring Your Own Data).
Model names available for your task and device are listed under Model Zoo Reference.