This repository contains a system that uses YOLOv5 to detect faces and determines whether the person is awake or drowsy. The project includes the necessary code to set up the YOLOv5 environment and perform face detection.
The Face Drowsiness Detection System uses YOLOv5, a popular object detection model, to detect faces in images. After detecting the face, the system then applies a drowsiness detection algorithm to determine if the person in the image is awake or drowsy.
To run this project, you need the following dependencies:
- Python 3.x
- OpenCV (cv2)
- Torch
- Matplotlib
- NumPy
- TensorFlow (tf)
- YOLOv5
You can install the required packages using pip
:
pip install opencv-python torch matplotlib numpy tensorflow
- Clone the YOLOv5 Repository Follow these steps to set up and use the Face Drowsiness Detection System:
git clone https://github.com/ultralytics/yolov5
cd yolov5
- Install YOLOv5 Requirements
pip install -qr requirements.txt
-
Upload the Zip File Upload the zip file containing your face images to the Colab environment.
-
Extract the Zip File Extract the contents of the uploaded zip file to the "datasets" folder within the YOLOv5 directory.
-
Run the Face Drowsiness Detection Run the following command to start the face drowsiness detection process:
python train.py --img 640 --batch 16 --epochs 500 --data myface.yaml --weights yolov5m.pt --cache
The system will use YOLOv5 to detect faces in the provided images and determine whether the person is awake or drowsy.
The system utilizes a custom dataset of face images, which you need to provide in the uploaded zip file. It uses the YOLOv5m model architecture for face detection.
The accuracy of the drowsiness detection system depends on the quality and diversity of the provided face images. Ensure that the images contain clear and representative samples of both awake and drowsy faces for better results.
This project is licensed under the "Fck it, I don't care"