This project implements a object detection system using YOLOv8 to identify persons and personal protective equipment (PPE) in various environments. The dataset consists of images and annotations for classes such as hard hats, gloves, masks, glasses, boots, vests, PPE suits, ear protectors, and safety harnesses. The goal is to train two models: one for detecting persons in whole images and another for detecting PPE in cropped images of persons.
- Installation
- Usage
- Scripts
- Annotation Conversion
- Model Training
- Inference
- Evaluation Metrics
- Report
- Demonstration Video
- License
- Python 3.8 or higher
- Git
- Virtual environment (recommended)
git clone https://github.com/YashrajKupekar17/Syook_person_and_ppe_detection
cd Syook_person_and_ppe_detection
python -m venv venv
source venv/bin/activate # On Windows use venv\Scripts\activate
pip install -r requirements.txt
Download the dataset from the provided link. Extract the contents of Datasets.zip, which contains the images and annotations directories along with classes.txt.
Run the following command to convert annotations from PascalVOC format to YOLOv8 format:
python pascalVOC_to_yolo.py --voc_dir path/to/annotations --yolo_dir path/to/yolov8_annotations
To train the YOLOv8 model for person detection, run:
python train.py --data data.yaml --weights yolov8.pt --cfg yolov8.yaml --epochs 50
To train the YOLOv8 model for PPE detection on cropped images, ensure you have implemented the logic to crop images based on the detected persons. Then run:
python train.py --data ppe_data.yaml --weights yolov8.pt --cfg yolov8.yaml --epochs 50
To perform inference using both models, run:
python inference.py --input_dir path/to/images --output_dir path/to/output --person_det_model path/to/person_weights.pt --ppe_detection_model path/to/ppe_weights.pt
The models will be evaluated using metrics such as:
Recall
F1 Score
Mean Average Precision (mAP)
A report containing the approaches, learning outcomes, and evaluation metrics is provided in PDF format. It includes:
Logic used for model training.
Challenges faced and solutions implemented.