U ‚PÓh© ã @s¦ddlmZddlmZddlmZddlmZddlm Z m Z m Z dd d d d d dddg Z Gdd„deƒZ Gdd „d eƒZGdd„deƒZe ZZeZZeZZdS)é)Ú annotations)ÚKeysCollection)Ú ensure_tupleé)Ú MapTransformé)ÚCutMixÚCutOutÚMixUpÚMixUpdÚMixUpDÚ MixUpDictÚCutMixdÚCutMixDÚ CutMixDictÚCutOutdÚCutOutDÚ CutOutDictcs8eZdZdZddddddd œ‡fd d „ Zd d „Z‡ZS)r zã Dictionary-based version :py:class:`monai.transforms.MixUp`. Notice that the mixup transformation will be the same for all entries for consistency, i.e. images and labels must be applied the same augmenation. çð?FrÚintÚfloatÚboolÚNone)ÚkeysÚ batch_sizeÚalphaÚallow_missing_keysÚreturncstƒ ||¡t||ƒ|_dS©N)ÚsuperÚ__init__r Úmixup)Úselfrrrr©Ú __class__©ú_/home/dell461/cl/sdc2/HISourceFinder-master-l/src/monai/transforms/regularization/dictionary.pyr szMixUpd.__init__cCs6|j ¡t|ƒ}|jD]}|j ||¡||<q|Sr)r!Ú randomizeÚdictrÚapply©r"ÚdataÚresultÚkr%r%r&Ú__call__%s   zMixUpd.__call__)rF©Ú__name__Ú __module__Ú __qualname__Ú__doc__r r.Ú __classcell__r%r%r#r&r s ÿcs:eZdZdZdddddd d d œ‡fd d „ Zdd„Z‡ZS)ra Dictionary-based version :py:class:`monai.transforms.CutMix`. Notice that the mixture weights will be the same for all entries for consistency, i.e. images and labels must be aggregated with the same weights, but the random crops are not. NrFrrzKeysCollection | Nonerrr)rrÚ label_keysrrrcs4tƒ ||¡t||ƒ|_|dk r*t|ƒng|_dSr)rr rÚmixerrr5)r"rrr5rrr#r%r&r 6s zCutMixd.__init__cCsV|j ¡t|ƒ}|jD]}|j ||¡||<q|jD]}|j ||¡||<q8|Sr)r6r'r(rr)r5Úapply_on_labelsr*r%r%r&r.Bs   zCutMixd.__call__)NrFr/r%r%r#r&r-s  ú cs6eZdZdZd dddddœ‡fdd „ Zd d „Z‡ZS) rz“ Dictionary-based version :py:class:`monai.transforms.CutOut`. Notice that the cutout is different for every entry in the dictionary. Frrrr)rrrrcstƒ ||¡t|ƒ|_dSr)rr r Úcutout)r"rrrr#r%r&r SszCutOutd.__init__cCs4t|ƒ}|j ¡|jD]}| ||¡||<q|Sr)r(r8r'rr*r%r%r&r.Ws   zCutOutd.__call__)Fr/r%r%r#r&rLsN)Ú __future__rÚ monai.configrÚmonai.utils.miscrÚ transformrÚarrayrr r Ú__all__r rrr r rrrrr%r%r%r&Ú s