Official Pytorch Implementation of "SiamHCC: a novel siamese network for quality evaluation of handwritten Chinese characters" by Weiran Chen, Guiqian Zhu, Ying Li, Yi Ji, and Chunping Liu*.
Paper can be found at here.
Our method is based on Siamese Network, so we named our evaluation method SiamHCC.
Automatic quality evaluation of handwritten Chinese characters aims to accurately quantify and assess handwritten Chinese characters through computer vision and machine learning technology. It is a topic that gathers significant attention from both handwriting learners and calligraphy enthusiasts. Nevertheless, most existing techniques rely mainly on traditional pre-deep learning methods. As we know, quality evaluation of handwritten Chinese characters based on the siamese network is still in the blank stage. Therefore, in this paper, we propose a novel deep convolutional siamese architecture (SiamHCC) to address this issue, which utilizes DenseNet as the backbone with a similarity-learning function. In order to pay more attention to non-local image features, our model also incorporates several self-attention blocks and Squeeze-and-Excitation (SE) blocks. Additionally, we also present a new collected dataset: Handwritten Chinese Character Evaluation (HCCE), which consists of 3,000 well-handwritten samples. By exploiting it during the model training, we achieve good results in the evaluation of various handwritten Chinese characters. Furthermore, we transfer our model to the evaluation of other eastern handwriting fonts such as Japanese (Kana) and Korean (Hangul) as well. Extensive experimental results demonstrate the effectiveness of our proposed quality evaluation model.
The model receives a target character and a corresponding template character to generate the final evaluation result.
python >= 3.8
torch >= 1.10.0
torchvision >= 0.11.0
opencv-python >= 4.8.0.76
The HCCE dataset consists of 3,000 handwritten images of 200 distinct Chinese characters. The characters, which include both simple and complex ones, were selected from the kevindkai dataset. The dataset was curated through a quality assessment process conducted by 21 individuals with professional calligraphy training. For each character, 15 high-quality images were selected based on average quality scores. In addition, the images in the dataset were converted to BMP format for consistency and easier processing.
| Dataset Name | Google Drive | Baidu Yun |
|---|---|---|
| HCCE | Google Drive | Baidu Yun |
Download the HCCE dataset and extract it to the project root directory. Ensure the dataset is organized in the following structure:
SiamHCC
├── HCCE
│ ├── s0
│ │ ├── 1.bmp
│ │ ├── 2.bmp
│ │ ├── ...
│ │ └── 15.bmp
│ ├── s1
│ ├── ...
│ └── s199
├── train.py
├── test.py
└── ...
Run the training script:
python train.py
Model checkpoints will be saved to "weights/".
Before testing, ensure you have: (1) A trained model weights file (e.g., SiamHCC.pkl); (2) Two images to compare (in .png or .jpg format).
To test the model with two images:
python test.py --img1 path/to/first.png --img2 path/to/second.png --weights path/to/weights.pth
To save the comparison result as an image:
python test.py --img1 path/to/first.png --img2 path/to/second.png --weights path/to/weights.pth --output result.png
For handwritten Chinese character recognition task, please refer to my other repository Handwritten Chinese character recognition based on MobileNetV3.
The repository is released under the MIT license.
We would like to express our sincere gratitude to our collaborators for their valuable supports throughout this project, to the creators of the HCCE dataset for providing high-quality handwritten Chinese character samples, and to the reviewers for their insightful feedback and suggestions, which greatly improved the quality of this work.
If you find the code or paper helpful, please consider citing our paper.
@article{Chen_2025_MS,
author = {Weiran Chen and Guiqian Zhu and Ying Li and Yi Ji and Chunping Liu},
title = {SiamHCC: a novel siamese network for quality evaluation of handwritten Chinese characters},
journal = {Multim. Syst.},
volume = {31},
number = {303},
pages = {1--16},
year = {2025},
doi = {10.1007/s00530-025-01886-3}
}

