This model is a high-performance Optical Character Recognition (OCR) system specifically designed for the Geez script (Amharic, Tigrinya). It utilizes a Convolutional Neural Network (CNN) architecture to classify individual handwritten Geez characters from images with high accuracy.
This model addresses the challenge of digital recognition for the Geez script by utilizing a deep CNN architecture. It is trained to accept a single character image and output one of 287 possible character classes. It has been optimized for web deployment using ONNX runtime.
The model is intended for direct use in digitizing handwritten Geez documents, educational language learning tools, and automated data entry systems. Users input a cropped image of a handwritten character, and the model returns the predicted character class and confidence score.
N/A (This is a standalone classification model).
Users should implement a pre-processing pipeline to segment words into individual characters before feeding them into this model. Images should be normalized to 128x128 pixels and converted to grayscale.
Use the code below to get started with the model.
1import onnxruntime as ort
2import numpy as np
3from PIL import Image
4
5# 1. Load the ONNX model
6session = ort.InferenceSession("cnn_output.onnx")
7
8# 2. Preprocess input image
9def preprocess_image(image_path):
10 # Load image
11 img = Image.open(image_path).convert('L') # Convert to Grayscale
12 # Resize to 128x128
13 img = img.resize((128, 128), Image.Resampling.LANCZOS)
14 # Convert to numpy array and normalize to 0-1
15 img_array = np.array(img).astype('float32') / 255.0
16 # Add batch dimension and channel dimension (1, 1, 128, 128)
17 img_array = np.expand_dims(np.expand_dims(img_array, axis=0), axis=0)
18 return img_array
19
20input_data = preprocess_image("path/to/geez_char.jpg")
21
22# 3. Run Inference
23input_name = session.get_inputs()[0].name
24output_name = session.get_outputs()[0].name
25predictions = session.run([output_name], {input_name: input_data})[0]
26
27# 4. Get Predicted Class
28predicted_class_index = np.argmax(predictions)
29print(f"Predicted Class ID: {predicted_class_index}")