Skip to content

vikas-tikapur/Smart_Safety_Monitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

31 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ›ก๏ธ Smart Safety Monitor

An AI-Powered Workplace Safety Monitoring System using Python, OpenCV, YOLOv8 and Tkinter Dashboard

Smart Safety Monitor is a modular Computer Vision application designed to improve workplace safety through real-time AI-powered surveillance.

The system continuously monitors live camera feeds and detects workplace safety violations using multiple YOLOv8 models.

It supports:

  • ๐Ÿ‘ค Person Detection
  • ๐Ÿ“ฑ Mobile Phone Detection
  • ๐Ÿช– Helmet Detection
  • ๐Ÿšซ No Helmet Detection
  • ๐Ÿฆบ Safety Vest Detection
  • ๐Ÿ”ซ Weapon Detection

Whenever a violation occurs, the application automatically:

  • ๐Ÿ“ธ Captures screenshots
  • ๐Ÿ“ Logs events into CSV
  • ๐Ÿ“Š Updates Dashboard Analytics
  • โšก Prevents duplicate alerts
  • ๐Ÿ“ˆ Displays live monitoring statistics

The project follows a modular software architecture, making it easy to extend with additional AI models such as Fire Detection, Intrusion Detection, PPE Compliance, and RTSP Camera Monitoring.


โœจ Features

๐ŸŽฏ AI Detection

  • Real-Time Person Detection
  • Mobile Phone Detection
  • Helmet Detection
  • No Helmet Detection
  • Safety Vest Detection
  • Weapon Detection
  • Triple YOLOv8 Model Architecture

๐Ÿ“Š Live Monitoring

  • Live Webcam Monitoring
  • Professional Status Panel
  • Live Person Counter
  • Live Mobile Counter
  • Live Helmet Counter
  • Live No Helmet Counter
  • Live Safety Vest Counter
  • Live Weapon Counter
  • Live FPS Counter
  • Live Date & Time

๐Ÿšจ Violation Management

  • Mobile Violation Detection
  • No Helmet Violation Detection
  • Weapon Violation Detection
  • Frame-Based Event Confirmation
  • Duplicate Event Prevention
  • Modular Violation Manager

๐Ÿ“ธ Evidence Collection

  • Automatic Screenshot Capture
  • Timestamped Image Saving
  • Organized Screenshot Folder
  • Event-wise Screenshot Naming

๐Ÿ“ Event Logging

  • CSV Event Logging
  • Event Timestamp
  • Person Count
  • Mobile Count
  • Helmet Count
  • No Helmet Count
  • Vest Count
  • Weapon Count
  • Screenshot Name

๐Ÿ“Š Dashboard

  • Tkinter Dashboard
  • Live Statistics
  • Latest Event Viewer
  • Latest Screenshot Viewer
  • Dashboard Auto Refresh
  • Event Analytics
  • CSV-based Monitoring

๐Ÿ—๏ธ Software Architecture

  • Modular Python Project
  • Object-Oriented Design
  • Multiple AI Model Support
  • Event Manager
  • Violation Manager
  • Screenshot Manager
  • Logger Module
  • Reusable Drawing Module
  • Clean Code Structure

๐Ÿ“‚ Project Structure

Smart_Safety_Monitor/

โ”‚
โ”œโ”€โ”€ dashboard/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ analytics.py
โ”‚   โ””โ”€โ”€ dashboard.py
โ”‚
โ”œโ”€โ”€ docs/
โ”‚   โ””โ”€โ”€ images/
โ”‚
โ”œโ”€โ”€ logs/
โ”‚
โ”œโ”€โ”€ models/
โ”‚   โ”œโ”€โ”€ coco/
โ”‚   โ”œโ”€โ”€ ppe/
โ”‚   โ””โ”€โ”€ weapon/
โ”‚
โ”œโ”€โ”€ output/
โ”œโ”€โ”€ screenshots/
โ”œโ”€โ”€ videos/
โ”‚
โ”œโ”€โ”€ utils/
โ”‚   โ”œโ”€โ”€ camera.py
โ”‚   โ”œโ”€โ”€ constants.py
โ”‚   โ”œโ”€โ”€ date_time.py
โ”‚   โ”œโ”€โ”€ detector.py
โ”‚   โ”œโ”€โ”€ drawing.py
โ”‚   โ”œโ”€โ”€ event_manager.py
โ”‚   โ”œโ”€โ”€ fps.py
โ”‚   โ”œโ”€โ”€ logger.py
โ”‚   โ”œโ”€โ”€ mobile_detector.py
โ”‚   โ”œโ”€โ”€ ppe_detector.py
โ”‚   โ”œโ”€โ”€ screenshot.py
โ”‚   โ”œโ”€โ”€ violation_manager.py
โ”‚   โ””โ”€โ”€ weapon_detector.py
โ”‚
โ”œโ”€โ”€ main.py
โ”œโ”€โ”€ test_ppe_model.py
โ”œโ”€โ”€ test_ppe_video.py
โ”œโ”€โ”€ test_weapon_model.py
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ README.md
โ””โ”€โ”€ .gitignore

๐Ÿ› ๏ธ Tech Stack

Programming Language

  • Python 3.10

Computer Vision

  • OpenCV

Deep Learning

  • YOLOv8 (Ultralytics)

Framework

  • PyTorch

Dashboard

  • Tkinter

Data Processing

  • Pandas
  • NumPy

Visualization

  • OpenCV Drawing API

Logging

  • CSV

Version Control

  • Git
  • GitHub

๐Ÿš€ Installation

1๏ธโƒฃ Clone the Repository

git clone https://github.com/vikas-tikapur/Smart_Safety_Monitor.git

cd Smart_Safety_Monitor

2๏ธโƒฃ Create a Virtual Environment

py -3.10 -m venv venv

3๏ธโƒฃ Activate the Virtual Environment

Windows PowerShell

.\venv\Scripts\Activate.ps1

Windows Command Prompt

venv\Scripts\activate

4๏ธโƒฃ Install Required Packages

pip install -r requirements.txt

โ–ถ๏ธ Running the Application

Start Smart Safety Monitor

python main.py

Open Dashboard

python -m dashboard.dashboard

Test PPE Model

python test_ppe_model.py

Test PPE Video

python test_ppe_video.py

Test Weapon Detection Model

python test_weapon_model.py

๐Ÿค– AI Models

The project uses multiple YOLOv8 models for different detection tasks.

Model Purpose Status
YOLOv8 COCO Person Detection โœ…
YOLOv8 COCO Mobile Phone Detection โœ…
PPE YOLOv8 Helmet Detection โœ…
PPE YOLOv8 No Helmet Detection โœ…
PPE YOLOv8 Safety Vest Detection โœ…
Weapon YOLOv8 Weapon Detection โœ…

๐Ÿง  Detection Pipeline

Live Camera
      โ”‚
      โ–ผ
 Frame Capture
      โ”‚
      โ–ผ
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
YOLOv8 COCO Detector
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
      โ”‚
      โ”œโ”€โ”€ Person Detection
      โ””โ”€โ”€ Mobile Detection
      โ”‚
      โ–ผ
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
PPE YOLOv8 Detector
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
      โ”‚
      โ”œโ”€โ”€ Helmet
      โ”œโ”€โ”€ No Helmet
      โ””โ”€โ”€ Safety Vest
      โ”‚
      โ–ผ
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Weapon YOLOv8 Detector
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
      โ”‚
      โ””โ”€โ”€ Weapon Detection
      โ”‚
      โ–ผ
Violation Manager
      โ”‚
      โ–ผ
Event Manager
      โ”‚
      โ”œโ”€โ”€ Screenshot Manager
      โ”œโ”€โ”€ CSV Logger
      โ””โ”€โ”€ Dashboard

๐Ÿ“ˆ Current Progress

Module Status
Project Architecture โœ…
Modular Design โœ…
Camera Module โœ…
YOLOv8 COCO Detection โœ…
Person Detection โœ…
Mobile Detection โœ…
PPE Detection โœ…
Helmet Detection โœ…
No Helmet Detection โœ…
Safety Vest Detection โœ…
Weapon Detection โœ…
Drawing Module โœ…
Screenshot Manager โœ…
CSV Event Logging โœ…
Event Manager โœ…
Violation Manager โœ…
Dashboard โœ…
Dashboard Analytics โœ…
Live Counters โœ…
Auto Refresh โœ…
Documentation โœ…

๐Ÿ“Š Project Completion

Component Progress
Core Architecture 100%
AI Detection 100%
Dashboard 100%
Event Management 100%
Violation Management 100%
Documentation 100%
Code Cleanup 100%

