Ryotaro Harada
Ryotaro Harada

Reputation: 39

How to resolve UnicodeError in Tensorflow 2 Object Detection API

I have a question, but when I was training the tensorflow-object-detection-API, I got the following error. Can you tell me if there is any workaround?

Conducted commnand

python model_main_tf2.py --model_dir=models/my_ssd_mobilenet_v1_fpn_640x640_coco17_tpu-8 --pipeline_config_path=models/my_ssd_mobilenet_v1_fpn_640x640_coco17_tpu-8/pipeline.config

erroer messege

  File "model_main_tf2.py", line 115, in <module>
    tf.compat.v1.app.run()
  File "C:\Users\rh731\.virtualenvs\Tensorflow\lib\site-packages\tensorflow\python\platform\app.py", line 40, in ru
n
    _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
  File "C:\Users\rh731\.virtualenvs\Tensorflow\lib\site-packages\absl\app.py", line 303, in run
    _run_main(main, args)
  File "C:\Users\rh731\.virtualenvs\Tensorflow\lib\site-packages\absl\app.py", line 251, in _run_main
    sys.exit(main(argv))
  File "model_main_tf2.py", line 106, in main
    model_lib_v2.train_loop(
  File "C:\Users\rh731\.virtualenvs\Tensorflow\lib\site-packages\object_detection\model_lib_v2.py", line 611, in tr
ain_loop
    manager = tf.compat.v2.train.CheckpointManager(
  File "C:\Users\rh731\.virtualenvs\Tensorflow\lib\site-packages\tensorflow\python\training\checkpoint_management.p
y", line 640, in __init__
    recovered_state = get_checkpoint_state(directory)
  File "C:\Users\rh731\.virtualenvs\Tensorflow\lib\site-packages\tensorflow\python\training\checkpoint_management.p
y", line 278, in get_checkpoint_state
    file_content = file_io.read_file_to_string(
  File "C:\Users\rh731\.virtualenvs\Tensorflow\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 352, in
 read_file_to_string
    return f.read()
  File "C:\Users\rh731\.virtualenvs\Tensorflow\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 117, in
 read
    self._preread_check()
  File "C:\Users\rh731\.virtualenvs\Tensorflow\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 79, in
_preread_check
    self._read_buf = _pywrap_file_io.BufferedInputStream(
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x83 in position 108: invalid start byte

tensorflow_check What I did -I tried to convert the character code of pipeline.config. -The API was tested. (It's OK like the attached image.) -Check if there are any mistakes in the execution command.

Also, when learning on another network, I was able to finish learning to the end without such an error. This time as well, I downloaded and ran the trained model.

Reference site: ·tutorial https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html#training-the-model ・ List of trained models https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf2_detection_zoo.md

We apologize for the inconvenience, but thank you for your cooperation.

Upvotes: 1

Views: 285

Answers (1)

Deep
Deep

Reputation: 306

Most Probably it's because you are trying to run a TPU model on your local machine(I guessed that from you PyCharm ScreenShot). Try running a GPU based model or a CPU one.

Upvotes: 1

Related Questions