Apply a sequence of augmentations. It has ``__call__`` method to apply the augmentations. Note that :meth:`get_transform` method is impossible (will throw error if called) for :class:`AugmentationList`, because in order to apply a sequence of augmentations, the kth augmentatio
| 574 | |
| 575 | |
| 576 | class AugmentationList(Augmentation): |
| 577 | """ |
| 578 | Apply a sequence of augmentations. |
| 579 | |
| 580 | It has ``__call__`` method to apply the augmentations. |
| 581 | |
| 582 | Note that :meth:`get_transform` method is impossible (will throw error if called) |
| 583 | for :class:`AugmentationList`, because in order to apply a sequence of augmentations, |
| 584 | the kth augmentation must be applied first, to provide inputs needed by the (k+1)th |
| 585 | augmentation. |
| 586 | """ |
| 587 | |
| 588 | def __init__(self, augs): |
| 589 | """ |
| 590 | Args: |
| 591 | augs (list[Augmentation or Transform]): |
| 592 | """ |
| 593 | super().__init__() |
| 594 | self.augs = [_transform_to_aug(x) for x in augs] |
| 595 | |
| 596 | def __call__(self, aug_input) -> Transform: |
| 597 | tfms = [] |
| 598 | for x in self.augs: |
| 599 | tfm = x(aug_input) |
| 600 | tfms.append(tfm) |
| 601 | return TransformList(tfms) |
| 602 | |
| 603 | def __repr__(self): |
| 604 | msgs = [str(x) for x in self.augs] |
| 605 | return "AugmentationList[{}]".format(", ".join(msgs)) |
| 606 | |
| 607 | __str__ = __repr__ |
| 608 | |
| 609 | |
| 610 | class AugInput: |