I have already posted the data transformations on the top, here once again for your reference
data_transforms = {
        'train': transforms.Compose([
                transforms.RandomResizedCrop(224),
                transforms.RandomHorizontalFlip(),
                transforms.ToTensor(),
                transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
        ]),
        'val': transforms.Compose([
                transforms.Resize(224),
                transforms.ToTensor(),
                transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
        ]),
}

I looked into this post https://github.com/marvis/pytorch-yolo2/issues/89 4 suggested using RandomCrop instead of Resize, which didn’t solve my issue instead it got this error

Traceback (most recent call last):
File “demotest1.py”, line 222, in 
model_ft = train_model(model_ft,criterion,optimizer_ft,exp_lr_scheduler,num_epochs=2)
File “demotest1.py”, line 119, in train_model
for i, (inputs,labels) in enumerate(dataloaders[phase]):
File “/home/ffffff/.virtualenvs/LearnPytorch/lib/python3.6/site-packages/torch/utils/data/dataloader.py”, line 336, in next
return self._process_next_batch(batch)
File “/home/ffffff/.virtualenvs/LearnPytorch/lib/python3.6/site-packages/torch/utils/data/dataloader.py”, line 357, in _process_next_batch
raise batch.exc_type(batch.exc_msg)
ValueError: Traceback (most recent call last):
File “/home/ffffff/.virtualenvs/LearnPytorch/lib/python3.6/site-packages/torch/utils/data/dataloader.py”, line 106, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File “/home/ffffff/.virtualenvs/LearnPytorch/lib/python3.6/site-packages/torch/utils/data/dataloader.py”, line 106, in 
samples = collate_fn([dataset[i] for i in batch_indices])
File “/home/ffffff/.virtualenvs/LearnPytorch/lib/python3.6/site-packages/torchvision/datasets/folder.py”, line 103, in getitem
sample = self.transform(sample)
File “/home/ffffff/.virtualenvs/LearnPytorch/lib/python3.6/site-packages/torchvision/transforms/transforms.py”, line 49, in call
img = t(img)
File “/home/ffffff/.virtualenvs/LearnPytorch/lib/python3.6/site-packages/torchvision/transforms/transforms.py”, line 421, in call
i, j, h, w = self.get_params(img, self.size)
File “/home/ffffff/.virtualenvs/LearnPytorch/lib/python3.6/site-packages/torchvision/transforms/transforms.py”, line 399, in get_params
i = random.randint(0, h - th)
File “/home/ffffff/.virtualenvs/LearnPytorch/lib/python3.6/random.py”, line 221, in randint
return self.randrange(a, b+1)
File “/home/ffffff/.virtualenvs/LearnPytorch/lib/python3.6/random.py”, line 199, in randrange
raise ValueError(“empty range for randrange() (%d,%d, %d)” % (istart, istop, width))
ValueError: empty range for randrange() (0,-29, -29)

However, using RandomSizeCrop solved my issue.
Wounder why this error occurs!
PS: typo it is RandomResizedCrop