- Introduction
- Prerequisites
- Installation
- Usage
- Model Architecture (YOLOv8)
- Dataset
- Training
- Evaluation
- Results
- Deployment with Flask
- Future Improvements
The "Personal Protective Equipment Detection using YOLOv8" project aims to develop an efficient and accurate system to detect the presence of personal protective equipment (PPE) on individuals in various settings, such as construction sites, hospitals, or manufacturing facilities. The system utilizes the YOLOv8 object detection model, leveraging machine learning and computer vision techniques to automatically identify whether a person is wearing appropriate PPE, including items like helmets, masks, and safety vests.
Before using the application, ensure you have the following dependencies installed on your system:
- Python 3.6+
- Flask
- OpenCV
- Pytorch
- NumPy
- Matplotlib
To set up the project on your local machine, follow these steps:
- Clone the repository to your local machine using the following command:
https://github.com/KaedKazuha/Personal-Protective-Equipment-Detection-Yolov8/
- Change into the project directory:
cd your-repo
- Install the required Python packages using pip:
pip install -r requirements.txt
The application provides a user-friendly web interface for real-time PPE detection using images or videos. To use the application:
-
Run the Flask app using the following command:
python flaskapp.py
-
Open your web browser and navigate to
http://localhost:5000
. -
Upload an image or provide a link to a video for PPE detection.
-
Click the "Detect PPE" button to initiate the detection process.
-
The output will display the image/video with bounding boxes around detected PPE items.
Ultralytics YOLOv8 is a cutting-edge, state-of-the-art (SOTA) model that builds upon the success of previous YOLO versions and introduces new features and improvements to further boost performance and flexibility 1. YOLOv8 is designed to be fast, accurate, and easy to use, making it an excellent choice for a wide range of object detection and tracking, instance segmentation, image classification, and pose estimation tasks 1.
The PPE detection model was trained on a custom dataset containing images of individuals wearing different types of personal protective equipment. The dataset includes the following PPE categories:
- Hardhat
- NO-hardhat
- Mask
- NO-Mask
- Safety Vest
- NO-Safety Vest
- Person
- Gloves
- SUV
- Safety Cone
- Ladder
- Excavator
- bus
- dump truck
- fire hydrant
- machinery
- mini-van
- sedan
- semi
- trailer
- truck and trailer
- truck
- van
- vehicle
- wheel loader
The dataset consists of approximately 10,000 labeled samples, split into training and validation sets.
To train the YOLOv8 PPE detection model using the custom dataset:
- Preprocess the data, including resizing images and converting labels to YOLO format.
- Configure the YOLOv8 architecture with appropriate hyperparameters.
- Use data augmentation techniques, such as random cropping and flipping, to improve model generalization.
- Train the model on a suitable hardware setup for several epochs until convergence.
The model's performance was evaluated using several evaluation metrics, including:
The evaluation was conducted on the validation set, and the model achieved an mAP of 0.85 for PPE detection.
After training and evaluation, the YOLOv8 model demonstrated robust PPE detection capabilities. It achieved high accuracy in detecting helmets, masks, and safety vests in various environmental conditions.
Here is a visualization of the detection results on sample images:
The PPE detection model is deployed using Flask, providing a user-friendly web interface for real-time PPE detection. Flask enables seamless integration with the model, allowing users to upload images or provide links to videos and receive instant detection results through the web app.
While the current implementation has shown promising results, there are several avenues for future improvements:
- Expand the dataset to include a more diverse range of individuals, poses, and PPE types.
- Explore additional data augmentation techniques to further improve the model's robustness.
- Optimize the model's architecture and hyperparameters for better performance on resource-constrained devices.
Footnotes
-
More information about Ultralytics YOLOv8 can be found in the official GitHub repository: Ultralytics GitHub Repository. ↩ ↩2