Document Classification

What is Document Classification?

Workflows often involve document processing and sometimes, you need to classify those documents automatically in your software. One reason can be that your users upload a bunch of different data in a single flow or a single pdf containing different documents. Depending on your use case, automating this might be tricky.

However, with Mindee, you can build an accurate document classification API that meets your particular requirements, have it up and running, and process millions of documents simultaneously.

Document classification

Create Your Classification Document API

To create your classification document API, you need to have different documents which you'll want to classify into different categories. For this example, let's consider these document classes:

  • 1040 Forms
  • Invoices
  • Payslips
  • W9
  • Other

Note: As it’s a dummy example, we put random documents for the “other” class, but in your own use case, it’s better to use real data from your flow that you’d consider as “other”.

  1. Log into your Mindee account. You'll land on the APIs hub page.

  2. Click the Create a new API button on the left.
    Create a new API button on the left

  3. On the Set up your API section, fill in the required information. Give the API a name, a description, and a cover image(optional) and click on Next.
    set up your API

  4. Next, Define your data model by defining the different classes within the classification field.
    define your data model

  • Click on the Classification field

Classification field

  • In the popup, input the different possible classes by filling the form with the classes defined earlier.
    adding the various classwes
  1. Click the Add this classification field button, we are all set.
  2. You can now click the Start training your model button.

Train Your Document Classifier API

Your API is now just deployed! Next we'll train the model.

To do so, we’ll need data, 15 samples for each type should be enough to get very high performances, but it’s up to you to train with more if you want to. It’s going to take you no more than 10 minutes to annotate your data once it’s uploaded. The training interface looks like this:
training interface

  1. On the left part of the training interface, you can upload images, pdf, or zip archives. If you have all the different documents you want to classify in a folder on your laptop, zip it and drag and drop on the upload interface. This opens the data management pane where you have the uploaded documents.
    uploaded zip. file

Note: You can mix pdfs and images, it’s not a problem as our backend will take care of this. Gathering your samples for training is actually the most boring part of the process.

  1. Each data will appear automatically in the pane until it’s ready for annotation. To make the annotation process easier, on the right-top of the screen, click on the Setting icon in the header and check the automatic data loading.
setting pop-up
  1. Click on Your data set on the left bottom of the interface to view the data uploaded.

  2. Select the first document you see in the list.
    data set on the left screenn

  3. Click on the desired class on the right part of the interface for each document.

  4. Click on Validate at the right bottom of the interface.

  5. Repeat this process until you have trained 20 documents to create a trained model.

Model Training

A model is trained every 20 document, and each of them is automatically deployed on your API under new versions:

  • V1.0 = no model
  • V1.1 = 1st model (20 data)
  • V1.2 = 2nd model (40 data)

You get an email when a model is deployed. To know the performances or your model, ask the support.

📘

Info

See Model training to know more on how your models are trained.

Use the API

Your API is now ready to be used in your coding environment. Once your first model is deployed you can test it right away with new data.

Hit the Live interface button on the sidebar, drag and drop a document. You should see something like this:

live interface

The latest version of your API (i.e the latest trained model) is automatically set for the live interface. You can then click the Documentation button in the sidebar. And follow these steps to integrate your API in your application.

 

Questions?
Slack Logo Icon  Join our Slack