# Real-Time drowsiness Detection with YOLOv5 and PyTorch
Identification of objects in an image considered a common assignment for the human brain, though not so trivial for a machine. Identification and localization of objects in photos is a computer vision task called ‘object detection’. One of the most popular algorithms to date for real-time object detection is YOLO (You Only Look Once).
In this project, we performed drowsiness detection to check whether a person is awake or drowsy, using the latest YOLOv5 implementation developed by Ultralytics.
## Prerequisites
- PyTorch
- Torchvision
- Torchaudio
- OpenCV
- Matplotlib
- Numpy
- ipywidgets
- PyQt5
- lxml
## Installation
1. Install the required dependencies by running the following command:
!pip3 install torch torchvision torchaudio
!pip install opencv-python matplotlib numpy ipywidgets
!pip install pyqt5==5.15.2 lxml
2. Clone the YOLOv5 repository by running:
!git clone https://github.com/ultralytics/yolov5
3. Navigate to the cloned directory:
cd yolov5
4. Install the requirements for YOLOv5:
!pip install -r requirements.txt
5. Clone the labelImg repository for image labeling:
!git clone https://github.com/tzutalin/labelImg.git
## Usage
1. Collect Images:
- Connect a webcam to your computer.
- Run the code to capture images for the specified labels ("awake" and "drowsy").
- Images will be saved in the "data/images" directory.
2. Label Images:
- Open the labelImg tool to label the collected images as "awake" or "drowsy".
- Save the labeled annotations as XML files.
3. Train the YOLOv5 Model:
- Run the training script with the specified parameters (image size, batch size, epochs, data configuration, weights, etc.).
- The model will be trained on the labeled images using the YOLOv5 architecture.
4. Load the Trained Model:
- Load the trained model weights for inference.
- Perform object detection on images or video streams.
![avatar](https://profile-avatar.csdnimg.cn/default.jpg!1)
hakesashou
- 粉丝: 7335
- 资源: 1736
最新资源
- springboot097大学生竞赛管理系统_zip.zip
- springboot096基于springboot的租房管理系统_zip.zip
- springboot092安康旅游网站的设计与实现_zip.zip
- springboot099大型商场应急预案管理系统_zip.zip
- springboot100精准扶贫管理系统_zip.zip
- 基于51单片机的温度报警器C程序设计及Proteus仿真报告:按键设置温度上下限,超限蜂鸣器报警功能实现,基于51单片机的温度报警器C程序设计及Proteus仿真报告:按键设置温度上下限,智能报警提醒
- springboot102基于web的音乐网站_zip.zip
- java项目之宠物诊所系统设计源码.zip
- springboot104学生网上请假系统设计与实现_zip.zip
- springboot113健身房管理系统_zip.zip
- springboot105基于保信息学科平台系统设计与实现_zip.zip
- springboot117基于SpringBoot的企业资产管理系统_zip.zip
- springboot118共享汽车管理系统_zip.zip
- springboot116基于java的教学辅助平台_zip.zip
- 高频方波电压注入模型:静止坐标下电流分量提取与无感速度矢量控制,高频方波电压注入模型:静坐标下电流分量提取与无感速度矢量控制技术,该模型在d轴注入高频的方波电压,在静止坐标下通过前后周期的电电流相应提
- log库,谷歌软件开发日志库
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)