Skip to main content

Distracted Driver Detection Package


Abstract

This project focuses on driver distraction activities detection via images, which is useful for vehicle accident precaution. We aim to build a high-accuracy classifiers to distinguish whether drivers is driving safely or experiencing a type of distraction activity.

Instructions to Install our Distracted Driver Detection Package

  1. Install:
pip install Distracted-Driver-Detection
  1. Download the Finetunned Model Weights
import gdown
PytorchURL   = 'https://drive.google.com/uc?id=1P9r7pCc-5eTmW4krT4GZ1F6w_miTtxJA'
TfLiteURL    = 'https://drive.google.com/uc?id=1WbZD6PMETHIH6oMj0bzyG3BoDUlyO2Ll'
PytorchModel = 'model_ft.pth'
TfLiteModel  = 'model.tflite'
gdown.download(PytorchURL, PytorchModel, quiet=False)
gdown.download(TfLiteURL, TfLiteModel, quiet=False)
  1. Import the DistractedDriverDetection_Utils from distracted_driver_detection :
from distracted_driver_detection import DistractedDriverDetection_Utils
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
  1. Detect The Distraction Class for the Driver Using Pytorch Weights:
# Run the Below Function by Input your image Path to get the outPut class and probability for the driver distraction class then show it
class_,pro = DistractedDriverDetection_Utils.PredictClass(imgPath)
print(class_,pro)
plt.imshow(mpimg.imread(imgPath));

# Plot Batch of Test Images from directory with Detection
DistractedDriverDetection_Utils.predMulti_images(test_img_dir,nImages=5)
  1. Detect The Distraction Class for the Driver Using Tesorflow Lite Model:
# Run the Below Function by Input your image Path to get the outPut class and probability for the driver distraction class then show it
class_,pro = DistractedDriverDetection_Utils.tfliteModel_Prediction(imgPath)
print(class_,pro)
plt.imshow(mpimg.imread(imgPath));

# Plot Batch of Test Images from directory with Detection
DistractedDriverDetection_Utils.tfliteModel_Plot(test_img_dir,nImages=5)

Metadata

Release files for Distracted-Driver-Detection 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Distracted-Driver-Detection 0.0.3
File Size Uploaded
Distracted Driver Detection-0.0.3.tar.gz 6.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Distracted-Driver-Detection 0.0.3
File Interpreter ABI Platform
Distracted_Driver_Detection-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 13.2 kB

Release files / Distracted Driver Detection-0.0.3.tar.gz

Download URL Distracted Driver Detection-0.0.3.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b625f5db46c45e331ed846afcf252924d63510b9687edd131846aa8d15690da5
BLAKE2b-256 checksum
How to use checksums
5215ed42b38b85ff67edf854aace491d520d21ef231ab7ad300ee11de8aae4f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.7.6

Release files / Distracted_Driver_Detection-0.0.3-py3-none-any.whl

Download URL Distracted_Driver_Detection-0.0.3-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3474077670cb3476595a69c0d6344750e78c282b8ad6bd25628dc685f5f69b27
BLAKE2b-256 checksum
How to use checksums
04025186f418488226033b9a52a2e68aaf900f32d637bdd484e4335c7fc18749
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.7.6

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page