HSRP-classification / README.md
Smolry's picture
Update README.md
7d666f8 verified
|
Raw
History Blame Contribute Delete
5.08 kB
---
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
---