|
33 | 33 | "cell_type": "markdown", |
34 | 34 | "metadata": {}, |
35 | 35 | "source": [ |
36 | | - "#### Turn Off Keras & TF Messages:\n", |
| 36 | + "#### Turn Off Messages & Set GPU Memory Growth:\n", |
37 | 37 | "TF_CPP_MIN_LOG_LEVEL:\n", |
38 | 38 | " - 0 = all messages are logged (default behavior)\n", |
39 | 39 | " - 1 = INFO messages are not printed\n", |
|
48 | 48 | "outputs": [], |
49 | 49 | "source": [ |
50 | 50 | "import os\n", |
51 | | - "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'" |
| 51 | + "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'\n", |
| 52 | + "os.environ['TF_FORCE_GPU_ALLOW_GROWTH'] = 'true'" |
52 | 53 | ] |
53 | 54 | }, |
54 | 55 | { |
|
114 | 115 | "from keras.datasets import cifar10\n", |
115 | 116 | "from random import randint\n", |
116 | 117 | "import numpy as np\n", |
117 | | - "import pandas as pd\n", |
118 | 118 | "import matplotlib.pyplot as plt\n", |
119 | 119 | "from keras.models import Sequential, load_model, Model\n", |
120 | 120 | "from keras.layers import Dense, Conv2D, Activation, MaxPooling2D, Flatten, Dropout\n", |
121 | 121 | "from keras.callbacks import ModelCheckpoint\n", |
122 | 122 | "from keras.utils.np_utils import to_categorical\n", |
123 | | - "from keras.utils.vis_utils import plot_model, model_to_dot\n", |
| 123 | + "from keras.utils.vis_utils import plot_model\n", |
124 | 124 | "from tensorflow.keras.datasets import fashion_mnist" |
125 | 125 | ] |
126 | 126 | }, |
|
138 | 138 | "metadata": {}, |
139 | 139 | "outputs": [], |
140 | 140 | "source": [ |
141 | | - "# plot training accuracy and loss\n", |
142 | | - "def plotCurve(trainingAccuracy, trainingLoss):\n", |
143 | | - " epochs = np.arange(trainingLoss.shape[0])\n", |
144 | | - " #print(epochs)\n", |
145 | | - " plt.figure(figsize = [12, 6])\n", |
146 | | - " plt.subplot(1, 2, 1)\n", |
147 | | - " plt.plot(epochs, trainingAccuracy)\n", |
148 | | - " #plt.axis([-1, 2, -1, 2])\n", |
149 | | - " plt.xlabel('Epoch')\n", |
150 | | - " plt.ylabel('Accuracy')\n", |
151 | | - " plt.title('Training Accuracy')\n", |
152 | | - "\n", |
153 | | - " plt.subplot(1, 2, 2)\n", |
154 | | - " plt.plot(epochs, trainingLoss)\n", |
155 | | - " plt.xlabel('Epoch')\n", |
156 | | - " plt.ylabel('Binary CrossEntropy Loss')\n", |
157 | | - " plt.title('Training Loss')\n", |
158 | | - " plt.show()\n", |
159 | | - "\n", |
160 | 141 | "def plotBothCurves(trainingAccuracy, trainingLoss, validAccuracy, validLoss):\n", |
161 | 142 | " epochs = np.arange(trainingLoss.shape[0])\n", |
162 | 143 | " epochsSaved = np.arange(validLoss.shape[0])\n", |
|
0 commit comments