Giter Club home page Giter Club logo

sleepystatedetection's Introduction

Human State Detection System

This repository contains a set of scripts for training and running a real-time human state detection system (awake or sleepy) using the YOLOv5 model. When the system detects the "sleepy" state, it triggers an alarm melody to alert the user.

Key Files

  • main.py: The main script to run the real-time detection system.
  • take_pictures.py: Script to collect images from a webcam.
  • label_photos.py: Tool for labeling collected images and converting them into YOLO format.
  • custom_train.py: Script for training the model based on labeled data.

Setup and Installation

To get started, clone the repository and install the required dependencies:

git clone https://github.com/thebmf/SleepyStateDetection
cd SleepyStateDetection
pip install -r requirements.txt

Data Collection

Run take_pictures.py to collect images. This script will activate the webcam and automatically take 40 snapshots for each of the two states: awake and sleepy.

python take_pictures.py

Data Labeling

To label the collected images, use the label_photos.py script. It will open a tkinter-based interface where you can label the images. After labeling, this script will also convert the images into the YOLO format, preparing them for model training.

python label_photos.py

Model Training

After labeling and converting the images, run custom_train.py to train the model. It is recommended to use more than 100 epochs for the best results, but fewer can also be sufficient.

python custom_train.py

Running the Detection System

To run the system in real-time, execute main.py. The system will activate the webcam and start detecting the state. When the sleepy state is detected, an alarm melody will start playing.

python main.py

sleepystatedetection's People

Contributors

thebmf avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.