A comprehensive web application for detecting and counting people in images using advanced computer vision techniques. The system provides real-time detection with a user-friendly interface and maintains a detailed history of all detection results.
- Person Detection System
- Table of content
- Features
- Architecture
- Project Structure
- Setup Instructions
- API Endpoints
- Technology Stack
- Cleaning Up
-
Image Upload: Easily upload images for people detection
-
Real-time Detection: Detects and counts people using advanced computer vision (YOLOv12)
-
Results Visualization: View detection results with bounding boxes around detected people
-
Detection History: Browse and filter previous detection results
-
Detailed Statistics: View information about each detection including timestamps and people count
-
Responsive UI: Works on desktop and mobile devices
The system consists of three main components:
- Frontend: Next.js application with Tailwind CSS for UI
- Backend: FastAPI service for business logic and database operations
- Detector: Specialized service for running ML-based people detection algorithms
All components are containerized using Docker for consistent deployment environments.
.
├── backend/ # FastAPI backend service
│ ├── app/ # Python application code
│ ├── Dockerfile # Docker configuration
│ └── requirements.txt # Python dependencies
├── detector/ # ML detection service
│ ├── app/ # Detection algorithms
│ ├── Dockerfile # Docker configuration
│ └── requirements.txt # Python dependencies
├── frontend/ # Next.js frontend application
│ ├── app/ # Next.js application directory
│ ├── public/ # Static assets
│ ├── src/ # Source code
│ └── Dockerfile # Docker configuration
├── uploads/ # Storage for uploaded images
├── results/ # Storage for detection results
├── docker-compose.dev.yml # Docker configuration for development
└── docker-compose.prod.yml # Docker configuration for production
- Docker and Docker Compose
- Task (optional, for running task commands)
1. Copy the environment template to create your environment file:
cp .env_template .env
2. Modify the .env
file if needed to adjust ports or configuration values:
Using Task
task run_dev
task run_prod
docker-compose -f docker-compose.dev.yml up
docker-compose -f docker-compose.prod.yml up
Using Task
task build_dev
task build_prod
docker-compose -f docker-compose.dev.yml up --build
docker-compose -f docker-compose.prod.yml up --build
- Access the web interface at http://localhost:3000 (default port)
- Upload an image using the upload interface
- View detection results showing people count and bounding boxes
- Browse detection history on the History page
- Filter history by date, people count, or filename
- Click on individual records to see detailed results
- Detection
POST /api/v1/detect
- Upload an image and detect people
- History
GET /api/history
- Get detection history recordsGET /api/history/:id
- Get details of a specific detection record
- Frontend: Next.js, React, Tailwind CSS
- Backend: FastAPI, SQLAlchemy
- Database: PostgreSQL
- ML/Computer Vision: YOLOv12
- Infrastructure: Docker, Docker Compose
To clean up containers and system resources:
task clean
or
docker-compose -f docker-compose.dev.yml down
docker-compose -f docker-compose.prod.yml down
docker system prune -f