pipert.utils.visualizer.catalog

Module Contents

Classes

DatasetCatalog

A catalog that stores information about the datasets and how to obtain them.

MetadataCatalog

MetadataCatalog provides access to “Metadata” of a given dataset.

class pipert.utils.visualizer.catalog.DatasetCatalog[source]

Bases: object

A catalog that stores information about the datasets and how to obtain them. It contains a mapping from strings (which are names that identify a dataset, e.g. “coco_2014_train”) to a function which parses the dataset and returns the samples in the format of list[dict]. The returned dicts should be in Detectron2 Dataset format (See DATASETS.md for details) if used with the data loader functionalities in data/build.py,data/detection_transform.py. The purpose of having this catalog is to make it easy to choose different datasets, by just using the strings in the config.

_REGISTERED[source]
static register(name, func)[source]

Args: name (str): the name that identifies a dataset, e.g. “coco_2014_train”. func (callable): a callable which takes no arguments and returns a list of dicts.

static get(name)[source]

Call the registered function and return its results. Args:

name (str): the name that identifies a dataset, e.g. “coco_2014_train”.

Returns:

list[dict]: dataset annotations.0

static list()List[str][source]

List all registered datasets. Returns:

list[str]

static clear()[source]

Remove all registered dataset.

class pipert.utils.visualizer.catalog.MetadataCatalog[source]

MetadataCatalog provides access to “Metadata” of a given dataset. The metadata associated with a certain name is a singleton: once created, the metadata will stay alive and will be returned by future calls to get(name). It’s like global variables, so don’t abuse it. It’s meant for storing knowledge that’s constant and shared across the execution of the program, e.g.: the class names in COCO.

_NAME_TO_META[source]
static get(name)[source]
Args:

name (str): name of a dataset (e.g. coco_2014_train).

Returns:

Metadata: The Metadata instance associated with this name, or create an empty one if none is available.

static list()[source]

List all registered metadata. Returns:

list[str]: keys (names of datasets) of all registered metadata