Augmentations for multispectral image segmentation. Just working with mid-level API, not with DataBlock

Hi,
I’ve been developing some classes to work with multispectral satellite images in Fastai-v2 (will make it available in github as soon as it is working properly) but I am struggling to use data augmentation properly. I could make it work using the mid-level API and passing the augmentations during the creation of dataloader as a pipeline in after_item like this:

However, when I use the same classes/transforms and try to create a DataBlock, I can’t put it to work:

When debugging, I realized that the DataBlock created internally an after_item pipeline with the ToTensor transformation, and that’s why it is getting multiple after_item keywords. I could just ignore this and continue using the mid-level API, but I would like to understand what am I doing wrong in the DataBlock.
Thanks

You should put your transforms in an item_tfms or batch_tfms parameter in the DataBlock, the only thing .dataloaders is expecting after the DataBlock is the source, batch size, and workers (everything unrelated to the Block. So for you set your pipe as item_tfms

Thanks @muellerzr,

I have tried this.
As my problem is segmentation, I have to apply the augmentation to both item and mask at the same time, so I put the augmentations in the item_tfms of the main DataBlock (that holds the two TransformBlocks) like so:

In this case it works, but as we can see in the summary, it applies only one augmentation (the last one), and skips the others. Also tried passing the augmentations to item_tfms as a pipeline, but it raises an error I am still debugging.
TypeError: '<' not supported between instances of 'L' and 'int'

As I told before, the weird is that it works flawlessly using directly the mid-level api. And there I pass the augmentations as the same pipe object.

Mauricio