# Annotate datasets

## Overview

Hub AI includes a sample editor for manual labeling, Smart Annotations powered by a segmentation model, and model pre-annotation
for processing a larger batch. In each workflow, review the labels and move approved samples to Completed so they contribute to
dataset health and run validation.

> **Note**
> Create the dataset tasks and classes before annotating. The editor tools and compatible model checkpoints are determined by that definition.

## Annotate a sample manually

The object-detection example below draws a box around each pallet. Other task types expose their corresponding tools in the same
editor.

Open a dataset and select a sample from the grid. Use the filters to narrow samples by annotation presence, status, split, dataset
version, tags, or classes.

Select the required class and use the task tool to label the image. Draw boxes for object detection, polygons for segmentation,
place skeleton points for keypoints, choose image-level classes for classification, or enter regions and text for OCR.

Use the regions and labels panel to inspect, select, or remove individual annotations.

Click Update, choose the Sample Split, and set the Sample Status. Move reviewed work to Completed, then use the previous and next
controls to continue through the filtered set.

Add tags from the dataset grid when you need to group samples for filtering, pre-annotation, or a later versioned training run.

> **Note**
> Editing an Unannotated or Pre-annotated sample automatically changes its status to Annotated. Annotation statuses are an optional review workflow, but only Completed samples contribute to the split sizes used by health and run validation.

## Use Smart Annotations

Smart Annotations use a promptable model to accelerate region creation. They are available for object-detection datasets,
including object detection with a nested segmentation task, and for semantic-segmentation datasets.

Open a sample and click Smart Annotations. If no engine is active, start it and wait for inference to become available. Warm-up
typically takes 5–10 minutes.

After the engine is ready, choose Annotate to propose regions across the whole image, Annotate With Selection to limit proposals
to a box you draw, or Annotate With Text to prompt with a class and description. The example below shows the native text-prompt
panel.

Inspect the returned regions, correct or delete unsuitable proposals, assign the right classes, and click Update. Hub displays
Smart Annotation proposals above 0.5 confidence, but human review is still required.

## Pre-annotate with a trained model

Pre-annotation runs a PyTorch checkpoint produced by Hub AI across a selected group of dataset samples. It is useful after the
first model has been trained and new, unlabeled data arrives.

Open the dataset action menu and select Preannotate.

Choose the Annotation Status to process. Optionally filter by tags; use AND to require every selected tag or OR to accept any
selected tag.

Select the merge strategy:

 * None: skips matching predictions to existing samples, so Hub ingests the prediction output as new samples.
 * Append Annotations: keeps existing annotations and adds predictions to matching samples.
 * Replace Annotations: removes existing annotations from matching samples before adding predictions.

Then choose a Model Checkpoint produced by a Hub AI training run and submit the form.

Monitor the Preannotation job from Jobs. Successful samples return with the Pre-annotated status. Filter the grid to that status,
review and correct the predictions, then move approved samples to Completed.

> **Checkpoint compatibility**
> Pre-annotation requires a PyTorch checkpoint whose tasks, task names, and classes match the dataset. If no compatible checkpoint is available, first create a project and complete a [training run](https://docs.luxonis.com/cloud/hubai/training/runs.md).

> **Update several sample statuses at once**
> To update annotation statuses in a batch, open the dataset's Samples tab and click Edit Samples. Select individual samples, choose Select All Samples from Page, or choose Select Entire Dataset. Then open Actions, select Update Annotation Status, and choose the new status.
