Overview

Annotate video frames

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.

Labelme annotates images, so video annotation is frame annotation. The work that makes it bearable is --keep-prev, which carries the previous frame's shapes into the next one so you nudge vertices instead of redrawing objects.

Split the video into frames#

Labelme does not decode video itself. The repository suggests video-cli:

pip install video-cli
video-toimg your_video.mp4

This creates a your_video/ directory of frames. Check it before annotating:

ls your_video/

Annotate the frames#

labelme data_annotated --labels labels.txt --keep-prev \
  --config '{shape_color: {mode: auto, auto: {shift: -2}}}'

With --keep-prev, moving to the next frame starts from the previous frame's annotation rather than from an empty canvas. Consecutive frames differ by a few pixels, so most shapes need adjusting rather than drawing.

Two consecutive video frames, each carrying the same labelled regions

The same behaviour can be made permanent in your config file with keep_prev: true; keep_prev_scale and keep_prev_brightness_contrast carry the zoom and display settings across frames too. See the configuration reference.

Check the result as a sequence#

Still frames hide flicker. Rendering the annotated frames back as an animation shows a mask that jumps between frames, which is the defect that hurts a video model:

The annotated video frames played back as an animation, showing per-frame segmentation

Updated

Was this page helpful?