Overview

Draw bounding boxes for object detection

Unofficial preview. Docsbook assembled this page from the public wkentaro/labelme README.md and examples/ directory. It is not affiliated with, endorsed by, or maintained by the Labelme project. The official documentation lives at labelme.io/docs.

Bounding-box detection in Labelme means drawing rectangles rather than polygons, and exporting to the Pascal VOC detection layout rather than a segmentation one. This is the examples/bbox_detection workflow.

Annotate the directory#

labelme data_annotated --labels labels.txt

Passing a directory loads every image in it. --labels fixes the vocabulary so the same object is not called bottle on one image and Bottle on the next.

Labelme showing rectangles drawn around objects, each with a class label

Export to Pascal VOC detection annotations#

./labelme2voc.py data_annotated data_dataset_voc --labels labels.txt

The script writes three directories:

Directory What it holds
data_dataset_voc/JPEGImages The source images
data_dataset_voc/Annotations One VOC XML annotation per image
data_dataset_voc/AnnotationsVisualization Boxes drawn back over the images, for checking

The visualisation directory is the one to open first — it is the fastest way to see a box that was drawn on the wrong object or given the wrong class.

Keeping the label set honest#

Add validation if more than one person annotates:

labelme data_annotated --labels labels.txt --validate-label exact

With --validate-label exact, a label not in labels.txt is rejected instead of silently creating a new class that then appears in the export.

Updated

Was this page helpful?