Downloads · 30 days
0
DungHugging/vietocr-handwritten-finetune
vietocr-handwritten-finetune is a machine learning model from DungHugging. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
Downloads · 30 days
0
Access
Public
Updated Feb 16, 2026
Repo size
152 MB
Likes
0
Public
Click a slice to open those files.
.pth152 MB · 100%
From the Hugging Face model README
This is a fine-tuned VietOCR model specifically optimized for Vietnamese handwritten text recognition. The model is based on VGG Transformer architecture and has been trained on the UIT_HWDB_line dataset, which contains real Vietnamese handwritten text samples.
Best for: Recognizing handwritten Vietnamese text from images (line-level OCR)
Evaluated on UIT_HWDB validation set (702 samples):
| Metric | Score | Description |
|---|---|---|
| Character Error Rate (CER) | 4.01% | Average character-level error (lower is better) |
| Word Error Rate (WER) | 11.02% | Average word-level error (lower is better) |
| Exact Match Accuracy | 34.76% | Percentage of perfectly predicted lines |
Ground Truth: "Nước ta giáp với biển Đông ở hai phía Đông và Nam"
Prediction: "Nước ta giáp với biển Đông ở hai phía Đông và Nam"
✅ Perfect match
Ground Truth: "thẳng Phú Hữu"
Prediction: "thẳng phú trước"
⚠️ Minor errors (case + word confusion)
pip install vietocr
pip install pillow
from vietocr.tool.predictor import Predictor
from vietocr.tool.config import Cfg
from PIL import Image
# Load configuration
config = Cfg.load_config_from_name('vgg_transformer')
# Download model from Hugging Face
from huggingface_hub import hf_hub_download
model_path = hf_hub_download(
repo_id="DungHugging/vietocr-handwritten-finetune",
filename="transformerocr.pth"
)
config['weights'] = model_path
config['device'] = 'cuda' # or 'cpu'
# Create predictor
predictor = Predictor(config)
# Predict
image = Image.open('path/to/handwritten_image.jpg')
text = predictor.predict(image)
print(text)
# For multiple images
images = [Image.open(f'image_{i}.jpg') for i in range(10)]
texts = [predictor.predict(img) for img in images]
Model: vgg_transformer
Pretrained: Yes (VietOCR pretrained weights)
Optimizer: Adam
Learning Rate: 0.0001
Batch Size: 8
Epochs: 50
Device: NVIDIA GPU (Kaggle T4/P100)
Training Time: ~2-3 hours
Data Split:
Minimum:
Recommended:
If you want to fine-tune this model on your own dataset:
from vietocr.tool.config import Cfg
from vietocr.model.trainer import Trainer
# Load this model as base
config = Cfg.load_config_from_name('vgg_transformer')
config['weights'] = 'path/to/transformerocr.pth'
# Update with your data
config['trainer']['data_root'] = './your_data'
config['trainer']['train_annotation'] = 'train.txt'
config['trainer']['valid_annotation'] = 'val.txt'
# Train
trainer = Trainer(config, pretrained=True)
trainer.train()
If you use this model in your research, please cite:
@misc{vietocr-handwritten-finetune,
author = {DungHugging},
title = {VietOCR Fine-tuned for Vietnamese Handwriting Recognition},
year = {2026},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/DungHugging/vietocr-handwritten-finetune}}
}
Original VietOCR:
@misc{vietocr,
author = {Pham, Bao Cong},
title = {VietOCR: Optical Character Recognition for Vietnamese},
year = {2020},
publisher = {GitHub},
howpublished = {\url{https://github.com/pbcquoc/vietocr}}
}
UIT_HWDB Dataset:
@inproceedings{nguyen2018recognition,
title={Recognition of Handwritten Vietnamese Text Using Convolutional Neural Network},
author={Nguyen, Hung Tuan and Nguyen, Cong Thanh and others},
booktitle={International Conference on Future Data and Security Engineering},
year={2018}
}
This model is released under the MIT License.
For issues, questions, or improvements, please open a discussion on the Hugging Face model page.
v1.0 (Current)
Made with ❤️ for Vietnamese OCR Community
</div>