/ Модель

Характеристики

Лицензия
CC BY 4.0
Библиотека
onnx
Опубликована
16 мар 2024

digit-recognition

Классификация изображенийИзображение → label3 профессии

ONNX-модель AI Panjab распознаёт одну рукописную цифру гурмукхи на изображении и оценивает вероятности десяти классов.

14скачиваний за 30 дней0лайковвеса обновлены22 окт 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

aipanjab/digit-recognition — модель распознавания одной рукописной цифры гурмукхи на изображении, разработанная для проекта AI Panjab. Она классифицирует изображение по десяти цифрам панжаби: ੦–੯, и возвращает вероятности для каждой метки; интерфейс демонстрационного Space показывает три наиболее вероятных варианта.

Модель принимает изображение в оттенках серого размером 28 × 28 пикселей и выдаёт оценки десяти классов. Репозиторий содержит модель в формате ONNX для запуска через ONNX Runtime; для инференса достаточно CPU. Обучение проводилось на 4 417 рукописных цифрах, собранных на платформе AI Panjab: 3 533 примерах для обучения и 884 для проверки.

Модель рассчитана на изображения с одной крупной цифрой, нарисованной тёмными чернилами на светлом фоне. На других стилях письма, при плохом качестве изображения или нескольких символах точность может снижаться. Лицензия — Creative Commons Attribution 4.0 (CC BY 4.0).

Сценарии применения

  • распознавание цифр гурмукхи на изображениях
  • оцифровка рукописных цифр панжаби
  • определение цифры, нарисованной на холсте
  • получение нескольких вероятных вариантов распознавания

Ограничения

Модель рассчитана на односимвольные изображения с тёмной цифрой на светлом фоне; для нескольких символов и изображений, заметно отличающихся от обучающих данных, качество может снижаться.

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Handwritten Panjabi Digit Recognition

Recognises one handwritten Gurmukhi digit (੦ ੧ ੨ ੩ ੪ ੫ ੬ ੭ ੮ ੯) in an image. It is the model behind the digit recognition on AI Panjab.

Try it without code: the Space: draw a digit and get the top three guesses. The Space also has a Use via API page (Python, JavaScript, curl).

Files

FileWhat it is
model.onnxThe model for ONNX Runtime (CPU is enough). Use this one.
labels.jsonThe ten labels, in the order of the model's outputs.
inference.pyThe code that runs the model: picture in, top guesses out (the loader uses it).
requirements.txtWhat inference.py needs: onnxruntime, numpy, pillow.
model.kerasThe same model for training, in Keras 3 (PyTorch backend): to fine-tune or continue training.
training.pyThe code that trains it: images in, a new model folder (model.keras + model.onnx) out.
requirements-train.txtWhat training needs: adds torch, keras, onnx, datasets.
config.jsonThe model's description, and its training dataset.

Input and output

  • Input image: float32, shape (batch, 28, 28, 1), grayscale with values 0 to 255 (the model rescales them itself). Dark ink on a light background, one digit filling most of the picture.
  • Output: ten probabilities, one per label in labels.json.

To turn a picture into the input exactly as the model was trained:

  1. a transparent background (RGBA) is put on white; any other image is converted to RGB;
  2. grayscale with the ITU-R 601 weights: 0.2989 R + 0.5870 G + 0.1140 B, kept in floating point;
  3. resized to 28 x 28 with bilinear (antialiased) resizing.

Use it

pip install git+https://huggingface.co/aipanjab/model-loader
from aipanjab import load

model = load("digit-recognition")
model.predict("my-digit.png")    # {'੨': 0.99, '੩': 0.01, '੭': 0.0}

The model is downloaded the first time and cached after that; it runs on your CPU, or on an NVIDIA GPU when onnxruntime-gpu is installed (load("digit-recognition", device="cpu") or "cuda" to choose).

predict takes a file path, an open file or a PIL image, and top_k (default 3). A picture with nothing drawn on it raises an error.

Train it

Continue training this model on your own handwriting, or on this model's dataset:

pip install "aipanjab-loader[train] @ git+https://huggingface.co/aipanjab/model-loader"
from aipanjab import load

model = load("digit-recognition").train(data="my-digits", epochs=10)   # my-digits/੨/1.png, my-digits/੨/2.png, ...
model.predict("my-digit.png")
model.save("my-digit-model")                                          # later: load("my-digit-model")

data is a folder with one folder per digit (named ੦ … ੯), a Hugging Face dataset id with image and label columns, or a list of (image, label) pairs; without data, the model's own dataset. Other options: batch_size (32), lr (0.0001), test_size (0.1, the share of images kept to check the model when the data has no test split). Training uses a GPU when there is one (device="cpu", "cuda" or "mps" to choose). The new model comes with both model.keras and model.onnx.

Training data

aipanjab/handwritten-digits: digits drawn by people on the AI Panjab platform (3,533 for training, 884 for testing), drawn with a black pen on a canvas of about 350 x 350. The model works best on pictures like these: one digit, dark on light, not too small in the picture.

Training procedure

Two convolutions (128 filters, 3 x 3, GELU then ReLU, each followed by 3 x 3 max pooling), dense layers of 128 and 64 (tanh) and a softmax over the 10 digits; Adam (learning rate 0.001), sparse categorical cross-entropy, 50 epochs, keeping the best epoch on the test split. Accuracy on the 884 test images: 98.6%. model.onnx and model.keras hold the same weights and give the same answers (outputs differ by less than 0.000002).

Licence

CC BY 4.0: you may use it, including commercially, if you credit AI Panjab.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · onnx

Нельзя запустить

В репозитории нет весов в формате PyTorch/safetensors.

Ревизия весов
81adcea

0 моделей