Tesseract 微调错误 - 计算 CTC 目标失败

     2023-04-17     229

关键词:

【中文标题】Tesseract 微调错误 - 计算 CTC 目标失败【英文标题】:Tesseract fine tuning error - Compute CTC targets failed 【发布时间】:2021-06-18 04:05:11 【问题描述】:

我正在尝试根据this 指南根据我自己的特定数据微调 tesseract 4.1.1。我希望它能够检测和识别这样的框中的文本:

我已经生成了许多这样的图像,并与它们对应的 .box 文件包含带有文本的边界框。为了在这里重现我的问题,我将只使用一张图像来展示我的管道。这是上图的 .box 文件:

0 1804 1659 1858 1813 0
5 1804 1659 1858 1813 0
9 1804 1659 1858 1813 0
9 1266 715 1334 1169 0
7 1266 715 1334 1169 0
8 1266 715 1334 1169 0
3 1266 715 1334 1169 0
6 1266 715 1334 1169 0
8 1266 715 1334 1169 0
0 1266 715 1334 1169 0
5 1266 715 1334 1169 0
3 1266 715 1334 1169 0
2 876 303 930 607 0
7 876 303 930 607 0
2 876 303 930 607 0
8 876 303 930 607 0
2 876 303 930 607 0
2 876 303 930 607 0
8 1671 120 1725 224 0
0 1671 120 1725 224 0
5 300 1278 354 1482 0
2 300 1278 354 1482 0
3 300 1278 354 1482 0
7 300 1278 354 1482 0
7 917 1451 975 1605 0
6 917 1451 975 1605 0
4 917 1451 975 1605 0
1 1058 1310 1132 1716 0
9 1058 1310 1132 1716 0
8 1058 1310 1132 1716 0
7 1058 1310 1132 1716 0
7 1058 1310 1132 1716 0
1 1058 1310 1132 1716 0
8 1058 1310 1132 1716 0
6 1058 1310 1132 1716 0
3 998 76 1070 382 0
4 998 76 1070 382 0
4 998 76 1070 382 0
8 998 76 1070 382 0
3 998 76 1070 382 0
6 998 76 1070 382 0
3 722 548 776 652 0
2 722 548 776 652 0
7 1782 1332 1838 1586 0
7 1782 1332 1838 1586 0
2 1782 1332 1838 1586 0
6 1782 1332 1838 1586 0
2 1782 1332 1838 1586 0
1 714 140 768 244 0
2 714 140 768 244 0
0 220 500 278 754 0
5 220 500 278 754 0
5 220 500 278 754 0
6 220 500 278 754 0
6 220 500 278 754 0
8 1676 1052 1742 1406 0
4 1676 1052 1742 1406 0
5 1676 1052 1742 1406 0
9 1676 1052 1742 1406 0
1 1676 1052 1742 1406 0
2 1676 1052 1742 1406 0
4 1676 1052 1742 1406 0
5 357 161 419 317 0
1 357 161 419 317 0
4 357 161 419 317 0
9 1424 848 1480 952 0
8 1424 848 1480 952 0
0 438 324 498 478 0
6 438 324 498 478 0
9 438 324 498 478 0
8 1503 1246 1559 1700 0
1 1503 1246 1559 1700 0
8 1503 1246 1559 1700 0
5 1503 1246 1559 1700 0
3 1503 1246 1559 1700 0
0 1503 1246 1559 1700 0
5 1503 1246 1559 1700 0
5 1503 1246 1559 1700 0
4 1503 1246 1559 1700 0
8 1553 477 1609 581 0
4 1553 477 1609 581 0
3 527 258 581 512 0
7 527 258 581 512 0
7 527 258 581 512 0
9 527 258 581 512 0
1 527 258 581 512 0
6 1665 1592 1727 1748 0
8 1665 1592 1727 1748 0
3 1665 1592 1727 1748 0
5 595 1362 651 1766 0
9 595 1362 651 1766 0
3 595 1362 651 1766 0
9 595 1362 651 1766 0
4 595 1362 651 1766 0
3 595 1362 651 1766 0
3 595 1362 651 1766 0
1 595 1362 651 1766 0

我还把图片转换成 .tiff 格式,和 .box 文件放在同一个目录下。假设我们在目录中有 87.tiff87.box

