|
32 | 32 | from mmengine.registry import Registry
|
33 | 33 |
|
34 | 34 | # manage all kinds of runners like `EpochBasedRunner` and `IterBasedRunner`
|
35 |
| -RUNNERS = Registry('runner', parent=MMENGINE_RUNNERS) |
| 35 | +RUNNERS = Registry( |
| 36 | + 'runner', |
| 37 | + parent=MMENGINE_RUNNERS, |
| 38 | + # TODO: update the location when mmocr has its own runner |
| 39 | + locations=['mmocr.engine']) |
36 | 40 | # manage runner constructors that define how to initialize runners
|
37 | 41 | RUNNER_CONSTRUCTORS = Registry(
|
38 |
| - 'runner constructor', parent=MMENGINE_RUNNER_CONSTRUCTORS) |
| 42 | + 'runner constructor', |
| 43 | + parent=MMENGINE_RUNNER_CONSTRUCTORS, |
| 44 | + # TODO: update the location when mmocr has its own runner constructor |
| 45 | + locations=['mmocr.engine']) |
39 | 46 | # manage all kinds of loops like `EpochBasedTrainLoop`
|
40 |
| -LOOPS = Registry('loop', parent=MMENGINE_LOOPS) |
| 47 | +LOOPS = Registry( |
| 48 | + 'loop', |
| 49 | + parent=MMENGINE_LOOPS, |
| 50 | + # TODO: update the location when mmocr has its own loop |
| 51 | + locations=['mmocr.engine']) |
41 | 52 | # manage all kinds of hooks like `CheckpointHook`
|
42 |
| -HOOKS = Registry('hook', parent=MMENGINE_HOOKS) |
| 53 | +HOOKS = Registry( |
| 54 | + 'hook', parent=MMENGINE_HOOKS, locations=['mmocr.engine.hooks']) |
43 | 55 |
|
44 | 56 | # manage data-related modules
|
45 |
| -DATASETS = Registry('dataset', parent=MMENGINE_DATASETS) |
46 |
| -DATA_SAMPLERS = Registry('data sampler', parent=MMENGINE_DATA_SAMPLERS) |
47 |
| -TRANSFORMS = Registry('transform', parent=MMENGINE_TRANSFORMS) |
| 57 | +DATASETS = Registry( |
| 58 | + 'dataset', parent=MMENGINE_DATASETS, locations=['mmocr.datasets']) |
| 59 | +DATA_SAMPLERS = Registry( |
| 60 | + 'data sampler', |
| 61 | + parent=MMENGINE_DATA_SAMPLERS, |
| 62 | + locations=['mmocr.datasets.samplers']) |
| 63 | +TRANSFORMS = Registry( |
| 64 | + 'transform', |
| 65 | + parent=MMENGINE_TRANSFORMS, |
| 66 | + locations=['mmocr.datasets.transforms']) |
48 | 67 |
|
49 | 68 | # manage all kinds of modules inheriting `nn.Module`
|
50 |
| -MODELS = Registry('model', parent=MMENGINE_MODELS) |
| 69 | +MODELS = Registry('model', parent=MMENGINE_MODELS, locations=['mmocr.models']) |
51 | 70 | # manage all kinds of model wrappers like 'MMDistributedDataParallel'
|
52 |
| -MODEL_WRAPPERS = Registry('model_wrapper', parent=MMENGINE_MODEL_WRAPPERS) |
| 71 | +MODEL_WRAPPERS = Registry( |
| 72 | + 'model wrapper', |
| 73 | + parent=MMENGINE_MODEL_WRAPPERS, |
| 74 | + locations=['mmocr.models']) |
53 | 75 | # manage all kinds of weight initialization modules like `Uniform`
|
54 | 76 | WEIGHT_INITIALIZERS = Registry(
|
55 |
| - 'weight initializer', parent=MMENGINE_WEIGHT_INITIALIZERS) |
| 77 | + 'weight initializer', |
| 78 | + parent=MMENGINE_WEIGHT_INITIALIZERS, |
| 79 | + locations=['mmocr.models']) |
56 | 80 |
|
57 | 81 | # manage all kinds of optimizers like `SGD` and `Adam`
|
58 |
| -OPTIMIZERS = Registry('optimizer', parent=MMENGINE_OPTIMIZERS) |
| 82 | +OPTIMIZERS = Registry( |
| 83 | + 'optimizer', |
| 84 | + parent=MMENGINE_OPTIMIZERS, |
| 85 | + # TODO: update the location when mmocr has its own optimizer |
| 86 | + locations=['mmocr.engine']) |
59 | 87 | # manage optimizer wrapper
|
60 |
| -OPTIM_WRAPPERS = Registry('optim wrapper', parent=MMENGINE_OPTIM_WRAPPERS) |
| 88 | +OPTIM_WRAPPERS = Registry( |
| 89 | + 'optimizer wrapper', |
| 90 | + parent=MMENGINE_OPTIM_WRAPPERS, |
| 91 | + # TODO: update the location when mmocr has its own optimizer wrapper |
| 92 | + locations=['mmocr.engine']) |
61 | 93 | # manage constructors that customize the optimization hyperparameters.
|
62 | 94 | OPTIM_WRAPPER_CONSTRUCTORS = Registry(
|
63 |
| - 'optimizer constructor', parent=MMENGINE_OPTIM_WRAPPER_CONSTRUCTORS) |
| 95 | + 'optimizer constructor', |
| 96 | + parent=MMENGINE_OPTIM_WRAPPER_CONSTRUCTORS, |
| 97 | + # TODO: update the location when mmocr has its own optimizer constructor |
| 98 | + locations=['mmocr.engine']) |
64 | 99 | # manage all kinds of parameter schedulers like `MultiStepLR`
|
65 | 100 | PARAM_SCHEDULERS = Registry(
|
66 |
| - 'parameter scheduler', parent=MMENGINE_PARAM_SCHEDULERS) |
67 |
| - |
| 101 | + 'parameter scheduler', |
| 102 | + parent=MMENGINE_PARAM_SCHEDULERS, |
| 103 | + # TODO: update the location when mmocr has its own parameter scheduler |
| 104 | + locations=['mmocr.engine']) |
68 | 105 | # manage all kinds of metrics
|
69 |
| -METRICS = Registry('metric', parent=MMENGINE_METRICS) |
| 106 | +METRICS = Registry( |
| 107 | + 'metric', parent=MMENGINE_METRICS, locations=['mmocr.evaluation.metrics']) |
70 | 108 | # manage evaluator
|
71 |
| -EVALUATOR = Registry('evaluator', parent=MMENGINE_EVALUATOR) |
| 109 | +EVALUATOR = Registry( |
| 110 | + 'evaluator', |
| 111 | + parent=MMENGINE_EVALUATOR, |
| 112 | + locations=['mmocr.evaluation.evaluator']) |
72 | 113 |
|
73 | 114 | # manage task-specific modules like anchor generators and box coders
|
74 |
| -TASK_UTILS = Registry('task util', parent=MMENGINE_TASK_UTILS) |
| 115 | +TASK_UTILS = Registry( |
| 116 | + 'task util', parent=MMENGINE_TASK_UTILS, locations=['mmocr.models']) |
75 | 117 |
|
76 | 118 | # manage visualizer
|
77 |
| -VISUALIZERS = Registry('visualizer', parent=MMENGINE_VISUALIZERS) |
| 119 | +VISUALIZERS = Registry( |
| 120 | + 'visualizer', |
| 121 | + parent=MMENGINE_VISUALIZERS, |
| 122 | + locations=['mmocr.visualization']) |
78 | 123 | # manage visualizer backend
|
79 |
| -VISBACKENDS = Registry('vis_backend', parent=MMENGINE_VISBACKENDS) |
| 124 | +VISBACKENDS = Registry( |
| 125 | + 'visualizer backend', |
| 126 | + parent=MMENGINE_VISBACKENDS, |
| 127 | + locations=['mmocr.visualization']) |
80 | 128 |
|
81 | 129 | # manage logprocessor
|
82 |
| -LOG_PROCESSORS = Registry('log_processor', parent=MMENGINE_LOG_PROCESSORS) |
| 130 | +LOG_PROCESSORS = Registry( |
| 131 | + 'logger processor', |
| 132 | + parent=MMENGINE_LOG_PROCESSORS, |
| 133 | + # TODO: update the location when mmocr has its own log processor |
| 134 | + locations=['mmocr.engine']) |
0 commit comments