A real-time hardhat detection application that uses a YOLOv8 object detection model to identify whether construction workers are wearing safety helmets.
Model used: YOLOv8m Hard Hat Detection via Ultralytics.
- Detects hard hats in uploaded images or via camera feed.
- Returns bounding boxes and classification results.
- FastAPI backend serving the detection model.
- Next.js frontend for intuitive user interface.
- Support for multiple image formats (JPEG, PNG, WebP).
- Frontend: Next.js, React, Tailwind CSS
- Backend: FastAPI, Python 3.10+
- ML Model: YOLOv8 (Ultralytics)
- Deployment: Hugging Face Hub (for model), Docker-ready
Sample outputs from the hardhat detection application are available in the Results/ directory:
- initial-image.jpeg - Original test image
- annotated-image.png - Annotated output with detected helmets highlighted on the frontend dashboard
- ppe_safety_report.pdf - Detailed analysis report
Install uv by Astral: https://docs.astral.sh/uv/getting-started/installation/
install dependencies and run the backend with:
uv run fastapi devThe backend will be available at http://localhost:8000.
Navigate to the frontend directory:
cd ../frontendInstall dependencies:
npm installStart the development server:
npm run devThe frontend will be available at http://localhost:3000.