Skip to content

Field

Annotation

Bases: BaseField

classification(annotation_id=None, image_id=None, category_id=None, score=None, **kwargs) classmethod

Classification Annotation Format

Parameters:

Name Type Description Default
annotation_id int

annotaion id. natural number.

None
image_id int

image id. natural number.

None
category_id int

category id. natural number.

None
score float

prediction score. Default to None.

None

Returns:

Name Type Description
Annotation Annotation

annotation class

instance_segmentation(annotation_id=None, image_id=None, category_id=None, bbox=None, segmentation=None, area=None, iscrowd=0, score=None, **kwargs) classmethod

Instance Annotation Format

Parameters:

Name Type Description Default
annotation_id int

annotaion id. natural number.

None
image_id int

image id. natural number.

None
category_id int

category id. natural number.

None
bbox list[float]

[x1, y1, w, h].

None
segmentation Union[list[list[float]], dict]

[[x1, y1, x2, y2, x3, y3, ...], [polygon]] or RLE.

None
area int

segmentation segmentation area.

None
iscrowd int

is crowd or not. Default to 0.

0
score float

prediction score. Default to None.

None

Returns:

Name Type Description
Annotation Annotation

annotation class

keypoint_detection(annotation_id=None, image_id=None, category_id=None, bbox=None, keypoints=None, num_keypoints=None, area=None, segmentation=None, iscrowd=0, score=None, **kwargs) classmethod

Keypoint Detection Annotation Format

Parameters:

Name Type Description Default
annotation_id int

annotaion id. natural number.

None
image_id int

image id. natural number.

None
category_id int

category id. natural number.

None
bbox list[float]

[x1, y1, w, h].

None
keypoints list[float]

[x1, y1, v1(visible flag), x2, y2, v2(visible flag), ...]. visible flag is one of [0(Not labeled), 1(Labeled but not visible), 2(labeled and visible)]

None
num_keypoints int

number of labeled keypoints

None
area int

segmentation segmentation or bbox area.

None
segmentation list[list[float]]

[[x1, y1, x2, y2, x3, y3, ...], [polygon]].

None
iscrowd int

is crowd or not. Default to 0.

0
score list[float]

prediction scores. Default to None.

None

Returns:

Name Type Description
Annotation Annotation

annotation class

new(annotation_id=None, image_id=None, category_id=None, bbox=None, segmentation=None, area=None, keypoints=None, num_keypoints=None, caption=None, value=None, iscrowd=None, score=None, task=None, **kwargs) classmethod

Annotation Format

Parameters:

Name Type Description Default
annotation_id int

annotaion id. natural number.

None
image_id int

image id. natural number.

None
category_id int

category id. natural number.

None
bbox list[float]

[x1, y1, w, h].

None
segmentation list[list[float]]

