Flowers archive download - data_dir issue

Hi,

I am not sure if this is a me or keras.utils.get_file but in the tutorials at Load and preprocess images  |  TensorFlow Core the Path(archive).with_suffix('') is not where the images end up.

import pathlib
dataset_url = "https://storage.googleapis.com/download.tensorflow.org/example_images/flower_photos.tgz"
archive = tf.keras.utils.get_file(origin=dataset_url, extract=True)
data_dir = pathlib.Path(archive).with_suffix('')

In my env data_dir is “$home/.keras/datasets/flower_photos”

However the files are downloaded and extracted into “.keras/datasets/flower_photos.tgz”

ls ~/.keras/datasets/flower_photos.tgz/flower_photos/
LICENSE.txt daisy dandelion roses sunflowers tulips

So for the rest of the tutorials at Load and preprocess images  |  TensorFlow Core you have tweak the path.

Hope I’m not doing mistaken and doing something wrong.
Thanks,
Dermot

Hi @tomred, Thank you for reporting this issue. Will create a PR to fix this issue.

import pathlib
dataset_url = "https://storage.googleapis.com/download.tensorflow.org/example_images/flower_photos.tgz"
archive = tf.keras.utils.get_file(origin=dataset_url, extract=True)
data_dir = pathlib.Path(archive).joinpath('flower_photos')

You can use this code so you don’t need to change the path anywhere in the code. Thank You.

1 Like