I am trying to build an object detection model with the help of tensorflow and having this error again and again. I tried that tf.io.Gfile also, but it is not helpful. I am using tensorflow 2.2.0 version and tensorflow-GPU 2.2.0 as well. Here is the code,
!python {SCRIPTS_PATH + '/generate_tfrecord.py'} -x {IMAGE_PATH + '/train'} -l {ANNOTATION_PATH + '/label_map.pbtxt'} -o {ANNOTATION_PATH + '/train.record'}
!python {SCRIPTS_PATH + '/generate_tfrecord.py'} -x{IMAGE_PATH + '/test'} -l {ANNOTATION_PATH + '/label_map.pbtxt'} -o {ANNOTATION_PATH + '/test.record'}
when I change the tf.gfile to tf.io.gfile, here comes the new error....
I tried and now facing this....
Traceback (most recent call last):
File "Tensorflow/scripts/generate_tfrecord.py", line 62, in
label_map_dict = label_map_util.get_label_map_dict(label_map)
File "C:\Users\91880\AppData\Roaming\Python\Python37\site-packages \object_detection\utils\label_map_util.py", line 164, in get_label_map_dict label_map = load_labelmap(label_map_path)
File "C:\Users\91880\AppData\Roaming\Python\Python37\site-packages\object_detection\utils\label_map_util.py", line 133, in load_labelmap label_map_string = fid.read()
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python\lib\io\file_io.py", line 122, in read self._preread_check()
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python\lib\io\file_io.py", line 84, in _preread_check compat.as_bytes(self.__name), 1024 * 512)
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python\util\compat.py", line 71, in as_bytes (bytes_or_text,))
TypeError: Expected binary or unicode string, got item {
name: "Namaste" id: 1 }
item { name: "Thanks" id: 2 }
item { name: "Yes" id: 3 }
item { name: "No" id: 4 }
item { name: "Good" id: 5 }