Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
304 views
in Technique[技术] by (71.8m points)

python - How to train data using tensorflow ocr?

I am new to tensorflow, so i am little bit confuse in tensorflow there are multiple model to perform OCR like

  1. attention_ocr
  2. street

I have below document which i have to perform OCR. I tried to use pytesseract to read image but not giving proper result. enter image description here

I need below result from above image

  • D MANIKANDAN

  • DURAISAMY

  • 16/07/1986

  • BNZPM2501F

Please suggest me please tensorflow modal is useful to perform above OCR. I am using below code to get data from pytesseract

def getData(coordinate, image):
    (y1, y2, x1, x2, classification) = coordinate
    ts = int(time.time())
    height = y2-y1
    width = x2-x1
    crop = image[y1:y1+height, x1:x1+width]
    CROP_IMAGE_URL = EXPORT_PATH +"data.jpg"
    cv2.imwrite(CROP_IMAGE_URL, crop)
    img = cv2.imread(CROP_IMAGE_URL)
    text = pytesseract.image_to_string(img)
    os.remove(CROP_IMAGE_URL)
    return text
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

First you must create an object detection model to find the region of intrests as shown in the picture. Then you can pass the ROI image into the OCR model or PyTesseract.

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...