Skip to main content

Dash Annotate CV - A dash library for computer vision annotation tasks

dash_annotate_cv is a Python Dash library for computer vision annotation tasks. It exposes reusable annotation components in a library format for dash.

Example of whole-image label annotations

Example of bounding box annotations

Supported tasks:

  • Annotation of images (whole image labels)
  • Annotating multiple labels per image
  • Annotating bounding boxes including labels

Roadmap for future tasks:

  • Support for more annotation formats: YOLO, COCO, etc.
  • Support for image segmentation tasks.
  • Support for skeleton annotation tasks.
  • Annotating video events
  • Annotating video tags

Note: this library is not meant for production usage. It is meant to be used for quick prototyping and testing of annotation tasks.

Getting started

  1. (Recommended) Create a new conda environment.

    conda create -n dash_annotate_cv python=3.11
    conda activate dash_annotate_cv
    
  2. Install using pip:

    pip install dash_annotate_cv
    

    Or local install from the repository:

    git clone https://github.com/smrfeld/dash-annotate-cv 
    cd dash-annotate-cv
    pip install -e .
    
  3. Run the example as described next.

Examples

The app can be launched in two ways:

  1. A simple command line utility lets you get up and running quickly.
  2. The app can be launched by writing a short Python script, which lets you use the annotation components in a flexible way in your own Dash app. We follow the practices of resuable components in Dash described in All-in-one components for Dash.

Each is described here briefly. You can also check out the examples.

Command line utility

To get started labeling immediately, you can use a simple command line utility. You just need to write a config YAML file. You can see the examples directory for more examples - as simple example is as follows:

# Annotation mode
# image_labels = Annotate images with whole-image labels
# bboxs = Annotate bounding boxes in each image
mode: image_labels

# Label source
label_source:
  labels:
  - astronaut
  - camera
  - cat

# Image source
image_source:

  # Image source type
  source_type: list_of_files

  # List of files
  list_of_files:
  - ex_chelsea.jpg
  - ex_astronaut.jpg
  - ex_camera.jpg

# Storage (optional)
storage:
  storage_type: json
  json_file: example.json

# Options (optional)
options:

  # How many labels can be selected per image
  selection_mode: single

To launch the app, simply run:

dacv conf.yml

Navigate to the default address http://127.0.0.1:8050/ in your browser to use the app.

Use dacv -h for a complete list of options. Or check out the examples directory for more examples.

Python

You can use the library in your own Dash app. This is recommended as a more flexible way to create your own annotation interface. The following example shows how to use the library to annotate images with labels.

# Import the library
import dash_annotate_cv as dac

# Other imports
from dash import Dash, html
import dash_bootstrap_components as dbc
from skimage import data

# Load some images
images = [ ("chelsea",data.chelsea()), ("astronaut",data.astronaut()), ("camera",data.camera()) ] # type: ignore
images_pil = [ (name,Image.fromarray(image)) for name,image in images ]

# Set up the image and label sources
image_source = dac.ImageSource(images=images_pil)
label_source = dac.LabelSource(labels=["astronaut", "camera", "cat"])

# Set up writing
storage = dac.AnnotationStorage(storage_types=[dac.StorageType.JSON], json_file="annotations.json")

app = Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
app.layout = dbc.Container([
    html.H1("Annotate Images"),
    dac.AnnotateImageLabelsAIO(label_source, image_source, annotation_storage=storage)
    ])
app.run(debug=True)

The result is shown in the gif above. Check out the examples directory for more examples.

Loading the annotations & format

Loading the annotations is as simple as:

with open("annotations.json","r") as f:
    annotations = dac.ImageAnnotations.from_dict(json.load(f))

See the ImageAnnotations class for more information on the format.

Dev

Some useful references:

Metadata

Release files for dash-annotate-cv 0.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dash-annotate-cv 0.1.9
File Size Uploaded Provenance Actions
dash_annotate_cv-0.1.9.tar.gz 23.9 kB Without provenance Details for dash_annotate_cv-0.1.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dash-annotate-cv 0.1.9
File Interpreter ABI Platform Actions
dash_annotate_cv-0.1.9-py3-none-any.whl Python 3 none any Details for dash_annotate_cv-0.1.9-py3-none-any.whl

Total release size: 49.8 kB

Release files / dash_annotate_cv-0.1.9.tar.gz

Download URL dash_annotate_cv-0.1.9.tar.gz
Size 23.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c8f7fdd4881527fcededc19e2b42cd6c3d8c86fbde57c328942d0b2087f204a3
BLAKE2b-256 checksum
How to use checksums
9c104e9331b0aad5f08c7d01186567313229f0bb47e832e7bc482bef4a1276a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / dash_annotate_cv-0.1.9-py3-none-any.whl

Download URL dash_annotate_cv-0.1.9-py3-none-any.whl
Size 26.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
34c6a3bdadb89ed1038855b63ac0bf3965d6bc016131398ae49d3fd292c1240f
BLAKE2b-256 checksum
How to use checksums
953bf88c65601b8e0d6b5fe7bd5ebc7070c7242868cdea1d6dae8e839b746034
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Security for dash-annotate-cv 0.1.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page