The code is list below
import os
import torch
import numpy as np
from torch.autograd import Variable
from torch import nn
import torch.nn.functional as F
from torch.utils.data import Dataset,DataLoader
from PIL import Image
from torchvision import transforms as tfs
from datetime import datetime

import matplotlib.pyplot as plt
def random_crop(data,label,crop_size):
    h,w=crop_size
    data,rect=tfs.RandomCrop((h,w))(data)
    label =tfs.FixedCrop(*rect)(label)
    return data,label

im_show1=Image.open("/home/ypl/dataset/VOC/VOCdevkit/VOC2012/JPEGImages/2007_000032.jpg")
label_show1=Image.open("/home/ypl/dataset/VOC/VOCdevkit/VOC2012/SegmentationClass/2007_000032.png")

im_show2=Image.open("/home/ypl/dataset/VOC/VOCdevkit/VOC2012/JPEGImages/2007_000645.jpg")
label_show2=Image.open("/home/ypl/dataset/VOC/VOCdevkit/VOC2012/SegmentationClass/2007_000645.png")

_, figs = plt.subplots(2, 2, figsize=(10, 8))
crop_im1,crop_label1=random_crop(im_show1,label_show1,(200,300))
figs[0][0].imshow(crop_im1)
figs[0][0].axes.get_xaxis().set_visible(False)
figs[0][0].axes.get_yaxis().set_visible(False)
figs[0][1].imshow(crop_label1)
figs[0][1].axes.get_xaxis().set_visible(False)
figs[0][1].axes.get_yaxis().set_visible(False)

I got an error like this
Traceback (most recent call last):
  File "vis_pic.py", line 38, in <module>
    crop_im1,crop_label1=random_crop(im_show1,label_show1,(200,300))
  File "vis_pic.py", line 19, in random_crop
    data,rect=transform_train(data)
TypeError: 'Image' object is not iterable

I have no idea to do, can anybody help me? I just want to random crop the pic and show them