An embedded machine learning project for real-time human activity recognition and fall-detection experimentation on a Raspberry Pi. This project focuses on building, optimizing, converting, and deploying neural network models for edge inference under real-world embedded constraints.
The project demonstrates an end-to-end embedded AI workflow: sensor data collection, preprocessing, model training, architecture tuning, TensorFlow Lite conversion, Raspberry Pi deployment, and evaluation of accuracy, model size, and inference performance.
Embedded machine learning systems must balance accuracy, latency, memory usage, and deployability. This project explores that tradeoff by developing neural network models for activity recognition and deploying optimized TensorFlow Lite models to a Raspberry Pi.
The work was developed across multiple stages:
- Data acquisition and sample-rate measurement
- PC-based model training and testing
- Raspberry Pi model deployment
- Neural network optimization
- TensorFlow Lite conversion and inference testing
The project shows how machine learning models can move beyond notebook-based training and into practical edge-computing environments.
- Collect and prepare activity-recognition sensor data
- Train neural network models for activity and fall detection
- Improve baseline model accuracy through preprocessing and architecture changes
- Convert trained models to TensorFlow Lite for embedded deployment
- Run inference on a Raspberry Pi
- Compare optimized and non-optimized model behavior
- Evaluate tradeoffs between model accuracy, model size, and inference time
- Build experience with real-world embedded AI workflows
| Area | Description |
|---|---|
| Embedded Machine Learning | Deploying trained models on Raspberry Pi hardware |
| Activity Recognition | Classifying motion-based activity patterns from sensor data |
| Data Acquisition | Collecting sensor samples and measuring sample rate |
| Preprocessing | Scaling and preparing data for neural network training |
| Neural Networks | Training and tuning models using TensorFlow/Keras |
| Conv1D Modeling | Using one-dimensional convolutional layers for time-series classification |
| TensorFlow Lite | Converting trained models for lightweight edge inference |
| Edge Deployment | Running inference scripts directly on Raspberry Pi |
| Performance Tradeoffs | Balancing accuracy, latency, model size, and responsiveness |
embedded-activity-recognition/
│
├── Week 10/
│ ├── Lab10_final.docx
│ ├── data_acquire3.py
│ └── measure_sampleRate.py
│
├── Week 11/
│ ├── Data/
│ ├── OnPC/
│ │ └── fall_detect_v1.ipynb
│ ├── OnPi/
│ │ ├── model.tflite
│ │ ├── predict_cnn_piLite.py
│ │ ├── predict_tflite.py
│ │ └── windowNN_model.tflite
│ └── Week 11_Pre-Lab.docx
│
├── Week 12/
│ ├── NN_1NP/
│ │ ├── fall_detect_nn_1np.ipynb
│ │ ├── nn_model_raw_1np.tflite
│ │ └── predict_tflite_nn1np.py
│ ├── Pre-lab/
│ └── Week 12_Pre-Lab.docx
│
├── Week 13/
│ ├── ML_Model/
│ │ ├── Test 1/
│ │ ├── Test 2/
│ │ └── Test 3/
│ └── Pre-Lab.docx
│
└── README.md
Sensor Data Collection
│
▼
Sample Rate Measurement
│
▼
Data Preprocessing
│
▼
Neural Network Training
│
▼
Model Optimization
│
▼
TensorFlow Lite Conversion
│
▼
Raspberry Pi Deployment
│
▼
Edge Inference Testing
The first stage focused on collecting sensor data and understanding the sampling behavior of the embedded system.
- Collected sensor data for activity-recognition experiments
- Measured sample rate behavior
- Established the data collection pipeline for later model training
- Built scripts for acquiring and analyzing motion data
data_acquire3.py
measure_sampleRate.py
Lab10_final.docx
- Sensor data acquisition
- Python scripting
- Sampling-rate measurement
- Embedded data collection
- Experimental setup and documentation
The second stage focused on training an initial neural network model on a PC and deploying TensorFlow Lite models to the Raspberry Pi.
- Trained an initial fall/activity detection model on a PC
- Converted trained models to TensorFlow Lite format
- Deployed
.tflitemodels to Raspberry Pi - Created prediction scripts for running inference on embedded hardware
- Compared PC-side development with Pi-side deployment
Week 11/OnPC/fall_detect_v1.ipynb
Week 11/OnPi/model.tflite
Week 11/OnPi/windowNN_model.tflite
Week 11/OnPi/predict_tflite.py
Week 11/OnPi/predict_cnn_piLite.py
- TensorFlow/Keras model training
- TensorFlow Lite conversion
- Raspberry Pi deployment
- Embedded inference scripting
- PC-to-edge model workflow
The third stage focused on improving model performance and testing optimized neural network designs.
- Developed an improved neural network model
- Used preprocessing to improve model stability
- Tested optimized model behavior
- Converted the improved model to TensorFlow Lite
- Created a dedicated TFLite prediction script for the optimized model
Week 12/NN_1NP/fall_detect_nn_1np.ipynb
Week 12/NN_1NP/nn_model_raw_1np.tflite
Week 12/NN_1NP/predict_tflite_nn1np.py
- Neural network architecture tuning
- Model preprocessing
- TensorFlow Lite deployment
- Embedded model evaluation
- Activity-recognition model optimization
The final stage organized multiple model tests and evaluation attempts to compare behavior across different configurations.
- Organized model experiments into multiple test folders
- Compared different model configurations
- Evaluated model behavior across repeated trials
- Continued improving edge-inference readiness
Week 13/ML_Model/Test 1/
Week 13/ML_Model/Test 2/
Week 13/ML_Model/Test 3/
- Model experiment organization
- Repeated testing
- Iterative model development
- Embedded ML evaluation
- Performance comparison
The project improved the embedded activity-recognition model through several changes.
- Applied standard scaling to reduce noise and normalize input features
- Increased training data usage from 60% to 80%
- Added additional Conv1D layers for time-series feature extraction
- Added MaxPooling1D layers to reduce feature dimensionality
- Increased dropout from 0.2 to 0.3 to reduce overfitting
- Increased training epochs from 15 to 50
- Compared optimized and non-optimized TensorFlow Lite models
Raw Sensor Data
│
▼
Data Cleaning and Formatting
│
▼
Standard Scaling
│
▼
Train/Test Split
│
▼
Neural Network Training
│
▼
Model Evaluation
│
▼
TensorFlow Lite Conversion
│
▼
Raspberry Pi Inference
Trained Keras Model
│
▼
TensorFlow Lite Converter
│
▼
.tflite Model File
│
▼
Raspberry Pi
│
▼
Prediction Script
│
▼
Real-Time Activity Classification
The project improved the baseline model from approximately 0.80 accuracy to stronger optimized performance through preprocessing, model architecture changes, and training adjustments.
The final workflow produced TensorFlow Lite models that could be deployed and tested on Raspberry Pi hardware.
- Built a working embedded machine learning pipeline
- Trained neural network models for activity/fall detection
- Converted models to TensorFlow Lite
- Ran prediction scripts on Raspberry Pi
- Improved classification performance through model tuning
- Evaluated accuracy versus embedded deployment constraints
- Python
- TensorFlow
- Keras
- TensorFlow Lite
- scikit-learn
- NumPy
- Jupyter Notebook
- Raspberry Pi
- Motion/activity sensor data pipeline
- Embedded machine learning
- Edge AI
- Activity recognition
- Fall detection
- Time-series classification
- Conv1D neural networks
- Model optimization
- TFLite deployment
- Real-time inference
- Embedded AI development
- Raspberry Pi deployment
- Sensor data acquisition
- Sample-rate measurement
- Machine learning preprocessing
- Neural network training
- Conv1D architecture tuning
- TensorFlow Lite model conversion
- Edge inference scripting
- Activity-recognition modeling
- Fall-detection experimentation
- Model size and inference tradeoff analysis
- End-to-end ML deployment workflow
- Add dataset documentation and label descriptions
- Include plots for training and validation accuracy/loss
- Add confusion matrix, precision, recall, and F1-score evaluation
- Benchmark Raspberry Pi inference latency more systematically
- Compare quantized and non-quantized TFLite models
- Add a demo video or sample terminal output
- Reorganize weekly folders into cleaner portfolio-style project folders
- Add a requirements file for easier environment setup
This project sits at the intersection of machine learning, embedded systems, and real-world deployment. It shows more than just model training; it shows the process of preparing a model for practical use on resource-constrained hardware.
The project is relevant to edge AI, wearable sensing, healthcare technology, activity monitoring, human-centered intelligent systems, and embedded machine learning applications.
Jaiden Medina
Computer Engineering @ Indiana University
Accelerated M.S. in Intelligent Systems Engineering
- GitHub: jfmedina05
- Portfolio: www.jaidenmedina.com
- LinkedIn: jaiden-medina