Skip to content

Commit

Permalink
changes to deepcolor downloader to tolerate corrupt files. When my ha…
Browse files Browse the repository at this point in the history
…rd drive ran out of space the script started saving crap
  • Loading branch information
bfortuner committed Apr 7, 2017
1 parent 767c908 commit 3b65fce
Show file tree
Hide file tree
Showing 2 changed files with 1,283 additions and 338 deletions.
1,562 changes: 1,224 additions & 338 deletions deepcolor.ipynb

Large diffs are not rendered by default.

59 changes: 59 additions & 0 deletions pytorch_cheatsheet.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1232,6 +1232,39 @@
"print(t.min())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Loading Preexisting Datasets"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"transform = transforms.Compose(\n",
" [transforms.ToTensor(),\n",
" transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))])\n",
"\n",
"trainset = torchvision.datasets.CIFAR10(root='./data', train=True,\n",
" download=True, transform=transform)\n",
"trainloader = torch.utils.data.DataLoader(trainset, batch_size=4,\n",
" shuffle=True, num_workers=2)\n",
"\n",
"testset = torchvision.datasets.CIFAR10(root='./data', train=False,\n",
" download=True, transform=transform)\n",
"testloader = torch.utils.data.DataLoader(testset, batch_size=4,\n",
" shuffle=False, num_workers=2)\n",
"\n",
"classes = ('plane', 'car', 'bird', 'cat',\n",
" 'deer', 'dog', 'frog', 'horse', 'ship', 'truck')"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -1467,6 +1500,12 @@
" \"\"\"Imshow for Tensor.\"\"\"\n",
" inp = decode_image(tensor)\n",
" plt.imshow(inp)\n",
" plt.show()\n",
" \n",
"def plot_img_array(img_arr, shape=(16,16)):\n",
" # Plot numpy array image with shape (inches?)\n",
" plt.figure(figsize=shape)\n",
" plt.imshow(img_arr.astype('uint8'))\n",
" plt.show()"
]
},
Expand Down Expand Up @@ -1776,6 +1815,26 @@
"source": [
"view_sample_predictions(3)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## References\n",
"\n",
"* https://github.com/desimone/pytorch-cat-vs-dogs/blob/master/main.py"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"t1 = torch."
]
}
],
"metadata": {
Expand Down

0 comments on commit 3b65fce

Please sign in to comment.