Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with Listing 12.30 Getting the CelebA data #218

Open
jkylearmstrong opened this issue Feb 13, 2023 · 1 comment
Open

Error with Listing 12.30 Getting the CelebA data #218

jkylearmstrong opened this issue Feb 13, 2023 · 1 comment

Comments

@jkylearmstrong
Copy link

!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.
@jkylearmstrong
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant