Search code examples
pythontensorflowmachine-learningobject-detectiongoogle-colaboratory

data/mscoco_label_map.pbtxt; No such file or directory


Please Help me! Thanks in Advance i am creating a object detector using python in google colab .

please tell me what to do? Is there any module version error or a file directory missing ? if the directory is missing so tell me how can i add. Please help me as fast as you can. once again thank you so much .

When i run this code it gives this error

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


Solution

  • What have you defined as PATH_TO_LABELS?

    It should point to your pbtxt file (preferably the full path - i.e. starts with /content in a Colab.