tensorflow / models

Models and examples built with TensorFlow
Other
76.97k stars 45.79k forks source link

'utf-8' codec can't decode byte 0xbe in position 55: invalid start byte #9245

Open crawfordxx opened 4 years ago

crawfordxx commented 4 years ago

I have already tried to add "rb" when I read the file, it still return this error

(tensorflow1) D:\tensorflow1\models\research\object_detection\legacy>(python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ ssd_mobilenet_v1_pe ts.config) 2020-09-15 01:24:22.297601: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not f ound 2020-09-15 01:24:22.302333: 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. WARNING:tensorflow:From D:\Anaconda3\envs\tensorflow1\lib\site-packages\absl\app.py:251: main (from main) is deprecated and will be removed in a future version. Instructions for updating: Use object_detection/model_main.py. W0915 01:24:24.713263 20620 deprecation.py:323] From D:\Anaconda3\envs\tensorflow1\lib\site-packages\absl\app.py:251: main (from main) is deprecated and will be removed i n a future version. Instructions for updating: Use object_detection/model_main.py. Traceback (most recent call last): File "train.py", line 186, in tf.app.run() File "D:\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\platform\app.py", line 40, in run _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef) File "D:\Anaconda3\envs\tensorflow1\lib\site-packages\absl\app.py", line 300, in run _run_main(main, args) File "D:\Anaconda3\envs\tensorflow1\lib\site-packages\absl\app.py", line 251, in _run_main sys.exit(main(argv)) File "D:\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\util\deprecation.py", line 324, in new_func return func(*args, *kwargs) File "train.py", line 95, in main FLAGS.pipeline_config_path) File "D:\tensorflow1\models\research\object_detection\utils\config_util.py", line 138, in get_configs_from_pipeline_file proto_str = f.read() File "D:\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 116, in read self._preread_check() File "D:\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 79, in _preread_check self.__name, 1024 512) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbe in position 55: invalid start byte

saikumarchalla commented 4 years ago

@crawfordxx Provide the exact sequence of commands / steps that you executed before running into the problem. Also, Please fill the issue template as it helps us to analyze the issue faster.Thanks!

crawfordxx commented 4 years ago

sorry for any inconvenience, I'm trying to execute train.py. the Unicode of this config file might be wrong. _python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ ssd_mobilenet_v1pets.config

Maioy97 commented 3 years ago

I've also run into the same problem using model_main.py and tensorflow 1.15 the error is : UnicodeEncodeError: 'latin-1' codec can't encode character '\u0635' in position 0: ordinal not in range(256) my dataset labels and .pbtext does have Arabic letters in them and the character code is for the letter ص the error appears after it trains for about 800 steps when it tries to reload the newly saved checkpoint (but it doesn't give this error if loads it in a new training session)

I'm trying to train a mobilenet-ssd v2 using this command

PIPELINE_CONFIG_PATH="/home/mai/ssd_mobilenet_v2_coco_custom.config"
MODEL_DIR="/home/mai/ssd_ckpt/tf1_fine_tuning_vehicle/6.25k_steps_frz_var/train"
python ./object_detection/model_main.py \
    --pipeline_config_path=${PIPELINE_CONFIG_PATH}  \
    --model_dir=${MODEL_DIR} \
    --sample_1_of_n_eval_examples=1 \
    --trainable_scopes=_box_predictor/_prediction_heads/class_predictions_with_background \
    --alsologtoderr

The character that causes the error only changes if you shuffle the evaluation data, I tried using the eval data for training to see if something's wrong with the tfrecord but it's not the case (trains fine till it saves a checkpoint and loads it for evaluation even when it trains on the evaluation data)