Created
July 12, 2018 11:11
-
-
Save svenski/1e96539e5e666708b1ad64fa51e23735 to your computer and use it in GitHub Desktop.
This file contains 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
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"# Put these at the top of every notebook, to get automatic reloading and inline plotting\n", | |
"%reload_ext autoreload\n", | |
"%autoreload 2\n", | |
"%matplotlib inline" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"# This file contains all the main external libs we'll use\n", | |
"from fastai.imports import *" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"from fastai.transforms import *\n", | |
"from fastai.conv_learner import *\n", | |
"from fastai.model import *\n", | |
"from fastai.dataset import *\n", | |
"from fastai.sgdr import *\n", | |
"from fastai.plots import *" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"True" | |
] | |
}, | |
"execution_count": 4, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"torch.cuda.is_available()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"True" | |
] | |
}, | |
"execution_count": 5, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"torch.backends.cudnn.enabled" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Requirement already satisfied: duckgoose in /home/paperspace/anaconda3/envs/fastai/lib/python3.6/site-packages (0.1.4)\n", | |
"Requirement already satisfied: google-images-download in /home/paperspace/anaconda3/envs/fastai/lib/python3.6/site-packages (from duckgoose) (2.3.0)\n", | |
"Requirement already satisfied: selenium in /home/paperspace/anaconda3/envs/fastai/lib/python3.6/site-packages (from google-images-download->duckgoose) (3.12.0)\n", | |
"\u001b[31mspacy 2.0.11 has requirement regex==2017.4.5, but you'll have regex 2017.11.9 which is incompatible.\u001b[0m\n", | |
"\u001b[31mkaggle-cli 0.12.13 has requirement lxml<4.1,>=4.0.0, but you'll have lxml 4.1.1 which is incompatible.\u001b[0m\n" | |
] | |
} | |
], | |
"source": [ | |
"# Install a pip package in the current Jupyter kernel\n", | |
"import sys\n", | |
"!{sys.executable} -m pip install duckgoose" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"ename": "ImportError", | |
"evalue": "cannot import name 'fetchImagesAndPrepForClassification'", | |
"output_type": "error", | |
"traceback": [ | |
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", | |
"\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)", | |
"\u001b[0;32m<ipython-input-7-5cbdbe91ece6>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mduckgoose\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mfetchImagesAndPrepForClassification\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;31m# dictionary structure `class_name => search term`\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mimage_classes\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m{\u001b[0m \u001b[0;34m'ducks'\u001b[0m \u001b[0;34m:\u001b[0m \u001b[0;34m'ducks -rubber'\u001b[0m \u001b[0;34m,\u001b[0m \u001b[0;34m'geese'\u001b[0m \u001b[0;34m:\u001b[0m \u001b[0;34m'geese'\u001b[0m \u001b[0;34m}\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mdownload_path\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m'data/downloaded_from_google/'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | |
"\u001b[0;31mImportError\u001b[0m: cannot import name 'fetchImagesAndPrepForClassification'" | |
] | |
} | |
], | |
"source": [ | |
"from duckgoose import fetchImagesAndPrepForClassification\n", | |
"\n", | |
"# dictionary structure `class_name => search term`\n", | |
"image_classes = { 'ducks' : 'ducks -rubber' , 'geese' : 'geese' }\n", | |
"download_path = 'data/downloaded_from_google/'\n", | |
"output_path = 'data/ducksgeese/'\n", | |
"number_of_images = 100\n", | |
"\n", | |
"fetchImagesAndPrepForClassification(image_classes, download_path, output_path, number_of_images)" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.6.5" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment