AI-powered real-time vehicle detection, classification, counting, and visual analytics platform.
VEHIX is an end-to-end computer vision platform designed for intelligent traffic and road surveillance analysis. By combining a FastAPI backend with Ultralytics YOLOv8 neural detection and a reactive Vite + React + Tailwind CSS frontend, VEHIX transforms raw road imagery into structured vehicle metrics, category counts, confidence ratings, and annotated visual outputs.
- π Neural Object Detection: Utilizes YOLOv8 for precise vehicle localization.
- π·οΈ Multi-Class Vehicle Classification: Detects and categorizes
cars,buses,trucks,motorcycles, andbicycles. - π’ Automated Vehicle Counting: Real-time aggregation per vehicle class with visual distribution metrics.
- πΌοΈ Annotated Image Generation: Automatic rendering of colored bounding boxes, labels, and percentage confidence scores onto images.
- π Interactive Analytics Dashboard: Donut charts, category breakdown progress bars, and full detection coordinate inspection tables.
- β‘ Asynchronous REST API: High-performance FastAPI endpoints with automated OpenAPI / Swagger interactive documentation.
- π Modern Glassmorphic UI: Built with dark mode, fluid micro-animations, and full responsive design.
- π One-Click Startup: Windows PowerShell launcher to initialize backend and frontend environments automatically.
ββββββββββββββββββββββββ ββββββββββββββββββββββββββ ββββββββββββββββββββββββββ
β User Client β ββββββ> β Vite / React Frontend β ββββββ> β FastAPI Backend β
β (Image Upload / Drop)β β (Port 5173) β β (Port 8000) β
ββββββββββββββββββββββββ ββββββββββββββββββββββββββ βββββββββββββ¬βββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ βββββββββββββββββββββββββ
β Output Payload β <βββββββ β YOLOv8 Inference β
β - Total Vehicle Count β β - Object Detection β
β - Per-Class Quantities β β - Classification β
β - Coordinate Bounding Boxes [x1, y1, x2, y2] β β - Confidence Scores β
β - Annotated Visualization Image β β - Bounding Box Math β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ βββββββββββββββββββββββββ
VEHIX/
βββ backend/
β βββ models/
β β βββ yolov8n.pt # Pretrained YOLOv8 weights (COCO)
β βββ results/ # Generated annotated outputs
β βββ uploads/ # Temporary uploaded source images
β βββ __init__.py
β βββ counter.py # Class counting and aggregation utilities
β βββ detector.py # Ultralytics YOLO detector wrapper and CV2 annotation
β βββ main.py # FastAPI endpoints and static mounts
β βββ requirements.txt # Python dependencies
β
βββ frontend/
β βββ public/
β β βββ samples/ # Demonstration images for instant testing
β βββ src/
β β βββ components/
β β β βββ AnnotatedImage.tsx # Image viewer with fullscreen & table view
β β β βββ ResultDashboard.tsx # Analytics summary, donut chart, and stats
β β β βββ UploadArea.tsx # Drag-and-drop file upload with sample loader
β β βββ App.tsx # Main application state and connectivity polling
β β βββ index.css # Tailwind base directives and custom design tokens
β β βββ main.tsx # React DOM mount point
β βββ index.html # HTML template with Google Fonts
β βββ package.json # Node.js dependencies and build scripts
β βββ postcss.config.js # PostCSS configuration
β βββ tailwind.config.js # Tailwind CSS theme configuration
β βββ tsconfig.json # TypeScript compiler configuration
β βββ vite.config.ts # Vite configuration with backend proxy
β
βββ training/
β βββ train.py # Custom YOLO dataset training script
β
βββ .env.example # Environment variables template
βββ .gitignore # Version control exclusion rules
βββ full-setup.ps1 # Automated installation and launch script
βββ setup-and-run.ps1 # One-click Windows runner
βββ README.md # Project documentation
Ensure you have the following installed on your machine:
- Python: Version
3.10,3.11, or3.12(recommended for PyTorch wheel compatibility). - Node.js: Version
18.0.0or higher (v20+recommended). - Git
Open PowerShell in the project root directory and run:
.\setup-and-run.ps1This script will automatically:
- Detect your Python runtime (preferring Python 3.12).
- Create the backend virtual environment in
backend/.venv. - Install backend dependencies via
piporuv. - Install frontend npm dependencies in
frontend/. - Launch the FastAPI Backend (
http://127.0.0.1:8000) and Vite Frontend (http://localhost:5173) in dedicated windows.
git clone https://github.com/ISBANDURAHUMAN-R/VEHIX.git
cd VEHIX# Create and activate virtual environment
python -m venv backend/.venv
# Windows:
backend\.venv\Scripts\activate
# Linux / macOS:
source backend/.venv/bin/activate
# Install dependencies
pip install --upgrade pip
pip install -r backend/requirements.txt
# Start FastAPI server
uvicorn backend.main:app --host 127.0.0.1 --port 8000 --reload- Backend API:
http://127.0.0.1:8000 - Swagger Documentation:
http://127.0.0.1:8000/docs
In a new terminal window:
cd frontend
# Install dependencies
npm install
# Start Vite dev server
npm run dev- Web Application:
http://localhost:5173
GET /api/healthResponse (200 OK):
{
"status": "healthy",
"version": "1.0.0"
}POST /api/detect
Content-Type: multipart/form-dataForm Data:
file: Image file (.jpg,.jpeg,.png,.webp, max 10MB)
Response (200 OK):
{
"total_vehicles": 3,
"counts": {
"car": 2,
"truck": 1
},
"detections": [
{
"class": "car",
"confidence": 0.9421,
"bbox": [120, 240, 310, 450]
},
{
"class": "car",
"confidence": 0.8875,
"bbox": [340, 260, 510, 430]
},
{
"class": "truck",
"confidence": 0.9124,
"bbox": [550, 180, 890, 520]
}
],
"result_image": "/results/4b85c2d1-9d2a-43cf-9f1e-f3b14e912384.jpg"
}VEHIX uses the YOLOv8 Nano (yolov8n.pt) model optimized for high-speed inference on CPU and GPU devices. The detection pipeline specifically isolates and classifies the following vehicle categories:
| Class | Icon | Color Marker |
|---|---|---|
| Car | π | Cyan (#06b6d4) |
| Bus | π | Emerald (#10b981) |
| Truck | π | Amber (#f59e0b) |
| Motorcycle | ποΈ | Rose (#f43f5e) |
| Bicycle | π² | Purple (#8b5cf6) |
- Machine Learning: Ultralytics YOLOv8, OpenCV, NumPy
- Backend API: FastAPI, Uvicorn, Pydantic v2
- Frontend Framework: React 18, TypeScript
- Build Tool: Vite 5
- Styling: Tailwind CSS 3
- Charts & Data Visualization: Recharts, React Icons
Isbandu Rahuman R.
- AI & Data Science Developer
- Interested in Computer Vision, Machine Learning, and Full-Stack Engineering.
This project is licensed under the MIT License β free for educational and research use.
