Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 18d9a9a

Browse files
committed
CNN Batch Norm & Img Augment: Rem Unused Libs/Funcs
1 parent dac786e commit 18d9a9a

File tree

1 file changed

+4
-28
lines changed

1 file changed

+4
-28
lines changed

Lectures/lecture7d.ipynb

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@
1717
]
1818
},
1919
{
20+
"attachments": {},
2021
"cell_type": "markdown",
2122
"metadata": {},
2223
"source": [
23-
"#### Turn Off Messages:"
24+
"#### Turn Off Messages & Set GPU Memory Growth:"
2425
]
2526
},
2627
{
@@ -31,10 +32,6 @@
3132
"source": [
3233
"import os\n",
3334
"os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'\n",
34-
"\n",
35-
"# Fix: UnknownError: Failed to get convolution algorithm. \n",
36-
"# This is probably because cuDNN failed to initialize, \n",
37-
"# so try looking to see if a warning log message was printed above\n",
3835
"os.environ['TF_FORCE_GPU_ALLOW_GROWTH'] = 'true'"
3936
]
4037
},
@@ -100,15 +97,13 @@
10097
"import numpy as np\n",
10198
"import pandas as pd\n",
10299
"from random import randint\n",
103-
"from tensorflow.keras import layers, regularizers\n",
104100
"from keras.models import Sequential, load_model\n",
105101
"from keras.datasets import cifar10\n",
106102
"from keras.callbacks import ModelCheckpoint\n",
107103
"from keras.utils import to_categorical\n",
108-
"from keras.applications.vgg16 import preprocess_input\n",
109104
"from keras.layers import Dense, Conv2D, Flatten, Dropout, Activation, MaxPooling2D, BatchNormalization\n",
110105
"from keras.preprocessing.image import ImageDataGenerator\n",
111-
"from sklearn.metrics import accuracy_score, confusion_matrix, recall_score"
106+
"from sklearn.metrics import accuracy_score, confusion_matrix"
112107
]
113108
},
114109
{
@@ -124,25 +119,6 @@
124119
"metadata": {},
125120
"outputs": [],
126121
"source": [
127-
"# plot training accuracy and loss\n",
128-
"def plotCurve(trainingAccuracy, trainingLoss):\n",
129-
" epochs = np.arange(trainingLoss.shape[0])\n",
130-
" #print(epochs)\n",
131-
" plt.figure(figsize = [12, 6])\n",
132-
" plt.subplot(1, 2, 1)\n",
133-
" plt.plot(epochs, trainingAccuracy)\n",
134-
" #plt.axis([-1, 2, -1, 2])\n",
135-
" plt.xlabel('Epoch')\n",
136-
" plt.ylabel('Accuracy')\n",
137-
" plt.title('Training Accuracy')\n",
138-
"\n",
139-
" plt.subplot(1, 2, 2)\n",
140-
" plt.plot(epochs, trainingLoss)\n",
141-
" plt.xlabel('Epoch')\n",
142-
" plt.ylabel('Binary CrossEntropy Loss')\n",
143-
" plt.title('Training Loss')\n",
144-
" plt.show()\n",
145-
"\n",
146122
"# Plot Features of CIFAR-10 data\n",
147123
"def feat_plot(features, labels, classes, title):\n",
148124
" for class_i in classes:\n",
@@ -480,7 +456,7 @@
480456
"metadata": {},
481457
"outputs": [],
482458
"source": [
483-
"save_path6 = '../assets/Lecture7/model3_ckpt.h5'\n",
459+
"save_path6 = '../assets/Lecture7/model6_ckpt.h5'\n",
484460
"callbacks_save6 = ModelCheckpoint(save_path6, monitor='val_loss', verbose=0, save_best_only=True, save_freq='epoch')\n",
485461
"\n",
486462
"opt6 = tf.keras.optimizers.Adam(learning_rate=0.01)\n",

0 commit comments

Comments
 (0)