赞
踩
出现这个问题,是因为在传参的过程中将位置参数放到了不合适的问题。具体为什么是这个原因,可能与Python读取参数的顺序有关
具体在运行改写deep-image-prior网络时的代码 。
刚开始调用时采用下面的代码出现这个错误
// A code block
#调用
self.plot_image_save([outputs], factor=5,fake_image_path)
接着更改为下面的调用方式不再进行报错
// A code block
#调用
self.plot_image_save([outputs], fake_image_path,factor=5)
// An highlighted block def plot_image_save(self,images_np,factor=1): nrow = 8 interpolation = 'lanczos' n_channels = max(x.shape[0] for x in images_np) assert (n_channels == 3) or (n_channels == 1), images_np = [x if (x.shape[0] == n_channels) else np.concatenate([x, x, x], axis=0) for x in images_np] grid = get_image_grid(images_np, nrow) plt.figure(figsize=(len(images_np) + factor, 12 + factor)) if images_np[0].shape[0] == 1: plt.imshow(grid[0], cmap='gray', interpolation=interpolation) else: plt.imshow(grid.transpose(1, 2, 0), interpolation=interpolation) plt.rcParams['savefig.dpi'] = 256 # 图片像素 plt.rcParams['figure.dpi'] = 256 # 分辨率 plt.axis('off') plt.savefig(pathxxx, bbox_inches='tight', dpi=256, pad_inches=0.0) return grid
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。