Automate identity document processing with Document AI

How many times have you filled out forms requesting personal information? It’s probably too many times to count. When online and signed in, you can save a lot of time thanks to your browser’s autofill feature. In other cases, you often have to provide the same data manually, again and again. The first Document AI identity processors are now generally available and can help you solve this problem.

In this post, you’ll see how to…

Use cases

Here are a few situations that you’ve probably encountered:

In these examples, the requested info – including the portrait photo – is already on your identity document. Moreover, an official authority has already validated it. Checking or retrieving the data directly from this source of truth would not only make processes faster and more effective, but also remove a lot of friction for end users.

Identity processors

Processor types

Each Document AI identity processor is a machine learning model trained to extract information from a standard ID document such as:

Note: an ID can have information on both sides, so identity processors support up to two pages per document.

Availability

Generally available as of this week, you can use two US identity processors in production:

Currently available in Preview:

Notes:

Processor creation

You can create a processor:

Processors are location-based. This helps guarantee where processing will occur for each processor.

Here are the current multi-region locations:

Once you’ve created a processor, you reference it with its ID (PROCESSOR_ID hereafter).

Note: To manage processors programmatically, see the codelab Managing Document AI processors with Python.

Document processing

You can process documents in two ways:

Online requests

Example of a REST online request:

Batch requests

Example of a REST batch request:

Interfaces

Document AI is available through the usual Google Cloud interfaces:

Note: With the client libraries, you can develop in your preferred programming language. You’ll see an example later in this post.

Identity fields

A typical REST response looks like the following:

Here are the detectable identity fields:

Please note that Address and MRZ Code are optional fields. For example, a US passport contains an MRZ but no address.

Fraud detection

Available in preview, the Identity Doc Fraud Detector helps detect tampering attempts. Typically, when an identity document does not “pass” the fraud detector, your automated process can block the attempt or trigger a human validation.

Here is an example of signals returned:

Sample demo

You can process a document live with just a few lines of code.

Here is a Python example:

This function uses the Python client library:

You can collect the detected fields by parsing the document entities:

Note: This function builds a mapping ready to be sent to a frontend. A similar function can be used for other specialized processors.

Finalize your app:

Here is a sample web app in action:

Here is the processing of a French national ID, dropping images from the client:

Note: For documents with multiple pages, you can use a PDF or TIFF container. In this example, the two uploaded PNG images are merged by the backend and processed as a TIFF file.

And this is the processing of a US driver license, captured with a laptop 720p webcam:

Notes:

The source code for this demo is available in the Document AI sample repository.

Related posts

Optimizing your sustainability efforts for resilience

by Kartika Triyanti
1 year ago

How to Make Hybrid Meetings More Inclusive

by Cloud Ace Indonesia
3 years ago

Here’s What to Know About Changes to Kubectl Authentication Coming in GKE v1.25

by Cloud Ace Indonesia
3 years ago