Skip to content

Commit 1c9244b

Browse files
committed
Created using Colaboratory
1 parent f60ea64 commit 1c9244b

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

Lab5-Using-Convolutions-With-Complex-Images.ipynb

+21-21
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
"colab": {
66
"name": "Lab5-Using-Convolutions-With-Complex-Images.ipynb",
77
"provenance": [],
8-
"collapsed_sections": [],
9-
"toc_visible": true
8+
"collapsed_sections": []
109
},
1110
"kernelspec": {
1211
"name": "python3",
@@ -35,7 +34,7 @@
3534
"# See the License for the specific language governing permissions and\n",
3635
"# limitations under the License."
3736
],
38-
"execution_count": 0,
37+
"execution_count": null,
3938
"outputs": []
4039
},
4140
{
@@ -81,7 +80,7 @@
8180
" https://storage.googleapis.com/laurencemoroney-blog.appspot.com/validation-horse-or-human.zip \\\n",
8281
" -O /tmp/validation-horse-or-human.zip"
8382
],
84-
"execution_count": 0,
83+
"execution_count": null,
8584
"outputs": []
8685
},
8786
{
@@ -113,7 +112,7 @@
113112
"zip_ref.extractall('/tmp/validation-horse-or-human')\n",
114113
"zip_ref.close()"
115114
],
116-
"execution_count": 0,
115+
"execution_count": null,
117116
"outputs": []
118117
},
119118
{
@@ -154,7 +153,7 @@
154153
"# Directory with our training human pictures\n",
155154
"validation_human_dir = os.path.join('/tmp/validation-horse-or-human/humans')"
156155
],
157-
"execution_count": 0,
156+
"execution_count": null,
158157
"outputs": []
159158
},
160159
{
@@ -181,7 +180,7 @@
181180
"train_human_names = os.listdir(train_human_dir)\n",
182181
"print(train_human_names[:10])"
183182
],
184-
"execution_count": 0,
183+
"execution_count": null,
185184
"outputs": []
186185
},
187186
{
@@ -205,7 +204,7 @@
205204
"print('total training horse images:', len(os.listdir(train_horse_dir)))\n",
206205
"print('total training human images:', len(os.listdir(train_human_dir)))"
207206
],
208-
"execution_count": 0,
207+
"execution_count": null,
209208
"outputs": []
210209
},
211210
{
@@ -238,7 +237,7 @@
238237
"# Index for iterating over images\n",
239238
"pic_index = 0"
240239
],
241-
"execution_count": 0,
240+
"execution_count": null,
242241
"outputs": []
243242
},
244243
{
@@ -279,7 +278,7 @@
279278
"\n",
280279
"plt.show()\n"
281280
],
282-
"execution_count": 0,
281+
"execution_count": null,
283282
"outputs": []
284283
},
285284
{
@@ -310,7 +309,7 @@
310309
"except Exception:\n",
311310
" pass"
312311
],
313-
"execution_count": 0,
312+
"execution_count": null,
314313
"outputs": []
315314
},
316315
{
@@ -324,7 +323,7 @@
324323
"import tensorflow as tf\n",
325324
"print(tf.__version__)"
326325
],
327-
"execution_count": 0,
326+
"execution_count": null,
328327
"outputs": []
329328
},
330329
{
@@ -370,7 +369,7 @@
370369
" tf.keras.layers.Dense(1, activation='sigmoid')\n",
371370
"])\n"
372371
],
373-
"execution_count": 0,
372+
"execution_count": null,
374373
"outputs": []
375374
},
376375
{
@@ -393,7 +392,7 @@
393392
"source": [
394393
"model.summary()"
395394
],
396-
"execution_count": 0,
395+
"execution_count": null,
397396
"outputs": []
398397
},
399398
{
@@ -432,7 +431,7 @@
432431
" optimizer=RMSprop(lr=0.001),\n",
433432
" metrics=['accuracy'])"
434433
],
435-
"execution_count": 0,
434+
"execution_count": null,
436435
"outputs": []
437436
},
438437
{
@@ -482,7 +481,7 @@
482481
" # Since we use binary_crossentropy loss, we need binary labels\n",
483482
" class_mode='binary')\n"
484483
],
485-
"execution_count": 0,
484+
"execution_count": null,
486485
"outputs": []
487486
},
488487
{
@@ -516,7 +515,7 @@
516515
" validation_steps=8,\n",
517516
" verbose=1)"
518517
],
519-
"execution_count": 0,
518+
"execution_count": null,
520519
"outputs": []
521520
},
522521
{
@@ -572,7 +571,7 @@
572571
" print(fn + \" is a horse\")\n",
573572
" "
574573
],
575-
"execution_count": 0,
574+
"execution_count": null,
576575
"outputs": []
577576
},
578577
{
@@ -639,7 +638,8 @@
639638
" # Postprocess the feature to make it visually palatable\n",
640639
" x = feature_map[0, :, :, i]\n",
641640
" x -= x.mean()\n",
642-
" x /= x.std()\n",
641+
" if x>0:\n",
642+
" x /= x.std()\n",
643643
" x *= 64\n",
644644
" x += 128\n",
645645
" x = np.clip(x, 0, 255).astype('uint8')\n",
@@ -652,7 +652,7 @@
652652
" plt.grid(False)\n",
653653
" plt.imshow(display_grid, aspect='auto', cmap='viridis')"
654654
],
655-
"execution_count": 0,
655+
"execution_count": null,
656656
"outputs": []
657657
},
658658
{
@@ -691,7 +691,7 @@
691691
"import os, signal\n",
692692
"os.kill(os.getpid(), signal.SIGKILL)"
693693
],
694-
"execution_count": 0,
694+
"execution_count": null,
695695
"outputs": []
696696
}
697697
]

0 commit comments

Comments
 (0)