MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / CutOutd

Class CutOutd

monai/transforms/regularization/dictionary.py:99–124  ·  view source on GitHub ↗

Dictionary-based version :py:class:`monai.transforms.CutOut`. Notice that the cutout is different for every entry in the dictionary.

Source from the content-addressed store, hash-verified

97
98
99class 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
127MixUpD = MixUpDict = MixUpd

Callers 1

test_cutoutdMethod · 0.90

Calls

no outgoing calls

Tested by 1

test_cutoutdMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…