In this tutorial, you will learn how to train a segmentation model in Arkindex.
This section is to be followed and carried out after creating the ground-truth annotations.
The Pellet
dataset created during the data partitioning step and annotated on Callico, now has three sets named train
, val
and test
.
To avoid any issues (data leakage, accidental deletions, ...), we should lock the state of our dataset. To make it immutable, we will:
Browse to the page of the Europeana | Pellet
project. Instructions to start an SQLite export are detailed in our guide to export a project. Once started, read how to monitor the status of your export.
Wait for your export to be Done before going further in this tutorial.
The SQLite export is needed to preprocess the dataset in Arkindex before training. Using an SQLite database speeds things up and avoids making too many requests to the API, especially for large datasets.
Once the export is ready, we will now lock the dataset.
After this operation is done, you will not be able to edit the dataset or its sets anymore.
Browse to the page of the Europeana | Pellet
project and click Create dataset process in the Actions dropdown menu.
Select the Pellet
dataset and select All sets
to add all three sets to the process.
Press the button in Actions column to confirm.
Use the Configure workers button to move on to worker selection.
Press the Select workers button, search for Generic Training Dataset Extractor
and press the Enter keyboard key.
Click on the name of the worker on the left and select the first version with main
reference listed by clicking on the button in the Actions column.
Close the modal by clicking on the Done button on the bottom right.
Your process should be configured and ready to go.
Click on the Run process button to launch the process.
Wait till the process is over.
If you browse to the page of your dataset, you should see Complete next to the dataset state.
This operation is only done once per dataset. If you need to train another model, as long as the annotations were already present on the element at this point, you will not have to regenerate the dataset like this.
However, if you added information on the elements, you will need to:
The training will save the model's files as a new version on Arkindex. In this section, we will create the model that will hold this new version.
Click on Models in the top right dropdown (with your email address).
Click on the Create a model button to create a new model. This will open a new page where you can fill your model's information. It is a good idea to name the model after:
In our case, we are training:
A suitable name would be YOLO | Pellet (page)
.
In the description, you can add a link towards the dataset on Europeana. The description supports Markdown input.
A model can hold multiple versions. If you do another training under different conditions (for a longer period of time, ...), you do not have to create a brand new model again.
Now that you have a dataset and a model, we can create the training process.
Create a process using all sets of the dataset. The procedure is the same as before, when we locked the dataset.
The state of the dataset has changed, you should now have the following process selection.
Proceed to workers configuration. Press the Select workers button, search for YOLO Training | Detect/Segment
and press the Enter keyboard key.
Click on the name of the worker on the left and select the first version listed by clicking on the button in the Actions column.
Close the modal by clicking on the Done button on the bottom right.
Configure the YOLO Training | Detect/Segment
worker by clicking on the button in the Configuration column. This will open a new modal, where you can pass specific parameters used for training. The full description of the fields is available on the worker's description page.
Select New configuration on the left column, to create a new configuration. Again, name it after the dataset you are using.
The most important parameters are:
text_line
and illustration
,yolov8m
here,Click on Create then Select when you are done filling the fields. Your process is ready to go.
Click on the Run process button to launch the process.
While it is running, the logs of the tasks are displayed. Multiple things happen during this process:
Training artifacts will be available when the process is finished. Click on the Artifacts button to list artifacts and click on results.tar.gz
to download it.
This type of archive is not natively supported by Windows. In that case, you will need an external archive manager tool like 7zip.
This archive has the following file structure:
train
folder: with graphs and sheets describing how the training went,eval_*
folders: the evaluation results on all splits.By evaluating on the training and validation splits, we can see how well the model has learned from the data. Moreover, the evaluation on the test split shows how good the model performs on unknown data. For this reason, all splits are evaluated.
Make sure to take a look at these if you want to know more about your model's performance.
Visit the page of your model to see your brand new trained model version. To do so, browse the Models page and search for your model.
You can download it to use it on your own or you can use it to process pages already on Arkindex, as described in the next section.
Graphs are nice to get an idea of how the model performs on unknown data. However, it is easier to make yourself an idea when the predictions are actually displayed.
In this section, you will learn to process the test set of your dataset with your newly trained model.
Browse to the folder containing the elements of the dataset, in the project you created in the earlier steps of the tutorial.
Click on the test
folder. Elements in the test
set will be displayed. Then click on Create process in the Actions menu.
Filter element by type page
and trigger the Load children toggle to display page
elements.
Click on Configure workers to move on to worker selection. Press the Select workers button, search for YOLO V8 Segmenter
and press the Enter keyboard key. Just like we did in the previous sections, click on the name of the worker on the left and select the first version listed by clicking on the button in the Actions column.
Close the modal by clicking on the Done button on the bottom right.
Now it is time to select the model you trained. Click on the button in the Model version column. In the modal that opens:
The process is ready and you can launch it using the Run process button. Wait for its completion before moving to the next step.
To see the predictions of your model, browse back to the test
folder in your project. There you can click on the first page displayed.
On all pages of the test
set, you can see both the annotations and the predictions. To know the difference between ground truth and predictions, look at the details of each element.
On the elements annotated by humans, Callico is mentioned. On the predicted elements, YOLO is mentioned. The confidence score of the YOLO prediction is also displayed.
In this tutorial, we do not calculate evaluation scores for this segmentation model as it would require you to run scoring tools using sophisticated procedures outside the Arkindex and Callico frameworks.
If the model's initial results are close to the ground truth annotations, you could use it on all your pages through a dedicated process.