# Training workflow

There are a several steps to follow when training a DAN model.

## 1. Extract data

The data must be extracted and formatted for training. To extract the data, DAN uses an Arkindex export database in SQLite format. You will need to:

1. Structure the data into folders (`train` / `val` / `test`) in [Arkindex](https://demo.arkindex.org/).
1. [Export the project](https://doc.arkindex.org/howto/export/) in SQLite format.
1. Extract the data with the [extract command](../usage/datasets/extract.md).
1. Format the data with the [format command](../usage/datasets/format.md).

At the end, you should have a tree structure like this:

```
output/
├── charset.pkl
├── labels.json
├── split.json
├── images
│   ├── train
│   ├── val
│   └── test
└── labels
    ├── train
    ├── val
    └── test
```

## 2. Train

The training command does not take any input parameters for now. To train a DAN model, you will therefore need to:

1. Update the parameters from those listed in the [dedicated page](../usage/train/parameters.md). You will always need to update at least these variables:

    - `dataset_name`, `dataset_level`, `dataset_variant` and `dataset_path`,
    - `model_params.transfer_learning.*[checkpoint_path]` to finetune an existing model,
    - `training_params.output_folder`.

1. Train a DAN model with the [train command](../usage/train/index.md).

## 3. Predict

Once the training is complete, you can apply  a trained DAN model on an image using the [predict command](../usage/predict.md) and the `inference_parameters.yml` file, located in `{training_params.output_folder}/results`.