Args: cfg (CfgNode): model (SemanticSegmentor): a SemanticSegmentor to apply TTA on. tta_mapper (callable): takes a dataset dict and returns a list of augmented versions of the dataset dict. Defaults to `DatasetMapperTTA(cf
(self, cfg, model, batch_size=1)
| 31 | """ |
| 32 | |
| 33 | def __init__(self, cfg, model, batch_size=1): |
| 34 | """ |
| 35 | Args: |
| 36 | cfg (CfgNode): |
| 37 | model (SemanticSegmentor): a SemanticSegmentor to apply TTA on. |
| 38 | tta_mapper (callable): takes a dataset dict and returns a list of |
| 39 | augmented versions of the dataset dict. Defaults to |
| 40 | `DatasetMapperTTA(cfg)`. |
| 41 | batch_size (int): batch the augmented images into this batch size for inference. |
| 42 | """ |
| 43 | super().__init__() |
| 44 | if isinstance(model, DistributedDataParallel) or isinstance(model, DistModule): |
| 45 | model = model.module |
| 46 | self.cfg = cfg |
| 47 | |
| 48 | self.min_sizes = cfg.min_sizes |
| 49 | self.max_size = cfg.max_size |
| 50 | self.flip = cfg.flip |
| 51 | |
| 52 | self.model = model |
| 53 | |
| 54 | # if tta_mapper is None: |
| 55 | # tta_mapper = DatasetMapperTTA(cfg) |
| 56 | # self.tta_mapper = tta_mapper |
| 57 | assert batch_size == 1 |
| 58 | self.batch_size = batch_size |
| 59 | |
| 60 | def tta_mapper(self, dataset_dict): |
| 61 | """ |
nothing calls this directly
no outgoing calls
no test coverage detected