D3-CNN-2 is a simplified version of the original D3-CNN — a Convolutional Neural Network (CNN) built entirely from scratch using NumPy to detect driver distractions from images and videos. Despite its simpler architecture, D3-CNN-2 achieves significantly higher test accuracy (86%) with just 11 epochs, compared to 78% after 40 epochs in the original.
This model is CPU-trained and features a Streamlit frontend for testing with image or video input.
Input Image | Prediction |
---|---|
Texting |
The architecture is even simpler than the original D3-CNN, yet more effective:
self.layers = [
Conv2D(filters=32, kernel_size=3, in_channels=3, padding=1),
ReLU(),
MaxPool2D(),
Flatten(),
Dense(input_size=16*16*32, output_size=128),
ReLU(),
Dense(input_size=128, output_size=NUM_CLASSES),
Softmax()
]
Note: Please include the architecture diagram as
architecture.png
in the project root directory.
- A mix of publicly available data and self-collected images.
- Download the dataset from this Google Drive link: 📎 Download Dataset
- Trained on CPU from scratch
- Epochs: 11
- Test Accuracy: ~86%
- Lightweight and fast-converging
git clone https://github.com/AS-0167/D3-CNN.git
cd D3-CNN
pip install -r requirements.txt
You can upload an image or a video and get distraction predictions.
streamlit run app.py
To retrain the model from scratch using the dataset:
-
Ensure dependencies are installed:
pip install -r requirements.txt
-
Run the training notebook:
jupyter notebook train-detect-distraction.ipynb
This project was created as a hands-on academic experiment to:
- Learn how CNNs work internally
- Understand forward and backward propagation using NumPy
- Handle dataset collection and preprocessing
- Build a mini deep learning pipeline without relying on big frameworks
No libraries like TensorFlow or PyTorch were used.
[AS-0167] 🧑🎓 Student, Enthusiastic Learner of Machine Learning & Computer Vision