0

I am having some issues as I am trying to use Tensorflow's Object Detection API for an object detection model I try to set up. I keep having a Unicode error that seems to be similar whether I use the train.py or model_main_tf2.py files but can't seem to proprely locate that error. Here is the code I used and the error. My system runs on Windows 10. Thanks in advance for your answers and/or tips.

The command:

!python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/EffDetD0.config

The error:

2021-11-26 15:24:15.527841: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2021-11-26 15:24:19.597360: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2021-11-26 15:24:19.597749: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cublas64_11.dll'; dlerror: cublas64_11.dll not found
2021-11-26 15:24:19.598123: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cublasLt64_11.dll'; dlerror: cublasLt64_11.dll not found
2021-11-26 15:24:19.601296: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cusolver64_11.dll'; dlerror: cusolver64_11.dll not found
2021-11-26 15:24:19.601686: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cusparse64_11.dll'; dlerror: cusparse64_11.dll not found
2021-11-26 15:24:19.602067: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudnn64_8.dll'; dlerror: cudnn64_8.dll not found
2021-11-26 15:24:19.602079: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1850] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
2021-11-26 15:24:19.602460: I tensorflow/core/platform/cpu_feature_guard.cc:151] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
WARNING:tensorflow:There are non-GPU devices in `tf.distribute.Strategy`, not using nccl allreduce.
W1126 15:24:19.602859  6764 cross_device_ops.py:1387] There are non-GPU devices in `tf.distribute.Strategy`, not using nccl allreduce.
INFO:tensorflow:Using MirroredStrategy with devices ('/job:localhost/replica:0/task:0/device:CPU:0',)
I1126 15:24:19.607062  6764 mirrored_strategy.py:376] Using MirroredStrategy with devices ('/job:localhost/replica:0/task:0/device:CPU:0',)
Traceback (most recent call last):
  File "model_main_tf2.py", line 115, in <module>
    tf.compat.v1.app.run()
  File "C:\Users\ishma\anaconda3\lib\site-packages\tensorflow\python\platform\app.py", line 40, in run
    _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
  File "C:\Users\ishma\anaconda3\lib\site-packages\absl\app.py", line 312, in run
    _run_main(main, args)
  File "C:\Users\ishma\anaconda3\lib\site-packages\absl\app.py", line 258, in _run_main
    sys.exit(main(argv))
  File "model_main_tf2.py", line 112, in main
    record_summaries=FLAGS.record_summaries)
  File "C:\Users\ishma\anaconda3\lib\site-packages\object_detection\model_lib_v2.py", line 499, in train_loop
    pipeline_config_path, config_override=config_override)
  File "C:\Users\ishma\anaconda3\lib\site-packages\object_detection\utils\config_util.py", line 138, in get_configs_from_pipeline_file
    proto_str = f.read()
  File "C:\Users\ishma\anaconda3\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 118, in read
    self._preread_check()
  File "C:\Users\ishma\anaconda3\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 81, in _preread_check
    compat.path_to_str(self.__name), 1024 * 512)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 81: invalid start byte```
2
  • There may be something wrong with your config file. Commented Nov 26, 2021 at 15:08
  • Hi Aniket, The only changes I made in the config file are the paths, for example: input_path: "ModelGarden/InputDataRing/TFRecordTrain/traintfrecord/train.tfrecord" Commented Nov 26, 2021 at 15:39

1 Answer 1

1

first answer

Try to add these lines to model_main_tf2.py to inspect the inputs are correctly inserted into the script.

...
## add the three prints to inspect the inputs fo the script
    with strategy.scope():
      print('🔴', FLAGS.pipeline_config_path)
      print('🔴', FLAGS.model_dir)
      print('\n\n\n')
...

I had the same issue and after adding these lines to the code, I found out that the script was getting None for pipeline.config file. So after some investigation it was my fault giving having a misspelled word in the script command.

second answer

From what I can see in your error, maybe your file pipeline.config is not saved in utf-8 format. Try to change it into utf-8 format.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.