<a href="https://github.com/voxel51/fiftyone-plugins/tree/main/plugins/annotation" target="_blank">![GitHub Repo](https://img.shields.io/badge/GitHub-Repository-black?logo=github)</a>

# Annotation Plugin

A plugin that contains utilities for integrating FiftyOne with annotation
tools.

In order to use this plugin, you must have at least one annotation backend
configured as
[described here](https://docs.voxel51.com/user_guide/annotation.html).

<video controls width="100%" style="max-width: 600px; height: auto;"><source src="https://github.com/voxel51/fiftyone-plugins/assets/25985824/24f2b974-94b1-484e-8ec2-8f7b1089ee15" type="video/mp4"></video>

## Installation

```shell
fiftyone plugins download \
    https://github.com/voxel51/fiftyone-plugins \
    --plugin-names @voxel51/annotation
```

Refer to the [main README](https://github.com/voxel51/fiftyone-plugins) for
more information about managing downloaded plugins and developing plugins
locally.

## Usage

1. Launch the App:

```py
import fiftyone as fo
import fiftyone.zoo as foz

dataset = foz.load_zoo_dataset("quickstart")
session = fo.launch_app(dataset)
```

1. Press ``` or click the `Browse operations` action to open the Operators
   list
2. Select any of the operators listed below!

## Operators

### request_annotations

You can use this operator to create annotation tasks for the current dataset or
view.

This operator is essentially a wrapper around the
[request annotations Python workflow](https://docs.voxel51.com/user_guide/annotation.html#requesting-annotations):

```py
dataset_or_view.annotate(
    anno_key,
    backend=...,
    label_schema=...,
    ...
)
```

where the operator’s form allows you to configure the annotation key,
annotation backend, label schema, and any other applicable fields for your
annotation backend.

### load_annotations

You can use this operator to load annotations for existing runs back onto your
dataset.

This operator is essentially a wrapper around the
[load annotations Python workflow](https://docs.voxel51.com/user_guide/annotation.html#loading-annotations):

```py
dataset_or_view.load_annotations(anno_key, ...)
```

where the operator’s form allows you to configure the annotation key and
related options.

### get_annotation_info

You can use this operator to get information about annotation runs.

This operator is essentially a wrapper around
[get_annotation_info()](https://docs.voxel51.com/api/fiftyone.core.collections.html#fiftyone.core.collections.SampleCollection.get_annotation_info):

```py
info = dataset_or_view.get_annotation_info(anno_key)
print(info)
```

### load_annotation_view

You can use this operator to load the view on which an annotation run was
performed.

This operator is essentially a wrapper around
[load_annotation_view()](https://docs.voxel51.com/api/fiftyone.core.collections.html#fiftyone.core.collections.SampleCollection.load_annotation_view):

```py
view = dataset.load_annotation_view(anno_key)
```

### rename_annotation_run

You can use this operator to rename annotation runs.

This operator is essentially a wrapper around
[rename_annotation_run()](https://docs.voxel51.com/api/fiftyone.core.collections.html#fiftyone.core.collections.SampleCollection.rename_annotation_run):

```py
dataset_or_view.rename_annotation_run(anno_key, new_anno_key)
```

### delete_annotation_run

You can use this operator to delete annotation runs.

This operator is essentially a wrapper around
[delete_annotation_run()](https://docs.voxel51.com/api/fiftyone.core.collections.html#fiftyone.core.collections.SampleCollection.delete_annotation_run):

```py
dataset_or_view.delete_annotation_run(anno_key)
```
