Skip to content

A Python-based tool designed to identify whether drivers in a set of images are wearing seat belts. Given a folder containing images, the application processes each image and generates a report indicating which drivers are wearing seat belts and which are not.

License

Notifications You must be signed in to change notification settings

vlalef/SafetyStrapAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SafetyStrapAI/README.md

Index

  1. Introduction
  2. Features
  3. Installation
  4. Usage
  5. Configuration
  6. Example
  7. Dependencies
  8. License
  9. Contact

Introduction

A Python-based tool designed to identify whether drivers in a set of images are wearing seat belts. Given a folder containing images, the application processes each image and generates a report indicating which drivers are wearing seat belts and which are not.

Features

  • Batch Processing: Processes multiple images in a single run.
  • Accurate Detection: Utilizes advanced machine learning models to ensure high accuracy.
  • Detailed Reports: Generates comprehensive reports of the results.
  • User-Friendly: Simple command-line interface for easy interaction.

Installation

  1. Clone the Repository:

    git clone https://github.com/vlalef/SafetyStrapAI.git
    cd SafetyStrapAI
  2. Create and Activate a Virtual Environment:

    python -m venv venv
    source venv/bin/activate
    
  3. Install Dependencies: Install the dependencies:

    pip install -r requirements.txt
    

Usage

  1. Prepare your dataset: Ensure that the images are organized into the appropriate directories under dataset/train and dataset/validation as it follows.

    dataset/ 
    ├── train/
    │   ├── with_seatbelt/
    │   │   ├── 1.jpg
    │   │   ├── 2.jpg
    │   │   ├── 3.jpg
    │   │   ├── 4.jpg
    │   │   ├── 5.jpg
    │   │   ├── 6.jpg
    │   │   ├── 7.jpg
    │   │   ├── 8.jpg
    │   │   ├── 9.jpg
    │   │   └── 10.jpg
    │   └── without_seatbelt/
    │       ├── 1.jpg
    │       ├── 2.jpg
    │       ├── 3.jpg
    │       ├── 4.jpg
    │       ├── 5.jpg
    │       ├── 6.jpg
    │       ├── 7.jpg
    │       ├── 8.jpg
    │       ├── 9.jpg
    │       └── 10.jpg
    └── validation/
        ├── with_seatbelt/
        │   ├── 1.jpg
        │   ├── 2.jpg
        │   ├── 3.jpg
        │   ├── 4.jpg
        │   └── 5.jpg
        └── without_seatbelt/
            ├── 1.jpg
            ├── 2.jpg
            ├── 3.jpg
            ├── 4.jpg
            └── 5.jpg
    
  2. Train the model:

    python train_model.py
    

    This command will train the model using the images in the train directory and validate it using images from the validation directory.

  3. Run the application:

    python safety_strap.py --input_folder ./dataset/validation --output_folder ./results --model ./models/seatbelt_detector.keras
    
  4. Review the Results:

    The application will generate a report in the specified output folder detailing which images contain drivers using seat belts and which do not.

    Example Report:

    image1.jpg: Using seat belt
    image2.jpg: Not using seat belt
    image3.jpg: Using seat belt
    

Configuration

The application can be configured via command-line arguments:

  • --input_folder: Path to the directory containing the images.
  • --output_folder: Path to the directory where results will be saved.
  • --model: (Optional) Path to a custom model file if you wish to use a different model.

Example:

python safety_strap.py --input_folder ./dataset/validation --output_folder ./results --model ./models/seatbelt_detector.keras

Dependencies

  • Python 3.9+
  • OpenCV
  • TensorFlow
  • NumPy
  • Keras
  • Pillow
  • SciPy

License

This project is licensed under the GPL-3.0 license. Se the LICENSE file for more details

Contact

LinkedIn

About

A Python-based tool designed to identify whether drivers in a set of images are wearing seat belts. Given a folder containing images, the application processes each image and generates a report indicating which drivers are wearing seat belts and which are not.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages