Skip to content

nacansino/Activity-Recognition-using-Motion-History-Images-MHI-with-Supervised-Machine-Learning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Activity Classification using Motion History Images

Workflow diagram

This repository contains the implementation and experiments for the project “Activity Classification using Motion History Images (MHI)”. The project explores a lightweight approach to human activity recognition by extracting temporal features (MHI and MEI) from video frames and classifying them using traditional machine learning models such as KNN, SVM, and Random Forest. It includes scripts for feature generation, model training, evaluation, and reproduction of results discussed in the accompanying report. The experiments use the KTH human action dataset — place the extracted KTH videos under the input_videos/ directory with one folder per class (for example input_videos/boxing/, input_videos/walking/, etc.), which is the structure expected by the scripts.

How to run the code

Follow the steps below to run the code:

  1. Create the conda environment using the environment.yml file:
conda env create -f environment.yml
  1. Activate the conda environment:
conda activate cv_proj
  1. Prepare the dataset. Inside input_videos folder, extract the KTH dataset in a way that each class is in a separate folder. The folder structure should look like this:
input_videos/
├── boxing
│   ├── person01_boxing_d1_uncomp.avi
...
├── walking
│   ├── person01_walking_d1_uncomp.avi
...
├── running
...
  1. cd to src directory, then run the experiment.py script. The script will extract the features from the videos and run the experiments. The experiment images will be saved in the output_images folder, whereas temporary data will be saved in the localdata folder. The code will run about less than 3 minutes until completion.
cd src
python experiment.py

Other Notes

The code is tested on Windows 11 and Ubuntu 20.04. The environment file is generated using the following command:

conda env export --no-builds --from-history > environment.yaml

About

Activity Recognition using MHI and MEI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages