November 5, 2021 | Deep learning, OCR, Tutorial

Introducing the New GdPicture.NET Deep Learning-based ICR Engine


illustration for the GdPicture.NET deep learning-based ICR engine

We’re gradually improving the machine vision capabilities of our versatile SDK with the release of the first version of a new ICR engine to recognize handwritten numerics. Future versions will support more contexts.

What is ICR?

Intelligent Character Recognition (ICR) is an advanced Optical Character Recognition (OCR) system that can recognize handwritten text and convert it into computer-readable text. It can extract information from structured and unstructured forms filled (totally or partially alongside typed text) with hand-printed text.

ICR works just like OCR, by extracting hand-printed characters that are separated and written as individual characters in specified areas/zones. This is why ICR is not suitable to recognize cursive handwriting, where all the characters in a word are connected.

ICR engine typically benefits from AI-supported neural network systems.

The GdPicture.NET OCR SDK

The OCR engine found in our SDK comprises different continuously improved layers using heuristics, machine learning, and applied mathematic-based methods.

The engine is continuously improved and with time, it produces faster results with better quality. We’re just starting to implement outcomes of extensive fundamental research carried by our R&D team for the past ten years.


This research work includes

  • thresholding,
  • pattern recognition,
  • layout analysis,
  • and image quality enhancement.

Deep learning-based features help to increase the speed and accuracy of the engine and bring new capabilities such as ICR.

(Very brief) tutorial

Our ICR engine can be used in a special context where there are handwritten digits inside five consecutive boxes, just like the images shown below.

handwritten numerics sample 1
handwritten numerics sample 2

Now, here are the steps to follow:


string path_to_image = "path\\to\\image.png";

GdPictureOCR gdPictureOcr = new GdPictureOCR();

using (GdPictureImaging oGdPictureImaging = new GdPictureImaging())
{
    int imgId = oGdPictureImaging.CreateGdPictureImageFromFile(path_to_image);

    if(imgId == 0)
    {
        Console.WriteLine("Image not loaded correctly!");
    }

    GdPictureStatus status = gdPictureOcr.SetImage(imgId);

    gdPictureOcr.ResourceFolder = "D:\\GdPicture.NET 14\\Redist\\OCR";

    if (status == GdPictureStatus.OK)
    {
        string ocrResultId = gdPictureOcr.RunOCR(OCRSpecialContext.HandwrittenNumericBoxML);
        string result = gdPictureOcr.GetOCRResultText(ocrResultId);

        if (gdPictureOcr.GetStat() == GdPictureStatus.OK)
            Console.WriteLine("Result : " + result);
        else
            Console.WriteLine("Error occurred when performing the first OCR. Status : " + gdPictureOcr.GetStat().ToString());  
    }

}

List of special contexts

In the documentation, the special context for our handwritten numbers is described as:

  • HandwrittenNumericBoxML

Specifies that the image or region of interest contains adjacent cells where each cell contains a single handwritten digit. This context is based on the GdPicture machine learning framework. To be used this context requires the hw_digits_boxes.gdpictureml file available into the specified resource folder (see GdPicture OCR.ResourceFolder property).

Other special contexts currently offered are:

  • MICRLineCMC7

Specifies that the image or region of interest contains a special magnetic ink character recognition code zone (MICR), using the CMC7 font.

  • MICRLineE13B

Specifies that the image or region of interest contains a special magnetic ink character recognition code zone (MICR), using the E13B font.

  • MRZ

Specifies that the image or region of interest contains a special machine-readable zone (MRZ). To be used this context requires the ocrb.traineddata file available into the specified resource folder (see GdPicture OCR.ResourceFolder property).

  • NumericLineML

Specifies that the image or region of interest contains a line having only numeric symbols. This context is based on the GdPicture machine learning framework (ICR). To be used this context requires the digits.gdpictureml file available into the specified resource folder (see GdPicture OCR.ResourceFolder property).

  • OneOrTwoNumerics

Specifies that the image or region of interest contains one or two numeric symbols which must be decoded. To be used this context requires the sp1.traineddata file available into the specified resource folder (see GdPicture OCR.ResourceFolder property).

  • SingleLineNumerics

Specifies that the image or region of interest contains a line having only numeric symbols. To be used this context requires the sp1.traineddata file available into the specified resource folder (see GdPicture OCR.ResourceFolder property).

Some of them were special requests by customers. If you have a specific case that requires the use of an OCR special context, please let us know! Maybe it could benefit other users as well.

Our deep learning for OCR series

To introduce this first version of the deep learning-based ICR engine, we just published a series of four blog articles:

We hope you will find our resources useful! Don’t hesitate to let us know if you need help with anything or if you have specific queries in machine learning.

Cheers!

Elodie & Nour


Tags: