This project leverages Computer Vision and Deep Learning to automatically detect safe and unsafe workplace conditions.
It aims to enhance occupational safety, reduce human monitoring costs, and minimize compliance risks by using image classification models built on Convolutional Neural Networks (CNNs) and VGG16 architectures.
- Automate the detection of unsafe workplace environments.
- Improve compliance with occupational safety standards (e.g., OSHA).
- Reduce manual supervision costs and human error.
- Build a scalable, proactive monitoring solution that ensures employee safety.
Traditional workplace safety monitoring is manual, reactive, and error-prone, leading to:
- Increased accident rates and insurance costs.
- Legal penalties for non-compliance.
- Operational inefficiencies and reputational damage.
Use AI-powered computer vision to automatically classify images as:
- Safe (0)
- Unsafe (1)
This enables real-time monitoring using camera feeds integrated with AI-driven alerts.
| Attribute | Description |
|---|---|
| Total Images | 631 |
| Image Size | 200 × 200 pixels |
| Color Mode | RGB |
| Classes | Safe (320) / Unsafe (311) |
| Data Split | Train (70%), Validation (15%), Test (15%) |
All images were standardized and preprocessed with normalization and augmentation for better generalization.
- Data Cleaning – Validated consistency of labels and image counts.
- Normalization – Rescaled pixel values from 0–255 to 0–1.
- Grayscale Testing – Checked model performance on reduced dimensions.
- Augmentation – Used
ImageDataGeneratorwith:- Rotation (±20°)
- Width/Height shift (10%)
- Shear (10%)
- Zoom (10%)
- Horizontal & Vertical flips
- Dataset Splitting – Stratified split to maintain class balance.
- 3 Convolutional Layers + MaxPooling
- Activation: ReLU
- Optimizer: Adam (lr=0.001)
- Loss: Binary Cross-Entropy
- Accuracy ≈ 0.998
- Great baseline; strong generalization.
- Used pre-trained VGG16 on ImageNet (frozen convolutional layers)
- Fine-tuned classification head
- Accuracy / Precision / Recall / F1 = 1.0
- Faster convergence, high accuracy, minimal overfitting.
- Added dense layers (256 → 128 neurons) with Dropout(0.5)
- Reduced overfitting, improved stability
- Perfect metrics (1.0) across validation sets
- More robust generalization.
- Combined transfer learning, dropout, and augmentation.
- Most deployment-ready model.
- Accuracy, Precision, Recall, and F1 Score = 1.0
- Excellent performance on unseen data and real-world variability.
| Model | Architecture | Accuracy | Precision | Recall | F1 Score | Remarks |
|---|---|---|---|---|---|---|
| Model 1 | Simple CNN | 0.998 | 0.998 | 0.998 | 0.998 | Strong baseline |
| Model 2 | VGG16 Base | 1.0 | 1.0 | 1.0 | 1.0 | Transfer learning, fast convergence |
| Model 3 | VGG16 + FFNN | 1.0 | 1.0 | 1.0 | 1.0 | Dropout improves generalization |
| Model 4 | VGG16 + FFNN + Augmentation | 1.0 | 1.0 | 1.0 | 1.0 | Best deployment-ready model |
- Model 4 achieved perfect scores across training, validation, and test sets.
- Data augmentation improved robustness and reduced overfitting.
- Very few misclassifications, with high true positives and true negatives.
- Reliable detection of unsafe conditions in unseen workplace environments.
- Enhanced safety compliance and reduced accidents.
- Lower insurance and legal costs.
- Improved employee morale and corporate reputation.
- Automated surveillance reduces reliance on human monitoring.
- Continued accidents and injuries.
- Higher legal exposure and financial loss.
- Regulatory non-compliance and reputational harm.
- Adopt Model 4 for real-time safety monitoring.
- Pilot deployment in one facility before full rollout.
- Integrate with existing CCTV feeds and compliance dashboards.
- Establish continuous learning pipeline — retrain with new unsafe scenarios.
- Expand enterprise-wide after successful pilot.
- Increase dataset size with more diverse, real-world images.
- Incorporate video stream analysis for live safety detection.
- Test advanced architectures like ResNet, EfficientNet, or Vision Transformers.
- Add Explainable AI (XAI) modules for transparency (e.g., Grad-CAM heatmaps).
- Combine with IoT sensors for holistic safety monitoring.
📦 workplace-safety-cv/ ├── data/ # Dataset (.npy, .csv) ├── notebooks/ # Jupyter notebooks ├── models/ # Saved models (CNN, VGG16, etc.) ├── src/ │ ├── preprocess.py │ ├── train_cnn.py │ ├── train_vgg16.py │ └── evaluate.py ├── reports/ # Visualizations, EDA, results ├── requirements.txt └── README.md