【发布时间】:2019-05-20 02:50:19
【问题描述】:
在通过运行安装驱动器后,我正在使用 Google Colaboratory IPython 进行样式转换:
from google.colab import drive
drive.mount('/drive')
它已挂载,所以我尝试 cd 进入一个目录,显示 pwd 和 ls 但它没有显示正确的 pwd
!cd "/content/drive/My Drive/"
!pwd
!ls
但它不会 cd 到给定的目录,它只会 cd 到 'content/'
当我尝试在我的代码中使用“load_image() 函数访问一些图像时,如下所示
def load_image(img_path, max_size=400, Shape=None):
image = Image.open(img_path).convert('RGB')
if max(image.size) > max_size:
size = max_size
else:
size = max(image.size)
if shape is not None:
size = shape
in_transform = transforms.Compose([transforms.Resize(size),
transforms.ToTensor(),
transforms.Normalize((0.485, 0.456, 0.406),
(0.229, 0.224, 0.225))])
image = in_transform(image)[:3,:,:].unsqueeze(0)
return image
#load image content
content = load_image('content/drive/My Drive/uche.jpg')
style = load_image('content/drive/My Drive/uche.jpg')
但是当我尝试从目录加载图像时,这段代码会引发错误:
FileNotFoundError: [Errno 2] No such file or directory: 'content/drive/My Drive/uche.jpg'
【问题讨论】:
-
我想知道,当我从足够多的问题中删除“ML”标签时,网络是否最终会知道它是一个编程语言家族。 (唯一相关的标签似乎是“google-colaboratory”。不要发送垃圾标签。)
标签: conv-neural-network google-colaboratory style-transfer