Skip to main content

Distracted Driver Detection Project

Project description

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Distracted Driver Detection-0.0.3.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file Distracted Driver Detection-0.0.3.tar.gz.

File metadata

  • Download URL: Distracted Driver Detection-0.0.3.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for Distracted Driver Detection-0.0.3.tar.gz
Algorithm Hash digest
SHA256 b625f5db46c45e331ed846afcf252924d63510b9687edd131846aa8d15690da5
MD5 075b63a508f15c1cdcfaca164eb990ab
BLAKE2b-256 5215ed42b38b85ff67edf854aace491d520d21ef231ab7ad300ee11de8aae4f7

See more details on using hashes here.

File details

Details for the file Distracted_Driver_Detection-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: Distracted_Driver_Detection-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for Distracted_Driver_Detection-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3474077670cb3476595a69c0d6344750e78c282b8ad6bd25628dc685f5f69b27
MD5 ca5327a89ebafd48385b289a7bb16f1c
BLAKE2b-256 04025186f418488226033b9a52a2e68aaf900f32d637bdd484e4335c7fc18749

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page