otx.api.serialization.label_mapper#

.This module contains the mapper for label related entities.

Functions

label_schema_to_bytes(label_schema)

Returns json-serialized LabelSchemaEntity as bytes.

Classes

ColorMapper()

This class maps a Color entity to a serialized dictionary, and vice versa.

LabelGroupMapper()

This class maps a LabelGroup entity to a serialized dictionary, and vice versa.

LabelMapper()

This class maps a Label entity to a serialized dictionary, and vice versa.

LabelSchemaMapper()

This class maps a LabelSchema entity to a serialized dictionary, and vice versa.

LabelTreeMapper()

This class maps a LabelTree entity to a serialized dictionary, and vice versa.

class otx.api.serialization.label_mapper.ColorMapper[source]#

Bases: object

This class maps a Color entity to a serialized dictionary, and vice versa.

static backward(instance: dict) Color[source]#

Deserializes from dict.

static forward(instance: Color) dict[source]#

Serializes to dict.

class otx.api.serialization.label_mapper.LabelGroupMapper[source]#

Bases: object

This class maps a LabelGroup entity to a serialized dictionary, and vice versa.

static backward(instance: dict, all_labels: Dict[ID, LabelEntity]) LabelGroup[source]#

Deserializes from dict.

static forward(instance: LabelGroup) dict[source]#

Serializes to dict.

class otx.api.serialization.label_mapper.LabelMapper[source]#

Bases: object

This class maps a Label entity to a serialized dictionary, and vice versa.

static backward(instance: dict) LabelEntity[source]#

Deserializes from dict.

static forward(instance: LabelEntity) dict[source]#

Serializes to dict.

class otx.api.serialization.label_mapper.LabelSchemaMapper[source]#

Bases: object

This class maps a LabelSchema entity to a serialized dictionary, and vice versa.

static backward(instance: dict) LabelSchemaEntity[source]#

Deserializes from dict.

static forward(instance: LabelSchemaEntity) dict[source]#

Serializes to dict.

class otx.api.serialization.label_mapper.LabelTreeMapper[source]#

Bases: object

This class maps a LabelTree entity to a serialized dictionary, and vice versa.

static backward(instance: dict, all_labels: Dict[ID, LabelEntity]) LabelTree[source]#

Deserializes from dict.

static forward(instance: LabelTree) dict[source]#

Serializes to dict.

otx.api.serialization.label_mapper.label_schema_to_bytes(label_schema: LabelSchemaEntity) bytes[source]#

Returns json-serialized LabelSchemaEntity as bytes.