Skip to content

About

A deep learning-based system to recognize and classify human actions from video data using computer vision techniques.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿƒ Human Action Recognition using Deep Learning

Recognising human actions in uploaded videos and live webcam feeds with ConvLSTM and a Kinetics-400 ResNet

Python TensorFlow OpenCV Django Dataset License

Main Project (Phase 2) ยท Dept. of Information Science & Engineering ยท Bahubali College of Engineering, Shravanabelagola (VTU) ยท 2024-25


๐Ÿ“Œ Aim

Build a Human Action Recognition (HAR) system that accurately detects and classifies human activities in real-world video, for use in healthcare monitoring, security and surveillance, sports analytics, robotics and smart homes.

Objectives

  • Develop an accurate HAR system using computer vision and deep learning
  • Work reliably in diverse conditions (lighting, occlusion, camera angle)
  • Minimise false positives for dependable predictions

๐Ÿง  Two Models

Model 1: ConvLSTM web app Model 2: Real-time recognition
Input Uploaded video clip Webcam or video stream
Network ConvLSTM2D (trained from scratch) ResNet-34 3D CNN pre-trained on Kinetics-400 (ONNX)
Classes Basketball, Biking, Diving, Horse Riding 400 Kinetics actions
Interface Django web page OpenCV window with live label
Code recognition/, training/ realtime/

๐Ÿ”„ How It Works

Model 1: upload โ†’ predict

flowchart TD
    A[User uploads video] --> B["upload_video(request)<br/>Django view"]
    B --> C["extract_frames()<br/>20 evenly spaced frames, 64ร—64, normalised"]
    C --> D["adjust_frames()<br/>pad to exactly 20 frames"]
    D --> E["ConvLSTM model.predict()"]
    E --> F[Predicted action + confidence per class]
    F --> G[result.html]
    B -. video deleted after prediction .-> H[(temp storage)]
Loading

Model 2: live stream

flowchart LR
    A[Webcam / video] --> B[capture_and_store_frame<br/>deque of 16 frames]
    B --> C[preprocess_frames<br/>blob 112ร—112]
    C --> D[ResNet-34 Kinetics<br/>OpenCV DNN]
    D --> E[stabilize_prediction<br/>majority vote]
    E --> F[display_label_on_frame]
Loading

Methodology

  1. Dataset collection: UCF50 videos (Model 1), Kinetics-400 pre-trained weights (Model 2)
  2. Preprocessing: frame extraction, resizing, normalisation
  3. Feature learning: ConvLSTM layers learn spatial features (convolutions) and temporal patterns (LSTM) together
  4. Training & evaluation: 75/25 train-test split, early stopping
  5. Recognition: prediction on new clips or live frames

๐Ÿ—๏ธ ConvLSTM Architecture

Input (20 frames ร— 64 ร— 64 ร— 3)
 โ†’ ConvLSTM2D(4)  โ†’ MaxPool3D โ†’ Dropout
 โ†’ ConvLSTM2D(8)  โ†’ MaxPool3D โ†’ Dropout
 โ†’ ConvLSTM2D(14) โ†’ MaxPool3D โ†’ Dropout
 โ†’ ConvLSTM2D(16) โ†’ MaxPool3D
 โ†’ Flatten โ†’ Dense(4, softmax)

๐Ÿ“‚ Project Structure

Human-Action-Recognition-using-Deep-Learning/
โ”œโ”€โ”€ har_web/                 # Django project settings and URLs
โ”œโ”€โ”€ recognition/             # Django app (Model 1)
โ”‚   โ”œโ”€โ”€ predictor.py         # extract_frames, adjust_frames, predict_activity
โ”‚   โ”œโ”€โ”€ views.py             # upload_video view
โ”‚   โ””โ”€โ”€ templates/recognition/
โ”œโ”€โ”€ training/
โ”‚   โ””โ”€โ”€ train_convlstm.py    # Train ConvLSTM on UCF50
โ”œโ”€โ”€ realtime/
โ”‚   โ””โ”€โ”€ realtime_har.py      # Model 2: live Kinetics-400 recognition
โ”œโ”€โ”€ models/                  # Trained / downloaded model files (not committed)
โ”œโ”€โ”€ manage.py
โ””โ”€โ”€ requirements.txt

๐Ÿš€ Getting Started

git clone https://github.com/Gaganajain/Human-Action-Recognition-using-Deep-Learning.git
cd Human-Action-Recognition-using-Deep-Learning
python -m venv venv
venv\Scripts\activate        # macOS/Linux: source venv/bin/activate
pip install -r requirements.txt

Model 1: train and run the web app

  1. Download UCF50 and extract it to ./UCF50.

  2. Train (saves models/convlstm_model.h5 and models/training_curves.png):

    python training/train_convlstm.py --dataset UCF50 --epochs 50
  3. Start the web app and open http://127.0.0.1:8000:

    python manage.py runserver

Model 2: real-time recognition

  1. Put these two files in models/:

  2. Run:

    python realtime/realtime_har.py                    # webcam
    python realtime/realtime_har.py --input clip.mp4   # video file

Press Q or Esc to quit.

โœ… Requirements Met

Requirement How
Accuracy โ‰ฅ 85% ConvLSTM on 4 distinct UCF50 classes; early stopping keeps the best weights
Fast inference (3โ€“5 s) Only 20 sampled frames per clip; model loaded once and reused
Privacy Uploaded videos are deleted immediately after prediction
Usability One-page upload UI with per-class confidence bars
Error handling Alerts for unsupported formats, unreadable videos and a missing model

๐Ÿ“š Literature Highlights

Paper Approach Reported result
Yu & Yan, 2020 Two-Stream CNN, CNN+LSTM, 3D CNN CNN+LSTM best at 89.74%
Shekokar & Kale, 2021 CNN with frame reduction 86.21%
Gao et al., 2018 Recurrent 3D CNN (3D CNN + LSTM) Best among compared models
Akula et al., 2018 2D CNN on infrared images 87.44%

The consistent finding, that combining spatial and temporal modelling works best, led to the ConvLSTM design.

๐Ÿ”ฎ Future Work

  • More action classes and a larger training set
  • Pose-based (skeleton) features for robustness to background clutter
  • Live webcam mode inside the web app
  • Deploy with Docker on a GPU server

๐Ÿ‘ฅ Team

  • Akshata Kiran Bole
  • Anusha Kaveramma B D
  • Gagana Jain A
  • Vijayalakshmi R

Guide: Teerthalakshmi A M, B.E., M.Tech., Assistant Professor, Dept. of ISE, Bahubali College of Engineering

๐Ÿ“„ License

This project is licensed under the MIT License.

About

A deep learning-based system to recognize and classify human actions from video data using computer vision techniques.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages