imageclass_cnn/team_zab.ipynb

1103 lines
677 KiB
Text
Raw Permalink Normal View History

2022-07-27 13:12:24 -04:00
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"ExecuteTime": {
"end_time": "2022-07-05T17:07:51.927811Z",
"start_time": "2022-07-05T17:07:48.781405Z"
},
"execution": {
"iopub.execute_input": "2022-07-17T21:28:44.434510Z",
"iopub.status.busy": "2022-07-17T21:28:44.433750Z",
"iopub.status.idle": "2022-07-17T21:28:47.737019Z",
"shell.execute_reply": "2022-07-17T21:28:47.736442Z",
"shell.execute_reply.started": "2022-07-17T21:28:44.434436Z"
},
"id": "8hbqOqrTKhVE",
"tags": []
},
"outputs": [],
"source": [
"import os\n",
"import random\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import seaborn as sns\n",
"from keras.models import Sequential\n",
"from keras.preprocessing.image import ImageDataGenerator\n",
"from keras.applications import EfficientNetV2L\n",
"from keras.optimizers import Adam\n",
"from sklearn.metrics import confusion_matrix, classification_report\n",
"from keras.utils import image_dataset_from_directory\n",
"from keras.layers import (Dense, Conv2D, MaxPool2D, Dropout, \n",
" Flatten, GlobalAveragePooling2D, Rescaling)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-17T21:28:47.738287Z",
"iopub.status.busy": "2022-07-17T21:28:47.737964Z",
"iopub.status.idle": "2022-07-17T21:28:47.741595Z",
"shell.execute_reply": "2022-07-17T21:28:47.741046Z",
"shell.execute_reply.started": "2022-07-17T21:28:47.738271Z"
},
"tags": []
},
"outputs": [],
"source": [
"sns.set_theme(style='darkgrid')"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-17T21:28:47.742341Z",
"iopub.status.busy": "2022-07-17T21:28:47.742199Z",
"iopub.status.idle": "2022-07-17T21:28:47.746494Z",
"shell.execute_reply": "2022-07-17T21:28:47.745989Z",
"shell.execute_reply.started": "2022-07-17T21:28:47.742327Z"
},
"id": "8xRpd7aTcGAK",
"tags": []
},
"outputs": [],
"source": [
"np.random.seed(42)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-17T21:28:47.747595Z",
"iopub.status.busy": "2022-07-17T21:28:47.747405Z",
"iopub.status.idle": "2022-07-17T21:28:47.751243Z",
"shell.execute_reply": "2022-07-17T21:28:47.750746Z",
"shell.execute_reply.started": "2022-07-17T21:28:47.747581Z"
},
"id": "Ik_Ed16RgzH1",
"tags": []
},
"outputs": [],
"source": [
"# path to files on Adam's local machine\n",
"train_path = 'data/seg_train/'\n",
"test_path = 'data/seg_test/'"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 286
},
"execution": {
"iopub.execute_input": "2022-07-17T21:28:48.974528Z",
"iopub.status.busy": "2022-07-17T21:28:48.974039Z",
"iopub.status.idle": "2022-07-17T21:28:49.133624Z",
"shell.execute_reply": "2022-07-17T21:28:49.132844Z",
"shell.execute_reply.started": "2022-07-17T21:28:48.974512Z"
},
"id": "Cm4rla2kKhVG",
"outputId": "c59ecc9c-18c5-44b7-f139-c89a869c8640",
"tags": []
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAQYAAAD+CAYAAADYg6v8AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAADorklEQVR4nOz9eZRl2VkfiP72Ge8YN+aIzIycKrMysuZJY0l6GsBPEmCsxm2MjGG16cYGPzdeXm7z/LD74X4GHssTBoGH14CNAcsGCwskhNCEJJBKoqqkUo0ZVTnHPN95ONN+f+z97bPPiXOHyMwSITp3raiMuPecffbZwzf8volxznG33W13292mN+PPegB32912tx29dpcw3G132912oN0lDHfb3Xa3HWh3CcPddrfdbQf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/4dJIZnE4ZBYxiEJej/Zn2vj5FzHPAgTD9H/zdTxIR+ZBjS2XwYjw9CAmrh+r8HRdLsd+AH5jhxuzopiP+VS9DX0Yfrv2ZJNcl1TN7fZ+4UoUofstSzDqhWybk8OAZJd5j+eXIuyWKQWLOM+Ujch4P7KTELtK84wBlTe5mYXj91V29HmzAwpiv3APptev2WUQ7Z4GtvpSXBn+z+02BZ/+frfQCDRHDSHdNSSvp31V+y4/Snoq+Ig0v9VXwVm2qThLnfeA5+n1bP+t3Tb9yiP71DQAHBnIP3mfdBBHkYQ9EjULmULNNmPMa0uNaM90jvu+SzD66Z/npZ4x/FTE33KUnHMGPikLTtZ784jjphGLHdKZ1vFEDqTrZRiQOgcZLbS/7bfyw4+MacUNc
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"plt.imshow(plt.imread(train_path + 'buildings/0.jpg'));"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Here is a building from the buildings Collection"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "6WqU_6rBKhVG"
},
"source": [
"## Modeling\n",
"\n",
"### ImageDataGenerator\n",
"\n",
"We'll use the `ImageDataGenerator` class to handle rescaling our data to be between 0 and 1 rather than between 0 and 255. You can read more about the `ImageDataGenerator` class in the documentation [here](https://www.tensorflow.org/api_docs/python/tf/keras/preprocessing/image/ImageDataGenerator)."
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-17T21:28:56.963717Z",
"iopub.status.busy": "2022-07-17T21:28:56.963065Z",
"iopub.status.idle": "2022-07-17T21:28:56.967228Z",
"shell.execute_reply": "2022-07-17T21:28:56.966537Z",
"shell.execute_reply.started": "2022-07-17T21:28:56.963687Z"
},
"tags": []
},
"outputs": [],
"source": [
"class_names = ['buildings', 'forest', 'glacier', 'mountain', 'sea', 'street']"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "ip-0O2xwKhVH"
},
"source": [
"### Train and Test Data\n",
"\n",
"80% train/test split with shuffle"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-17T21:29:11.672947Z",
"iopub.status.busy": "2022-07-17T21:29:11.672683Z",
"iopub.status.idle": "2022-07-17T21:29:12.942926Z",
"shell.execute_reply": "2022-07-17T21:29:12.942365Z",
"shell.execute_reply.started": "2022-07-17T21:29:11.672931Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Found 14034 files belonging to 6 classes.\n",
"Using 11228 files for training.\n",
"Found 14034 files belonging to 6 classes.\n",
"Using 2806 files for validation.\n"
]
}
],
"source": [
"#Inferring labels goes in alphanumeric order, so will match our class names\n",
"train_data = image_dataset_from_directory(directory=train_path,\n",
" labels='inferred',\n",
" label_mode='categorical',\n",
" class_names=class_names,\n",
" color_mode='rgb',\n",
" batch_size=32,\n",
" image_size=(150, 150),\n",
" validation_split=.2,\n",
" subset='training',\n",
" shuffle=True,\n",
" seed=42)\n",
"\n",
"test_data = image_dataset_from_directory(directory=train_path,\n",
" labels='inferred',\n",
" label_mode='categorical',\n",
" class_names=class_names,\n",
" color_mode='rgb',\n",
" batch_size=32,\n",
" image_size=(150, 150),\n",
" validation_split=.2,\n",
" subset='validation',\n",
" shuffle=True,\n",
" seed=42)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "ezaEVseFKhVH"
},
"source": [
"### Basic Network\n",
"\n",
"We'll fit a basic convolutional neural network to start with."
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-17T21:29:19.918941Z",
"iopub.status.busy": "2022-07-17T21:29:19.918311Z",
"iopub.status.idle": "2022-07-17T21:29:19.949324Z",
"shell.execute_reply": "2022-07-17T21:29:19.948563Z",
"shell.execute_reply.started": "2022-07-17T21:29:19.918911Z"
},
"id": "mAlAbM3OcGAF",
"tags": []
},
"outputs": [],
"source": [
"# instantiate the model\n",
"basic_model = Sequential()\n",
"\n",
"#Rescale our data so color values are between 0 and 1\n",
"basic_model.add(Rescaling(1./255))\n",
"\n",
"# this is the fancy stuff!\n",
"# 16 different 3-by-3 filters that pick up on patterns in the images\n",
"basic_model.add(Conv2D(filters=16, # number of filters\n",
" kernel_size=(3, 3), # height/width of filter\n",
" activation='relu', # activation function\n",
" ))\n",
"# reduce the dimensionality inside the CNN\n",
"basic_model.add(MaxPool2D(pool_size=(2, 2))) # dimensions of region of pooling\n",
"\n",
"# before this information inside the NN is 3-d -- to connec to a Dense\n",
"# layer, we need to squash it\n",
"basic_model.add(Flatten())\n",
"\n",
"# let it learn a little more...\n",
"basic_model.add(Dense(100, activation='relu'))\n",
"\n",
"# output layer\n",
"basic_model.add(Dense(6, activation='softmax'))"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-17T21:29:23.093969Z",
"iopub.status.busy": "2022-07-17T21:29:23.093284Z",
"iopub.status.idle": "2022-07-17T21:29:23.106381Z",
"shell.execute_reply": "2022-07-17T21:29:23.105554Z",
"shell.execute_reply.started": "2022-07-17T21:29:23.093940Z"
},
"id": "KD4bRtFAcGAF",
"tags": []
},
"outputs": [],
"source": [
"# compile\n",
"basic_model.compile(loss='categorical_crossentropy',\n",
" optimizer='adam',\n",
" metrics=['accuracy'])"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"execution": {
"iopub.execute_input": "2022-07-17T21:30:15.072057Z",
"iopub.status.busy": "2022-07-17T21:30:15.071462Z",
"iopub.status.idle": "2022-07-17T21:30:35.983523Z",
"shell.execute_reply": "2022-07-17T21:30:35.982892Z",
"shell.execute_reply.started": "2022-07-17T21:30:15.072028Z"
},
"id": "cc7o5JcQmGrK",
"outputId": "b6122964-6ea1-4783-b9d2-fe6bf56c111b",
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Epoch 1/9\n",
"351/351 [==============================] - 2s 6ms/step - loss: 0.0384 - accuracy: 0.9935 - val_loss: 1.3848 - val_accuracy: 0.7153\n",
"Epoch 2/9\n",
"351/351 [==============================] - 2s 7ms/step - loss: 0.0286 - accuracy: 0.9958 - val_loss: 1.5794 - val_accuracy: 0.7153\n",
"Epoch 3/9\n",
"351/351 [==============================] - 2s 7ms/step - loss: 0.0232 - accuracy: 0.9978 - val_loss: 1.5496 - val_accuracy: 0.7245\n",
"Epoch 4/9\n",
"351/351 [==============================] - 2s 7ms/step - loss: 0.0367 - accuracy: 0.9911 - val_loss: 2.0015 - val_accuracy: 0.6828\n",
"Epoch 5/9\n",
"351/351 [==============================] - 2s 7ms/step - loss: 0.0527 - accuracy: 0.9868 - val_loss: 1.8391 - val_accuracy: 0.6793\n",
"Epoch 6/9\n",
"351/351 [==============================] - 2s 7ms/step - loss: 0.0343 - accuracy: 0.9920 - val_loss: 1.8650 - val_accuracy: 0.6900\n",
"Epoch 7/9\n",
"351/351 [==============================] - 2s 7ms/step - loss: 0.0412 - accuracy: 0.9905 - val_loss: 1.8137 - val_accuracy: 0.6878\n",
"Epoch 8/9\n",
"351/351 [==============================] - 2s 6ms/step - loss: 0.0204 - accuracy: 0.9963 - val_loss: 2.1676 - val_accuracy: 0.6896\n",
"Epoch 9/9\n",
"351/351 [==============================] - 2s 7ms/step - loss: 0.0298 - accuracy: 0.9931 - val_loss: 2.2046 - val_accuracy: 0.6828\n"
]
}
],
"source": [
"# fit\n",
"basic_history = basic_model.fit(train_data,\n",
" validation_data=test_data,\n",
" epochs=9,\n",
" verbose=1)"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-17T21:30:57.895175Z",
"iopub.status.busy": "2022-07-17T21:30:57.894790Z",
"iopub.status.idle": "2022-07-17T21:30:58.034694Z",
"shell.execute_reply": "2022-07-17T21:30:58.034119Z",
"shell.execute_reply.started": "2022-07-17T21:30:57.895146Z"
},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OKFj2EkMxu007CQG40TiPdbi1QyC5uay/44K+DI44YRPMG/esTz33DOMGTOWM888iwsv/D+0tm4glUoze/b+nHXWfwHwu99dT1tbG+ec8zXmz7+bBx64l/r6wSxZ8ib19XVcdNFlNDSM2OL7rVixnMsv/wnr1q3F8zzOPPNs9t13Nslkkosu+gFLly7B8yLssMN4fvzjS1i2bCkXX/xDkskkvp9j3rxjOPnkz26Lj0akKvht60k/81febWsivX5NPrSTLfR46rUb6RTKQ3CHj9s0qBNDcBL1+a1x19vmv0+xBlTAP/bSShYs2rTLBceBvh6nOGDaduy/+3a9fv3q1av5+c+vByCVSnHppVcyeHAdyWSa8847hyeffJx99529yev+/e9XufHGWxk1ajSXXnoRd9xxG1/60tlbfK8f/vB7HHvsJ5k37zjeemsJ55xzBjfffAeLFi2kubmZm2++HYD169cDcOedd7DffvvzhS98EYDW1urri0Okv+TWrKDtvqsIWj/E3W4n3CHb4Yw23QJ7MG5iCE7tYIgmQnNMakAFfDWbM2dux7Dv+1x33dW8/PIigiCgqamJ119f3GPAT5s2nVGjRgMwdepuPPPMU1t8n9bWDbzxxmKOPvoYACZO3JFJkwyvvPISkyZNZtmypfz0p5eyxx57Mnv2AQDMmLEH1157NZlMhpkz92Lvvfcml6vO/jhEyim7bBFtD12HE62h9pjvMnrXaaxaVf6mkGo1oAJ+/9173squhguKamsTHcO33XYLzc3r+d3vbsLzolx66cWk05t01QxALBbrGHZdj1xuy93hb+6UKsdxGDt2e2655XaeffYZnnzyMX7962u58cY/c/DBH2e33abx9NNPcvPNf2D+/L/z/e//uBe/pcjAEAQBmVceJPXEn3CHjyNx5Ndw64ZXuqxtrurPgx+ImpubaWgYQTweZ9WqD1iw4OGyLXvQoDomTZrCPff8DwBvv72UN99czK677sYHH7yP63ocdNDBfPWr/826dWtpbl7PihXLGT68gaOP/gSnn34Gr776StnqEak2gZ8lteAmUo/fQmT8HtQe892PZLjDANuCHyhOPPEUvv/9b/H5z3+axsaR7LnnrLIu/wc/uIjLL/8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TfsQw7+DMMnX18WQ6mhvXz6kmpB1l/DrQAvyh7JUBPXRX4vt9xWb3vBz32pug4Tp9vXOv7wVa7FXAcj8MPP5K77/4bZ531X7S2buDhh//FLbfczqBBg7jyyuuIxWK0trZy5pmnsc8++zFu3ASCINji8rNZn7a2FN/+9vl85zsXMGvWPjz77NN8+9vnc9ttd3HPPf9g1KjRXHXVdUC+n/ds1uemm37PSSd9mjlz5hIEAS0tLUV1jbC5rgp839/ml3EHqQ203n0JfvMatjv1QtaufI+MfYS1j9zG2kf+grf9VKI7H0Rk/B44XnSb1tauWi9vh+qtra915dasoO3eKwnamqk57GyyO85i9eq+38cgbJ9Xp64KelR0wBtjriDfvv4Ja21PKbKMfNPNM4Xx7lv0fRadsj/RKftvMn1b9vkyd+6xnH/+uZx55tk89NADTJs2ncbGkaxZ08QvfnEJb7yxGMdxWb16FW+88Trjxk0oarnLlr1NNBpl1qx9ANhrr72JRqMsW/Y2U6fuzm23/Ylrr72aGTNmss8++wEwc+Ze3HzzH3jvvZXMmrUvU6fu1l+/dr8IMila770Sf927JOZ8ncSE3WkZNIHopH3x168is/hRMnYByQevw4nXEZk8m+jOB+INL2nHUAaY7LIXaXvol4U+3L+D1zix0iUNWEUFvDHmYmBPYK61tueOzeF24AxjzJ1AA3AccFA5iqwmkydPoaFhBE899QTz5/+dk076DADXX38tw4c3cMMNtxCJRPj6188mldrcR7W
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"plt.plot(basic_history.history['loss'], label='Train loss')\n",
"plt.plot(basic_history.history['val_loss'], label='Val loss')\n",
"plt.legend();\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-17T21:31:01.220234Z",
"iopub.status.busy": "2022-07-17T21:31:01.219850Z",
"iopub.status.idle": "2022-07-17T21:31:01.353825Z",
"shell.execute_reply": "2022-07-17T21:31:01.353254Z",
"shell.execute_reply.started": "2022-07-17T21:31:01.220205Z"
},
"tags": []
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAX8AAAD7CAYAAACCEpQdAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAAsfUlEQVR4nO3deZgcVb3/8XdVdffsk8lMJntCIpAjQgKEPSwqOwKK7CgEFVFkEVzu9QoaAggCCngjQRDEG0G5ymIECQguFyGIghKWn3JAtoSQkGGyztpb/f7omp6eJZPp2bon9Xk9zzzVfaqq+zvb55w+1V3l+L6PiIiEi1voAkREZOQp/EVEQkjhLyISQgp/EZEQUviLiIRQpNAF9EMJsA+wBkgVuBYRkdHCAyYBzwLt3VeOhvDfB3iy0EWIiIxSBwNPdW8cDeG/BmDDhmbS6fw/k1BXV0ljY9OQFzVYqis/qit/xVqb6srPQOtyXYexYysgyNDuRkP4pwDSaX9A4d+xbzFSXflRXfkr1tpUV34GWVev0+U64CsiEkIKfxGRENrmtI8x5vvAScAMYLa19uVetvGARcDRgA9ca629Y1vrRESkMPoz8l8KHAK83cc2nwZ2AnYGDgAWGmNm9GOdiIgUwDbD31r7lLV21TY2Ow243VqbttY2kOkwTunHOhERKYCherfPdLq+MlgJTOvHun6rq6sccHH19VUD3nc4FWNdvu8XZV1QnD8vKN66oHhrU135GY66RsNbPQFobGwa0Nud6uuraGjYMgwVDc7W6vJ9n1TaJ5FMd36l0sQTKRKpNMmc9njO+kxbqsd+Hdslc9encvbN3TaRBnzGVJYwtqrzq7aqtMv9msoSopGRfa/AaPs9FoNira3Y6kqm0mxpSTBhfBXNW9pG/G97Wwb683Jdp89B81CF/0pgBzIfI4auo/2+1o0Kad8nkUjTnkyRSKSJJ1PEc5eJFPFkznJr7TlLH2htSxLPDewgrAd7fZ2I5xKNBF+eSyyaWXa0VcSi1Hgusaj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PrLV7BF8KfhGRAtpm+BtjxgNzgXuCpnuAucaY+m6b7g48CmCtbQBWAKcOWaUiIjJk+jPtMw1Yba1NAVhrU8aYd4P2hpzt/g6cbox5DpgBzAPeyll/ujHmSGAtcLm19i/5FFpXV5nP5l3U11cNeN/hpLryo7ryV6y1qa78DEdd/Zrz76evATeRGfGvBP4IJIJ1t5I5BpAwxhwB/MYYs4u1trG/D97Y2EQ67eddVH19FQ0NW/Leb7iprvyorvwVa22qKz8Drct1nT4Hzf0J/1XAFGOMF4z6PWBy0J4VTPWc2XHfGLMM+Fewbm3Odo8bY1YBuwFP5PG9iIjIENnmnL+1dh2Z0fwZQdMZwPNB2GcZY+qMMZHg9qHAbOAXwf0pOdvtQWZayA66ehERGZD+TvucBywxxiwANgDzITu6X2CtfQ7YF1hkjEkB7wPHW2tbgv2vMcbsBaSAOHBW7qsBEREZWf0Kf2vtK8B+vbR/LOf2I8DOW9n/7IEWKCIiQ0+f8BURCSGFv4hICCn8RURCSOEvIhJCCn8RkRBS+IuIhJDCX0QkhBT+IiIhpPAXEQkhhb+ISAgp/EVEQkjhLyISQgp/EZEQUviLiISQwl9EJIQU/iIiIaTwFxEJIYW/iEgIKfxFREJI4S8iEkIKfxGREFL4i4iEUKQ/GxljZgFLgDqgEZhvrX2t2zYTgduAmUAUuNpae3ewzgMWAUcDPnCttfaOofomREQkP/0d+d8KLLbWzgIWkwn57m4EnrPWzgEOAa4xxkwL1n0a2AnYGTgAWGiMmTGYwkVEZOC2Gf7GmPHAXOCeoOkeYK4xpr7bprsDjwJYaxuAFcCpwbrTgNuttelg3VLglMEWLyI
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"plt.plot(basic_history.history['accuracy'], label='Train accuracy')\n",
"plt.plot(basic_history.history['val_accuracy'], label='Val accuracy')\n",
"plt.legend();\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This model doesn't seem to be performing very well"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "1sGS2tyjKhVJ"
},
"source": [
"### Prebuilt Networks\n",
"\n",
"Today we'll use `EfficientNet`. You can read more about the keras implementation of `EfficientNet` [here](https://keras.io/examples/vision/image_classification_efficientnet_fine_tuning/#:~:text=Keras%20implementation%20of%20EfficientNet)."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "XzBFnZUncGAJ"
},
"source": [
"#### Import EfficientNet and freeze"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"execution": {
"iopub.execute_input": "2022-07-17T21:31:09.035471Z",
"iopub.status.busy": "2022-07-17T21:31:09.035203Z",
"iopub.status.idle": "2022-07-17T21:31:14.664011Z",
"shell.execute_reply": "2022-07-17T21:31:14.663373Z",
"shell.execute_reply.started": "2022-07-17T21:31:09.035455Z"
},
"id": "WIhFD_gKcGAK",
"outputId": "c400468e-c3fe-4497-9842-79f386fa63f7",
"tags": []
},
"outputs": [],
"source": [
"#top = false so we don't get the output layer of effnet\n",
"effnet = EfficientNetV2L(include_top=False, weights='imagenet')"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"execution": {
"iopub.execute_input": "2022-07-17T21:31:14.665176Z",
"iopub.status.busy": "2022-07-17T21:31:14.664960Z",
"iopub.status.idle": "2022-07-17T21:31:14.688847Z",
"shell.execute_reply": "2022-07-17T21:31:14.688260Z",
"shell.execute_reply.started": "2022-07-17T21:31:14.665161Z"
},
"id": "iH3UYtn6cGAK",
"outputId": "6d71c7a2-9efb-4b5c-a46f-6a3bb10321f1",
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"effnet.trainable = False\n",
"effnet.trainable"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "KxV0EayjcGAK"
},
"source": [
"\n",
"#### Add EfficientNet to a Sequential model\n",
"\n",
"Between `EfficientNet` and our first Dense layer, we will need to use `GlobalAveragePooling2D()`. (This appears to be related to a bug inside of keras; you can read more [here](https://stackoverflow.com/questions/48851558/tensorflow-estimator-valueerror-logits-and-labels-must-have-the-same-shape).)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-17T21:31:24.580846Z",
"iopub.status.busy": "2022-07-17T21:31:24.580321Z",
"iopub.status.idle": "2022-07-17T21:31:26.456824Z",
"shell.execute_reply": "2022-07-17T21:31:26.456030Z",
"shell.execute_reply.started": "2022-07-17T21:31:24.580817Z"
},
"id": "XsOqCzq_tJZ_",
"tags": []
},
"outputs": [],
"source": [
"eff_model = Sequential()\n",
"eff_model.add(effnet)\n",
"eff_model.add(GlobalAveragePooling2D())\n",
"eff_model.add(Dense(6, activation='softmax'))"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"execution": {
"iopub.execute_input": "2022-07-17T21:31:26.458355Z",
"iopub.status.busy": "2022-07-17T21:31:26.458112Z",
"iopub.status.idle": "2022-07-17T21:31:26.494031Z",
"shell.execute_reply": "2022-07-17T21:31:26.493375Z",
"shell.execute_reply.started": "2022-07-17T21:31:26.458334Z"
},
"id": "J-QUvl1fx3XG",
"outputId": "c146558d-157a-42c2-a956-132375724116",
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Model: \"sequential_1\"\n",
"_________________________________________________________________\n",
" Layer (type) Output Shape Param # \n",
"=================================================================\n",
" efficientnetv2-l (Functiona (None, None, None, 1280) 117746848\n",
" l) \n",
" \n",
" global_average_pooling2d (G (None, 1280) 0 \n",
" lobalAveragePooling2D) \n",
" \n",
" dense_2 (Dense) (None, 6) 7686 \n",
" \n",
"=================================================================\n",
"Total params: 117,754,534\n",
"Trainable params: 7,686\n",
"Non-trainable params: 117,746,848\n",
"_________________________________________________________________\n"
]
}
],
"source": [
"eff_model.summary()"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "Qkgpfj-9cGAK"
},
"source": [
"#### Compile and evaluate"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-17T21:31:54.783074Z",
"iopub.status.busy": "2022-07-17T21:31:54.782685Z",
"iopub.status.idle": "2022-07-17T21:31:54.811131Z",
"shell.execute_reply": "2022-07-17T21:31:54.810534Z",
"shell.execute_reply.started": "2022-07-17T21:31:54.783046Z"
},
"id": "viuBcMiEcGAK",
"tags": []
},
"outputs": [],
"source": [
"eff_model.compile(optimizer=Adam(learning_rate=0.0001),\n",
" loss='categorical_crossentropy', \n",
" metrics=['accuracy'])"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"execution": {
"iopub.execute_input": "2022-07-17T21:31:56.504469Z",
"iopub.status.busy": "2022-07-17T21:31:56.504198Z",
"iopub.status.idle": "2022-07-17T21:37:11.005343Z",
"shell.execute_reply": "2022-07-17T21:37:11.004527Z",
"shell.execute_reply.started": "2022-07-17T21:31:56.504453Z"
},
"id": "-IDTcsTOoYZK",
"outputId": "3db8b63d-04b9-41fe-f14a-ec1b32f248a6",
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Epoch 1/10\n",
"351/351 [==============================] - 52s 100ms/step - loss: 1.1717 - accuracy: 0.6575 - val_loss: 0.7577 - val_accuracy: 0.8357\n",
"Epoch 2/10\n",
"351/351 [==============================] - 29s 83ms/step - loss: 0.6484 - accuracy: 0.8325 - val_loss: 0.5315 - val_accuracy: 0.8660\n",
"Epoch 3/10\n",
"351/351 [==============================] - 29s 83ms/step - loss: 0.5048 - accuracy: 0.8555 - val_loss: 0.4439 - val_accuracy: 0.8753\n",
"Epoch 4/10\n",
"351/351 [==============================] - 29s 83ms/step - loss: 0.4414 - accuracy: 0.8636 - val_loss: 0.3968 - val_accuracy: 0.8813\n",
"Epoch 5/10\n",
"351/351 [==============================] - 29s 83ms/step - loss: 0.3988 - accuracy: 0.8726 - val_loss: 0.3675 - val_accuracy: 0.8842\n",
"Epoch 6/10\n",
"351/351 [==============================] - 29s 83ms/step - loss: 0.3717 - accuracy: 0.8779 - val_loss: 0.3467 - val_accuracy: 0.8917\n",
"Epoch 7/10\n",
"351/351 [==============================] - 29s 83ms/step - loss: 0.3538 - accuracy: 0.8822 - val_loss: 0.3318 - val_accuracy: 0.8963\n",
"Epoch 8/10\n",
"351/351 [==============================] - 29s 83ms/step - loss: 0.3363 - accuracy: 0.8897 - val_loss: 0.3201 - val_accuracy: 0.8988\n",
"Epoch 9/10\n",
"351/351 [==============================] - 29s 83ms/step - loss: 0.3265 - accuracy: 0.8887 - val_loss: 0.3111 - val_accuracy: 0.8999\n",
"Epoch 10/10\n",
"351/351 [==============================] - 29s 83ms/step - loss: 0.3149 - accuracy: 0.8949 - val_loss: 0.3035 - val_accuracy: 0.9041\n"
]
}
],
"source": [
"eff_history = eff_model.fit(train_data, validation_data=test_data, epochs=10)"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 265
},
"execution": {
"iopub.execute_input": "2022-07-06T22:39:29.986688Z",
"iopub.status.busy": "2022-07-06T22:39:29.986347Z",
"iopub.status.idle": "2022-07-06T22:39:30.103357Z",
"shell.execute_reply": "2022-07-06T22:39:30.102578Z",
"shell.execute_reply.started": "2022-07-06T22:39:29.986670Z"
},
"id": "5RM9RSYRoYWs",
"outputId": "a43236c4-2b16-42da-f5cb-b9c08c4a87fe",
"tags": []
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAD4CAYAAAD8Zh1EAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAAqcElE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qrbO11tlJSUkm7LpvuZOS8GjYUCDDLkKI4GBGoBcDqV0epwAlJrQ7JDNT44gJs5O3XwJdCBEczAj014Cveme7zANqtNYnTWh3SKwWxcKJSaw7WI7HI9MXhRCBrz/TFl8ANgNZSqlipdTXlVJ3K6Xu9m7yFlAIFAB/Au4dtmoHKDcriYr6FvJLZPqiECLwnfNMUa31knO8roH7TKvIRAsndq6+OC0lxsfVCCHE8Aq4M0W7SowMZUZKjExfFEIEhYAOdIBFWU4+Ol7N6YZWX5cihBDDKuADPTcrCa1h/SGZ7SKECGwBH+jTU2KJjwiRZQCEEAEv4APdalEsnJAo0xeFEAEv4AMdjKsYVTW0sudEja9LEUKIYRMUgX7ZhCSUQq41KoQIaEER6PERIcxMjWXtQRlHF0IErqAIdDBWX9xTXE1FfYuvSxFCiGERNIGe0z59UXrpQogAFTSBPnVsDImRMn1RCBG4gibQLRbFoolO1h0sxy3TF4UQAShoAh2MYZeaJhcfHz/t61KEEMJ0QRXoCyckYVFy8WghRGAKqkCPCbcze1wcebL
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"plt.plot(eff_history.history['loss'], label='Train loss')\n",
"plt.plot(eff_history.history['val_loss'], label='Val loss')\n",
"plt.legend();\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 265
},
"execution": {
"iopub.execute_input": "2022-07-06T22:39:30.124496Z",
"iopub.status.busy": "2022-07-06T22:39:30.124010Z",
"iopub.status.idle": "2022-07-06T22:39:30.217731Z",
"shell.execute_reply": "2022-07-06T22:39:30.217203Z",
"shell.execute_reply.started": "2022-07-06T22:39:30.124465Z"
},
"id": "5RM9RSYRoYWs",
"outputId": "a43236c4-2b16-42da-f5cb-b9c08c4a87fe",
"tags": []
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAD4CAY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lhHoJd91vG8racO1n0wR58FC7/uCvZ5EJPqs2bXNTrJdxtmOVBi9c6PlNe3nwQVgcykKCalx3He5DQmpsUyMSOWCWmxJETpVZlqeNGgV31rbrAqX8r2d3kcBGdDx3pRSdY4+pTLrPH1tkdils9662W1jWw7UsG2o5XsOVFNfkktxys72hwaImSnxjBlRByXzxzZPtwyPjWWqHAdO1eBQYNedaizd++Zl+2HiiN0zGsuVnCnTYFx51tTAaROtgI+JsWXrae5pZW9J6rZfrSSbUcr2Ha0gmPlVqiH2YRJ6XHMy05iRfqY9iGXsSnRQTF7oQpuGvTBprUFKo+6gvwzV5gfgNLPOs/xEhoJKZOsIZdZK1yBPsWaJiAsynftd1NS42DbkUq2H6tg+5FKdh6vbL8KNCM+grlZSdy0IJs5WYmcMTpBq1tU0NKgD1TGWKWKpfs6eual+8F+EFoaO9aLTrV65NOv7DzckjDGr0oZm5xWb33b0Yr2HnthRUdvfcaoBL40fyxzxyYyJyuJUQmRemJUKRcN+kDTUAmfPAtb/gL2A9ZrEgKJY60An3hh50D3kxLGrkqqHa7hl0q2Halg1/Gq9hkSR8RHMndsIjcvzGZOVhIzRsVrb12pU9CgDxQnPoEtj8Ou9dBcD6Nz4MrfWUMvyRMgLNLXLexVk7OV3UVV7T317Ucr20+YhttCOGN0PF9eMJa5WUnMHZvIyAT/GDpSarjQoB/Omh2w52XY8pg1VUBoFJy5HOZ91bpbkZ86WeVwBbrVY991vKq9Tn1UQiR
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"plt.plot(eff_history.history['accuracy'], label='Train accuracy')\n",
"plt.plot(eff_history.history['val_accuracy'], label='Val accuracy')\n",
"plt.legend();\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"It looks like this could train for a little while longer but we'll call it good here for fear of overfitting"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Confusion matrix\n",
"First create some data for it:"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-06T22:23:05.431294Z",
"iopub.status.busy": "2022-07-06T22:23:05.431089Z",
"iopub.status.idle": "2022-07-06T22:23:06.142409Z",
"shell.execute_reply": "2022-07-06T22:23:06.141756Z",
"shell.execute_reply.started": "2022-07-06T22:23:05.431278Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Found 14034 files belonging to 6 classes.\n"
]
}
],
"source": [
"all_data = image_dataset_from_directory(directory=train_path,\n",
" labels='inferred',\n",
" label_mode='categorical',\n",
" class_names=class_names,\n",
" color_mode='rgb',\n",
" batch_size=32,\n",
" image_size=(150, 150),\n",
" shuffle=False,\n",
" seed=42)"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-06T22:47:05.275883Z",
"iopub.status.busy": "2022-07-06T22:47:05.275387Z",
"iopub.status.idle": "2022-07-06T22:48:03.127611Z",
"shell.execute_reply": "2022-07-06T22:48:03.127049Z",
"shell.execute_reply.started": "2022-07-06T22:47:05.275853Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"439/439 [==============================] - 57s 129ms/step\n",
"Confusion Matrix\n",
"[[8.89548152e-01 4.56412597e-03 1.82565039e-03 1.04974897e-02\n",
" 9.12825194e-03 8.44363304e-02]\n",
" [1.32100396e-03 9.81946279e-01 8.80669309e-04 1.10083664e-02\n",
" 3.08234258e-03 1.76133862e-03]\n",
" [3.74376040e-03 9.56738769e-03 8.05324459e-01 1.33943428e-01\n",
" 4.40931780e-02 3.32778702e-03]\n",
" [1.19426752e-03 3.98089172e-03 1.39331210e-01 8.34394904e-01\n",
" 2.03025478e-02 7.96178344e-04]\n",
" [6.59630607e-03 3.95778364e-03 1.75901495e-02 1.05540897e-02\n",
" 9.58663149e-01 2.63852243e-03]\n",
" [4.99580185e-02 2.93870697e-03 4.19815281e-04 5.03778338e-03\n",
" 3.35852225e-03 9.38287154e-01]]\n",
"Classification Report\n",
" precision recall f1-score support\n",
"\n",
" buildings 0.93 0.89 0.91 2191\n",
" forest 0.97 0.98 0.98 2271\n",
" glacier 0.83 0.81 0.82 2404\n",
" mountain 0.84 0.83 0.84 2512\n",
" sea 0.92 0.96 0.94 2274\n",
" street 0.92 0.94 0.93 2382\n",
"\n",
" accuracy 0.90 14034\n",
" macro avg 0.90 0.90 0.90 14034\n",
"weighted avg 0.90 0.90 0.90 14034\n",
"\n"
]
}
],
"source": [
"y = np.concatenate([y for x, y in all_data], axis=0)\n",
"\n",
"y_pred_array = eff_model.predict(all_data)\n",
"y_pred = np.argmax(y_pred_array, axis=1)\n",
"\n",
"#Create confusion matrix\n",
"print('Confusion Matrix')\n",
"matrix = confusion_matrix(np.where(y==1)[1], y_pred,normalize='true')\n",
"print(matrix)\n",
"print('Classification Report')\n",
"print(classification_report(np.where(y==1)[1], y_pred, \n",
" target_names=class_names))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Create heatmap "
]
},
{
"cell_type": "code",
"execution_count": 59,
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-06T22:56:17.443695Z",
"iopub.status.busy": "2022-07-06T22:56:17.443185Z",
"iopub.status.idle": "2022-07-06T22:56:17.673770Z",
"shell.execute_reply": "2022-07-06T22:56:17.673084Z",
"shell.execute_reply.started": "2022-07-06T22:56:17.443661Z"
},
"tags": []
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAiQAAAExCAYAAABMALnFAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAABLGUlEQVR4nO3deVhTZ9oG8DsEUBKWKFXEpSCgSDu2bq227iCurGpra7eZtu5Lq07rLlqXjtoZWzfqCi7T5WutsrlW1Lq3VdvaqiigKIJakQRJIkj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Dz87PoyVz6f/a/ZVsD9VzrYNWEUAS3fRK3Cu5gZvxhfL0/Dc0auOHk56+j3cjNuPLnbdRxkuNfw7oi8sUAKOs6IiNHg5gNRyoubF3wdhf8vc/TcHJ0wOE/cjAxdj8yc4VZFbqV8J4gz6PRqBEzcxqOHT0ClYcK4ydMQv8B4cjNzcHAiAH4LjEF3t6NAQCbNsQhbt0aFBXdQUhoH8yYNQfOzs7VjiMEIY4jjbpsfkfL5/fehEnoHxaO3JwcREcMwNbEFHg3LqvTxvg4xK1fg6I7ZXWaGfNAnaoYRwilVR/mj5RGo8bsmdMf2Bcmol/5PjUoIgxbEpMr7VPx69aW71O9Mf2BferzFcuwKnZFpbFHjBqDkWPGCTIPW7OHOhXobN/4FGg0WDh3Jn7+8WjZJ9fGTEBo3wG4fi0Xbw2JwIavE+HVyBsA8PV/N+DLTetQVFSEbj1DMWnKrIo6XTh/Dsv/8y+kXzgPuYMD2rR/HhM+nI569W3/QYVGHk42f44HWfvvrH67MP/uVKfahuSeW7duITc
"text/plain": [
"<Figure size 720x360 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"sns.set(rc = {'figure.figsize':(10,5)})\n",
"sns.heatmap(matrix, annot=True,fmt='.2f', cmap=\"Blues\");"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Can you tell the difference between these pictures? Our model can!"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-06T22:41:17.462231Z",
"iopub.status.busy": "2022-07-06T22:41:17.461836Z",
"iopub.status.idle": "2022-07-06T22:41:17.584227Z",
"shell.execute_reply": "2022-07-06T22:41:17.583586Z",
"shell.execute_reply.started": "2022-07-06T22:41:17.462205Z"
},
"tags": []
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAQEAAAD8CAYAAAB3lxGOAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiw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ixrV3bPkTL4zKD/d5vt3fY7ZkYIQABe5TZ+R3EFn5gp/52a3enqTtM38Py+07dHv3ut9aH2Q8PqsxB4J7ZAefcPDBf/d4VQryNz0H4Q8D3VMV+FPgs8Lf2a+9eX2Sch9qPb7qXMexH+h60z91UTLu/9yYfvL2/HdV/O5beG8QOYce2t7vfs/vlubfwwewmG9qjvSHrMY48Rj9273OnMd/LHjrsvr1XlmE/YeZhBYrj8EBkAkKIs8CHgReBYxWCwDk3L4Q4eg/tUdV/EGN7z/j7+4U9xybEgW0PAKTYI1fDTs2PYY1xk+Kdxjgs817A1g28sxZla3mq8Qy/eLBjGYe7ZBK/RbDbGmynYu51jPeNBIQQTeAngb/mnOscFBOJsYSkzZnjOy7AYbDy/ZJEu7X/oA7Bbu+y67h3udp3ryM48BQM297HEu6g5PH9wE79DsWKO7Y9VBduShHvHtO29g8Dh7mZd0Ma99P+YYy89luvg77LfSEBIUSIRwD/3jn3U9XXi0KIExUVcAJY2qmuc+6fA/8c4Oijz7iDk8mH16XuR77u1e9efb2X5pxuLCDibuTe/d5Ne5HA433dy3sedM63vk/1jiMd3041Ds747KbHPwirs5cqebvdyU5lDgoHYQ/2WqcHcfndj3ZAAP8KeNs597+MPfpZ4Ier338Y+Jl7H96ufT+wm/9bHsTY536aeUj
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"mountain = random.choice(os.listdir(\"data/seg_train/mountain\"))\n",
"plt.imshow(plt.imread(f'data/seg_train/mountain/{mountain}'));\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-06T22:40:21.212301Z",
"iopub.status.busy": "2022-07-06T22:40:21.211546Z",
"iopub.status.idle": "2022-07-06T22:40:21.343654Z",
"shell.execute_reply": "2022-07-06T22:40:21.343049Z",
"shell.execute_reply.started": "2022-07-06T22:40:21.212265Z"
},
"tags": []
},
"outputs":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D60VAiUVwpMIDdYc4lm2rwkh8DxvJF74vo9S43nT1Okl0jTFGDNCRg/e7sdaMyHXc9/B9/b/D6f4y9uDsKcHmlJ/ACztD6pNUvv7en2+h/Ee5vbQIAHXxOj/HJjz6+O/98ZZy+y68yEQiIx7sMaQxtoh14PYsAO+AwgpMNaCNSRpisnFg/z3jMOQUqKNva9OYO/cE9Qxx/j7+oiJz8PAen9egA+jPfi4k4qt7NDfZ6wPyoF82EB1ENt/kC7insFJrsNd1/e3/XEBP4i17x/7fu3hQQIjQHMOASONZvYphMMBZkR9c2FAIDNAl0IipM1MixptNMo74BHvx5ph0cY65aLNxIMJ7evYGmEeyA/gIEQwed8kIhhdPsTddY/IsE8j/F7ae/WyG1/brx+Z7HP3tcPHee8ythv7vff/oO0wTuAuoN878d1y4PtYy4OKTk4yPFwEu1d7OJCAEEjlgXMH3ONpNyK0FqydYOul0xMIQFsLVgMaYcCYTIYHhLUP5EEHY7nfsfqT3IZEZXqGPVRg7MF0j0c7gBPIcNu9joQQ4sBDMykCvJ/2gTTcDzoHH2yN9xz7Q0QY2U3vcUXvoR3yTg/u+uC6HWst9/a0uHd7OJAAYMwkqzzmAPbwxxP7J5VCyAwJmBRjnLZeSJBSITPOYA/iGA209/uY1R+PvecOMRkynCMKkJJDLRCT9+55rkNWsr/vflPVHhHgoG/v8bBPIrQH6bt39sP9KrKLH+BIvtf1HNw+CII76N794sBd3IDdm63xwLn3cQeTtoBcEcgD7OFI1Mj6j9dwn/kPaQ8JEnDRgjmve6Cya0ITbi0gJ7IG7ZOphZAjC4E17MW
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"glacier = random.choice(os.listdir(\"data/seg_train/glacier\"))\n",
"plt.imshow(plt.imread(f'data/seg_train/glacier/{glacier}'));\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-06T22:42:17.308200Z",
"iopub.status.busy": "2022-07-06T22:42:17.307758Z",
"iopub.status.idle": "2022-07-06T22:42:17.429258Z",
"shell.execute_reply": "2022-07-06T22:42:17.428820Z",
"shell.execute_reply.started": "2022-07-06T22:42:17.308173Z"
},
"tags": []
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAQEAAAD8CAYAAAB3lxGOAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOz9aayt2brfB/1G8zazWe3uqjl1qs45t7Fva/smjuNYsUWECGDwF0BgJQSClC8QgQCBk+9IkZAQlhASFgEZEYlEgAQSVgBZshIicRVf59rm+t5z72nrVO1du1n9bN5mNHx4xnjnO+eaa+29q04527o1Sqv2WnO+zXjHO8Yznub//B8VY+Sb9k37pv3xbfo/7Q58075p37T/dNs3QuCb9k37Y96+EQLftG/aH/P2jRD4pn3T/pi3b4TAN+2b9se8fSMEvmnftD/m7WsTAkqpf1Ep9X2l1A+UUn/t67rPN+2b9k37ak19HTgBpZQB/hD4zwKfAf8x8N+IMf6jn/vNvmnftG/aV2pflybwZ4EfxBh/FGPsgP8T8Fe+pnt9075p37Sv0OzXdN0PgZ+N/v4M+GfuOlibOupi/haXz9qL2vl4pNUodfexe4/7+lvWutQ/xnv+4+vD9vWU2h7mdPedYxRfF2I1P99bX3/PsKitL+LOjNo+Yd/9xs+p5IM36sLPe2Rc8+pVjPHR7udflxDY95Rbz6SU+teAfw1A2xlH3/4v7R6yt90eZHXPd5vbjid9jJEY714Iu5/fNZGUUlsv9L4JJ/fc9OV1i/BtF2k+ft95+b5bfdjSAdXeod8ds3ys2j75zue5PR7h1nnjPu3r//i7NxVg4/6EEPb2ce+7UnevzzvHgvuFzfi84D1KKbTWaK23hMO+Z7tPkO2OG/q2UN097+U/+rd/uq+PX5cQ+Az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F3VdDtifb6Pu86qe4y4d4EaLS/bffjvmtIGO9txnm/JrL5fayt7t/5d/t0nwl7X3udibfvXvn4f2LNgX0e7M0AjDWC/fbbuEl4LW60qDderm+qRG36uN32OR339/G2nf66fu5Tn/efc9cc2HYsjk2dO3aU4Xr7Lrh7rY36GtmzOLdtBpJ1PfpaJWfh3ePK6Jx4ay6Mjs6KVDom+Qa33u0eHeHeXXp83s6jyH3yTe7oy6CB7buouv0k2ZBk69/RKYN5l8Zh73vdf+64vRNCIE/+fd7TLADGamv2hI7V7a0JO9r0s1L05trDm02ETT+3vbLjFzD2RG/6vv2Cbq2THbNnn+mSHZ27n2+3u61OaWOTadvkuj2Jds+/a3xGk3x02JZHPi9g0qLcNfeG8d93jx2RkU2m/O2upgGgNr6L3afZL9ju0gqTb2O4ltr6Zrcvu/eJgNL3z6uY7wHkAdxce49wYSMI1J5I0m0tZn97J4TAfW0cJnmbc4bjY7zv+b/2tqta737+JuftO+dtPcC3r/26QXn7a28W8tu3zbNshN/2RgBvbo7c9iW9SXu98L9POP48mjzflzUfvmx7J4RATCqg/B6HVz3aUwGdvttMtLE0ViP7PCqFihGBYr79ZNi015+znWA2On7nfqItqtE83rNr7ZgQu2rxrfPvW3R3CJF4a2Hdbttq6PiSrzFV8s4/RD3GAnxHK0rq8wZktG2ajBfxllCIyTm5q9uPOz+oInKtjZ98v92+vfjvzhfY/LZ/HMafx82DDx+8ThOQpoe+b6IO92te27+lv99ivr8TQkDa5kXt2lywmZj77Ljh3+Gljs2z25P+vrj29gR4nfq2/Z7feKdXtzWb2xNvs8D32tbbevA9Js9WB4d/t2XX6yfZnX3Zd50Yb43cLUjvyH6+11s+EgBbC2Kf/T1+1OHKauvv/d0eLd63iP1vCdj
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"buildings = random.choice(os.listdir(\"data/seg_train/buildings\"))\n",
"plt.imshow(plt.imread(f'data/seg_train/buildings/{buildings}'));\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-06T22:42:02.906854Z",
"iopub.status.busy": "2022-07-06T22:42:02.906295Z",
"iopub.status.idle": "2022-07-06T22:42:03.045861Z",
"shell.execute_reply": "2022-07-06T22:42:03.045228Z",
"shell.execute_reply.started": "2022-07-06T22:42:02.906820Z"
},
"tags": []
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAQEAAAD8CAYAAAB3lxGOAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOz9eZRk+VUdjO47xBwZQ2ZEZkbOlZlVlTV09TyqW1JrQA0IpM9gITAPD+Kx7M/P4AffQxjzzFpeBoztZT9sY3kBBmGLwcgMkoVAQj1IrW6puqpr6pqycqicI6eY54g7vD9u7JO/SFV3S4j+XF70XStXZWVmRNz7G87ZZ599zk9zXRdvX29fb19/fS/9f/UNvH29fb19/a+93jYCb19vX3/Nr7eNwNvX29df8+ttI/D29fb11/x62wi8fb19/TW/3jYCb19vX3/Nr7fMCGia9oymafOapi1qmvYzb9XnvH29fb19fXuX9lboBDRNMwDcAvB+ABsAzgH4Qdd1r/+Vf9jb19vX29e3db1VSOARAIuu6y67rtsG8PsAPvQWfdbb19vX29e3cZlv0fuOAlhX/r8B4NHX+2NN09zuvwgEAggGg9B1HeVyGbquQ9M0aJoGwzBgGAZ8Ph9arRZc14WmaUgkEmg0Gmg0GnBdF36/H4ZhwLIsuK4LXdcRCATQarXkfTRNg+u6cF0XzWYToVAIgUAAnU4Htm0DAPx+P3w+H2zbRq1Wg2EYcF0XjuOg2WxC0zToui73pGkaarUaBgcHEQgE5H0BwLIsFAoFBAIBxGIx1Go1OI4D13VRr9fh8/lgmiZ8Ph8Mw4B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"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"street = random.choice(os.listdir(\"data/seg_train/street\"))\n",
"plt.imshow(plt.imread(f'data/seg_train/street/{street}'));\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 60,
"metadata": {
"execution": {
"iopub.execute_input": "2022-07-06T23:54:11.547266Z",
"iopub.status.busy": "2022-07-06T23:54:11.546755Z",
"iopub.status.idle": "2022-07-06T23:54:11.552724Z",
"shell.execute_reply": "2022-07-06T23:54:11.551926Z",
"shell.execute_reply.started": "2022-07-06T23:54:11.547239Z"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"16.666666666666668"
]
},
"execution_count": 60,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"100/6"
]
}
],
"metadata": {
"accelerator": "GPU",
"colab": {
"collapsed_sections": [],
"name": "Team ZAB Intel Image Classification",
"provenance": []
},
"gpuClass": "standard",
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.10.5"
}
},
"nbformat": 4,
"nbformat_minor": 4
}