Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IMU-Based Human Activity Detection 🏃‍♂️🧘‍♂️🚶‍♀️

A comprehensive MATLAB implementation for Classifying Human Activities using Inertial Measurement Units (IMUs). This project leverages advanced feature selection techniques and multiple machine learning classifiers to achieve high accuracy in HAR (Human Activity Recognition).


🚀 Overview

This repository provides a complete pipeline for processing IMU data from the UCI Human Activity Recognition (HAR) dataset. It focuses on optimizing classification performance by selecting the most relevant features using a Discrete Biogeography-Based Optimization (BBO) algorithm.

Key Features

  • Intelligent Feature Selection: Implementation of a custom Discrete BBO to reduce dimensionality and improve model efficiency.
  • Support for Multiple Classifiers: Easily switch between K-Nearest Neighbors (KNN), Linear Discriminant Analysis (LDA), and Decision Trees.
  • Robust Validation: Built-in K-Fold Cross-Validation to ensure model generalizability.
  • Detailed Evaluation: Generates confusion matrices and per-class accuracy metrics.

📊 Dataset

The project uses the UCI Human Activity Recognition Using Smartphones Dataset.

  • 🔗 Access the Dataset Here
  • The dataset includes recordings of 30 subjects performing activities of daily living while carrying a waist-mounted smartphone with embedded inertial sensors.

🛠️ Repository Structure

File/Folder Description
Main.mlx The primary entry point (MATLAB Live Script) for running the detection pipeline.
Classifier.m Core classification engine supporting KNN, LDA, and Trees with cross-validation.
DiscreteBBO.m Implementation of the Biogeography-Based Optimization for feature selection.
importfile.m Utility script for loading and preprocessing raw IMU data.
Data-Description/ Detailed documentation regarding the source data and sensors.
Results/ Storage for output metrics, plots, and performance logs.

💻 Getting Started

Prerequisites

  • MATLAB (R2021a or later recommended)
  • Statistics and Machine Learning Toolbox

Usage

  1. Clone the repository:
    git clone https://github.com/BanaanKiamanesh/IMU-Activity-Detection.git
  2. Download the dataset from the link above and place it in the appropriate directory (or update the path in Main.mlx).
  3. Open Main.mlx in MATLAB.
  4. Run the sections to execute data loading, feature selection, and classification.

🧠 Methodology

  1. Preprocessing: Data is imported and normalized.
  2. Feature Selection: The DiscreteBBO algorithm identifies the most significant sensor readings (acceleration, angular velocity, etc.) to optimize the classification cost function.
  3. Classification: The selected features are fed into the chosen classifier (KNN by default).
  4. Evaluation: Performance is assessed using 10-fold cross-validation.

📈 Results

Results, including classification accuracy and optimized feature subsets, are saved in the Results/ directory. The pipeline aims for maximum balanced accuracy across all activity types (Walking, Sitting, Standing, etc.).


🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request or open an issue for any bugs or feature requests.


Developed by Banaan Kiamanesh

Releases

Packages

Contributors

Languages