LabelMe#

class LabelMe(filename: str)[source]#

Read annotations from a LabelMe JSON file.

Parameters:

filename (str) – path to LabelMe JSON file

The reader returns three values:

  • an Image

  • a list of Polygon2 instances for all shapes

  • file-level flags as a dictionary

For each returned polygon, additional attributes are attached:

  • group_id from the shape entry

  • flags from the shape entry as a dictionary

Rectangle shapes are converted to 4-corner polygons.

Example:

from machinevisiontoolbox import LabelMe
image, polygons, flags = LabelMe("scene.json").read()
len(polygons)
Seealso:

pixels_mask Image.Polygons Image, Polygon2

Methods

read

Read LabelMe JSON and return image, polygons and file flags.

Attributes