This repository implements a multi-head convolutional attention-based model for human activity recognition. The model employs attention mechanisms to improve recognition accuracy by focusing on informative regions in the input data. Further, the obtained model is Quantized for supporting IoT-based devices.
-
Clone the repository:
git clone https://github.com/Arshdeep-Singh-01/Human-Activity-Recogonition-using-MutliHead-Convolutional-Attention.git
-
Navigate to the project directory:
cd Human-Activity-Recogonition-using-MutliHead-Convolutional-Attention
-
Install the required dependencies:
pip install -r requirements.txt
This task use the WISDM dataset which contains the acceleration values (x,y,z) and the corresponding activity, along with the temporal components Dataset is freely avaliable at WISDM Train Data: 80% Test Data: 20%
The overview of the model architecture is as follows:
- 3-Head Convolutional Neural Network
- Concatination followed by Maxpooling
- 30-Head Convolutional Attention
- Fully connected dense layers
The model was trained over 200 epochs (20+ hours of computation)
- Optimizer: SGD(lr = 0.001)
- Loss: Cross Entropy Loss
The trained model was then Quantized using Post Training Dynamic Quantization
Model | Size (MB) |
---|---|
Original Model | 373.094 |
Quantized Model | 0.009 |
Activity | Accuracy (Original Model) | Accuracy (Quantized Model) |
---|---|---|
Walking | 98.06% | 97.86% |
Jogging | 99.82% | 98.96% |
Upstairs | 92.87% | 92.57% |
Downstairs | 98.5% | 98.11% |
Sitting | 95.05% | 93.85% |
Standing | 99.65% | 98.97% |
Overall | 97.33% | 96.72% |