augmentation
feature's utils.
Classes:
| Name | Description |
|---|---|
FeatureAugmentation |
Feature augmentation class, mainly for images. |
Functions:
| Name | Description |
|---|---|
from_select_transform_augmentation |
Reverse of to_insert_transform_augmentation using **kwargs. |
trusted_augmentation_from_model |
Convert a serialized transform to a torchvision transform. |
augmentation_from_model |
Reverse of to_model(). |
FeatureAugmentation
#
Feature augmentation class, mainly for images.
For images, the corresponding data uses the channel-last format, i.e. batch_size x H x W x num_channels. You may need to use Compose([Permute([0, 3, 1, 2]), YourTransformation(), Permute([0, 2, 3, 1])]) if your augmentation requires the channel first. You don't need to convert to torch tensor first, as it is automatically handled by xpdeep.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Compose | None
|
A feature augmentation function used to augment raw data. This is done before data preprocessing. |
None
|
|
Compose | None
|
A feature augmentation function used to augment data after it has been preprocessed. |
None
|
Methods:
| Name | Description |
|---|---|
__attrs_post_init__ |
Post init method, triggered after calling init method to check instance's validity. |
to_model |
Convert to AugmentationInsert. |
stable_hash |
Return the hash. |
Attributes:
| Name | Type | Description |
|---|---|---|
augment_raw |
AllAugmentationTransform | None
|
|
augment_preprocessed |
AllAugmentationTransform | None
|
|
augment_raw: AllAugmentationTransform | None = field(default=None)
#
augment_preprocessed: AllAugmentationTransform | None = field(default=None)
#
__attrs_post_init__() -> None
#
Post init method, triggered after calling init method to check instance's validity.
Source code in src/xpdeep/dataset/feature/augmentation/augmentation.py
to_model() -> AugmentationInsert
#
Convert to AugmentationInsert.
Source code in src/xpdeep/dataset/feature/augmentation/augmentation.py
from_select_transform_augmentation(value: TransformAugmentationValue) -> AllAugmentationTransform
#
Reverse of to_insert_transform_augmentation using **kwargs.
Source code in src/xpdeep/dataset/feature/augmentation/augmentation.py
trusted_augmentation_from_model(value: ComposeAugmentationValueInput | LinearTransformationAugmentationValue | RandomApplyAugmentationValueInput | RandomChoiceAugmentationValueInput | RandomOrderAugmentationValueInput | TransformAugmentationValue | None) -> AllAugmentationTransform | None
#
Convert a serialized transform to a torchvision transform.
Source code in src/xpdeep/dataset/feature/augmentation/augmentation.py
augmentation_from_model(augmentation_select: AugmentationSelectInput | AugmentationInsert) -> FeatureAugmentation
#
Reverse of to_model().