# Annotate Data for Object Detection

## 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-4cd56e10c3d0a0d44f34d3cec1b31f7cf563388c%2Fannotation-window-empty.png?alt=media" alt=""><figcaption></figcaption></figure>

The AugeLab Studio Image Annotation Window allows users to annotate images by drawing bounding boxes around objects of interest and associating them with specific classes.

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

To open the Image Annotation Window, navigate to the top menu and click on `AI Tools` ➡️ `Image Annotation`.

For image annotation, you need two things:

1. `.class` file
2. Dataset

## Class File <a href="#class-file" id="class-file"></a>

To label your data, first you need a `classes.names` file, which is a standard text file with _.names_ extension. A normal class file looks like below:

```
Human
Dog
Cat
Cup

```

If you do not have such file, you can create your own using the `Classes` section:

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

To create your own classes file:

1. Type a class name
2. Click on `+` and add your classes.
3. Click on `Save Classes` and you are ready to pick a folder.

You may also click on `-` to remove any unwanted classes.

## \*\*Load Image Folder\*\* <a href="#load-image-folder" id="load-image-folder"></a>

{% hint style="warning" %}
Make sure path to your dataset do not contain any non-english characters.
{% endhint %}

Click on `Open Folder` at the top of the screen and choose the folder that contains all of your images:

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

Select Image from List: After loading the image folder, a list of available images will be displayed. Click on an image to select it for annotation.

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

## \*\*Annotating Images\*\* <a href="#annotating-images" id="annotating-images"></a>

Annotating images are pretty simple. Click on the top left of the object you'd like to detect, drag the mouse and release it when you are done!

![](https://63608322-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbH8gla5D8g5pQAK8IzR8%2Fuploads%2Fgit-blob-408c74b4a6cef4063e25c0c30acc094904c04ef7%2Fdrone-annotation.webp?alt=media)

## Using the Dataset Panel <a href="#using-the-dataset-panel" id="using-the-dataset-panel"></a>

![](https://63608322-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbH8gla5D8g5pQAK8IzR8%2Fuploads%2Fgit-blob-059ef40e745bd39fb9da589e9db94c8d3fbd052b%2Fdataset-panel.png?alt=media)

Dataset features several functionalities:

1. `Filter` function that allows you to filter several image classes:
   * `All` All images with and without annotation
   * `Annotated` images have annotations with them.
   * `Empty` images do no contain annotations, but included in the training. This means objects that are not annotated may negatively impact training.
   * `Excluded` images do no have an annotation file. This means they do not affect training whatsoever.
2. `Search` functionality will allow you to filter images with their names.

## Annotating Videos <a href="#annotating-videos" id="annotating-videos"></a>

You can also annotate video files using the **Video** mode on the top side of the window:

![](https://63608322-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbH8gla5D8g5pQAK8IzR8%2Fuploads%2Fgit-blob-3be51a7e7e0fb89fda31e85345ac316484fcbb0d%2Fannotation-modes.png?alt=media)

Changing video mode will ask you for a file path. Choosing the video will allow you to annotate a video just like a folder!

## Tools <a href="#tools" id="tools"></a>

There are several tools inside the Annotation Tool to help you during your dataset preparation:

### Class Frequency Analysis <a href="#class-frequency-analysis" id="class-frequency-analysis"></a>

Clicking on class frequency analysis will analyze and show you how many classes exist in your dataset.

This is useful to check if you have a balanced dataset or not.

### Augment Dataset <a href="#augment-dataset" id="augment-dataset"></a>

AugeLab Studio automatically applies dataset augmentation. Augmentation is the process of artificially creating similar data.

![](https://63608322-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbH8gla5D8g5pQAK8IzR8%2Fuploads%2Fgit-blob-5bd98c53c42296835dd051d59e67973bbc535d63%2Faugementation-tool.png?alt=media)

Clicking on `Apply Augmentation` will create artificial data and keep your annotations on the newly created images.

{% hint style="warning" %}
Augmentation process should be done after finishing annotation
{% endhint %}

{% hint style="warning" %}
Augmentation process may increase the disk size of your dataset up to 10 times.
{% endhint %}

### Preprocess Image <a href="#preprocess-image" id="preprocess-image"></a>

Preprocess Image tool allows you to change the contrast, brightness and gamma of images that are shown in the window. This feature comes in handy when dealing with very dark or too bright images.

![](https://63608322-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbH8gla5D8g5pQAK8IzR8%2Fuploads%2Fgit-blob-ea614591a99ba0fb4c1aa63655adfa91024e1d7d%2Fpreprocess-image.png?alt=media)

### Change Class Id <a href="#change-class-id" id="change-class-id"></a>

Change Class Id tool will allow you to change the all annotated class instances to a different class.

This tool comes in hand when merging two different datasets.

![](https://63608322-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbH8gla5D8g5pQAK8IzR8%2Fuploads%2Fgit-blob-855577ac596492464532d4657bd17311d15dc45a%2Fchange-class-id.png?alt=media)

### Shortcuts and Help <a href="#shortcuts-and-help" id="shortcuts-and-help"></a>

<details>

<summary>For shorcuts and help, you can click on the `Help` button at the top menu.</summary>

* `D`: Show next image or frame.
* `A`: Show previous image or frame.
* `Shift + D`: Move forward by 10 images/frames.
* `Shift + A`: Move backward by 10 images/frames.
* `W`: Decrement class selection.
* `S`: Increment class selection.
* `Shift + W`: Decrement class selection by 3.
* `Shift + S`: Increment class selection by 3.
* `X`: Remove the last bounding box annotation.
* `Shift + C`: Clear all annotations.
* `O`: Add an empty annotation file or clear annotations.
* `P`: Remove annotations and clear the file.
* `M`: Move or exclude image to another folder (Folder Mode only).
* `Shift + Delete`: Remove image and annotation from computer (Folder Mode only).

</details>

### Training With Custom AI Object Detection Model <a href="#training-with-custom-ai-object-detection-model" id="training-with-custom-ai-object-detection-model"></a>

To train a custom object detection model, please refer to [**Object Detection Train**](train-custom-ai-models-with-training-window).
