I want to combine some transformations and then concatenate them. It's comfortable for me to create a composition of some transformations and then combine these compositions into a one transformation. I'm expecting, that when I'll apply this transformation to dataset, all basic transformations will be applied sequentially in order, in which them are in code.
Example:
transform_resize = A.Sequential([
A.Resize(200),
])
some_transforms = A.Sequential([
transform1,
transform2,
transform3
])
transform_norm = A.Sequential([
A.Normalize(mean=mean, std=std),
ToTensorV2()
])
transform = A.Compose([
transform_resize,
some_transforms,
transform_norm
])
Expected sequence of transformations, when transform will be applied to dataset:
[Resize, transform1, transform2, transform3, Normalize, ToTensorV2]
The questions are:
- Is my way to use Compose and Sequential correct?
- What are the rules to use these two classes inside each other? Sequential class documentation only said:
This transform is not intended to be a replacement for Compose. Instead, it should be used inside Compose the same way OneOf or OneOrOther are used
but it's nothing about using Sequential inside Sequential and Compose inside Compose