|
239 | 239 | "source": [ |
240 | 240 | "# make sure utils.py is in the same directory as this code\n", |
241 | 241 | "from utils import load_data\n", |
| 242 | + "import glob\n", |
| 243 | + "\n", |
242 | 244 | "\n", |
243 | 245 | "# note we also shrink the intensity values (X) from 0-255 to 0-1. This helps the model converge faster.\n", |
244 | | - "X_train = load_data(os.path.join(data_folder, \"train-images-idx3-ubyte.gz\"), False) / 255.0\n", |
245 | | - "X_test = load_data(os.path.join(data_folder, \"t10k-images-idx3-ubyte.gz\"), False) / 255.0\n", |
246 | | - "y_train = load_data(os.path.join(data_folder, \"train-labels-idx1-ubyte.gz\"), True).reshape(-1)\n", |
247 | | - "y_test = load_data(os.path.join(data_folder, \"t10k-labels-idx1-ubyte.gz\"), True).reshape(-1)\n", |
| 246 | + "X_train = load_data(glob.glob(os.path.join(data_folder,\"**/train-images-idx3-ubyte.gz\"), recursive=True)[0], False) / 255.0\n", |
| 247 | + "X_test = load_data(glob.glob(os.path.join(data_folder,\"**/t10k-images-idx3-ubyte.gz\"), recursive=True)[0], False) / 255.0\n", |
| 248 | + "y_train = load_data(glob.glob(os.path.join(data_folder,\"**/train-labels-idx1-ubyte.gz\"), recursive=True)[0], True).reshape(-1)\n", |
| 249 | + "y_test = load_data(glob.glob(os.path.join(data_folder,\"**/t10k-labels-idx1-ubyte.gz\"), recursive=True)[0], True).reshape(-1)\n", |
| 250 | + "\n", |
248 | 251 | "\n", |
249 | 252 | "# now let's show some randomly chosen images from the traininng set.\n", |
250 | 253 | "count = 0\n", |
|
0 commit comments