Created
March 3, 2021 16:07
-
-
Save mlelarge/60ddefa9e16bc06f7f4fc7bff769bdb1 to your computer and use it in GitHub Desktop.
MNIST_download.ipynb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"name": "MNIST_download.ipynb", | |
"provenance": [], | |
"authorship_tag": "ABX9TyPddvG5YQJCuO2wGi0aTsEE", | |
"include_colab_link": true | |
}, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3" | |
} | |
}, | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "view-in-github", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"<a href=\"https://colab.research.google.com/gist/mlelarge/60ddefa9e16bc06f7f4fc7bff769bdb1/mnist_download.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"id": "2biaCSOWtdrg", | |
"outputId": "08a5d7cf-4330-4ef4-bcd1-4d279f56ec0a" | |
}, | |
"source": [ | |
"!wget www.di.ens.fr/~lelarge/MNIST.tar.gz" | |
], | |
"execution_count": null, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": [ | |
"--2021-03-03 16:01:32-- http://www.di.ens.fr/~lelarge/MNIST.tar.gz\n", | |
"Resolving www.di.ens.fr (www.di.ens.fr)... 129.199.99.14\n", | |
"Connecting to www.di.ens.fr (www.di.ens.fr)|129.199.99.14|:80... connected.\n", | |
"HTTP request sent, awaiting response... 302 Found\n", | |
"Location: https://www.di.ens.fr/~lelarge/MNIST.tar.gz [following]\n", | |
"--2021-03-03 16:01:32-- https://www.di.ens.fr/~lelarge/MNIST.tar.gz\n", | |
"Connecting to www.di.ens.fr (www.di.ens.fr)|129.199.99.14|:443... connected.\n", | |
"HTTP request sent, awaiting response... 200 OK\n", | |
"Length: unspecified [application/x-gzip]\n", | |
"Saving to: ‘MNIST.tar.gz’\n", | |
"\n", | |
"MNIST.tar.gz [ <=> ] 33.20M 9.78MB/s in 4.2s \n", | |
"\n", | |
"2021-03-03 16:01:36 (7.94 MB/s) - ‘MNIST.tar.gz’ saved [34813078]\n", | |
"\n" | |
], | |
"name": "stdout" | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"id": "IfTvk6oMypbS", | |
"outputId": "55e1fbce-19bd-4693-d424-ad742d438d37" | |
}, | |
"source": [ | |
"!tar -zxvf MNIST.tar.gz" | |
], | |
"execution_count": null, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": [ | |
"MNIST/\n", | |
"MNIST/raw/\n", | |
"MNIST/raw/train-labels-idx1-ubyte\n", | |
"MNIST/raw/t10k-labels-idx1-ubyte.gz\n", | |
"MNIST/raw/t10k-labels-idx1-ubyte\n", | |
"MNIST/raw/t10k-images-idx3-ubyte.gz\n", | |
"MNIST/raw/train-images-idx3-ubyte\n", | |
"MNIST/raw/train-labels-idx1-ubyte.gz\n", | |
"MNIST/raw/t10k-images-idx3-ubyte\n", | |
"MNIST/raw/train-images-idx3-ubyte.gz\n", | |
"MNIST/processed/\n", | |
"MNIST/processed/training.pt\n", | |
"MNIST/processed/test.pt\n" | |
], | |
"name": "stdout" | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"id": "B4Iq2Jg5sgk8", | |
"outputId": "cfa6a5d3-0045-4f33-f4ef-ee42a4ac2f65" | |
}, | |
"source": [ | |
"import torchvision\n", | |
"import torchvision.transforms as transforms\n", | |
"root_dir = './'\n", | |
"torchvision.datasets.MNIST(root=root_dir,download=True)" | |
], | |
"execution_count": null, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
"Dataset MNIST\n", | |
" Number of datapoints: 60000\n", | |
" Root location: ./\n", | |
" Split: Train" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
}, | |
"execution_count": 3 | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "W3cG6FOSy0aA" | |
}, | |
"source": [ | |
"train_set = torchvision.datasets.MNIST(root=root_dir, train=True, download=True)" | |
], | |
"execution_count": null, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "ZPUL6w7z0zcg" | |
}, | |
"source": [ | |
"" | |
], | |
"execution_count": null, | |
"outputs": [] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment