-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelper.py
31 lines (18 loc) · 892 Bytes
/
helper.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import matplotlib.pyplot as plt
import numpy as np
import torch
def show_image(image,mask,pred_image = None):
if pred_image == None:
f, (ax1, ax2) = plt.subplots(1, 2, figsize=(10,5))
ax1.set_title('IMAGE')
ax1.imshow(image.permute(1,2,0).squeeze(),cmap = 'gray')
ax2.set_title('GROUND TRUTH')
ax2.imshow(mask.permute(1,2,0).squeeze(),cmap = 'gray')
elif pred_image != None :
f, (ax1, ax2,ax3) = plt.subplots(1, 3, figsize=(10,5))
ax1.set_title('IMAGE')
ax1.imshow(image.permute(1,2,0).squeeze(),cmap = 'gray')
ax2.set_title('GROUND TRUTH')
ax2.imshow(mask.permute(1,2,0).squeeze(),cmap = 'gray')
ax3.set_title('MODEL OUTPUT')
ax3.imshow(pred_image.permute(1,2,0).squeeze(),cmap = 'gray')