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

Add Comment
1 Answer(s)

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 1024×1024

Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.