[[[x1, y1, x2, y2, x3, y3, ...], [...]].

None
area int

bbox area.

None
keypoints list[float]

[x1, y1, v1(visible flag), x2, y2, v2(visible flag), ...]. visible flag is one of [0(Not labeled), 1(Labeled but not visible), 2(labeled and visible)]

None
num_keypoints int

number of labeled keypoints

None
caption str

string.

None
value float

regression value.

None
iscrowd int

is crowd or not. Default to None.

None
score float

prediction score. Default to None.

None
task Union[str, TaskType]

task type. Default to None.

None

Returns:

Name Type Description
Annotation Annotation

annotation class

object_detection(annotation_id=None, image_id=None, category_id=None, bbox=None, area=None, iscrowd=0, score=None, **kwargs) classmethod

Object Detection Annotation Format

Parameters:

Name Type Description Default
annotation_id int

annotaion id. natural number.

None
image_id int

image id. natural number.

None
category_id int

category id. natural number.

None
bbox list[float]

[x1, y1, w, h].

None
area int

bbox area.

None
iscrowd int

is crowd or not. Default to 0.

0
score float

prediction score. Default to None.

None

Returns:

Name Type Description
Annotation Annotation

annotation class

regression(annotation_id=None, image_id=None, value=None, **kwargs) classmethod

Regression Annotation Format

Parameters:

Name Type Description Default
annotation_id int

annotaion id. natural number.

None
image_id int

image id. natural number.

None
category_id int

category id. natural number.

required
value float

regression value.

None

Returns:

Name Type Description
Annotation Annotation

annotation class

semantic_segmentation(annotation_id=None, image_id=None, category_id=None, bbox=None, segmentation=None, area=None, iscrowd=0, score=None, **kwargs) classmethod

Segmentation Annotation Format

Parameters:

Name Type Description Default
annotation_id int

annotaion id. natural number.

None
image_id int

image id. natural number.

None
category_id int

category id. natural number.

None
bbox list[float]

[x1, y1, w, h].

None
segmentation Union[list[list[float]], dict]

[[x1, y1, x2, y2, x3, y3, ...], [polygon]] or RLE.

None
area int

segmentation segmentation area.

None
iscrowd int

is crowd or not. Default to 0.

0
score float

prediction score. Default to None.

None

Returns:

Name Type Description
Annotation Annotation

annotation class

text_recognition(annotation_id=None, image_id=None, caption=None, score=None, **kwargs) classmethod

Text Recognition Annotation Format

Parameters:

Name Type Description Default
annotation_id int

annotaion id. natural number.

None
image_id int

image id. natural number.

None
category_id int

category id. natural number.

required
caption str

string.

None
score float

prediction score. Default to None.

None

Returns:

Name Type Description
Annotation Annotation

annotation class

to_dict()

Get Dictionary of Annotation Data

Returns:

Name Type Description
dict dict

annotation dictionary.

Category

Bases: BaseField

classification(category_id, name, supercategory=None, **kwargs) classmethod

Classification Category Format

Parameters:

Name Type Description Default
category_id int

category id. natural number.

required
name str

category name.

required
supercategory str

supercategory name.

None

Returns:

Name Type Description
Category Category

category class

instance_segmentation(category_id, name, supercategory=None, **kwargs) classmethod

Instance Category Format

Parameters:

Name Type Description Default
category_id int

category id. natural number.

required
name str

category name.

required
supercategory str

supercategory name.

None

Returns:

Name Type Description
Category Category

category class

keypoint_detection(category_id, name, keypoints, skeleton, supercategory=None, **kwargs) classmethod

Keypoint Detection Category Format

Parameters:

Name Type Description Default
category_id int

category id. natural number.

required
name str

category name.

required
keypoints list[str]

category name.

required
skeleton list[list[int]]

skeleton edges.

required
supercategory str

supercategory name.

None

Returns:

Name Type Description
Category Category

category class

new(category_id, name, supercategory=None, keypoints=None, skeleton=None, task=None, **kwargs) classmethod

Category Format

Parameters:

Name Type Description Default
category_id int

category id. natural number.

required
name str

category name.

required
supercategory str

supercategory name.

None
keypoints list[str]

category name.

None
skeleton list[list[int]]

skeleton edges.

None
task Union[str, TaskType]

task type. Default to None.

None

Returns:

Name Type Description
Category Category

category class

object_detection(category_id, name, supercategory=None, **kwargs) classmethod

Object Detection Category Format

Parameters:

Name Type Description Default
category_id int

category id. natural number.

required
name str

category name.

required
supercategory str

supercategory name.

None

Returns:

Name Type Description
Category Category

category class

semantic_segmentation(category_id, name, supercategory=None, **kwargs) classmethod

Segmentation Category Format

Parameters:

Name Type Description Default
category_id int

category id. natural number.

required
name str

category name.

required
supercategory str

supercategory name.

None

Returns:

Name Type Description
Category Category

category class

text_recognition(category_id, name, supercategory=None, **kwargs) classmethod

Text Recognition Category Format

Parameters:

Name Type Description Default
category_id int

category id. natural number.

required
name str

category name.

required
supercategory str

supercategory name.

None

Returns:

Name Type Description
Category Category

category class

to_dict()

Get Dictionary of Category

Returns:

Name Type Description
dict dict

annotation dictionary.

Image

Bases: BaseField

new(image_id, file_name, width, height, date_captured=None, **kwargs) classmethod

Image Format

Parameters:

Name Type Description Default
image_id int

image id. natural number.

required
file_name str

file name. relative file path.

required
width int

image width.

required
height int

image height.

required
date_captured str

date_captured string. "%Y-%m-%d %H:%M:%S"

None

Returns:

Name Type Description
Image Image

image class

to_dict()

Get Dictionary of Category

Returns:

Name Type Description
dict dict

annotation dictionary.