birdnet_tiny_forge.registries package

Submodules

birdnet_tiny_forge.registries.base module

A few components of the pipeline are dynamically applied by looking at configuration. For example, one might configure feature extraction to happen via FeatureExtractorX or FeatureExtractorY, model training with ModelA, or ModelB, and so on. For this reason, we keep a few registries around which can map from strings (used in the configuration yaml file) to the concrete objects to be used in the pipeline. A pipeline node can then retrieve the needed object using the string via the corresponding registry. Here is a base class that can map classes and functions to names (and viceversa as needed). Registers are singletons. Here we implement the singleton pattern by making each Register a class (rather than a class instance). As such, a metaclass RegisterMeta is used to make sure each Register class gets its own internal dicts to perform the str->entity and entity->str mapping.

class birdnet_tiny_forge.registries.base.RegisterMeta(name, bases, namespace)

Bases: type

Metaclass for RegistryBase, ‘initializes’ new empty internal dicts for each new register class.

class birdnet_tiny_forge.registries.base.RegistryBase

Bases: Generic[_D]

Base class for all registries. Can map strings to classes/functions and vice-versa. a transient_registration context manager is also implemented to facilitate testing.

classmethod add(name: str, item: _D | type[_D] | Callable[[...], _D]) None

Register item with name

classmethod contains(item: str | _D | type[_D] | Callable[[...], _D]) bool

Return True if item is in registry, else False

classmethod get_item(name: str) type[_D] | Callable[[...], _D]

Get item by name

classmethod get_name(item: _D | type[_D] | Callable[[...], _D]) str

Get name of item

classmethod remove(item: str | _D | type[_D] | Callable[[...], _D]) None

Remove item from registry

classmethod transient_registration(name: str, item: _D | type[_D] | Callable[[...], _D])

Utility context manager that temporarily registers an item under name, then undoes the registration at exit.

birdnet_tiny_forge.registries.feature_extraction module

Registry for feature extractors

class birdnet_tiny_forge.registries.feature_extraction.FeatureExtractorsRegistry

Bases: RegistryBase

birdnet_tiny_forge.registries.hypersearch module

birdnet_tiny_forge.registries.models module

birdnet_tiny_forge.registries.targets module