pocketpose.utils.registry#

Module Contents#

Classes#

Registry

A registry to map names to classes.

Functions#

build_from_cfg(cfg, registry[, default_args])

Build a class from the config.

class pocketpose.utils.registry.Registry(name)#

A registry to map names to classes.

This is a generic registry that can be used to register any class, e.g. skeletons, datasets, models, etc. It is used by different modules to register their classes.

Args:

name (str): The name of the registry.

Attributes:

name (str): The name of the registry. _registry (dict): The dictionary mapping names to classes.

Example:
>>> model_registry = Registry("model")
>>> @model_registry.register("movenet")
register(name)#

Register a class using the name.

Args:

name (str): The name of the class.

get(name)#

Get the class corresponding to the name.

Args:

name (str): The name of the class.

Returns:

The corresponding class.

Raises:

ValueError: If the name is not registered in the registry.

list()#

List all the registered names.

pocketpose.utils.registry.build_from_cfg(cfg, registry, default_args=None)#

Build a class from the config.

Args:

cfg (dict): The config. registry (Registry): The registry to look up the class. default_args (dict): The default arguments to the class.

Returns:

The built class.