{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"# <B><u>Preview of Whale and Dolphin Dataset with Plotly/Matplotlib</u></B>","metadata":{}},{"cell_type":"markdown","source":"# [1] Introduction","metadata":{}},{"cell_type":"markdown","source":"The dataset for \"Happywhale - Whale and Dolphin Identification\" competition is visualized with <u>[Plotly](https://plotly.com/python/)</u> and <u>[Matplotlib](https://matplotlib.org/)</u> in the kernel. It may help us to get some insight into strategy of training, data augumentation, etc.","metadata":{}},{"cell_type":"markdown","source":"All of the figures, tables, etc. for train images in the kernel are as follows,\n- Number of train images,\n- Number of species,\n- Graph/Table of number of images/individuals for each species (with Plotly),\n- Graph/Table of number of images for each individual (with Plotly),\n- Sample of train images for each species/individual (with Matplotlib).","metadata":{}},{"cell_type":"markdown","source":"All of the figures, tables, etc. for test images in the kernel are as follows,\n- Number of test images,\n- Sample of test images (with Matplotlib).","metadata":{}},{"cell_type":"markdown","source":"NOTE1 : The author is a beginner of Kaggle/MachineLearning/Python/English. So the kernel may have several bugs/wrongs. I am happy to get your comments. Thank you in advance for your kind advice to make the kernel so NICE! and to make me NICE deep learning guy!! ","metadata":{}},{"cell_type":"markdown","source":" NOTE2 : Those contents may be usefull for beginners of Kaggle/MachineLearning/Python.\n - How to load competition data in Kaggle notebook\n - How to process images with Pillow/Numpy\n - How to process data with Pandas\n - How to visualize data with Plotly/Matplotlib","metadata":{}},{"cell_type":"markdown","source":"# [2] Preparation of dataset","metadata":{}},{"cell_type":"markdown","source":"The dataset for \"Happywhale - Whale and Dolphin Identification\" can be loaded by clicking the following buttons in the sidebar of kaggle notebook,","metadata":{}},{"cell_type":"markdown","source":"###  \"+ Add data\" -> \"Competition Data\" -> \"Add (Happywhale - Whale and Dolphin Identification)\".","metadata":{}},{"cell_type":"markdown","source":"If it succeeds, the data are loaded to the following path. ","metadata":{}},{"cell_type":"code","source":"path_to_inputs = \"/kaggle/input/happy-whale-and-dolphin\"\n!ls {path_to_inputs}","metadata":{"execution":{"iopub.status.busy":"2022-02-25T09:09:01.390402Z","iopub.execute_input":"2022-02-25T09:09:01.390783Z","iopub.status.idle":"2022-02-25T09:09:02.257829Z","shell.execute_reply.started":"2022-02-25T09:09:01.390693Z","shell.execute_reply":"2022-02-25T09:09:02.256655Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"The contents of csv files are shown.","metadata":{}},{"cell_type":"code","source":"!head {path_to_inputs}/sample_submission.csv","metadata":{"execution":{"iopub.status.busy":"2022-02-25T09:09:02.260042Z","iopub.execute_input":"2022-02-25T09:09:02.260339Z","iopub.status.idle":"2022-02-25T09:09:03.102049Z","shell.execute_reply.started":"2022-02-25T09:09:02.260301Z","shell.execute_reply":"2022-02-25T09:09:03.100825Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!head {path_to_inputs}/train.csv","metadata":{"execution":{"iopub.status.busy":"2022-02-25T09:09:03.104064Z","iopub.execute_input":"2022-02-25T09:09:03.105157Z","iopub.status.idle":"2022-02-25T09:09:03.929270Z","shell.execute_reply.started":"2022-02-25T09:09:03.105099Z","shell.execute_reply":"2022-02-25T09:09:03.928498Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"The list of train/test images are shown.","metadata":{}},{"cell_type":"code","source":"!ls {path_to_inputs}/train_images | head","metadata":{"execution":{"iopub.status.busy":"2022-02-25T09:09:03.931301Z","iopub.execute_input":"2022-02-25T09:09:03.932211Z","iopub.status.idle":"2022-02-25T09:09:05.642614Z","shell.execute_reply.started":"2022-02-25T09:09:03.932167Z","shell.execute_reply":"2022-02-25T09:09:05.641359Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!ls {path_to_inputs}/test_images | head","metadata":{"execution":{"iopub.status.busy":"2022-02-25T09:09:05.644794Z","iopub.execute_input":"2022-02-25T09:09:05.645097Z","iopub.status.idle":"2022-02-25T09:09:07.034614Z","shell.execute_reply.started":"2022-02-25T09:09:05.645066Z","shell.execute_reply":"2022-02-25T09:09:07.033669Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"The number of train/test images are shown.","metadata":{}},{"cell_type":"code","source":"!echo \"Number of train_images:\"\n!ls {path_to_inputs}/train_images | cat -n | tail -1 | cut -f1\n!echo \"\"\n!echo \"Number of test_images:\"\n!ls {path_to_inputs}/test_images | cat -n | tail -1 | cut -f1","metadata":{"execution":{"iopub.status.busy":"2022-02-25T09:09:07.035922Z","iopub.execute_input":"2022-02-25T09:09:07.036164Z","iopub.status.idle":"2022-02-25T09:09:11.267697Z","shell.execute_reply.started":"2022-02-25T09:09:07.036138Z","shell.execute_reply":"2022-02-25T09:09:11.266661Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"The metadata for train images exists, but the one for test images is not exists. So the dummy metadata for test images is generated. Same format as the metadata for train images is assumed for loading test images with same manner.","metadata":{}},{"cell_type":"code","source":"# Generates metadata for test images. \npath_to_test_metadata = \"/kaggle/working/test.csv\"\n\n!echo \"image,species,individual_id\" > {path_to_test_metadata}\n!ls {path_to_inputs}/test_images | sed \"s/.jpg/.jpg,unknown,unknown/g\" >> {path_to_test_metadata}\n\n# Shows contents of generated metadata.\n!head {path_to_test_metadata}","metadata":{"execution":{"iopub.status.busy":"2022-02-25T09:09:11.269427Z","iopub.execute_input":"2022-02-25T09:09:11.269750Z","iopub.status.idle":"2022-02-25T09:09:13.798595Z","shell.execute_reply.started":"2022-02-25T09:09:11.269713Z","shell.execute_reply":"2022-02-25T09:09:13.797153Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# [3] Showing train images","metadata":{}},{"cell_type":"markdown","source":"The train images and those statistics are shown,\n- Number of species,\n- Graph/Table of number of images/individuals for each species (with Plotly),\n- Graph/Table of number of images for each individual (with Plotly).","metadata":{}},{"cell_type":"markdown","source":"## [3-1] Loading dataset","metadata":{}},{"cell_type":"code","source":"# Installs required libraries.\n!pip install numpy\n!pip install pandas\n!pip install matplotlib\n!pip install Pillow\n!pip install plotly","metadata":{"_kg_hide-output":true,"execution":{"iopub.status.busy":"2022-02-25T09:09:13.800545Z","iopub.execute_input":"2022-02-25T09:09:13.800833Z","iopub.status.idle":"2022-02-25T09:09:57.323618Z","shell.execute_reply.started":"2022-02-25T09:09:13.800802Z","shell.execute_reply":"2022-02-25T09:09:57.322826Z"},"collapsed":true,"jupyter":{"outputs_hidden":true},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Import required libraries.\nimport numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\nfrom PIL import Image, ImageDraw\nimport plotly.graph_objects as go\nfrom plotly.subplots import make_subplots\n#import IPython","metadata":{"execution":{"iopub.status.busy":"2022-02-25T09:09:57.325150Z","iopub.execute_input":"2022-02-25T09:09:57.325402Z","iopub.status.idle":"2022-02-25T09:09:57.347554Z","shell.execute_reply.started":"2022-02-25T09:09:57.325371Z","shell.execute_reply":"2022-02-25T09:09:57.346741Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Defines the class to load metadata and images and to process those.\nclass WhaleAndDolphin():\n    def __init__(self, path_to_metadata, path_to_dir_images):\n        self._path_to_metadata = path_to_metadata\n        self._path_to_dir_images = path_to_dir_images\n        self._metadata = pd.read_csv(path_to_metadata)\n        \n    def getAllSpecies(self):\n        return self._metadata[\"species\"].unique()\n    \n    def sliceMetadata(self, query):\n        return self._metadata.query(query).reset_index(drop=True)\n    \n    def getAllIndividualIDs(self, metadata):\n        return metadata[\"individual_id\"].unique()\n    \n    def showImagesTile(self, metadata, num_cols=4):\n        num_rows = len(metadata) // num_cols + 1\n        fig = plt.figure(figsize=(6.4 * num_cols, 4.8 * num_rows))\n        \n        for row in metadata.itertuples():\n            ax = fig.add_subplot(num_rows, num_cols, row.Index + 1)\n            \n            title = self.getTitle(row)\n            ax.set_title(title)\n            \n            image = self.getImage(row)\n            plt.imshow(image)\n            \n        plt.show()\n        plt.clf()\n        plt.close()\n        \n    def getTitle(self, metadata_row):\n        #return self._title(metadata_row.individual_id, metadata_row.species)\n        return metadata_row.image\n    \n    def getImage(self, metadata_row):\n        path_to_image = self._pathToImage(self._path_to_dir_images, \\\n                                          metadata_row.image)\n        return Image.open(path_to_image)\n    \n    def _title(self, individual_id, species):\n        return \"%s (%s)\" % (individual_id, species)\n    \n    def _pathToImage(self, path_to_dir_images, file_name):\n        return \"%s/%s\" % (path_to_dir_images, file_name)\n    \n    def getImageArray(self, metadata_row):\n        image_pil = self.getImage(metadata_row)\n        return np.array(image_pil)\n    \n    def showIndividualImagesTile(self, metadata, num_cols=3, \\\n                                 max_num_individual_images=3, \\\n                                 max_num_individuals=10):\n        individual_ids = self.getAllIndividualIDs(metadata)\n        for individual_id in individual_ids[:max_num_individuals]:\n            print()\n            print(\"Individual ID : %s\" % individual_id)\n            metadata_individual = \\\n                metadata.query(\"individual_id == @individual_id\").reset_index(drop=True)\n            self.showImagesTile(\n                metadata=metadata_individual[:max_num_individual_images], \\\n                num_cols=num_cols \\\n            )","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-02-25T09:09:57.350136Z","iopub.execute_input":"2022-02-25T09:09:57.350444Z","iopub.status.idle":"2022-02-25T09:09:57.365010Z","shell.execute_reply.started":"2022-02-25T09:09:57.350407Z","shell.execute_reply":"2022-02-25T09:09:57.363812Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"The dataset for train images is loaded. The dataset for test images will be loaded later using same class.","metadata":{}},{"cell_type":"code","source":"# Loads metadata for train images.\npath_to_metadata = \"%s/train.csv\" % path_to_inputs\npath_to_dir_images = \"%s/train_images\" % path_to_inputs\n\nwhale_and_dolphin = WhaleAndDolphin(\n    path_to_metadata=path_to_metadata,\n    path_to_dir_images=path_to_dir_images\n)","metadata":{"execution":{"iopub.status.busy":"2022-02-25T09:09:57.366369Z","iopub.execute_input":"2022-02-25T09:09:57.367069Z","iopub.status.idle":"2022-02-25T09:09:57.509764Z","shell.execute_reply.started":"2022-02-25T09:09:57.367012Z","shell.execute_reply":"2022-02-25T09:09:57.508742Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## [3-2] Statistics of train images","metadata":{}},{"cell_type":"markdown","source":"### [3-2-1] Number of species","metadata":{}},{"cell_type":"markdown","source":"The number of species and name of species are shown.","metadata":{}},{"cell_type":"code","source":"# Shows number of species and its names.\nall_species = whale_and_dolphin.getAllSpecies()\n\nprint(\"Number of species:\")\nprint(len(all_species))\nprint()\n\nprint(\"Name of species:\")\nprint(all_species)\nprint()","metadata":{"execution":{"iopub.status.busy":"2022-02-25T09:09:57.511251Z","iopub.execute_input":"2022-02-25T09:09:57.511479Z","iopub.status.idle":"2022-02-25T09:09:57.533169Z","shell.execute_reply.started":"2022-02-25T09:09:57.511451Z","shell.execute_reply":"2022-02-25T09:09:57.531833Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### [3-2-2] Number of images/individuals for each species","metadata":{}},{"cell_type":"markdown","source":"The graph/table of number of images/unique individuals for each species are shown with Plotly.","metadata":{}},{"cell_type":"code","source":"# Calculates numbers of images/individuals for each species are calculated.\nmetadata = {}\nstats_species = pd.DataFrame(columns=[\"num_of_images\", \"num_of_individuals\"], \\\n                             index=all_species)\n\nfor species in all_species:\n    # Calculates number of images for each species.\n    metadata[species] = whale_and_dolphin.sliceMetadata(query=\"species == @species\")\n    num_images = len(metadata[species])\n    \n    # Calculates number of individuals for each species. \n    individual_ids = whale_and_dolphin.getAllIndividualIDs(metadata[species])\n    num_individuals = len(individual_ids)\n    \n    # Appends the result into summary table.\n    stats_species.loc[species] = [num_images, num_individuals]\n\n# Calculates total number of images/individuals and appends the result into summary table.\nstats_species.loc[\"total\"] = [stats_species[\"num_of_images\"].sum(), stats_species[\"num_of_individuals\"].sum()]","metadata":{"execution":{"iopub.status.busy":"2022-02-25T09:09:57.534958Z","iopub.execute_input":"2022-02-25T09:09:57.535526Z","iopub.status.idle":"2022-02-25T09:09:57.709353Z","shell.execute_reply.started":"2022-02-25T09:09:57.535476Z","shell.execute_reply":"2022-02-25T09:09:57.708067Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Shows the graph of numbers of images/individuals for each species with Plotly.\nfig = go.Figure()\nfor column_name, items in stats_species[:len(stats_species)-1].iteritems():\n    trace = go.Bar(x=items.index.tolist(), y=items.tolist(), name=column_name)\n    fig.add_trace(trace)\nfig.update_layout(yaxis_title=\"Number of images/individuals for each species\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2022-02-25T09:09:57.710677Z","iopub.execute_input":"2022-02-25T09:09:57.710924Z","iopub.status.idle":"2022-02-25T09:09:58.013005Z","shell.execute_reply.started":"2022-02-25T09:09:57.710887Z","shell.execute_reply":"2022-02-25T09:09:58.011920Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Shows the table of numbers of images/individuals for each species.\nprint(\"Number of images/individuals for each species:\")\nstats_species","metadata":{"execution":{"iopub.status.busy":"2022-02-25T09:09:58.014462Z","iopub.execute_input":"2022-02-25T09:09:58.014752Z","iopub.status.idle":"2022-02-25T09:09:58.033464Z","shell.execute_reply.started":"2022-02-25T09:09:58.014722Z","shell.execute_reply":"2022-02-25T09:09:58.032733Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### [3-2-3] Number of images for each individual","metadata":{}},{"cell_type":"markdown","source":"The graph/table of numbers of images for each individuals are shown with Plotly. Total number of individuals is too large to show all images at once, so only the numbers of images for a species \"false_killer_whale\" is shown as an example. The species can be changed easily by changing the variable \"species\".","metadata":{}},{"cell_type":"code","source":"species = \"false_killer_whale\" # It can be changed to \"melon_headed_whale\", \"humpback_whale\", etc.\nindividual_ids = whale_and_dolphin.getAllIndividualIDs(metadata[species])\n\nstats_individuals = pd.DataFrame(columns=[\"num_of_images\"], index=individual_ids)\n\nfor individual_id in individual_ids:\n    # Calculates number of images for each individual and appends the result into summary table.\n    metadata_individual = metadata[species].query(\"individual_id == @individual_id\").reset_index(drop=True)\n    num_images = len(metadata_individual)\n    \n    stats_individuals.loc[individual_id] = [num_images]\n\n# Calculates total number of images/individuals and appends the result into summary table.\nstats_individuals.loc[\"total\"] = [stats_individuals[\"num_of_images\"].sum()]","metadata":{"execution":{"iopub.status.busy":"2022-02-25T09:09:58.034487Z","iopub.execute_input":"2022-02-25T09:09:58.034748Z","iopub.status.idle":"2022-02-25T09:09:58.440018Z","shell.execute_reply.started":"2022-02-25T09:09:58.034719Z","shell.execute_reply":"2022-02-25T09:09:58.439056Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Shows the graph of numbers of images for each individuals with Plotly.\nfig = go.Figure()\nfor column_name, items in stats_individuals[:len(stats_individuals)-1].iteritems():\n    trace = go.Bar(x=items.index.tolist(), y=items.tolist(), name=column_name)\n    fig.add_trace(trace)\nfig.update_layout(title_text=\"Species : %s\" % species, yaxis_title=\"Number of images for each individuals\")\nfig.update_layout(xaxis_rangeslider_visible=True)\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2022-02-25T09:09:58.441251Z","iopub.execute_input":"2022-02-25T09:09:58.441497Z","iopub.status.idle":"2022-02-25T09:09:58.482459Z","shell.execute_reply.started":"2022-02-25T09:09:58.441467Z","shell.execute_reply":"2022-02-25T09:09:58.481510Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Unsets limitation of display of rows.\npd.set_option(\"display.max_rows\", None)\n\n# Shows the table of number of images for each individuals.\nprint(\"Number of images for each individual of %s:\" % species)\nprint(\"(Total number of individuals for %s: %d)\" % (species, len(stats_individuals)-1))\nstats_individuals","metadata":{"execution":{"iopub.status.busy":"2022-02-25T09:09:58.483913Z","iopub.execute_input":"2022-02-25T09:09:58.484305Z","iopub.status.idle":"2022-02-25T09:09:58.506178Z","shell.execute_reply.started":"2022-02-25T09:09:58.484263Z","shell.execute_reply":"2022-02-25T09:09:58.505250Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## [3-3] Sample of train images","metadata":{}},{"cell_type":"markdown","source":"The train images for the first 10 individuals for each species are shown with Matplotlib. The images for same individual are shown in same row. \nThe number of images for each row can be changed by changing the variable \"num_cols\". The number of images for each individual can be changed by changing the variable \"max_num_individual_images\". The number of individuals can be changed by changing the variable \"max_num_individuals\".","metadata":{}},{"cell_type":"code","source":"# Shows train images for the first 10 individuals for each species.\nnum_cols = 4\nmax_num_individual_images = 4\nmax_num_individuals = 10\n\nfor species in all_species:\n    print()\n    print(\"--------------------------------------------------\")\n    print()\n    print(\"   Images for %s\" % species)\n    print()\n    print(\"--------------------------------------------------\")\n    whale_and_dolphin.showIndividualImagesTile( \\\n        metadata=metadata[species], \\\n        num_cols=num_cols, \\\n        max_num_individual_images=max_num_individual_images, \\\n        max_num_individuals=max_num_individuals \\\n    )\n    print()\n    print()","metadata":{"execution":{"iopub.status.busy":"2022-02-25T09:09:58.507472Z","iopub.execute_input":"2022-02-25T09:09:58.507741Z","iopub.status.idle":"2022-02-25T09:19:52.792919Z","shell.execute_reply.started":"2022-02-25T09:09:58.507703Z","shell.execute_reply":"2022-02-25T09:19:52.791784Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# [4] Showing test images","metadata":{}},{"cell_type":"markdown","source":"The test images and those statistics are shown,\n- Number of images.","metadata":{}},{"cell_type":"markdown","source":"## [4-1] Loading dataset","metadata":{}},{"cell_type":"markdown","source":"The dataset for test images is loaded using the same class as test images.","metadata":{}},{"cell_type":"code","source":"# Loads metadata for test images.\npath_to_metadata = \"%s\" % path_to_test_metadata\npath_to_dir_images = \"%s/test_images\" % path_to_inputs\n\nwhale_and_dolphin = WhaleAndDolphin(\n    path_to_metadata=path_to_metadata,\n    path_to_dir_images=path_to_dir_images\n)","metadata":{"execution":{"iopub.status.busy":"2022-02-25T09:19:52.794632Z","iopub.execute_input":"2022-02-25T09:19:52.794989Z","iopub.status.idle":"2022-02-25T09:19:52.837052Z","shell.execute_reply.started":"2022-02-25T09:19:52.794940Z","shell.execute_reply":"2022-02-25T09:19:52.835936Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## [4-2] Statistics of test images","metadata":{}},{"cell_type":"markdown","source":"The number of species and name of species are shown.","metadata":{}},{"cell_type":"code","source":"# Shows number of images for each species.\nall_species = whale_and_dolphin.getAllSpecies()\n\nprint(\"Number of species:\")\nprint(len(all_species))\nprint()\n\nprint(\"All species:\")\nprint(all_species)\nprint()","metadata":{"execution":{"iopub.status.busy":"2022-02-25T09:19:52.839017Z","iopub.execute_input":"2022-02-25T09:19:52.839597Z","iopub.status.idle":"2022-02-25T09:19:52.848174Z","shell.execute_reply.started":"2022-02-25T09:19:52.839554Z","shell.execute_reply":"2022-02-25T09:19:52.847306Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Number of images are shown.","metadata":{}},{"cell_type":"code","source":"print(\"Number of images:\")\nprint()\nprint(\"species, num_of_images\")\n\nmetadata = {}\nfor species in all_species:\n    metadata[species] = whale_and_dolphin.sliceMetadata(query=\"species == @species\")\n    num_images = len(metadata[species])\n    \n    print(\"%s, %d\" % (species, num_images))","metadata":{"execution":{"iopub.status.busy":"2022-02-25T09:19:52.849790Z","iopub.execute_input":"2022-02-25T09:19:52.850291Z","iopub.status.idle":"2022-02-25T09:19:52.873209Z","shell.execute_reply.started":"2022-02-25T09:19:52.850249Z","shell.execute_reply":"2022-02-25T09:19:52.872327Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## [4-3] Sample of test images","metadata":{}},{"cell_type":"markdown","source":"Sample of test images are shown with Matplotlib. \nThe number of images can be changed by changing the variable \"num_images\". The number of images for each row can be changed by changing the variable \"num_cols\".","metadata":{}},{"cell_type":"code","source":"# Shows first 100 test images.\nnum_images = 100\ni_first = 0\ni_end = i_first + num_images\nnum_cols = 4\n\nfor species in all_species:\n    print()\n    print(\"--------------------------------------------------\")\n    print()\n    print(\"   Images for %s\" % species)\n    print()\n    print(\"--------------------------------------------------\")\n    print()\n    whale_and_dolphin.showImagesTile( \\\n        metadata=metadata[species][i_first:i_end], \\\n        num_cols=num_cols \\\n    )\n    print()\n    print()","metadata":{"execution":{"iopub.status.busy":"2022-02-25T09:19:52.874505Z","iopub.execute_input":"2022-02-25T09:19:52.874776Z","iopub.status.idle":"2022-02-25T09:21:00.375808Z","shell.execute_reply.started":"2022-02-25T09:19:52.874745Z","shell.execute_reply":"2022-02-25T09:21:00.374140Z"},"trusted":true},"execution_count":null,"outputs":[]}]}