So, there are 9560 images that I am using in trainval in 85:15 ratio. As we can see, I am trying to run the traindataloader, so it is the 85% of 9560, so 8126 images.
The shapes of them are [1, 400, 400] (binary images), so probably you can try torch.rand here.
The transform is:
transform = transforms.Compose([
        transforms.ToPILImage(),
        transforms.RandomHorizontalFlip(),
        transforms.RandomVerticalFlip(),
        # transforms.Resize(resize),
        transforms.CenterCrop(800),
        transforms.RandomResizedCrop(400),
        transforms.ToTensor(),
        transforms.Normalize(mean=train_mean, std=train_std)
    ])

Original images were larger than 800 and had different sizes. So I used centercrop and randomresize here (I had to do centercrop to ensure I was taking image part from almost the middle of the image).