我正在尝试按照本教程将自定义数据集转换为 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 图像相同。分割蒙版也具有相同的颜色图,我提前在它们上使用了删除颜色图脚本。