Manuscript
Project description
Installation
Для пользователей
pip install manuscript-ocr
Для разработчиков
pip install -r requirements-dev.txt
Примечание:
requirements-dev.txtвключает GPU версию PyTorch, инструменты тестирования, форматирования и сборки.
GPU поддержка
Если вы пользователь и хотите GPU поддержку:
pip install manuscript-ocr
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 --force-reinstall
Проверка GPU:
import torch
print(f"CUDA доступна: {torch.cuda.is_available()}")
Usage Example
from PIL import Image
from manuscript.detectors import EASTInfer
# Инициализация
det = EASTInfer(score_thresh=0.9)
# Инфер с визуализацией
page, vis_image = det.infer(r"example\ocr_example_image.jpg", vis=True)
print(page)
# Покажет картинку с наложенными боксами
Image.fromarray(vis_image).show()
# Или сохранить результат на диск:
Image.fromarray(vis_image).save(r"example\ocr_example_image_infer.png")
Результат
Текстовые блоки будут выведены в консоль, например:
Page(blocks=[Block(words=[Word(polygon=[(874.1005, 909.1005), (966.8995, 909.1005), (966.8995, 956.8995), (874.1005, 956.8995)]),
Word(polygon=[(849.1234, 810.5678), … ])])])
А визуализация сохранится в файл example/ocr_example_image_infer.png:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file manuscript_ocr-0.1.8.tar.gz.
File metadata
- Download URL: manuscript_ocr-0.1.8.tar.gz
- Upload date:
- Size: 60.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8fb1859dff3814156c8a4f730a2f31ff360e315564065a9b0d3b62d98073049f
|
|
| MD5 |
8f7c50d286f71dfe19dc11cec81f0d48
|
|
| BLAKE2b-256 |
556bfb9707462afcd5ef149ec2638801d7af8eb804b5aeafdd80f29ec22fc693
|
File details
Details for the file manuscript_ocr-0.1.8-py3-none-any.whl.
File metadata
- Download URL: manuscript_ocr-0.1.8-py3-none-any.whl
- Upload date:
- Size: 66.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b5d31aa89efdcf599f1aa3f49a4800cdfde0e6fd5e349e487874fe6fceb7c18
|
|
| MD5 |
6311107c7fc5a3b049099558f9bc299a
|
|
| BLAKE2b-256 |
892a30b1a909728683f5fbfe390d19d68ea4b0db3b052be4b85f7dcf6c48fd53
|