Skip to content

deliteser112/video-recognition-tensorflow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

🎥 Violation Detection Video App

This fullstack AI-powered web app enables users to upload and analyze videos for raised-hand violations using PoseNet. It consists of a Node.js backend and a React frontend, with MinIO for video storage and PostgreSQL for data management.

👉 You can check this video to know how it works here


🛠️ Tech Stack

  • Backend: Node.js + Express + TensorFlow.js + MinIO
  • Frontend: React + Tailwind CSS
  • AI: PoseNet model for body keypoint detection
  • Database: PostgreSQL
  • Storage: MinIO (S3-compatible object storage)

📁 Project Structure

project-root/
├── frontend/
│   ├── src/
│   └── ...
├── backend/
│   ├── src/
│   └── ...
└── README.md

🧩 Prerequisites

  • Node.js v18+
  • PostgreSQL (running locally)
  • MinIO (manual startup)
  • FFmpeg installed globally
  • TensorFlow native libraries (for Windows setup)

🔧 Backend Setup

  1. Install dependencies

    cd backend
    npm install
  2. Environment variables: Create a .env file with the following:

    MINIO_ACCESS_KEY=minioadmin
    MINIO_SECRET_KEY=minioadmin
    MINIO_ENDPOINT=127.0.0.1
    MINIO_PORT=9000
    MINIO_USE_SSL=false
    
    PG_USER=postgres
    PG_HOST=127.0.0.1
    PG_DATABASE=video_recording_db
    PG_PASSWORD=postgres
    PG_PORT=5432
    
    PORT=5000
  3. Initialize the database

    npm run init-db
  4. Start the backend server

    npm start

💻 Frontend Setup

  1. Navigate to the frontend directory:

    cd frontend
  2. Install dependencies:

    npm install
  3. Run the development server:

    npm start

The frontend runs on http://localhost:3000.


📦 Starting MinIO Manually

minio server /path/to/data --console-address ":9001"

🧠 TensorFlow Setup for Windows

  1. Download libtensorflow-cpu-windows-x86_64-2.9.1.zip.

  2. Copy tensorflow.dll and tensorflow.lib to:

    node_modules/@tensorflow/tfjs-node/deps/lib

🎞️ FFmpeg Setup (Windows)

  1. Download FFmpeg from ffmpeg.org.
  2. Extract it to a folder, e.g., C:\ffmpeg.
  3. Add the bin folder to your system PATH (e.g., C:\ffmpeg\bin).
  4. Restart your terminal or system to apply the change.

Verify installation with:

ffmpeg -version

🧠 How Violation Detection Works

  • Extracts the first frame from the uploaded video using FFmpeg.
  • Runs PoseNet on the frame to estimate body keypoints.
  • Flags a violation if:
    • leftWrist or rightWrist is detected above a vertical threshold (Y < 500).
    • Detection confidence is too low (uncertain violation).
  • All violations are stored in PostgreSQL.

✅ Scripts

Backend

npm install       # Install dependencies
npm run init-db   # Initialize the database
npm start         # Start the backend server

Frontend

npm install       # Install dependencies
npm start         # Run the React app

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published