Nemaly Praveen
Nemaly Praveen

Reputation: 77

why is dimension with matplotlib giving an error

enter image description here

<iframe src="https://jovian.ml/embed?url=https://jovian.ml/pravin-bnmit/cxr/v/1&cellId=15" title="Jovian Viewer" height="800" width="800" frameborder="0" scrolling="auto"></iframe>

def show_sample(img, target, invert=True):
if invert:
    plt.imshow(1 - img.permute((1, 2, 0)))
else:
    plt.imshow(img.permute(1, 2, 0))
print('Labels:', decode_target(target, text_labels=True))

Trying to display an image but got dimension error when the channel were also properly defined

Upvotes: 0

Views: 80

Answers (1)

ErikXIII
ErikXIII

Reputation: 557

I think the problem is that you have a 3D array you want to plot but you need 2D. Try to use np.reshape() to change you shape to 1024x1024

Upvotes: 1

Related Questions