Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
- cityscapes transforms are in a try-except clause to better diagnose…
Browse files Browse the repository at this point in the history
… a shape mismatch which appears to happen only sporadically
  • Loading branch information
nasimrahaman committed Sep 13, 2017
1 parent 91e5aa9 commit 8110f95
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions inferno/io/box/cityscapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,18 @@ def __getitem__(self, index):
pi, pl = self.image_paths[index]
image = extract_image(self.image_root, pi)
label = extract_image(self.label_root, pl)
# Apply transforms
if self.image_transform is not None:
image = self.image_transform(image)
if self.label_transform is not None:
label = self.label_transform(label)
if self.joint_transform is not None:
image, label = self.joint_transform(image, label)
try:
# Apply transforms
if self.image_transform is not None:
image = self.image_transform(image)
if self.label_transform is not None:
label = self.label_transform(label)
if self.joint_transform is not None:
image, label = self.joint_transform(image, label)
except Exception:
print("[!] An Exception occurred while applying the transforms at "
"index {} of split '{}'.".format(index, self.split))
raise
return image, label

def __len__(self):
Expand Down

0 comments on commit 8110f95

Please sign in to comment.