From fe3f56552a629be4b07014b360d1fde7327fb7dd Mon Sep 17 00:00:00 2001 From: airbrain-org Date: Sun, 16 Feb 2020 20:32:20 -0800 Subject: [PATCH] Replaces glob() Function With os.walk() Implementation of the glob() function varies between python versions and is unable to reliably locate all of the .jpg data files in the celeb dataset. It has been replaced with the os.walk() function. --- 03_05_vae_faces_train.ipynb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/03_05_vae_faces_train.ipynb b/03_05_vae_faces_train.ipynb index a1a194b57f..fff84fe8e9 100644 --- a/03_05_vae_faces_train.ipynb +++ b/03_05_vae_faces_train.ipynb @@ -21,7 +21,6 @@ "outputs": [], "source": [ "import os\n", - "from glob import glob\n", "import numpy as np\n", "\n", "from models.VAE import VariationalAutoencoder\n", @@ -69,7 +68,12 @@ "INPUT_DIM = (128,128,3)\n", "BATCH_SIZE = 32\n", "\n", - "filenames = np.array(glob(os.path.join(DATA_FOLDER, '*/*.jpg')))\n", + "filenames = []\n", + "\n", + "for root, dirs, files in os.walk(DATA_FOLDER):\n", + " for file in files:\n", + " if file.endswith(\".jpg\"):\n", + " filenames.append(os.path.join(root, file))\n", "\n", "NUM_IMAGES = len(filenames)" ]