Skip to content

Commit

Permalink
Merge pull request fastai#672 from slee5777/sl
Browse files Browse the repository at this point in the history
fix error in def resize_mask
  • Loading branch information
sgugger authored Aug 1, 2018
2 parents 8abb7b0 + 39717d7 commit 026fd55
Showing 1 changed file with 10 additions and 26 deletions.
36 changes: 10 additions & 26 deletions courses/dl2/carvana.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -409,19 +409,15 @@
},
{
"cell_type": "markdown",
"metadata": {
"heading_collapsed": true
},
"metadata": {},
"source": [
"### Resize and convert"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"hidden": true
},
"metadata": {},
"outputs": [],
"source": [
"(PATH/'train_masks_png').mkdir(exist_ok=True)"
Expand All @@ -430,9 +426,7 @@
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"hidden": true
},
"metadata": {},
"outputs": [],
"source": [
"def convert_img(fn):\n",
Expand All @@ -443,9 +437,7 @@
{
"cell_type": "code",
"execution_count": 23,
"metadata": {
"hidden": true
},
"metadata": {},
"outputs": [
{
"name": "stdout",
Expand All @@ -463,9 +455,7 @@
{
"cell_type": "code",
"execution_count": 33,
"metadata": {
"hidden": true
},
"metadata": {},
"outputs": [],
"source": [
"(PATH/'train_masks-128').mkdir(exist_ok=True)"
Expand All @@ -474,24 +464,20 @@
{
"cell_type": "code",
"execution_count": 38,
"metadata": {
"hidden": true
},
"metadata": {},
"outputs": [],
"source": [
"def resize_mask(fn):\n",
" Image.open(fn).resize((128,128)).save((fn.parent.parent)/'train_masks-128'/fn.name)\n",
"\n",
"files = list((PATH/'train_masks_png').iterdir())\n",
"with ThreadPoolExecutor(8) as e: e.map(resize_img, files)"
"with ThreadPoolExecutor(8) as e: e.map(resize_mask, files)"
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {
"hidden": true
},
"metadata": {},
"outputs": [],
"source": [
"(PATH/'train-128').mkdir(exist_ok=True)"
Expand All @@ -500,9 +486,7 @@
{
"cell_type": "code",
"execution_count": 45,
"metadata": {
"hidden": true
},
"metadata": {},
"outputs": [],
"source": [
"def resize_img(fn):\n",
Expand Down Expand Up @@ -1937,7 +1921,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
"version": "3.6.6"
},
"toc": {
"colors": {
Expand Down

0 comments on commit 026fd55

Please sign in to comment.