Compare commits
7 Commits
bde3b97266
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c56b9285a | ||
|
|
f28aa1d53b | ||
|
|
66e153ff4a | ||
|
|
6f854a9d62 | ||
|
|
59f26a299c | ||
|
|
4f8c48c504 | ||
|
|
4d9bf5965b |
94
README.md
94
README.md
@@ -1,6 +1,92 @@
|
|||||||
# vehicle-classification
|
# Vehicle Classification — UTD Deep Learning Assessment
|
||||||
|
|
||||||
UTD Vehicle Classification Assessment Code
|
A Convolutional Neural Network (CNN) trained to classify 8 vehicle types:
|
||||||
|
**Bicycle, Bus, Car, Motorcycle, NonVehicles, Taxi, Truck, Van**
|
||||||
|
|
||||||
Download Zip and move to data/raw/
|
---
|
||||||
Extract zip into data/raw/vehicle_classification
|
|
||||||
|
## Requirements
|
||||||
|
- Python 3.11 (see `.python-version`)
|
||||||
|
- pip
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
### 1. Clone the repository
|
||||||
|
```bash
|
||||||
|
git clone https://git.keshavanand.net/KeshavAnandCode/vehicle-classification.git
|
||||||
|
cd utd-vehicle-classification
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Create and activate a virtual environment
|
||||||
|
```bash
|
||||||
|
python3.11 -m venv .venv
|
||||||
|
```
|
||||||
|
**Mac/Linux:**
|
||||||
|
```bash
|
||||||
|
source .venv/bin/activate
|
||||||
|
```
|
||||||
|
**Windows:**
|
||||||
|
```bash
|
||||||
|
.venv\Scripts\activate
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Install dependencies
|
||||||
|
```bash
|
||||||
|
pip install -r requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. Download the dataset
|
||||||
|
- Download `vehicle_classification.zip`
|
||||||
|
- Place and extract it so the structure looks exactly like this:
|
||||||
|
```
|
||||||
|
data/
|
||||||
|
└── raw/
|
||||||
|
└── vehicle_classification/
|
||||||
|
├── Bicycle/
|
||||||
|
├── Bus/
|
||||||
|
├── Car/
|
||||||
|
├── Motorcycle/
|
||||||
|
├── NonVehicles/
|
||||||
|
├── Taxi/
|
||||||
|
├── Truck/
|
||||||
|
└── Van/
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. Run the notebook
|
||||||
|
```bash
|
||||||
|
jupyter notebook notebooks/submission.ipynb
|
||||||
|
```
|
||||||
|
Once open: **Kernel → Restart & Run All**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Project Structure
|
||||||
|
```
|
||||||
|
utd-vehicle-classification/
|
||||||
|
├── notebooks/
|
||||||
|
│ ├── submission.ipynb ← main submission, run this
|
||||||
|
│ └── experiments/ ← exploratory notebooks (ignore)
|
||||||
|
├── data/
|
||||||
|
│ └── raw/
|
||||||
|
│ └── vehicle_classification/ ← dataset goes here
|
||||||
|
├── models/ ← saved model weights (auto-created on run)
|
||||||
|
├── results/ ← training curves (auto-created on run)
|
||||||
|
├── requirements.txt
|
||||||
|
└── README.md
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Expected Output
|
||||||
|
```
|
||||||
|
Final Train Accuracy : ~88%
|
||||||
|
Final Test Accuracy : ~82%
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
- Device is detected automatically — runs on NVIDIA GPU, Apple Silicon (MPS), or CPU with no code changes required
|
||||||
|
- `models/` and `results/` directories are created automatically when the notebook runs
|
||||||
685
notebooks/Final-Submission.ipynb
Normal file
685
notebooks/Final-Submission.ipynb
Normal file
File diff suppressed because one or more lines are too long
@@ -2,7 +2,7 @@
|
|||||||
"cells": [
|
"cells": [
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 2,
|
"execution_count": 1,
|
||||||
"id": "7a37220a",
|
"id": "7a37220a",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 3,
|
"execution_count": 2,
|
||||||
"id": "d318d1f0",
|
"id": "d318d1f0",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"import os\n",
|
"import os\n",
|
||||||
"\n",
|
"\n",
|
||||||
"data_dir = '../data/raw/vehicle_classification'\n",
|
"data_dir = '../../data/raw/vehicle_classification'\n",
|
||||||
"\n",
|
"\n",
|
||||||
"for class_name in os.listdir(data_dir):\n",
|
"for class_name in os.listdir(data_dir):\n",
|
||||||
" class_path = os.path.join(data_dir, class_name)\n",
|
" class_path = os.path.join(data_dir, class_name)\n",
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 4,
|
"execution_count": 3,
|
||||||
"id": "5604ace3",
|
"id": "5604ace3",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -110,7 +110,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 5,
|
"execution_count": 4,
|
||||||
"id": "3cedd586",
|
"id": "3cedd586",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -150,7 +150,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 6,
|
"execution_count": 5,
|
||||||
"id": "8f556b22",
|
"id": "8f556b22",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -184,7 +184,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 7,
|
"execution_count": 6,
|
||||||
"id": "37793c77",
|
"id": "37793c77",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -222,7 +222,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 8,
|
"execution_count": 7,
|
||||||
"id": "f68c1a25",
|
"id": "f68c1a25",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -257,7 +257,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 9,
|
"execution_count": 8,
|
||||||
"id": "e1539eaa",
|
"id": "e1539eaa",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -289,7 +289,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 10,
|
"execution_count": 9,
|
||||||
"id": "d1b7d9ca",
|
"id": "d1b7d9ca",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -347,7 +347,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 11,
|
"execution_count": 10,
|
||||||
"id": "54d11a04",
|
"id": "54d11a04",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
@@ -370,7 +370,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 12,
|
"execution_count": 11,
|
||||||
"id": "374d0590",
|
"id": "374d0590",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -378,16 +378,16 @@
|
|||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"Epoch 1: Loss=1.575, Accuracy=50.54%\n",
|
"Epoch 1: Loss=1.518, Accuracy=51.03%\n",
|
||||||
"Epoch 2: Loss=1.196, Accuracy=60.35%\n",
|
"Epoch 2: Loss=1.110, Accuracy=62.02%\n",
|
||||||
"Epoch 3: Loss=1.018, Accuracy=64.98%\n",
|
"Epoch 3: Loss=0.976, Accuracy=66.24%\n",
|
||||||
"Epoch 4: Loss=0.909, Accuracy=68.58%\n",
|
"Epoch 4: Loss=0.906, Accuracy=68.52%\n",
|
||||||
"Epoch 5: Loss=0.842, Accuracy=70.87%\n",
|
"Epoch 5: Loss=0.838, Accuracy=70.77%\n",
|
||||||
"Epoch 6: Loss=0.784, Accuracy=72.83%\n",
|
"Epoch 6: Loss=0.782, Accuracy=72.33%\n",
|
||||||
"Epoch 7: Loss=0.738, Accuracy=74.24%\n",
|
"Epoch 7: Loss=0.735, Accuracy=74.25%\n",
|
||||||
"Epoch 8: Loss=0.703, Accuracy=75.30%\n",
|
"Epoch 8: Loss=0.696, Accuracy=75.42%\n",
|
||||||
"Epoch 9: Loss=0.671, Accuracy=76.30%\n",
|
"Epoch 9: Loss=0.665, Accuracy=76.53%\n",
|
||||||
"Epoch 10: Loss=0.641, Accuracy=77.64%\n",
|
"Epoch 10: Loss=0.634, Accuracy=77.40%\n",
|
||||||
"Finished Training\n"
|
"Finished Training\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -425,12 +425,12 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 14,
|
"execution_count": 12,
|
||||||
"id": "2bf2b9a2",
|
"id": "2bf2b9a2",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"PATH = '../models/tutorial-cnn.pth'\n",
|
"PATH = '../../models/tutorial-cnn.pth'\n",
|
||||||
"torch.save(model.state_dict(), PATH)"
|
"torch.save(model.state_dict(), PATH)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -444,7 +444,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 15,
|
"execution_count": 13,
|
||||||
"id": "bc158602",
|
"id": "bc158602",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -452,7 +452,7 @@
|
|||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"Test Accuracy: 74.53%\n"
|
"Test Accuracy: 75.66%\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -474,7 +474,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 16,
|
"execution_count": 14,
|
||||||
"id": "8cc7ed40",
|
"id": "8cc7ed40",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -482,14 +482,14 @@
|
|||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"Accuracy for class: Bicycle is 43.5%\n",
|
"Accuracy for class: Bicycle is 73.6%\n",
|
||||||
"Accuracy for class: Bus is 53.8%\n",
|
"Accuracy for class: Bus is 65.1%\n",
|
||||||
"Accuracy for class: Car is 87.6%\n",
|
"Accuracy for class: Car is 86.2%\n",
|
||||||
"Accuracy for class: Motorcycle is 75.2%\n",
|
"Accuracy for class: Motorcycle is 55.7%\n",
|
||||||
"Accuracy for class: NonVehicles is 99.0%\n",
|
"Accuracy for class: NonVehicles is 99.3%\n",
|
||||||
"Accuracy for class: Taxi is 20.0%\n",
|
"Accuracy for class: Taxi is 32.9%\n",
|
||||||
"Accuracy for class: Truck is 13.9%\n",
|
"Accuracy for class: Truck is 24.8%\n",
|
||||||
"Accuracy for class: Van is 24.7%\n"
|
"Accuracy for class: Van is 22.9%\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
558
notebooks/experiments/02-tutorial-cnn-modified-vals.ipynb
Normal file
558
notebooks/experiments/02-tutorial-cnn-modified-vals.ipynb
Normal file
File diff suppressed because one or more lines are too long
558
notebooks/experiments/03-adam-optimizer.ipynb
Normal file
558
notebooks/experiments/03-adam-optimizer.ipynb
Normal file
File diff suppressed because one or more lines are too long
598
notebooks/experiments/04-batch-norm-dropout.ipynb
Normal file
598
notebooks/experiments/04-batch-norm-dropout.ipynb
Normal file
File diff suppressed because one or more lines are too long
620
notebooks/experiments/05-data-augmentation.ipynb
Normal file
620
notebooks/experiments/05-data-augmentation.ipynb
Normal file
File diff suppressed because one or more lines are too long
@@ -1,67 +1,8 @@
|
|||||||
asttokens==3.0.1
|
torch>=2.0.0
|
||||||
comm==0.2.3
|
torchvision>=0.15.0
|
||||||
contourpy==1.3.3
|
numpy>=1.24.0
|
||||||
cuda-bindings==12.9.4
|
matplotlib>=3.7.0
|
||||||
cuda-pathfinder==1.2.2
|
Pillow>=9.0.0
|
||||||
cuda-toolkit==12.8.1
|
scikit-learn>=1.0.0
|
||||||
cycler==0.12.1
|
jupyter>=1.0.0
|
||||||
debugpy==1.8.20
|
ipykernel>=6.0.0
|
||||||
decorator==5.2.1
|
|
||||||
executing==2.2.1
|
|
||||||
filelock==3.25.2
|
|
||||||
fonttools==4.62.1
|
|
||||||
fsspec==2026.2.0
|
|
||||||
ipykernel==7.2.0
|
|
||||||
ipython==9.10.0
|
|
||||||
ipython_pygments_lexers==1.1.1
|
|
||||||
jedi==0.19.2
|
|
||||||
Jinja2==3.1.6
|
|
||||||
jupyter_client==8.8.0
|
|
||||||
jupyter_core==5.9.1
|
|
||||||
kiwisolver==1.5.0
|
|
||||||
MarkupSafe==3.0.2
|
|
||||||
matplotlib==3.10.8
|
|
||||||
matplotlib-inline==0.2.1
|
|
||||||
mpmath==1.3.0
|
|
||||||
nest-asyncio==1.6.0
|
|
||||||
networkx==3.6.1
|
|
||||||
numpy==2.4.3
|
|
||||||
nvidia-cublas-cu12==12.8.4.1
|
|
||||||
nvidia-cuda-cupti-cu12==12.8.90
|
|
||||||
nvidia-cuda-nvrtc-cu12==12.8.93
|
|
||||||
nvidia-cuda-runtime-cu12==12.8.90
|
|
||||||
nvidia-cudnn-cu12==9.20.0.48
|
|
||||||
nvidia-cufft-cu12==11.3.3.83
|
|
||||||
nvidia-cufile-cu12==1.13.1.3
|
|
||||||
nvidia-curand-cu12==10.3.9.90
|
|
||||||
nvidia-cusolver-cu12==11.7.3.90
|
|
||||||
nvidia-cusparse-cu12==12.5.8.93
|
|
||||||
nvidia-cusparselt-cu12==0.7.1
|
|
||||||
nvidia-nccl-cu12==2.29.7
|
|
||||||
nvidia-nvjitlink-cu12==12.8.93
|
|
||||||
nvidia-nvshmem-cu12==3.4.5
|
|
||||||
nvidia-nvtx-cu12==12.8.90
|
|
||||||
packaging==26.0
|
|
||||||
parso==0.8.6
|
|
||||||
pexpect==4.9.0
|
|
||||||
pillow==12.1.1
|
|
||||||
platformdirs==4.9.4
|
|
||||||
prompt_toolkit==3.0.52
|
|
||||||
psutil==7.2.2
|
|
||||||
ptyprocess==0.7.0
|
|
||||||
pure_eval==0.2.3
|
|
||||||
Pygments==2.19.2
|
|
||||||
pyparsing==3.3.2
|
|
||||||
python-dateutil==2.9.0.post0
|
|
||||||
pyzmq==27.1.0
|
|
||||||
six==1.17.0
|
|
||||||
stack-data==0.6.3
|
|
||||||
sympy==1.14.0
|
|
||||||
torch==2.12.0.dev20260318+cu128
|
|
||||||
torchaudio==2.11.0.dev20260318+cu128
|
|
||||||
torchvision==0.26.0.dev20260318+cu128
|
|
||||||
tornado==6.5.5
|
|
||||||
traitlets==5.14.3
|
|
||||||
triton==3.6.0+git9844da95
|
|
||||||
typing_extensions==4.15.0
|
|
||||||
wcwidth==0.6.0
|
|
||||||
|
|||||||
BIN
results/training_curves.png
Normal file
BIN
results/training_curves.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 60 KiB |
Reference in New Issue
Block a user