I’m playing around with the siamese twins network and got stuck on the augmentation part. How do I rotate images per Item?
The default dataloader looks like this:
dls = tls.dataloaders(after_item=[Resize(224), ToTensor],
after_batch=[IntToFloatTensor, Normalize.from_stats(*imagenet_stats)])
I’m trying to add Rotation and Brightnes augmentation as item transforms. Because I would like the images to be more different when they are the same image (eg, the image is a bit rotated and darker but it’s still the same image).
I can add the transforms to a batch
dls = tls.dataloaders(after_item=[Resize(224), ToTensor],
after_batch=[IntToFloatTensor, Rotate(max_deg=10), Normalize.from_stats(*imagenet_stats)])
but this will rotate all pair in the whole batch the same.
if I move the transform to “after_item”:
dls = tls.dataloaders(after_item=[ Resize(160), Rotate(max_deg=10) ToTensor],
after_batch=[IntToFloatTensor, Normalize.from_stats(*imagenet_stats)], bs=100)
I get the error message “Could not do one pass in your dataloader, there is something wrong in it”
What is the easiest way to rotate the images per item?