Skip to content

TypeError: Expected binary or unicode string, got item #9799

@CPor99

Description

@CPor99

Hi, so I am currently following a tutorial whereby I am training a custom dataset using SSD. In order to complete my dataset, I had to run the command "python generate_tfrecord.py -x [PATH_TO_IMAGES_FOLDER]/train -l [PATH_TO_ANNOTATIONS_FOLDER]/label_map.pbtxt -o [PATH_TO_ANNOTATIONS_FOLDER]/train.record", now the issue is on the label_map where it is giving me the Type error mentioned in the title.

Link to tutorial:
https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html

This is how I am calling that command:
"python generate_tfrecord.py -x C:\Test\workspace\training_demo/images/train -l C:\Test\workspace\training_demo\annotations\label_map.pbtxt -o C:\Test\workspace\training_demo\annotations\train.record"

The error in the shell:
Traceback (most recent call last):
File "generate_tfrecord.py", line 62, in
label_map_dict = label_map_util.get_label_map_dict(label_map)
File "C:\Python\lib\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:\Python\lib\site-packages\object_detection\utils\label_map_util.py", line 133, in load_labelmap
label_map_string = fid.read()
File "C:\Python\lib\site-packages\tensorflow_core\python\lib\io\file_io.py", line 122, in read
self._preread_check()
File "C:\Python\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:\Python\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: "Dog"
id: 1
}
item {
name: "Cat"
id: 2
}
item {
name: "Mouse"
id: 3
}

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions