Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use joint transform in Cityscapes #1024

Merged
merged 2 commits into from
Jun 20, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions torchvision/datasets/cityscapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ class Cityscapes(VisionDataset):
]

def __init__(self, root, split='train', mode='fine', target_type='instance',
transform=None, target_transform=None):
super(Cityscapes, self).__init__(root)
transform=None, target_transform=None, transforms=None):
super(Cityscapes, self).__init__(root, transforms, transform, target_transform)
self.transform = transform
self.target_transform = target_transform
self.mode = 'gtFine' if mode == 'fine' else 'gtCoarse'
Expand Down Expand Up @@ -163,11 +163,8 @@ def __getitem__(self, index):

target = tuple(targets) if len(targets) > 1 else targets[0]

if self.transform:
image = self.transform(image)

if self.target_transform:
target = self.target_transform(target)
if self.transforms is not None:
image, target = self.transforms(image, target)

return image, target

Expand Down