数据/mscoco_label_map.pbtxt;没有这样的文件或目录

请帮我!在此先感谢我正在使用 google colab 中的 python 创建一个对象检测器。


请告诉我该怎么办?是否有任何模块版本错误或缺少文件目录?如果目录丢失,请告诉我如何添加。请尽快帮助我。再次非常感谢你。


当我运行此代码时,它会出现此错误


label_map = label_map_util.load_labelmap(PATH_TO_LABELS)

categories = label_map_util.convert_label_map_to_categories(label_map, max_num_classes=NUM_CLASSES, use_display_name=True)

category_index = label_map_util.create_category_index(categories)```.



**This is the output**


WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/object_detection/utils/label_map_util.py:132: The name tf.gfile.GFile is deprecated. Please use tf.io.gfile.GFile instead.


---------------------------------------------------------------------------

NotFoundError                             Traceback (most recent call last)

<ipython-input-9-b47b5c1dba35> in <module>()

      1 import os

----> 2 label_map = label_map_util.load_labelmap(PATH_TO_LABELS)

      3 categories = label_map_util.convert_label_map_to_categories(label_map, max_num_classes=NUM_CLASSES, use_display_name=True)

      4 category_index = label_map_util.create_category_index(categories)


2 frames

/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/lib/io/file_io.py 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: data/mscoco_label_map.pbtxt; No such file or directory


白猪掌柜的
浏览 136回答 2
2回答

慕慕森

你定义PATH_TO_LABELS为什么?它应该指向您的pbtxt&nbsp;文件(最好是完整路径 - 即以/contentColab 开头。

幕布斯6054654

首先,单击左侧的文件按钮以找到数据集并确保您确实已下载它。colab 中的路径通常与我们使用的路径有些不同。因此,在找到数据集后,右键单击文件并获取在代码中使用的正确路径。如果即使这样导入也不起作用,那么您可能需要重新启动运行时,因为 colab 中通常会出现不可预见的故障。如果错误仍然存在,请将数据集上传到 Google Drive 并将其挂载到您的运行时。它解决了很多基于文件的问题......
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python