fchollet/deep-learning-with-python-notebooks

Error with Listing 12.30 Getting the CelebA data

jkylearmstrong opened this issue · 1 comments

!mkdir celeba_gan
!gdown --id 1O7m1010EJjLE5QxLZiM9Fpjs7Oj6e684 -O celeba_gan/data.zip
!unzip -qq celeba_gan/data.zip -d celeba_gan
/usr/local/lib/python3.8/dist-packages/gdown/cli.py:127: FutureWarning: Option `--id` was deprecated in version 4.3.1 and will be removed in 5.0. You don't need to pass it anymore to use a file ID.
  warnings.warn(
Access denied with the following error:

 	Cannot retrieve the public link of the file. You may need to change
	the permission to 'Anyone with the link', or have had many accesses. 

You may still be able to access the file from the browser:

	 https://drive.google.com/uc?id=1O7m1010EJjLE5QxLZiM9Fpjs7Oj6e684 

unzip:  cannot find or open celeba_gan/data.zip, celeba_gan/data.zip.zip or celeba_gan/data.zip.ZIP.

The data is on already available on Kaggle. The fix is pretty much in line with the other Kaggle examples in the book https://www.kaggle.com/datasets/jessicali9530/celeba-dataset

from tensorflow import keras
from tensorflow.keras import layers
from tensorflow import keras
from tensorflow.keras import layers
from google.colab import files
files.upload()
!pip install -U -q kaggle
!mkdir ~/.kaggle # make directory 
!cp kaggle.json ~/.kaggle/ # copy the file
!chmod 600 ~/.kaggle/kaggle.json # change permissions on API key file make it only readable to yourself
!kaggle datasets download jessicali9530/celeba-dataset
!unzip -qq celeba-dataset.zip
import os
 
# Get the list of all files and directories
path = "img_align_celeba/img_align_celeba"
dir_list = os.listdir(path)
 
print("Files and directories in '", path, "' :")
 
# prints all files
print(dir_list)
from tensorflow import keras
dataset = keras.utils.image_dataset_from_directory(
    "img_align_celeba/img_align_celeba",
    label_mode=None,
    image_size=(64, 64),
    batch_size=32,
    smart_resize=True)

The rest of the code appears to work as expected. However, there is a warning for this block:

dataset = dataset.map(lambda x: x / 255.)
WARNING:tensorflow:From /usr/local/lib/python3.8/dist-packages/tensorflow/python/autograph/pyct/static_analysis/liveness.py:83: Analyzer.lamba_check (from tensorflow.python.autograph.pyct.static_analysis.liveness) is deprecated and will be removed after 2023-09-23.
Instructions for updating:
Lambda fuctions will be no more assumed to be used in the statement where they are used, or at least in the same block. https://github.com/tensorflow/tensorflow/issues/56089