> ## 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.

# Auto-create a FlexiLayout

> Train ABBYY FlexiLayout Studio on marked-up fields and static elements to auto-create FlexiLayouts, generate layout alternatives, and set training options.

ABBYY FlexiLayout Studio lets you create [FlexiLayouts](/flexi-capture/fls/template/ftemplate) by training it on marked-up fields and static elements.

Static elements are elements that appear on documents of the same type. The most common type of static element is static text (a word, a part of a word, or a line of text). Less common examples include separators and barcodes.

Fields are the blocks that FlexiLayout Studio must detect to extract text (a word, a part of a word, a line, or a paragraph) or a barcode.

FlexiLayouts created this way can be used in ABBYY FlexiCapture to detect fields on document images based on their positions relative to static elements. Using training to create FlexiLayouts can be much easier than creating them manually.

ABBYY FlexiLayout Studio also lets you create several [layout alternatives](/flexi-capture/fls/template/alternative-layout). Layout alternatives are versions of a FlexiLayout that have different static element settings but share the same set of fields. They can be trained using the training mode or while editing a FlexiLayout.

## FlexiLayout training considerations

* FlexiLayout Studio uses images from the training set. You can add images to the training set at any point before you generate a FlexiLayout. The training set must contain at least 3 pages.
* You can only edit the static elements of a layout alternative. All alternatives of a FlexiLayout have the same fields.
* If the page contains unmarked fields or static elements when you edit a layout alternative, the FlexiLayout is automatically applied to the page. Any new field blocks detected this way are added to the FlexiLayout, while existing field regions are not changed.
* If you add blocks to an existing FlexiLayout, these blocks do not appear in the training mode. You can create these blocks using the **Initialize Fields By Blocks** command on the shortcut menu of the FlexiLayout.

## Create a FlexiLayout in the training mode

<Steps>
  <Step title="Create or open a project">
    Create a new project, or open an existing project that already contains a FlexiLayout.
  </Step>

  <Step title="Switch to the training mode">
    Click the <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Button_Training.png?fit=max&auto=format&n=fmgRWFNHKYN2MLSg&q=85&s=a61d1e0e9ecd532479f3e5cc3eb965f4" alt="Training mode button" style={{display:"inline-block",verticalAlign:"middle",margin:0}} width="24" height="20" data-path="images/flexi-capture/fls/Button_Training.png" /> button, or select **Training Mode** from the **Training** menu.
  </Step>

  <Step title="Pre-recognize the images in the Batch pane">
    Select all images, right-click them, and click **Pre-Recognize** on the shortcut menu. Alternatively, open the **Batch** menu and click **Pre-Recognize**.
  </Step>

  <Step title="Open and study an image">
    Double-click any image to open it. Study the [recognition results](/flexi-capture/fls/batch/prerecognition-run), and then specify the fields and static elements that you want to use for training the FlexiLayout.
  </Step>

  <Step title="Select a reference alternative in the Training window">
    Select a layout alternative from the **Reference Alternative** drop-down list, or create a new one.
  </Step>

  <Step title="Set the Auto references option">
    To generate reference elements automatically, leave the **Auto references** option enabled. If this option is disabled, you must specify reference elements manually.

    <Note>
      * If the **Auto references** option is disabled, automatically generated reference elements are added to the **Static elements** list, and their positions are marked on pages. You can remove unnecessary elements or add new ones. If the **Auto references** option is enabled, manually added elements are deleted.
      * The contents of the **Training** window depend on whether the **Auto references** option is enabled or disabled. If it is disabled, the **Training** window contains two areas: the **Fields** area with a list of fields and the **Static elements** area with a list of static elements. If the **Auto references** option is enabled, only the **Fields** area is present in the **Training** window.
    </Note>
  </Step>

  <Step title="Mark fields and static elements in the Image window">
    Use the following tools to mark the areas:

    * Use the **Create Block** <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Button_New_Block.png?fit=max&auto=format&n=fmgRWFNHKYN2MLSg&q=85&s=a8a1506d12630fcec77bc2522a66e278" alt="Create Block button" style={{display:"inline-block",verticalAlign:"middle",margin:0}} width="24" height="25" data-path="images/flexi-capture/fls/Button_New_Block.png" /> tool to mark areas of blocks on the image. The names of the blocks you have marked appear in the **Fields** list.
    * Use the **Create Element** <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Button_Create_Element.png?fit=max&auto=format&n=fmgRWFNHKYN2MLSg&q=85&s=80ec4b850e8d4cfe27a206e1c6803546" alt="Create Element button" style={{display:"inline-block",verticalAlign:"middle",margin:0}} width="23" height="23" data-path="images/flexi-capture/fls/Button_Create_Element.png" /> tool to mark areas of static elements. The names of marked elements appear in the **Static elements** list.

    <Note>
      - FlexiLayout Studio uses recognized text near marked fields and elements to generate their names. These names appear in bold font when the area of the field or element is detected on the page.
      - The **Create Block** and **Create Element** tools can be used when viewing a **Reference Layout** or **Difference Layout**, but the **Create Element** tool is only available when creating reference elements manually.
    </Note>

    You can also use commands on the [shortcut menu](/flexi-capture/fls/interface/local-menu#training) to mark fields and static elements. Use the **Draw Location** <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Button_Draw_Location.png?fit=max&auto=format&n=fmgRWFNHKYN2MLSg&q=85&s=8f9a84915725c8d433844e218e3d1907" alt="Draw Location button" style={{display:"inline-block",verticalAlign:"middle",margin:0}} width="23" height="21" data-path="images/flexi-capture/fls/Button_Draw_Location.png" /> tool to mark a field or element, right-click the marked area, and then click the command on the shortcut menu.
  </Step>

  <Step title="Add the pages to the training set">
    Select the pages in the **Used For Training** column of the **Batch** window.
  </Step>

  <Step title="Predict the draft layout">
    Click **Predict Draft Layout** on the shortcut menu of images.
  </Step>

  <Step title="Check detection and correct the markup">
    Check whether fields and elements were detected correctly on all images in the batch, and correct the markup where necessary. Add all pages where FlexiLayout Studio failed to detect fields or elements to the training set.

    To mark an element that is not present on the page, click **Not Present** on the shortcut menu of the element, click the <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Button_Not_Present.png?fit=max&auto=format&n=fmgRWFNHKYN2MLSg&q=85&s=bef71b398c086e725fcc76598b9e3da0" alt="Not Present button" style={{display:"inline-block",verticalAlign:"middle",margin:0}} width="21" height="21" data-path="images/flexi-capture/fls/Button_Not_Present.png" /> button, or click the middle mouse button on the area of the element. The names of elements marked as not present are displayed in strike-through font.

    The status of pages is indicated by icons in the **Training Layout State** column:

    * <img src="https://mintlify.s3.us-west-1.amazonaws.com/abbyy/images/flexi-capture/fls/No%20elements%20marked.png" alt="No elements marked status icon" style={{display:"inline-block",verticalAlign:"middle",margin:0}} /> **No elements marked** – No fields or reference elements have been marked on the page.
    * <img src="https://mintlify.s3.us-west-1.amazonaws.com/abbyy/images/flexi-capture/fls/Has%20unmarked%20elements.png" alt="Has unmarked elements status icon" style={{display:"inline-block",verticalAlign:"middle",margin:0}} /> **Has unmarked elements** – Some fields or reference elements have not been marked on the page, or not all unmarked elements have been marked as not present.
    * <img src="https://mintlify.s3.us-west-1.amazonaws.com/abbyy/images/flexi-capture/fls/Has%20unmarked%20required%20element.png" alt="Has unmarked required element status icon" style={{display:"inline-block",verticalAlign:"middle",margin:0}} /> **Has unmarked required element** – A required element has not been marked on the page.
    * <img src="https://mintlify.s3.us-west-1.amazonaws.com/abbyy/images/flexi-capture/fls/All%20elements%20marked.png" alt="All elements marked status icon" style={{display:"inline-block",verticalAlign:"middle",margin:0}} /> **All elements marked** – All elements have been marked on the page or marked as not present.
    * <img src="https://mintlify.s3.us-west-1.amazonaws.com/abbyy/images/flexi-capture/fls/No%20reference%20class%20set.png" alt="No reference class set status icon" style={{display:"inline-block",verticalAlign:"middle",margin:0}} /> **No reference class set** – The reference class of the training page has not been specified.
  </Step>

  <Step title="Generate the layout alternative">
    Click the <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Button_Generate_Alternative.png?fit=max&auto=format&n=fmgRWFNHKYN2MLSg&q=85&s=74906f4720358bf211ae3675818258ab" alt="Generate Alternative button" style={{display:"inline-block",verticalAlign:"middle",margin:0}} width="22" height="22" data-path="images/flexi-capture/fls/Button_Generate_Alternative.png" /> button. If the project uses more than one reference alternative, specify which layout alternatives you want to update.
  </Step>
</Steps>

## Train FlexiLayouts during debugging

ABBYY FlexiCapture 12 lets you train FlexiLayouts while debugging them. To do so, use the **Train Alternative** command [on the context menu of a layout alternative](/flexi-capture/fls/interface/local-menu#alternative). The reference layout is used to generate the new layout alternative, and reference elements are created automatically. The **Train and Test Alternative** command trains a new layout alternative and applies it to all pages of its class.

## Training mode options

The **Training** tab of the [Options...](/flexi-capture/fls/batch/options) dialog box contains training settings.

Settings in the **Navigation** group determine how the program navigates pages when you click the <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Button_Up_UPage.png?fit=max&auto=format&n=fmgRWFNHKYN2MLSg&q=85&s=f3bb8b6a0ae8d84aee414dd60d0ee26a" alt="Previous page button" style={{display:"inline-block",verticalAlign:"middle",margin:0}} width="24" height="25" data-path="images/flexi-capture/fls/Button_Up_UPage.png" /> or <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Button_Down_UPage.png?fit=max&auto=format&n=fmgRWFNHKYN2MLSg&q=85&s=ca268e118cef47e93d7d6dc1a670f34d" alt="Next page button" style={{display:"inline-block",verticalAlign:"middle",margin:0}} width="23" height="24" data-path="images/flexi-capture/fls/Button_Down_UPage.png" /> buttons:

* **any unmarked element** – Cycles pages that contain any unmarked element. This is the default setting.
* **unmarked selected element** – Cycles pages that contain the currently selected unmarked element.

The **Draft layout prediction** group contains settings that determine how layout alternatives are applied during training:

* **Predict layout automatically on navigation** (<img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Button_Predict_Layout.png?fit=max&auto=format&n=fmgRWFNHKYN2MLSg&q=85&s=3f72ed190ab52783f57b1f1105d6bb62" alt="Predict Layout button" style={{display:"inline-block",verticalAlign:"middle",margin:0}} width="24" height="24" data-path="images/flexi-capture/fls/Button_Predict_Layout.png" /> button) – Automatically applies the draft layout when you switch to a different page.
* **Replace existing regions of fields on batch prediction** – Replaces existing blocks of fields and elements with blocks detected when the layout alternative is applied.

The **Template generation** group contains one option:

* **Create Identifiers on Generation** – Automatically creates identifiers for the layout alternative being trained. For more information, see the [Identifiers](#identifiers) section.

### <a id="identifiers" />Identifiers

Identifiers are distinctive features of documents that can be used to classify them as belonging to a specific type. Examples of identifiers include distinctive words and phrases, specific barcode values, and separators.

When you train a layout alternative, FlexiLayout Studio puts together a set of words that occur frequently in documents belonging to the layout alternative and do not occur in other types of documents.

Identifiers of layout alternatives are stored in the **Identifiers** group, which is marked as required. This group includes a list of elements of the static text type, each of which contains a word that only occurs in documents belonging to the layout alternative. Relationships between groups of identifiers cannot be created.

## Training mode toolbar buttons

The training mode toolbar provides the following buttons:

| Button                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | Description                                                                |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Button_Training.png?fit=max&auto=format&n=fmgRWFNHKYN2MLSg&q=85&s=a61d1e0e9ecd532479f3e5cc3eb965f4" alt="Toolbar button that enables or disables the training mode." width="24" height="20" data-path="images/flexi-capture/fls/Button_Training.png" />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | Enables or disables the training mode.                                     |
| <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Button_New_Block.png?fit=max&auto=format&n=fmgRWFNHKYN2MLSg&q=85&s=a8a1506d12630fcec77bc2522a66e278" alt="Toolbar button that creates a field and marks its area." width="24" height="25" data-path="images/flexi-capture/fls/Button_New_Block.png" />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | Creates a field and marks its area.                                        |
| <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Button_Create_Element.png?fit=max&auto=format&n=fmgRWFNHKYN2MLSg&q=85&s=80ec4b850e8d4cfe27a206e1c6803546" alt="Toolbar button that creates an element and marks its area." width="23" height="23" data-path="images/flexi-capture/fls/Button_Create_Element.png" />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | Creates an element and marks its area.                                     |
| <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Button_Draw_Location.png?fit=max&auto=format&n=fmgRWFNHKYN2MLSg&q=85&s=8f9a84915725c8d433844e218e3d1907" alt="Toolbar button that draws an area." width="23" height="21" data-path="images/flexi-capture/fls/Button_Draw_Location.png" />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | Draws an area.                                                             |
| <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Button_Add_Region.png?fit=max&auto=format&n=fmgRWFNHKYN2MLSg&q=85&s=948e430e6b8c23d52555998e8e0545d0" alt="Toolbar button that adds a region to an existing area." width="21" height="21" data-path="images/flexi-capture/fls/Button_Add_Region.png" /> <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Button_Cut_Part.png?fit=max&auto=format&n=fmgRWFNHKYN2MLSg&q=85&s=c0c8bda1ec40c567c7a187711aa7c3b3" alt="Toolbar button that cuts part from an existing area." width="23" height="23" data-path="images/flexi-capture/fls/Button_Cut_Part.png" /> | Edits an existing area.                                                    |
| <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Button_Del_Region.png?fit=max&auto=format&n=fmgRWFNHKYN2MLSg&q=85&s=97368419acf2dedcaf832d58c2a7e4c9" alt="Toolbar button that deletes an area." width="24" height="22" data-path="images/flexi-capture/fls/Button_Del_Region.png" />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | Deletes an area.                                                           |
| <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Button_Generate_Alternative.png?fit=max&auto=format&n=fmgRWFNHKYN2MLSg&q=85&s=74906f4720358bf211ae3675818258ab" alt="Toolbar button that creates layout alternatives using pages from the training set." width="22" height="22" data-path="images/flexi-capture/fls/Button_Generate_Alternative.png" />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | Creates layout alternatives using pages from the training set.             |
| <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Button_Initialize_fields.png?fit=max&auto=format&n=fmgRWFNHKYN2MLSg&q=85&s=e88e538965428f83cdd263282d0e4c67" alt="Toolbar button that automatically generates fields based on existing areas in the FlexiLayout." width="28" height="25" data-path="images/flexi-capture/fls/Button_Initialize_fields.png" />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | Automatically generates fields based on existing areas in the FlexiLayout. |
| <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Button_Not_Present.png?fit=max&auto=format&n=fmgRWFNHKYN2MLSg&q=85&s=bef71b398c086e725fcc76598b9e3da0" alt="Toolbar button that marks the selected element as not present on the page." width="21" height="21" data-path="images/flexi-capture/fls/Button_Not_Present.png" />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | Marks the selected element as not present on the page.                     |
| <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Button_Required.png?fit=max&auto=format&n=fmgRWFNHKYN2MLSg&q=85&s=4cbf239dc6beefb53c11f7c519650aa0" alt="Toolbar button that marks an element as required." width="24" height="23" data-path="images/flexi-capture/fls/Button_Required.png" />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | Marks an element as required.                                              |
