没有这样的文件或目录错误tensorflow自定义对象检测

时间:2018-02-04 16:07:18

标签: python tensorflow python-3.6

收到错误:

Traceback (most recent call last):
  File "generate_tfrecord.py", line 97, in <module>
    tf.app.run()
  File "C:\Python36\lib\site-packages\tensorflow\python\platform\app.py", line 124, in run
    _sys.exit(main(argv))
  File "generate_tfrecord.py", line 88, in main
    tf_example = create_tf_example(group, path)
  File "generate_tfrecord.py", line 43, in create_tf_example
    encoded_jpg = fid.read()
  File "C:\Python36\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 119, in read
    self._preread_check()
  File "C:\Python36\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 79, in _preread_check
    compat.as_bytes(self.__name), 1024 * 512, status)
  File "C:\Python36\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 473, in __exit__
    c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.NotFoundError: NewRandomAccessFile failed to Create/Open: D:\Custom-Object-Detection-master\images\1 : The system cannot find the file specified.
; No such file or directory

克隆此存储库:

https://github.com/bourdakos1/Custom-Object-Detection

所有这些文件运行得很好,但是当我使用labelimg和自己的图像创建我自己的数据集时,它不会工作,所有文件都在完全相同的位置,相同的名称等但不能让它工作,任何建议?

赢10,张量流1.5

1 个答案:

答案 0 :(得分:1)

如果有人遇到同样的问题,labelimg会以某种方式使xml成为:

<annotation>
  <folder>train</folder>
  <filename>1</filename>
  <path>1.jpg</path>
  <source>
    <database>Unknown</database>
  </source>
  <size>
    <width>106</width>
    <height>107</height>
    <depth>3</depth>
  </size>
  <segmented>0</segmented>
  <object>
    <name>bat</name>
    <pose>Unspecified</pose>
    <truncated>0</truncated>
    <difficult>0</difficult>
    <bndbox>
      <xmin>25</xmin>
      <ymin>30</ymin>
      <xmax>73</xmax>
      <ymax>82</ymax>
    </bndbox>
  </object>
</annotation>

其中文件名应为1.jpg而不是1,这解决了问题。 :)