This is the code:-
tfms = transforms.Compose([
    transforms.Resize(224),
    transforms.CenterCrop(224),
    transforms.ToTensor(),
    #transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
    ])
    object_img_tensor = tfms(PIL.Image.fromarray(object_image))
    context_img_tensor = tfms(PIL.Image.fromarray(context_image))
  
  

Type of image before tranform is applied :- <class ‘numpy.ndarray’>
Shape of the image before tranform is applied :- (480, 640, 3)
Type of image after tranform is applied :- <class ‘torch.Tensor’>
Shape of the image after tranform is applied :- torch.Size([3, 224, 224])