How to improve the accuracy of Form Recognizer?

半腔热情 提交于 2019-12-02 10:02:29

I created a program in Python with opencv and matplotlib to inspect your result, then I found the Surname and e-Mail Address both come out, but the House and Country not, as the figure below.

Here is my code for drawing.

import cv2
import matplotlib.pyplot as plt
import json
import numpy as np

json_file = open('sample.json')
json_dict = json.load(json_file)
page = json_dict['pages'][0]
height = page['height']
keyValuePairs = page['keyValuePairs']

key_boundingBoxes = [np.int64(key['boundingBox']) for keyValuePair in keyValuePairs for key in keyValuePair['key']]
key_texts = [key['text'] for keyValuePair in keyValuePairs for key in keyValuePair['key']]
value_texts = [value['text'] for keyValuePair in keyValuePairs for value in keyValuePair['value']]
print(key_texts)
value_boundingBoxes = [np.int64(value['boundingBox']) for keyValuePair in keyValuePairs for value in keyValuePair['value']]

img = cv2.imread("sample.jpg")
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
[cv2.rectangle(img, (boundingBox[0], height - boundingBox[1]),(boundingBox[4], height - boundingBox[5]) ,(0,255,0), 3) for boundingBox in key_boundingBoxes]
[cv2.rectangle(img, (boundingBox[0], height - boundingBox[1]),(boundingBox[4], height - boundingBox[5]) ,(255,0,0), 3) for boundingBox in value_boundingBoxes]
plt.figure()
plt.imshow(img)
plt.axis('off')
plt.show()

Ofcourse, it's not related to improve the accuracy.

Per my experience, easily to improve the accuracy is to feed the training model with more images, because you were using Azure Cognitive Service which algorithm you can not change.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!