03 Extract Data From Forms With Azure Document Intelligence
03 Extract Data From Forms With Azure Document Intelligence
• Many people still manually extract data from forms to exchange information.
Introduction
• Consider some of the instances when a person needs to process form data:
• Some may also need to complete these tasks in real-time with a customer.
Introduction
• Azure Document Intelligence services provide the building blocks for automation by
using intelligent services to extract data at scale and with accuracy.
• Azure Document Intelligence is a Vision API that extracts key-value pairs and table data
from form documents.
• Process automation
• Knowledge mining
• Industry-specific applications
• Identify how Azure Document Intelligence's document analysis, prebuilt, and custom
models can automate processes
• Use Azure Document Intelligence's Optical Character Recognition (OCR) capabilities with
SDKs and REST API
• Azure Document Intelligence uses Optical Character Recognition (OCR) capabilities and
deep learning models to extract text, key-value pairs, selection marks, and tables from
documents.
• Azure Document Intelligence services return bounding box data and other
information in a structured form with the relationships from the original file.
What is Azure Document
Intelligence?
What is Azure Document
•Intelligence?
To build a high-accuracy model from scratch, people need to build deep learning
models, use a large amount of compute resources, and face long model training times.
• Azure Document Intelligence provides underlying models that have been trained on
thousands of form examples.
• The underlying models enable you to do high-accuracy data extraction from your
forms with little to no model training.
What is Azure Document
Intelligence?
Azure Document Intelligence service
• components
Azure Document Intelligence is composed of the following services:
• Document analysis models: which take an input of JPEG, PNG, PDF, and TIFF files and
return a JSON file with the location of text in bounding boxes, text content, tables,
selection marks (also known as checkboxes or radio buttons), and document structure.
• Prebuilt models: which detect and extract information from document images and
return the extracted data in a structured JSON output. Azure Document Intelligence
currently supports prebuilt models for several forms, including:
• W-2 forms
• Invoices
• Receipts
• ID documents
• Business cards
• Custom models: custom models extract data from forms specific to your business.
Custom models can be trained through the Azure Document Intelligence Studio.
What is Azure Document
Intelligence?
Access services with the client library SDKs or
• REST
You canAPIaccess Azure Document Intelligence services by using a REST API, client
library SDKs, and through the Azure Document Intelligence Studio to integrate the
services into your workflow or application.
Get started with Azure Document
Intelligence
• To start a project with Azure Document Intelligence services, you need to prepare the
following:
• The file size must be less than 500 MB for paid (S0) tier and 4 MB for free (F0)
tier.
• The total size of the training data set must be 500 pages or less.
Get started with Azure Document
Intelligence
Decide what component of Azure Document
Intelligence to use
• After you have collected your files, decide what you need to accomplish.
• To use OCR capabilities to capture document analysis, use the Layout model,
Read model, or General Document model.
• You can train custom models and create composite models with form documents
and JSON documents that contain labeled fields.
Train custom models
• To train a custom model:
1. Store sample forms in an Azure blob container, along with JSON files containing
layout and label field information.
• You can generate an ocr.json file for each sample form using the Azure
Document Intelligence's Analyze document function. Additionally, you need a
single fields.json file describing the fields you want to extract, and a
labels.json file for each sample form mapping the fields to their location in
that form.
3. Use the Build model REST API function (or equivalent SDK method).
4. Use the Get model REST API function (or equivalent SDK method) to get the
trained model ID.
Train custom models
OR
5. Use the Azure Document Intelligence Studio to label and train. There are two
types of underlying models for custom forms custom template models or custom
neural models.
• Custom neural models are deep learned models that combine layout and
language features to accurately extract labeled fields from documents.This
model is best for semi-structured or unstructured documents.
Use Azure Document Intelligence
models
Using the API
• To extract form data using a custom model, use the analyze document function of
either a supported SDK, or the REST API, while supplying model ID (generated
during model training).
• This function starts the form analysis. which you can then request the result to
get the analysis.
• This function starts the form analysis. which you can then request the result to
get the analysis.
document_analysis_client = DocumentAnalysisClient(
endpoint=endpoint, credential=AzureKeyCredential(key)
)
# Make sure your document's type is included in the list of document types the custom model
can analyze
task = document_analysis_client.begin_analyze_document_from_url(model_id, formUrl)
result = task.result()
Use Azure Document Intelligence
models
Using the API
• A successful JSON response contains analyzeResult that contains the content
extracted and an array of pages containing information about the document
content.
• You want to make sure that the form you're analyzing has a similar appearance to
forms in the training set if the confidence values are low.
• If the form appearance varies, consider training more than one model, with each
model focused on one form format.
• Depending on the use case, you might find that a confidence score of 80% or
higher is acceptable for a low-risk application.
• For more sensitive cases, like reading medical records or billing statements, a
score of 100% is recommended.
Use the Azure Document Intelligence
Studio
• In addition to SDKs and the REST API, Azure Document Intelligence services can
be accessed through a user interface called the Azure Document Intelligence
Studio (preview), an online tool for visually exploring, understanding, and
integrating features from the Azure Document Intelligence service.
• The Studio can be used to analyze form layouts, extract data from prebuilt
models, and train custom models.
Use the Azure Document Intelligence
Studio
Use the Azure Document Intelligence
Studio
The Azure Document Intelligence Studio currently supports the following projects:
o Layout: Extract text, tables, selection marks, and structure information from
documents (PDF and TIFF) and images (JPG, PNG, and BMP).
o General Documents: Extract key-value pairs, selection marks, and entities from
documents.
• Prebuilt models
• Custom models
Use the Azure Document Intelligence
Studio
Build Document analysis model
projects
• To extract text, tables, structure, key-value pairs, and named entities with document
analysis models:
• Analyze your document. You'll need your Azure Document Intelligence or Azure
AI service endpoint and key.
Use the Azure Document Intelligence
Studio
Build prebuilt model projects
• To extract data from common forms with prebuilt models:
• Analyze your document. You'll need your Azure Document Intelligence or Azure
AI service endpoint and key.
Use the Azure Document Intelligence
Studio
Build custom model projects
• You can use Azure Document Intelligence Studio's custom service for the entire process of
training and testing custom models.
• When you use Azure Document Intelligence Studio to build custom models, the ocr.json files,
labels.json files, and fields.json file needed for training are automatically created and stored in
your storage account.
• To train a custom model and use it to extract data with custom models:
2. A person needs to build an application that submits expense claims and extracts the
merchant, date, and total from scanned receipts. What's the best way to do this?
3. A person is building a custom model with Azure Document Intelligence services. What is
required to train a model?