【发布时间】:2021-05-15 08:51:14
【问题描述】:
我正在 Google Colab 上运行我的代码,我已将我的文件上传到我的 Google 驱动器上。有关更多信息,我通过以下方式连接到我的 Google Drive:
from google.colab import drive
drive.mount('/content/gdrive')
我有一段代码可以显示任何时期的一些无花果。它很好地展示了无花果。我把它写成:
img_plt=imgs.cpu().numpy()
true_masks_plt=true_masks.detach().cpu().numpy()
masks_pred_plt=masks_pred.detach().cpu().numpy()
input=np.squeeze(np.moveaxis(img_plt,1,-1))
gt=np.squeeze(np.moveaxis(true_masks_plt,1,-1))
pd=np.squeeze(np.moveaxis(masks_pred_plt,1,-1))
_,figs=plt.subplots(1,3,figsize=[15,5])
figs[0].imshow(input[0])
figs[1].imshow(pd[0])
figs[2].imshow(gt[0])
figs[0].set_title(f'input image ')
figs[1].set_title(f'mask prediction')
figs[2].set_title(f'true mask')
plt.show()
现在,我想将这三张图片保存在我的谷歌驱动器上。我该怎么做?
【问题讨论】:
-
将它们存储为 3 个单独的文件 还是作为包含所有 3 个子图的 一个文件 是否重要?
-
@MikeXydas 无论我们将它们存储为单独的文件还是子图。
标签: python matplotlib