๐ŸŽฏ Overall Completion

โ‰ˆ 98%

The remaining work consists of optional enterprise-level features such as:

  • RTSP Camera Support
  • Email Alerts
  • Audio Alarm
  • Multi-Camera Monitoring
  • AI Reports

These features are planned for future releases and are not required for Version 1.0.


๐Ÿ“ฆ Current Release

Version 1.0.0 Release Candidate (RC)

โœ” Completed

  • Triple YOLOv8 Model Architecture
  • Person Detection
  • Mobile Detection
  • PPE Detection
  • Weapon Detection
  • Live Monitoring Dashboard
  • Screenshot Capture
  • CSV Logging
  • Event Manager
  • Violation Manager
  • Professional Monitoring Panel
  • Live Statistics
  • Code Cleanup
  • Documentation

๐Ÿ—๏ธ System Architecture

                           Live Camera
                                โ”‚
                                โ–ผ
                        Video Frame Capture
                                โ”‚
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ–ผ                       โ–ผ                        โ–ผ
 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
 โ”‚ YOLOv8 COCO    โ”‚     โ”‚ PPE YOLOv8     โ”‚      โ”‚ Weapon YOLOv8  โ”‚
 โ”‚                โ”‚     โ”‚                โ”‚      โ”‚                โ”‚
 โ”‚ โ€ข Person       โ”‚     โ”‚ โ€ข Helmet       โ”‚      โ”‚ โ€ข Weapon       โ”‚
 โ”‚ โ€ข Mobile       โ”‚     โ”‚ โ€ข No Helmet    โ”‚      โ”‚                โ”‚
 โ”‚                โ”‚     โ”‚ โ€ข Safety Vest  โ”‚      โ”‚                โ”‚
 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
        โ”‚                       โ”‚                        โ”‚
        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                        โ–ผ
              Detection Aggregation
                        โ”‚
                        โ–ผ
               Violation Manager
                        โ”‚
                        โ–ผ
                 Event Manager
                        โ”‚
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ–ผ               โ–ผ                โ–ผ
 Screenshot      CSV Event Logger   Live Dashboard
   Manager                               โ”‚
                                         โ–ผ
                              Dashboard Analytics

๐Ÿ“ธ Project Preview

๐Ÿ–ฅ๏ธ Live Monitoring

Live Monitoring


๐Ÿ‘ท Helmet Detection

Helmet Detection


๐Ÿšซ No Helmet Detection

No Helmet Detection


๐Ÿ”ซ Weapon Detection

Weapon Detection


๐Ÿ“Š Dashboard

Dashboard


๐ŸŽฏ Project Goals

The primary objective of this project is to build a modular AI-powered workplace safety monitoring system capable of detecting safety violations in real time.

Current goals achieved:

  • โœ… Real-time workplace monitoring
  • โœ… Multi-model AI detection
  • โœ… Modular architecture
  • โœ… Event-based violation management
  • โœ… Automated screenshot capture
  • โœ… CSV event logging
  • โœ… Live monitoring dashboard
  • โœ… Professional code structure
  • โœ… Extensible architecture

๐Ÿš€ Future Roadmap

Version 1.1

  • RTSP/IP Camera Support
  • Video File Processing
  • Email Alerts
  • Audio Alarm
  • Dashboard Charts
  • Daily Reports
  • Better Dashboard UI

Version 1.2

  • Multi-Camera Monitoring
  • Face Recognition
  • Attendance System Integration
  • Fire Detection
  • Smoke Detection
  • Restricted Area Detection

Version 2.0

  • Cloud Dashboard
  • Web Application
  • User Authentication
  • AI Safety Reports
  • Database Integration
  • REST API
  • Docker Deployment
  • Edge AI Deployment

๐Ÿ’ผ Resume Highlights

This project demonstrates practical experience in:

  • Python Development
  • Computer Vision
  • Deep Learning
  • YOLOv8
  • OpenCV
  • Object-Oriented Programming
  • Modular Software Architecture
  • Event-Driven Programming
  • Dashboard Development
  • Real-Time Video Processing
  • AI-Based Workplace Safety Monitoring

โญ Why This Project?

This project is designed to simulate a real-world industrial safety monitoring solution.

It combines multiple AI models into a single modular application capable of monitoring workplace safety in real time while generating evidence, logs, and analytics.

The architecture is scalable and can easily be extended with additional AI models, making it suitable for future enterprise-level surveillance applications.


