Building Production-Grade spaCy Text Classification Pipelines for Business Data
Unlock the full potential of spaCy with this guide to building production-grade text classification pipelines for business data.
The state of invoice processing remains alarming and surprising — 36% of firms still use paper invoicing, 47% rely on manual approvals, and 44% are still looking to add invoice automation. But why are these numbers so high and why haven't four decades of computerization and automation brought them down? Do you have to deal with invoicing problems in your business too?
In this article, you'll learn about the significant problems of existing systems, find out how deep learning algorithms for automated data extraction eliminate most of those drawbacks, and learn the six steps to add fully automated invoice data extraction to your business.
Your business or organization purchases goods and services from multiple vendors. The invoices they send you are processed by your accounting department. But the problem is that most invoices and receipts are meant to be read by people and not by software systems. So accounting teams have to enter the data into your accounting system, check it for problems, confirm the details with other departments, and release payments as per each vendor's payment terms. In some cases, specific data points are pulled to be stored for business or marketing purposes.
If you're a medium or large business, you may receive hundreds of such invoices or receipts every day. Processing them is a process that requires a ton of manual hours and resources to ensure the data is stored correctly in software such as Quickbooks or your internal CRM.
But this process can be transformed into a faster, automated, and less erroneous process using automated invoice data extraction systems. They use machine learning to extract the different data points and understand what they are (price, name, quantity, product) in any invoice — even a paper or handwritten invoice — regardless of its layout, formatting, language, currency, and other details. They extract all that information as structured data that can be consumed by downstream systems such as ERPs, CRM, and internal databases.
To appreciate their benefits, you need to first understand all the typical problems businesses face when processing invoices using other methods.
Processing invoices manually still happens in about 36% of U.S. businesses.
The points of contact assigned to vendors receive their invoices first. They do basic checks like looking for missing details, wrong line items, and other obvious problems. However, they can't practically check for deeper problems like duplicated entries across invoices or fraudulent entries. Invoices that pass the basic checks are passed on to the accounting department.
The accounts payable team then enters the key data in their internal database or accounting system. They may check for deeper problems like duplicated or fraudulent entries and mismatches with purchase orders. But even such checking requires manual querying and searching in their data. Typically, a senior accountant then double checks everything to reduce errors.
So manual processing suffers some major challenges:
Most businesses know about these problems and have tried to use semi-automated approaches for years. But those have problems too, as we'll see next.
Most businesses of all sizes today use semi-automated invoice processing involving optical character recognition (OCR) and template matching. OCR is first used to extract all the text found in an invoice along with their positions. Then custom parsing rules are created to process that text based on its positions and words.
While this works for standardized documents, it doesn't work well for invoices. Invoices vary widely in layouts and positions. So existing invoice management systems have tried to ease the problem using the concept of invoice templates.
An invoice template is a collection of positional information and parser rules that allow the management system to transform unstructured text into a semblance of structured data if that invoice matches that template. They try to make template creation easy by providing visual editors and predefined rules. But what if you receive dozens or hundreds of invoices from different vendors every day? Because these templates are not very flexible, the only option is to create a template for every unique invoice layout.
So even these semi-automated approaches bring several challenges:
Semi-automated approaches do not contain deep learning models that can create a learned relationship between invoice text, text positioning, and keywords to automatically extract invoice data that matters to us.
Leveraging natural language processing and computer vision architectures to handle all stages of invoice processing is a game changer. These architectures allow us to create pipelines that can process a huge amount of variation in invoices or receipts with breathtaking accuracy in a matter of seconds. Let's understand the significant business benefits of such a system over the older manual and template-based approaches.
Instead of relying on rigid rules and simple pattern matching, these systems understand the semantics of invoice data the way people do. So they can handle invoices with any layout, formatting, lighting conditions, and other aspects. They quickly learn the relationship between the text on the invoice and the fields you’re looking for. These deep learning architectures can extract from row based invoices, grids, receipts, all while being able to handle different levels of input data for the field. That means if your product name is 2 words or 20 the field can be extracted and understood for what it is. Some fields such as price or quantity need even less information and can rely on the architectures understanding of column names and the location of fields.
Unlike traditional OCR, deep learning combines visual features and natural language models for true entity understanding. They are largely immune to typos and wrong identification of characters. The high accuracy also brings significant downstream benefits like reducing the risks of financial losses or late payment penalties.
The accuracy of OCR products for these invoices just simply does not cut it. These APIs do not have the deep level understanding of the different fields on an invoice that allows you to map them when extracting. On top of that, these APIs do not allow for custom fine-tuning on your specific data to provide an in-context boost of accuracy.
Intelligent processing that matches human-level understanding streamlines every step of the invoice processing pipeline. High accuracy significantly reduces the time, effort, and money spent on manual data entry and double-checking. This pipeline runs in a matter of seconds and removes the need for any human intervention.
The ability to intelligently understand invoice data means these systems can automate other accounting practices too:
Width.ai automated invoice extraction offers state of the art accuracy in a fully automated and hands off pipeline that processes your invoices in seconds. The API can be customized to automatically accept invoices from your internal workflows and automatically push the grabbed invoice data to your CRM, ERP, DB, or email. The pipeline is fully customizable and can be fine-tuned for your specific domain or invoices to push the accuracy even higher. No matter if you have zero invoices or millions you can deploy this architecture and start processing documents in just 6 easy steps.
The first step is planning how to include our system in your existing business practices. This involves answering questions like:
The answers to such questions help us assess your integration and deployment requirements. For example, if you want thousands of historical invoices processed in a short time, we deploy additional cloud infrastructure to process your workload. If you're a large enterprise with hundreds of general ledger codes, then we train a secondary machine learning model to automatically generate a code for each invoice line item.
Our system supports a wide variety of invoice file formats and sources. It does not require you to provide invoice templates or define a given set. In this step, you should set up your invoice input pipeline and tell our system about the sources of invoices.
If some of your vendors still send paper invoices, we should set up a data capture pipeline for invoice scanning and digitize them to image formats like PDF. A scanner is perfect if you have it, but our system is capable of processing images/PDFs with varying levels of quality.
The second approach is probably the easiest way to integrate our automated system into your accounting workflows. Equip your current manual processors with photo taking tools and set them up to transfer the invoice photos to internal network storage or to cloud storage like AWS S3. Our system can automatically fetch new files from there and process them.
Many businesses already send PDF invoices or other digital formats. Our system can read these files directly and process them without any invoice templates. We’ll configure our system to read them from your internal databases, emails, or others.
If your business has an invoice management system (like FreshBooks, QuickBooks, Zoho Books, Xero, or Pilot) or an accounting system (like SAP FI), our system knows how to query and fetch invoices directly from them using their APIs. Our system does not need fine-tuning to start processing your invoices from the most common invoice management systems.
Fine-tuning the deep learning models used to extract text and understand the relationship between text and fields allows us to go from the baseline models built to support as much data variance as possible to a domain specific pipeline optimized for your use case. Fine-tuning also allows for us to add unique fields or special remarks to the list of fields that are extracted when your invoices are processed. This is a huge part of the equation as it allows us to take the state of the art architecture we’ve built and fully customize it to your business workflow.
Right out of the box, our system understands invoice layouts produced by popular invoicing software like FreshBooks and others at a high level with good data variance coverage. We want to boost the accuracy for your specific business workflow and will fine-tune the deep learning models on real invoice and receipt examples from your business.
Layout variations may not be your only concern. While our model supports over 50 of the most common fields right out of the box, you may want to extract additional important information according to your unique accounting practices. For example:
Our system efficiently handles special information that is important to your business. For example, its natural language processing capabilities enable it to understand a sentence with payment terms and automatically file it under the payment terms field.
Our customizable pipeline allows you to add new fields that you want to extract on top of the 20+ default fields provided. We handle all the fine-tuning required to add these new fields to your specific pipeline.
Customizations based on one vendor's invoice can be automatically applied to all invoices across any vendor, or a subset of invoices. Our system then automatically looks for semantically similar information in every invoice (including older invoices if you want) to populate the relevant fields.
Some of the custom information we have extracted or added using such techniques include:
The ability to integrate with popular accounting systems and practices straight out of the box is an important requirement for any automated invoice data extraction that aims to save time and effort. Our system comes with the following built-in export and storage integration features:
You can route the extracted data to multiple export workflows for any subset of invoices based on custom criteria, like vendor names or invoice amounts.
Once you have configured and fine-tuned our system to your invoices, it's ready to process your invoices in bulk and start extracting structured data with minimal manual intervention. Let's understand how it works under the hood.
First, let's understand the high-level end-to-end processing of an invoice.
The heart of the system is a state of the art deep learning architecture. We’ve trained it on thousands of invoices — generated by ten of the most popular invoice management systems like FreshBooks and QuickBooks — to help it detect text, recognize the text characters, and associate invoice elements with appropriate fields. To do this, the system uses various characteristics of these elements, like their:
By focusing on the most popular examples from businesses, our system produces high accuracy right out of the box but also has enough flexibility to adapt to your specific business use cases.
In the third step where you refine it by providing your invoices, we clone our latest model and fine-tune it on your invoices to create a model that's adapted to your invoices. Your preferences, like custom fields, help further refine this model to identify the data you want.
This customized model is now ready to process your new invoices. It scans each invoice to extract visual and linguistic characteristics. The combinations of characteristics trigger different areas of the neural network to identify an element as an address, purchase order, invoice number, etc.
Some elements may require additional processing. For example, a secondary deep learning model classifies the line items identified in your invoices to output their general ledger codes.
The primary output of this phase is a set of fields and their values. This data is then routed to one or more export pipelines to produce reports in different formats or export data to an accounting system.
Text detection and text recognition are important steps in this process. Text detection classifies regions in the input invoice as text or non-text elements (like lines of tables). Our system can identify handwritten text, irregularly oriented text, and signatures as text.
Text recognition involves recognizing the characters in the text. This is done based on visual features and a language model that gives the most probable words given the neighboring characters and the typical words in invoices. Such text understanding using multiple features provides far higher accuracy than plain OCR.
We use a state of the art deep learning pipeline to handle extracting visual features, text, and any other fine-tuned fields. This is used to get all the text from the invoice as well as any visual information that will help us understand what fields in your system match to what data.
The recognized text is further refined by a second subnetwork that specializes in natural language processing, like GPT-3. This model is trained on large volumes of text, like books and websites. As a result, it can identify typos and weird word combinations that are unlikely in the real world.
With all text fragments accurately identified and located, the final subnetwork is a deep learning model that identifies those fragments as fields or field values. It does so based on their meanings, positions on the page, and positions relative to each other — exactly like a person would. For example, a string that has numbers and dashes in the upper regions of an invoice is probably the date of issue while a date in the lower regions is probably the last date of payment. Using such knowledge, it identifies a text fragment as a field value and classifies a probable field name for it.
The final outputs of this model are a set of detected field values and their field names.
While we aim for minimal manual intervention in bulk invoice processing, monitoring metrics is necessary to ensure accuracy, and real-time alerts are needed to inform personnel about the progress or any issues that come up.
The initial runs may show some errors in text recognition and field identification. If that happens, it's a hint to refine your model by providing more samples of problematic invoices. Our system reports metrics like accuracy, precision, recall, and F1-scores on the training and test invoices after each refinement step to help you understand the accuracy when extracting data from any invoice format.
Our system also tells you confidence scores for each processed invoice. Invoices that are proving problematic for the model show low confidence scores. This is a great way for you to monitor the results of the invoice processing at a high level without needing to evaluate each invoice.
Whenever a set of invoices are processed or metrics fall short of thresholds, our system can notify personnel or workflows that are waiting for the extracted data. Our system supports alerts through:
You’ve seen our architecture used to extract data from invoices using artificial intelligence and deep learning to provide an instant reduction of manual effort and costly resource consumption. The benefits are instant as you start to extract structured data and process it into your accounting system wih state of the art accuracy and zero human input required.
At Width.ai, we have years of expertise in developing highly accurate information extraction systems using the latest deep learning innovations. We can customize our invoice processing solution to your exact business requirements and use cases. Contact us to see a demo of our invoice processing!
Unlock the full potential of spaCy with this guide to building production-grade text classification pipelines for business data.
We compare 12 AI text summarization models through a series of tests to see how BART text summarization holds up against GPT-3, PEGASUS, and more.
Let’s take a look at what intent classification is in conversational ai and how you can build a GPT-3 intent classification model for conversational ai and chatbot pipelines.
Discover the capabilities of zero-shot object detection, which enables anyone to use a model out-of-the-box without any training and generate production-grade results.
What is facial expression recognition and what SOTA models are being used today in production
Get a simple TensorFlow facial recognition model up & running quickly with this tutorial aimed at using it in your personal spaces on smartphones & IoT devices.
Explore accurate classification algorithms using the latest innovations in deep learning, computer vision, and natural language processing.
Learn what human activity recognition means, how it works, and how it’s implemented in various industries using the latest advances in artificial intelligence.
What is the the SetFit architecture and how does it outperform GPT-3 and other few shot large language models
What is image classification and how we build production level TensorFlow image classification systems for recognizing various products on a retail shelf.
Explore the application of intelligent document processing (IDP) in different industries and dive in-depth on intelligent document pipelines.
How to build an image classification model in PyTorch with a real world use case. How you can perform product recognition with image classification
Let's build a custom CTA generator that you'll actually want to use for your website copy
We’re going to look at how we built a state of the art NLP pipeline for blended summarization and NER to process master service agreements (MDAs) that vary the outputs based on the input document and what is deemed important information.
Get a comprehensive overview of a purchase order vs. invoice, including when businesses use each, what information goes in them, and more.
Learn what Google Shopping categories are used for and how you can automate fitting products to this taxonomy using ai.
Automatically categorize your Shopify store products to the Shopify Product Taxonomy instantly with ai based PIM software
Dive deep into 3-way invoice matching, including how it works, eight benefits for your business, and the problems with doing it manually.
Smart farming using computer vision and deep learning provides the most promising path forward in the slow-moving industry of agriculture.
How we leveraged large language models to build a legal clause rewriting pipeline that generates stronger language and more clarity in legal clauses
Using ai for document information extraction to automate various parts of the loan process.
Apply AI to your favorite sport with this guide. Learn how automated ball tracking can change the game for coaches and players.
Categorize your ecommerce products to the 2021 google product taxonomy tree instantly with our Ai software
Surveying the current landscape of ecommerce automation and how you can use ai to automate huge chunks of your product management.
Classify your product data against an existing product category database or generate categories and tags in seconds using artificial intelligence
Warehouse automation plays a crucial role across your supply chain. Learn about how machine learning and ai software can be integrated into your warehouse automation stack.
4 different NLP methods of summarizing longer input text into different methods such as extractive, abstractive, and blended summarization
iscover an invoice OCR tool that will revolutionize the way you handle invoices. There’s no human intervention needed & a dramatically lower per-invoice cost.
Instead of invoice matching taking upwards of a week, it could take mere seconds with the proper automation solution. Learn more here.
Manual and template-based invoicing are riddled with low accuracy and required human intervention. Learn how to systematically eliminate these issues with the right invoice data capture software.
A complete walkthrough guide on how to use visual search in ecommerce stores to create more sales and real examples of companies already using it.
How you can use machine learning based data matching to compare data features in a scalable architecture for deduping, record merging, and operational efficiency
Learn how lifetime value or LTV prediction can improve your marketing strategies. Then, discover the best statistical & machine learning models for your predictions.
A deep understanding of how we use gpt-3 and other NLP processes to build flexible chatbot architectures that can handle negotiation, multiple conversation turns, and multiple sales tactics to increase conversions.
The popular HR company O.C. Tanner, which has been in business since 1927 and has over 1500 employees, was looking to research and design two GPT-3 software products to be used as internal tools with their clients. GPT-3 based products can be difficult to outline and design given the sheer lack of publicly available information around optimizing and improving these systems to a production level.
We’ll compare Tableau vs QlikView in terms of popularity, integrations, ease of use, performance, security, customization, and more.
With a context-aware recommender system, you can plan ways to recreate some of the contextual conditions that persuade them to buy more from you.
We’re going to walk through building a production level twitter sentiment analysis classifier using GPT-3 with the popular tweet dataset Sentiment140.
Find out how machine learning in medical imaging is transforming the healthcare world and making it more efficient with three use cases.
Discover ways that machine learning in health care informatics has become indispensable. Review the results of two case studies and consider two key challenges.
Accelerate your growth by pivoting key areas of your business to AI. Your business outcomes will be achieved quicker & you’ll see benefits you didn’t plan for.
We built a GPT-3 based software solution to automate raw data processing and data classification. Our model handles keyword extraction, named entity recognition, text classification | Case Study
We built a custom GPT-3 pipeline for key topic extraction for an asset management company that can be used across the financial domain | Case Study
How you can use GPT-3 to create higher order product categorization and product tagging from your ecommerce listings, and how you can create a powerful product taxonomy system with ai.
5 ways you can use product matching software in ecommerce to create real value that raises your sales metrics and improves your workflow operations.
Data mining and machine learning in cybersecurity enable businesses to ensure an acceptable level of data security 24/7 in highly dynamic IT environments. Learn how data security is getting increasingly automated.
Product recognition software has tremendous potential to improve your profits and slash your costs in your retail business. Find out just how useful it is.
Big data has evolved from hype to a crucial part of scaling your organization in every modern industry. Learn more about how big data is transforming organizations and providing business impacts.
Learn how natural language processing can benefit everybody involved in education from individual students and teachers to entire universities and mass testing agencies.
Here’s how automated data capture systems can benefit your business in some key ways and some real-life examples of what it looks like in practice.
Use these power ai and machine learning tools to create business intelligence in your marketing that pushes your business understanding and analytics past your competition.
We built a custom ML pipeline to automate information extraction and fine tuned it for the legal document domain.
In this practical guide, you'll get to know the principles, architectures, and technologies used for building a data lake implementation.
Find out how machine learning in biology is accelerating research and innovation in the areas of cancer treatment, medical devices, and more.
An enterprise data warehouse (EDW) is a repository of big data for an enterprise. It’s almost exclusive to business and houses a very specific type of data.
Dlib is a versatile and well-diffused facial recognition library, with perhaps an ideal balance of resource usage, accuracy and latency, suited for real-time face recognition in mobile app development. It's becoming a common and possibly even essential library in the facial recognition landscape, and, even in the face of more recent contenders, is a strong candidate for your computer vision and facial recognition or detection framework.
Learn how to utilize machine learning to get a higher customer retention rate with this step-by-step guide to a churn prediction model.
Machine learning algorithms are helping the oil and gas industry cut costs and improve efficiency. We'll show you how.
We’ll show you the difference between machine learning vs. data mining so you know how to implement them in your organization.
Here’s why you should use deep learning algorithms in your business, along with some real-world examples to help you see the potential.
Beam search is an algorithm used in many NLP and speech recognition models as a final decision making layer to choose the best output given target variables like maximum probability or next output character.
Best Place For was looking for an image recognition based software solution that could be used to detect and identify different food dishes, drinks, and menu items in images sourced from blogs and Instagram. The images would be pulled from restaurant locations on Instagram and different menu items would be identified in the images. This software solution has to be able to handle high and low quality images and still perform at the highest production level, while accounting for runtime as well as accuracy.
Deep learning recommendation system architectures make use of multiple simpler approaches in order to remediate the shortcomings of any single approach to extracting, transforming and vectorizing a large corpus of data into a useful recommendation for an end user.
Let's take a look at the architecture used to build neural collaborative filtering algorithms for recommendation systems
GPT-3 is one of the most versatile and transformative components that you can include in your framework, application or service. However, sensational headlines have obscured its wide range of capabilities since its launch. Let’s take a look at the ways that companies and researchers are achieving real-world results with GPT-3, and examine the untapped potential of this 'celebrity AI'.
How to get started with machine learning based dynamic pricing algorithms for price optimization and revenue management
Let's take a look at how you can use spaCy, a state of the art natural language processing tool, to build custom software tools for your business that increase ROI and give you data insights your competitors wish they had.
The landscape for AI in ecommerce has changed a lot recently. Some of the most popular products and approaches have been compromised or undermined in a very short time by a new global impetus for privacy reform, and by the way that the COVID-19 pandemic has transformed the nature of retail.
Extremely High ROI Computer Vision Applications Examples Across Different Industries
Building Data Capture Services To Collect High ROI Business Data With Machine Learning and AI
Software packages and Inventory Data tools that you definitely need for all automated warehouse solutions
Inventory automation with computer vision - how to use computer vision in online retail to automate backend inventory processes