<a id="edo-setting-parameters"></a>

# Setting the Parameters

<a id="edo-specifying-execution-settings"></a>

## Specifying the Execution Settings

Depending on the computer used, you can greatly improve the performance by properly setting these deep learning execution settings.

**EasyDeepOCR** is based on **eVision**’s deep learning tools.

* Use the method [`ETextReader::SetExecutionSettings`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ETextReader.html#a29ef6e069e59cb595c275318eabce7a4) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ETextReader.html#a2872cffe51f09fc998a8307e6773c47e) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ETextReader.html#a2be0e5e469d6cf7320d65c69596301fd) to set the execution settings of these tools.
* It is not mandatory to set these execution settings. If they are not set, **EasyDeepOCR** tries to use the **OpenVINO** engine if available, otherwise it uses the default engine.

#### WARNING
Changing the execution settings resets the initialization. You must call [`ETextReader::Initialize`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ETextReader.html#a8aa4a233c236ab66c860b792fdd8fbc3) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ETextReader.html#a5ca732cfe514ac1ca50059551abba832) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ETextReader.html#a05a2381cf55e5a93bc140d58c3de4661) afterward.

#### WARNING
When using the **TensorRT** engine, the initialization may take a few tens of minutes, depending on the hardware configuration.

<a id="edo-building-sample-list"></a>

## Building a Sample List

The class [`ESampleList`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ESampleList.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ESampleList.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ESampleList.html) contains all the information about a “customer use case”.

* An [`ESampleList`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ESampleList.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ESampleList.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ESampleList.html) is a list of [`ESample`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ESample.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ESample.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ESample.html), where each [`ESample`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ESample.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ESample.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ESample.html) is associated with an image from the batch.
* The “texts of interest” are specified as [`EText`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1EText.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1EText.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1EText.html), the output class of the method [`ETextReader::Read`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ETextReader.html#a89af65e87d9b4bcb08c67ccb6144bef6) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ETextReader.html#ab4c5317f2a21715a57f29a5d7f28f4d1) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ETextReader.html#a74442f7cf99d92154de65b581cdc78a8).
* You can specify a [`ERegion`](../../../doxygen_cpp/classeVision_1_1ERegion.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ERegion.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ERegion.html) inside an [`ESample`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ESample.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ESample.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ESample.html) corresponding to the region used to read the image with [`ETextReader::Read`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ETextReader.html#a89af65e87d9b4bcb08c67ccb6144bef6) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ETextReader.html#ab4c5317f2a21715a57f29a5d7f28f4d1) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ETextReader.html#a74442f7cf99d92154de65b581cdc78a8). It is particularly useful if the region where the “text of interest” lies is found by some pre-processing.

The best way to create an [`ESampleList`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ESampleList.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ESampleList.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ESampleList.html) is through a graphical interface because you need to annotate the “texts of interest”. **eVision Studio** provides a widget to perform this annotation easily. Alternatively, you can also create the [`ESampleList`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ESampleList.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ESampleList.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ESampleList.html) using the API.

<a id="edo-building-sample-list-in-evision-studio"></a>

### Using eVision Studio

![image](assets/images/easydeepocr/building_a_sample_liste.webp)

To manage your [`ESampleList`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ESampleList.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ESampleList.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ESampleList.html):

1. Open a file explorer to add one or several images to the batch.
   * An `ESample` is created for each image added to the batch.
2. Display the list of the [`ESample`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ESample.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ESample.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ESample.html). The [`ESample`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ESample.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ESample.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ESample.html) currently selected is highlighted.
3. Create a new [`EText`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1EText.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1EText.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1EText.html) and add it to the selected [`ESample`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ESample.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ESample.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ESample.html).
4. Display the list of [`EText`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1EText.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1EText.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1EText.html) for the selected [`ESample`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ESample.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ESample.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ESample.html). The [`EText`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1EText.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1EText.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1EText.html) currently selected is highlighted.
5. Create a new [`ETextLine`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ETextLine.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ETextLine.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ETextLine.html) and add it to the selected [`EText`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1EText.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1EText.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1EText.html).
6. Display the list of [`ETextLine`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ETextLine.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ETextLine.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ETextLine.html) for the selected [`EText`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1EText.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1EText.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1EText.html).
   * You must edit the string of the [`ETextLine`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ETextLine.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ETextLine.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ETextLine.html) from this table.
   * You can edit the position of the [`ETextLine`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ETextLine.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ETextLine.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ETextLine.html) from this table.
7. Display the image of the selected [`ESample`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ESample.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ESample.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ESample.html), overlaid with the [`ETextLine`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ETextLine.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ETextLine.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ETextLine.html) of the selected [`EText`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1EText.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1EText.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1EText.html).
   * You can edit the position of the [`ETextLine`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ETextLine.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ETextLine.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ETextLine.html) using the handles.
   * The orientation of the [`ETextLine`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ETextLine.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ETextLine.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ETextLine.html) is indicated by a small arrow.

<a id="edo-building-sample-list-in-api"></a>

### Using the API

The creation of the [`ESampleList`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ESampleList.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ESampleList.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ESampleList.html) is illustrated in the code snippet below.

### C++

```cpp
#include <eVision/EasyOcr/EasyDeepOCR/ESampleList.h>
```

```cpp
using namespace eVision;
namespace EDO = eVision::EasyDeepOCR;
// Create an ESampleList
EDO::ESampleList sampleList;
// Create an ESample vector
std::vector<EDO::ESample> samples(1);
// Fill the ESample vector
for (EDO::ESample& sample : samples)
{
  // Set the image
  sample.SetImagePath("image.tif");
  // Create an EText vector 
  std::vector<EDO::EText> texts(1);
  // Fill the EText vector
  for (EDO::EText& text : texts)
  {
    // Create an ETextLine vector
    std::vector<EDO::ETextLine> textLines(1);
    // Fill the ETextLine vector
    for (EDO::ETextLine& textLine : textLines)
    {
      // Adjust the ERectangle around the text line
      textLine.SetRectangle(ERectangle());
      // Annotate the text line
      textLine.SetString("");
    }
    // Set the ETextLine vector
    text.SetLines(textLines);
  }
  // Set the EText vector
  sample.SetTexts(texts);
}
// Set the ESample vector
sampleList.SetSamples(samples);
// ...
```

### C#

```cs
using eVision;
using EDO = eVision.EasyDeepOCR;
```

```cs
// Create an ESampleList
EDO.ESampleList sampleList = new EDO.ESampleList();
// Create an ESample vector
EDO.ESample[] samples = new EDO.ESample[1];
// Fill the ESample vector
foreach (EDO.ESample sample in samples) 
{
  // Set the image
  sample.ImagePath = "image.tif";
  // Create an EText vector 
  EDO.EText[] texts = new EDO.EText[1];
  // Fill the EText vector
  foreach (EDO.EText text in texts)
  {
    // Create an ETextLine vector
    EDO.ETextLine[] textLines = new EDO.ETextLine[1];
    // Fill the ETextLine vector
    foreach (EDO.ETextLine textLine in textLines)
    {
      // Adjust the ERectangle around the text line
      textLine.Rectangle = new ERectangle();
      // Annotate the text line
      textLine.String = "";
    }
    // Set the ETextLine vector
    text.Lines = textLines;
  }
  // Set the EText vector
  sample.Texts = texts;
}
// Set the ESample vector
sampleList.Samples = samples;
// ...
```

### Python

```py
import eVision
from eVision import EasyDeepOCR as EDO
# Create an ESampleList
sampleList = EDO.ESampleList()
# Create an ESample vector
samples = [EDO.ESample()]
# Fill the ESample vector
for sample in samples: 
  # Set the image
  sample.ImagePath = "image.tif"
  # Create an EText vector 
  texts = [EDO.EText()]
  # Fill the EText vector
  for text in texts:
    # Create an ETextLine vector
    textLines = [EDO.ETextLine()]
    # Fill the ETextLine vector
    for textLine in textLines:
      # Adjust the ERectangle around the text line
      textLine.Rectangle = eVision.ERectangle()
      # Annotate the text line
      textLine.String = ""
    # Set the ETextLine vector
    text.Lines = textLines
  # Set the EText vector
  sample.Texts = texts
# Set the ESample vector
sampleList.Samples = samples
```

* The [`ESampleList`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ESampleList.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ESampleList.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ESampleList.html) contains a single [`ESample`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ESample.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ESample.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ESample.html).
* This [`ESample`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ESample.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ESample.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ESample.html) contains a single [`EText`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1EText.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1EText.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1EText.html) that is composed of a single [`ETextLine`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ETextLine.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ETextLine.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ETextLine.html).

You can easily modify this code snippet to include more [`ESample`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ESample.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ESample.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ESample.html), [`EText`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1EText.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1EText.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1EText.html) and [`ETextLine`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ETextLine.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ETextLine.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ETextLine.html).

#### WARNING
**EasyDeepOCR** expects that the rectangle of the [`ETextLine`](../../../doxygen_cpp/classeVision_1_1EasyDeepOCR_1_1ETextLine.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepOCR_1_1ETextLine.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepOCR_1_1ETextLine.html) is tightly fitted around the text. There must be no margin between the text line and the border of the rectangle.
