Skip to content

Commit

Permalink
Remove conditional squeeze
Browse files Browse the repository at this point in the history
  • Loading branch information
ashnair1 committed Nov 5, 2024
1 parent 11be80e commit 9c74986
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions torchgeo/datasets/inria.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,7 @@ def plot(
show_predictions = 'prediction' in sample

if show_mask:
mask = sample['mask']
if mask.ndim == 3 and mask.shape[0] == 1:
mask = mask.squeeze(0)
mask_arr = mask.numpy()
mask = sample['mask'].numpy()
ncols += 1

if show_predictions:
Expand All @@ -236,7 +233,7 @@ def plot(
axs[0].set_title('Image')

if show_mask:
axs[1].imshow(mask_arr, interpolation='none')
axs[1].imshow(mask, interpolation='none')
axs[1].axis('off')
if show_titles:
axs[1].set_title('Label')
Expand Down

0 comments on commit 9c74986

Please sign in to comment.