链接:https://github.com/Breta01/handwriting-ocr/blob/master/OCR.ipynb 如果我禁用这行代码,程序会执行,但由于明显的原因,无法正确读取文本。
crop = page.detection(image)
细节如下:
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-66-869a5b4b76fb> in <module>()
1 # Crop image and get bounding boxes
----> 2 crop = page.detection(image)
3 implt(image)
4 bBoxes = words.detection(image)
~/SageMaker/handwriting-ocr/ocr/page.py in detection(image)
17 np.ones((5, 11)))
18 # Countours
---> 19 pageContour = findPageContours(closedEdges, resize(image))
20 # Recalculate to original scale
21 pageContour = pageContour.dot(ratio(image))
~/SageMaker/handwriting-ocr/ocr/page.py in findPageContours(edges, img)
94
95 # Sort corners and offset them
---> 96 pageContour = fourCornersSort(pageContour[:, 0])
97 return contourOffset(pageContour, (-5, -5))
98
~/SageMaker/handwriting-ocr/ocr/page.py in fourCornersSort(pts)
47 def fourCornersSort(pts):
48 """ Sort corners: top-left, bot-left, bot-right, top-right"""
---> 49 diff = np.diff(pts, axis=1)
50 summ = pts.sum(axis=1)
51 return np.array([pts[np.argmin(summ)],
~/anaconda3/envs/tensorflow_p36/lib/python3.6/site-packages/numpy/lib/function_base.py in diff(a, n, axis)
1922 slice1 = [slice(None)]*nd
1923 slice2 = [slice(None)]*nd
-> 1924 slice1[axis] = slice(1, None)
1925 slice2[axis] = slice(None, -1)
1926 slice1 = tuple(slice1)
IndexError: list assignment index out of range
我希望这能够奏效,因为我有手写文件需要导入,而大多数非机器学习软件无法正确读取它们。
更新:
假设公司有100名员工将提交手写文件。这是否意味着我需要收集所有100个人的样本手写来训练模型?
更新1:
也许我没有正确解释我的问题。我有一张图片: https://s3.amazonaws.com/todel162/harshad_college_card.jpg Tessaract OCR 无法正确读取它。如在此文本文件中所示 - 缺少姓名、标准和出生日期(这是最重要的) https://s3.amazonaws.com/todel162/college_card_reading.txt 是否有任何软件包(带或不带机器学习),可以从单个文档中读取印刷和手写文本,该文档可能会被最终用户以不同的分辨率/大小扫描?