<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Wrik Bhadra</title>
    <description>The latest articles on DEV Community by Wrik Bhadra (@mavewrik).</description>
    <link>https://dev.to/mavewrik</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F390259%2F4b8b7a2e-3e53-49bf-994e-30504159513e.jpeg</url>
      <title>DEV Community: Wrik Bhadra</title>
      <link>https://dev.to/mavewrik</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mavewrik"/>
    <language>en</language>
    <item>
      <title>Distracted Driver Detection</title>
      <dc:creator>Wrik Bhadra</dc:creator>
      <pubDate>Wed, 20 May 2020 08:27:51 +0000</pubDate>
      <link>https://dev.to/mavewrik/distracted-driver-detection-2627</link>
      <guid>https://dev.to/mavewrik/distracted-driver-detection-2627</guid>
      <description>&lt;h2&gt;
  
  
  Problem Statement
&lt;/h2&gt;

&lt;p&gt;Given dashboard images of drivers, our system aims to classify the driver on the basis of 10 predefined actions such as texting, reaching to the back etc. to detect distraction using Machine Learning (ML) and Deep Learning (DL) models.&lt;/p&gt;

&lt;h2&gt;
  
  
  Application
&lt;/h2&gt;

&lt;p&gt;With an aim of reducing road accidents, detection and prevention (say, by activating an alarm to notify the driver) of distracted driving can have a major impact in enhancing road safety.&lt;/p&gt;

&lt;h2&gt;
  
  
  Link to Kaggle challenge
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.kaggle.com/c/state-farm-distracted-driver-detection"&gt;https://www.kaggle.com/c/state-farm-distracted-driver-detection&lt;/a&gt; [Last accessed: May 20, 2020]&lt;/p&gt;

&lt;h2&gt;
  
  
  Dataset Description
&lt;/h2&gt;

&lt;p&gt;Out of the 22k labelled images, we had divided them into 70% training and 30% testing. Images belonging to the 10 classes were balanced to avoid bias in dataset.&lt;/p&gt;

&lt;h2&gt;
  
  
  Data Exploration
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rkXLIk81--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/cx67empppsieilnytpwl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rkXLIk81--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/cx67empppsieilnytpwl.png" alt="Exploring the data"&gt;&lt;/a&gt;&lt;br&gt;
Class labels along with their description, count and sample image&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hnG7O-Yx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ryvj41jomzevvei8wfz8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hnG7O-Yx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ryvj41jomzevvei8wfz8.png" alt="Class-wise data distribution"&gt;&lt;/a&gt;&lt;br&gt;
Class-wise data distribution. This was balanced by pruning extra samples from each class.&lt;/p&gt;

&lt;h2&gt;
  
  
  Activity Workflow
&lt;/h2&gt;

&lt;p&gt;Pre-processing =&amp;gt; Feature extraction =&amp;gt; Training =&amp;gt; Validation =&amp;gt; Prediction&lt;/p&gt;

&lt;h2&gt;
  
  
  Baseline Models
&lt;/h2&gt;

&lt;p&gt;Classical Machine Learning models including Support Vector Machines, Logistic Regression etc.&lt;/p&gt;

&lt;h2&gt;
  
  
  Feature Engineering
&lt;/h2&gt;

&lt;p&gt;We experimented with the following features:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Intensity value&lt;/li&gt;
&lt;li&gt;Histogram value&lt;/li&gt;
&lt;li&gt;Haar wavelets&lt;/li&gt;
&lt;li&gt;Histogram of Oriented Gradient (HOG)&lt;/li&gt;
&lt;li&gt;Local Binary Pattern (LBP)&lt;/li&gt;
&lt;li&gt;Features derived from pre-trained AlexNet model&lt;/li&gt;
&lt;li&gt;Features from pre-trained VGG-16 model&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Classifiers used
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Gaussian Naive Bayes (GNB)&lt;/li&gt;
&lt;li&gt;Logistic Regression (LR)&lt;/li&gt;
&lt;li&gt;Support Vector Machine (SVM)&lt;/li&gt;
&lt;li&gt;Multi-class Adaboost&lt;/li&gt;
&lt;li&gt;Bootstrap Aggregating (Bagging)&lt;/li&gt;
&lt;li&gt;VGG-16&lt;/li&gt;
&lt;li&gt;AlexNet&lt;/li&gt;
&lt;li&gt;Ensemble of AlexNet and VGG-16&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Results
&lt;/h2&gt;

&lt;p&gt;We found that upon using classical ML models, SVMs with RBF (Radial Basis Function) kernels gave the best accuracy of about 80% using Haar wavelets as features, whereas the ensemble of AlexNet and VGG-16 gave about 98% accuracy!&lt;br&gt;
The evaluation metric for the challenge was log-loss and our best performing model was LR with HOG feature (log-loss value: 2.02).&lt;/p&gt;

&lt;h2&gt;
  
  
  Confusion Matrix for Ensemble model
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VnycdZu4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fk2cpbw9uzgaxy56npc0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VnycdZu4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fk2cpbw9uzgaxy56npc0.png" alt="Confusion Matrix for Ensemble Model"&gt;&lt;/a&gt;&lt;br&gt;
For folks new to the concept of confusion matrix, think like this: the numbers along the principal diagonal state how many images were correctly classified. The more the better!&lt;/p&gt;

&lt;h2&gt;
  
  
  ROC curves for Ensemble model
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XYh6AOaw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/2c1ziz5c1zm0f25kd3tz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XYh6AOaw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/2c1ziz5c1zm0f25kd3tz.png" alt="Class-wise ROC curves for Ensemble Model"&gt;&lt;/a&gt;&lt;br&gt;
Receiving Operator Characteristic (ROC) curves like these demonstrate a model is performing quite well.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tools and Technologies
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Python&lt;/li&gt;
&lt;li&gt;Scikit-learn&lt;/li&gt;
&lt;li&gt;OpenCV&lt;/li&gt;
&lt;li&gt;PyTorch&lt;/li&gt;
&lt;li&gt;Scikit-image&lt;/li&gt;
&lt;li&gt;Seaborn&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Collaborators
&lt;/h2&gt;

&lt;p&gt;Wrik Bhadra, Suraj Pandey, Arjun Tyagi (IIIT Delhi)&lt;/p&gt;

&lt;p&gt;[Note]: We didn't yet push our project to Github and would be doing it soon.&lt;/p&gt;

&lt;h2&gt;
  
  
  Scope for improvement
&lt;/h2&gt;

&lt;p&gt;Accuracy of the system can perhaps be improved by segmenting the person and his/her action.&lt;/p&gt;

&lt;h2&gt;
  
  
  Additional Thoughts
&lt;/h2&gt;

&lt;p&gt;Maybe adding more layers to the DL models can improve the performance?&lt;/p&gt;

&lt;p&gt;[Final Note]: It was fun to dive deep into a Computer Vision project and collaborating with cool folks along the way!&lt;/p&gt;

</description>
      <category>octograd2020</category>
      <category>devgrad2020</category>
      <category>python</category>
      <category>machinelearning</category>
    </item>
  </channel>
</rss>
