Hello everyone,
I run code of Tensorflow object detection but I had issue when run this part of code to load label map:
5, we know that this corresponds to airplane. Here we use internal utility functions, but anything that returns a dictionary mapping integers to appropriate string labels would be finelabel_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)
The following issue is:
NotFoundError Traceback (most recent call last)
1 # In[7]:
2
----> 3 label_map = label_map_util.load_labelmap(PATH_TO_LABELS)
4 categories = label_map_util.convert_label_map_to_categories(label_map, max_num_classes=NUM_CLASSES, use_display_name=True)
5 category_index = label_map_util.create_category_index(categories)
~\Anaconda3\envs\py36\lib\site-packages\object_detection\utils\label_map_util.py in load_labelmap(path)
115 """
116 with tf.gfile.GFile(path, 'r') as fid:
--> 117 label_map_string = fid.read()
118 label_map = string_int_label_map_pb2.StringIntLabelMap()
119 try:
~\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\lib\io\file_io.py in read(self, n)
117 string if in string (regular) mode.
118 """
--> 119 self._preread_check()
120 with errors.raise_exception_on_not_ok_status() as status:
121 if n == -1:
~\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\lib\io\file_io.py in _preread_check(self)
77 with errors.raise_exception_on_not_ok_status() as status:
78 self._read_buf = pywrap_tensorflow.CreateBufferedInputStream(
---> 79 compat.as_bytes(self.__name), 1024 * 512, status)
80
81 def _prewrite_check(self):
~\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\framework\errors_impl.py in __exit__(self, type_arg, value_arg, traceback_arg)
471 None, None,
472 compat.as_text(c_api.TF_Message(self.status.status)),
--> 473 c_api.TF_GetCode(self.status.status))
474 # Delete the underlying status object from memory otherwise it stays alive
475 # as there is a reference to status from this from the traceback due to
NotFoundError: NewRandomAccessFile failed to Create/Open: data\mscoco_label_map.pbtxt : The system cannot find the path specified.
; No such process
Can anyone help me, please?
This question is better asked on StackOverflow since it is not a bug or feature request. There is also a larger community that reads questions there. Thanks!
Was this ever asked on StackOverflow?
In my case, I was able to get over this by using an absolute path to the labels file instead of relative.
In my case, I was able to get over this by using an absolute path to the labels file instead of relative.
what do u mean by absolute path ??
It's been over a year since I posted this suggestion, so I no longer have access to the code that caused this issue. I can do my best to describe from my memory.
What I mean is instead of "./models" which says look in the model directory located here where the script is being executed, I use the entire path from the base directory of the computer, like what you would see at the top of windows file explorer, or what you see when you type PWD in a terminal. Something that would look like "C:\Users\melissa\Documents\master_repo\data\models\"
It's been over a year since I posted this suggestion, so I no longer have access to the code that caused this issue. I can do my best to describe from my memory.
What I mean is instead of "./models" which says look in the model directory located here where the script is being executed, I use the entire path from the base directory of the computer, like what you would see at the top of windows file explorer, or what you see when you type PWD in a terminal. Something that would look like "C:\Users\melissa\Documents\master_repo\data\models"
This works try it. Thank you so much.
It's been over a year since I posted this suggestion, so I no longer have access to the code that caused this issue. I can do my best to describe from my memory.
What I mean is instead of "./models" which says look in the model directory located here where the script is being executed, I use the entire path from the base directory of the computer, like what you would see at the top of windows file explorer, or what you see when you type PWD in a terminal. Something that would look like "C:\Users\melissa\Documents\master_repo\data\models"
Thanks, bro it worked but I am facing one more issue

It's been over a year since I posted this suggestion, so I no longer have access to the code that caused this issue. I can do my best to describe from my memory.
What I mean is instead of "./models" which says look in the model directory located here where the script is being executed, I use the entire path from the base directory of the computer, like what you would see at the top of windows file explorer, or what you see when you type PWD in a terminal. Something that would look like "C:\Users\melissa\Documents\master_repo\data\models"Thanks, bro it worked but I am facing one more issue
this error can be fixed by changing return value to 0 in generate_tfrecord.py script. In your script return value is set none.
Most helpful comment
In my case, I was able to get over this by using an absolute path to the labels file instead of relative.