diff --git a/docs/tutorials/Quantum_with_6G_Technology_in_Computer_Vision_on_AI.ipynb b/docs/tutorials/Quantum_with_6G_Technology_in_Computer_Vision_on_AI.ipynb new file mode 100644 index 000000000..f2259d4f4 --- /dev/null +++ b/docs/tutorials/Quantum_with_6G_Technology_in_Computer_Vision_on_AI.ipynb @@ -0,0 +1,1253 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "xLOXFOT5Q40E" + }, + "source": [ + "##### Copyright 2022 The Emirhan BULUT.\n", + "# Quantum with 6G Technology in Computer Vision on AI\n", + "**Author:** [Emirhan BULUT](https://www.linkedin.com/in/artificialintelligencebulut/)
\n", + "**Date created:** 2022/10/31
\n", + "**Last modified:** 2022/10/31
\n", + "**Description:** Processed with 2nd class land use image datasets accompanied by quantum neural network in a manner compatible with 6G with quantum computer and compared with CNN (at close parameters)." + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "i9Jcnb8bQQyd" + }, + "source": [ + "\n", + "\n", + " \n", + " \n", + "
\n", + " Run in Google Colab\n", + " \n", + " View source on GitHub\n", + "
" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "udLObUVeGfTs" + }, + "source": [ + "It is the algorithmic form of Quantum Neural Network designed according to 6G technology. I have been researching about Quantum Computing + 6G technology for about 2 years. In this software (in a notebook), I processed it with 2nd class land use image datasets accompanied by quantum neural network in a manner compatible with 6G with quantum computer and compared it with CNN (at close parameters). The main purpose of this software is to prove that artificial intelligence has now risen to an advanced (Quantum6) state." + ] + }, + { + "cell_type": "markdown", + "source": [ + "## Download and Unzip Data" + ], + "metadata": { + "id": "5F6MksIHXe3X" + } + }, + { + "cell_type": "code", + "source": [ + "!git clone https://github.com/emirhanai/Quantum-with-6G-Technology-in-Computer-Vision-on-AI.git" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "qkldmPE5WDAS", + "outputId": "9b88e7dc-9e84-47db-881b-d01f98aafded" + }, + "execution_count": 53, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Cloning into 'Quantum-with-6G-Technology-in-Computer-Vision-on-AI'...\n", + "remote: Enumerating objects: 8, done.\u001b[K\n", + "remote: Counting objects: 100% (8/8), done.\u001b[K\n", + "remote: Compressing objects: 100% (8/8), done.\u001b[K\n", + "remote: Total 8 (delta 1), reused 0 (delta 0), pack-reused 0\u001b[K\n", + "Unpacking objects: 100% (8/8), done.\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "!unzip \"/content/Quantum-with-6G-Technology-in-Computer-Vision-on-AI/datasets_for_quantum6.zip\"" + ], + "metadata": { + "id": "u0FjGHqh5HTQ", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "29a88a96-8c16-48a5-e5d8-0a3cee795c34" + }, + "execution_count": 54, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Archive: /content/Quantum-with-6G-Technology-in-Computer-Vision-on-AI/datasets_for_quantum6.zip\n", + " creating: quantum/\n", + " creating: quantum/first class/\n", + " inflating: quantum/first class/first class - Copy (2).png \n", + " inflating: quantum/first class/first class - Copy (3).png \n", + " inflating: quantum/first class/first class - Copy (4).png \n", + " inflating: quantum/first class/first class - Copy (5).png \n", + " inflating: quantum/first class/first class - Copy (6).png \n", + " inflating: quantum/first class/first class - Copy (7).png \n", + " inflating: quantum/first class/first class - Copy (8).png \n", + " inflating: quantum/first class/first class - Copy (9).png \n", + " inflating: quantum/first class/first class - Copy.png \n", + " inflating: quantum/first class/first class.png \n", + " creating: quantum/second class/\n", + " inflating: quantum/second class/second class - Copy (2).png \n", + " inflating: quantum/second class/second class - Copy (3).png \n", + " inflating: quantum/second class/second class - Copy (4).png \n", + " inflating: quantum/second class/second class - Copy (5).png \n", + " inflating: quantum/second class/second class - Copy (6).png \n", + " inflating: quantum/second class/second class - Copy (7).png \n", + " inflating: quantum/second class/second class - Copy (8).png \n", + " inflating: quantum/second class/second class - Copy (9).png \n", + " inflating: quantum/second class/second class - Copy.png \n", + " inflating: quantum/second class/second class.png \n" + ] + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "X35qHdh5Gzqg" + }, + "source": [ + "## Setup" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "id": "TorxE5tnkvb2", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "ee92cb97-4440-4aa7-f0cb-5d8750ec8dd0" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n", + "Collecting tensorflow==2.7.0\n", + " Downloading https://us-python.pkg.dev/colab-wheels/public/tensorflow/tensorflow-2.7.0%2Bzzzcolab20220506150900-cp37-cp37m-linux_x86_64.whl (665.5 MB)\n", + "\u001b[K |████████████████████████████████| 665.5 MB 23 kB/s \n", + "\u001b[?25hRequirement already satisfied: protobuf>=3.9.2 in /usr/local/lib/python3.7/dist-packages (from tensorflow==2.7.0) (3.17.3)\n", + "Requirement already satisfied: flatbuffers<3.0,>=1.12 in /usr/local/lib/python3.7/dist-packages (from tensorflow==2.7.0) (1.12)\n", + "Requirement already satisfied: libclang>=9.0.1 in /usr/local/lib/python3.7/dist-packages (from tensorflow==2.7.0) (14.0.6)\n", + "Requirement already satisfied: gast<0.5.0,>=0.2.1 in /usr/local/lib/python3.7/dist-packages (from tensorflow==2.7.0) (0.4.0)\n", + "Requirement already satisfied: typing-extensions>=3.6.6 in /usr/local/lib/python3.7/dist-packages (from tensorflow==2.7.0) (4.1.1)\n", + "Requirement already satisfied: opt-einsum>=2.3.2 in /usr/local/lib/python3.7/dist-packages (from tensorflow==2.7.0) (3.3.0)\n", + "Requirement already satisfied: six>=1.12.0 in /usr/local/lib/python3.7/dist-packages (from tensorflow==2.7.0) (1.15.0)\n", + "Requirement already satisfied: tensorflow-io-gcs-filesystem>=0.21.0 in /usr/local/lib/python3.7/dist-packages (from tensorflow==2.7.0) (0.27.0)\n", + "Requirement already satisfied: wrapt>=1.11.0 in /usr/local/lib/python3.7/dist-packages (from tensorflow==2.7.0) (1.14.1)\n", + "Requirement already satisfied: tensorboard~=2.6 in /usr/local/lib/python3.7/dist-packages (from tensorflow==2.7.0) (2.9.1)\n", + "Requirement already satisfied: absl-py>=0.4.0 in /usr/local/lib/python3.7/dist-packages (from tensorflow==2.7.0) (1.3.0)\n", + "Requirement already satisfied: numpy>=1.14.5 in /usr/local/lib/python3.7/dist-packages (from tensorflow==2.7.0) (1.21.6)\n", + "Requirement already satisfied: astunparse>=1.6.0 in /usr/local/lib/python3.7/dist-packages (from tensorflow==2.7.0) (1.6.3)\n", + "Requirement already satisfied: h5py>=2.9.0 in /usr/local/lib/python3.7/dist-packages (from tensorflow==2.7.0) (3.1.0)\n", + "Requirement already satisfied: wheel<1.0,>=0.32.0 in /usr/local/lib/python3.7/dist-packages (from tensorflow==2.7.0) (0.37.1)\n", + "Requirement already satisfied: google-pasta>=0.1.1 in /usr/local/lib/python3.7/dist-packages (from tensorflow==2.7.0) (0.2.0)\n", + "Requirement already satisfied: termcolor>=1.1.0 in /usr/local/lib/python3.7/dist-packages (from tensorflow==2.7.0) (2.0.1)\n", + "Collecting keras<2.8,>=2.7.0rc0\n", + " Downloading keras-2.7.0-py2.py3-none-any.whl (1.3 MB)\n", + "\u001b[K |████████████████████████████████| 1.3 MB 32.2 MB/s \n", + "\u001b[?25hRequirement already satisfied: grpcio<2.0,>=1.24.3 in /usr/local/lib/python3.7/dist-packages (from tensorflow==2.7.0) (1.50.0)\n", + "Requirement already satisfied: keras-preprocessing>=1.1.1 in /usr/local/lib/python3.7/dist-packages (from tensorflow==2.7.0) (1.1.2)\n", + "Collecting tensorflow-estimator<2.8,~=2.7.0rc0\n", + " Downloading tensorflow_estimator-2.7.0-py2.py3-none-any.whl (463 kB)\n", + "\u001b[K |████████████████████████████████| 463 kB 74.3 MB/s \n", + "\u001b[?25hRequirement already satisfied: cached-property in /usr/local/lib/python3.7/dist-packages (from h5py>=2.9.0->tensorflow==2.7.0) (1.5.2)\n", + "Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in /usr/local/lib/python3.7/dist-packages (from tensorboard~=2.6->tensorflow==2.7.0) (0.4.6)\n", + "Requirement already satisfied: google-auth<3,>=1.6.3 in /usr/local/lib/python3.7/dist-packages (from tensorboard~=2.6->tensorflow==2.7.0) (1.35.0)\n", + "Requirement already satisfied: requests<3,>=2.21.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard~=2.6->tensorflow==2.7.0) (2.23.0)\n", + "Requirement already satisfied: tensorboard-plugin-wit>=1.6.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard~=2.6->tensorflow==2.7.0) (1.8.1)\n", + "Requirement already satisfied: markdown>=2.6.8 in /usr/local/lib/python3.7/dist-packages (from tensorboard~=2.6->tensorflow==2.7.0) (3.4.1)\n", + "Requirement already satisfied: tensorboard-data-server<0.7.0,>=0.6.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard~=2.6->tensorflow==2.7.0) (0.6.1)\n", + "Requirement already satisfied: werkzeug>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from tensorboard~=2.6->tensorflow==2.7.0) (1.0.1)\n", + "Requirement already satisfied: setuptools>=41.0.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard~=2.6->tensorflow==2.7.0) (57.4.0)\n", + "Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/local/lib/python3.7/dist-packages (from google-auth<3,>=1.6.3->tensorboard~=2.6->tensorflow==2.7.0) (0.2.8)\n", + "Requirement already satisfied: rsa<5,>=3.1.4 in /usr/local/lib/python3.7/dist-packages (from google-auth<3,>=1.6.3->tensorboard~=2.6->tensorflow==2.7.0) (4.9)\n", + "Requirement already satisfied: cachetools<5.0,>=2.0.0 in /usr/local/lib/python3.7/dist-packages (from google-auth<3,>=1.6.3->tensorboard~=2.6->tensorflow==2.7.0) (4.2.4)\n", + "Requirement already satisfied: requests-oauthlib>=0.7.0 in /usr/local/lib/python3.7/dist-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard~=2.6->tensorflow==2.7.0) (1.3.1)\n", + "Requirement already satisfied: importlib-metadata>=4.4 in /usr/local/lib/python3.7/dist-packages (from markdown>=2.6.8->tensorboard~=2.6->tensorflow==2.7.0) (4.13.0)\n", + "Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.7/dist-packages (from importlib-metadata>=4.4->markdown>=2.6.8->tensorboard~=2.6->tensorflow==2.7.0) (3.10.0)\n", + "Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in /usr/local/lib/python3.7/dist-packages (from pyasn1-modules>=0.2.1->google-auth<3,>=1.6.3->tensorboard~=2.6->tensorflow==2.7.0) (0.4.8)\n", + "Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests<3,>=2.21.0->tensorboard~=2.6->tensorflow==2.7.0) (2.10)\n", + "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests<3,>=2.21.0->tensorboard~=2.6->tensorflow==2.7.0) (2022.9.24)\n", + "Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from requests<3,>=2.21.0->tensorboard~=2.6->tensorflow==2.7.0) (3.0.4)\n", + "Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests<3,>=2.21.0->tensorboard~=2.6->tensorflow==2.7.0) (1.24.3)\n", + "Requirement already satisfied: oauthlib>=3.0.0 in /usr/local/lib/python3.7/dist-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard~=2.6->tensorflow==2.7.0) (3.2.2)\n", + "Installing collected packages: tensorflow-estimator, keras, tensorflow\n", + " Attempting uninstall: tensorflow-estimator\n", + " Found existing installation: tensorflow-estimator 2.9.0\n", + " Uninstalling tensorflow-estimator-2.9.0:\n", + " Successfully uninstalled tensorflow-estimator-2.9.0\n", + " Attempting uninstall: keras\n", + " Found existing installation: keras 2.9.0\n", + " Uninstalling keras-2.9.0:\n", + " Successfully uninstalled keras-2.9.0\n", + " Attempting uninstall: tensorflow\n", + " Found existing installation: tensorflow 2.9.2\n", + " Uninstalling tensorflow-2.9.2:\n", + " Successfully uninstalled tensorflow-2.9.2\n", + "Successfully installed keras-2.7.0 tensorflow-2.7.0+zzzcolab20220506150900 tensorflow-estimator-2.7.0\n" + ] + } + ], + "source": [ + "!pip install tensorflow==2.7.0" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "FxkQA6oblNqI" + }, + "source": [ + "Install TensorFlow Quantum Library:" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "id": "saFHsRDpkvkH", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 1000 + }, + "outputId": "8894214a-8277-4558-a933-d9faf11488c8" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n", + "Collecting tensorflow-quantum==0.7.2\n", + " Downloading tensorflow_quantum-0.7.2-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (10.5 MB)\n", + "\u001b[K |████████████████████████████████| 10.5 MB 23.5 MB/s \n", + "\u001b[?25hRequirement already satisfied: protobuf==3.17.3 in /usr/local/lib/python3.7/dist-packages (from tensorflow-quantum==0.7.2) (3.17.3)\n", + "Collecting cirq-google>=0.13.1\n", + " Downloading cirq_google-1.0.0-py3-none-any.whl (576 kB)\n", + "\u001b[K |████████████████████████████████| 576 kB 67.3 MB/s \n", + "\u001b[?25hCollecting cirq-core==0.13.1\n", + " Downloading cirq_core-0.13.1-py3-none-any.whl (1.6 MB)\n", + "\u001b[K |████████████████████████████████| 1.6 MB 53.7 MB/s \n", + "\u001b[?25hCollecting google-api-core==1.21.0\n", + " Downloading google_api_core-1.21.0-py2.py3-none-any.whl (90 kB)\n", + "\u001b[K |████████████████████████████████| 90 kB 10.3 MB/s \n", + "\u001b[?25hCollecting googleapis-common-protos==1.52.0\n", + " Downloading googleapis_common_protos-1.52.0-py2.py3-none-any.whl (100 kB)\n", + "\u001b[K |████████████████████████████████| 100 kB 6.9 MB/s \n", + "\u001b[?25hCollecting sympy==1.8\n", + " Downloading sympy-1.8-py3-none-any.whl (6.1 MB)\n", + "\u001b[K |████████████████████████████████| 6.1 MB 22.9 MB/s \n", + "\u001b[?25hCollecting google-auth==1.18.0\n", + " Downloading google_auth-1.18.0-py2.py3-none-any.whl (90 kB)\n", + "\u001b[K |████████████████████████████████| 90 kB 8.9 MB/s \n", + "\u001b[?25hRequirement already satisfied: networkx~=2.4 in /usr/local/lib/python3.7/dist-packages (from cirq-core==0.13.1->tensorflow-quantum==0.7.2) (2.6.3)\n", + "Collecting duet~=0.2.0\n", + " Downloading duet-0.2.7-py3-none-any.whl (28 kB)\n", + "Requirement already satisfied: typing-extensions in /usr/local/lib/python3.7/dist-packages (from cirq-core==0.13.1->tensorflow-quantum==0.7.2) (4.1.1)\n", + "Requirement already satisfied: pandas in /usr/local/lib/python3.7/dist-packages (from cirq-core==0.13.1->tensorflow-quantum==0.7.2) (1.3.5)\n", + "Requirement already satisfied: matplotlib~=3.0 in /usr/local/lib/python3.7/dist-packages (from cirq-core==0.13.1->tensorflow-quantum==0.7.2) (3.2.2)\n", + "Requirement already satisfied: scipy in /usr/local/lib/python3.7/dist-packages (from cirq-core==0.13.1->tensorflow-quantum==0.7.2) (1.7.3)\n", + "Requirement already satisfied: tqdm in /usr/local/lib/python3.7/dist-packages (from cirq-core==0.13.1->tensorflow-quantum==0.7.2) (4.64.1)\n", + "Requirement already satisfied: sortedcontainers~=2.0 in /usr/local/lib/python3.7/dist-packages (from cirq-core==0.13.1->tensorflow-quantum==0.7.2) (2.4.0)\n", + "Requirement already satisfied: numpy~=1.16 in /usr/local/lib/python3.7/dist-packages (from cirq-core==0.13.1->tensorflow-quantum==0.7.2) (1.21.6)\n", + "Requirement already satisfied: setuptools>=34.0.0 in /usr/local/lib/python3.7/dist-packages (from google-api-core==1.21.0->tensorflow-quantum==0.7.2) (57.4.0)\n", + "Requirement already satisfied: six>=1.10.0 in /usr/local/lib/python3.7/dist-packages (from google-api-core==1.21.0->tensorflow-quantum==0.7.2) (1.15.0)\n", + "Requirement already satisfied: pytz in /usr/local/lib/python3.7/dist-packages (from google-api-core==1.21.0->tensorflow-quantum==0.7.2) (2022.5)\n", + "Requirement already satisfied: requests<3.0.0dev,>=2.18.0 in /usr/local/lib/python3.7/dist-packages (from google-api-core==1.21.0->tensorflow-quantum==0.7.2) (2.23.0)\n", + "Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/local/lib/python3.7/dist-packages (from google-auth==1.18.0->tensorflow-quantum==0.7.2) (0.2.8)\n", + "Requirement already satisfied: cachetools<5.0,>=2.0.0 in /usr/local/lib/python3.7/dist-packages (from google-auth==1.18.0->tensorflow-quantum==0.7.2) (4.2.4)\n", + "Requirement already satisfied: rsa<5,>=3.1.4 in /usr/local/lib/python3.7/dist-packages (from google-auth==1.18.0->tensorflow-quantum==0.7.2) (4.9)\n", + "Requirement already satisfied: mpmath>=0.19 in /usr/local/lib/python3.7/dist-packages (from sympy==1.8->tensorflow-quantum==0.7.2) (1.2.1)\n", + "Collecting cirq-google>=0.13.1\n", + " Downloading cirq_google-0.15.0-py3-none-any.whl (641 kB)\n", + "\u001b[K |████████████████████████████████| 641 kB 56.1 MB/s \n", + "\u001b[?25hRequirement already satisfied: google-api-core[grpc]<2.0.0dev,>=1.14.0 in /usr/local/lib/python3.7/dist-packages (from cirq-google>=0.13.1->tensorflow-quantum==0.7.2) (1.31.6)\n", + " Downloading cirq_google-0.14.1-py3-none-any.whl (541 kB)\n", + "\u001b[K |████████████████████████████████| 541 kB 55.6 MB/s \n", + "\u001b[?25h Downloading cirq_google-0.14.0-py3-none-any.whl (541 kB)\n", + "\u001b[K |████████████████████████████████| 541 kB 72.2 MB/s \n", + "\u001b[?25h Downloading cirq_google-0.13.1-py3-none-any.whl (437 kB)\n", + "\u001b[K |████████████████████████████████| 437 kB 62.1 MB/s \n", + "\u001b[?25hCollecting typing-extensions\n", + " Downloading typing_extensions-3.10.0.0-py3-none-any.whl (26 kB)\n", + "Collecting google-api-core[grpc]<2.0.0dev,>=1.14.0\n", + " Downloading google_api_core-1.33.2-py3-none-any.whl (115 kB)\n", + "\u001b[K |████████████████████████████████| 115 kB 62.3 MB/s \n", + "\u001b[?25h Downloading google_api_core-1.33.1-py3-none-any.whl (115 kB)\n", + "\u001b[K |████████████████████████████████| 115 kB 54.3 MB/s \n", + "\u001b[?25h Downloading google_api_core-1.33.0-py3-none-any.whl (115 kB)\n", + "\u001b[K |████████████████████████████████| 115 kB 60.4 MB/s \n", + "\u001b[?25h Downloading google_api_core-1.32.0-py2.py3-none-any.whl (93 kB)\n", + "\u001b[K |████████████████████████████████| 93 kB 1.5 MB/s \n", + "\u001b[?25h Downloading google_api_core-1.31.5-py2.py3-none-any.whl (93 kB)\n", + "\u001b[K |████████████████████████████████| 93 kB 1.7 MB/s \n", + "\u001b[?25h Downloading google_api_core-1.31.4-py2.py3-none-any.whl (93 kB)\n", + "\u001b[K |████████████████████████████████| 93 kB 1.8 MB/s \n", + "\u001b[?25h Downloading google_api_core-1.31.3-py2.py3-none-any.whl (93 kB)\n", + "\u001b[K |████████████████████████████████| 93 kB 889 kB/s \n", + "\u001b[?25h Downloading google_api_core-1.31.2-py2.py3-none-any.whl (93 kB)\n", + "\u001b[K |████████████████████████████████| 93 kB 1.7 MB/s \n", + "\u001b[?25h Downloading google_api_core-1.31.1-py2.py3-none-any.whl (93 kB)\n", + "\u001b[K |████████████████████████████████| 93 kB 1.4 MB/s \n", + "\u001b[?25h Downloading google_api_core-1.31.0-py2.py3-none-any.whl (93 kB)\n", + "\u001b[K |████████████████████████████████| 93 kB 769 kB/s \n", + "\u001b[?25h Downloading google_api_core-1.30.0-py2.py3-none-any.whl (93 kB)\n", + "\u001b[K |████████████████████████████████| 93 kB 782 kB/s \n", + "\u001b[?25h Downloading google_api_core-1.29.0-py2.py3-none-any.whl (93 kB)\n", + "\u001b[K |████████████████████████████████| 93 kB 1.3 MB/s \n", + "\u001b[?25h Downloading google_api_core-1.28.0-py2.py3-none-any.whl (92 kB)\n", + "\u001b[K |████████████████████████████████| 92 kB 1.2 MB/s \n", + "\u001b[?25h Downloading google_api_core-1.27.0-py2.py3-none-any.whl (93 kB)\n", + "\u001b[K |████████████████████████████████| 93 kB 522 kB/s \n", + "\u001b[?25h Downloading google_api_core-1.26.3-py2.py3-none-any.whl (93 kB)\n", + "\u001b[K |████████████████████████████████| 93 kB 1.2 MB/s \n", + "\u001b[?25h Downloading google_api_core-1.26.2-py2.py3-none-any.whl (93 kB)\n", + "\u001b[K |████████████████████████████████| 93 kB 1.4 MB/s \n", + "\u001b[?25h Downloading google_api_core-1.26.1-py2.py3-none-any.whl (92 kB)\n", + "\u001b[K |████████████████████████████████| 92 kB 491 kB/s \n", + "\u001b[?25h Downloading google_api_core-1.26.0-py2.py3-none-any.whl (92 kB)\n", + "\u001b[K |████████████████████████████████| 92 kB 748 kB/s \n", + "\u001b[?25h Downloading google_api_core-1.25.1-py2.py3-none-any.whl (92 kB)\n", + "\u001b[K |████████████████████████████████| 92 kB 279 kB/s \n", + "\u001b[?25h Downloading google_api_core-1.25.0-py2.py3-none-any.whl (92 kB)\n", + "\u001b[K |████████████████████████████████| 92 kB 189 kB/s \n", + "\u001b[?25h Downloading google_api_core-1.24.1-py2.py3-none-any.whl (92 kB)\n", + "\u001b[K |████████████████████████████████| 92 kB 4.3 MB/s \n", + "\u001b[?25h Downloading google_api_core-1.24.0-py2.py3-none-any.whl (91 kB)\n", + "\u001b[K |████████████████████████████████| 91 kB 12.1 MB/s \n", + "\u001b[?25h Downloading google_api_core-1.23.0-py2.py3-none-any.whl (91 kB)\n", + "\u001b[K |████████████████████████████████| 91 kB 9.9 MB/s \n", + "\u001b[?25h Downloading google_api_core-1.22.4-py2.py3-none-any.whl (91 kB)\n", + "\u001b[K |████████████████████████████████| 91 kB 3.4 MB/s \n", + "\u001b[?25h Downloading google_api_core-1.22.3-py2.py3-none-any.whl (91 kB)\n", + "\u001b[K |████████████████████████████████| 91 kB 10.4 MB/s \n", + "\u001b[?25h Downloading google_api_core-1.22.2-py2.py3-none-any.whl (91 kB)\n", + "\u001b[K |████████████████████████████████| 91 kB 10.8 MB/s \n", + "\u001b[?25h Downloading google_api_core-1.22.1-py2.py3-none-any.whl (91 kB)\n", + "\u001b[K |████████████████████████████████| 91 kB 9.7 MB/s \n", + "\u001b[?25h Downloading google_api_core-1.22.0-py2.py3-none-any.whl (91 kB)\n", + "\u001b[K |████████████████████████████████| 91 kB 8.8 MB/s \n", + "\u001b[?25hRequirement already satisfied: grpcio<2.0dev,>=1.29.0 in /usr/local/lib/python3.7/dist-packages (from google-api-core==1.21.0->tensorflow-quantum==0.7.2) (1.50.0)\n", + "Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib~=3.0->cirq-core==0.13.1->tensorflow-quantum==0.7.2) (1.4.4)\n", + "Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib~=3.0->cirq-core==0.13.1->tensorflow-quantum==0.7.2) (2.8.2)\n", + "Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib~=3.0->cirq-core==0.13.1->tensorflow-quantum==0.7.2) (3.0.9)\n", + "Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.7/dist-packages (from matplotlib~=3.0->cirq-core==0.13.1->tensorflow-quantum==0.7.2) (0.11.0)\n", + "Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in /usr/local/lib/python3.7/dist-packages (from pyasn1-modules>=0.2.1->google-auth==1.18.0->tensorflow-quantum==0.7.2) (0.4.8)\n", + "Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests<3.0.0dev,>=2.18.0->google-api-core==1.21.0->tensorflow-quantum==0.7.2) (1.24.3)\n", + "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests<3.0.0dev,>=2.18.0->google-api-core==1.21.0->tensorflow-quantum==0.7.2) (2022.9.24)\n", + "Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests<3.0.0dev,>=2.18.0->google-api-core==1.21.0->tensorflow-quantum==0.7.2) (2.10)\n", + "Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from requests<3.0.0dev,>=2.18.0->google-api-core==1.21.0->tensorflow-quantum==0.7.2) (3.0.4)\n", + "Installing collected packages: typing-extensions, googleapis-common-protos, google-auth, sympy, google-api-core, duet, cirq-core, cirq-google, tensorflow-quantum\n", + " Attempting uninstall: typing-extensions\n", + " Found existing installation: typing-extensions 4.1.1\n", + " Uninstalling typing-extensions-4.1.1:\n", + " Successfully uninstalled typing-extensions-4.1.1\n", + " Attempting uninstall: googleapis-common-protos\n", + " Found existing installation: googleapis-common-protos 1.56.4\n", + " Uninstalling googleapis-common-protos-1.56.4:\n", + " Successfully uninstalled googleapis-common-protos-1.56.4\n", + " Attempting uninstall: google-auth\n", + " Found existing installation: google-auth 1.35.0\n", + " Uninstalling google-auth-1.35.0:\n", + " Successfully uninstalled google-auth-1.35.0\n", + " Attempting uninstall: sympy\n", + " Found existing installation: sympy 1.7.1\n", + " Uninstalling sympy-1.7.1:\n", + " Successfully uninstalled sympy-1.7.1\n", + " Attempting uninstall: google-api-core\n", + " Found existing installation: google-api-core 1.31.6\n", + " Uninstalling google-api-core-1.31.6:\n", + " Successfully uninstalled google-api-core-1.31.6\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", + "pydata-google-auth 1.4.0 requires google-auth<3.0dev,>=1.25.0; python_version >= \"3.6\", but you have google-auth 1.18.0 which is incompatible.\n", + "pydantic 1.10.2 requires typing-extensions>=4.1.0, but you have typing-extensions 3.10.0.0 which is incompatible.\n", + "google-cloud-bigquery-storage 1.1.2 requires google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0,<3.0.0dev,>=1.31.5, but you have google-api-core 1.21.0 which is incompatible.\u001b[0m\n", + "Successfully installed cirq-core-0.13.1 cirq-google-0.13.1 duet-0.2.7 google-api-core-1.21.0 google-auth-1.18.0 googleapis-common-protos-1.52.0 sympy-1.8 tensorflow-quantum-0.7.2 typing-extensions-3.10.0.0\n" + ] + }, + { + "output_type": "display_data", + "data": { + "application/vnd.colab-display-data+json": { + "pip_warning": { + "packages": [ + "google", + "typing_extensions" + ] + } + } + }, + "metadata": {} + } + ], + "source": [ + "!pip install tensorflow-quantum==0.7.2" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "hdgMMZEBGqyl" + }, + "source": [ + "Now import TensorFlow, Keras and the module dependencies:" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "id": "enZ300Bflq80" + }, + "outputs": [], + "source": [ + "import tensorflow as tf\n", + "import tensorflow_quantum as tfq\n", + "import keras\n", + "from sklearn.preprocessing import LabelEncoder\n", + "\n", + "import cirq\n", + "import sympy\n", + "import numpy as np\n", + "import seaborn as sns\n", + "import collections\n", + "import pandas as pd\n", + "\n", + "from sklearn.model_selection import train_test_split\n", + "# visualization tools\n", + "%matplotlib inline\n", + "import matplotlib.pyplot as plt\n", + "from cirq.contrib.svg import SVGCircuit" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "pDUdGxn-ojgy" + }, + "source": [ + "### A. Data Preparation\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "xZyGXlaKojgz" + }, + "source": [ + "We will pull the ImageDataGenerator function from the Keras library to convert the images extracted from the zip format into mathematical array to make them ready for processing." + ] + }, + { + "cell_type": "code", + "execution_count": 55, + "metadata": { + "id": "d9OSExvCojg0", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "e5e3e8d2-c809-4101-da4a-4fa623df0197" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Found 20 images belonging to 2 classes.\n" + ] + } + ], + "source": [ + "from keras.preprocessing.image import ImageDataGenerator\n", + "# We prepare of data\n", + "train_datagen = ImageDataGenerator(\n", + " featurewise_center=False, samplewise_center=False, rescale=1.0/255.0, preprocessing_function=None, data_format=None, dtype=None)\n", + "\n", + "train_generator = train_datagen.flow_from_directory(\"/content/quantum\",target_size=(4,4), batch_size=128, class_mode='categorical', interpolation=\"lanczos\", color_mode=\"grayscale\")" + ] + }, + { + "cell_type": "code", + "source": [ + "#from keras_image_generator type to numpy array\n", + "x=np.concatenate([train_generator.next()[0] for i in range(train_generator.__len__())])\n", + "y=np.concatenate([train_generator.next()[1] for i in range(train_generator.__len__())])" + ], + "metadata": { + "id": "nkQCq-h3ZV9T" + }, + "execution_count": 7, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "#Split of data to x_train, x_test, y_train, y_test\n", + "x_train, x_test, y_train, y_test = train_test_split(x,y,test_size=0.2,shuffle=True)" + ], + "metadata": { + "id": "GPbz0LmKZQyN" + }, + "execution_count": 8, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "3wyiaP0Xojg_" + }, + "source": [ + "Show the first example:" + ] + }, + { + "cell_type": "code", + "source": [ + "x_train.shape" + ], + "metadata": { + "id": "HULkeM715Y-J", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "82a071f7-2b76-4124-e403-e3d8afade618" + }, + "execution_count": 9, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "(16, 4, 4, 1)" + ] + }, + "metadata": {}, + "execution_count": 9 + } + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "id": "j5STP7MbojhA", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 304 + }, + "outputId": "f60f1f9b-6622-497d-e0b3-8570509665df" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "[0. 1.]\n" + ] + }, + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "" + ] + }, + "metadata": {}, + "execution_count": 10 + }, + { + "output_type": "display_data", + "data": { + "text/plain": [ + "
" + ], + "image/png": "iVBORw0KGgoAAAANSUhEUgAAATkAAAD8CAYAAAAMs9NCAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAU0UlEQVR4nO3df4xmVX3H8feHZQHFHyhLZbssPxrWVooKOkENSUsF6kLMYiIqNFUw4LZGFKs1QW2w0n+0TW1ioeJGCGAsPwpqp3bNFhWDtgI7ICC7CE5plMWtKwsCG2RhZj79496ljw/PzHOXe2efO3c+r+Rm748z55zJZr977vlxj2wTEdFVe426AhER8ylBLiI6LUEuIjotQS4iOi1BLiI6LUEuIjqtVpCT9HJJN0r6Sfnny2ZJNy3pzvIYr1NmRHSXpMslbZN0zyzPJenzkiYl3S3pdcPyrNuSuwD4tu1VwLfL60F+bfuY8lhTs8yI6K4rgNVzPD8FWFUea4EvDMuwbpA7DbiyPL8SeFvN/CJiEbN9M/DIHElOA65y4RbgAEnL58pz75p1eoXtreX5/wKvmCXdfpImgCngM7a/PiiRpLUU0Zn9X6jX/96R+9SsXkTM5fa7dz5s+6A6ebzlj/b39kemq5a3CXiq59Y62+t2o7gVwIM911vKe1sHJ68Q5CR9Czh4wKNP9l7YtqTZ1ogdZvshSb8DfEfSj2z/d3+i8pddBzD22v1824aVw6oXETUsWT7507p5bH9kmts2HFqxvJ88ZXusbpm7Y2iQs33SbM8k/ULScttbyybjtlnyeKj88wFJ3wWOBZ4T5CJi4TEww8yeKu4hoLf1c0h5b1Z1++TGgbPK87OAf+1PIOllkvYtz5cBxwOba5YbES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I6LwWTyFpYreu/STdJukuSZskfXpAmrMl/VLSneVxbt1yI6IdDHjGlY5RaKIltxN4s+0dkpYC35f0Tdu39KW71vZ5DZQXEW3ijn80s9w/dUd5ubQ82vuCHhGN6/zAQ7nn6u3AkcAltm8dkOztkv4AuB/4C9sPDshnLbC2vNyxZPnkfU3Ur6JlwMN7sLw9Jb/XwrMnf7fD6mbwBI9u+JavX1Yx+R7/O1OTG9lLOgD4GvBB2/f03D8Q2GF7p6Q/A95l+82NFdwASRO2x0Zdj6bl91p4uvy7jULtgYdetn8F3ASs7ru/3fbO8vJLwOubLDciYjZNjK4eVLbgkPQC4GTgx31plvdcrgHurVtuREQVTfTJLQeuLPvl9gKus/0NSRcBE7bHgQ9JWgNMAY8AZzdQbtPWjboC8yS/18LT5d9tj2u0Ty4iom0a7ZOLiGibBLmI6LRFH+QkrZZ0n6RJSReMuj5NkXS5pG2S7hmeeuGQtFLSTZI2l8sIzx91nZpQZXlkPD+Luk+uHCy5n2JEeAuwETjT9uaRVqwB5cTrHcBVto8edX2aUo7UL7d9h6QXU0xCf9tC/zuTJGD/3uWRwPkDlkfGblrsLbnjgEnbD9h+GrgGOG3EdWqE7ZspRrI7xfZW23eU509QTEdaMdpa1edClkfOg8Ue5FYAvcvLttCBfzCLhaTDgWOBQcsIFxxJSyTdCWwDbpxleWTspsUe5GKBkvQi4Abgw7YfH3V9mmB72vYxwCHAcZI6080wSos9yD0ErOy5PqS8Fy1W9lndAHzF9ldHXZ+mzbY8Mp6fxR7kNgKrJB0haR/gDGB8xHWKOZQd9JcB99r+3Kjr05QqyyPj+VnUQc72FHAesIGiA/s625tGW6tmSLoa+AHwu5K2SDpn1HVqyPHAu4E393xp+tRRV6oBy4GbJN1N8Z/vjba/MeI6dcKinkISEd23qFtyEdF9CXIR0WkJchHRaQlyEdFpCXIR0WkJchHRaQlyEdFp/wftepdy57MlqwAAAABJRU5ErkJggg==\n" + }, + "metadata": { + "needs_background": "light" + } + } + ], + "source": [ + "print(y_train[0])\n", + "\n", + "plt.imshow(x_train[0, :, :, 0])\n", + "plt.colorbar()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "wNS9sVPQojhC" + }, + "source": [ + "### A.B. Resize the images" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "fmmtplIFGL6t" + }, + "source": [ + "An image size of 256x256 is much too large for my quantum computer. Resize the image down to 2x2:" + ] + }, + { + "cell_type": "code", + "source": [ + "first,two = 3,6" + ], + "metadata": { + "id": "PYHHANE9_nFA" + }, + "execution_count": 28, + "outputs": [] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": { + "id": "lbhUdBFWojhE", + "scrolled": false + }, + "outputs": [], + "source": [ + "#x_train_resize = np.array(tf.image.resize(x_train, (first,two)))\n", + "#x_test_resize = np.array(tf.image.resize(x_test, (first,two)))\n", + "#print(y_train[0])\n", + "\n", + "#plt.imshow(x_train_resize[0, :, :, 0])\n", + "#plt.colorbar()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "SlJ5NVaPojhT" + }, + "source": [ + "### A.C. Encode the data as quantum circuits (with qubits)\n", + "\n", + "To process images using a quantum computer." + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": { + "id": "1z8J7OyDojhV" + }, + "outputs": [], + "source": [ + "THRESHOLD = 0.7\n", + "\n", + "x_train_bin = np.array(x_train > THRESHOLD, dtype=np.float32)\n", + "x_test_bin = np.array(x_test > THRESHOLD, dtype=np.float32)" + ] + }, + { + "cell_type": "code", + "source": [ + "x_train_bin.shape" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "mitM7Hyqcws1", + "outputId": "07a7d2cd-6622-4cda-e1fe-7b2adc2c8b68" + }, + "execution_count": 31, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "(16, 4, 4, 1)" + ] + }, + "metadata": {}, + "execution_count": 31 + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "oLyxS9KlojhZ" + }, + "source": [ + "The qubits at pixel indices with values that exceed a threshold, are rotated through an $X$ gate. And we use (3,6) qubits." + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": { + "id": "aOu_3-3ZGL61" + }, + "outputs": [], + "source": [ + "def convert_to_circuit(data):\n", + " \"\"\"Encode truncated classical data into quantum datapoint.\"\"\"\n", + " values = np.ndarray.flatten(data)\n", + " qubits = cirq.GridQubit.rect(first,two)\n", + " circuit = cirq.Circuit()\n", + " for i, value in enumerate(values):\n", + " if value:\n", + " circuit.append(cirq.X(qubits[i]))\n", + " return circuit\n", + "x_train_circ = [convert_to_circuit(x) for x in x_train_bin]\n", + "x_test_circ = [convert_to_circuit(x) for x in x_test_bin]" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "zSCXqzOzojhd" + }, + "source": [ + "Here is the circuit created for the first example (circuit diagrams do not show qubits with zero gates):" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": { + "id": "w3POmUEUojhe", + "scrolled": false, + "colab": { + "base_uri": "https://localhost:8080/", + "height": 421 + }, + "outputId": "0265d9dd-d859-49d4-d8d4-6d64e5ef4a5a" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "" + ], + "image/svg+xml": "(0, 0): (0, 1): (0, 2): (0, 3): (2, 0): (2, 1): (2, 2): (2, 3): XXXXXXXX" + }, + "metadata": {}, + "execution_count": 33 + } + ], + "source": [ + "SVGCircuit(x_train_circ[0])" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "AEQMxCcBojhg" + }, + "source": [ + "Compare this circuit to the indices where the image value exceeds the threshold:" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": { + "id": "TBIsiXdtojhh", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "7fe10ddd-61ba-40ce-dc1b-aaa4247b6e8f" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "array([[0, 0, 0],\n", + " [0, 1, 0],\n", + " [0, 2, 0],\n", + " [0, 3, 0],\n", + " [3, 0, 0],\n", + " [3, 1, 0],\n", + " [3, 2, 0],\n", + " [3, 3, 0]])" + ] + }, + "metadata": {}, + "execution_count": 34 + } + ], + "source": [ + "bin_img = x_train_bin[-1]\n", + "indices = np.array(np.where(bin_img)).T\n", + "indices" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "mWZ24w1Oojhk" + }, + "source": [ + "Convert these `Cirq` circuits to tensors for `tfq`:" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": { + "id": "IZStEMk4ojhk" + }, + "outputs": [], + "source": [ + "x_train_tfcirc = tfq.convert_to_tensor(x_train_circ)\n", + "x_test_tfcirc = tfq.convert_to_tensor(x_test_circ)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "4USiqeOqGL67" + }, + "source": [ + "## B. Quantum6 prepared by Python" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "knIzawEeojho" + }, + "source": [ + "### B.A. Build the model circuit" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": { + "id": "-hjxxgU5ojho" + }, + "outputs": [], + "source": [ + "class CircuitLayerBuilder():\n", + " def __init__(self, data_qubits, readout):\n", + " self.data_qubits = data_qubits\n", + " self.readout = readout\n", + " \n", + " def add_layer(self, circuit, gate, prefix):\n", + " for i, qubit in enumerate(self.data_qubits):\n", + " symbol = sympy.Symbol(prefix + '-' + str(i))\n", + " circuit.append(gate(qubit, self.readout)**symbol)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "Sjo5hANFojhr" + }, + "source": [ + "Build an example circuit layer to see how it looks:" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": { + "id": "SzXWOpUGojhs", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 991 + }, + "outputId": "1deca26b-8973-4e26-dace-ad88140a7bf7" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "" + ], + "image/svg+xml": "(-1, -1): (0, 0): (0, 1): (0, 2): (0, 3): (0, 4): (0, 5): (1, 0): (1, 1): (1, 2): (1, 3): (1, 4): (1, 5): (2, 0): (2, 1): (2, 2): (2, 3): (2, 4): (2, 5): XX^(Emirhan_Quantum6G_AI-0)XXXX^(Emirhan_Quantum6G_AI-1)XXXX^(Emirhan_Quantum6G_AI-2)XXXX^(Emirhan_Quantum6G_AI-3)XXXX^(Emirhan_Quantum6G_AI-4)XXXX^(Emirhan_Quantum6G_AI-5)XXXX^(Emirhan_Quantum6G_AI-6)XXXX^(Emirhan_Quantum6G_AI-7)XXXX^(Emirhan_Quantum6G_AI-8)XXXX^(Emirhan_Quantum6G_AI-9)XXXX^(Emirhan_Quantum6G_AI-10)XXXX^(Emirhan_Quantum6G_AI-11)XXXX^(Emirhan_Quantum6G_AI-12)XXXX^(Emirhan_Quantum6G_AI-13)XXXX^(Emirhan_Quantum6G_AI-14)XXXX^(Emirhan_Quantum6G_AI-15)XXXX^(Emirhan_Quantum6G_AI-16)XXXX^(Emirhan_Quantum6G_AI-17)XX" + }, + "metadata": {}, + "execution_count": 37 + } + ], + "source": [ + "demo_builder = CircuitLayerBuilder(data_qubits = cirq.GridQubit.rect(first,two),\n", + " readout=cirq.GridQubit(-1,-1))\n", + "\n", + "circuit = cirq.Circuit()\n", + "demo_builder.add_layer(circuit, gate = cirq.XX, prefix='Emirhan_Quantum6G_AI')\n", + "SVGCircuit(circuit)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "T-QhPE1pojhu" + }, + "source": [ + "Now build a quantum model, matching the data-circuit size, and include the preparation and readout operations." + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": { + "id": "JiALbpwRGL69" + }, + "outputs": [], + "source": [ + "def create_quantum_model():\n", + " \"\"\"Create a Quantum6 AI Brain circuit and readout operation to go along with it.\"\"\"\n", + " data_qubits = cirq.GridQubit.rect(first,two) # a 3x6 grid.\n", + " readout = cirq.GridQubit(-1, -1) # a quantum qubits at [-1,-1]\n", + " circuit = cirq.Circuit()\n", + " \n", + " # Prepare the readout quantum qubits.\n", + " circuit.append(cirq.X(readout))\n", + " circuit.append(cirq.H(readout))\n", + " \n", + " builder = CircuitLayerBuilder(\n", + " data_qubits = data_qubits,\n", + " readout=readout)\n", + "\n", + " # Then add layers (experiment by adding more).\n", + " builder.add_layer(circuit, cirq.XX, \"emir1\")\n", + " builder.add_layer(circuit, cirq.ZZ, \"bulut1\")\n", + "\n", + " # Finally, prepare the readout qubit.\n", + " circuit.append(cirq.H(readout))\n", + "\n", + " return circuit, cirq.Z(readout)" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": { + "id": "2QZvVh7vojhx" + }, + "outputs": [], + "source": [ + "model_circuit, model_readout = create_quantum_model()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "LY7vbY6yfABE" + }, + "source": [ + "### B.C. Build a Sequential Model for Quantum" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": { + "id": "ZYdf_KOxojh0" + }, + "outputs": [], + "source": [ + "# Build the Tensorflow/Keras Sequential model.\n", + "model = keras.Sequential([\n", + " # The input is the data-circuit (data format), encoded as a tf.string (type)\n", + " keras.layers.Input(shape=(), dtype=tf.string),\n", + " tfq.layers.PQC(model_circuit, model_readout),\n", + "])" + ] + }, + { + "cell_type": "markdown", + "source": [ + "Model Compile" + ], + "metadata": { + "id": "J3HBvUScp6sJ" + } + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": { + "id": "FlpETlLRojiA" + }, + "outputs": [], + "source": [ + "model.compile(\n", + " loss=\"mse\",\n", + " optimizer=tf.keras.optimizers.Adam(),\n", + " metrics=[\"accuracy\"])" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": { + "id": "jkHq2RstojiC", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "829d2590-76d8-4f66-cbe0-15c0f1577a45" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Model: \"sequential_1\"\n", + "_________________________________________________________________\n", + " Layer (type) Output Shape Param # \n", + "=================================================================\n", + " pqc_1 (PQC) (None, 1) 36 \n", + " \n", + "=================================================================\n", + "Total params: 36\n", + "Trainable params: 36\n", + "Non-trainable params: 0\n", + "_________________________________________________________________\n", + "None\n" + ] + } + ], + "source": [ + "print(model.summary())" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "lsuOzDYblA9s" + }, + "source": [ + "### Quantum6 model with training in Keras" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "metadata": { + "id": "n8vuQpSLlBV2" + }, + "outputs": [], + "source": [ + "EPOCHS = 35\n", + "BATCH_SIZE = 128\n", + "\n", + "NUM_EXAMPLES = len(x_train_tfcirc)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "QMSdgGC1GL7D" + }, + "source": [ + "Model fitting" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "metadata": { + "id": "Ya9qP3KkojiM", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "e13a79b4-19e3-417b-e66c-c8b66af2c75c" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "1/1 [==============================] - 0s 185ms/step - loss: 0.4939 - accuracy: 0.5000\n" + ] + } + ], + "source": [ + "quantum6_history = model.fit(x_train_tfcirc, y_train,batch_size=BATCH_SIZE,epochs=EPOCHS,verbose=0,validation_data=(x_test_tfcirc, y_test))\n", + "\n", + "quantum_6_results = model.evaluate(x_test_tfcirc, y_test)" + ] + }, + { + "cell_type": "code", + "source": [ + "def cnn_model():\n", + " model = tf.keras.Sequential()\n", + " model.add(tf.keras.layers.Conv2D(2,2,input_shape=(4,4,1)))\n", + " model.add(tf.keras.layers.Flatten())\n", + " model.add(tf.keras.layers.Dense(2))\n", + " return model\n", + "\n", + "\n", + "model = cnn_model()\n", + "model.compile(loss=\"mse\",\n", + " optimizer=tf.keras.optimizers.Adam(),\n", + " metrics=['accuracy'])\n", + "\n", + "model.summary()" + ], + "metadata": { + "id": "G_AGGDLjgGsB", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "59e96f40-35ce-4909-f523-d67a91aaba8f" + }, + "execution_count": 45, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Model: \"sequential_2\"\n", + "_________________________________________________________________\n", + " Layer (type) Output Shape Param # \n", + "=================================================================\n", + " conv2d (Conv2D) (None, 3, 3, 2) 10 \n", + " \n", + " flatten (Flatten) (None, 18) 0 \n", + " \n", + " dense (Dense) (None, 2) 38 \n", + " \n", + "=================================================================\n", + "Total params: 48\n", + "Trainable params: 48\n", + "Non-trainable params: 0\n", + "_________________________________________________________________\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "cnn_model = model.fit(x_train_bin,y_train,batch_size=BATCH_SIZE,epochs=EPOCHS,verbose=0,validation_data=(x_test_bin, y_test))\n", + "\n", + "cnn_model_results = model.evaluate(x_test_bin, y_test)" + ], + "metadata": { + "id": "lZQm4gZNgKV7", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "f9023bb1-4d90-40d6-c834-0cbf13aa5d7b" + }, + "execution_count": 46, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "1/1 [==============================] - 0s 19ms/step - loss: 0.9469 - accuracy: 0.2500\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "RH3mam7EGL7N" + }, + "source": [ + "## C. Results on Matplotlib" + ] + }, + { + "cell_type": "code", + "source": [ + "sns.barplot([\"Quantum6 Accuracy\",\"Convolutional Neural Network\"],\n", + " [quantum_6_results[1],cnn_model_results[1]])" + ], + "metadata": { + "id": "eTrnJ70NJUVV", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 337 + }, + "outputId": "ba058921-8066-44a9-93ba-9d37ae54504e" + }, + "execution_count": 52, + "outputs": [ + { + "output_type": "stream", + "name": "stderr", + "text": [ + "/usr/local/lib/python3.7/dist-packages/seaborn/_decorators.py:43: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.\n", + " FutureWarning\n" + ] + }, + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "" + ] + }, + "metadata": {}, + "execution_count": 52 + }, + { + "output_type": "display_data", + "data": { + "text/plain": [ + "
" + ], + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAD4CAYAAAD8Zh1EAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAATv0lEQVR4nO3df/QddX3n8eeLsPgDqT1bvq0uAcJiqBsVUL+A1WJpN+2BrQKutJBalR7btOcsLasLFdceFtlju0q1Z6tYpa5FPWoUbWuqqSzVQhEL5hvkhwGjMc1KOFTjb61FCLz3j5kvXK7f5E7ITQKfPB/n5HzvzHzuzPvemfu6n5m5M0lVIUl69NtvbxcgSZoOA12SGmGgS1IjDHRJaoSBLkmN2H9vLfjggw+uJUuW7K3FS9Kj0rp1675eVTMLTdtrgb5kyRLm5ub21uIl6VEpyf/b3jQPuUhSIwx0SWqEgS5JjTDQJakRBrokNcJAl6RGDAr0JCcn2ZBkY5ILFph+dpKtSW7q//3m9EuVJO3IxN+hJ1kEXAr8IrAFWJtkdVXdNtb0g1V1zm6oUZI0wJAe+vHAxqraVFX3AKuA03ZvWZKknTXkStFDgDtGhrcAJyzQ7sVJng98EXhlVd0x3iDJSmAlwGGHHbbz1Y559vnv2eV5qD3rLnnZ3i5B2iumdVL0b4AlVXU0cBXw7oUaVdVlVTVbVbMzMwveikCS9DANCfQ7gUNHhhf34x5QVd+oqh/2g+8Enj2d8iRJQw0J9LXA0iRHJDkAOAtYPdogyZNHBk8Fbp9eiZKkISYeQ6+qbUnOAa4EFgHvqqr1SS4G5qpqNfB7SU4FtgHfBM7ejTVLkhYw6Pa5VbUGWDM27sKRx68BXjPd0iRJO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ll2n6Ff6epLkmL75+Ht4LV0H5Ev9sr8J/Ce6Q1LQ9eDnz1W9hAd77gv5HPDbwOqM/BppV+zTgd73RF4EnJHkS3Q3FLu/ql7fN7mOLgBvozsWdmP/vJvpVsYX6HavrhuwuL8BXtSfXDkR+HO6D9XNdLtp49/ek1xJd0z8NuDv6Y7zjd8QbQXdLzFGfaQf/07gK8AtfQ2/1t/v/kzgLf24q+hCesH3YVxVfbt/XZ/v61s7MvmlwO8luYVuo39S/5yvArcDf7GTr3+vGtl2lvcnxNYDfwT8M917fgtwM13w/35V/fOE+d1Hd6jjlP4vVXUXcAHd+r0ZWFdVHx173r3AxXQhfRXdNjnvcuDt/Tb3uJHnTJzvAi6iOySxjp28FW6/Xf0p8JP98Fa6cycf6LeHfwTmf1L7OuB/J5mj20PYnrcBL++306ey85+f19P1jOe9BHhFP7/1PPh/PqwCzk93MvjI/nxY6Hrq0AX5t+d/nEB3jus3+tf1UuDcHRXRn3c6D/h4JvwMdQgv/R/Rn9X+APCiqlowtDRdfU/9VuBZVfWdvV2P9Gi2T/fQx1XVZ/rDE4b5HpBkOV3v/C2GubTr7KFLUiPsoUtSIwx0SWqEgS5JjTDQJakRBrokNeL/A9S7Z++J34glAAAAAElFTkSuQmCC\n" + }, + "metadata": { + "needs_background": "light" + } + } + ] + } + ], + "metadata": { + "colab": { + "collapsed_sections": [], + "provenance": [] + }, + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "accelerator": "GPU", + "gpuClass": "standard" + }, + "nbformat": 4, + "nbformat_minor": 0 +} \ No newline at end of file