summaryrefslogtreecommitdiff
path: root/util/util.py
diff options
context:
space:
mode:
authorjunyanz <junyanz@berkeley.edu>2017-10-06 10:46:43 -0700
committerjunyanz <junyanz@berkeley.edu>2017-10-06 10:46:43 -0700
commit7800d516596f1a25986b458cddf8b8785bcc7df8 (patch)
tree56d57350e7104393f939ec7cc2e07c96840aaa27 /util/util.py
parente986144cee13a921fd3ad68d564f820e8f7dd3b0 (diff)
support nc=1, add new leaerning rate policy and new initialization
Diffstat (limited to 'util/util.py')
-rw-r--r--util/util.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/util/util.py b/util/util.py
index 781239f..4de0a74 100644
--- a/util/util.py
+++ b/util/util.py
@@ -11,6 +11,8 @@ import collections
# |imtype|: the desired type of the converted numpy array
def tensor2im(image_tensor, imtype=np.uint8):
image_numpy = image_tensor[0].cpu().float().numpy()
+ if image_numpy.shape[0] == 1:
+ image_numpy = np.tile(image_numpy, (3, 1, 1))
image_numpy = (np.transpose(image_numpy, (1, 2, 0)) + 1) / 2.0 * 255.0
return image_numpy.astype(imtype)