How to Use Form Recognizer to Extract Items From Receipt

2022-01-02 AI-OCR

Table of Contents

In this article, Let’s use Azure Form Recognizer, latest AI-OCR tool developed by Microsoft to extract items from receipt.

form recognizer receipt

Setup Azure

Behind Azure Form Recognizer is actually Azure Cognitive Services like Computer Vision Read API.
So an Azure account is required. Let’s setup azure account and cognitive service resource first.
Firstly let’s open the Azure portal URL.

Azure Portal
https://portal.azure.com/

If you don’t have an Azure account, the page below will show up and you must create your own Azure account first. When you created your Azure free account for the first time, you will get popular services free for 12 months and 25+ services free always and start with $200 credit to use in your first 30 days.

form recognizer receipt

After you finished creating Azure free account, sign in to it.
The home page of Azure will show up like below.

form recognizer receipt

Let’s create cognitive service resource.
Input “cognitive services” in top search bar and click “Cognitive Services” in result list.

form recognizer receipt

The home page of “Cognitive Services” will show up and scroll down to bottom, you will find Multipurpose service and click "+ Create".

form recognizer receipt

Subscription: default, Free account you created.
Resource group: Resource management unit that manages all resources under it. You should click “Create new” and input a name.
Region: Where the computing instance locates, select nearest region.
Name: Input a not used cognitive services name.
Pricing tier: Standard S0
Check terms confirm checkbox and click “Review + create”.

form recognizer receipt

Confirm page will show up and click Create.

form recognizer receipt

When resource deployment is complete, you finished the setup of Azure account.

form recognizer receipt

Start using Form Recognizer Studio

Form Recognizer Studio
https://formrecognizer.appliedai.azure.com/

We will use Prebuilt model “Receipts” this time.

form recognizer receipt

After clicking “Receipts”, configuration dialog will show up.
Subscription: Free Azure account created above. Resource group: Created above in Azure account setup. Cognitive Service Resource: Created above in Azure account setup.

form recognizer receipt

Click “Continue”. Confirm dialog will show up. Click “Finish”.

form recognizer receipt

Receipts recognization workspace will show up. Let’s review the layout of workspace together.
①: Upload receipt images or pdfs that you want to extract items from.
②: Uploaded receipt images or pdfs.
③: Analyze receipt and extract itmes.
④: Scalable image of receipts.
⑤: Extracted results.
⑥: Layers to show (Text, Tables, Selection marks).
⑦: API version.
⑧: Extracted result in JSON format.
⑨: Python code using API.

form recognizer receipt

Above is just preset samples, so let’s download a receipt from Internet to check the performance of Azure Form Recognizer.

form recognizer receipt

Download above image and upload it to Form Recognizer Studio to analyze it.
The item name, quantity and price, etc. are extracted correctly.

form recognizer receipt

You can download the result JSON file and utilize it in other system.

form recognizer receipt

Conclusion

  • To use Azure Form Recognizer, you have to create your own free azure account first and create a resource group, a cognitive service resource.
  • Use prebuilt receipt model to analyze receipt images or pdfs and extract items as JSON result.

Subscribe and be the FIRST reader of our latest articles

* indicates required

Contact us