I used the torchvision.datasets.Cityscapes to load the model.

model = Net()
model = model.to(device)
train_transform = transforms.Compose([
#transforms.RandomResizedCrop(size=224, scale=(0.9,1.0), ratio=(0.9,1.1)),
#transforms.Resize(256),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
transforms.Normalize([0.5, 0.5, 0.5], [0.5, 0.5, 0.5])
])
test_transform = transforms.Compose([
#transforms.Resize(256),
#transforms.CenterCrop(224),
transforms.ToTensor(),
transforms.Normalize([0.5, 0.5, 0.5], [0.5, 0.5, 0.5])
])
train_dataset = torchvision.datasets.Cityscapes(root = “./Cityscapes”, split=“train”, transform=train_transform)
num_train = len(train_dataset)
val_dataset = torchvision.datasets.Cityscapes(root = “./Cityscapes”, split=“val”, transform=train_transform)
num_val = len(val_dataset)
print(“Number of training images: %d” % len(train_dataset))
print(“Number of validation images: %d” % len(val_dataset))
    batch_size = 3

    train_loader = torch.utils.data.DataLoader(train_dataset, batch_size=batch_size, shuffle=True, num_workers=1)
    val_loader = torch.utils.data.DataLoader(val_dataset, batch_size=batch_size, shuffle=True, num_workers=1)
    test_dataset = torchvision.datasets.Cityscapes(root = "./Cityscapes", split="test", transform=test_transform)
    test_loader = torch.utils.data.DataLoader(test_dataset, batch_size=batch_size, shuffle=True, num_workers=1)
    print("Number of test images: %d" % len(test_dataset))
    torch.save(train_loader,'train_loader')
    torch.save(val_loader,'val_loader')
    torch.save(test_loader,'test_loader')
    train_model(model, test_loader, val_loader, epochs=3)