Rsharan622244/human-action-recognition-lrcn
Human Action Recognition using LRCN
Overview
This project is a deep learning-based Human Action Recognition system that classifies actions from video sequences using an LRCN (Long-term Recurrent Convolutional Network) architecture.
The application supports both:
- Video file uploads
- YouTube video URLs
and predicts the action being performed in the video.
The model was trained on four action classes and achieved 87% classification accuracy.
Features
- Upload local video files for prediction
- Predict actions directly from YouTube videos
- Real-time video playback inside the application
- Confidence scores for all classes
- Streamlit-based interactive web interface
- CNN + LSTM architecture for spatiotemporal feature learning
Action Classes
The model is trained to classify the following activities:
- PullUps
- TaiChi
- Skijet
- Billiards
Model Architecture
The project uses an LRCN (Long-term Recurrent Convolutional Network) architecture:
Video Frames → CNN Feature Extraction → Temporal Sequence Modeling (LSTM) → Softmax Classification
Architecture
- TimeDistributed Conv2D (16 filters)
- TimeDistributed MaxPooling2D
- TimeDistributed Dropout
- TimeDistributed Conv2D (32 filters)
- TimeDistributed MaxPooling2D
- TimeDistributed Dropout
- TimeDistributed Conv2D (64 filters)
- TimeDistributed MaxPooling2D
- TimeDistributed Dropout
- TimeDistributed Conv2D (64 filters)
- TimeDistributed MaxPooling2D
- TimeDistributed GlobalAveragePooling2D
- LSTM (32 Units)
- Dropout (0.5)
- Dense (4, Softmax)
Dataset Preprocessing
Each video is processed as follows:
- Extract 20 frames per video
- Resize frames to 64 × 64 pixels
- Normalize pixel values by dividing by 255
- Create temporal sequences for LSTM processing
Input Shape:
(20, 64, 64, 3)
Performance
Project Structure
Human-Action-Recognition/
├── app.py
├── predict.py
├── LRCN_model_4class_87acc.h5
├── requirements.txt
└── README.mdInstallation
Clone the repository:
git clone <repository-url>
cd Human-Action-RecognitionCreate a virtual environment:
python -m venv venvActivate environment:
Windows
venv\Scripts\activateInstall dependencies:
pip install -r requirements.txtRunning the Application
Start the Streamlit server:
streamlit run app.pyOpen:
http://localhost:8501Usage
Option 1: Upload Video
- Upload a supported video file.
- Wait for preprocessing and inference.
- View the predicted action and confidence scores.
Option 2: YouTube URL
- Paste a YouTube video URL.
- Download and process the video.
- View the prediction results.
Technologies Used
- Python
- TensorFlow / Keras
- OpenCV
- NumPy
- Streamlit
- yt-dlp
Future Improvements
- Support for additional action classes
- Real-time webcam prediction
- Batch video processing
- GPU inference optimization
- Action localization within videos
Author
Rachuri Sharan
AI / Machine Learning Projects Human Action Recognition using LRCN
