Skip to content

dineshsutihar/Object-Detection-AI

Repository files navigation

ObjectAI

ObjectAI is a full-stack object-detection workspace built with Next.js, FastAPI, MongoDB, and Ultralytics YOLO. It supports secure sign-in, image uploads, live webcam detection, labeled training-data intake, health monitoring, and per-user activity history.

Stack

  • Next.js 15 App Router for the product UI and route handlers
  • FastAPI for the Python inference service
  • MongoDB + Mongoose for users and history logs
  • Ultralytics YOLO for object detection
  • Tailwind CSS + shadcn/ui for the interface

Features

  • Secure cookie-based authentication
  • Single-image object detection with confidence threshold control
  • Live webcam detection with frame sampling
  • Labeled dataset intake for future custom-model training
  • Searchable history filtered by type and status
  • Health endpoint that reports web, database, and model readiness

Local Setup

1. Install the frontend

npm install

2. Configure environment variables

Copy .env.example to .env.local and update the values:

MONGODB_URI=mongodb://127.0.0.1:27017/objectAI
JWT_SECRET=replace-me-with-a-long-random-string
PYTHON_BACKEND_URL=http://127.0.0.1:8000
ALLOWED_ORIGINS=http://localhost:3000,http://127.0.0.1:3000
YOLO_MODEL=yolo11n.pt

3. Install the Python backend

npm run setup-backend

4. Start both services

npm run dev:all

Or run them separately:

npm run dev
npm run dev:backend

5. Create your first account

Open http://localhost:3000/auth/register, create an account, then go to http://localhost:3000/detect.

Scripts

  • npm run dev: start the Next.js app
  • npm run dev:backend: start the FastAPI app
  • npm run dev:all: run frontend and backend together
  • npm run lint: run ESLint
  • npm run build: run the production build
  • npm run setup-backend: create the Python virtualenv and install backend dependencies

API Surface

  • POST /api/auth/register
  • POST /api/auth/login
  • POST /api/auth/logout
  • GET /api/auth/check
  • POST /api/detect
  • POST /api/detect-frame
  • POST /api/train
  • GET /api/history
  • GET /api/health

Notes

  • The training tab currently collects and forwards labeled image batches. It does not launch automated model training jobs on its own.
  • Large image previews are skipped when history rows are stored to avoid unnecessary MongoDB bloat.
  • The Python backend defaults to python-backend/yolo11n.pt, but you can override that with YOLO_MODEL.

Validation

The current production checks used for this repo are:

npm run lint
npm run build
python -m py_compile python-backend/app/main.py

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors