← 开源
githubharald

SimpleHTR

Handwritten Text Recognition (HTR) system implemented with TensorFlow.

ApplicationsDomain-specificPython
在 GitHub 打开
增长势头
+-124 小时新增 Star-0.0%
2.19k
Star
913
Fork
+-2
本周
7
贡献者
创建于 2018-06-13 · 更新于 2026-10-15 · 今日第 18737 名
主要开发者
githubharaldn1sntChazzz

githubharald/SimpleHTR 排名第 18,737,有 2,190 个星标。

同类别比较

githubharald/SimpleHTR 排名第 18,737,此处有 8 个同类条目;enarjord/passivbot 排名第 18,744。

同类别比较
名称排名指标
FullAgent/fulling18,700
语言:
TypeScript
星标数:
2,445
分叉数:
239
简介:
Fulling is an AI-powered Full-stack Engineer Agent. Built with Next.js, Claude, shadcn/ui, and PostgreSQL. Use kubernetes as infra.
MetaGLM/FinGLM18,722
语言:
HTML
星标数:
2,268
分叉数:
311
简介:
FinGLM: 致力于构建一个开放的、公益的、持久的金融大模型项目,利用开源开放来促进「AI+金融」。
dou-jiang/codex-console18,727
语言:
Python
星标数:
2,228
分叉数:
979
简介:
codex-console 是一个集成化控制台项目,支持任务管理、批量处理、数据导出、自动上传、日志查看与打包支持。
ai-christianson/RA.Aid18,729
语言:
Python
星标数:
2,223
分叉数:
211
简介:
Develop software autonomously.
enarjord/passivbot18,744
语言:
Python
星标数:
2,129
分叉数:
680
简介:
Trading bot running on Bybit, Bitget, OKX, GateIO, Binance, Kucoin, WEEX and Hyperliquid
4thfever/cultivation-world-simulator18,747
语言:
Python
星标数:
2,111
分叉数:
238
简介:
基于 AI Agent 工作流的修仙世界模拟器,旨在还原智能、开放的仙侠世界。| An open-source Cultivation World Simulator using Agentic Workflow to create a dynamic, emerging Xianxia world.
akl7777777/ShellGPT18,759
语言:
JavaScript
星标数:
2,021
分叉数:
234
简介:
**ShellGPT is a free chatgpt client, now Supported online search.no need for a key, no need to log in.Multi-node automatic speed measurement switch,Long text translation with no word limit, AI graphics.免费的chatgpt客户端,已支持联网搜索,无需密钥,无需登录,多节点自动测速切换,长文翻译不限字数,AI出图**
facebookresearch/Detic18,760
语言:
Python
星标数:
2,011
分叉数:
229
简介:
Code release for "Detecting Twenty-thousand Classes using Image-level Supervision".
关键参数与规格
关键参数与规格
参数值
语言Python
类别Applications
子类别Domain-specific
关键词OCR
星标数2,190
分叉数913
贡献者7
创建日期2018-06-13
更新日期2026-10-15
1 天星标数-1
7 天星标数-2
排名18,737
上次排名18,549
排名变化-188
7 天星标排名18,235
上次 7 天星标排名12,177
7 天星标排名变化-6,058
总星标排名5,906
上次总星标排名5,899
总星标排名变化-7
国家Austria
README 摘录

Handwritten Text Recognition with TensorFlow **Update 2023/2: a web demo is available** **Update 2023/1: see HTRPipeline for a package to read full pages** **Update 2021/2: recognize text on line level (multiple words)** **Update 2021/1: more robust model, faster dataloader, word beam search decoder also available for Windows** **Update 2020: code is compatible with TF2** Handwritten Text Recognition (HTR) system implemented with TensorFlow (TF) and trained on the IAM off-line HTR dataset. The model takes **images

of single words or text lines (multiple words) as input** and **outputs the recognized text**. 3/4 of the words from the validation-set are correctly recognized, and the character error rate is around 10%. Run demo Download one of the pretrained models Model trained on word images: Model trained on text line images: Put the contents of the downloaded zip-file into the directory of the repository Go to the directory Run inference code: Execute to run the model

on an image of a word Execute to run the model on an image of a text line The input images, and the expected outputs are shown below when the text line model is used. Command line arguments : select between "train", "validate" and "infer". : select from CTC decoders "bestpath", "beamsearch" and "wordbeamsearch". For option "wordbeamsearch" see details below. : directory containing IAM dataset (with subdirectories and ). : train reading text lines instead of single words. : dumps the output of the NN to

CSV file(s) saved in the folder. Can be used as input for the CTCDecoder. Integrate word beam search decoding The word beam search decoder can be used instead of the two decoders shipped with TF. Words are constrained to those contained in a dictionary, but arbitrary non-word character strings (numbers, punctuation marks) can still be recognized. The following illustration shows a sample for which word beam search is able to recognize the correct text, while the other decoders

fail. Follow these instructions to integrate word beam search decoding: 1. Compile and install by running at the root level of the CTCWordBeamSearch repository 3. Specify the command line option when executing to actually use the decoder The dictionary is automatically created in training and validation mode by using all words contained in the IAM dataset (i. also including words from validation set) and is saved into the file . Further, the manually created list of word-characters can be found

