{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Defaulting to user installation because normal site-packages is not writeable\n", "Collecting tensorflow\n", " Downloading tensorflow-2.6.2-cp36-cp36m-manylinux2010_x86_64.whl (458.3 MB)\n", " |████████████████████████████████| 458.3 MB 15 kB/s ��█████████████████████████ | 428.5 MB 54.8 MB/s eta 0:00:01 \n", "\u001b[?25hCollecting tensorboard<2.7,>=2.6.0\n", " Downloading tensorboard-2.6.0-py3-none-any.whl (5.6 MB)\n", " |████████████████████████████████| 5.6 MB 81.1 MB/s \n", "\u001b[?25hRequirement already satisfied: numpy~=1.19.2 in /usr/local/lib/python3.6/dist-packages (from tensorflow) (1.19.5)\n", "Collecting google-pasta~=0.2\n", " Downloading google_pasta-0.2.0-py3-none-any.whl (57 kB)\n", " |████████████████████████████████| 57 kB 8.4 MB/s \n", "\u001b[?25hCollecting tensorflow-estimator<2.7,>=2.6.0\n", " Downloading tensorflow_estimator-2.6.0-py2.py3-none-any.whl (462 kB)\n", " |████████████████████████████████| 462 kB 73.5 MB/s \n", "\u001b[?25hCollecting keras-preprocessing~=1.1.2\n", " Downloading Keras_Preprocessing-1.1.2-py2.py3-none-any.whl (42 kB)\n", " |████████████████████████████████| 42 kB 1.9 MB/s \n", "\u001b[?25hCollecting astunparse~=1.6.3\n", " Downloading astunparse-1.6.3-py2.py3-none-any.whl (12 kB)\n", "Collecting typing-extensions~=3.7.4\n", " Downloading typing_extensions-3.7.4.3-py3-none-any.whl (22 kB)\n", "Collecting wheel~=0.35\n", " Downloading wheel-0.37.1-py2.py3-none-any.whl (35 kB)\n", "Collecting flatbuffers~=1.12.0\n", " Downloading flatbuffers-1.12-py2.py3-none-any.whl (15 kB)\n", "Collecting opt-einsum~=3.3.0\n", " Downloading opt_einsum-3.3.0-py3-none-any.whl (65 kB)\n", " |████████████████████████████████| 65 kB 6.1 MB/s \n", "\u001b[?25hRequirement already satisfied: protobuf>=3.9.2 in /usr/local/lib/python3.6/dist-packages (from tensorflow) (3.19.3)\n", "Collecting keras<2.7,>=2.6.0\n", " Downloading keras-2.6.0-py2.py3-none-any.whl (1.3 MB)\n", " |████████████████████████████████| 1.3 MB 67.3 MB/s \n", "\u001b[?25hCollecting clang~=5.0\n", " Downloading clang-5.0.tar.gz (30 kB)\n", " Preparing metadata (setup.py) ... \u001b[?25ldone\n", "\u001b[?25hCollecting h5py~=3.1.0\n", " Downloading h5py-3.1.0-cp36-cp36m-manylinux1_x86_64.whl (4.0 MB)\n", " |████████████████████████████████| 4.0 MB 59.1 MB/s \n", "\u001b[?25hCollecting gast==0.4.0\n", " Downloading gast-0.4.0-py3-none-any.whl (9.8 kB)\n", "Requirement already satisfied: grpcio<2.0,>=1.37.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow) (1.43.0)\n", "Collecting six~=1.15.0\n", " Downloading six-1.15.0-py2.py3-none-any.whl (10 kB)\n", "Requirement already satisfied: absl-py~=0.10 in /usr/local/lib/python3.6/dist-packages (from tensorflow) (0.11.0)\n", "Requirement already satisfied: termcolor~=1.1.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow) (1.1.0)\n", "Collecting wrapt~=1.12.1\n", " Downloading wrapt-1.12.1.tar.gz (27 kB)\n", " Preparing metadata (setup.py) ... \u001b[?25ldone\n", "\u001b[?25hCollecting cached-property\n", " Downloading cached_property-1.5.2-py2.py3-none-any.whl (7.6 kB)\n", "Requirement already satisfied: google-auth<2,>=1.6.3 in /usr/local/lib/python3.6/dist-packages (from tensorboard<2.7,>=2.6.0->tensorflow) (1.35.0)\n", "Requirement already satisfied: setuptools>=41.0.0 in /usr/local/lib/python3.6/dist-packages (from tensorboard<2.7,>=2.6.0->tensorflow) (59.6.0)\n", "Requirement already satisfied: requests<3,>=2.21.0 in /usr/local/lib/python3.6/dist-packages (from tensorboard<2.7,>=2.6.0->tensorflow) (2.27.1)\n", "Collecting tensorboard-plugin-wit>=1.6.0\n", " Downloading tensorboard_plugin_wit-1.8.1-py3-none-any.whl (781 kB)\n", " |████████████████████████████████| 781 kB 57.6 MB/s \n", "\u001b[?25hCollecting google-auth-oauthlib<0.5,>=0.4.1\n", " Downloading google_auth_oauthlib-0.4.6-py2.py3-none-any.whl (18 kB)\n", "Collecting tensorboard-data-server<0.7.0,>=0.6.0\n", " Downloading tensorboard_data_server-0.6.1-py3-none-manylinux2010_x86_64.whl (4.9 MB)\n", " |████████████████████████████████| 4.9 MB 50.8 MB/s \n", "\u001b[?25hCollecting markdown>=2.6.8\n", " Downloading Markdown-3.3.7-py3-none-any.whl (97 kB)\n", " |████████████████████████████████| 97 kB 9.4 MB/s \n", "\u001b[?25hCollecting werkzeug>=0.11.15\n", " Downloading Werkzeug-2.0.3-py3-none-any.whl (289 kB)\n", " |████████████████████████████████| 289 kB 79.3 MB/s \n", "\u001b[?25hRequirement already satisfied: rsa<5,>=3.1.4 in /usr/local/lib/python3.6/dist-packages (from google-auth<2,>=1.6.3->tensorboard<2.7,>=2.6.0->tensorflow) (4.8)\n", "Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/local/lib/python3.6/dist-packages (from google-auth<2,>=1.6.3->tensorboard<2.7,>=2.6.0->tensorflow) (0.2.8)\n", "Requirement already satisfied: cachetools<5.0,>=2.0.0 in /usr/local/lib/python3.6/dist-packages (from google-auth<2,>=1.6.3->tensorboard<2.7,>=2.6.0->tensorflow) (4.2.4)\n", "Requirement already satisfied: requests-oauthlib>=0.7.0 in /usr/local/lib/python3.6/dist-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.7,>=2.6.0->tensorflow) (1.3.0)\n", "Requirement already satisfied: importlib-metadata>=4.4 in /usr/local/lib/python3.6/dist-packages (from markdown>=2.6.8->tensorboard<2.7,>=2.6.0->tensorflow) (4.8.3)\n", "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.6/dist-packages (from requests<3,>=2.21.0->tensorboard<2.7,>=2.6.0->tensorflow) (1.26.8)\n", "Requirement already satisfied: charset-normalizer~=2.0.0 in /usr/local/lib/python3.6/dist-packages (from requests<3,>=2.21.0->tensorboard<2.7,>=2.6.0->tensorflow) (2.0.10)\n", "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/dist-packages (from requests<3,>=2.21.0->tensorboard<2.7,>=2.6.0->tensorflow) (2021.10.8)\n", "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.6/dist-packages (from requests<3,>=2.21.0->tensorboard<2.7,>=2.6.0->tensorflow) (3.3)\n", "Requirement already satisfied: dataclasses in /usr/local/lib/python3.6/dist-packages (from werkzeug>=0.11.15->tensorboard<2.7,>=2.6.0->tensorflow) (0.8)\n", "Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.6/dist-packages (from importlib-metadata>=4.4->markdown>=2.6.8->tensorboard<2.7,>=2.6.0->tensorflow) (3.6.0)\n", "Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in /usr/local/lib/python3.6/dist-packages (from pyasn1-modules>=0.2.1->google-auth<2,>=1.6.3->tensorboard<2.7,>=2.6.0->tensorflow) (0.4.8)\n", "Requirement already satisfied: oauthlib>=3.0.0 in /usr/local/lib/python3.6/dist-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.7,>=2.6.0->tensorflow) (3.1.1)\n", "Building wheels for collected packages: clang, wrapt\n", " Building wheel for clang (setup.py) ... \u001b[?25ldone\n", "\u001b[?25h Created wheel for clang: filename=clang-5.0-py3-none-any.whl size=32130 sha256=b5e6f9c858fd938aa6312f2ed6828aeea530130c214ab9dbc228a1e0fb4fa382\n", " Stored in directory: /home/jovyan/.cache/pip/wheels/22/4c/94/0583f60c9c5b6024ed64f290cb2d43b06bb4f75577dc3c93a7\n", " Building wheel for wrapt (setup.py) ... \u001b[?25ldone\n", "\u001b[?25h Created wheel for wrapt: filename=wrapt-1.12.1-cp36-cp36m-linux_x86_64.whl size=69408 sha256=7a1a7bafa804a609e50fa8ee98375c239f839953087f0a21c0a4ac8588979cdb\n", " Stored in directory: /home/jovyan/.cache/pip/wheels/32/42/7f/23cae9ff6ef66798d00dc5d659088e57dbba01566f6c60db63\n", "Successfully built clang wrapt\n", "Installing collected packages: typing-extensions, six, wheel, werkzeug, tensorboard-plugin-wit, tensorboard-data-server, markdown, google-auth-oauthlib, cached-property, wrapt, tensorflow-estimator, tensorboard, opt-einsum, keras-preprocessing, keras, h5py, google-pasta, gast, flatbuffers, clang, astunparse, tensorflow\n", "\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n", "nbclient 0.5.9 requires nbformat>=5.0, but you have nbformat 4.4.0 which is incompatible.\u001b[0m\n", "Successfully installed astunparse-1.6.3 cached-property-1.5.2 clang-5.0 flatbuffers-1.12 gast-0.4.0 google-auth-oauthlib-0.4.6 google-pasta-0.2.0 h5py-3.1.0 keras-2.6.0 keras-preprocessing-1.1.2 markdown-3.3.7 opt-einsum-3.3.0 six-1.15.0 tensorboard-2.6.0 tensorboard-data-server-0.6.1 tensorboard-plugin-wit-1.8.1 tensorflow-2.6.2 tensorflow-estimator-2.6.0 typing-extensions-3.7.4.3 werkzeug-2.0.3 wheel-0.37.1 wrapt-1.12.1\n", "Defaulting to user installation because normal site-packages is not writeable\n", "Collecting autokeras\n", " Downloading autokeras-1.0.19-py3-none-any.whl (162 kB)\n", " |████████████████████████████████| 162 kB 28.5 MB/s \n", "\u001b[?25hRequirement already satisfied: pandas in /usr/local/lib/python3.6/dist-packages (from autokeras) (1.1.5)\n", " Downloading autokeras-1.0.18-py3-none-any.whl (160 kB)\n", " |████████████████████████████████| 160 kB 75.7 MB/s \n", "\u001b[?25h Downloading autokeras-1.0.17-py3-none-any.whl (160 kB)\n", " |████████████████████████████████| 160 kB 75.2 MB/s \n", "\u001b[?25h Downloading autokeras-1.0.16.post1-py3-none-any.whl (166 kB)\n", " |████████████████████████████████| 166 kB 65.5 MB/s \n", "\u001b[?25hCollecting keras-tuner<1.1,>=1.0.2\n", " Downloading keras_tuner-1.0.4-py3-none-any.whl (97 kB)\n", " |████████████████████████████████| 97 kB 10.9 MB/s \n", "\u001b[?25hRequirement already satisfied: scikit-learn in /usr/local/lib/python3.6/dist-packages (from autokeras) (0.23.2)\n", "Collecting tensorflow<2.6,>=2.3.0\n", " Downloading tensorflow-2.5.2-cp36-cp36m-manylinux2010_x86_64.whl (454.3 MB)\n", " |████████████████████████████████| 454.3 MB 25 kB/s \n", "\u001b[?25hRequirement already satisfied: packaging in /usr/local/lib/python3.6/dist-packages (from autokeras) (21.3)\n", "Collecting kt-legacy\n", " Downloading kt_legacy-1.0.4-py3-none-any.whl (9.6 kB)\n", "Requirement already satisfied: tensorboard in /home/jovyan/.local/lib/python3.6/site-packages (from keras-tuner<1.1,>=1.0.2->autokeras) (2.6.0)\n", "Requirement already satisfied: requests in /usr/local/lib/python3.6/dist-packages (from keras-tuner<1.1,>=1.0.2->autokeras) (2.27.1)\n", "Requirement already satisfied: ipython in /usr/local/lib/python3.6/dist-packages (from keras-tuner<1.1,>=1.0.2->autokeras) (7.16.2)\n", "Requirement already satisfied: scipy in /usr/local/lib/python3.6/dist-packages (from keras-tuner<1.1,>=1.0.2->autokeras) (1.5.4)\n", "Requirement already satisfied: numpy in /usr/local/lib/python3.6/dist-packages (from keras-tuner<1.1,>=1.0.2->autokeras) (1.19.5)\n", "Collecting grpcio~=1.34.0\n", " Downloading grpcio-1.34.1-cp36-cp36m-manylinux2014_x86_64.whl (4.0 MB)\n", " |████████████████████████████████| 4.0 MB 47.5 MB/s \n", "\u001b[?25hRequirement already satisfied: typing-extensions~=3.7.4 in /home/jovyan/.local/lib/python3.6/site-packages (from tensorflow<2.6,>=2.3.0->autokeras) (3.7.4.3)\n", "Requirement already satisfied: wheel~=0.35 in /home/jovyan/.local/lib/python3.6/site-packages (from tensorflow<2.6,>=2.3.0->autokeras) (0.37.1)\n", "Requirement already satisfied: flatbuffers~=1.12.0 in /home/jovyan/.local/lib/python3.6/site-packages (from tensorflow<2.6,>=2.3.0->autokeras) (1.12)\n", "Requirement already satisfied: termcolor~=1.1.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow<2.6,>=2.3.0->autokeras) (1.1.0)\n", "Requirement already satisfied: google-pasta~=0.2 in /home/jovyan/.local/lib/python3.6/site-packages (from tensorflow<2.6,>=2.3.0->autokeras) (0.2.0)\n", "Requirement already satisfied: keras-preprocessing~=1.1.2 in /home/jovyan/.local/lib/python3.6/site-packages (from tensorflow<2.6,>=2.3.0->autokeras) (1.1.2)\n", "Requirement already satisfied: six~=1.15.0 in /home/jovyan/.local/lib/python3.6/site-packages (from tensorflow<2.6,>=2.3.0->autokeras) (1.15.0)\n", "Requirement already satisfied: wrapt~=1.12.1 in /home/jovyan/.local/lib/python3.6/site-packages (from tensorflow<2.6,>=2.3.0->autokeras) (1.12.1)\n", "Collecting tensorflow-estimator<2.6.0,>=2.5.0\n", " Downloading tensorflow_estimator-2.5.0-py2.py3-none-any.whl (462 kB)\n", " |████████████████████████████████| 462 kB 62.2 MB/s \n", "\u001b[?25hRequirement already satisfied: astunparse~=1.6.3 in /home/jovyan/.local/lib/python3.6/site-packages (from tensorflow<2.6,>=2.3.0->autokeras) (1.6.3)\n", "Requirement already satisfied: gast==0.4.0 in /home/jovyan/.local/lib/python3.6/site-packages (from tensorflow<2.6,>=2.3.0->autokeras) (0.4.0)\n", "Requirement already satisfied: opt-einsum~=3.3.0 in /home/jovyan/.local/lib/python3.6/site-packages (from tensorflow<2.6,>=2.3.0->autokeras) (3.3.0)\n", "Requirement already satisfied: protobuf>=3.9.2 in /usr/local/lib/python3.6/dist-packages (from tensorflow<2.6,>=2.3.0->autokeras) (3.19.3)\n", "Requirement already satisfied: h5py~=3.1.0 in /home/jovyan/.local/lib/python3.6/site-packages (from tensorflow<2.6,>=2.3.0->autokeras) (3.1.0)\n", "Requirement already satisfied: absl-py~=0.10 in /usr/local/lib/python3.6/dist-packages (from tensorflow<2.6,>=2.3.0->autokeras) (0.11.0)\n", "Collecting keras-nightly~=2.5.0.dev\n", " Downloading keras_nightly-2.5.0.dev2021032900-py2.py3-none-any.whl (1.2 MB)\n", " |████████████████████████████████| 1.2 MB 72.4 MB/s \n", "\u001b[?25hRequirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /usr/local/lib/python3.6/dist-packages (from packaging->autokeras) (3.0.6)\n", "Requirement already satisfied: pytz>=2017.2 in /usr/local/lib/python3.6/dist-packages (from pandas->autokeras) (2021.3)\n", "Requirement already satisfied: python-dateutil>=2.7.3 in /usr/local/lib/python3.6/dist-packages (from pandas->autokeras) (2.8.2)\n", "Requirement already satisfied: threadpoolctl>=2.0.0 in /usr/local/lib/python3.6/dist-packages (from scikit-learn->autokeras) (3.0.0)\n", "Requirement already satisfied: joblib>=0.11 in /usr/local/lib/python3.6/dist-packages (from scikit-learn->autokeras) (1.1.0)\n", "Requirement already satisfied: cached-property in /home/jovyan/.local/lib/python3.6/site-packages (from h5py~=3.1.0->tensorflow<2.6,>=2.3.0->autokeras) (1.5.2)\n", "Requirement already satisfied: google-auth<2,>=1.6.3 in /usr/local/lib/python3.6/dist-packages (from tensorboard->keras-tuner<1.1,>=1.0.2->autokeras) (1.35.0)\n", "Requirement already satisfied: markdown>=2.6.8 in /home/jovyan/.local/lib/python3.6/site-packages (from tensorboard->keras-tuner<1.1,>=1.0.2->autokeras) (3.3.7)\n", "Requirement already satisfied: setuptools>=41.0.0 in /usr/local/lib/python3.6/dist-packages (from tensorboard->keras-tuner<1.1,>=1.0.2->autokeras) (59.6.0)\n", "Requirement already satisfied: tensorboard-data-server<0.7.0,>=0.6.0 in /home/jovyan/.local/lib/python3.6/site-packages (from tensorboard->keras-tuner<1.1,>=1.0.2->autokeras) (0.6.1)\n", "Requirement already satisfied: tensorboard-plugin-wit>=1.6.0 in /home/jovyan/.local/lib/python3.6/site-packages (from tensorboard->keras-tuner<1.1,>=1.0.2->autokeras) (1.8.1)\n", "Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in /home/jovyan/.local/lib/python3.6/site-packages (from tensorboard->keras-tuner<1.1,>=1.0.2->autokeras) (0.4.6)\n", "Requirement already satisfied: werkzeug>=0.11.15 in /home/jovyan/.local/lib/python3.6/site-packages (from tensorboard->keras-tuner<1.1,>=1.0.2->autokeras) (2.0.3)\n", "Requirement already satisfied: charset-normalizer~=2.0.0 in /usr/local/lib/python3.6/dist-packages (from requests->keras-tuner<1.1,>=1.0.2->autokeras) (2.0.10)\n", "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.6/dist-packages (from requests->keras-tuner<1.1,>=1.0.2->autokeras) (1.26.8)\n", "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.6/dist-packages (from requests->keras-tuner<1.1,>=1.0.2->autokeras) (3.3)\n", "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/dist-packages (from requests->keras-tuner<1.1,>=1.0.2->autokeras) (2021.10.8)\n", "Requirement already satisfied: traitlets>=4.2 in /usr/local/lib/python3.6/dist-packages (from ipython->keras-tuner<1.1,>=1.0.2->autokeras) (4.3.3)\n", "Requirement already satisfied: jedi<=0.17.2,>=0.10 in /usr/local/lib/python3.6/dist-packages (from ipython->keras-tuner<1.1,>=1.0.2->autokeras) (0.17.2)\n", "Requirement already satisfied: pexpect in /usr/local/lib/python3.6/dist-packages (from ipython->keras-tuner<1.1,>=1.0.2->autokeras) (4.8.0)\n", "Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /usr/local/lib/python3.6/dist-packages (from ipython->keras-tuner<1.1,>=1.0.2->autokeras) (3.0.24)\n", "Requirement already satisfied: pickleshare in /usr/local/lib/python3.6/dist-packages (from ipython->keras-tuner<1.1,>=1.0.2->autokeras) (0.7.5)\n", "Requirement already satisfied: pygments in /usr/local/lib/python3.6/dist-packages (from ipython->keras-tuner<1.1,>=1.0.2->autokeras) (2.11.2)\n", "Requirement already satisfied: decorator in /usr/local/lib/python3.6/dist-packages (from ipython->keras-tuner<1.1,>=1.0.2->autokeras) (4.4.2)\n", "Requirement already satisfied: backcall in /usr/local/lib/python3.6/dist-packages (from ipython->keras-tuner<1.1,>=1.0.2->autokeras) (0.2.0)\n", "Requirement already satisfied: cachetools<5.0,>=2.0.0 in /usr/local/lib/python3.6/dist-packages (from google-auth<2,>=1.6.3->tensorboard->keras-tuner<1.1,>=1.0.2->autokeras) (4.2.4)\n", "Requirement already satisfied: rsa<5,>=3.1.4 in /usr/local/lib/python3.6/dist-packages (from google-auth<2,>=1.6.3->tensorboard->keras-tuner<1.1,>=1.0.2->autokeras) (4.8)\n", "Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/local/lib/python3.6/dist-packages (from google-auth<2,>=1.6.3->tensorboard->keras-tuner<1.1,>=1.0.2->autokeras) (0.2.8)\n", "Requirement already satisfied: requests-oauthlib>=0.7.0 in /usr/local/lib/python3.6/dist-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard->keras-tuner<1.1,>=1.0.2->autokeras) (1.3.0)\n", "Requirement already satisfied: parso<0.8.0,>=0.7.0 in /usr/local/lib/python3.6/dist-packages (from jedi<=0.17.2,>=0.10->ipython->keras-tuner<1.1,>=1.0.2->autokeras) (0.7.1)\n", "Requirement already satisfied: importlib-metadata>=4.4 in /usr/local/lib/python3.6/dist-packages (from markdown>=2.6.8->tensorboard->keras-tuner<1.1,>=1.0.2->autokeras) (4.8.3)\n", "Requirement already satisfied: wcwidth in /usr/local/lib/python3.6/dist-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython->keras-tuner<1.1,>=1.0.2->autokeras) (0.2.5)\n", "Requirement already satisfied: ipython-genutils in /usr/local/lib/python3.6/dist-packages (from traitlets>=4.2->ipython->keras-tuner<1.1,>=1.0.2->autokeras) (0.2.0)\n", "Requirement already satisfied: dataclasses in /usr/local/lib/python3.6/dist-packages (from werkzeug>=0.11.15->tensorboard->keras-tuner<1.1,>=1.0.2->autokeras) (0.8)\n", "Requirement already satisfied: ptyprocess>=0.5 in /usr/local/lib/python3.6/dist-packages (from pexpect->ipython->keras-tuner<1.1,>=1.0.2->autokeras) (0.7.0)\n", "Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.6/dist-packages (from importlib-metadata>=4.4->markdown>=2.6.8->tensorboard->keras-tuner<1.1,>=1.0.2->autokeras) (3.6.0)\n", "Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in /usr/local/lib/python3.6/dist-packages (from pyasn1-modules>=0.2.1->google-auth<2,>=1.6.3->tensorboard->keras-tuner<1.1,>=1.0.2->autokeras) (0.4.8)\n", "Requirement already satisfied: oauthlib>=3.0.0 in /usr/local/lib/python3.6/dist-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard->keras-tuner<1.1,>=1.0.2->autokeras) (3.1.1)\n", "Installing collected packages: grpcio, tensorflow-estimator, kt-legacy, keras-nightly, tensorflow, keras-tuner, autokeras\n", " Attempting uninstall: tensorflow-estimator\n", " Found existing installation: tensorflow-estimator 2.6.0\n", " Uninstalling tensorflow-estimator-2.6.0:\n", " Successfully uninstalled tensorflow-estimator-2.6.0\n", " Attempting uninstall: tensorflow\n", " Found existing installation: tensorflow 2.6.2\n", " Uninstalling tensorflow-2.6.2:\n", " Successfully uninstalled tensorflow-2.6.2\n", "Successfully installed autokeras-1.0.16.post1 grpcio-1.34.1 keras-nightly-2.5.0.dev2021032900 keras-tuner-1.0.4 kt-legacy-1.0.4 tensorflow-2.5.2 tensorflow-estimator-2.5.0\n", "Defaulting to user installation because normal site-packages is not writeable\n", "Collecting kaggle\n", " Downloading kaggle-1.5.12.tar.gz (58 kB)\n", " |████████████████████████████████| 58 kB 6.1 MB/s \n", "\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25ldone\n", "\u001b[?25hRequirement already satisfied: six>=1.10 in /home/jovyan/.local/lib/python3.6/site-packages (from kaggle) (1.15.0)\n", "Requirement already satisfied: certifi in /usr/local/lib/python3.6/dist-packages (from kaggle) (2021.10.8)\n", "Requirement already satisfied: python-dateutil in /usr/local/lib/python3.6/dist-packages (from kaggle) (2.8.2)\n", "Requirement already satisfied: requests in /usr/local/lib/python3.6/dist-packages (from kaggle) (2.27.1)\n", "Collecting tqdm\n", " Downloading tqdm-4.64.0-py2.py3-none-any.whl (78 kB)\n", " |████████████████████████████████| 78 kB 11.0 MB/s \n", "\u001b[?25hCollecting python-slugify\n", " Downloading python_slugify-6.1.2-py2.py3-none-any.whl (9.4 kB)\n", "Requirement already satisfied: urllib3 in /usr/local/lib/python3.6/dist-packages (from kaggle) (1.26.8)\n", "Collecting text-unidecode>=1.3\n", " Downloading text_unidecode-1.3-py2.py3-none-any.whl (78 kB)\n", " |████████████████████████████████| 78 kB 10.2 MB/s \n", "\u001b[?25hRequirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.6/dist-packages (from requests->kaggle) (3.3)\n", "Requirement already satisfied: charset-normalizer~=2.0.0 in /usr/local/lib/python3.6/dist-packages (from requests->kaggle) (2.0.10)\n", "Requirement already satisfied: importlib-resources in /usr/local/lib/python3.6/dist-packages (from tqdm->kaggle) (5.4.0)\n", "Requirement already satisfied: zipp>=3.1.0 in /usr/local/lib/python3.6/dist-packages (from importlib-resources->tqdm->kaggle) (3.6.0)\n", "Building wheels for collected packages: kaggle\n", " Building wheel for kaggle (setup.py) ... \u001b[?25ldone\n", "\u001b[?25h Created wheel for kaggle: filename=kaggle-1.5.12-py3-none-any.whl size=73051 sha256=0f89ab64d8431b01152bfd27ea790c0ce581f08f64e10ecbfd348bcb6822063b\n", " Stored in directory: /home/jovyan/.cache/pip/wheels/77/47/e4/44a4ba1b7dfd53faaa35f59f1175e123b213ff401a8a56876b\n", "Successfully built kaggle\n", "Installing collected packages: text-unidecode, tqdm, python-slugify, kaggle\n", "Successfully installed kaggle-1.5.12 python-slugify-6.1.2 text-unidecode-1.3 tqdm-4.64.0\n" ] } ], "source": [ "!pip install tensorflow\n", "!pip install autokeras\n", "!pip install kaggle" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Downloading training.zip to /home/jovyan/examples-1/facial-keypoints-detection-kaggle-competition/my_data\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "100%|██████████| 60.1M/60.1M [00:00<00:00, 241MB/s]\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\n", "Downloading test.zip to /home/jovyan/examples-1/facial-keypoints-detection-kaggle-competition/my_data\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "100%|██████████| 16.0M/16.0M [00:00<00:00, 130MB/s] " ] }, { "name": "stdout", "output_type": "stream", "text": [ "\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "\n" ] } ], "source": [ "def download_kaggle_dataset(kaggle_user:str, kaggle_key:str, data_set:str, path:str):\n", " import os\n", " import glob\n", " os.environ['KAGGLE_USERNAME'] = kaggle_user \n", " os.environ['KAGGLE_KEY'] = kaggle_key\n", "\n", " import kaggle\n", " from kaggle.api.kaggle_api_extended import KaggleApi\n", " os.chdir(os.getcwd())\n", " os.system(\"mkdir \" + path)\n", " os.chdir(path)\n", " api = KaggleApi()\n", " api.authenticate()\n", " api.competition_download_file('facial-keypoints-detection','training.zip')\n", " api.competition_download_file('facial-keypoints-detection','test.zip')\n", "\n", "\n", "download_kaggle_dataset(\"username\", \"key\", \"facial-keypoints-detection\",\"my_data\")\n", "\n" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import os\n", "from sklearn.utils import shuffle \n", "import matplotlib.pyplot as plt \n", "import tensorflow as tf \n", "import pandas as pd\n", "from tensorflow.keras.models import load_model\n", "import os\n", "import shutil\n", "import argparse\n", "import autokeras as ak\n", "from tensorflow.keras.models import load_model\n", "import autokeras as ak\n", "import pandas as pd\n", "import numpy as np\n" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "trials = 1\n", "epochs = 1\n", "patience = 1" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Trial 1 Complete [00h 01m 05s]\n", "val_loss: 2114.038818359375\n", "\n", "Best val_loss So Far: 2114.038818359375\n", "Total elapsed time: 00h 01m 05s\n", "INFO:tensorflow:Oracle triggered exit\n", "67/67 [==============================] - 67s 902ms/step - loss: 1062.2905 - mean_squared_error: 1062.2905\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "/home/jovyan/.local/lib/python3.6/site-packages/tensorflow/python/keras/utils/generic_utils.py:497: CustomMaskWarning: Custom mask layers require a config and must override get_config. When loading, the custom mask layer must be passed to the custom_objects argument.\n", " category=CustomMaskWarning)\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "INFO:tensorflow:Assets written to: ./image_regressor/best_model/assets\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "/home/jovyan/.local/lib/python3.6/site-packages/tensorflow/python/keras/utils/generic_utils.py:497: CustomMaskWarning: Custom mask layers require a config and must override get_config. When loading, the custom mask layer must be passed to the custom_objects argument.\n", " category=CustomMaskWarning)\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "INFO:tensorflow:Assets written to: data/model_autokeras/assets\n" ] } ], "source": [ "\n", "\n", "project=\"Facial-keypoints\"\n", "run_id= \"1.8\"\n", "resume_run = True\n", "\n", "MAX_TRIALS=int(trials)\n", "EPOCHS=int(epochs)\n", "PATIENCE=int(patience)\n", "\n", "### Data Extraction : extract data and save to attached extenal pvc at location /data ###\n", "\n", "train_dir_zip='training.zip'\n", "test_dir_zip='test.zip'\n", "\n", "from zipfile import ZipFile\n", "with ZipFile(train_dir_zip,'r') as zipObj:\n", " zipObj.extractall('data')\n", " print(\"Train Archive unzipped\")\n", "with ZipFile(test_dir_zip,'r') as zipObj:\n", " zipObj.extractall('data')\n", " print(\"Test Archive unzipped\")\n", "\n", "\n", "## Data preprocess \n", "\n", "train_dir='data/training.csv'\n", "test_dir='data/test.csv'\n", "train=pd.read_csv(train_dir)\n", "test=pd.read_csv(test_dir)\n", "\n", "train=train.dropna()\n", "train=train.reset_index(drop=True)\n", "\n", "X_train=[]\n", "Y_train=[]\n", "\n", "for img in train['Image']:\n", " X_train.append(np.asarray(img.split(),dtype=float).reshape(96,96,1))\n", "X_train=np.reshape(X_train,(-1,96,96,1))\n", "X_train = np.asarray(X_train).astype('float32')\n", " \n", "for i in range(len((train))): \n", " Y_train.append(np.asarray(train.iloc[i][0:30].to_numpy()))\n", "Y_train = np.asarray(Y_train).astype('float32')\n", "\n", "## Data training\n", "\n", "reg = ak.ImageRegressor(max_trials=MAX_TRIALS)\n", "reg.fit(X_train, Y_train, validation_split=0.15, epochs=EPOCHS)\n", "\n", "# Export trained model to externally attached pvc \n", "my_model = reg.export_model()\n", "my_model.save('data/model_autokeras', save_format=\"tf\")\n" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Model: \"model\"\n", "__________________________________________________________________________________________________\n", "Layer (type) Output Shape Param # Connected to \n", "==================================================================================================\n", "input_1 (InputLayer) [(None, 96, 96, 1)] 0 \n", "__________________________________________________________________________________________________\n", "cast_to_float32 (CastToFloat32) (None, 96, 96, 1) 0 input_1[0][0] \n", "__________________________________________________________________________________________________\n", "concatenate (Concatenate) (None, 96, 96, 3) 0 cast_to_float32[0][0] \n", " cast_to_float32[0][0] \n", " cast_to_float32[0][0] \n", "__________________________________________________________________________________________________\n", "resnet50 (Functional) (None, 3, 3, 2048) 23587712 concatenate[0][0] \n", "__________________________________________________________________________________________________\n", "flatten (Flatten) (None, 18432) 0 resnet50[0][0] \n", "__________________________________________________________________________________________________\n", "regression_head_1 (Dense) (None, 30) 552990 flatten[0][0] \n", "==================================================================================================\n", "Total params: 24,140,702\n", "Trainable params: 24,087,582\n", "Non-trainable params: 53,120\n", "__________________________________________________________________________________________________\n", "None\n" ] } ], "source": [ "\n", "### Load model \n", "loaded_model = load_model(\"data/model_autokeras\", custom_objects=ak.CUSTOM_OBJECTS)\n", "\n", "### Pint model summary\n", "print(loaded_model.summary())\n", "\n", "test_dir='data/test.csv'\n", "test=pd.read_csv(test_dir)\n", "\n", "X_test=[]\n", "for img in test['Image']:\n", " X_test.append(np.asarray(img.split(),dtype=float).reshape(96,96,1))\n", "X_test=np.reshape(X_test,(-1,96,96,1))\n", "X_test = np.asarray(X_test).astype('float32')\n", "\n", "### predict \n", "y_pred = loaded_model.predict(X_test)\n", "\n", "### Create submission file\n", "y_pred= y_pred.reshape(-1,)\n", "submission = pd.DataFrame({'Location': y_pred})\n", "submission.to_csv('data/submission.csv', index=True , index_label='RowId')\n" ] }, { "cell_type": "markdown", "metadata": { "tags": [] }, "source": [ "### Submission file is exported to location\n", "\n", "```\n", "/home/jovyan/examples-1/facial-keypoints-detection-kaggle-competition/my_data/data/submission.csv\n", "```" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "kubeflow_notebook": { "autosnapshot": false, "docker_image": "gcr.io/arrikto/jupyter-kale-py36@sha256:dd3f92ca66b46d247e4b9b6a9d84ffbb368646263c2e3909473c3b851f3fe198", "experiment": { "id": "c2268016-e4ff-4bea-8fc3-9b7ee1e56a25", "name": "Kale-pipelines" }, "experiment_name": "Kale-pipelines", "katib_metadata": { "algorithm": { "algorithmName": "grid" }, "maxFailedTrialCount": 3, "maxTrialCount": 12, "objective": { "objectiveMetricName": "", "type": "minimize" }, "parallelTrialCount": 3, "parameters": [] }, "katib_run": false, "pipeline_description": "converted facial keypoint detection to pipeline", "pipeline_name": "kale-pipeline", "snapshot_volumes": true, "steps_defaults": [ "label:access-ml-pipeline:true", "label:access-rok:true" ], "volume_access_mode": "rwm", "volumes": [ { "annotations": [], "mount_point": "/home/jovyan", "name": "test-face-keypoint-workspace-54wqj", "size": 5, "size_type": "Gi", "snapshot": false, "type": "clone" } ] }, "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.6.9" } }, "nbformat": 4, "nbformat_minor": 4 }