Build segmentor.
(cfg, train_cfg=None, test_cfg=None)
| 36 | |
| 37 | |
| 38 | def build_segmentor(cfg, train_cfg=None, test_cfg=None): |
| 39 | """Build segmentor.""" |
| 40 | if train_cfg is not None or test_cfg is not None: |
| 41 | warnings.warn("train_cfg and test_cfg is deprecated, please specify them in model", UserWarning) |
| 42 | assert cfg.get("train_cfg") is None or train_cfg is None, ( |
| 43 | "train_cfg specified in both outer field and model field " |
| 44 | ) |
| 45 | assert cfg.get("test_cfg") is None or test_cfg is None, "test_cfg specified in both outer field and model field " |
| 46 | return SEGMENTORS.build(cfg, default_args=dict(train_cfg=train_cfg, test_cfg=test_cfg)) |