in the file . Beam width is set to 50 to conform with the beam width of vanilla beam search decoding. Train model on IAM dataset Prepare dataset Follow these instructions to get the IAM dataset: Register for free at this website Download Download Create a directory for the dataset on your disk, and create two subdirectories: and Put into the directory Put the content (directories , , . ) of into the directory Run training Delete files from directory if you want to train

from scratch Go to the directory and execute The IAM dataset is split into 95% training data and 5% validation

常见问题

记录了多少星标和分叉?

githubharald/SimpleHTR 有 2,190 个星标和 913 个分叉。

仓库排名是多少?

githubharald/SimpleHTR 排名第 18,737。

记录的语言和类别是什么?

githubharald/SimpleHTR 有 2,190 个星标,语言为 Python,类别为 Applications。

哪个仓库排名最接近?

githubharald/SimpleHTR 与 enarjord/passivbot 比较,后者排名第 18,744,有 2,129 个星标。

README

Handwritten Text Recognition with TensorFlow

  • Update 2023/2: a web demo is available
  • Update 2023/1: see HTRPipeline for a package to read full pages
  • Update 2021/2: recognize text on line level (multiple words)
  • Update 2021/1: more robust model, faster dataloader, word beam search decoder also available for Windows
  • Update 2020: code is compatible with TF2

Handwritten Text Recognition (HTR) system implemented with TensorFlow (TF) and trained on the IAM off-line HTR dataset. The model takes images of single words or text lines (multiple words) as input and outputs the recognized text. 3/4 of the words from the validation-set are correctly recognized, and the character error rate is around 10%.

Run demo

  • Download one of the pretrained models
  • Put the contents of the downloaded zip-file into the model directory of the repository
  • Go to the src directory
  • Run inference code:
    • Execute python main.py to run the model on an image of a word
    • Execute python main.py --img_file ../data/line.png to run the model on an image of a text line

The input images, and the expected outputs are shown below when the text line model is used.

> python main.py
Init with stored values from ../model/snapshot-13
Recognized: "word"
Probability: 0.9806370139122009

> python main.py --img_file ../data/line.png
Init with stored values from ../model/snapshot-13
Recognized: "or work on line level"
Probability: 0.6674373149871826

Command line arguments

  • --mode: select between "train", "validate" and "infer". Defaults to "infer".
  • --decoder: select from CTC decoders "bestpath", "beamsearch" and "wordbeamsearch". Defaults to "bestpath". For option "wordbeamsearch" see details below.
  • --batch_size: batch size.
  • --data_dir: directory containing IAM dataset (with subdirectories img and gt).
  • --fast: use LMDB to load images faster.
  • --line_mode: train reading text lines instead of single words.
  • --img_file: image that is used for inference.
  • --dump: dumps the output of the NN to CSV file(s) saved in the dump folder. Can be used as input for the CTCDecoder.

Integrate word beam search decoding

The word beam search decoder can be used instead of the two decoders shipped with TF. Words are constrained to those contained in a dictionary, but arbitrary non-word character strings (numbers, punctuation marks) can still be recognized. The following illustration shows a sample for which word beam search is able to recognize the correct text, while the other decoders fail.

Follow these instructions to integrate word beam search decoding:

  1. Clone repository CTCWordBeamSearch
  2. Compile and install by running pip install . at the root level of the CTCWordBeamSearch repository
  3. Specify the command line option --decoder wordbeamsearch when executing main.py to actually use the decoder

The dictionary is automatically created in training and validation mode by using all words contained in the IAM dataset (i.e. also including words from validation set) and is saved into the file data/corpus.txt. Further, the manually created list of word-characters can be found in the file model/wordCharList.txt. Beam width is set to 50 to conform with the beam width of vanilla beam search decoding.

Train model on IAM dataset

Prepare dataset

Follow these instructions to get the IAM dataset:

  • Register for free at this website
  • Download words/words.tgz
  • Download ascii/words.txt
  • Create a directory for the dataset on your disk, and create two subdirectories: img and gt
  • Put words.txt into the gt directory
  • Put the content (directories a01, a02, ...) of words.tgz into the img directory

Run training

  • Delete files from model directory if you want to train from scratch
  • Go to the src directory and execute python main.py --mode train --data_dir path/to/IAM
  • The IAM dataset is split into 95% training data and 5% validation data
  • If the option --line_mode is specified, the model is trained on text line images created by combining multiple word images into one
  • Training stops after a fixed number of epochs without improvement

The pretrained word model was trained with this command on a GTX 1050 Ti:

python main.py --mode train --fast --data_dir path/to/iam  --batch_size 500 --early_stopping 15

And the line model with:

python main.py --mode train --fast --data_dir path/to/iam  --batch_size 250 --early_stopping 10

Fast image loading

Loading and decoding the png image files from the disk is the bottleneck even when using only a small GPU. The database LMDB is used to speed up image loading:

  • Go to the src directory and run create_lmdb.py --data_dir path/to/iam with the IAM data directory specified
  • A subfolder lmdb is created in the IAM data directory containing the LMDB files
  • When training the model, add the command line option --fast

The dataset should be located on an SSD drive. Using the --fast option and a GTX 1050 Ti training on single words takes around 3h with a batch size of 500. Training on text lines takes a bit longer.

Information about model

The model is a stripped-down version of the HTR system I implemented for my thesis. What remains is the bare minimum to recognize text with an acceptable accuracy. It consists of 5 CNN layers, 2 RNN (LSTM) layers and the CTC loss and decoding layer. For more details see this Medium article.

References

排名相邻
同类项目