This project is a comprehensive baggage tracking and analytics platform consisting of a Node.js backend, a React frontend, and a Python-based YOLO object detection engine.
- backend/: Node.js Express server with Prisma ORM and WebSocket server.
- frontend/: React application for scanning and monitoring dashboard.
- python-engine/: Python script using YOLOv8 for real-time object detection and streaming.
- Node.js (v16 or higher)
- Python (v3.8 or higher)
- PostgreSQL
- Install and start PostgreSQL.
- Create a database (e.g.,
baggage_db). - Note your database connection details (username, password, host, port, database name).
- Navigate to the
backenddirectory:cd backend - Install dependencies:
npm install
- Configure environment variables:
- Create a
.envfile in thebackenddirectory (if it does not exist). - Add the
DATABASE_URLvariable:Note: ReplaceDATABASE_URL="postgresql://USER:PASSWORD@localhost:5432/baggage_db?schema=public"
USER,PASSWORD, andbaggage_dbwith your actual PostgreSQL credentials.
- Create a
- Initialize the database schema:
npx prisma generate npx prisma db push
- Start the backend server:
npm start
- The API server runs on
http://localhost:5000. - The WebSocket server runs on
ws://localhost:8081.
- The API server runs on
- Open a new terminal and navigate to the
frontenddirectory:cd frontend - Install dependencies:
npm install
- Start the development server:
npm start
- The application will open at
http://localhost:3000.
- The application will open at
-
Open a new terminal and navigate to the
python-enginedirectory:cd python-engine -
Install Python dependencies:
pip install -r requirements.txt
-
Run the detection engine:
python live_yolo_engine.py --source <VIDEO_SOURCE> --streamId <STREAM_ID>
--source: Path to a video file or camera index (e.g.,0for webcam).--streamId: A unique identifier for the stream (e.g.,cam1).
Example:
python live_yolo_engine.py --source 0 --streamId cam1
- Ensure the PostgreSQL Database is running.
- Start the Backend (
npm startinbackend/). - Start the Frontend (
npm startinfrontend/). - Run the Python Engine with your desired video source.
- Open
http://localhost:3000to view the dashboard and real-time analytics.