将数据集转换为 DeepLab v3+ 的 tfrecord 时出错



按照本教程,我正在尝试将自定义数据集转换为 DeepLab v3+ 的 tfrecord。我的目录设置如下:

+ datasets
+ pascal_voc_seg/custom_dataset
+ VOCdevkit
+ VOC2012
+ JPEGImages
+ SegmentationClassRaw
+ ImageSets
+Segmentation
+ tfrecord

我还下载了Pascal VOC数据集,两个目录结构现在相同。当我在 PascalVOC 数据集上运行 build_voc2012_data.py 脚本时,如下所示:

#from models/research/deeplab/dataset/pascal_voc_seg
python build_voc2012_data.py 
--image_folder="./VOCdevkit/VOC2012/JPEGImages" 
--semantic_segmentation_folder="./VOCdevkit/VOC2012/SegmentationClassRaw" 
--list_folder="./VOCdevkit/VOC2012/ImageSets/Segmentation" 
--image_format="jpg" 
--output_dir="./tfrecord"

。一切正常,数据集转换为带有进度条的 tfRecord 文件。但是,当我从自定义数据集目录运行相同的脚本时,会发生以下错误:

>> Converting image 1/164 shard 0Traceback (most recent call last):
File "build_voc2012_data.py", line 146, in <module>
tf.compat.v1.app.run()
File "/home/delanyn/.local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "/home/delanyn/.local/lib/python2.7/site-packages/absl/app.py", line 299, in run
_run_main(main, args)
File "/home/delanyn/.local/lib/python2.7/site-packages/absl/app.py", line 250, in _run_main
sys.exit(main(argv))
File "build_voc2012_data.py", line 142, in main
_convert_dataset(dataset_split)
File "build_voc2012_data.py", line 121, in _convert_dataset
image_data = tf.io.gfile.GFile(image_filename, 'rb').read()
File "/home/delanyn/.local/lib/python2.7/site-packages/tensorflow/python/lib/io/file_io.py", line 122, in read
self._preread_check()
File "/home/delanyn/.local/lib/python2.7/site-packages/tensorflow/python/lib/io/file_io.py", line 84, in _preread_check
compat.as_bytes(self.__name), 1024 * 512)
.jpg; No such file or directoryors_impl.NotFoundError: ./VOCdevkit/VOC2012/JPEGImages/2020_0

我在这里可能缺少什么?我的图像是JPEG,与Pascal VOC图像具有相同的尺寸。分割蒙版也具有相同的颜色图,我事先在它们上使用删除颜色图脚本。

根据错误消息,我只能说文件夹中的 train.txt 或 val.txt 文件中的条目:pascal_voc_dataset/VOCdevkit/VOC2012/ImageSets/Segmentation 与 JPEG 文件夹中的任何内容(图像(不匹配:pascal_voc_dataset/VOCdevkit/VOC2012/JPEGImages。

相关内容

  • 没有找到相关文章

最新更新