SSD tensorflow:unicodedecodeerror: ' utf-8 ' codec can ' t decode byte 0xff in position 0:invalid start

Source: Internet
Author: User

When we run the SSD TensorFlow version, the following issues occur, and the command I run is:

dataset_dir=voc2012/
output_dir=tfrecords
python tf_convert_data.py \
    --dataset_name=pascalvoc \
    --dataset_dir=${dataset_dir} \
    --output_name=voc_2012_train \
    --output_dir=${output_dir}

Through Baidu is not found GitHub above the issues above the answer, I am here to solve the problem to write out, hoping to help you play SSD. The error message is:

 Converting image 1/5138traceback (most recent call last): File "tf_convert_data.py", line <module> TF. App.run () File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/platform/app.py", line and in run _sys.exit
  (Main (_sys.argv[:1] + Flags_passthrough)) File "tf_convert_data.py", line Si, in main pascalvoc_to_tfrecords.run (Flags.dataset_dir, Flags.output_dir, FLAGS.OUTP Ut_name) File "/home/xyxt/downloads/ssd-tensorflow/datasets/pascalvoc_to_tfrecords.py", line 218, in Run _ADD_TO_TFR Ecord (Dataset_dir, Img_name, Tfrecord_writer) File "/home/xyxt/downloads/ssd-tensorflow/datasets/pascalvoc_to_ tfrecords.py ", line 177, in _add_to_tfrecord _process_image (dataset_dir, name) File"/home/xyxt/downloads/ssd-tensor flow/datasets/pascalvoc_to_tfrecords.py ", line, _process_image image_data = tf.gfile.FastGFile (filename, ' R '). Re
    AD () File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/lib/io/file_io.py", line 126, in readPywrap_tensorflow. ReadFromStream (self._read_buf, length, status)) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/lib /io/file_io.py ", line, in _prepare_value return Compat.as_str_any (val) file"/usr/local/lib/python3.5/dist-packag es/tensorflow/python/util/compat.py ", line, As_str_any return As_str (value) File/usr/local/lib/python3.5/di st-packages/tensorflow/python/util/compat.py ", line A, in As_text return Bytes_or_text.decode (encoding) unicodedecod Eerror: ' Utf-8 ' codec can ' t decode byte 0xff in position 0:invalid start byte

The solution is:

pascalvoc_to_tfrecords.py
Image_data = tf.gfile.FastGFile (filename, ' r '). Read ()
Change into:
Image_data = tf.gfile.FastGFile (filename, ' RB '). Read ()
It's OK.


Reference Documents [1].can ' t create DataSet: ' Utf-8 ' codec can ' t decode byte 0xff in position 0:invalid start byte. https://github.com/balancap/SSD-Tensorflow/issues/108

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.