Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Baggage Platform

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.

## Project Structure

- **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.

## Prerequisites

- [Node.js](https://nodejs.org/) (v16 or higher)
- [Python](https://www.python.org/) (v3.8 or higher)
- [PostgreSQL](https://www.postgresql.org/)

## Setup Instructions

### 1. Database Setup (PostgreSQL)

1. Install and start PostgreSQL.
2. Create a database (e.g., `baggage_db`).
3. Note your database connection details (username, password, host, port, database name).

### 2. Backend Setup

1. Navigate to the `backend` directory:
```bash
cd backend
```
2. Install dependencies:
```bash
npm install
```
3. Configure environment variables:
- Create a `.env` file in the `backend` directory (if it does not exist).
- Add the `DATABASE_URL` variable:
```env
DATABASE_URL="postgresql://USER:PASSWORD@localhost:5432/baggage_db?schema=public"
```
**Note:** Replace `USER`, `PASSWORD`, and `baggage_db` with your actual PostgreSQL credentials.
4. Initialize the database schema:
```bash
npx prisma generate
npx prisma db push
```
5. Start the backend server:
```bash
npm start
```
- The API server runs on `http://localhost:5000`.
- The WebSocket server runs on `ws://localhost:8081`.

### 3. Frontend Setup

1. Open a new terminal and navigate to the `frontend` directory:
```bash
cd frontend
```
2. Install dependencies:
```bash
npm install
```
3. Start the development server:
```bash
npm start
```
- The application will open at `http://localhost:3000`.

### 4. Python Engine Setup

1. Open a new terminal and navigate to the `python-engine` directory:
```bash
cd python-engine
```
2. Install Python dependencies:
```bash
pip install -r requirements.txt
```
3. Run the detection engine:
```bash
python live_yolo_engine.py --source <VIDEO_SOURCE> --streamId <STREAM_ID>
```
- `--source`: Path to a video file or camera index (e.g., `0` for webcam).
- `--streamId`: A unique identifier for the stream (e.g., `cam1`).

**Example:**
```bash
python live_yolo_engine.py --source 0 --streamId cam1
```

## Running the Complete System

1. Ensure the **PostgreSQL Database** is running.
2. Start the **Backend** (`npm start` in `backend/`).
3. Start the **Frontend** (`npm start` in `frontend/`).
4. Run the **Python Engine** with your desired video source.
5. Open `http://localhost:3000` to view the dashboard and real-time analytics.
1 change: 1 addition & 0 deletions backend/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DATABASE_URL="postgresql://postgres:1234@localhost:5432/baggage_db?schema=public"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
0 0.3895610272884369 0.6932320594787598 0.1280086189508438 0.1627638041973114
0 0.16703420877456665 0.5642731785774231 0.09341136366128922 0.15167592465877533
0 0.9560484290122986 0.9221291542053223 0.08790302276611328 0.15574170649051666
0 0.13916879892349243 0.811154842376709 0.07705847173929214 0.1463843435049057
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
0 0.29829591512680054 0.6446008682250977 0.12156656384468079 0.15267311036586761
0 0.49192899465560913 0.745903730392456 0.1493932455778122 0.18510030210018158
0 0.7323252558708191 0.8575846552848816 0.1644657701253891 0.20728585124015808
0 0.43945321440696716 0.26821741461753845 0.08059863746166229 0.10975001007318497
0 0.14751005172729492 0.5243874788284302 0.07802576571702957 0.1305433213710785
0 0.9607410430908203 0.9214945435523987 0.07851791381835938 0.15701085329055786
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
0 0.6010957956314087 0.8095666170120239 0.1622653603553772 0.20247666537761688
0 0.21071714162826538 0.6001806259155273 0.10528070479631424 0.1516542285680771
0 0.37665608525276184 0.6881519556045532 0.1307695060968399 0.16416846215724945
0 0.27681371569633484 0.3579447865486145 0.08090914040803909 0.10942911356687546
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading