DmitryUlyanov / deep-image-prior

Image restoration with neural networks but without learning.
https://dmitryulyanov.github.io/deep_image_prior
Other
7.9k stars 1.43k forks source link

problem about "plot_image_grid" in project"sr_prior_effect" #49

Open biexiangduo opened 5 years ago

biexiangduo commented 5 years ago

plot_image_grid([imgs['HR_np'], result_no_prior, result_tv_prior, result_deep_prior], factor=8, nrow=2);

RuntimeError Traceback (most recent call last)

in () 2 result_no_prior, 3 result_tv_prior, ----> 4 result_deep_prior], factor=8, nrow=2); ~\Downloads\deep-image-prior\utils\common_utils.py in plot_image_grid(images_np, nrow, factor, interpolation) 74 images_np = [x if (x.shape[0] == n_channels) else np.concatenate([x, x, x], axis=0) for x in images_np] 75 ---> 76 grid = get_image_grid(images_np, nrow) 77 78 plt.figure(figsize=(len(images_np) + factor, 12 + factor)) ~\Downloads\deep-image-prior\utils\common_utils.py in get_image_grid(images_np, nrow) 56 '''Creates a grid from a list of images by concatenating them.''' 57 images_torch = [torch.from_numpy(x) for x in images_np] ---> 58 torch_grid = torchvision.utils.make_grid(images_torch, nrow) 59 60 return torch_grid.numpy() ~\Anaconda3\lib\site-packages\torchvision\utils.py in make_grid(tensor, nrow, padding, normalize, range, scale_each, pad_value) 33 # if list of tensors, convert to a 4D mini-batch Tensor 34 if isinstance(tensor, list): ---> 35 tensor = torch.stack(tensor, dim=0) 36 37 if tensor.dim() == 2: # single image H x W RuntimeError: Expected a Tensor of type torch.FloatTensor but found a type torch.DoubleTensor for sequence element 1 in sequence argument at position #1 'tensors' do you met similar problem? if you know?I would appreciate your help. Thanks a lot