Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 谷歌colab没有这样的文件或目录_Python_Duplicates_Google Colaboratory - Fatal编程技术网

Python 谷歌colab没有这样的文件或目录

Python 谷歌colab没有这样的文件或目录,python,duplicates,google-colaboratory,Python,Duplicates,Google Colaboratory,但是图像是存在的,可以在桌面上手动打开,提前谢谢 这是触发错误的代码: error: in _preread_check(self) 82 "File isn't open for reading") 83 self._read_buf = pywrap_tensorflow.CreateBufferedInputStream( ---> 84

但是图像是存在的,可以在桌面上手动打开,提前谢谢

这是触发错误的代码:

error:
in _preread_check(self)
     82                                            "File isn't open for reading")
     83       self._read_buf = pywrap_tensorflow.CreateBufferedInputStream(
---> 84           compat.as_bytes(self.__name), 1024 * 512)
     85 
     86   def _prewrite_check(self):

NotFoundError: /gdrive/My Drive/object_detection/data/images/11.jpg.jpg; No such file or directory
我看到您正在尝试获取11.jpg.jpg,将其更正为正确的扩展可能会有所帮助


您可能希望使用python打印文件夹中的文件,以查看文件路径的打印方式,并对照您如何调用它们进行检查。

这是因为在创建测试和训练标签csv时,“filename”列将额外的.jpg添加到文件名中。检查图像文件名,文件名中可能已包含.jpg

在函数xml_to_csv()中,作者的代码是

'''

'''


从文件扩展名中删除.jpg。这将解决问题

您可以显示打开/尝试读取图像的代码吗?def create_tfu示例(group,path):22带有tf.io.gfile.gfile(os.path.join(path,{}.format(group.filename)),'r+')作为fid:-->23编码的_jpg=fid.read()24编码的_jpg_io=io.BytesIO(编码的_jpg)25 image=image.open(encoded_jpg_io)/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/lib/io/file_io.py在读取(self,n)模式下为120字符串。121“-->122 self.\u preread\u check()123如果n==-1:124 length=self.size()-self.tell()在这一节中,第6节-genrating trf record用代码编辑您的原始帖子,不要将其放在评论中。评论中几乎没有格式扫描,请立即检查
data_base_url = '/gdrive/My Drive/object_detection/data/'

#location of images
image_dir = data_base_url +'images/'

def split(df, group):
  data = namedtuple('data', ['filename', 'object'])
  gb = df.groupby(group)
  return [data(filename, gb.get_group(x)) for filename, x in zip(gb.groups.keys(), gb.groups)]

def create_tf_example(group, path):
    with tf.io.gfile.GFile(os.path.join(path, '{}'.format(group.filename)), 'r+') as fid:
      encoded_jpg = fid.read()
    encoded_jpg_io = io.BytesIO(encoded_jpg)
NotFoundError: /gdrive/My Drive/object_detection/data/images/11.jpg.jpg; No such file or directory
value = (root.find('filename').text + '.jpg',
               int(root.find('size')[0].text),
               int(root.find('size')[1].text),
               member[0].text,...