Instructions to use ChrisMoe/handwriting with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use ChrisMoe/handwriting with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://ChrisMoe/handwriting") - Notebooks
- Google Colab
- Kaggle
Chinese Handwriting Recognition โ HSK1
A CNN trained on the HWDB1.0 dataset to recognise 178 Chinese characters.
Model details
| Item | Value |
|---|---|
| Input | 40ร40 grayscale image |
| Classes | 178 Chinese characters + Unknown |
| Framework | Keras / TensorFlow |
| Confidence threshold | 0.5 (below โ Unknown) |
Files
| File | Description |
|---|---|
chinese_hsk1_model.keras |
Trained Keras model |
label_map.json |
Index-to-character mapping |
training_curves.png |
Accuracy & loss curves |
Quick start
import numpy as np, json
from tensorflow import keras
model = keras.models.load_model('chinese_hsk1_model.keras')
label_map = json.load(open('label_map.json', encoding='utf-8'))
THRESHOLD = 0.5
def predict(img_40x40_gray):
x = img_40x40_gray.astype('float32') / 255.0
x = x.reshape(1, 40, 40, 1)
probs = model.predict(x)[0]
conf = probs.max()
if conf < THRESHOLD:
return 'Unknown', conf
return label_map[str(probs.argmax())], conf
- Downloads last month
- 59