# Train Custom AI Models

### First Look <a href="#first-look" id="first-look"></a>

{% hint style="info" %}
You will need to have a computer with [Nvidia GPU](../introduction/system-requirements), should install [CUDA, CUDNN](../../getting-started/installation-and-licensing#follow-the-steps-below-to-use-ai-modules), and use [Module Downloader Window](https://github.com/AugelabTech/AugeLab-Studio-Gitbook-Docs/blob/main/english/key-features/integrate-gpu-with-module-downloader.md).
{% endhint %}

<figure><img src="https://63608322-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbH8gla5D8g5pQAK8IzR8%2Fuploads%2Fgit-blob-421bd7a808bd840a7e6a96c06c1982a238651e07%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

The AugeLab Studio Detection Training window provides a user-friendly interface to train object detection models using the YOLO (You Only Look Once) framework.

### \*\*Getting Started\*\* <a href="#getting-started" id="getting-started"></a>

1. Launch AugeLab Studio on your computer.
2. Clic on `AI Tools` ➡️ [**Object Detection Training Widow**](https://github.com/AugelabTech/AugeLab-Studio-Gitbook-Docs/blob/main/english/function-blocks-ai-applications/object-detection-train.md)
3. Before you start training, you need to load the **dataset folder** and the **class file** that contains the classes for the objects you want to detect.

{% hint style="info" %}
You can integrate pretrained YOLO weights with class names as well.
{% endhint %}

### \*\*Menu Bar - Train Configuration\*\* <a href="#menu-bar-train-configuration" id="menu-bar-train-configuration"></a>

1. Load Dataset: Click on this action to select the dataset folder containing images for training.

<figure><img src="https://63608322-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbH8gla5D8g5pQAK8IzR8%2Fuploads%2Fgit-blob-134ba073af147a6e558413cfece41238e9ff2536%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

2. Load Class File: Use this action to load the class file (`.names` format) that contains the list of classes for training.

<figure><img src="https://63608322-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbH8gla5D8g5pQAK8IzR8%2Fuploads%2Fgit-blob-dfe427e7178be521bd52bed4e0df157e22578eca%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

3. Detection Model Type: Choose between "Fast Detection" and "Robust Detection" models. The "Fast Detection" model is suitable for low-spec PCs and offers lower accuracy. The "Robust Detection" model provides higher accuracy but requires high-spec PCs.

<figure><img src="https://63608322-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbH8gla5D8g5pQAK8IzR8%2Fuploads%2Fgit-blob-1bc953752a2854934d7b704783b93e56df80bad8%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

4. Load Custom Training Checkpoint: If you have a pre-trained weight file (`.weights` or `.pw` format), you can load it to use as a starting point for training.

<figure><img src="https://63608322-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbH8gla5D8g5pQAK8IzR8%2Fuploads%2Fgit-blob-094bb71225ee045b6e12d7b4642c028d00d046eb%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

5. Open Advanced Settings: Further (advanced) configuration can be set in Advanced Settings window.

<figure><img src="https://63608322-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbH8gla5D8g5pQAK8IzR8%2Fuploads%2Fgit-blob-7fd2bc821fd62168a3b4373fceb92b187307aeaa%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

### Advanced Settings Window <a href="#advanced-settings-window" id="advanced-settings-window"></a>

In this window, training parameters can be adjusted for advanced usage.

1. **Dataset Split**: Determines the proportion of data allocated for training and validation to evaluate the model's performance.
2. **Network Size**: Specifies the network size, impacting the trade-off between speed and accuracy in object detection tasks.
3. **Subdivision Size**: Defines the size of mini-batches during training, influencing memory usage and computational efficiency.

<figure><img src="https://63608322-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbH8gla5D8g5pQAK8IzR8%2Fuploads%2Fgit-blob-ceddb24fa32476a9d8a45429ca41a8b3bb827fae%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
The "Train Procedure" action under the "Help" menu provides detailed instructions on how to train the models effectively.
{% endhint %}

### \*\*Starting Training Process\*\* <a href="#starting-training-process" id="starting-training-process"></a>

1. Start Train: After loading the dataset and class file, click on `START TRAIN` to initiate the training process.
2. Train Log: The log area will display the progress and status of the training process.
3. Stop Train: You can stop the training process by clicking on the `STOP TRAIN` button.

You can follow training process from two screens:

1. Training Logging Window

<figure><img src="https://63608322-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbH8gla5D8g5pQAK8IzR8%2Fuploads%2Fgit-blob-f7f460fdeed4f8edc528965f88ae53e5fb288439%2Fimage.png?alt=media" alt="" width="563"><figcaption><p>Training Logging</p></figcaption></figure>

2. Training Chart (Loss and mAP)

<figure><img src="https://63608322-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbH8gla5D8g5pQAK8IzR8%2Fuploads%2Fgit-blob-82114ae6556f9fd5ed7e1bf75197cb3220935aa1%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
If you close the Detection Training window while the training process is running, the process will be terminated.
{% endhint %}

You can now use the Detection Training window in AugeLab Studio to train object detection models on custom datasets. Experiment with different model types, batch sizes, and custom checkpoints to achieve optimal results! Enjoy training your object detection models with AugeLab Studio!
