Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 7169

how to solve tf.keras.utils.image_dataset_from_directory invalid continuation byte error?

$
0
0

I had a python venv on ubuntu 20.04 and there i was using tensorflow to train my model. There was a folder named Persona and it has 5 subfolders as classes. each subfolder contains image files and some file names are Arabic and Farsi. there were no problem There and everything was fine until i migrate all those files to another device which it's OS is windows11. After setting up my environment and everything when i tried to run my code i got this error:

return _pywrap_file_io.IsDirectory(compat.path_to_bytes(path))           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcc in position 49: invalid continuation byte

the error occurs on second line of following code which i import model data using Keras:

image_path = 'D:\\Desktop\\tfmm\\Personas\\'train_ds = tf.keras.utils.image_dataset_from_directory(    image_path,    labels="inferred",    label_mode="int",    class_names=None,    color_mode="rgb",    batch_size=32,    image_size=(256, 256),    shuffle=True,    seed=123,    validation_split=0.2,    subset='training',    interpolation="bilinear",    follow_links=False,    crop_to_aspect_ratio=False)

any help would be appreciated.

I searched on google and github to find the reason and the solution with no luck. i also found this question on stackoverflow with no acceptable answer error-importing-image-dataset-in-tensorflowI solved the problem by renaming all my image files to latin based encoding but this would be painfull when i need to keep original file names.


Viewing all articles
Browse latest Browse all 7169

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>