avewright's picture
Add nameplate classifier model
3f2d6ef verified
---
language: en
tags:
- image-classification
- nameplate-detection
- industrial
- pytorch
- computer-vision
license: mit
datasets:
- kahua-ml/nameplate-classification
base_model: mobilenet_v2
pipeline_tag: image-classification
---
# Nameplate Classifier
## Model Description
This is a lightweight binary image classifier that determines whether an image contains a readable nameplate or not. The model is based on MobileNetV2 architecture and is optimized for industrial equipment nameplate detection.
## Model Details
- **Model Type**: Image Classification (Binary)
- **Architecture**: MobileNetV2 backbone with custom classifier
- **Framework**: PyTorch
- **Model Size**: ~9.4MB
- **Input Size**: 224x224 RGB images
- **Classes**:
- `no_nameplate` (0): Image does not contain a readable nameplate
- `has_nameplate` (1): Image contains a readable nameplate
## Training Data
The model was trained on the `kahua-ml/nameplate-classification` dataset, which contains:
- **Positive examples**: 3,456 images with nameplates from industrial equipment
- **Negative examples**: 826 images without nameplates from construction safety and industry datasets
- **Total**: 4,282 images
## Performance
- **Expected Accuracy**: 85-95%
- **Training Time**: ~10-15 minutes
- **Inference Speed**: Very fast (optimized for real-time applications)
## Usage
```python
import torch
import torchvision.transforms as transforms
from PIL import Image
# Load model
model = torch.load("model.pth", map_location='cpu')
model.eval()
# Prepare image
transform = transforms.Compose([
transforms.Resize((224, 224)),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225])
])
# Predict
image = Image.open("your_image.jpg")
input_tensor = transform(image).unsqueeze(0)
with torch.no_grad():
outputs = model(input_tensor)
probabilities = torch.nn.functional.softmax(outputs, dim=1)
predicted = torch.max(outputs, 1)[1].item()
confidence = probabilities[0][predicted].item()
result = "has_nameplate" if predicted == 1 else "no_nameplate"
print(f"Prediction: {result} (Confidence: {confidence:.3f})")
```
## Applications
- Industrial equipment documentation
- Asset management systems
- Quality control in manufacturing
- Automated inventory systems
## Limitations
- Optimized for industrial nameplates
- May not work well on severely damaged or obscured nameplates
- Requires clear, readable text on nameplates
## Training Details
- **Optimizer**: Adam
- **Loss Function**: CrossEntropyLoss
- **Epochs**: 5
- **Batch Size**: 32
- **Learning Rate**: 0.001
- **Data Augmentation**: Random horizontal flip, rotation, color jitter
## Model Architecture
```
LightweightNameplateClassifier(
(backbone): MobileNetV2(
(classifier): Sequential(
(0): Dropout(p=0.2)
(1): Linear(in_features=1280, out_features=128)
(2): ReLU()
(3): Dropout(p=0.3)
(4): Linear(in_features=128, out_features=2)
)
)
)
```
## Citation
If you use this model in your research, please cite:
```
@misc{kahua-nameplate-classifier,
title={Lightweight Nameplate Classifier},
author={Kahua ML Team},
year={2024},
howpublished={\url{https://huggingface.co/kahua-ml/nameplate-classifier}}
}
```