Dictionary-based version :py:class:`monai.transforms.CutOut`. Notice that the cutout is different for every entry in the dictionary.
| 97 | |
| 98 | |
| 99 | class CutOutd(MapTransform, RandomizableTransform): |
| 100 | """ |
| 101 | Dictionary-based version :py:class:`monai.transforms.CutOut`. |
| 102 | |
| 103 | Notice that the cutout is different for every entry in the dictionary. |
| 104 | """ |
| 105 | |
| 106 | def __init__(self, keys: KeysCollection, batch_size: int, allow_missing_keys: bool = False) -> None: |
| 107 | super().__init__(keys, allow_missing_keys) |
| 108 | self.cutout = CutOut(batch_size) |
| 109 | |
| 110 | def set_random_state(self, seed: int | None = None, state: np.random.RandomState | None = None) -> CutOutd: |
| 111 | super().set_random_state(seed, state) |
| 112 | self.cutout.set_random_state(seed, state) |
| 113 | return self |
| 114 | |
| 115 | def __call__(self, data): |
| 116 | d = dict(data) |
| 117 | first_key: Hashable = self.first_key(d) |
| 118 | if first_key == (): |
| 119 | out: dict[Hashable, NdarrayOrTensor] = convert_to_tensor(d, track_meta=get_track_meta()) |
| 120 | return out |
| 121 | self.cutout.randomize(d[first_key]) |
| 122 | for k in self.key_iterator(d): |
| 123 | d[k] = self.cutout(data[k], randomize=False) |
| 124 | return d |
| 125 | |
| 126 | |
| 127 | MixUpD = MixUpDict = MixUpd |
no outgoing calls
searching dependent graphs…