7

TL;DR: how can I detect the presence of handwriting in an image?

I'm using Google's Python Vision API to scan for text in images, with generally good results. Most of the time the images contain printed text, but sometimes there is handwriting.

As noted in the documentation, you sometimes get better results for handwritten text using document_text_detection rather than the standard text_detection API call. My own tests back this up, but also show that the standard text_detection call generally works best for printed text in JPEG images.

So I'd like to use the standard text_detection by default, and only run images thrrough document_text_detection if there is handwriting. However, I can't find a reliable way to detect the presence of handwritten text in an image using the Vision APIs.

I tried label detection, but there does not appear to be a specific label for handwriting. Occasionally it will spit out "Calligraphy" but not reliably.

Does anyone know of a way to accomplish this?

Mark Turner
  • 81
  • 2
  • 5
  • I have the same question and problem. I have a bunch of library cards (thousands). Some of them written with a typewriter and some are hand written. The best results for OCR is when TEXT_DETECTION is set for the typewriter cards, and DOCUMENT_TEXT_DETECTION for those with handwriting in them. But I don't know beforehand which to choose. – Barsk Apr 15 '22 at 05:13

1 Answers1

0

I haven’t used Google Cloud Vision API but you can try Object detection models. I would suggest to create a labeled dataset over the document images of your use case using tools like LabelImg and train an Object detection model like Yolov3 [paper] [code]. I have worked on similar problems It should work.

Atinesh
  • 1,790
  • 9
  • 36
  • 57