This repository contains the code for training and evaluation of the teacher model (DualCrossTAP) and student models (CNN-S1 & CNN-S2) from Composite human activity recognition utilizing knowledge distillation and sensor fusion focusing on resource constrained microcontrollers.
- First run
run_preprocessing.pyto download and prepare the dataset - To train models with KD, run
run_kd_pipeline.py - To perform cross validation on the teacher model, run
run_cross_validation.py - To calculate the floating point operations (FLOPS) of each model, run
run_flops_analysis.py - To generate the C header files to run student models on a microcontroller, run
run_deployment_prep.py
├── config.py # Hyperparameters and other configuration values
├── data_pipeline
│ ├── downloader.py # Helper script to download the CAPP dataset
│ ├── processor.py # Helper script to process the CAPP dataset
├── models
│ ├── analysis.py # Analysis utilities
│ ├── deployment_prep_utils.py # Generate C header files from trained student models
│ ├── knowledge_distillation.py # Train student model with KD
│ ├── student.py # Train student model without KD
│ ├── teacher.py # Train teacher model
│ └── utils.py # Training utilities
├── README.md
├── run_cross_validation.py # Perform k-fold cross validation on DualCrossTAP
├── run_deployment_prep.py # Convert student models to C header files
├── run_flops_analysis.py # Calculate model MFLOPS
├── run_kd_pipeline.py # Train DualCrossTAP and students (CNN-S1 & CNN-S2) with and without KD
├── run_preprocessing.py # Prepare the CAPP datasetConsider citing our paper published in Expert Systems with Applications (ESWA) if you use the codebase in your work:
@article{dual_cross_tap,
title = {Composite human activity recognition utilizing knowledge distillation and sensor fusion focusing on resource constrained microcontrollers},
journal = {Expert Systems with Applications},
volume = {298},
pages = {129652},
year = {2026},
issn = {0957-4174},
doi = {10.1016/j.eswa.2025.129652},
url = {https://doi.org/10.1016/j.eswa.2025.129652},
author = {Athar Noor Mohammad Rafee and John Clear and Jannatun Noor}
}