D3-CNN is a simple Convolutional Neural Network (CNN) built from scratch using NumPy to detect driver distractions from images and videos. It’s an academic project designed to deeply understand how CNNs work internally — with no deep learning frameworks like PyTorch or TensorFlow used.
It is trained purely on CPU, and also features a Streamlit-based frontend for easy testing with image or video input.
| Input Image | Prediction |
|---|---|
Texting |
The CNN is simple and built from scratch using NumPy only:
self.layers = [
Conv2D(filters=32, kernel_size=3, in_channels=3, padding=1),
ReLU(),
MaxPool2D(),
Conv2D(filters=64, kernel_size=3, in_channels=32, padding=1),
ReLU(),
MaxPool2D(),
Flatten(),
Dense(input_size=16*16*64, output_size=128),
ReLU(),
Dense(input_size=128, output_size=NUM_CLASSES),
Softmax()
]Note: Please include the architecture diagram as
architecture.pngin 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
- Test Accuracy: ~75%
- Lightweight model for quick experimentation and learning
git clone https://github.com/AS-0167/D3-CNN.git
cd D3-CNNpip install -r requirements.txtYou can upload an image or a video and get distraction predictions.
streamlit run app.pyTo 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
