from dassl.utils import Registry, check_availability EVALUATOR_REGISTRY = Registry('EVALUATOR') def build_evaluator(cfg, **kwargs): avai_evaluators = EVALUATOR_REGISTRY.registered_names() check_availability(cfg.TEST.EVALUATOR, avai_evaluators) if cfg.VERBOSE: print('Loading evaluator: {}'.format(cfg.TEST.EVALUATOR)) return EVALUATOR_REGISTRY.get(cfg.TEST.EVALUATOR)(cfg, **kwargs)
from dassl.utils import Registry, check_availability BACKBONE_REGISTRY = Registry('BACKBONE') def build_backbone(name, verbose=True, **kwargs): avai_backbones = BACKBONE_REGISTRY.registered_names() check_availability(name, avai_backbones) if verbose: print('Backbone: {}'.format(name)) return BACKBONE_REGISTRY.get(name)(**kwargs)
from dassl.utils import Registry, check_availability MODEL_REGISTRY = Registry('MODELS') def build_model(name, verbose=True, **kwargs): avai_models = MODEL_REGISTRY.registered_names() check_availability(name, avai_models) if verbose: print('Model: {}'.format(name)) return MODEL_REGISTRY.get(name)(**kwargs)
from dassl.utils import Registry, check_availability NETWORK_REGISTRY = Registry('NETWORK') def build_network(name, verbose=True, **kwargs): avai_models = NETWORK_REGISTRY.registered_names() check_availability(name, avai_models) if verbose: print('Network: {}'.format(name)) return NETWORK_REGISTRY.get(name)(**kwargs)
from dassl.utils import Registry, check_availability DATASET_REGISTRY = Registry('DATASET') def build_dataset(cfg): avai_datasets = DATASET_REGISTRY.registered_names() check_availability(cfg.DATASET.NAME, avai_datasets) if cfg.VERBOSE: print('Loading dataset: {}'.format(cfg.DATASET.NAME)) return DATASET_REGISTRY.get(cfg.DATASET.NAME)(cfg)
from dassl.utils import Registry, check_availability TRAINER_REGISTRY = Registry('TRAINER') def build_trainer(cfg): avai_trainers = TRAINER_REGISTRY.registered_names() check_availability(cfg.TRAINER.NAME, avai_trainers) if cfg.VERBOSE: print('Loading trainer: {}'.format(cfg.TRAINER.NAME)) return TRAINER_REGISTRY.get(cfg.TRAINER.NAME)(cfg)
from dassl.utils import Registry, check_availability HEAD_REGISTRY = Registry('HEAD') def build_head(name, verbose=True, **kwargs): avai_heads = HEAD_REGISTRY.registered_names() check_availability(name, avai_heads) if verbose: print('Head: {}'.format(name)) return HEAD_REGISTRY.get(name)(**kwargs)