python-3.x - 枕头没有从本地系统加载图像 - 没有这样的文件或目录:'home/hp/DeepLearning/images/picasso.jpg'
问题描述
imsize = 512 if torch.cuda.is_available() else 128
loader = transforms.Compose([transforms.Resize(imsize),transforms.ToTensor()])
def image_loader(image_name):
image = Image.open(image_name)
image = loader(image).unsqueeze(0)
return image.to(device, torch.float)
style_img = image_loader("home/hp/DeepLearning/images/picasso.jpg")
content_img = image_loader("home/hp/DeepLearning/images/picasso.jpg")
assert style_img.size() == content_img.size(),\"we need to import style and content images of the same size"
当我尝试从本地系统加载图像时,它显示错误。我努力了os.path.abspath()
解决方案
推荐阅读
- c - 在 C 中连接字符串的未定义行为
- reactjs - 如何在 React 中设置 Ant DatePicker 的值(使用 react-moment)?
- python-3.x - 如何继续使用 cmd 并使用 sublime 文本创建的 django 项目?
- android - 在 Android 中 React Native 监听应用程序前台或后台切换
- rust - 条件编译简写
- reactjs - 忘记密码不适用于 .NET Core 3.x 和 React 脚手架
- php - GAPI.LOL API 在打开游戏时抛出未知错误
- json - 我有两个 Json 对象。通过使用 Scala 我如何合并这两者?
- django - Reactify Django 或分离的前端和后端
- php - 页脚受到引导程序 c;ass 的影响