> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Training while processing documents

> Improve recognition while processing documents: correct field regions in the Verification Station so FlexiCapture for Invoices learns each vendor's invoice layout.

FlexiCapture for Invoices lets you improve recognition quality while processing documents in the Verification Station. If the program fails to detect the correct location of a field on a document image, you can specify its correct location, and the program uses it when recognizing other documents.

## Prerequisites

Training is available only if ABBYY FlexiCapture can reliably identify the company by finding the corresponding record in a database. If you have no databases but still want to use field training, you can accumulate company information by adding records to your data sets while capturing documents. For more information, see [Looking up vendors and business units in the database](/flexi-capture/invoice-reader/ir-data-set-using#addnew).

## Train the program

<Steps>
  <Step title="Collect and feed a batch of documents">
    Collect a batch of documents (for example, invoices processed within the past month) and start feeding them to the program. For more information, see [How to capture invoices](/flexi-capture/invoice-reader/ir-invoices-input).
  </Step>

  <Step title="Let the program recognize and check the documents">
    Once fed to the program, the documents are automatically recognized (only if the **Recognize added images automatically** option is enabled on the **Document Processing** tab of the **Options** dialog box — to open it, click **Tools → Options**), and the data is checked by validation rules.
  </Step>

  <Step title="Open a document that needs correction">
    If a recognized document's status is other than **Valid**, or you have other reasons to believe the program failed to detect some fields, open the document in the document editor.
  </Step>

  <Step title="Confirm the company">
    Review the document form. The **Vendor/Issuer** group of fields must be filled out correctly.

    Training is done independently for each document variant, and documents from the same company are treated as the same variant. If the program fails to identify the issuing company, either select it from your company database or key it in from the document image and save it by clicking **Save**.

    Depending on your project's settings, you may also have to specify the issuing company's unique ID to use its document for training. To do this, type the unique ID in the **VATID** field (this field may have a different name in some projects, depending on the country). The **VATID** is a unique identification number assigned to companies for tax purposes.

    If documents from the same company have widely varying layouts, use the *clustering feature*. For more information, see [Training with clustering](/flexi-capture/ir-clustering).
  </Step>

  <Step title="Adjust the field regions">
    Training succeeds only if all field regions are identified correctly, so make sure the regions match the actual field locations on the image. In the image window of the document editor, adjust the regions or draw regions for the fields the program failed to detect. For more information about marking up line items, see [Training line items](/flexi-capture/invoice-reader/ir-matching-line-items#train-items).

    You can change a field's region in several ways:

    * Place the mouse pointer in a field on the data form, find the corresponding region on the image (highlighted in blue), and click it (or draw a rectangle with the mouse).
    * Place the mouse pointer over a region on the image (highlighted in blue), click it (or draw the region), and then select the corresponding field from the drop-down list that opens.
    * Adjust a region by moving its boundaries with the mouse.
    * Delete an incorrectly located region: place the pointer over its rectangle and, when a red cross appears in the top-right corner, click the cross. Then create the correct region for the field.
    * On the data form, start typing a value into a field. A drop-down list shows the words captured from the image that resemble what you are typing. Select the right word, and the position of that word on the image becomes the field's region.

    After you adjust the markup, the program analyzes the document. If the markup was modified and training for documents from this company is not prohibited, the document is added to the batch.

    <Note>
      The program is trained on all the document's fields, not just those whose regions you drew or adjusted.
    </Note>
  </Step>

  <Step title="Repeat for the remaining documents">
    Open the next document and repeat the review and markup steps.
  </Step>

  <Step title="Let training run">
    To initiate training, a training batch must contain at least one document. If clustering is used, a separate FlexiLayout is created for each cluster; otherwise, a FlexiLayout is created for each company. For more information, see [Training with clustering](/flexi-capture/ir-clustering).
  </Step>

  <Step title="Review the training results">
    The program tests the trained FlexiLayout variant by applying it to all documents in the training batch and comparing the results with the markup you adjusted. If the trained FlexiLayout delivers better results than its earlier version, it is used the next time you recognize documents belonging to this document variant.
  </Step>
</Steps>

## If training doesn't improve results

If the trained FlexiLayout variant delivers worse results than its earlier version, continue training it on documents from the company by repeating the review and markup steps. Training completes when the trained FlexiLayout variant correctly identifies all field regions.

For administrator-side training during project setup, see [Training done by project administrators](/flexi-capture/invoice-reader/ir-training-doc-variants).
