2023-02-01 17:24:31 +01:00
|
|
|
{"cells":[{"cell_type":"markdown","metadata":{"id":"0yYBm4b55ZBm"},"source":["## Load Data"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":32292,"status":"ok","timestamp":1673089492816,"user":{"displayName":"Mikołaj Krzymiński","userId":"01535337980860424008"},"user_tz":-60},"id":"s26DWJCk5vq8","outputId":"584f88c0-e24b-4847-ff1a-4a7ff262992c"},"outputs":[],"source":["# importing required modules\n","from zipfile import ZipFile\n"," \n","# specifying the zip file name\n","file_name = \"/content/face-expression-recognition-dataset.zip\"\n"," \n","# opening the zip file in READ mode\n","with ZipFile(file_name, 'r') as zip:\n"," # printing all the contents of the zip file\n"," zip.printdir()\n"," \n"," # extracting all the files\n"," print('Extracting all the files now...')\n"," zip.extractall()\n"," print('Done!')"]},{"cell_type":"code","execution_count":65,"metadata":{"executionInfo":{"elapsed":200,"status":"ok","timestamp":1673097954289,"user":{"displayName":"Mikołaj Krzymiński","userId":"01535337980860424008"},"user_tz":-60},"id":"j23l4luA5blT"},"outputs":[],"source":["import numpy as np # linear algebra\n","import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n","import os\n","import matplotlib.pyplot as plt"]},{"cell_type":"code","execution_count":68,"metadata":{"executionInfo":{"elapsed":308,"status":"ok","timestamp":1673098013758,"user":{"displayName":"Mikołaj Krzymiński","userId":"01535337980860424008"},"user_tz":-60},"id":"v35PuWG57DUd"},"outputs":[],"source":["from tensorflow.keras.utils import load_img, img_to_array\n","from keras.preprocessing.image import ImageDataGenerator\n","from keras.layers import Dense, Input, Dropout, GlobalAveragePooling2D\n","from keras.layers import Flatten\n","from keras.layers import Conv2D\n","from keras.layers import BatchNormalization\n","from keras.layers import Activation\n","from keras.layers import MaxPooling2D\n","from keras.models import Model, Sequential\n","#from tensorflow.python.keras.optimizer_v2.adam import Adam\n","#from keras.optimizers import adam_v2\n","from tensorflow.keras.optimizers import RMSprop\n","#from keras.optimizers import rmsprop\n","from tensorflow.keras.optimizers import SGD\n","from tensorflow.keras.optimizers import Adam\n","#, SGD,RMSpro"]},{"cell_type":"code","execution_count":99,"metadata":{"executionInfo":{"elapsed":200,"status":"ok","timestamp":1673099365995,"user":{"displayName":"Mikołaj Krzymiński","userId":"01535337980860424008"},"user_tz":-60},"id":"LY_HhLJwaP44"},"outputs":[],"source":["picture_size = 64\n","folder_path = \"/content/images/\""]},{"cell_type":"code","execution_count":100,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":703},"executionInfo":{"elapsed":1744,"status":"ok","timestamp":1673099370368,"user":{"displayName":"Mikołaj Krzymiński","userId":"01535337980860424008"},"user_tz":-60},"id":"fwXftq0Madg1","outputId":"1948666e-fefa-45b7-c409-12ddc3896965"},"outputs":[{"data":{"image/png":"iVBORw0KGgoAAAANSUhEUgAAAroAAAKuCAYAAABOur+UAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nOy9S4hs6ZYetnZkxjsj8ll16lT1uXV1+/YD2uD2xA88ES0MPTC0Rk3LICRouCMPDB648UTT9sTG0wsW3QZjScg20kBgRGPTeGKEjMC0RTeyu698H11Vt87JzMh4R8b24NS384sv1vr3jnydjPJekGRmxL///b/WWt9a//rXn+V5bjXVVFNNNdVUU0011fRto8aHbkBNNdVUU0011VRTTTU9BdVAt6aaaqqppppqqqmmbyXVQLemmmqqqaaaaqqppm8l1UC3pppqqqmmmmqqqaZvJdVAt6aaaqqppppqqqmmbyXVQLemmmqqqaaaaqqppm8lPQjoZln2m1mW/WmWZf8qy7Lfe6xG1VRTTU9DNc/WVNP+UM2vNdX0cMrum0c3y7IDM/szM/sPzOzHZvbPzOxv5Hn+fz1e82qqqabHoppna6ppf6jm15pqehw6fMCz/7aZ/as8z/8fM7Msy/6emf2WmYVMeHFxkX/nO9+x29tbW61Wtl6vN75fr9d2e3tr6/XasiwrPs+yrPhh0s/47zzPTUF8nud2e3treZ5blmV2eHhojcZ7p3aj0diqX+v0vn8oPWadD6nrsS4O2bWe+5Yvm9/b21tbLBbFOlutVnZ7e7tRnsfr4ODAWq1WsQ6i9cDP8s/BwUGxlqJ+/dmf/dnP8zz/aKcOPy7txLPdbjcfDodmZht9Y8I8YIzX6/XGPChFY+rNp5bnucd7vHr02UajUfwwNRqNYt4ODg6s2WwW5XQ+UR/qjOSRR4/B409xsQ+PuTee/D3+5vJe2fV6vbEG8Hc0v967ou/1vWX8xu
|