This method assumes self.batch_transform will extract metadata from the input batch. Args: engine: Ignite Engine, it can be a trainer, validator or evaluator.
(self, engine: Engine)
| 96 | engine.add_event_handler(Events.COMPLETED, self.finalize) |
| 97 | |
| 98 | def __call__(self, engine: Engine) -> None: |
| 99 | """ |
| 100 | This method assumes self.batch_transform will extract metadata from the input batch. |
| 101 | |
| 102 | Args: |
| 103 | engine: Ignite Engine, it can be a trainer, validator or evaluator. |
| 104 | """ |
| 105 | if not isinstance(engine.state.batch, dict) or not isinstance(engine.state.output, dict): |
| 106 | raise ValueError("engine.state.batch and engine.state.output must be dictionaries.") |
| 107 | names = engine.state.batch[CommonKeys.IMAGE].meta[ProbMapKeys.NAME] |
| 108 | locs = engine.state.batch[CommonKeys.IMAGE].meta[ProbMapKeys.LOCATION] |
| 109 | probs = engine.state.output[self.prob_key] |
| 110 | for name, loc, prob in zip(names, locs, probs): |
| 111 | self.prob_map[name][tuple(loc)] = prob |
| 112 | with self.lock: |
| 113 | self.counter[name] -= 1 |
| 114 | if self.counter[name] == 0: |
| 115 | self.save_prob_map(name) |
| 116 | |
| 117 | def save_prob_map(self, name: str) -> None: |
| 118 | """ |
nothing calls this directly
no test coverage detected