You can set the transforms of a dataset programatically like so:
for a_idx in range(128):
train_loader.dataset.transforms=albumentations_transform_0
Is it possible to do this with Python formats? I tried this:
for a_idx in range(128):
train_loader.dataset.transforms=f"albumentations_transform_{a_idx}"
TypeError: Caught TypeError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/opt/conda/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop
data = fetcher.fetch(index)
File "/opt/conda/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/opt/conda/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
data = [self.dataset[idx] for idx in possibly_batched_index]
File "<ipython-input-18-4a491769a098>", line 30, in __getitem__
augmented = self.transforms(image=image)
TypeError: 'str' object is not callable