{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "00bf1c4e-13dc-a42a-b905-1811c8ed3f9a"
      },
      "outputs": [],
      "source": [
        "# This Python 3 environment comes with many helpful analytics libraries installed\n",
        "# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python\n",
        "# For example, here's several helpful packages to load in \n",
        "\n",
        "import pandas as pd\n",
        "import numpy as np\n",
        "import glob\n",
        "import os\n",
        "import cv2\n",
        "import matplotlib.pyplot as plt\n",
        "%matplotlib inline\n",
        "\n",
        "train_data = pd.read_csv('../input/Train/train.csv')\n",
        "train_imgs = sorted(glob.glob('../input/Train/*.jpg'), key=lambda name: int(os.path.basename(name)[:-4]))\n",
        "train_dot_imgs = sorted(glob.glob('../input/TrainDotted/*.jpg'), key=lambda name: int(os.path.basename(name)[:-4]))\n",
        "\n",
        "submission = pd.read_csv('../input/sample_submission.csv')\n",
        "\n",
        "\n",
        "print(train_data.shape)\n",
        "print('Number of Train Images: {:d}'.format(len(train_imgs)))\n",
        "print('Number of Dotted-Train Images: {:d}'.format(len(train_dot_imgs)))\n",
        "\n",
        "\n",
        "\n",
        "print(train_data.head(6))\n",
        "\n",
        "# Input data files are available in the \"../input/\" directory.\n",
        "# For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory\n",
        "\n",
        "from subprocess import check_output\n",
        "print(check_output([\"ls\", \"../input\"]).decode(\"utf8\"))\n",
        "\n",
        "# Any results you write to the current directory are saved as output."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "f739bbcf-0de2-cf0c-8ccb-e48036aa1da6"
      },
      "outputs": [],
      "source": [
        "index = 5\n",
        "sl_counts = train_data.iloc[index]\n",
        "print(sl_counts)\n",
        "\n",
        "plt.figure()\n",
        "sl_counts.plot(kind='bar', title='Count of Sea Lion Types')\n",
        "plt.show()\n",
        "\n",
        "print(train_imgs[index])\n",
        "img = cv2.cvtColor(cv2.imread(train_imgs[index]), cv2.COLOR_BGR2RGB)\n",
        "img_dot = cv2.cvtColor(cv2.imread(train_dot_imgs[index]), cv2.COLOR_BGR2RGB)\n",
        "\n",
        "crop_img = img[200:2000, 2600:3500]\n",
        "crop_img_dot = img_dot[200:2000, 2600:3500]\n",
        "\n",
        "f, ax = plt.subplots(1,2,figsize=(16,8))\n",
        "(ax1, ax2) = ax.flatten()\n",
        "\n",
        "ax1.imshow(img)\n",
        "ax2.imshow(img_dot)\n",
        "\n",
        "plt.show()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "_cell_guid": "f6a74286-f168-13e4-a6f6-5a226774d8d2"
      },
      "source": [
        "## The tasks should include the following:\n",
        "1. Find the dot in dotted image\n",
        "2. Run sliding window to crop small images which contain the dot and let it contain each sea lion as possible. \n",
        "3. Set these small images as training image and fit it with some algorithm\n",
        "4. Modify the algorithm until it is accurate enough.\n",
        "5. Apply the algorithm to test images and upload the results"
      ]
    }
  ],
  "metadata": {
    "_change_revision": 0,
    "_is_fork": false,
    "kernelspec": {
      "display_name": "Python 3",
      "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.6.0"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}