{"cells": [{"metadata": {"_cell_guid": "3acd6a41-43a8-4832-a84b-2988655dbcb0", "_uuid": "c63d29a4a79755adf0572411a35762a8da0ae191"}, "cell_type": "markdown", "source": ["**Our goal is to check how many train images we have per breed**"]}, {"metadata": {"_cell_guid": "12021e52-0776-4228-ab4a-5fa30c25e099", "_uuid": "0ed80464bd7976ffa3b1fb1794409430355ca9a6"}, "cell_type": "markdown", "source": ["Lets import some libraries first."]}, {"metadata": {"collapsed": true, "_cell_guid": "d0ce18fe-ce07-4dc5-b07b-09bf2d85e5e6", "_uuid": "3f6f2c7929fbbdefa759f7250a320c6668dd92b2"}, "source": ["import numpy as np # linear algebra\n", "import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n", "from PIL import Image"], "execution_count": null, "cell_type": "code", "outputs": []}, {"metadata": {"_cell_guid": "f0218b22-6d71-4e82-9f29-e93f12acddff", "_uuid": "25bc4226ab87b1210147f7f45f21b05e4336b479"}, "cell_type": "markdown", "source": ["Now we can load train data and check structure"]}, {"metadata": {"collapsed": true, "_cell_guid": "f9a34af0-8fa0-4255-9b77-d2bc46a09418", "_uuid": "08e3670afc1d71a3d98d26244d8e704b1905d2e9"}, "source": ["labels = pd.read_csv(\"../input/labels.csv\")\n", "labels.head()"], "execution_count": null, "cell_type": "code", "outputs": []}, {"metadata": {"_cell_guid": "643e872b-9e17-4bdd-befc-95fbfa2cac7f", "_uuid": "02289de8fe02558c4b2659eaead00d2cb5a68410"}, "cell_type": "markdown", "source": ["Ok, lets check how many unique breeds we have"]}, {"metadata": {"collapsed": true, "_cell_guid": "e7d728d4-849f-4c18-b5f1-795053c47ade", "_uuid": "5a62b2b27a09423486aa4884e406e5cad4fd02d7"}, "source": ["unique_breeds = labels.breed.unique()\n", "len(unique_breeds)"], "execution_count": null, "cell_type": "code", "outputs": []}, {"metadata": {"_cell_guid": "e1e91197-ef11-401e-83f9-a0b45c1c1ee8", "_uuid": "285e23aa0200a64d12653af193877c2a7cb3cbe0"}, "cell_type": "markdown", "source": ["We have good news - all breeds are present in train dataset.\n", "\n", "So lets calculate amount if images for every breed and check most frequent."]}, {"metadata": {"collapsed": true, "_cell_guid": "ac752a1a-97eb-4cc4-a112-8c031cd443dd", "_uuid": "5d749f5f994488e1d004efa530aa9b70cd098929"}, "source": ["gr_labels = labels.groupby(\"breed\").count()\n", "gr_labels = gr_labels.rename(columns = {\"id\" : \"count\"})\n", "gr_labels = gr_labels.sort_values(\"count\", ascending=False)\n", "gr_labels.head()"], "execution_count": null, "cell_type": "code", "outputs": []}, {"metadata": {"_cell_guid": "b2f21a27-0d04-4dae-98e5-05ef8c777007", "_uuid": "f9eb755a2edc28dd530935d9d3adfa68d896d4a7"}, "cell_type": "markdown", "source": ["Ok, so most popular breed in dataset is scottish deerhound with 126 images.\n", "Lets look on one of them :)"]}, {"metadata": {"collapsed": true, "_cell_guid": "7cc45f98-c778-42e6-93ea-9762fa6f0578", "_uuid": "c760eb1eb4f57a751e13ee12b0de4ccf3fd05e2b"}, "source": ["scottish_deerhound_id = labels.loc[labels.breed == \"scottish_deerhound\"].iloc[0, 0]\n", "Image.open(\"../input/train/\"+scottish_deerhound_id+\".jpg\")"], "execution_count": null, "cell_type": "code", "outputs": []}, {"metadata": {"_cell_guid": "fce9bc06-8bf6-4947-88c1-0f3efff3c751", "_uuid": "d7a6b8504756bfd446b11ca88f13a8c88f4acd79"}, "cell_type": "markdown", "source": ["And now lets check the most critical point: is there is very rare breed in dataset."]}, {"metadata": {"collapsed": true, "_cell_guid": "dfab66bb-619f-45b1-9031-aa2a2a152519", "_uuid": "66beb01ab8e95c2ed5e69235326a061eb4d7c749"}, "source": ["gr_labels.tail()"], "execution_count": null, "cell_type": "code", "outputs": []}, {"metadata": {"_cell_guid": "f0259530-f58c-43eb-9c29-2543dd2faa33", "_uuid": "08e151b109ef2f96033d2e9814026f06e5af3278"}, "cell_type": "markdown", "source": ["Five most rare breeds have 66-67 images. Thats very nice.\n", "\n", "And for sure we need to check how eskimo dog looks like :)"]}, {"metadata": {"collapsed": true, "_cell_guid": "f584fc99-4e4e-49cd-8300-b9ebee2f41bc", "_uuid": "b87d2cbe47910be1faa076f868d30e5a8cec97da"}, "source": ["eskimo_dog_id = labels.loc[labels.breed == \"eskimo_dog\"].iloc[1, 0] #0 row is too agressive, so i decided to take 1st :)\n", "Image.open(\"../input/train/\"+eskimo_dog_id+\".jpg\")"], "execution_count": null, "cell_type": "code", "outputs": []}, {"metadata": {"_cell_guid": "fe45b413-853c-4634-b633-e5cfcbf6ecae", "_uuid": "674f33d6b1f927a2a34e32a18ce237cd4e244341"}, "cell_type": "markdown", "source": ["***Good luck!***"]}], "nbformat": 4, "metadata": {"language_info": {"pygments_lexer": "ipython3", "nbconvert_exporter": "python", "name": "python", "codemirror_mode": {"name": "ipython", "version": 3}, "file_extension": ".py", "mimetype": "text/x-python", "version": "3.6.1"}, "kernelspec": {"language": "python", "name": "python3", "display_name": "Python 3"}}, "nbformat_minor": 1}