接下来我使用

生成87.lstmf文件
tesseract 87.tiff 87 lstm.train

接下来我使用提取模型

combine_tessdata -e /usr/share/tesseract-ocr/4.00/tessdata/rus.traineddata lstm_model/rus.lstm

接下来我创建包含单行的 train.txt 文件:87.lstmf

最后,我创建了 bash 脚本 train.sh

/usr/bin/lstmtraining \
 --model_output output/fine_tuned \
 --continue_from lstm_model/rus.lstm \
 --traineddata /usr/share/tesseract-ocr/4.00/tessdata/rus.traineddata \
 --train_listfile train.txt \
 --eval_listfile train.txt \
 --max_iterations 400\
 --debug_level -1

当我运行它时,我有以下日志:

$ bash train.sh
Loaded file lstm_model/rus.lstm, unpacking...
Warning: LSTMTrainer deserialized an LSTMRecognizer!
Continuing from lstm_model/rus.lstm
Loaded 1/1 lines (1-1) of document 87.lstmf
Loaded 1/1 lines (1-1) of document 87.lstmf
Compute CTC targets failed!
Compute CTC targets failed!
Compute CTC targets failed!
Compute CTC targets failed!

消息“计算 CTC 目标失败!”无限重复,直到我中断脚本。

我做错了什么?我还担心消息“已加载 1/1 行 (1-1)”,因为我在图像上有多个边界框。

【问题讨论】:

【参考方案1】:

对于图像的 lstm 训练,您可能需要具有新 lstm 格式的 .box 文件(这些可以通过运行带有 lstmbox 参数的 tesseract 生成): TrainingTesseract-4.00 所以在每一行文本之后用一个特殊的行标记它: <tab> <left> <bottom> <right> <top> <page> 然后运行 ​​lstm.train 。

【讨论】:

多个微调器计算结果不准确

】多个微调器计算结果不准确【英文标题】:multiplespinnercaclulationresultsarenotaccurate【发布时间】:2013-12-0514:49:02【问题描述】:我是android开发的新手,我有一个计算器页面,我需要对从两个微调器中选择的选项进行小计算。我已... 查看详情

MS dotnet core 容器镜像拉取失败,错误:CTC1014

】MSdotnetcore容器镜像拉取失败,错误:CTC1014【英文标题】:MSdotnetcorecontainerimagesfailedtopull,Error:CTC1014【发布时间】:2021-10-0406:24:04【问题描述】:我正在尝试为小型dotnetcore3.1控制台应用程序构建新映像。我收到一个错误:无法... 查看详情

Tesseract 的自定义字典

】Tesseract的自定义字典【英文标题】:CustomDictionaryforTesseract【发布时间】:2012-03-2300:20:49【问题描述】:我目前正在开发一个使用TesseractOCR的android项目。我希望通过添加字典来微调给用户的结果。根据tesseractOCRwiki,最好的办法... 查看详情

tesseract 错误置信决策

】tesseract错误置信决策【英文标题】:tesseractfalseconfidencedecision【发布时间】:2015-09-1407:59:23【问题描述】:我正在使用tesseract进行序列号识别。在tesseract可以识别不同级别的文本,例如识别单个单词、行、段落、字符。也有可... 查看详情

Tesseract 错误空间识别

】Tesseract错误空间识别【英文标题】:TesseractFalseSpaceRecognition【发布时间】:2015-09-1308:45:13【问题描述】:我正在使用tesseract来识别序列号。这适用于可接受的常见问题,例如错误识别零和“O”、6和5,或存在M和H。除此之外,... 查看详情

从微调器创建计算器

】从微调器创建计算器【英文标题】:Createacalculatorfromaspinner【发布时间】:2015-04-0715:41:33【问题描述】:我创建了两个微调器,用户可以在其中选择膳食类型,然后选择食物(例如“早餐”和“粥”)。然后,我需要将食物卡... 查看详情

tesseract 错误 - 图像太大

】tesseract错误-图像太大【英文标题】:tesseracterror-Imagetoolarge【发布时间】:2012-11-0214:41:39【问题描述】:对于大小为5+MB的图像,我收到来自tesseract的错误。Tesseract开源OCR引擎v3.01与Leptonica第0页图片太大:(39667、56133)处理过... 查看详情

