Applies to version 8.3.x; Author: Paweł Snoch
WEBCON BPS offers clients a solution allowing them to automatically recognize and register documents. This article is a follow up on our guide to installing OCR AI. With the introduction of version 8.3, a mechanism for defining your own custom fields was implemented, greatly enhancing the versatility of OCR AI. Recognition and learning mechanisms have also been improved.
By default, the system provides a set of standard form fields defined in every OCR AI project, these standard fields include: VAT ID, payment date, sale date, etc. These fields are always predefined in OCR AI projects provided by WEBCON. In earlier versions, there was no way of adding your own customized fields to OCR AI projects directly from Designer Studio.
In the newest version however, using only Designer Studio, a user can easily define additional parameters if necessary.
This article contains two examples of Custom field use:
- Adding Post-Office (City) recognition to a basic Invoice recognition process.
- Sample use of a custom OCR fields in processes unrelated with invoice workflows.
The last part of the article will feature a demonstration of the Teach OCR AI process, along with some other technical details that should be taken into consideration.
Adding post-office recognition to a standard Invoice recognition process
Assuming that there is an invoice workflow is already in place , go to the System settings tab and then to the OCR AI Projects node. Select the OCR AI project for which you wish to define a new field, which hasn’t been searched for until now. The bottom section of project screen contains the Custom fields list. Click the Add button to configure a new custom field.
Fig. 1. Creating custom fields in the OCR AI Project menu.
In the pop-up window we can define a name for our custom field, the name may contain alphanumerical characters, spaces and underscores. The ID field is generated automatically based on the entered name and exiting custom fields in the database.
The Recognition settings section allows us to define a template for the searched phrase. The idea is to portray this template using an adequate Regular Expression. (It is recommended to use the provided wizard) . Defining a RegEx is not necessary however, and so the Define field format checkbox can be left unchecked.
A defined custom field may be edited later, however the ID will always remain the same. Keep in mind that altering the Recognition settings section will have no effect on the recognition capabilities of an existing custom network.
A point about RegEx:
The value entered into the RegEx field is used as a validator – this means that for the example in the screenshot above (Fig. 1), an OCR AI Recognition action will fail to pick up post-office location names containing more than one word, e.g. Welwyn Garden City. As a result, the OCR learning process will yield no results. Let us adjust the RegEx field to look something like this:
Fig. 2. Custom field edit window.
With the OCR AI project correctly configured, go to the Processes tab and find the process which uses of the OCR AI project that you just modified. We will need extra form fields to accommodate the new data obtained from custom fields – add an appropriate number of text form fields where this data will be saved. Next navigate to the Advanced configuration screen of the OCR AI recognition action which uses the modified OCR AI project, the newly added custom field should be listed under Form fields and mapping settings. Map the new custom OCR AI field(s) to the newly added workflow form field(s) and save the configuration.
Fig. 3. Mapping settings.
We can now test the modified workflow. Keep in mind that it will be necessary to run a Teach OCR AI process to educate the project on which values to put in what form fields.
Example of using custom OCR fields for processes completely unrelated with invoice workflows
The second example is supposed to demonstrate the variety of ways in which custom OCR fields can be used, and how easy it is to go beyond standard invoice processing. Think of a scenario in which your company receives resumes (Curriculum Vitae) documents in paper or electronic form. We need a process which starts new workflow elements based on text files – additionally filtering the data so that it appears in the desired order. To keep things simple, let’s skip setting up a proper distinguisher for now – it could be related to the resume layout or design.
For invoices, the standard go-to distinguisher is the Taxpayer Identification Number (TIN) or the VAT Identification Number (VATIN) of whoever issued the invoice, this is because the values of these fields are unique to a single company, and invoices issued by the same company usually have the same layout/structure/design.
Distinguisher (OCR AI) – The distinguisher is a specific value of a designated form field, for which a custom network is created and maintained. Custom networks used in teaching and recognition actions are selected based on this distinguisher.
For example: Imagine an Invoice OCR workflow, where the value of the form field: Company name is the distinguisher. The OCR AI mechanism finds the Company name field on the invoice document, it finds that the value is ABCD. It will now use the custom network created for the company ABCD, in order to increase the accuracy of recognizing values on their invoices. Similarly, Company names: LMNO and WXYZ are also distinguishers, having their own custom networks, so that if the OCR mechanism finds invoices issued by those companies, it will use their respective custom networks for better recognition accuracy and speed (and later improve them through Teach OCR AI if necessary).
Go to the main OCR AI projects node and create a New project. Add your desired set of custom fields to the list.
Fig. 4. Creating new OCR project
Now it is time to construct the workflow
Fig. 5. CV Recognition workflow.
The first step is registering an attachment, the second step is a system step – adding a text layer in order to edit and overwrite the existing attachment. Step three – probably the one we are most interested in, this step will run OCR AI recognition to automatically read values from a resume and inserting them into the form.
Next we should verify the results of the OCR AI recognition, so that we can additionally teach the custom network if needed. After verifying the results, we can choose between an additional learning cycle or archiving the element.
Fig. 6. OCR AI Actions.
Teaching the OCR AI custom networks
This function should be carried out by an administrator only. Let’s continue using the the workflow from the second example (We need to define a distinguisher though, since custom networks are created, and maintained, for a specific value of the distinguisher field – for the purpose of this example, I went with a field named Document type) and throw in a resume document to see what happens. At the very beginning, custom networks are unformed, so value recognition in custom fields can be rather erratic.
Fig. 7. Initial recognition.- note that the wrong address was copied to the “Dwelling-place” field
Before launching the first teaching phase, verify the algorithm’s results. Enter ADMIN mode, an information panel should appear in the bottom-left corner, click on the element’s History. Check the details of step on which the OCR AI recognition action is defined. Information about the actions that were carried out on the step can be seen at the end.
Fig. 8. Admin view – Action summary
In our case, we only have one action: CV recognition. The bullet-point list contains all attachments on which a text layer was found. The action: CV recognition was also carried out for every attachment on this list. Clicking on an element will allow you to check the filtering that was applied from the RegEx defined earlier.
Fig. 9. OCR recognition details
The tooltip contains the ID’s of the fields that we added to the OCR AI project. The first thing you want to check is to see if a match was found, and also the list of found matches and the probability of the match being correct. If any parameters were skipped, info about them can be found at the very bottom. When recognition or teaching actions happen to have sub-par results, remember about these problematic custom fields – go back to see if they have been defined properly. You can also screen the configurations settings of actions for errors – e.g. Text layers are created on unnecessary attachments.
It is time to carry out the necessary preparations for Teach OCR AI. As before, it is recommended to use the History to help you.
Fig. 10. Teach OCR AI details
As you can see in the screenshot above, we have 4 attachments that affect the recognition capabilities of this custom network. There are two ways of honing the recognition accuracy:
- Take a look at the found attachments and whether the recognition process found all values correctly – the custom network considers these attachments to be recognized ‘correctly’ and will base future recognition attempts on them, so it is imperative that they are indeed correct.
- Introduce more attachments with the same distinguisher value and perform the Teach OCR AI process on them, using them to improve this custom network.
For teaching custom networks, we should use up to 100 of the most recent documents (resumes, in our case) on the condition that they have the same distinguisher value and aren’t older than a year.
As more examples are used to teach the custom network, it’s accuracy in recognizing the characteristic fields will increase. Sooner or later all values will be recognized correctly on every single attempt (in our case it took three Teach OCR AI actions).
Fig. 11. Final verification.