说明文档
Geez 字符 OCR (Geez-Net)
<!-- Provide a quick summary of what the model is/does. --> 该模型是一个高性能光学字符识别 (OCR) 系统,专为 Geez 文字(阿姆哈拉语、提格雷语)设计。它采用卷积神经网络 (CNN) 架构,能够高精度地对手写 Geez 字符图像进行分类。
模型详情
模型描述
<!-- Provide a longer summary of what this model is. -->
该模型利用深度 CNN 架构解决了 Geez 文字数字识别的挑战。它被训练用于接收单个字符图像并输出 287 个可能的字符类别之一。该模型已使用 ONNX 运行时针对 Web 部署进行了优化。
- 开发者: Yared Kassa
- 分享者: Yared Kassa
- 模型类型: 用于图像分类的卷积神经网络 (CNN)
- 语言: 阿姆哈拉语、提格雷语(Geez 文字)
- 许可证: apache-2.0
- 微调自: 从头训练
模型来源 [可选]
<!-- Provide a basic links for the model. -->
用途
<!-- Address questions around how the model is intended to be used, including foreseeable users of the model and those affected by the model. -->
直接使用
<!-- This section is for model use without fine-tuning or plugging into a larger ecosystem/app. -->
该模型旨在直接用于手写 Geez 文档的数字化、教育语言学习工具和自动化数据录入系统。用户输入手写字符的裁剪图像,模型返回预测的字符类别和置信度分数。
下游使用 [可选]
<!-- This section for model use when fine-tuned for a task, or when plugged into a larger ecosystem/app. -->
不适用(这是一个独立的分类模型)。
超出范围的使用
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
该模型不适用于:
- 完整文档 OCR(它不执行单词分割或版面分析)。
- 非 Geez 文字的识别(拉丁文、阿拉伯文等)。
- 训练数据中不存在的草书或高度风格化字体的识别。
偏差、风险和局限性
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
局限性
- 单字符输入: 该模型需要预分割的单字符图像。它无法直接处理完整的单词或句子。
- 输入质量: 在没有预处理的情况下,低分辨率或高噪声图像的性能可能会下降。
- 数据偏差: 虽然在约 40 万张增强图像上进行了训练,但该模型可能偏向于原始 1.3 万个源数据集中存在的特定手写风格。
建议
<!-- This section is meant to convey recommendations with respect to bias, risk, and technical limitations. -->
用户应实现预处理流水线,在将单词输入此模型之前将其分割为单个字符。图像应归一化为 128x128 像素并转换为灰度。
评估
测试数据、因素和指标
指标
- 准确率:用于评估的主要指标。
推理性能
- 单图像推理:81% 基准准确率。
- 测试时增强 (TTA):
- 配置:10 次增强并进行多数投票。
- 结果:达到约 90% 的分类准确率。
- 影响:显著减少由手写变异性导致的错误率。
如何开始使用该模型
使用以下代码开始使用该模型。
import onnxruntime as ort
import numpy as np
from PIL import Image
# 1. 加载 ONNX 模型
session = ort.InferenceSession(\"cnn_output.onnx\")
# 2. 预处理输入图像
def preprocess_image(image_path):
# 加载图像
img = Image.open(image_path).convert('L') # 转换为灰度
# 调整大小为 128x128
img = img.resize((128, 128), Image.Resampling.LANCZOS)
# 转换为 numpy 数组并归一化到 0-1
img_array = np.array(img).astype('float32') / 255.0
# 添加批次维度和通道维度 (1, 1, 128, 128)
img_array = np.expand_dims(np.expand_dims(img_array, axis=0), axis=0)
return img_array
input_data = preprocess_image(\"path/to/geez_char.jpg\")
# 3. 运行推理
input_name = session.get_inputs()[0].name
output_name = session.get_outputs()[0].name
predictions = session.run([output_name], {input_name: input_data})[0]
# 4. 获取预测类别
predicted_class_index = np.argmax(predictions)
print(f\"Predicted Class ID: {predicted_class_index}\")"
Yaredoffice/geez-char-ocr
作者 Yaredoffice
创建时间: 2026-01-03 12:11:27+00:00
更新时间: 2026-01-04 00:19:10+00:00
在 Hugging Face 上查看