Hi, @ptrblck,
Thanks for responding back.
I did try to change the Image format to Tensor input. I got the following error:
Traceback (most recent call last):
  File "/home/khushi/Documents/deep-learning/benchmarking-deep-neural-networks/vgg/main.py", line 58, in <module>
    main()
  File "/home/khushi/Documents/deep-learning/benchmarking-deep-neural-networks/vgg/main.py", line 54, in main
    train(data, model, num_epochs, criteria, optimizer)
  File "/home/khushi/Documents/deep-learning/benchmarking-deep-neural-networks/vgg/main.py", line 17, in train
    for i, (image, target) in enumerate(data):
  File "/home/khushi/Documents/deep-learning/benchmarking-deep-neural-networks/vgg/voc_loader.py", line 85, in __getitem__
    img, target = self.transforms(img, target)
  File "/home/khushi/.local/lib/python3.9/site-packages/torchvision/datasets/vision.py", line 93, in __call__
    input = self.transform(input)
  File "/home/khushi/.local/lib/python3.9/site-packages/torchvision/transforms/transforms.py", line 61, in __call__
    img = t(img)
  File "/home/khushi/.local/lib/python3.9/site-packages/torchvision/transforms/transforms.py", line 98, in __call__
    return F.to_tensor(pic)
  File "/home/khushi/.local/lib/python3.9/site-packages/torchvision/transforms/functional.py", line 114, in to_tensor
    raise TypeError('pic should be PIL Image or ndarray. Got {}'.format(type(pic)))
TypeError: pic should be PIL Image or ndarray. Got <class 'torch.Tensor'>

The transformation block, that I added is:
data = voc_loader.VOCDetection('/home/khushi/Documents/deep-learning/datasets/pascal-voc/', 
            transform=transforms.Compose([
                transforms.ToTensor(),
                transforms.CenterCrop(224),
                transforms.ToTensor(),
                transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
            ])
        )

Is there any other mistake? Thanks again