Reference: [object\_detection\_tutorial.ipynb](https://github.com/tensorflow/models/blob/master/object_detection/object_detection_tutorial.ipynb)

NOTE : I have successfully installed everything according to installation instructions [Installation](https://github.com/tensorflow/models/blob/master/object_detection/g3doc/installation.md) and researched regarding this on github but had no luck.

Label maps map indices to category names, so that when our convolution network predicts 5, we know that this corresponds to airplane.

```
label_map = label_map_util.load_labelmap(PATH_TO_LABELS)

```

This raises a error as 

```
TypeError: a bytes-like object is required, not 'str'

```

After drilling down in this function **label\_map\_util.load\_labelmap**, below is the used function (load\_labelmap)

```
from google.protobuf import text_format
from object_detection.protos import string_int_label_map_pb2

with tf.gfile.GFile(PATH_TO_LABELS, 'rb') as fid:
    label_map_string = fid.read()
    label_map = string_int_label_map_pb2.StringIntLabelMap()
    print(type(label_map_string))
    print(type(label_map))
    try:
      text_format.Merge(label_map_string, label_map)
    except text_format.ParseError:
      label_map.ParseFromString(label_map_string)

```

I tried to see the error which is same. But label\_map\_string is already a Bytes object as you can see in the output. Tried 'r' mode also while reading.

OUTPUT
======

```
<class 'bytes'>
<class 'object_detection.protos.string_int_label_map_pb2.StringIntLabelMap'>
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-25-3fce64fd5c00> in <module>()
      5     print(type(label_map))
      6     try:
----> 7       text_format.Merge(label_map_string, label_map)
      8     except text_format.ParseError:
      9       label_map.ParseFromString(label_map_string)

C:\Users\GUS9KOR\AppData\Local\Continuum\Anaconda3\envs\dlnd\lib\site-packages\protobuf-3.3.0-py3.5.egg\google\protobuf\text_format.py in Merge(text, message, allow_unknown_extension, allow_field_number, descriptor_pool)
    475   """
    476   return MergeLines(
--> 477       text.split('\n'),
    478       message,
    479       allow_unknown_extension,

TypeError: a bytes-like object is required, not 'str'

```

Thanks in advance.