Malek-Messaoudi commited on
Commit
55c2d09
·
verified ·
1 Parent(s): a01fc74

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +77 -3
README.md CHANGED
@@ -1,3 +1,77 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Car Bounding Box Detection — Custom CNN From Scratch
2
+
3
+ This repository contains a **custom Convolutional Neural Network (CNN)** trained **from scratch** for **car bounding box detection** on the **Stanford Cars Dataset**.
4
+ The model predicts bounding boxes in normalized format: `[x_center, y_center, width, height]`.
5
+
6
+ ---
7
+
8
+ ## Features
9
+
10
+ - Custom CNN architecture built from scratch
11
+ - Bounding box regression only (no classification)
12
+ - Balanced dataset with per-class sampling
13
+ - Dataset split: **64% train, 16% validation, 20% test**
14
+ - Advanced image augmentation (flip, rotation, brightness, contrast, crop)
15
+ - Smooth L1 loss for bounding box regression
16
+ - Fully GPU-compatible training and inference
17
+
18
+ ---
19
+
20
+ ## Dataset
21
+
22
+ - **Source:** Stanford Cars Dataset (https://www.kaggle.com/datasets/eduardo4jesus/stanford-cars-dataset/data)
23
+ - **Annotations used:** Bounding boxes only
24
+ - Images resized to **416×416 pixels**
25
+
26
+ ---
27
+
28
+ ## Model Architecture
29
+
30
+ - Multiple convolutional blocks with BatchNorm and ReLU
31
+ - Dropout layers to prevent overfitting
32
+ - Fully connected regression head
33
+ - Sigmoid output to produce normalized coordinates
34
+ - Output format: `[x_center, y_center, width, height]`
35
+
36
+ ---
37
+
38
+ ## Training
39
+
40
+ - **Batch size:** 32
41
+ - **Optimizer:** AdamW
42
+ - **Loss function:** Smooth L1 (CIoU Loss)
43
+ - **Scheduler:** Cosine annealing LR
44
+ - Training monitored with best validation IoU checkpointing
45
+
46
+ ---
47
+
48
+ ## Inference
49
+
50
+ - The model can predict bounding boxes on any car image or video
51
+ - Input images must be preprocessed and resized to **416×416**
52
+ - Output: normalized `[x_center, y_center, width, height]` coordinates
53
+
54
+ ---
55
+
56
+ ## Example
57
+
58
+ ![detected_image212](https://cdn-uploads.huggingface.co/production/uploads/67bc31088cf27f32cbcf927f/h286qIktC-H5CkxuO-YvH.jpeg)
59
+
60
+ ## 📝 Citation
61
+
62
+ If you use this model, please cite:
63
+
64
+ ```bibtex
65
+ @misc{car-bbox-detection-2025,
66
+ title = {Car Bounding Box Detection — Custom CNN},
67
+ author = {Malek Messaoudi, Yassine Mhirsi},
68
+ year = {2025},
69
+ publisher = {Hugging Face},
70
+ howpublished = {\url{https://huggingface.co/Safe-Drive-TN/Car-detection-from-scratch}}
71
+ }
72
+
73
+ ```
74
+
75
+ ## license
76
+
77
+ license : MIT