Updated model card
Browse files
README.md
CHANGED
|
@@ -1,3 +1,55 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
# Model Card: Chinese Calligraphy Character Classifier (ResNet50-based)
|
| 6 |
+
|
| 7 |
+
## Model Details
|
| 8 |
+
- Architecture: ResNet50 pretrained on ImageNet + custom classifier head
|
| 9 |
+
- Classes: 1200 Chinese calligraphy characters
|
| 10 |
+
- Input: 224x224 RGB images (grayscale converted to RGB)
|
| 11 |
+
- Framework: PyTorch
|
| 12 |
+
|
| 13 |
+
## Intended Use
|
| 14 |
+
- Handwritten Chinese calligraphy OCR and recognition
|
| 15 |
+
- For research, cultural preservation, and academic purposes
|
| 16 |
+
|
| 17 |
+
## Dataset
|
| 18 |
+
- EthicalSplit5508v3
|
| 19 |
+
- Train: 60,168 images | Val: 1,200 | Test: 1,200
|
| 20 |
+
- 1200 classes with fixed splits
|
| 21 |
+
|
| 22 |
+
## Training
|
| 23 |
+
- Batch size: 64, Learning rate: 3e-5 with OneCycleLR scheduler
|
| 24 |
+
- Epochs: up to 50, early stopping enabled
|
| 25 |
+
- Optimizer: Adam with weight decay 1e-4
|
| 26 |
+
- Loss: Cross-entropy with label smoothing (0.1)
|
| 27 |
+
|
| 28 |
+
## Performance
|
| 29 |
+
- Validation loss reduced from ~5.7 to ~1.06
|
| 30 |
+
- Test accuracy: ~88%+
|
| 31 |
+
- Model size: ~25M parameters
|
| 32 |
+
|
| 33 |
+
## Limitations
|
| 34 |
+
- May underperform on unseen handwriting styles or poor image quality
|
| 35 |
+
- Uses RGB input; grayscale-specific training not applied
|
| 36 |
+
- Dataset biases may affect generalization
|
| 37 |
+
|
| 38 |
+
## Ethical Considerations
|
| 39 |
+
- Dataset complies with ethical usage; no PII involved
|
| 40 |
+
- Intended for cultural and academic use only
|
| 41 |
+
|
| 42 |
+
## Usage Example
|
| 43 |
+
```python
|
| 44 |
+
model = ChineseClassifier(embed_dim=512, num_classes=1200, pretrainedEncoder=True, unfreezeEncoder=True)
|
| 45 |
+
checkpoint = torch.load("best_checkpoint.pth", map_location=device)
|
| 46 |
+
model.load_state_dict(checkpoint["model_state_dict"])
|
| 47 |
+
model.eval()
|
| 48 |
+
|
| 49 |
+
transform = CalligraphyCharacterDataset.defaultTransform()
|
| 50 |
+
img = Image.open("path_to_image.jpg").convert("RGB")
|
| 51 |
+
input_tensor = transform(img).unsqueeze(0).to(device)
|
| 52 |
+
|
| 53 |
+
outputs = model(input_tensor)
|
| 54 |
+
pred_idx = torch.argmax(outputs, dim=1).item()
|
| 55 |
+
pred_char = idx2char[pred_idx]
|