Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Commit

Permalink
Add error message if padding fails for missing void class
Browse files Browse the repository at this point in the history
  • Loading branch information
fvisin committed Jan 15, 2018
1 parent 26653ae commit be8b093
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion dataset_loaders/data_augmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,12 @@ def random_transform(x, y=None,
(pad[0]//2, pad[0] - pad[0]//2),
(pad[1]//2, pad[1] - pad[1]//2))
x = np.pad(x, pad_pattern, 'constant')
y = np.pad(y, pad_pattern, 'constant', constant_values=void_label)
try:
y = np.pad(y, pad_pattern, 'constant',
constant_values=void_label)
except ValueError as e:
raise type(e)(e.message + '\nCannot pad the image: the '
'dataset has no void class')

x = x.transpose(inv_pattern)
if y is not None and len(y) > 0:
Expand Down

0 comments on commit be8b093

Please sign in to comment.