-1

I want to build the dataset by reading the path of the jpg image under the folder.But when I use tf.data.Dataset.list_files, there is a unicode error.

image_dir=os.path.join('/images')
list_ds=tf.data.Dataset.list_files(image_dir+'/*')

the error:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd5 in position 40: invalid continuation byte

This is the error image: enter image description here

How should I solve this problem?

marcolz
  • 2,880
  • 2
  • 23
  • 28
ssfpython
  • 21
  • 1
  • 5
  • 1
    Possible duplicate of [UnicodeDecodeError: 'utf-8' codec can't decode byte](https://stackoverflow.com/questions/19699367/unicodedecodeerror-utf-8-codec-cant-decode-byte) – Olympiloutre Oct 03 '19 at 01:23
  • Yep, the error itself is explained multiple times here. Anyway, you must extract and provide a [mcve], your question is off-topic without it. As a new user, also take the [tour] and read [ask]. – Ulrich Eckhardt Oct 03 '19 at 07:42

1 Answers1

1

You have not mentioned tensorflow version, please update libraries. It is working on my system, not able to reproduce error with same code. Or create new environment and install tensorflow in that.

BabaYaga
  • 111
  • 4