{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "XjQxmm04iTx4"
      },
      "source": [
        "<a href=\"https://colab.research.google.com/github/open-mmlab/mmclassification/blob/master/docs/tutorials/MMClassification_python.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "UdMfIsMpiODD"
      },
      "source": [
        "# MMClassification Python API tutorial on Colab\n",
        "\n",
        "In this tutorial, we will introduce the following content:\n",
        "\n",
        "* How to install MMCls\n",
        "* Inference a model with Python API\n",
        "* Fine-tune a model with Python API"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "iOl0X9UEiRvE"
      },
      "source": [
        "## Install MMClassification\n",
        "\n",
        "Before using MMClassification, we need to prepare the environment with the following steps:\n",
        "\n",
        "1. Install Python, CUDA, C/C++ compiler and git\n",
        "2. Install PyTorch (CUDA version)\n",
        "3. Install mmcv\n",
        "4. Clone mmcls source code from GitHub and install it\n",
        "\n",
        "Because this tutorial is on Google Colab, and the basic environment has been completed, we can skip the first two steps."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "_i7cjqS_LtoP"
      },
      "source": [
        "### Check environment"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "c6MbAw10iUJI",
        "outputId": "dd37cdf5-7bcf-4a03-f5b5-4b17c3ca16de"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "/content\n"
          ]
        }
      ],
      "source": [
        "%cd /content"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "4IyFL3MaiYRu",
        "outputId": "5008efdf-0356-4d93-ba9d-e51787036213"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "/content\n"
          ]
        }
      ],
      "source": [
        "!pwd"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "DMw7QwvpiiUO",
        "outputId": "33fa5eb8-d083-4a1f-d094-ab0f59e2818e"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "nvcc: NVIDIA (R) Cuda compiler driver\n",
            "Copyright (c) 2005-2020 NVIDIA Corporation\n",
            "Built on Mon_Oct_12_20:09:46_PDT_2020\n",
            "Cuda compilation tools, release 11.1, V11.1.105\n",
            "Build cuda_11.1.TC455_06.29190527_0\n"
          ]
        }
      ],
      "source": [
        "# Check nvcc version\n",
        "!nvcc -V"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "4VIBU7Fain4D",
        "outputId": "ec20652d-ca24-4b82-b407-e90354d728f8"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0\n",
            "Copyright (C) 2017 Free Software Foundation, Inc.\n",
            "This is free software; see the source for copying conditions.  There is NO\n",
            "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
            "\n"
          ]
        }
      ],
      "source": [
        "# Check GCC version\n",
        "!gcc --version"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "24lDLCqFisZ9",
        "outputId": "30ec9a1c-cdb3-436c-cdc8-f2a22afe254f"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "1.9.0+cu111\n",
            "True\n"
          ]
        }
      ],
      "source": [
        "# Check PyTorch installation\n",
        "import torch, torchvision\n",
        "print(torch.__version__)\n",
        "print(torch.cuda.is_available())"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "R2aZNLUwizBs"
      },
      "source": [
        "### Install MMCV\n",
        "\n",
        "MMCV is the basic package of all OpenMMLab packages. We have pre-built wheels on Linux, so we can download and install them directly.\n",
        "\n",
        "Please pay attention to PyTorch and CUDA versions to match the wheel.\n",
        "\n",
        "In the above steps, we have checked the version of PyTorch and CUDA, and they are 1.9.0 and 11.1 respectively, so we need to choose the corresponding wheel.\n",
        "\n",
        "In addition, we can also install the full version of mmcv (mmcv-full). It includes full features and various CUDA ops out of the box, but needs a longer time to build."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "nla40LrLi7oo",
        "outputId": "162bf14d-0d3e-4540-e85e-a46084a786b1"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Looking in links: https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html\n",
            "Collecting mmcv\n",
            "  Downloading mmcv-1.3.15.tar.gz (352 kB)\n",
            "\u001b[K     |████████████████████████████████| 352 kB 5.2 MB/s \n",
            "\u001b[?25hCollecting addict\n",
            "  Downloading addict-2.4.0-py3-none-any.whl (3.8 kB)\n",
            "Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from mmcv) (1.19.5)\n",
            "Requirement already satisfied: packaging in /usr/local/lib/python3.7/dist-packages (from mmcv) (21.0)\n",
            "Requirement already satisfied: Pillow in /usr/local/lib/python3.7/dist-packages (from mmcv) (7.1.2)\n",
            "Requirement already satisfied: pyyaml in /usr/local/lib/python3.7/dist-packages (from mmcv) (3.13)\n",
            "Collecting yapf\n",
            "  Downloading yapf-0.31.0-py2.py3-none-any.whl (185 kB)\n",
            "\u001b[K     |████████████████████████████████| 185 kB 49.9 MB/s \n",
            "\u001b[?25hRequirement already satisfied: pyparsing>=2.0.2 in /usr/local/lib/python3.7/dist-packages (from packaging->mmcv) (2.4.7)\n",
            "Building wheels for collected packages: mmcv\n",
            "  Building wheel for mmcv (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
            "  Created wheel for mmcv: filename=mmcv-1.3.15-py2.py3-none-any.whl size=509835 sha256=793fe3796421336ca7a7740a1397a54016ba71ce95fd80cb80a116644adb4070\n",
            "  Stored in directory: /root/.cache/pip/wheels/b2/f4/4e/8f6d2dd2bef6b7eb8c89aa0e5d61acd7bff60aaf3d4d4b29b0\n",
            "Successfully built mmcv\n",
            "Installing collected packages: yapf, addict, mmcv\n",
            "Successfully installed addict-2.4.0 mmcv-1.3.15 yapf-0.31.0\n"
          ]
        }
      ],
      "source": [
        "# Install mmcv\n",
        "!pip install mmcv -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html\n",
        "# !pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu110/torch1.9.0/index.html"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "GDTUrYvXjlRb"
      },
      "source": [
        "### Clone and install MMClassification\n",
        "\n",
        "Next, we clone the latest mmcls repository from GitHub and install it."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "Bwme6tWHjl5s",
        "outputId": "eae20624-4695-4cd9-c3e5-9c59596d150a"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Cloning into 'mmclassification'...\n",
            "remote: Enumerating objects: 4152, done.\u001b[K\n",
            "remote: Counting objects: 100% (994/994), done.\u001b[K\n",
            "remote: Compressing objects: 100% (576/576), done.\u001b[K\n",
            "remote: Total 4152 (delta 476), reused 765 (delta 401), pack-reused 3158\u001b[K\n",
            "Receiving objects: 100% (4152/4152), 8.20 MiB | 21.00 MiB/s, done.\n",
            "Resolving deltas: 100% (2524/2524), done.\n"
          ]
        }
      ],
      "source": [
        "# Clone mmcls repository\n",
        "!git clone https://github.com/open-mmlab/mmclassification.git\n",
        "%cd mmclassification/\n",
        "\n",
        "# Install MMClassification from source\n",
        "!pip install -e . "
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "hFg_oSG4j3zB",
        "outputId": "05a91f9b-d41c-4ae7-d4fe-c30a30d3f639"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "0.16.0\n"
          ]
        }
      ],
      "source": [
        "# Check MMClassification installation\n",
        "import mmcls\n",
        "print(mmcls.__version__)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "4Mi3g6yzj96L"
      },
      "source": [
        "## Inference a model with Python API\n",
        "\n",
        "MMClassification provides many pre-trained models, and you can check them by the link of [model zoo](https://mmclassification.readthedocs.io/en/latest/model_zoo.html). Almost all models can reproduce the results in original papers or reach higher metrics. And we can use these models directly.\n",
        "\n",
        "To use the pre-trained model, we need to do the following steps:\n",
        "\n",
        "- Prepare the model\n",
        "  - Prepare the config file\n",
        "  - Prepare the checkpoint file\n",
        "- Build the model\n",
        "- Inference with the model"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "nDQchz8CkJaT",
        "outputId": "9805bd7d-cc2a-4269-b43d-257412f1df93"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "--2021-10-21 03:52:36--  https://www.dropbox.com/s/k5fsqi6qha09l1v/banana.png?dl=0\n",
            "Resolving www.dropbox.com (www.dropbox.com)... 162.125.3.18, 2620:100:601b:18::a27d:812\n",
            "Connecting to www.dropbox.com (www.dropbox.com)|162.125.3.18|:443... connected.\n",
            "HTTP request sent, awaiting response... 301 Moved Permanently\n",
            "Location: /s/raw/k5fsqi6qha09l1v/banana.png [following]\n",
            "--2021-10-21 03:52:36--  https://www.dropbox.com/s/raw/k5fsqi6qha09l1v/banana.png\n",
            "Reusing existing connection to www.dropbox.com:443.\n",
            "HTTP request sent, awaiting response... 302 Found\n",
            "Location: https://uc10f85c3c33c4b5233bac4d074e.dl.dropboxusercontent.com/cd/0/inline/BYYklQk6LNPXNm7o5xE_fxE2GA9reePyNajQgoe9roPlSrtsJd4WN6RVww7zrtNZWFq8iZv349MNQJlm7vVaqRBxTcd0ufxkqbcJYJvOrORpxOPV7mHmhMjKYUncez8YNqELGwDd-aeZqLGKBC8spSnx/file# [following]\n",
            "--2021-10-21 03:52:36--  https://uc10f85c3c33c4b5233bac4d074e.dl.dropboxusercontent.com/cd/0/inline/BYYklQk6LNPXNm7o5xE_fxE2GA9reePyNajQgoe9roPlSrtsJd4WN6RVww7zrtNZWFq8iZv349MNQJlm7vVaqRBxTcd0ufxkqbcJYJvOrORpxOPV7mHmhMjKYUncez8YNqELGwDd-aeZqLGKBC8spSnx/file\n",
            "Resolving uc10f85c3c33c4b5233bac4d074e.dl.dropboxusercontent.com (uc10f85c3c33c4b5233bac4d074e.dl.dropboxusercontent.com)... 162.125.3.15, 2620:100:601b:15::a27d:80f\n",
            "Connecting to uc10f85c3c33c4b5233bac4d074e.dl.dropboxusercontent.com (uc10f85c3c33c4b5233bac4d074e.dl.dropboxusercontent.com)|162.125.3.15|:443... connected.\n",
            "HTTP request sent, awaiting response... 200 OK\n",
            "Length: 297299 (290K) [image/png]\n",
            "Saving to: ‘demo/banana.png’\n",
            "\n",
            "demo/banana.png     100%[===================>] 290.33K  --.-KB/s    in 0.08s   \n",
            "\n",
            "2021-10-21 03:52:36 (3.47 MB/s) - ‘demo/banana.png’ saved [297299/297299]\n",
            "\n"
          ]
        }
      ],
      "source": [
        "# Get the demo image\n",
        "!wget https://www.dropbox.com/s/k5fsqi6qha09l1v/banana.png?dl=0 -O demo/banana.png"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 420
        },
        "id": "o2eiitWnkQq_",
        "outputId": "192b3ebb-202b-4d6e-e178-561223024318"
      },
      "outputs": [
        {
          "data": {
            "image/png": "[encoded data, 378112 characters]",
            "text/plain": [
              "<PIL.PngImagePlugin.PngImageFile image mode=RGBA size=393x403 at 0x7FD3A038A490>"
            ]
          },
          "execution_count": 20,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "from PIL import Image\n",
        "Image.open('demo/banana.png')"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "sRfAui8EkTDX"
      },
      "source": [
        "### Prepare the config file and checkpoint file\n",
        "\n",
        "We configure a model with a config file and save weights with a checkpoint file.\n",
        "\n",
        "On GitHub, you can find all these pre-trained models in the config folder of MMClassification. For example, you can find the config files and checkpoints of Mobilenet V2 in [this link](https://github.com/open-mmlab/mmclassification/tree/master/configs/mobilenet_v2).\n",
        "\n",
        "We have integrated many config files for various models in the MMClassification repository. As for the checkpoint, we can download it in advance, or just pass an URL to API, and MMClassification will download it before load weights."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "VvRoZpBGkgpC",
        "outputId": "68282782-015e-4f5c-cef2-79be3bf6a9b7"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "configs/mobilenet_v2/mobilenet-v2_8xb32_in1k.py\n"
          ]
        }
      ],
      "source": [
        "# Confirm the config file exists\n",
        "!ls configs/mobilenet_v2/mobilenet-v2_8xb32_in1k.py\n",
        "\n",
        "# Specify the path of the config file and checkpoint file.\n",
        "config_file = 'configs/mobilenet_v2/mobilenet-v2_8xb32_in1k.py'\n",
        "checkpoint_file = 'https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth'"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "eiYdsHoIkpD1"
      },
      "source": [
        "### Inference the model\n",
        "\n",
        "MMClassification provides high-level Python API to inference models.\n",
        "\n",
        "At first, we build the MobilenetV2 model and load the checkpoint."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 323,
          "referenced_widgets": [
            "badf240bbb7d442fbd214e837edbffe2",
            "520112917e0f4844995d418c5041d23a",
            "9f3f6b72b4d14e2a96b9185331c8081b",
            "a275bef3584b49ab9b680b528420d461",
            "c4b2c6914a05497b8d2b691bd6dda6da",
            "863d2a8cc4074f2e890ba6aea7c54384",
            "be55ab36267d4dcab1d83dfaa8540270",
            "31475aa888da4c8d844ba99a0b3397f5",
            "e310c50e610248dd897fbbf5dd09dd7a",
            "8a8ab7c27e404459951cffe7a32b8faa",
            "e1a3dce90c1a4804a9ef0c687a9c0703"
          ]
        },
        "id": "KwJWlR2QkpiV",
        "outputId": "982b365e-d3be-4e3d-dee7-c507a8020292"
      },
      "outputs": [
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "/usr/local/lib/python3.7/dist-packages/mmcv/cnn/bricks/transformer.py:28: UserWarning: Fail to import ``MultiScaleDeformableAttention`` from ``mmcv.ops.multi_scale_deform_attn``, You should install ``mmcv-full`` if you need this module. \n",
            "  warnings.warn('Fail to import ``MultiScaleDeformableAttention`` from '\n",
            "/usr/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility. Expected 192 from C header, got 216 from PyObject\n",
            "  return f(*args, **kwds)\n",
            "/usr/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility. Expected 192 from C header, got 216 from PyObject\n",
            "  return f(*args, **kwds)\n",
            "/usr/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility. Expected 192 from C header, got 216 from PyObject\n",
            "  return f(*args, **kwds)\n",
            "/usr/local/lib/python3.7/dist-packages/yaml/constructor.py:126: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working\n",
            "  if not isinstance(key, collections.Hashable):\n"
          ]
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Use load_from_http loader\n"
          ]
        },
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "Downloading: \"https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth\" to /root/.cache/torch/hub/checkpoints/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth\n"
          ]
        },
        {
          "data": {
            "application/vnd.jupyter.widget-view+json": {
              "model_id": "badf240bbb7d442fbd214e837edbffe2",
              "version_major": 2,
              "version_minor": 0
            },
            "text/plain": [
              "  0%|          | 0.00/13.5M [00:00<?, ?B/s]"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "/content/mmclassification/mmcls/apis/inference.py:44: UserWarning: Class names are not saved in the checkpoint's meta data, use imagenet by default.\n",
            "  warnings.warn('Class names are not saved in the checkpoint\\'s '\n"
          ]
        }
      ],
      "source": [
        "import mmcv\n",
        "from mmcls.apis import inference_model, init_model, show_result_pyplot\n",
        "\n",
        "# Specify the device, if you cannot use GPU, you can also use CPU \n",
        "# by specifying `device='cpu'`.\n",
        "device = 'cuda:0'\n",
        "# device = 'cpu'\n",
        "\n",
        "# Build the model according to the config file and load the checkpoint.\n",
        "model = init_model(config_file, checkpoint_file, device=device)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "GiSACYFgkvNE",
        "outputId": "252ae93d-a4fd-4581-f98e-6dadfde6c078"
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "(mmcls.models.classifiers.image.ImageClassifier,\n",
              " mmcls.models.classifiers.base.BaseClassifier,\n",
              " mmcv.runner.base_module.BaseModule,\n",
              " torch.nn.modules.module.Module,\n",
              " object)"
            ]
          },
          "execution_count": 23,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "# The model's inheritance relationship\n",
        "model.__class__.__mro__"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "FyjY7hP9k0_D",
        "outputId": "6cc4f9aa-5d25-46ae-ff21-4f24e68760c9"
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "{'pred_class': 'banana', 'pred_label': 954, 'pred_score': 0.9999284744262695}"
            ]
          },
          "execution_count": 24,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "# The inference result in a single image\n",
        "img = 'demo/banana.png'\n",
        "img_array =  mmcv.imread(img)\n",
        "result = inference_model(model, img_array)\n",
        "result"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 427
        },
        "id": "ndwdD8eUk96g",
        "outputId": "5cf3639c-a857-4e92-dc09-21ea0ec474f9"
      },
      "outputs": [
        {
          "data": {
            "image/png": "[encoded data, 350316 characters]",
            "text/plain": [
              "<Figure size 393.01x403.01 with 1 Axes>"
            ]
          },
          "metadata": {
            "needs_background": "light"
          },
          "output_type": "display_data"
        }
      ],
      "source": [
        "%matplotlib inline\n",
        "# Visualize the inference result\n",
        "show_result_pyplot(model, img, result)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "oDMr3Bx_lESy"
      },
      "source": [
        "## Fine-tune a model with Python API\n",
        "\n",
        "Fine-tuning is to re-train a model which has been trained on another dataset (like ImageNet) to fit our target dataset. Compared with training from scratch, fine-tuning is much faster can avoid over-fitting problems during training on a small dataset.\n",
        "\n",
        "The basic steps of fine-tuning are as below:\n",
        "\n",
        "1. Prepare the target dataset and meet MMClassification's requirements.\n",
        "2. Modify the training config.\n",
        "3. Start training and validation.\n",
        "\n",
        "More details are in [the docs](https://mmclassification.readthedocs.io/en/latest/tutorials/finetune.html)."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "TJtKKwAvlHX_"
      },
      "source": [
        "### Prepare the target dataset\n",
        "\n",
        "Here we download the cats & dogs dataset directly. You can find more introduction about the dataset in the [tools tutorial](https://colab.research.google.com/github/open-mmlab/mmclassification/blob/master/docs/tutorials/MMClassification_tools.ipynb)."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "3vBfU8GGlFPS",
        "outputId": "b12dadb4-ccbc-45b4-bb08-3d24977ed93c"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "--2021-10-21 03:57:58--  https://www.dropbox.com/s/wml49yrtdo53mie/cats_dogs_dataset_reorg.zip?dl=0\n",
            "Resolving www.dropbox.com (www.dropbox.com)... 162.125.80.18, 2620:100:6018:18::a27d:312\n",
            "Connecting to www.dropbox.com (www.dropbox.com)|162.125.80.18|:443... connected.\n",
            "HTTP request sent, awaiting response... 301 Moved Permanently\n",
            "Location: /s/raw/wml49yrtdo53mie/cats_dogs_dataset_reorg.zip [following]\n",
            "--2021-10-21 03:57:58--  https://www.dropbox.com/s/raw/wml49yrtdo53mie/cats_dogs_dataset_reorg.zip\n",
            "Reusing existing connection to www.dropbox.com:443.\n",
            "HTTP request sent, awaiting response... 302 Found\n",
            "Location: https://ucfd8157272a6270e100392293da.dl.dropboxusercontent.com/cd/0/inline/BYbFG6Zo1S3l2kJtqLrJIne9lTLgQn-uoJxmUjhLSkp36V7AoiwlyR2gP0XVoUQt9WzF2ZsmeERagMy7rpsNoIYG4MjsYA90i_JsarFDs9PHhXHw9qwHpHqBvgd4YU_mwDQHuouJ_oCU1kft04QgCVRg/file# [following]\n",
            "--2021-10-21 03:57:59--  https://ucfd8157272a6270e100392293da.dl.dropboxusercontent.com/cd/0/inline/BYbFG6Zo1S3l2kJtqLrJIne9lTLgQn-uoJxmUjhLSkp36V7AoiwlyR2gP0XVoUQt9WzF2ZsmeERagMy7rpsNoIYG4MjsYA90i_JsarFDs9PHhXHw9qwHpHqBvgd4YU_mwDQHuouJ_oCU1kft04QgCVRg/file\n",
            "Resolving ucfd8157272a6270e100392293da.dl.dropboxusercontent.com (ucfd8157272a6270e100392293da.dl.dropboxusercontent.com)... 162.125.3.15, 2620:100:6018:15::a27d:30f\n",
            "Connecting to ucfd8157272a6270e100392293da.dl.dropboxusercontent.com (ucfd8157272a6270e100392293da.dl.dropboxusercontent.com)|162.125.3.15|:443... connected.\n",
            "HTTP request sent, awaiting response... 302 Found\n",
            "Location: /cd/0/inline2/BYYSXb-0kWS7Lpk-cdrgBGzcOBfsvy7KjhqWEgjI5L9xfcaXohKlVeFMNFVyqvCwZLym2kWCD0nwURRpQ2mnHICrNsrvTvavbn24hk1Bd3_lXX08LBBe3C6YvD2U_iP8UMXROqm-B3JtnBjeMpk1R4YZ0O6aVLgKu0eET9RXsRaNCczD2lTK_i72zmbYhGmBvlRWmf_yQnnS5WKpGhSAobznIqKzw78yPzo5FsgGiEj5VXb91AElrKVAW8HFC9EhdUs7RrL3q9f0mQ9TbQpauoAp32TL3YQcuAp891Rv-EmDVxzfMwKVTGU8hxR2SiIWkse4u2QGhliqhdha7qBu7sIPcIoeI5-DdSoc6XG77vTYTRhrs_cf7rQuTPH2gTIUwTY/file [following]\n",
            "--2021-10-21 03:57:59--  https://ucfd8157272a6270e100392293da.dl.dropboxusercontent.com/cd/0/inline2/BYYSXb-0kWS7Lpk-cdrgBGzcOBfsvy7KjhqWEgjI5L9xfcaXohKlVeFMNFVyqvCwZLym2kWCD0nwURRpQ2mnHICrNsrvTvavbn24hk1Bd3_lXX08LBBe3C6YvD2U_iP8UMXROqm-B3JtnBjeMpk1R4YZ0O6aVLgKu0eET9RXsRaNCczD2lTK_i72zmbYhGmBvlRWmf_yQnnS5WKpGhSAobznIqKzw78yPzo5FsgGiEj5VXb91AElrKVAW8HFC9EhdUs7RrL3q9f0mQ9TbQpauoAp32TL3YQcuAp891Rv-EmDVxzfMwKVTGU8hxR2SiIWkse4u2QGhliqhdha7qBu7sIPcIoeI5-DdSoc6XG77vTYTRhrs_cf7rQuTPH2gTIUwTY/file\n",
            "Reusing existing connection to ucfd8157272a6270e100392293da.dl.dropboxusercontent.com:443.\n",
            "HTTP request sent, awaiting response... 200 OK\n",
            "Length: 228802825 (218M) [application/zip]\n",
            "Saving to: ‘cats_dogs_dataset.zip’\n",
            "\n",
            "cats_dogs_dataset.z 100%[===================>] 218.20M  86.3MB/s    in 2.5s    \n",
            "\n",
            "2021-10-21 03:58:02 (86.3 MB/s) - ‘cats_dogs_dataset.zip’ saved [228802825/228802825]\n",
            "\n"
          ]
        }
      ],
      "source": [
        "# Download the cats & dogs dataset\n",
        "!wget https://www.dropbox.com/s/wml49yrtdo53mie/cats_dogs_dataset_reorg.zip?dl=0 -O cats_dogs_dataset.zip\n",
        "!mkdir -p data\n",
        "!unzip -qo cats_dogs_dataset.zip -d ./data/"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "15iKNG0SlV9y"
      },
      "source": [
        "### Read the config file and modify the config\n",
        "\n",
        "In the [tools tutorial](https://colab.research.google.com/github/open-mmlab/mmclassification/blob/master/docs/tutorials/MMClassification_tools.ipynb), we have introduced all parts of the config file, and here we can modify the loaded config by Python code."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "WCfnDavFlWrK"
      },
      "outputs": [],
      "source": [
        "# Load the base config file\n",
        "from mmcv import Config\n",
        "from mmcls.utils import auto_select_device\n",
        "\n",
        "cfg = Config.fromfile('configs/mobilenet_v2/mobilenet-v2_8xb32_in1k.py')\n",
        "cfg.device = auto_select_device()\n",
        "\n",
        "# Modify the number of classes in the head.\n",
        "cfg.model.head.num_classes = 2\n",
        "cfg.model.head.topk = (1, )\n",
        "\n",
        "# Load the pre-trained model's checkpoint.\n",
        "cfg.model.backbone.init_cfg = dict(type='Pretrained', checkpoint=checkpoint_file, prefix='backbone')\n",
        "\n",
        "# Specify sample size and number of workers.\n",
        "cfg.data.samples_per_gpu = 32\n",
        "cfg.data.workers_per_gpu = 2\n",
        "\n",
        "# Specify the path and meta files of training dataset\n",
        "cfg.data.train.data_prefix = 'data/cats_dogs_dataset/training_set/training_set'\n",
        "cfg.data.train.classes = 'data/cats_dogs_dataset/classes.txt'\n",
        "\n",
        "# Specify the path and meta files of validation dataset\n",
        "cfg.data.val.data_prefix = 'data/cats_dogs_dataset/val_set/val_set'\n",
        "cfg.data.val.ann_file = 'data/cats_dogs_dataset/val.txt'\n",
        "cfg.data.val.classes = 'data/cats_dogs_dataset/classes.txt'\n",
        "\n",
        "# Specify the path and meta files of test dataset\n",
        "cfg.data.test.data_prefix = 'data/cats_dogs_dataset/test_set/test_set'\n",
        "cfg.data.test.ann_file = 'data/cats_dogs_dataset/test.txt'\n",
        "cfg.data.test.classes = 'data/cats_dogs_dataset/classes.txt'\n",
        "\n",
        "# Specify the normalization parameters in data pipeline\n",
        "normalize_cfg = dict(type='Normalize', mean=[124.508, 116.050, 106.438], std=[58.577, 57.310, 57.437], to_rgb=True)\n",
        "cfg.data.train.pipeline[3] = normalize_cfg\n",
        "cfg.data.val.pipeline[3] = normalize_cfg\n",
        "cfg.data.test.pipeline[3] = normalize_cfg\n",
        "\n",
        "# Modify the evaluation metric\n",
        "cfg.evaluation['metric_options']={'topk': (1, )}\n",
        "\n",
        "# Specify the optimizer\n",
        "cfg.optimizer = dict(type='SGD', lr=0.005, momentum=0.9, weight_decay=0.0001)\n",
        "cfg.optimizer_config = dict(grad_clip=None)\n",
        "\n",
        "# Specify the learning rate scheduler\n",
        "cfg.lr_config = dict(policy='step', step=1, gamma=0.1)\n",
        "cfg.runner = dict(type='EpochBasedRunner', max_epochs=2)\n",
        "\n",
        "# Specify the work directory\n",
        "cfg.work_dir = './work_dirs/cats_dogs_dataset'\n",
        "\n",
        "# Output logs for every 10 iterations\n",
        "cfg.log_config.interval = 10\n",
        "\n",
        "# Set the random seed and enable the deterministic option of cuDNN\n",
        "# to keep the results' reproducible.\n",
        "from mmcls.apis import set_random_seed\n",
        "cfg.seed = 0\n",
        "set_random_seed(0, deterministic=True)\n",
        "\n",
        "cfg.gpu_ids = range(1)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "HDerVUPFmNR0"
      },
      "source": [
        "### Fine-tune the model\n",
        "\n",
        "Use the API `train_model` to fine-tune our model on the cats & dogs dataset."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "P7unq5cNmN8G",
        "outputId": "bf32711b-7bdf-45ee-8db5-e8699d3eff91"
      },
      "outputs": [
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "2021-10-21 04:04:12,758 - mmcv - INFO - initialize MobileNetV2 with init_cfg {'type': 'Pretrained', 'checkpoint': 'https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth', 'prefix': 'backbone'}\n",
            "2021-10-21 04:04:12,759 - mmcv - INFO - load backbone in model from: https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth\n",
            "2021-10-21 04:04:12,815 - mmcv - INFO - initialize LinearClsHead with init_cfg {'type': 'Normal', 'layer': 'Linear', 'std': 0.01}\n",
            "2021-10-21 04:04:12,818 - mmcv - INFO - \n",
            "backbone.conv1.conv.weight - torch.Size([32, 3, 3, 3]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,821 - mmcv - INFO - \n",
            "backbone.conv1.bn.weight - torch.Size([32]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,823 - mmcv - INFO - \n",
            "backbone.conv1.bn.bias - torch.Size([32]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,824 - mmcv - INFO - \n",
            "backbone.layer1.0.conv.0.conv.weight - torch.Size([32, 1, 3, 3]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,826 - mmcv - INFO - \n",
            "backbone.layer1.0.conv.0.bn.weight - torch.Size([32]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,827 - mmcv - INFO - \n",
            "backbone.layer1.0.conv.0.bn.bias - torch.Size([32]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,829 - mmcv - INFO - \n",
            "backbone.layer1.0.conv.1.conv.weight - torch.Size([16, 32, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,830 - mmcv - INFO - \n",
            "backbone.layer1.0.conv.1.bn.weight - torch.Size([16]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,832 - mmcv - INFO - \n",
            "backbone.layer1.0.conv.1.bn.bias - torch.Size([16]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,833 - mmcv - INFO - \n",
            "backbone.layer2.0.conv.0.conv.weight - torch.Size([96, 16, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,835 - mmcv - INFO - \n",
            "backbone.layer2.0.conv.0.bn.weight - torch.Size([96]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,836 - mmcv - INFO - \n",
            "backbone.layer2.0.conv.0.bn.bias - torch.Size([96]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,838 - mmcv - INFO - \n",
            "backbone.layer2.0.conv.1.conv.weight - torch.Size([96, 1, 3, 3]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,839 - mmcv - INFO - \n",
            "backbone.layer2.0.conv.1.bn.weight - torch.Size([96]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,841 - mmcv - INFO - \n",
            "backbone.layer2.0.conv.1.bn.bias - torch.Size([96]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,842 - mmcv - INFO - \n",
            "backbone.layer2.0.conv.2.conv.weight - torch.Size([24, 96, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,844 - mmcv - INFO - \n",
            "backbone.layer2.0.conv.2.bn.weight - torch.Size([24]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,845 - mmcv - INFO - \n",
            "backbone.layer2.0.conv.2.bn.bias - torch.Size([24]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,847 - mmcv - INFO - \n",
            "backbone.layer2.1.conv.0.conv.weight - torch.Size([144, 24, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,848 - mmcv - INFO - \n",
            "backbone.layer2.1.conv.0.bn.weight - torch.Size([144]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,850 - mmcv - INFO - \n",
            "backbone.layer2.1.conv.0.bn.bias - torch.Size([144]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,851 - mmcv - INFO - \n",
            "backbone.layer2.1.conv.1.conv.weight - torch.Size([144, 1, 3, 3]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,853 - mmcv - INFO - \n",
            "backbone.layer2.1.conv.1.bn.weight - torch.Size([144]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,854 - mmcv - INFO - \n",
            "backbone.layer2.1.conv.1.bn.bias - torch.Size([144]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,856 - mmcv - INFO - \n",
            "backbone.layer2.1.conv.2.conv.weight - torch.Size([24, 144, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,857 - mmcv - INFO - \n",
            "backbone.layer2.1.conv.2.bn.weight - torch.Size([24]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,858 - mmcv - INFO - \n",
            "backbone.layer2.1.conv.2.bn.bias - torch.Size([24]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,860 - mmcv - INFO - \n",
            "backbone.layer3.0.conv.0.conv.weight - torch.Size([144, 24, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,861 - mmcv - INFO - \n",
            "backbone.layer3.0.conv.0.bn.weight - torch.Size([144]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,863 - mmcv - INFO - \n",
            "backbone.layer3.0.conv.0.bn.bias - torch.Size([144]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,864 - mmcv - INFO - \n",
            "backbone.layer3.0.conv.1.conv.weight - torch.Size([144, 1, 3, 3]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,866 - mmcv - INFO - \n",
            "backbone.layer3.0.conv.1.bn.weight - torch.Size([144]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,867 - mmcv - INFO - \n",
            "backbone.layer3.0.conv.1.bn.bias - torch.Size([144]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,869 - mmcv - INFO - \n",
            "backbone.layer3.0.conv.2.conv.weight - torch.Size([32, 144, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,870 - mmcv - INFO - \n",
            "backbone.layer3.0.conv.2.bn.weight - torch.Size([32]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,872 - mmcv - INFO - \n",
            "backbone.layer3.0.conv.2.bn.bias - torch.Size([32]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,873 - mmcv - INFO - \n",
            "backbone.layer3.1.conv.0.conv.weight - torch.Size([192, 32, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,875 - mmcv - INFO - \n",
            "backbone.layer3.1.conv.0.bn.weight - torch.Size([192]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,876 - mmcv - INFO - \n",
            "backbone.layer3.1.conv.0.bn.bias - torch.Size([192]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,878 - mmcv - INFO - \n",
            "backbone.layer3.1.conv.1.conv.weight - torch.Size([192, 1, 3, 3]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,879 - mmcv - INFO - \n",
            "backbone.layer3.1.conv.1.bn.weight - torch.Size([192]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,882 - mmcv - INFO - \n",
            "backbone.layer3.1.conv.1.bn.bias - torch.Size([192]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,883 - mmcv - INFO - \n",
            "backbone.layer3.1.conv.2.conv.weight - torch.Size([32, 192, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,885 - mmcv - INFO - \n",
            "backbone.layer3.1.conv.2.bn.weight - torch.Size([32]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,886 - mmcv - INFO - \n",
            "backbone.layer3.1.conv.2.bn.bias - torch.Size([32]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,887 - mmcv - INFO - \n",
            "backbone.layer3.2.conv.0.conv.weight - torch.Size([192, 32, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,889 - mmcv - INFO - \n",
            "backbone.layer3.2.conv.0.bn.weight - torch.Size([192]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,890 - mmcv - INFO - \n",
            "backbone.layer3.2.conv.0.bn.bias - torch.Size([192]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,892 - mmcv - INFO - \n",
            "backbone.layer3.2.conv.1.conv.weight - torch.Size([192, 1, 3, 3]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,894 - mmcv - INFO - \n",
            "backbone.layer3.2.conv.1.bn.weight - torch.Size([192]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,895 - mmcv - INFO - \n",
            "backbone.layer3.2.conv.1.bn.bias - torch.Size([192]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,896 - mmcv - INFO - \n",
            "backbone.layer3.2.conv.2.conv.weight - torch.Size([32, 192, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,898 - mmcv - INFO - \n",
            "backbone.layer3.2.conv.2.bn.weight - torch.Size([32]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,899 - mmcv - INFO - \n",
            "backbone.layer3.2.conv.2.bn.bias - torch.Size([32]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,901 - mmcv - INFO - \n",
            "backbone.layer4.0.conv.0.conv.weight - torch.Size([192, 32, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,903 - mmcv - INFO - \n",
            "backbone.layer4.0.conv.0.bn.weight - torch.Size([192]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,907 - mmcv - INFO - \n",
            "backbone.layer4.0.conv.0.bn.bias - torch.Size([192]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,908 - mmcv - INFO - \n",
            "backbone.layer4.0.conv.1.conv.weight - torch.Size([192, 1, 3, 3]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,910 - mmcv - INFO - \n",
            "backbone.layer4.0.conv.1.bn.weight - torch.Size([192]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,911 - mmcv - INFO - \n",
            "backbone.layer4.0.conv.1.bn.bias - torch.Size([192]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,913 - mmcv - INFO - \n",
            "backbone.layer4.0.conv.2.conv.weight - torch.Size([64, 192, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,914 - mmcv - INFO - \n",
            "backbone.layer4.0.conv.2.bn.weight - torch.Size([64]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,915 - mmcv - INFO - \n",
            "backbone.layer4.0.conv.2.bn.bias - torch.Size([64]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,917 - mmcv - INFO - \n",
            "backbone.layer4.1.conv.0.conv.weight - torch.Size([384, 64, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,918 - mmcv - INFO - \n",
            "backbone.layer4.1.conv.0.bn.weight - torch.Size([384]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,920 - mmcv - INFO - \n",
            "backbone.layer4.1.conv.0.bn.bias - torch.Size([384]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,921 - mmcv - INFO - \n",
            "backbone.layer4.1.conv.1.conv.weight - torch.Size([384, 1, 3, 3]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,923 - mmcv - INFO - \n",
            "backbone.layer4.1.conv.1.bn.weight - torch.Size([384]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,924 - mmcv - INFO - \n",
            "backbone.layer4.1.conv.1.bn.bias - torch.Size([384]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,925 - mmcv - INFO - \n",
            "backbone.layer4.1.conv.2.conv.weight - torch.Size([64, 384, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,927 - mmcv - INFO - \n",
            "backbone.layer4.1.conv.2.bn.weight - torch.Size([64]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,928 - mmcv - INFO - \n",
            "backbone.layer4.1.conv.2.bn.bias - torch.Size([64]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,930 - mmcv - INFO - \n",
            "backbone.layer4.2.conv.0.conv.weight - torch.Size([384, 64, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,932 - mmcv - INFO - \n",
            "backbone.layer4.2.conv.0.bn.weight - torch.Size([384]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,933 - mmcv - INFO - \n",
            "backbone.layer4.2.conv.0.bn.bias - torch.Size([384]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,935 - mmcv - INFO - \n",
            "backbone.layer4.2.conv.1.conv.weight - torch.Size([384, 1, 3, 3]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,936 - mmcv - INFO - \n",
            "backbone.layer4.2.conv.1.bn.weight - torch.Size([384]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,938 - mmcv - INFO - \n",
            "backbone.layer4.2.conv.1.bn.bias - torch.Size([384]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,939 - mmcv - INFO - \n",
            "backbone.layer4.2.conv.2.conv.weight - torch.Size([64, 384, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,941 - mmcv - INFO - \n",
            "backbone.layer4.2.conv.2.bn.weight - torch.Size([64]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,942 - mmcv - INFO - \n",
            "backbone.layer4.2.conv.2.bn.bias - torch.Size([64]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,944 - mmcv - INFO - \n",
            "backbone.layer4.3.conv.0.conv.weight - torch.Size([384, 64, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,945 - mmcv - INFO - \n",
            "backbone.layer4.3.conv.0.bn.weight - torch.Size([384]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,946 - mmcv - INFO - \n",
            "backbone.layer4.3.conv.0.bn.bias - torch.Size([384]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,948 - mmcv - INFO - \n",
            "backbone.layer4.3.conv.1.conv.weight - torch.Size([384, 1, 3, 3]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,949 - mmcv - INFO - \n",
            "backbone.layer4.3.conv.1.bn.weight - torch.Size([384]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,951 - mmcv - INFO - \n",
            "backbone.layer4.3.conv.1.bn.bias - torch.Size([384]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,952 - mmcv - INFO - \n",
            "backbone.layer4.3.conv.2.conv.weight - torch.Size([64, 384, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,954 - mmcv - INFO - \n",
            "backbone.layer4.3.conv.2.bn.weight - torch.Size([64]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,955 - mmcv - INFO - \n",
            "backbone.layer4.3.conv.2.bn.bias - torch.Size([64]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,957 - mmcv - INFO - \n",
            "backbone.layer5.0.conv.0.conv.weight - torch.Size([384, 64, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,958 - mmcv - INFO - \n",
            "backbone.layer5.0.conv.0.bn.weight - torch.Size([384]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,959 - mmcv - INFO - \n",
            "backbone.layer5.0.conv.0.bn.bias - torch.Size([384]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,961 - mmcv - INFO - \n",
            "backbone.layer5.0.conv.1.conv.weight - torch.Size([384, 1, 3, 3]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,963 - mmcv - INFO - \n",
            "backbone.layer5.0.conv.1.bn.weight - torch.Size([384]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,964 - mmcv - INFO - \n",
            "backbone.layer5.0.conv.1.bn.bias - torch.Size([384]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n"
          ]
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Use load_from_http loader\n"
          ]
        },
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "2021-10-21 04:04:12,965 - mmcv - INFO - \n",
            "backbone.layer5.0.conv.2.conv.weight - torch.Size([96, 384, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,967 - mmcv - INFO - \n",
            "backbone.layer5.0.conv.2.bn.weight - torch.Size([96]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,969 - mmcv - INFO - \n",
            "backbone.layer5.0.conv.2.bn.bias - torch.Size([96]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,970 - mmcv - INFO - \n",
            "backbone.layer5.1.conv.0.conv.weight - torch.Size([576, 96, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,972 - mmcv - INFO - \n",
            "backbone.layer5.1.conv.0.bn.weight - torch.Size([576]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,973 - mmcv - INFO - \n",
            "backbone.layer5.1.conv.0.bn.bias - torch.Size([576]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,975 - mmcv - INFO - \n",
            "backbone.layer5.1.conv.1.conv.weight - torch.Size([576, 1, 3, 3]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,976 - mmcv - INFO - \n",
            "backbone.layer5.1.conv.1.bn.weight - torch.Size([576]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,978 - mmcv - INFO - \n",
            "backbone.layer5.1.conv.1.bn.bias - torch.Size([576]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,979 - mmcv - INFO - \n",
            "backbone.layer5.1.conv.2.conv.weight - torch.Size([96, 576, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,981 - mmcv - INFO - \n",
            "backbone.layer5.1.conv.2.bn.weight - torch.Size([96]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,982 - mmcv - INFO - \n",
            "backbone.layer5.1.conv.2.bn.bias - torch.Size([96]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,984 - mmcv - INFO - \n",
            "backbone.layer5.2.conv.0.conv.weight - torch.Size([576, 96, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,985 - mmcv - INFO - \n",
            "backbone.layer5.2.conv.0.bn.weight - torch.Size([576]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,986 - mmcv - INFO - \n",
            "backbone.layer5.2.conv.0.bn.bias - torch.Size([576]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,988 - mmcv - INFO - \n",
            "backbone.layer5.2.conv.1.conv.weight - torch.Size([576, 1, 3, 3]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,989 - mmcv - INFO - \n",
            "backbone.layer5.2.conv.1.bn.weight - torch.Size([576]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,991 - mmcv - INFO - \n",
            "backbone.layer5.2.conv.1.bn.bias - torch.Size([576]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,992 - mmcv - INFO - \n",
            "backbone.layer5.2.conv.2.conv.weight - torch.Size([96, 576, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,994 - mmcv - INFO - \n",
            "backbone.layer5.2.conv.2.bn.weight - torch.Size([96]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,995 - mmcv - INFO - \n",
            "backbone.layer5.2.conv.2.bn.bias - torch.Size([96]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,997 - mmcv - INFO - \n",
            "backbone.layer6.0.conv.0.conv.weight - torch.Size([576, 96, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,998 - mmcv - INFO - \n",
            "backbone.layer6.0.conv.0.bn.weight - torch.Size([576]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:12,999 - mmcv - INFO - \n",
            "backbone.layer6.0.conv.0.bn.bias - torch.Size([576]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,001 - mmcv - INFO - \n",
            "backbone.layer6.0.conv.1.conv.weight - torch.Size([576, 1, 3, 3]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,002 - mmcv - INFO - \n",
            "backbone.layer6.0.conv.1.bn.weight - torch.Size([576]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,004 - mmcv - INFO - \n",
            "backbone.layer6.0.conv.1.bn.bias - torch.Size([576]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,005 - mmcv - INFO - \n",
            "backbone.layer6.0.conv.2.conv.weight - torch.Size([160, 576, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,007 - mmcv - INFO - \n",
            "backbone.layer6.0.conv.2.bn.weight - torch.Size([160]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,008 - mmcv - INFO - \n",
            "backbone.layer6.0.conv.2.bn.bias - torch.Size([160]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,010 - mmcv - INFO - \n",
            "backbone.layer6.1.conv.0.conv.weight - torch.Size([960, 160, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,011 - mmcv - INFO - \n",
            "backbone.layer6.1.conv.0.bn.weight - torch.Size([960]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,013 - mmcv - INFO - \n",
            "backbone.layer6.1.conv.0.bn.bias - torch.Size([960]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,014 - mmcv - INFO - \n",
            "backbone.layer6.1.conv.1.conv.weight - torch.Size([960, 1, 3, 3]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,015 - mmcv - INFO - \n",
            "backbone.layer6.1.conv.1.bn.weight - torch.Size([960]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,017 - mmcv - INFO - \n",
            "backbone.layer6.1.conv.1.bn.bias - torch.Size([960]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,018 - mmcv - INFO - \n",
            "backbone.layer6.1.conv.2.conv.weight - torch.Size([160, 960, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,021 - mmcv - INFO - \n",
            "backbone.layer6.1.conv.2.bn.weight - torch.Size([160]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,022 - mmcv - INFO - \n",
            "backbone.layer6.1.conv.2.bn.bias - torch.Size([160]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,024 - mmcv - INFO - \n",
            "backbone.layer6.2.conv.0.conv.weight - torch.Size([960, 160, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,025 - mmcv - INFO - \n",
            "backbone.layer6.2.conv.0.bn.weight - torch.Size([960]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,027 - mmcv - INFO - \n",
            "backbone.layer6.2.conv.0.bn.bias - torch.Size([960]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,028 - mmcv - INFO - \n",
            "backbone.layer6.2.conv.1.conv.weight - torch.Size([960, 1, 3, 3]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,030 - mmcv - INFO - \n",
            "backbone.layer6.2.conv.1.bn.weight - torch.Size([960]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,031 - mmcv - INFO - \n",
            "backbone.layer6.2.conv.1.bn.bias - torch.Size([960]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,033 - mmcv - INFO - \n",
            "backbone.layer6.2.conv.2.conv.weight - torch.Size([160, 960, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,034 - mmcv - INFO - \n",
            "backbone.layer6.2.conv.2.bn.weight - torch.Size([160]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,036 - mmcv - INFO - \n",
            "backbone.layer6.2.conv.2.bn.bias - torch.Size([160]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,037 - mmcv - INFO - \n",
            "backbone.layer7.0.conv.0.conv.weight - torch.Size([960, 160, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,039 - mmcv - INFO - \n",
            "backbone.layer7.0.conv.0.bn.weight - torch.Size([960]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,040 - mmcv - INFO - \n",
            "backbone.layer7.0.conv.0.bn.bias - torch.Size([960]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,041 - mmcv - INFO - \n",
            "backbone.layer7.0.conv.1.conv.weight - torch.Size([960, 1, 3, 3]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,043 - mmcv - INFO - \n",
            "backbone.layer7.0.conv.1.bn.weight - torch.Size([960]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,045 - mmcv - INFO - \n",
            "backbone.layer7.0.conv.1.bn.bias - torch.Size([960]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,046 - mmcv - INFO - \n",
            "backbone.layer7.0.conv.2.conv.weight - torch.Size([320, 960, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,048 - mmcv - INFO - \n",
            "backbone.layer7.0.conv.2.bn.weight - torch.Size([320]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,049 - mmcv - INFO - \n",
            "backbone.layer7.0.conv.2.bn.bias - torch.Size([320]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,051 - mmcv - INFO - \n",
            "backbone.conv2.conv.weight - torch.Size([1280, 320, 1, 1]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,052 - mmcv - INFO - \n",
            "backbone.conv2.bn.weight - torch.Size([1280]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,054 - mmcv - INFO - \n",
            "backbone.conv2.bn.bias - torch.Size([1280]): \n",
            "PretrainedInit: load from https://download.openmmlab.com/mmclassification/v0/mobilenet_v2/mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth \n",
            " \n",
            "2021-10-21 04:04:13,055 - mmcv - INFO - \n",
            "head.fc.weight - torch.Size([2, 1280]): \n",
            "NormalInit: mean=0, std=0.01, bias=0 \n",
            " \n",
            "2021-10-21 04:04:13,057 - mmcv - INFO - \n",
            "head.fc.bias - torch.Size([2]): \n",
            "NormalInit: mean=0, std=0.01, bias=0 \n",
            " \n",
            "2021-10-21 04:04:13,408 - mmcls - INFO - Start running, host: root@cc5b42005207, work_dir: /content/mmclassification/work_dirs/cats_dogs_dataset\n",
            "2021-10-21 04:04:13,412 - mmcls - INFO - Hooks will be executed in the following order:\n",
            "before_run:\n",
            "(VERY_HIGH   ) StepLrUpdaterHook                  \n",
            "(NORMAL      ) CheckpointHook                     \n",
            "(LOW         ) EvalHook                           \n",
            "(VERY_LOW    ) TextLoggerHook                     \n",
            " -------------------- \n",
            "before_train_epoch:\n",
            "(VERY_HIGH   ) StepLrUpdaterHook                  \n",
            "(LOW         ) IterTimerHook                      \n",
            "(LOW         ) EvalHook                           \n",
            "(VERY_LOW    ) TextLoggerHook                     \n",
            " -------------------- \n",
            "before_train_iter:\n",
            "(VERY_HIGH   ) StepLrUpdaterHook                  \n",
            "(LOW         ) IterTimerHook                      \n",
            "(LOW         ) EvalHook                           \n",
            " -------------------- \n",
            "after_train_iter:\n",
            "(ABOVE_NORMAL) OptimizerHook                      \n",
            "(NORMAL      ) CheckpointHook                     \n",
            "(LOW         ) IterTimerHook                      \n",
            "(LOW         ) EvalHook                           \n",
            "(VERY_LOW    ) TextLoggerHook                     \n",
            " -------------------- \n",
            "after_train_epoch:\n",
            "(NORMAL      ) CheckpointHook                     \n",
            "(LOW         ) EvalHook                           \n",
            "(VERY_LOW    ) TextLoggerHook                     \n",
            " -------------------- \n",
            "before_val_epoch:\n",
            "(LOW         ) IterTimerHook                      \n",
            "(VERY_LOW    ) TextLoggerHook                     \n",
            " -------------------- \n",
            "before_val_iter:\n",
            "(LOW         ) IterTimerHook                      \n",
            " -------------------- \n",
            "after_val_iter:\n",
            "(LOW         ) IterTimerHook                      \n",
            " -------------------- \n",
            "after_val_epoch:\n",
            "(VERY_LOW    ) TextLoggerHook                     \n",
            " -------------------- \n",
            "2021-10-21 04:04:13,417 - mmcls - INFO - workflow: [('train', 1)], max: 2 epochs\n",
            "2021-10-21 04:04:18,924 - mmcls - INFO - Epoch [1][10/201]\tlr: 5.000e-03, eta: 0:03:29, time: 0.535, data_time: 0.259, memory: 1709, loss: 0.3917\n",
            "2021-10-21 04:04:21,743 - mmcls - INFO - Epoch [1][20/201]\tlr: 5.000e-03, eta: 0:02:35, time: 0.281, data_time: 0.019, memory: 1709, loss: 0.3508\n",
            "2021-10-21 04:04:24,552 - mmcls - INFO - Epoch [1][30/201]\tlr: 5.000e-03, eta: 0:02:15, time: 0.280, data_time: 0.020, memory: 1709, loss: 0.3955\n",
            "2021-10-21 04:04:27,371 - mmcls - INFO - Epoch [1][40/201]\tlr: 5.000e-03, eta: 0:02:04, time: 0.282, data_time: 0.021, memory: 1709, loss: 0.2485\n",
            "2021-10-21 04:04:30,202 - mmcls - INFO - Epoch [1][50/201]\tlr: 5.000e-03, eta: 0:01:56, time: 0.283, data_time: 0.021, memory: 1709, loss: 0.4196\n",
            "2021-10-21 04:04:33,021 - mmcls - INFO - Epoch [1][60/201]\tlr: 5.000e-03, eta: 0:01:50, time: 0.282, data_time: 0.023, memory: 1709, loss: 0.4994\n",
            "2021-10-21 04:04:35,800 - mmcls - INFO - Epoch [1][70/201]\tlr: 5.000e-03, eta: 0:01:45, time: 0.278, data_time: 0.020, memory: 1709, loss: 0.4372\n",
            "2021-10-21 04:04:38,595 - mmcls - INFO - Epoch [1][80/201]\tlr: 5.000e-03, eta: 0:01:40, time: 0.280, data_time: 0.019, memory: 1709, loss: 0.3179\n",
            "2021-10-21 04:04:41,351 - mmcls - INFO - Epoch [1][90/201]\tlr: 5.000e-03, eta: 0:01:36, time: 0.276, data_time: 0.018, memory: 1709, loss: 0.3175\n",
            "2021-10-21 04:04:44,157 - mmcls - INFO - Epoch [1][100/201]\tlr: 5.000e-03, eta: 0:01:32, time: 0.280, data_time: 0.021, memory: 1709, loss: 0.3412\n",
            "2021-10-21 04:04:46,974 - mmcls - INFO - Epoch [1][110/201]\tlr: 5.000e-03, eta: 0:01:28, time: 0.282, data_time: 0.019, memory: 1709, loss: 0.2985\n",
            "2021-10-21 04:04:49,767 - mmcls - INFO - Epoch [1][120/201]\tlr: 5.000e-03, eta: 0:01:25, time: 0.280, data_time: 0.021, memory: 1709, loss: 0.2778\n",
            "2021-10-21 04:04:52,553 - mmcls - INFO - Epoch [1][130/201]\tlr: 5.000e-03, eta: 0:01:21, time: 0.278, data_time: 0.021, memory: 1709, loss: 0.2229\n",
            "2021-10-21 04:04:55,356 - mmcls - INFO - Epoch [1][140/201]\tlr: 5.000e-03, eta: 0:01:18, time: 0.280, data_time: 0.021, memory: 1709, loss: 0.2318\n",
            "2021-10-21 04:04:58,177 - mmcls - INFO - Epoch [1][150/201]\tlr: 5.000e-03, eta: 0:01:14, time: 0.282, data_time: 0.022, memory: 1709, loss: 0.2333\n",
            "2021-10-21 04:05:01,025 - mmcls - INFO - Epoch [1][160/201]\tlr: 5.000e-03, eta: 0:01:11, time: 0.285, data_time: 0.020, memory: 1709, loss: 0.2783\n",
            "2021-10-21 04:05:03,833 - mmcls - INFO - Epoch [1][170/201]\tlr: 5.000e-03, eta: 0:01:08, time: 0.281, data_time: 0.022, memory: 1709, loss: 0.2132\n",
            "2021-10-21 04:05:06,648 - mmcls - INFO - Epoch [1][180/201]\tlr: 5.000e-03, eta: 0:01:05, time: 0.281, data_time: 0.019, memory: 1709, loss: 0.2096\n",
            "2021-10-21 04:05:09,472 - mmcls - INFO - Epoch [1][190/201]\tlr: 5.000e-03, eta: 0:01:02, time: 0.282, data_time: 0.020, memory: 1709, loss: 0.1729\n",
            "2021-10-21 04:05:12,229 - mmcls - INFO - Epoch [1][200/201]\tlr: 5.000e-03, eta: 0:00:59, time: 0.275, data_time: 0.018, memory: 1709, loss: 0.1969\n",
            "2021-10-21 04:05:12,275 - mmcls - INFO - Saving checkpoint at 1 epochs\n"
          ]
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "[>>>>>>>>>>>>>>>>>>>>>>>>>>] 1601/1601, 104.1 task/s, elapsed: 15s, ETA:     0s"
          ]
        },
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "2021-10-21 04:05:27,767 - mmcls - INFO - Epoch(val) [1][51]\taccuracy_top-1: 95.6277\n",
            "2021-10-21 04:05:32,987 - mmcls - INFO - Epoch [2][10/201]\tlr: 5.000e-04, eta: 0:00:57, time: 0.505, data_time: 0.238, memory: 1709, loss: 0.1764\n",
            "2021-10-21 04:05:35,779 - mmcls - INFO - Epoch [2][20/201]\tlr: 5.000e-04, eta: 0:00:54, time: 0.278, data_time: 0.020, memory: 1709, loss: 0.1514\n",
            "2021-10-21 04:05:38,537 - mmcls - INFO - Epoch [2][30/201]\tlr: 5.000e-04, eta: 0:00:51, time: 0.276, data_time: 0.020, memory: 1709, loss: 0.1395\n",
            "2021-10-21 04:05:41,283 - mmcls - INFO - Epoch [2][40/201]\tlr: 5.000e-04, eta: 0:00:48, time: 0.275, data_time: 0.020, memory: 1709, loss: 0.1508\n",
            "2021-10-21 04:05:44,017 - mmcls - INFO - Epoch [2][50/201]\tlr: 5.000e-04, eta: 0:00:44, time: 0.274, data_time: 0.021, memory: 1709, loss: 0.1771\n",
            "2021-10-21 04:05:46,800 - mmcls - INFO - Epoch [2][60/201]\tlr: 5.000e-04, eta: 0:00:41, time: 0.278, data_time: 0.020, memory: 1709, loss: 0.1438\n",
            "2021-10-21 04:05:49,570 - mmcls - INFO - Epoch [2][70/201]\tlr: 5.000e-04, eta: 0:00:38, time: 0.277, data_time: 0.020, memory: 1709, loss: 0.1321\n",
            "2021-10-21 04:05:52,314 - mmcls - INFO - Epoch [2][80/201]\tlr: 5.000e-04, eta: 0:00:35, time: 0.275, data_time: 0.021, memory: 1709, loss: 0.1629\n",
            "2021-10-21 04:05:55,052 - mmcls - INFO - Epoch [2][90/201]\tlr: 5.000e-04, eta: 0:00:32, time: 0.273, data_time: 0.021, memory: 1709, loss: 0.1574\n",
            "2021-10-21 04:05:57,791 - mmcls - INFO - Epoch [2][100/201]\tlr: 5.000e-04, eta: 0:00:29, time: 0.274, data_time: 0.019, memory: 1709, loss: 0.1220\n",
            "2021-10-21 04:06:00,534 - mmcls - INFO - Epoch [2][110/201]\tlr: 5.000e-04, eta: 0:00:26, time: 0.274, data_time: 0.021, memory: 1709, loss: 0.2550\n",
            "2021-10-21 04:06:03,295 - mmcls - INFO - Epoch [2][120/201]\tlr: 5.000e-04, eta: 0:00:23, time: 0.276, data_time: 0.019, memory: 1709, loss: 0.1528\n",
            "2021-10-21 04:06:06,048 - mmcls - INFO - Epoch [2][130/201]\tlr: 5.000e-04, eta: 0:00:20, time: 0.275, data_time: 0.022, memory: 1709, loss: 0.1223\n",
            "2021-10-21 04:06:08,811 - mmcls - INFO - Epoch [2][140/201]\tlr: 5.000e-04, eta: 0:00:17, time: 0.276, data_time: 0.021, memory: 1709, loss: 0.1734\n",
            "2021-10-21 04:06:11,576 - mmcls - INFO - Epoch [2][150/201]\tlr: 5.000e-04, eta: 0:00:14, time: 0.277, data_time: 0.020, memory: 1709, loss: 0.1527\n",
            "2021-10-21 04:06:14,330 - mmcls - INFO - Epoch [2][160/201]\tlr: 5.000e-04, eta: 0:00:11, time: 0.276, data_time: 0.020, memory: 1709, loss: 0.1910\n",
            "2021-10-21 04:06:17,106 - mmcls - INFO - Epoch [2][170/201]\tlr: 5.000e-04, eta: 0:00:09, time: 0.277, data_time: 0.019, memory: 1709, loss: 0.1922\n",
            "2021-10-21 04:06:19,855 - mmcls - INFO - Epoch [2][180/201]\tlr: 5.000e-04, eta: 0:00:06, time: 0.274, data_time: 0.023, memory: 1709, loss: 0.1760\n",
            "2021-10-21 04:06:22,638 - mmcls - INFO - Epoch [2][190/201]\tlr: 5.000e-04, eta: 0:00:03, time: 0.278, data_time: 0.019, memory: 1709, loss: 0.1739\n",
            "2021-10-21 04:06:25,367 - mmcls - INFO - Epoch [2][200/201]\tlr: 5.000e-04, eta: 0:00:00, time: 0.272, data_time: 0.020, memory: 1709, loss: 0.1654\n",
            "2021-10-21 04:06:25,410 - mmcls - INFO - Saving checkpoint at 2 epochs\n"
          ]
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "[>>>>>>>>>>>>>>>>>>>>>>>>>>] 1601/1601, 105.5 task/s, elapsed: 15s, ETA:     0s"
          ]
        },
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "2021-10-21 04:06:40,694 - mmcls - INFO - Epoch(val) [2][51]\taccuracy_top-1: 97.5016\n"
          ]
        }
      ],
      "source": [
        "import time\n",
        "import mmcv\n",
        "import os.path as osp\n",
        "\n",
        "from mmcls.datasets import build_dataset\n",
        "from mmcls.models import build_classifier\n",
        "from mmcls.apis import train_model\n",
        "\n",
        "# Create the work directory\n",
        "mmcv.mkdir_or_exist(osp.abspath(cfg.work_dir))\n",
        "# Build the classifier\n",
        "model = build_classifier(cfg.model)\n",
        "model.init_weights()\n",
        "# Build the dataset\n",
        "datasets = [build_dataset(cfg.data.train)]\n",
        "# Add `CLASSES` attributes to help visualization\n",
        "model.CLASSES = datasets[0].CLASSES\n",
        "# Start fine-tuning\n",
        "train_model(\n",
        "    model,\n",
        "    datasets,\n",
        "    cfg,\n",
        "    distributed=False,\n",
        "    validate=True,\n",
        "    timestamp=time.strftime('%Y%m%d_%H%M%S', time.localtime()),\n",
        "    meta=dict())"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 304
        },
        "id": "HsoGBZA3miui",
        "outputId": "eb2e09f5-55ce-4165-b754-3b75dbc829ab"
      },
      "outputs": [
        {
          "data": {
            "image/png": "[encoded data, 206960 characters]",
            "text/plain": [
              "<Figure size 300.01x280.01 with 1 Axes>"
            ]
          },
          "metadata": {
            "needs_background": "light"
          },
          "output_type": "display_data"
        }
      ],
      "source": [
        "%matplotlib inline\n",
        "# Validate the fine-tuned model\n",
        "\n",
        "img = mmcv.imread('data/cats_dogs_dataset/training_set/training_set/cats/cat.1.jpg')\n",
        "\n",
        "model.cfg = cfg\n",
        "result = inference_model(model, img)\n",
        "\n",
        "show_result_pyplot(model, img, result)"
      ]
    }
  ],
  "metadata": {
    "accelerator": "GPU",
    "colab": {
      "collapsed_sections": [],
      "name": "MMClassification_python.ipynb",
      "provenance": [],
      "toc_visible": true
    },
    "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.8.11"
    },
    "widgets": {
      "application/vnd.jupyter.widget-state+json": {
        "31475aa888da4c8d844ba99a0b3397f5": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "ProgressStyleModel",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "520112917e0f4844995d418c5041d23a": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "863d2a8cc4074f2e890ba6aea7c54384": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "8a8ab7c27e404459951cffe7a32b8faa": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "9f3f6b72b4d14e2a96b9185331c8081b": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "HTMLModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_be55ab36267d4dcab1d83dfaa8540270",
            "placeholder": "​",
            "style": "IPY_MODEL_863d2a8cc4074f2e890ba6aea7c54384",
            "value": "100%"
          }
        },
        "a275bef3584b49ab9b680b528420d461": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "FloatProgressModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_e310c50e610248dd897fbbf5dd09dd7a",
            "max": 14206911,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_31475aa888da4c8d844ba99a0b3397f5",
            "value": 14206911
          }
        },
        "badf240bbb7d442fbd214e837edbffe2": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "HBoxModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_9f3f6b72b4d14e2a96b9185331c8081b",
              "IPY_MODEL_a275bef3584b49ab9b680b528420d461",
              "IPY_MODEL_c4b2c6914a05497b8d2b691bd6dda6da"
            ],
            "layout": "IPY_MODEL_520112917e0f4844995d418c5041d23a"
          }
        },
        "be55ab36267d4dcab1d83dfaa8540270": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "c4b2c6914a05497b8d2b691bd6dda6da": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "HTMLModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_e1a3dce90c1a4804a9ef0c687a9c0703",
            "placeholder": "​",
            "style": "IPY_MODEL_8a8ab7c27e404459951cffe7a32b8faa",
            "value": " 13.5M/13.5M [00:01&lt;00:00, 9.60MB/s]"
          }
        },
        "e1a3dce90c1a4804a9ef0c687a9c0703": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "e310c50e610248dd897fbbf5dd09dd7a": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        }
      }
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}
