Skip to content

Vaibhav0221/human-action-recognition-v2

Repository files navigation

Human Action Recognition (HAR)

A full-stack web application for human action recognition using TensorFlow/Keras and React.

Features

  • Upload images to classify human actions
  • Real-time prediction using a trained TensorFlow model
  • Modern React frontend with Vite
  • Flask backend API
  • 15 action classes: Sitting, Drinking, Calling, Sleeping, Clapping, Dancing, Cycling, Laughing, Eating, Fighting, Listening to music, Running, and more

Project Structure

HAR/
├── app.py                 # Flask backend API
├── Model2.h5/            # Trained TensorFlow model
├── requirements.txt      # Python dependencies
├── package.json          # Node.js dependencies
├── vite.config.js        # Vite configuration
├── index.html            # React app entry point
├── src/
│   ├── main.jsx         # React entry point
│   ├── App.jsx          # Main React component
│   ├── App.css          # Component styles
│   └── index.css        # Global styles
└── templates/           # (Legacy Flask templates - not used in React version)

Setup Instructions

1. Install Python Dependencies

pip install -r requirements.txt

2. Install Node.js Dependencies

npm install

Running the Application

Option 1: Run Both Together (Recommended)

Using npm script (requires concurrently):

npm install  # Install concurrently if not already installed
npm start    # Starts both backend and frontend

Using start scripts:

  • Windows: Double-click start.bat or run start.bat in terminal
  • Linux/Mac: Run chmod +x start.sh && ./start.sh

Option 2: Run Both Separately (For Development)

Terminal 1 - Start Flask Backend:

python app.py

Backend will run on http://localhost:5000

Terminal 2 - Start React Frontend:

npm run dev

Frontend will run on http://localhost:3000

API Endpoints

POST /predict

Upload an image to get human action prediction.

Request:

  • Method: POST
  • Content-Type: multipart/form-data
  • Body: image (file)

Response:

{
  "success": true,
  "prediction": "Sitting"
}

GET /health

Health check endpoint.

Response:

{
  "status": "healthy",
  "model_loaded": true
}

Model Information

Technologies Used

  • Frontend: React 18, Vite
  • Backend: Flask, Flask-CORS
  • ML: TensorFlow/Keras
  • Image Processing: PIL/Pillow, NumPy

Development

  • Frontend runs on port 3000 (configured in vite.config.js)
  • Backend runs on port 5000 (configured in app.py)
  • Vite proxy is configured to forward /predict and /health requests to the backend

License

© 2024 Vaibhav Soni | All rights reserved.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors