File size: 5,080 Bytes
a57f753
 
 
 
 
 
 
92f4032
 
 
 
 
 
 
 
 
 
 
 
a57f753
 
 
92f4032
a57f753
 
 
 
 
 
7d666f8
 
 
7342c76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92f4032
7342c76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e29b18b
7342c76
e29b18b
 
7342c76
ac41245
 
 
e29b18b
 
92f4032
7342c76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ac41245
 
7342c76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
---
license: apache-2.0
datasets:
- Smolry/HSRP_classification_data
language:
- en
metrics:
- name: F1
  type: f1
  value: 0.86
- name: Precision
  type: precision
  value: 0.87
- name: Recall
  type: recall
  value: 0.85
- name: Accuracy
  type: accuracy
  value: 0.87
base_model:
- google/efficientnet-b0


pipeline_tag: image-classification
tags:
- computer-vision
- license-plate
- hsrp
- traffic

library_name: pytorch

---
# HSRP Classification using EfficientNet-B0

## Model Overview

This model performs binary classification of vehicle license plate images.

Given a cropped license plate image, the model predicts whether the plate belongs to:

- HSRP
- Non-HSRP

The model forms the classification component of the Smart HSRP Detection and Violation Monitoring System.

---

## Problem Statement

Determine whether a detected vehicle license plate is an HSRP plate.

Input:
    License Plate Crop

Output:
    HSRP Probability

Decision:
    HSRP / Non-HSRP

---

## Pipeline Role

```text
Camera Frame
      ↓
Vehicle Detection
      ↓
License Plate Detection
      ↓
Plate Crop
      ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ EfficientNet-B0    β”‚
β”‚ HSRP Classifier    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           ↓
     HSRP Probability
           ↓
     Downstream Logic

```
---

## Scope

This model performs:

βœ“ HSRP Classification

This model does NOT perform:

βœ— Vehicle Detection
βœ— License Plate Detection
βœ— OCR
βœ— License Plate Recognition
βœ— Vehicle Tracking
βœ— Violation Decision Making

---

## Model Architecture

```text
Backbone:
    EfficientNet-B0

Initialization:
    ImageNet Pretrained Weights

Classifier Head:

Dropout(0.2)
        ↓
Linear(1280 β†’ 1)

Output:
    Binary Classification Logit

Activation:
    Sigmoid

Input Size:
    224 Γ— 224 RGB

```
---

## Dataset

Dataset Repository:

[![HSRP-Classification Dataset](https://img.shields.io/badge/Dataset-00000)](https://huggingface.co/datasets/Smolry/HSRP_classification_data)

Classes:

0 β†’ HSRP
1 β†’ Non-HSRP

---

## Training Procedure

### Preprocessing

Training:

- Resize (224 Γ— 224)
- ColorJitter
- RandomRotation (Β±5Β°)
- ImageNet Normalization

Validation / Test:

- Resize (224 Γ— 224)
- ImageNet Normalization

---

### Phase 1 – Classifier Training

```text
EfficientNet-B0
        ↓
Frozen Backbone
        ↓
Train Classifier Only

Optimizer:
    Adam

Learning Rate:
    1e-4

Epochs:
    5

Scheduler:
    ReduceLROnPlateau

```
---

### Phase 2 – Fine Tuning

```text
Load Best Phase-1 Checkpoint
        ↓
Unfreeze Final Feature Blocks
        ↓
Fine Tune Model

Optimizer:
    Adam

Learning Rate:
    1e-5

Epochs:
    20

Scheduler:
    ReduceLROnPlateau

```
---

## Evaluation

### Test Metrics

| Metric | Score |
|----------|----------|
| Accuracy | 87.47% |
| Precision | 87.92% |
| Recall | 85.85% |
| F1 Score | 86.87% |

Test Samples:
    439

---

## Confusion Matrix

![Confusion Matrix](evaluation/confusion_matrix.png)

---

## Training History

The model was trained in two stages:

1. Classifier training with the EfficientNet-B0 backbone frozen.
2. Fine-tuning of the final feature blocks.

| Phase 1 Loss | Phase 2 Loss |
| :---: | :---: |
| ![Phase 1](training/phase1_loss.png) | ![Phase 2](training/phase2_loss.png) |

The epoch-level training history is available in
[![Training Hisitory](https://img.shields.io/badge/Training_History-training__history.json-blue?logo=json&logoColor=white)](https://huggingface.co/Smolry/HSRP-classification/blob/main/training/training_history.json)

---

## Observations

Key observations discovered during evaluation:

- Model performs strong binary separation between classes.
- Errors primarily occur in visually ambiguous samples.
- Performance depends heavily on crop quality.
- Explainability analysis should be used to validate focus on plate regions.

---

## Limitations

- Binary classification only.
- Not evaluated on every Indian state.
- Performance may degrade on heavily blurred images.
- Sensitive to plate crop quality.
- Domain shift may affect performance.

---

## Future Improvements

Potential future work:

- Larger dataset
- Additional state coverage
- CCTV-specific training data
- Hard-negative mining
- Better augmentation
- Threshold optimization
- Calibration analysis
- Lightweight deployment models

---

## Files

```text
model/
└── efficientnet_b0_finetuned.pth

evaluation/
β”œβ”€β”€ metrics.json
β”œβ”€β”€ classification_report.txt
└── confusion_matrix.png

training/
β”œβ”€β”€ training_history.json
└── phase1_loss.png
└── phase2_loss.png

```
---

## Project Context

This model is one component of the larger Smart HSRP Detection and Violation Monitoring System.

Its sole responsibility is determining whether a cropped license plate image belongs to an HSRP or Non-HSRP category.

---

## Version History

### v1.0

- Initial EfficientNet-B0 implementation
- Two-stage training pipeline
- Binary HSRP classification

---