How to add a new annotation format support
- Add a python script to
dataset_manager/formats
- Add an import statement to registry.py.
- Implement some importers and exporters as the format requires.
Each format is supported by an importer and exporter.
It can be a function or a class decorated with
importer
or exporter
from registry.py.
Examples:
Each decorator defines format parameters such as:
-
name
-
version
-
file extension. For the
importer
it can be a comma-separated list. These parameters are combined to produce a visible name. It can be set explicitly by thedisplay_name
argument.
Importer arguments:
- file_object - a file with annotations or dataset
- task_data - an instance of
TaskData
class.
Exporter arguments:
-
file_object - a file for annotations or dataset
-
task_data - an instance of
TaskData
class. -
options - format-specific options.
save_images
is the option to distinguish if dataset or just annotations are requested.
TaskData
provides
many task properties and interfaces to add and read task annotations.
Public members:
-
TaskData. Attribute - class,
namedtuple('Attribute', 'name, value')
-
TaskData. LabeledShape - class,
namedtuple('LabeledShape', 'type, frame, label, points, occluded, attributes, group, z_order')
-
TrackedShape -
namedtuple('TrackedShape', 'type, points, occluded, frame, attributes, outside, keyframe, z_order')
-
Track - class,
namedtuple('Track', 'label, group, shapes')
-
Tag - class,
namedtuple('Tag', 'frame, label, attributes, group')
-
Frame - class,
namedtuple('Frame', 'frame, name, width, height, labeled_shapes, tags')
-
TaskData. shapes - property, an iterator over
LabeledShape
objects -
TaskData. tracks - property, an iterator over
Track
objects -
TaskData. tags - property, an iterator over
Tag
objects -
TaskData. meta - property, a dictionary with task information
-
TaskData. group_by_frame() - method, returns an iterator over
Frame
objects, which groups annotation objects by frame. Note thatTrackedShape
s will be represented asLabeledShape
s. -
TaskData. add_tag(tag) - method, tag should be an instance of the
Tag
class -
TaskData. add_shape(shape) - method, shape should be an instance of the
Shape
class -
TaskData. add_track(track) - method, track should be an instance of the
Track
class
Sample exporter code:
Sample importer code:
Format specifications
- CVAT
- Datumaro
- LabelMe
- MOT
- MOTS
- COCO
- PASCAL VOC and mask
- YOLO
- TF detection API
- ImageNet
- CamVid
- WIDER Face
- VGGFace2
- Market-1501
- ICDAR13/15