Update README.md
Browse files
README.md
CHANGED
|
@@ -12,15 +12,320 @@ metrics:
|
|
| 12 |
base_model:
|
| 13 |
- google/efficientnet-b0
|
| 14 |
|
| 15 |
-
# HSRP Classification Model
|
| 16 |
-
|
| 17 |
-
## Model Description
|
| 18 |
-
## This model is designed to classify High-Security Registration Plates (HSRP) from vehicle crop images.
|
| 19 |
-
|
| 20 |
pipeline_tag: image-classification
|
| 21 |
tags:
|
| 22 |
- computer-vision
|
| 23 |
- license-plate
|
| 24 |
- hsrp
|
| 25 |
- traffic
|
| 26 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
base_model:
|
| 13 |
- google/efficientnet-b0
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
pipeline_tag: image-classification
|
| 16 |
tags:
|
| 17 |
- computer-vision
|
| 18 |
- license-plate
|
| 19 |
- hsrp
|
| 20 |
- traffic
|
| 21 |
+
---
|
| 22 |
+
# HSRP Classification using EfficientNet-B0
|
| 23 |
+
|
| 24 |
+
## Model Overview
|
| 25 |
+
|
| 26 |
+
This model performs binary classification of vehicle license plate images.
|
| 27 |
+
|
| 28 |
+
Given a cropped license plate image, the model predicts whether the plate belongs to:
|
| 29 |
+
|
| 30 |
+
- HSRP
|
| 31 |
+
- Non-HSRP
|
| 32 |
+
|
| 33 |
+
The model forms the classification component of the Smart HSRP Detection and Violation Monitoring System.
|
| 34 |
+
|
| 35 |
+
---
|
| 36 |
+
|
| 37 |
+
## Problem Statement
|
| 38 |
+
|
| 39 |
+
Determine whether a detected vehicle license plate is an HSRP plate.
|
| 40 |
+
|
| 41 |
+
Input:
|
| 42 |
+
License Plate Crop
|
| 43 |
+
|
| 44 |
+
Output:
|
| 45 |
+
HSRP Probability
|
| 46 |
+
|
| 47 |
+
Decision:
|
| 48 |
+
HSRP / Non-HSRP
|
| 49 |
+
|
| 50 |
+
---
|
| 51 |
+
|
| 52 |
+
## Pipeline Role
|
| 53 |
+
|
| 54 |
+
```text
|
| 55 |
+
Camera Frame
|
| 56 |
+
β
|
| 57 |
+
Vehicle Detection
|
| 58 |
+
β
|
| 59 |
+
License Plate Detection
|
| 60 |
+
β
|
| 61 |
+
Plate Crop
|
| 62 |
+
β
|
| 63 |
+
ββββββββββββββββββββββββ
|
| 64 |
+
β EfficientNet-B0 β
|
| 65 |
+
β HSRP Classifier β
|
| 66 |
+
ββββββββββββ¬ββββββββββββ
|
| 67 |
+
β
|
| 68 |
+
HSRP Probability
|
| 69 |
+
β
|
| 70 |
+
Downstream Logic
|
| 71 |
+
|
| 72 |
+
```
|
| 73 |
+
---
|
| 74 |
+
|
| 75 |
+
## Scope
|
| 76 |
+
|
| 77 |
+
This model performs:
|
| 78 |
+
|
| 79 |
+
β HSRP Classification
|
| 80 |
+
|
| 81 |
+
This model does NOT perform:
|
| 82 |
+
|
| 83 |
+
β Vehicle Detection
|
| 84 |
+
β License Plate Detection
|
| 85 |
+
β OCR
|
| 86 |
+
β License Plate Recognition
|
| 87 |
+
β Vehicle Tracking
|
| 88 |
+
β Violation Decision Making
|
| 89 |
+
|
| 90 |
+
---
|
| 91 |
+
|
| 92 |
+
## Model Architecture
|
| 93 |
+
|
| 94 |
+
```text
|
| 95 |
+
Backbone:
|
| 96 |
+
EfficientNet-B0
|
| 97 |
+
|
| 98 |
+
Initialization:
|
| 99 |
+
ImageNet Pretrained Weights
|
| 100 |
+
|
| 101 |
+
Classifier Head:
|
| 102 |
+
|
| 103 |
+
Dropout(0.2)
|
| 104 |
+
β
|
| 105 |
+
Linear(1280 β 1)
|
| 106 |
+
|
| 107 |
+
Output:
|
| 108 |
+
Binary Classification Logit
|
| 109 |
+
|
| 110 |
+
Activation:
|
| 111 |
+
Sigmoid
|
| 112 |
+
|
| 113 |
+
Input Size:
|
| 114 |
+
224 Γ 224 RGB
|
| 115 |
+
|
| 116 |
+
```
|
| 117 |
+
---
|
| 118 |
+
|
| 119 |
+
## Dataset
|
| 120 |
+
|
| 121 |
+
Dataset Repository:
|
| 122 |
+
|
| 123 |
+
<HF_DATASET_LINK>
|
| 124 |
+
|
| 125 |
+
Classes:
|
| 126 |
+
|
| 127 |
+
0 β HSRP
|
| 128 |
+
1 β Non-HSRP
|
| 129 |
+
|
| 130 |
+
---
|
| 131 |
+
|
| 132 |
+
## Training Procedure
|
| 133 |
+
|
| 134 |
+
### Preprocessing
|
| 135 |
+
|
| 136 |
+
Training:
|
| 137 |
+
|
| 138 |
+
- Resize (224 Γ 224)
|
| 139 |
+
- ColorJitter
|
| 140 |
+
- RandomRotation (Β±5Β°)
|
| 141 |
+
- ImageNet Normalization
|
| 142 |
+
|
| 143 |
+
Validation / Test:
|
| 144 |
+
|
| 145 |
+
- Resize (224 Γ 224)
|
| 146 |
+
- ImageNet Normalization
|
| 147 |
+
|
| 148 |
+
---
|
| 149 |
+
|
| 150 |
+
### Phase 1 β Classifier Training
|
| 151 |
+
|
| 152 |
+
```text
|
| 153 |
+
EfficientNet-B0
|
| 154 |
+
β
|
| 155 |
+
Frozen Backbone
|
| 156 |
+
β
|
| 157 |
+
Train Classifier Only
|
| 158 |
+
|
| 159 |
+
Optimizer:
|
| 160 |
+
Adam
|
| 161 |
+
|
| 162 |
+
Learning Rate:
|
| 163 |
+
1e-4
|
| 164 |
+
|
| 165 |
+
Epochs:
|
| 166 |
+
5
|
| 167 |
+
|
| 168 |
+
Scheduler:
|
| 169 |
+
ReduceLROnPlateau
|
| 170 |
+
|
| 171 |
+
```
|
| 172 |
+
---
|
| 173 |
+
|
| 174 |
+
### Phase 2 β Fine Tuning
|
| 175 |
+
|
| 176 |
+
```text
|
| 177 |
+
Load Best Phase-1 Checkpoint
|
| 178 |
+
β
|
| 179 |
+
Unfreeze Final Feature Blocks
|
| 180 |
+
β
|
| 181 |
+
Fine Tune Model
|
| 182 |
+
|
| 183 |
+
Optimizer:
|
| 184 |
+
Adam
|
| 185 |
+
|
| 186 |
+
Learning Rate:
|
| 187 |
+
1e-5
|
| 188 |
+
|
| 189 |
+
Epochs:
|
| 190 |
+
20
|
| 191 |
+
|
| 192 |
+
Scheduler:
|
| 193 |
+
ReduceLROnPlateau
|
| 194 |
+
|
| 195 |
+
```
|
| 196 |
+
---
|
| 197 |
+
|
| 198 |
+
## Evaluation
|
| 199 |
+
|
| 200 |
+
### Test Metrics
|
| 201 |
+
|
| 202 |
+
| Metric | Score |
|
| 203 |
+
|----------|----------|
|
| 204 |
+
| Accuracy | 87.47% |
|
| 205 |
+
| Precision | 87.92% |
|
| 206 |
+
| Recall | 85.85% |
|
| 207 |
+
| F1 Score | 86.87% |
|
| 208 |
+
|
| 209 |
+
Test Samples:
|
| 210 |
+
439
|
| 211 |
+
|
| 212 |
+
---
|
| 213 |
+
|
| 214 |
+
## Confusion Matrix
|
| 215 |
+
|
| 216 |
+

|
| 217 |
+
|
| 218 |
+
---
|
| 219 |
+
|
| 220 |
+
## Training History
|
| 221 |
+
|
| 222 |
+
Training curves are available in:
|
| 223 |
+
|
| 224 |
+
training/
|
| 225 |
+
|
| 226 |
+
Contents:
|
| 227 |
+
|
| 228 |
+
- train_loss.png
|
| 229 |
+
- validation_loss.png
|
| 230 |
+
- learning_curve.png
|
| 231 |
+
|
| 232 |
+
---
|
| 233 |
+
|
| 234 |
+
## Explainability
|
| 235 |
+
|
| 236 |
+
Grad-CAM visualizations are provided to understand which image regions contribute most strongly to predictions.
|
| 237 |
+
|
| 238 |
+
Examples include:
|
| 239 |
+
|
| 240 |
+
- Correct HSRP predictions
|
| 241 |
+
- Correct Non-HSRP predictions
|
| 242 |
+
- False Positives
|
| 243 |
+
- False Negatives
|
| 244 |
+
|
| 245 |
+
Location:
|
| 246 |
+
|
| 247 |
+
explainability/
|
| 248 |
+
|
| 249 |
+
---
|
| 250 |
+
|
| 251 |
+
## Observations
|
| 252 |
+
|
| 253 |
+
Key observations discovered during evaluation:
|
| 254 |
+
|
| 255 |
+
- Model performs strong binary separation between classes.
|
| 256 |
+
- Errors primarily occur in visually ambiguous samples.
|
| 257 |
+
- Performance depends heavily on crop quality.
|
| 258 |
+
- Explainability analysis should be used to validate focus on plate regions.
|
| 259 |
+
|
| 260 |
+
---
|
| 261 |
+
|
| 262 |
+
## Limitations
|
| 263 |
+
|
| 264 |
+
- Binary classification only.
|
| 265 |
+
- Not evaluated on every Indian state.
|
| 266 |
+
- Performance may degrade on heavily blurred images.
|
| 267 |
+
- Sensitive to plate crop quality.
|
| 268 |
+
- Domain shift may affect performance.
|
| 269 |
+
|
| 270 |
+
---
|
| 271 |
+
|
| 272 |
+
## Future Improvements
|
| 273 |
+
|
| 274 |
+
Potential future work:
|
| 275 |
+
|
| 276 |
+
- Larger dataset
|
| 277 |
+
- Additional state coverage
|
| 278 |
+
- CCTV-specific training data
|
| 279 |
+
- Hard-negative mining
|
| 280 |
+
- Better augmentation
|
| 281 |
+
- Threshold optimization
|
| 282 |
+
- Calibration analysis
|
| 283 |
+
- Lightweight deployment models
|
| 284 |
+
|
| 285 |
+
---
|
| 286 |
+
|
| 287 |
+
## Files
|
| 288 |
+
|
| 289 |
+
```text
|
| 290 |
+
model/
|
| 291 |
+
βββ efficientnet_b0_finetuned.pth
|
| 292 |
+
|
| 293 |
+
evaluation/
|
| 294 |
+
βββ metrics.json
|
| 295 |
+
βββ classification_report.txt
|
| 296 |
+
βββ confusion_matrix.png
|
| 297 |
+
|
| 298 |
+
training/
|
| 299 |
+
βββ training_history.json
|
| 300 |
+
βββ training_config.yaml
|
| 301 |
+
|
| 302 |
+
explainability/
|
| 303 |
+
βββ gradcam_examples/
|
| 304 |
+
|
| 305 |
+
```
|
| 306 |
+
---
|
| 307 |
+
|
| 308 |
+
## Project Context
|
| 309 |
+
|
| 310 |
+
This model is one component of the larger Smart HSRP Detection and Violation Monitoring System.
|
| 311 |
+
|
| 312 |
+
Its sole responsibility is determining whether a cropped license plate image belongs to an HSRP or Non-HSRP category.
|
| 313 |
+
|
| 314 |
+
---
|
| 315 |
+
|
| 316 |
+
## Version History
|
| 317 |
+
|
| 318 |
+
### v1.0
|
| 319 |
+
|
| 320 |
+
- Initial EfficientNet-B0 implementation
|
| 321 |
+
- Two-stage training pipeline
|
| 322 |
+
- Binary HSRP classification
|
| 323 |
+
|
| 324 |
+
---
|
| 325 |
+
|
| 326 |
+
## Author
|
| 327 |
+
|
| 328 |
+
Aniket Behera
|
| 329 |
+
|
| 330 |
+
Computer Engineering
|
| 331 |
+
Smart HSRP Detection & Violation Monitoring System
|