`Registery` and `DatasetCatalog` used in `Gale`

class Registry[source]

Registry(*args, **kwds) :: Iterable

The registry that provides name -> object mapping, to support third-party users' custom modules.

Registry.register[source]

Registry.register(obj:Any=None)

Register the given object under the the name obj.__name__. Can also be used a decorator.

Registry.get[source]

Registry.get(name:str)

Retrive an object from the Registry

To create a registry (e.g. a backbone registry):

BACKBONE_REGISTRY = Registry('BACKBONE')

To register an object:

@BACKBONE_REGISTRY.register()
class MyBackbone():
    ...

Registry instances

Activation Registry

Activations[source]

Registry of Activation functions

Image Classifier BackBonesS

Image Classification Backbones[source]

Registry for Backbones used in Image Classification.

Classification Heads Registry

Image Classification Heads[source]

Registry for Classification heads in a Gale model. Heads take feature maps and returns predictions.

Model Architecure Registry

Model Architectures[source]

Registry for meta-architectures, i.e. the whole model. The registered object will be called with cfg and expected to return a nn.Module object.

Optimizer Registry

Optimizers[source]

Registry for optimizers. Should be a subclass of torch.optim.Optimizer

LRScheduler Registry

LRSchedulers[source]

Registry for lr_schedulers. Should be a subclass of torch.optim.lr_scheduler._LRScheduler

Loss Registry

Loss Functions[source]

Registry for custom Loss Functions

Dataset Catalog

A global dictionary that stores information about the Datasets and how to obtain them.

DatasetCatalog(registered datasets: )[source]

A global dictionary 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 purpose of having this catalog is to make it easy to choose different datasets, by just using the strings in the config.

_DatasetCatalog.register[source]

_DatasetCatalog.register(name, func)

Arguments:

  • 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. It must return the same results if called multiple times.

_DatasetCatalog.get[source]

_DatasetCatalog.get(name, **kwargs)

Call the registered function and return its results.

Arguments:

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

Returns:

  • list[dict]: dataset annotations.

_DatasetCatalog.remove[source]

_DatasetCatalog.remove(name)

Alias of pop.