๐Ÿ‘จโ€๐Ÿ’ป Author

Vikas Mishra

AI / ML Developer | Python Developer | Computer Vision Enthusiast

Connect with Me


๐Ÿ“„ License

This project is intended for educational purposes and portfolio demonstration.

You are free to fork, learn from, and improve this project while giving appropriate credit.


๐Ÿค Contributing

Contributions are always welcome!

If you have ideas for improving this project:

  1. Fork the repository
  2. Create a new feature branch
git checkout -b feature-name
  1. Commit your changes
git commit -m "Add new feature"
  1. Push to your branch
git push origin feature-name
  1. Open a Pull Request

๐Ÿงช Tested On

  • Windows 11
  • Python 3.10
  • OpenCV
  • Ultralytics YOLOv8
  • PyTorch
  • Tkinter

๐Ÿ“Œ Project Statistics

Programming Language

  • Python

AI Models

  • YOLOv8 COCO
  • YOLOv8 PPE
  • YOLOv8 Weapon

Detection Modules

  • Person Detection
  • Mobile Detection
  • Helmet Detection
  • No Helmet Detection
  • Safety Vest Detection
  • Weapon Detection

Event System

  • Screenshot Manager
  • CSV Logger
  • Event Manager
  • Violation Manager

Dashboard

  • Live Monitoring
  • Analytics
  • Latest Events
  • Latest Screenshot
  • Auto Refresh

๐ŸŽ“ Learning Outcomes

This project helped in learning:

  • Object-Oriented Programming
  • Modular Software Development
  • OpenCV
  • YOLOv8 Integration
  • Multiple AI Model Integration
  • Event-Driven Programming
  • CSV Logging
  • Dashboard Development
  • Real-Time Computer Vision
  • Software Architecture Design
  • Git & GitHub Workflow
  • Debugging and Testing

๐Ÿ”ฎ Future Enhancements

  • RTSP Camera Support
  • Multi-Camera Monitoring
  • Email Notifications
  • Telegram Alerts
  • Audio Alarm
  • Fire Detection
  • Smoke Detection
  • PPE Compliance Reports
  • Cloud Dashboard
  • REST API
  • Docker Deployment
  • Database Integration
  • User Authentication

๐Ÿ† Project Highlights

โœ” Triple YOLOv8 Model Architecture

โœ” Real-Time Workplace Monitoring

โœ” AI-Based Safety Violation Detection

โœ” Modular Python Architecture

โœ” Automated Screenshot Capture

โœ” Event Logging

โœ” Dashboard Analytics

โœ” Professional Monitoring Panel

โœ” Live Statistics

โœ” Production-Ready Project Structure


๐Ÿ™ Acknowledgements

Special thanks to the open-source community and the developers behind:

  • Ultralytics YOLOv8
  • OpenCV
  • PyTorch
  • Pandas
  • NumPy

These libraries made it possible to build a real-time AI-powered workplace safety monitoring application.


โญ Support

If you found this project useful:

โญ Star this repository

๐Ÿด Fork this repository

๐Ÿ’ก Share your suggestions

๐Ÿค Contribute to future improvements


๐Ÿš€ Version

Smart Safety Monitor v1.0.0

Release Status

Release Candidate (RC)

Current Features:

  • โœ… Person Detection
  • โœ… Mobile Detection
  • โœ… Helmet Detection
  • โœ… No Helmet Detection
  • โœ… Safety Vest Detection
  • โœ… Weapon Detection
  • โœ… Screenshot Capture
  • โœ… CSV Logging
  • โœ… Dashboard Analytics
  • โœ… Event Manager
  • โœ… Violation Manager
  • โœ… Live Monitoring UI

๐Ÿ“ข Final Note

Smart Safety Monitor is a modular AI-powered workplace surveillance system developed to demonstrate real-world applications of Computer Vision, Deep Learning, and Software Engineering.

The project focuses on building a scalable, maintainable, and production-oriented architecture that can be extended with future AI modules and enterprise-grade monitoring capabilities.


โญ Thanks for Visiting โญ

If you like this project, don't forget to โญ Star the repository!

Made with โค๏ธ by Vikas Mishra

About

AI-powered Workplace Safety Monitoring System using Python, OpenCV, YOLOv8, and Tkinter for real-time Person, PPE, Mobile, and Weapon Detection.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages