A simple Python module for recognizing handwritten using machine learning. Designed for easy integration and efficient preprocessing.
- Preprocess handwritten images
- Extract simple features for recognition
- K-Nearest Neighbors (KNN) prediction
- Async support for building templates
- Timeout mechanism for long-running operations
- Save and load models as .npz files
Install from PyPI:
pip install cat-handwriting-recognizerfrom cat_handwriting_recognizer import HandwritingRecognizer
import asyncio
machine = HandwritingRecognizer(timeout=-1)
# Build templates from data
asyncio.run(machine.build_all_templates("directory")) # Your data directory
# Save model
machine.save_model("model.npz") # Save model file(.npz)
# Load model
machine.load_model("model.npz") # Load model file(.npz)
# Predict a picture
result = asyncio.run(machine.predict("file.png")) # Use model to predict png/jpg/jpeg file
print(result)- Python 3.10+
- NumPy
- Pillow
MIT License
littlecommandcat