avewright commited on
Commit
3f2d6ef
·
verified ·
1 Parent(s): e4e4692

Add nameplate classifier model

Browse files
Files changed (4) hide show
  1. README.md +128 -0
  2. config.json +19 -0
  3. model.pth +3 -0
  4. pytorch_model.bin +3 -0
README.md ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ tags:
4
+ - image-classification
5
+ - nameplate-detection
6
+ - industrial
7
+ - pytorch
8
+ - computer-vision
9
+ license: mit
10
+ datasets:
11
+ - kahua-ml/nameplate-classification
12
+ base_model: mobilenet_v2
13
+ pipeline_tag: image-classification
14
+ ---
15
+
16
+ # Nameplate Classifier
17
+
18
+ ## Model Description
19
+
20
+ 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.
21
+
22
+ ## Model Details
23
+
24
+ - **Model Type**: Image Classification (Binary)
25
+ - **Architecture**: MobileNetV2 backbone with custom classifier
26
+ - **Framework**: PyTorch
27
+ - **Model Size**: ~9.4MB
28
+ - **Input Size**: 224x224 RGB images
29
+ - **Classes**:
30
+ - `no_nameplate` (0): Image does not contain a readable nameplate
31
+ - `has_nameplate` (1): Image contains a readable nameplate
32
+
33
+ ## Training Data
34
+
35
+ The model was trained on the `kahua-ml/nameplate-classification` dataset, which contains:
36
+ - **Positive examples**: 3,456 images with nameplates from industrial equipment
37
+ - **Negative examples**: 826 images without nameplates from construction safety and industry datasets
38
+ - **Total**: 4,282 images
39
+
40
+ ## Performance
41
+
42
+ - **Expected Accuracy**: 85-95%
43
+ - **Training Time**: ~10-15 minutes
44
+ - **Inference Speed**: Very fast (optimized for real-time applications)
45
+
46
+ ## Usage
47
+
48
+ ```python
49
+ import torch
50
+ import torchvision.transforms as transforms
51
+ from PIL import Image
52
+
53
+ # Load model
54
+ model = torch.load("model.pth", map_location='cpu')
55
+ model.eval()
56
+
57
+ # Prepare image
58
+ transform = transforms.Compose([
59
+ transforms.Resize((224, 224)),
60
+ transforms.ToTensor(),
61
+ transforms.Normalize(mean=[0.485, 0.456, 0.406],
62
+ std=[0.229, 0.224, 0.225])
63
+ ])
64
+
65
+ # Predict
66
+ image = Image.open("your_image.jpg")
67
+ input_tensor = transform(image).unsqueeze(0)
68
+
69
+ with torch.no_grad():
70
+ outputs = model(input_tensor)
71
+ probabilities = torch.nn.functional.softmax(outputs, dim=1)
72
+ predicted = torch.max(outputs, 1)[1].item()
73
+ confidence = probabilities[0][predicted].item()
74
+
75
+ result = "has_nameplate" if predicted == 1 else "no_nameplate"
76
+ print(f"Prediction: {result} (Confidence: {confidence:.3f})")
77
+ ```
78
+
79
+ ## Applications
80
+
81
+ - Industrial equipment documentation
82
+ - Asset management systems
83
+ - Quality control in manufacturing
84
+ - Automated inventory systems
85
+
86
+ ## Limitations
87
+
88
+ - Optimized for industrial nameplates
89
+ - May not work well on severely damaged or obscured nameplates
90
+ - Requires clear, readable text on nameplates
91
+
92
+ ## Training Details
93
+
94
+ - **Optimizer**: Adam
95
+ - **Loss Function**: CrossEntropyLoss
96
+ - **Epochs**: 5
97
+ - **Batch Size**: 32
98
+ - **Learning Rate**: 0.001
99
+ - **Data Augmentation**: Random horizontal flip, rotation, color jitter
100
+
101
+ ## Model Architecture
102
+
103
+ ```
104
+ LightweightNameplateClassifier(
105
+ (backbone): MobileNetV2(
106
+ (classifier): Sequential(
107
+ (0): Dropout(p=0.2)
108
+ (1): Linear(in_features=1280, out_features=128)
109
+ (2): ReLU()
110
+ (3): Dropout(p=0.3)
111
+ (4): Linear(in_features=128, out_features=2)
112
+ )
113
+ )
114
+ )
115
+ ```
116
+
117
+ ## Citation
118
+
119
+ If you use this model in your research, please cite:
120
+
121
+ ```
122
+ @misc{kahua-nameplate-classifier,
123
+ title={Lightweight Nameplate Classifier},
124
+ author={Kahua ML Team},
125
+ year={2024},
126
+ howpublished={\url{https://huggingface.co/kahua-ml/nameplate-classifier}}
127
+ }
128
+ ```
config.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "LightweightNameplateClassifier"
4
+ ],
5
+ "model_type": "image-classification",
6
+ "num_classes": 2,
7
+ "id2label": {
8
+ "0": "no_nameplate",
9
+ "1": "has_nameplate"
10
+ },
11
+ "label2id": {
12
+ "no_nameplate": 0,
13
+ "has_nameplate": 1
14
+ },
15
+ "image_size": 224,
16
+ "backbone": "mobilenet_v2",
17
+ "framework": "pytorch",
18
+ "task": "image-classification"
19
+ }
model.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a7976def7f4d156f56251a1e661fa73f0603ea674f5e6c74ee8218772bd97429
3
+ size 9813242
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:531e5aeca5016aa40ad162d7fbb635edacb03b790ff60b820d4afb8055167135
3
+ size 9799674