错误!找不到命令“tesseract”。 (PHP 蒂亚戈莱西奥)

】错误!找不到命令“tesseract”。(PHP蒂亚戈莱西奥)【英文标题】:Error!Thecommand"tesseract"wasnotfound.(PHPthiagoalessio)【发布时间】:2019-05-1123:36:18【问题描述】:我遇到了这个错误信息错误!找不到命令“tesseract”。但是,tes... 查看详情

Tesseract - 错误 net.sourceforge.tess4j.Tesseract - null

】Tesseract-错误net.sourceforge.tess4j.Tesseract-null【英文标题】:Tesseract-ERRORnet.sourceforge.tess4j.Tesseract-null【发布时间】:2017-01-2301:49:09【问题描述】:创建了一个使用Tesseract的java应用程序,以便将给定的图像或pdf转换为字符串格式,... 查看详情

iPhone Tesseract 库错误

】iPhoneTesseract库错误【英文标题】:iPhoneTesseractliberror【发布时间】:2011-04-1710:13:34【问题描述】:我从here克隆了tesseract代码并为4.3构建了iphoneOCR演示我知道之前有someissues使用tesseract,但我认为我的问题不一样。应用程序启动... 查看详情

Tesseract 4.1.1 错误 eng.traineddata 在谷歌 colab 中找不到

】Tesseract4.1.1错误eng.traineddata在谷歌colab中找不到【英文标题】:Tesseract4.1.1erroreng.traineddatanotfoundingooglecolab【发布时间】:2021-04-2003:00:32【问题描述】:我正在尝试在googlecolab中安装tesseract4.1.1。我已经安装了tesseract,我可以使用... 查看详情

CTC1014 Docker 命令失败,退出代码为 0

...:2022-01-2012:44:42【问题描述】:我收到一条非常不透明的错误消息-。这个Dockerfile之前运行良好,但我认为它在VisualStudio2022中存在问题。FROMmcr.microsoft.com/dotnet/core/aspnet:3.1-alpineAS 查看详情

opencv tesseract 未定义的引用错误

】opencvtesseract未定义的引用错误【英文标题】:opencvtesseractundefinedreferenceerror【发布时间】:2015-05-2019:36:22【问题描述】:我正在尝试使用来自here的测试代码从opencv3.0测试tesseract但是,当我尝试编译它时,我收到以下错误undefined... 查看详情

RNN+CTC 模型似乎没有正确获取数据维度

...简单RNN模型(GRU)。以下是代码和模型摘要。我不断收到此错误,如下所示。似乎模型中的某处数据维度,可能是输入数据长度(即[batch_size,length,mfcc_feat 查看详情

tesseract-php 包装器在本地主机上运行时出现路径错误

】tesseract-php包装器在本地主机上运行时出现路径错误【英文标题】:tesseract-phpwrapperhavingapatherrorwhilerunningonlocalhost【发布时间】:2019-03-1806:58:01【问题描述】:所以我正在使用这里给出的tesseract-php包装器https://github.com/thiagoalessio... 查看详情

在 Angular 中安装 Tesseract.js 后找不到名称“缓冲区”错误

】在Angular中安装Tesseract.js后找不到名称“缓冲区”错误【英文标题】:Cannotfindname\'Buffer\'errorafterinstallingTesseract.jsinAngular【发布时间】:2020-06-0421:55:04【问题描述】:我的项目中需要Tesseract,所以首先我使用了yarnaddtesseract.js,... 查看详情

在 tesseract 中找不到 Lib 错误 [关闭]

】在tesseract中找不到Lib错误[关闭]【英文标题】:Libnotfounderrorintesseract[closed]【发布时间】:2012-07-1600:24:12【问题描述】:我正在使用OCRandroid。从谷歌搜索获得样本并使用androidtesseract。我将该项目作为库并在另一个项目中引用,... 查看详情

安装 tesseract-ocr 时出现 gcc 错误

】安装tesseract-ocr时出现gcc错误【英文标题】:gccerroroninstalloftesseract-ocr【发布时间】:2016-05-0103:44:41【问题描述】:我正在尝试在我的Mac上运行以下代码。importImageentercodehere`importpytesseractim=Image.open(\'test.png\')printpytesseract.image_to_s... 查看详情