It looks like you are trying to get the first batch from the initialization of your DataLoader.
Could you try to first instantiate your DataLoader, then get the batches in a for loop:
train_loader = TrainLoader(im_dir=...)
for t_images, t_label in train_loader:
    print(t_images.shape)