image-processing - 在 Chainer 模型中仅提供图像
问题描述
我有一个仅包含图像的数据集,这些图像将在自动编码器中用于重新生成输入图像。我想使用链接器 ImageDataset 将数据输入迭代器。
data = test_tup = chainer.datasets.ImageDataset('/NewText.txt', '/train')
我已经给出了包含图像地址的文本文件的地址,并在根目录中给出了保存图像的文件夹的地址。
79 _check_pillow_availability()
80 if isinstance(paths, six.string_types):
---> 81 with open(paths) as paths_file:
82 paths = [path.strip() for path in paths_file]
83 self._paths = paths
FileNotFoundError: [Errno 2] No such file or directory: '/NewText.txt'
这是使用 ImageDataset 的正确方法吗?另外我想知道 ImageDataset 是否是仅输入图像的好选择,还是有其他选择。
解决方案
我猜路径可能与您的预期不同。print(paths)
可能有助于确定问题。
datasets.LabeledImageDataset() 可能会更好。有关导入的示例,请查看此处:https ://github.com/chainer/chainer/blob/v5.4.0/examples/imagenet/train_imagenet.py
希望有帮助,
推荐阅读
- laravel - Laravel API 资源中的多级关系
- sql - 从表名在当前查询中的表中查询
- java - Java - 从函数返回 BigDecimal?
- angular - 事件执行后如何在Angular 6中刷新jquery数据表
- ios - 在 Xcode 10 上运行通用框架的脚本
- jquery - 如何让 jQuery Quicksearch 以任何顺序接受搜索词?
- php - 为什么我的分页在 Wordpress 中不起作用?
- java - 为什么迭代只是迭代列表一次?
- windows - 如何在windows中启动ksql?
- sqlite - 无法使用 Spring data jpa 正确连接到 SQlitedb