Skip to content
This repository has been archived by the owner on Oct 19, 2023. It is now read-only.

Commit

Permalink
2쇄 업데이트
Browse files Browse the repository at this point in the history
  • Loading branch information
Keon Kim committed Oct 18, 2020
1 parent 18756c1 commit a987eb5
Show file tree
Hide file tree
Showing 13 changed files with 1,191 additions and 329 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
"import torch\n",
"import numpy\n",
"from sklearn.datasets import make_blobs\n",
"import matplotlib.pyplot as plt\n",
"import torch.nn.functional as F"
"import matplotlib.pyplot as plt"
]
},
{
Expand Down Expand Up @@ -309,7 +308,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.0"
"version": "3.8.5"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import numpy
from sklearn.datasets import make_blobs
import matplotlib.pyplot as plt
import torch.nn.functional as F


n_dim = 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,117 @@
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Downloading http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/train-images-idx3-ubyte.gz to ./.data/FashionMNIST/raw/train-images-idx3-ubyte.gz\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "1aeda6e7f2f949f3b40910d4bbe9f643",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"HBox(children=(HTML(value=''), FloatProgress(value=1.0, bar_style='info', layout=Layout(width='20px'), max=1.0…"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Extracting ./.data/FashionMNIST/raw/train-images-idx3-ubyte.gz to ./.data/FashionMNIST/raw\n",
"Downloading http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/train-labels-idx1-ubyte.gz to ./.data/FashionMNIST/raw/train-labels-idx1-ubyte.gz\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "32d0e96e1df2498aa0cd05bfef74a0cb",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"HBox(children=(HTML(value=''), FloatProgress(value=1.0, bar_style='info', layout=Layout(width='20px'), max=1.0…"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Extracting ./.data/FashionMNIST/raw/train-labels-idx1-ubyte.gz to ./.data/FashionMNIST/raw\n",
"Downloading http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/t10k-images-idx3-ubyte.gz to ./.data/FashionMNIST/raw/t10k-images-idx3-ubyte.gz\n",
"\n",
"\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "9ba3ba91a8114a3cb6c93dfdfb0716ea",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"HBox(children=(HTML(value=''), FloatProgress(value=1.0, bar_style='info', layout=Layout(width='20px'), max=1.0…"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Extracting ./.data/FashionMNIST/raw/t10k-images-idx3-ubyte.gz to ./.data/FashionMNIST/raw\n",
"Downloading http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/t10k-labels-idx1-ubyte.gz to ./.data/FashionMNIST/raw/t10k-labels-idx1-ubyte.gz\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "b22aa7f5b217481da36362df3baf5082",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"HBox(children=(HTML(value=''), FloatProgress(value=1.0, bar_style='info', layout=Layout(width='20px'), max=1.0…"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Extracting ./.data/FashionMNIST/raw/t10k-labels-idx1-ubyte.gz to ./.data/FashionMNIST/raw\n",
"Processing...\n",
"Done!\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/keon/projects/3-min-pytorch/env/lib/python3.8/site-packages/torchvision/datasets/mnist.py:469: UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors. This means you can write to the underlying (supposedly non-writeable) NumPy array using the tensor. You may want to copy the array to protect its data or make it writeable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at ../torch/csrc/utils/tensor_numpy.cpp:141.)\n",
" return torch.from_numpy(parsed.astype(m[2], copy=False)).view(*s)\n"
]
}
],
"source": [
"train_loader = torch.utils.data.DataLoader(\n",
" datasets.MNIST('./.data',\n",
" datasets.FashionMNIST('./.data',\n",
" train=True,\n",
" download=True,\n",
" transform=transforms.Compose([\n",
Expand All @@ -71,7 +178,7 @@
" ])),\n",
" batch_size=BATCH_SIZE, shuffle=True)\n",
"test_loader = torch.utils.data.DataLoader(\n",
" datasets.MNIST('./.data',\n",
" datasets.FashionMNIST('./.data',\n",
" train=False, \n",
" transform=transforms.Compose([\n",
" transforms.ToTensor(),\n",
Expand Down Expand Up @@ -182,7 +289,15 @@
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n"
]
}
],
"source": [
"def evaluate(model, test_loader):\n",
" model.eval()\n",
Expand Down Expand Up @@ -222,56 +337,56 @@
"name": "stdout",
"output_type": "stream",
"text": [
"[1] Test Loss: 0.5471, Accuracy: 82.80%\n",
"[2] Test Loss: 0.4169, Accuracy: 86.73%\n",
"[3] Test Loss: 0.3393, Accuracy: 89.36%\n",
"[4] Test Loss: 0.2775, Accuracy: 91.60%\n",
"[5] Test Loss: 0.2420, Accuracy: 92.51%\n",
"[6] Test Loss: 0.2205, Accuracy: 93.24%\n",
"[7] Test Loss: 0.1990, Accuracy: 93.90%\n",
"[8] Test Loss: 0.1828, Accuracy: 94.26%\n",
"[9] Test Loss: 0.1786, Accuracy: 94.53%\n",
"[10] Test Loss: 0.1625, Accuracy: 95.13%\n",
"[11] Test Loss: 0.1589, Accuracy: 95.22%\n",
"[12] Test Loss: 0.1493, Accuracy: 95.46%\n",
"[13] Test Loss: 0.1448, Accuracy: 95.60%\n",
"[14] Test Loss: 0.1388, Accuracy: 95.67%\n",
"[15] Test Loss: 0.1326, Accuracy: 95.97%\n",
"[16] Test Loss: 0.1292, Accuracy: 96.01%\n",
"[17] Test Loss: 0.1257, Accuracy: 96.06%\n",
"[18] Test Loss: 0.1234, Accuracy: 96.17%\n",
"[19] Test Loss: 0.1174, Accuracy: 96.36%\n",
"[20] Test Loss: 0.1149, Accuracy: 96.55%\n",
"[21] Test Loss: 0.1133, Accuracy: 96.46%\n",
"[22] Test Loss: 0.1121, Accuracy: 96.50%\n",
"[23] Test Loss: 0.1099, Accuracy: 96.63%\n",
"[24] Test Loss: 0.1071, Accuracy: 96.69%\n",
"[25] Test Loss: 0.1055, Accuracy: 96.76%\n",
"[26] Test Loss: 0.1039, Accuracy: 96.83%\n",
"[27] Test Loss: 0.1036, Accuracy: 96.73%\n",
"[28] Test Loss: 0.1011, Accuracy: 96.77%\n",
"[29] Test Loss: 0.0973, Accuracy: 96.91%\n",
"[30] Test Loss: 0.0973, Accuracy: 96.99%\n",
"[31] Test Loss: 0.0970, Accuracy: 96.97%\n",
"[32] Test Loss: 0.0949, Accuracy: 97.00%\n",
"[33] Test Loss: 0.0931, Accuracy: 97.19%\n",
"[34] Test Loss: 0.0918, Accuracy: 97.14%\n",
"[35] Test Loss: 0.0911, Accuracy: 97.20%\n",
"[36] Test Loss: 0.0927, Accuracy: 97.04%\n",
"[37] Test Loss: 0.0900, Accuracy: 97.18%\n",
"[38] Test Loss: 0.0923, Accuracy: 97.16%\n",
"[39] Test Loss: 0.0899, Accuracy: 97.13%\n",
"[40] Test Loss: 0.0896, Accuracy: 97.10%\n",
"[41] Test Loss: 0.0879, Accuracy: 97.23%\n",
"[42] Test Loss: 0.0872, Accuracy: 97.43%\n",
"[43] Test Loss: 0.0867, Accuracy: 97.24%\n",
"[44] Test Loss: 0.0854, Accuracy: 97.25%\n",
"[45] Test Loss: 0.0863, Accuracy: 97.36%\n",
"[46] Test Loss: 0.0838, Accuracy: 97.42%\n",
"[47] Test Loss: 0.0829, Accuracy: 97.47%\n",
"[48] Test Loss: 0.0834, Accuracy: 97.38%\n",
"[49] Test Loss: 0.0860, Accuracy: 97.34%\n",
"[50] Test Loss: 0.0816, Accuracy: 97.36%\n"
"[1] Test Loss: 0.6536, Accuracy: 76.92%\n",
"[2] Test Loss: 0.5359, Accuracy: 80.72%\n",
"[3] Test Loss: 0.4977, Accuracy: 82.18%\n",
"[4] Test Loss: 0.4584, Accuracy: 83.49%\n",
"[5] Test Loss: 0.4421, Accuracy: 84.22%\n",
"[6] Test Loss: 0.4245, Accuracy: 84.91%\n",
"[7] Test Loss: 0.4205, Accuracy: 84.82%\n",
"[8] Test Loss: 0.4067, Accuracy: 85.32%\n",
"[9] Test Loss: 0.4024, Accuracy: 85.54%\n",
"[10] Test Loss: 0.3923, Accuracy: 85.82%\n",
"[11] Test Loss: 0.3875, Accuracy: 86.22%\n",
"[12] Test Loss: 0.3772, Accuracy: 86.19%\n",
"[13] Test Loss: 0.3807, Accuracy: 86.11%\n",
"[14] Test Loss: 0.3762, Accuracy: 86.33%\n",
"[15] Test Loss: 0.3636, Accuracy: 86.70%\n",
"[16] Test Loss: 0.3699, Accuracy: 86.29%\n",
"[17] Test Loss: 0.3625, Accuracy: 86.92%\n",
"[18] Test Loss: 0.3567, Accuracy: 87.06%\n",
"[19] Test Loss: 0.3515, Accuracy: 87.41%\n",
"[20] Test Loss: 0.3490, Accuracy: 87.50%\n",
"[21] Test Loss: 0.3572, Accuracy: 86.86%\n",
"[22] Test Loss: 0.3504, Accuracy: 87.10%\n",
"[23] Test Loss: 0.3465, Accuracy: 87.48%\n",
"[24] Test Loss: 0.3383, Accuracy: 87.60%\n",
"[25] Test Loss: 0.3347, Accuracy: 87.91%\n",
"[26] Test Loss: 0.3370, Accuracy: 87.76%\n",
"[27] Test Loss: 0.3330, Accuracy: 88.07%\n",
"[28] Test Loss: 0.3338, Accuracy: 88.12%\n",
"[29] Test Loss: 0.3316, Accuracy: 87.98%\n",
"[30] Test Loss: 0.3280, Accuracy: 88.29%\n",
"[31] Test Loss: 0.3241, Accuracy: 88.31%\n",
"[32] Test Loss: 0.3279, Accuracy: 88.23%\n",
"[33] Test Loss: 0.3261, Accuracy: 88.05%\n",
"[34] Test Loss: 0.3262, Accuracy: 88.13%\n",
"[35] Test Loss: 0.3207, Accuracy: 88.47%\n",
"[36] Test Loss: 0.3287, Accuracy: 88.15%\n",
"[37] Test Loss: 0.3221, Accuracy: 88.43%\n",
"[38] Test Loss: 0.3215, Accuracy: 88.31%\n",
"[39] Test Loss: 0.3165, Accuracy: 88.60%\n",
"[40] Test Loss: 0.3178, Accuracy: 88.66%\n",
"[41] Test Loss: 0.3270, Accuracy: 88.00%\n",
"[42] Test Loss: 0.3130, Accuracy: 88.84%\n",
"[43] Test Loss: 0.3118, Accuracy: 89.00%\n",
"[44] Test Loss: 0.3142, Accuracy: 88.57%\n",
"[45] Test Loss: 0.3131, Accuracy: 88.70%\n",
"[46] Test Loss: 0.3202, Accuracy: 88.44%\n",
"[47] Test Loss: 0.3144, Accuracy: 88.76%\n",
"[48] Test Loss: 0.3121, Accuracy: 89.03%\n",
"[49] Test Loss: 0.3177, Accuracy: 88.58%\n",
"[50] Test Loss: 0.3127, Accuracy: 88.94%\n"
]
}
],
Expand Down Expand Up @@ -301,7 +416,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.0"
"version": "3.8.5"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# ![horizontalflip.png](./assets/horizontalflip.png)

train_loader = torch.utils.data.DataLoader(
datasets.MNIST('./.data',
datasets.FashionMNIST('./.data',
train=True,
download=True,
transform=transforms.Compose([
Expand All @@ -35,7 +35,7 @@
])),
batch_size=BATCH_SIZE, shuffle=True)
test_loader = torch.utils.data.DataLoader(
datasets.MNIST('./.data',
datasets.FashionMNIST('./.data',
train=False,
transform=transforms.Compose([
transforms.ToTensor(),
Expand Down
Loading

0 comments on commit a987eb5

Please sign in to comment.