Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
ec203153
Commit
ec203153
authored
Jun 20, 2019
by
Michael Kösel
Committed by
Francisco Massa
Jun 20, 2019
Browse files
Use joint transform in Cityscapes (#1024)
* Use joint transform in Cityscapes * Add transforms doc
parent
ae2cb6ec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
torchvision/datasets/cityscapes.py
torchvision/datasets/cityscapes.py
+6
-7
No files found.
torchvision/datasets/cityscapes.py
View file @
ec203153
...
...
@@ -21,6 +21,8 @@ class Cityscapes(VisionDataset):
and returns a transformed version. E.g, ``transforms.RandomCrop``
target_transform (callable, optional): A function/transform that takes in the
target and transforms it.
transforms (callable, optional): A function/transform that takes input sample and its target as entry
and returns a transformed version.
Examples:
...
...
@@ -95,8 +97,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'
...
...
@@ -163,11 +165,8 @@ class Cityscapes(VisionDataset):
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment