{"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":"# <center style=\"font-family: consolas; font-size: 32px; font-weight: bold;\">🐦 BirdCLEF 🕊️ - Data and problem investigation</center>\n<p><center style=\"color:#949494; font-family: consolas; font-size: 20px;\">BirdCLEF 2023 - Identify bird calls in soundscapes</center></p>\n\n***","metadata":{}},{"cell_type":"markdown","source":"# <center style=\"font-family: consolas; font-size: 32px; font-weight: bold;\">(ಠಿ⁠_⁠ಠ) Overview</center>\n\n<p style=\"font-family: consolas; font-size: 16px;\">⚪ The goal of this competition is to use machine learning to <b>identify Eastern African bird species by sound</b>.</p>\n\n<p style=\"font-family: consolas; font-size: 16px;\">⚪ The purpose of this is to <b>provide a more cost-effective and logistically feasible method</b> of conducting bird biodiversity surveys, which can be challenging and expensive when done through traditional observer-based methods.</p>\n\n<p style=\"font-family: consolas; font-size: 16px;\">⚪ By using passive acoustic monitoring (PAM) combined with new analytical tools based on machine learning, conservationists can sample much larger spatial scales with higher temporal resolution, allowing for a more comprehensive exploration of the relationship between restoration interventions and biodiversity.</p>\n\n<p style=\"font-family: consolas; font-size: 16px;\">⚪ The best entries in the competition will be able to develop reliable classifiers with limited training data, which will help advance ongoing efforts to protect avian biodiversity in Africa, including those led by the Kenyan conservation organization NATURAL STATE.</p>","metadata":{}},{"cell_type":"markdown","source":"#### <a id=\"top\"></a>\n# <div style=\"box-shadow: rgb(60, 121, 245) 0px 0px 0px 3px inset, rgb(255, 255, 255) 10px -10px 0px -3px, rgb(31, 193, 27) 10px -10px, rgb(255, 255, 255) 20px -20px 0px -3px, rgb(255, 217, 19) 20px -20px, rgb(255, 255, 255) 30px -30px 0px -3px, rgb(255, 156, 85) 30px -30px, rgb(255, 255, 255) 40px -40px 0px -3px, rgb(255, 85, 85) 40px -40px; padding:20px; margin-right: 40px; font-size:30px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(60, 121, 245);\"><b>Table of contents</b></div>\n\n<div style=\"background-color: rgba(60, 121, 245, 0.03); padding:30px; font-size:15px; font-family: consolas;\">\n\n* [0. Import all dependencies](#0)\n* [1. Overview directories](#1)\n    * [1.1 Overview train_audio/ directory](#1.1)\n    * [1.2 Overview test_soundscapes/ directory](#1.2)\n* [2. Overview train_metadata.csv file](#2)\n    * [2.1 Check for missing data](#2.1)\n    * [2.2 Consider how many classes are present in the training set](#2.2)\n    * [2.3 Consider the column secondary labels](#2.3)\n    * [2.4 Consider the column type](#2.4)\n    * [2.5 Consider the column scientific name](#2.5)\n    * [2.6 Consider the columns latitude & longitude](#2.6)\n    * [2.7 Consider the column rating](#2.7)\n* [3. Overview eBird_Taxonomy_v2021.csv file](#3)\n    * [3.1 Check for missing data](#3.1)\n    * [3.2 Histogram of the taxonomic order counts](#3.2)\n    * [3.3 Category Taxonomic Order Distribution](#3.3)\n    * [3.4 Family Taxonomic Order Distribution](#3.4)\n* [4. Audio Exploration of Top11 most popular birds](#4)\n    * [4.1 Barn Swallow](#4.1)\n    * [4.2 Willow Warbler](#4.2)\n    * [4.3 Thrush Nightingale](#4.3)\n    * [4.4 Western Yellow Wagtail](#4.4)\n    * [4.5 Common Sandpiper](#4.5)\n    * [4.6 Wood Sandpiper](#4.6)\n    * [4.7 Common Buzzard](#4.7)\n    * [4.8 European Bee-eater](#4.8)\n    * [4.9 Eurasian Hoopoe](#4.9)\n    * [4.10 Common House-Martin](#4.10)\n    * [4.11 Common House-Martin](#4.11)","metadata":{}},{"cell_type":"markdown","source":"<a id=\"0\"></a>\n# <div style=\"box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px inset, rgb(51, 51, 51) 0px 0px 0px 3px inset; padding:20px; font-size:32px; font-family: consolas; text-align:center; display:fill; border-radius:15px;  color:rgb(34, 34, 34);\"> <b> 0. Import all dependencies </b></div>","metadata":{}},{"cell_type":"code","source":"import os\nimport random\nimport cv2\nimport librosa\nimport folium\nimport pandas as pd\nimport numpy as np\nimport plotly.express as px\nimport matplotlib.pyplot as plt\nfrom folium.plugins import HeatMap\nfrom folium.features import DivIcon\nfrom IPython.display import Audio, display","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:24.023935Z","iopub.execute_input":"2023-03-22T22:50:24.024823Z","iopub.status.idle":"2023-03-22T22:50:28.161623Z","shell.execute_reply.started":"2023-03-22T22:50:24.024777Z","shell.execute_reply":"2023-03-22T22:50:28.160157Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"class color:\n   PURPLE = '\\033[95m'\n   CYAN = '\\033[96m'\n   DARKCYAN = '\\033[36m'\n   BLUE = '\\033[94m'\n   GREEN = '\\033[92m'\n   YELLOW = '\\033[93m'\n   RED = '\\033[91m'\n   BOLD = '\\033[1m'\n   UNDERLINE = '\\033[4m'\n   END = '\\033[0m'","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:28.164199Z","iopub.execute_input":"2023-03-22T22:50:28.164735Z","iopub.status.idle":"2023-03-22T22:50:28.176029Z","shell.execute_reply.started":"2023-03-22T22:50:28.164681Z","shell.execute_reply":"2023-03-22T22:50:28.172380Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from plotly.offline import init_notebook_mode\nimport plotly.graph_objs as go\nimport plotly\n\ninit_notebook_mode(connected=True)","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:28.177659Z","iopub.execute_input":"2023-03-22T22:50:28.179375Z","iopub.status.idle":"2023-03-22T22:50:28.281512Z","shell.execute_reply.started":"2023-03-22T22:50:28.179281Z","shell.execute_reply":"2023-03-22T22:50:28.280378Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def normalize(v):\n    norm = np.linalg.norm(v)\n    if norm == 0: \n        return v\n    return v / norm\n\n\ndef display_audio(\n    dir_path: str, label: str, example: str = None, \n    sr: int = 8000, wf_duration: int = 5, wf_offset: int = 0\n) -> None:\n    \n    if example is None:\n        example = os.listdir(f\"{dir_path}/{label}\")[0].split(\".\")[0]\n    \n    if label == \"\":\n        filename = f\"{dir_path}/{example}.ogg\"\n        label = \"None\"\n    else:\n        filename = f\"{dir_path}/{label}/{example}.ogg\"\n    \n    print(f\"\\nLabel - {color.BOLD}{color.PURPLE}{label}{color.END}, example - {example}:\")\n    display(Audio(filename=filename))\n    \n    y, sr = librosa.load(\n        filename, sr=sr, mono=False, \n        duration=wf_duration, offset=wf_offset\n    )\n    y_mono = librosa.to_mono(y)\n\n    dur = np.arange(0, len(y_mono)) / sr\n    dur += wf_offset\n    y_norm = normalize(y_mono)\n    \n    layout = go.Layout(\n        xaxis_title=\"Time (s)\", \n        yaxis_title=\"Amplitude\",\n        margin=dict(l=0, r=0, t=0, b=0)\n    )\n    plotly.offline.iplot({\n        \"data\": [go.Scatter(x=dur, y=y_norm, name='normalized')],\n        \"layout\": layout\n    })\n    ","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:28.283965Z","iopub.execute_input":"2023-03-22T22:50:28.284593Z","iopub.status.idle":"2023-03-22T22:50:28.298372Z","shell.execute_reply.started":"2023-03-22T22:50:28.284557Z","shell.execute_reply":"2023-03-22T22:50:28.297468Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"1\"></a>\n# <div style=\"box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px inset, rgb(51, 51, 51) 0px 0px 0px 3px inset; padding:20px; font-size:32px; font-family: consolas; text-align:center; display:fill; border-radius:15px;  color:rgb(34, 34, 34);\"> <b> 1. Overview directories </b></div>","metadata":{}},{"cell_type":"markdown","source":"<a id=\"1.1\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 1.1 Overview <i>train_audio/</i> directory</b></div>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">⚪ The provided training data for this competition includes brief recordings of separate bird calls that have been contributed by users of <a href=\"https://xeno-canto.org/\"><strong>xenocanto.org</strong></a>. To ensure compatibility with the test set audio, these files have been converted to the ogg format and downsampled to 32 kHz where appropriate. It is expected that the training data comprises almost all of the pertinent files, and it is not necessary to search for additional ones on <a href=\"https://xeno-canto.org/\"><strong>xenocanto.org</strong></a>:</p>\n\n<p style=\"text-align:center;\"><img src=\"https://user-images.githubusercontent.com/45982614/223520408-82b31ee8-3733-4ed6-b62d-46a88b9def3b.png\" width=\"90%\" height=\"90%\"></p>\n\n","metadata":{}},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">⚪ Number of entries in the directory:</p>","metadata":{}},{"cell_type":"code","source":"len(os.listdir(\"/kaggle/input/birdclef-2023/train_audio\"))","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:28.299617Z","iopub.execute_input":"2023-03-22T22:50:28.300451Z","iopub.status.idle":"2023-03-22T22:50:28.340351Z","shell.execute_reply.started":"2023-03-22T22:50:28.300415Z","shell.execute_reply":"2023-03-22T22:50:28.338860Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">⚪ Let's listen to a few samples and plot their waveforms:</p>","metadata":{}},{"cell_type":"code","source":"display_audio(\"/kaggle/input/birdclef-2023/train_audio\", \"abethr1\", \"XC128013\")\ndisplay_audio(\"/kaggle/input/birdclef-2023/train_audio\", \"abhori1\", \"XC120250\")","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:28.341970Z","iopub.execute_input":"2023-03-22T22:50:28.342724Z","iopub.status.idle":"2023-03-22T22:50:43.257836Z","shell.execute_reply.started":"2023-03-22T22:50:28.342678Z","shell.execute_reply":"2023-03-22T22:50:43.256535Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"1.2\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 1.2 Overview <i>test_soundscapes/</i> directory</b></div>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">⚪ When you submit a notebook, the test_soundscapes directory will be populated with approximately 200 recordings to be used for scoring. These recordings are 10 minutes in duration and are saved in the ogg audio format, with their file names randomized. Your submission notebook should take approximately five minutes to load all of the test soundscapes.</p>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">⚪ This directory has only one audiofile as an example.</p>","metadata":{}},{"cell_type":"code","source":"!ls /kaggle/input/birdclef-2023/test_soundscapes","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:43.259667Z","iopub.execute_input":"2023-03-22T22:50:43.260745Z","iopub.status.idle":"2023-03-22T22:50:44.396039Z","shell.execute_reply.started":"2023-03-22T22:50:43.260681Z","shell.execute_reply":"2023-03-22T22:50:44.394633Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!ls -lh /kaggle/input/birdclef-2023/test_soundscapes/soundscape_29201.ogg","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:44.397856Z","iopub.execute_input":"2023-03-22T22:50:44.398317Z","iopub.status.idle":"2023-03-22T22:50:45.530142Z","shell.execute_reply.started":"2023-03-22T22:50:44.398262Z","shell.execute_reply":"2023-03-22T22:50:45.528644Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">⚪ Let's listen to it:</p>","metadata":{}},{"cell_type":"code","source":"display_audio(\"/kaggle/input/birdclef-2023/test_soundscapes\", \"\", \"soundscape_29201\")","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:45.532460Z","iopub.execute_input":"2023-03-22T22:50:45.533810Z","iopub.status.idle":"2023-03-22T22:50:46.018664Z","shell.execute_reply.started":"2023-03-22T22:50:45.533763Z","shell.execute_reply":"2023-03-22T22:50:46.017123Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"2\"></a>\n# <div style=\"box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px inset, rgb(51, 51, 51) 0px 0px 0px 3px inset; padding:20px; font-size:32px; font-family: consolas; text-align:center; display:fill; border-radius:15px;  color:rgb(34, 34, 34);\"> <b> 2. Overview <i>train_metadata.csv</i> file</b></div>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">A wide range of metadata is provided for the training data. The most directly relevant fields are:</p>\n\n* <p style=\"font-family: consolas; font-size: 16px;\"> <b><i><code>primary_label</code></i></b> - a code for the bird species. You can review detailed information about the bird codes by appending the <a href=\"https://ebird.org/species/\"><strong>code</strong></a>, such as <a href=\"https://ebird.org/species/amecro\"><strong>American Crow</strong></a>.</p>\n* <p style=\"font-family: consolas; font-size: 16px;\"> <b><i><code>latitude </code></i></b> & <b><i><code>longitude</code></i></b>: coordinates for where the recording was taken. Some bird species may have local call 'dialects,' so you may want to seek geographic diversity in your training data.</p>\n* <p style=\"font-family: consolas; font-size: 16px;\"> <b><i><code>author</code></i></b> - The user who provided the recording.</p>\n* <p style=\"font-family: consolas; font-size: 16px;\"> <b><i><code>filename</code></i></b>: the name of the associated audio file.</p>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">⚪ Read .csv file.</p>","metadata":{}},{"cell_type":"code","source":"train_metadata_df = pd.read_csv(\"/kaggle/input/birdclef-2023/train_metadata.csv\")","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:46.023441Z","iopub.execute_input":"2023-03-22T22:50:46.023973Z","iopub.status.idle":"2023-03-22T22:50:46.152918Z","shell.execute_reply.started":"2023-03-22T22:50:46.023933Z","shell.execute_reply":"2023-03-22T22:50:46.151370Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_metadata_df.head()","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:46.154382Z","iopub.execute_input":"2023-03-22T22:50:46.154848Z","iopub.status.idle":"2023-03-22T22:50:46.192628Z","shell.execute_reply.started":"2023-03-22T22:50:46.154813Z","shell.execute_reply":"2023-03-22T22:50:46.191693Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"Examples count:\", len(train_metadata_df))","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:46.194279Z","iopub.execute_input":"2023-03-22T22:50:46.195043Z","iopub.status.idle":"2023-03-22T22:50:46.200634Z","shell.execute_reply.started":"2023-03-22T22:50:46.194968Z","shell.execute_reply":"2023-03-22T22:50:46.199345Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_metadata_df.describe()","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:46.202123Z","iopub.execute_input":"2023-03-22T22:50:46.202572Z","iopub.status.idle":"2023-03-22T22:50:46.246058Z","shell.execute_reply.started":"2023-03-22T22:50:46.202526Z","shell.execute_reply":"2023-03-22T22:50:46.244806Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"2.1\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 2.1 Check for missing data</b></div>","metadata":{}},{"cell_type":"code","source":"train_metadata_df.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:46.247827Z","iopub.execute_input":"2023-03-22T22:50:46.248438Z","iopub.status.idle":"2023-03-22T22:50:46.267482Z","shell.execute_reply.started":"2023-03-22T22:50:46.248398Z","shell.execute_reply":"2023-03-22T22:50:46.266200Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"2.2\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 2.2 Consider how many classes are present in the training set</b></div>","metadata":{}},{"cell_type":"code","source":"primary_label_counts = train_metadata_df.primary_label.value_counts()","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:46.268781Z","iopub.execute_input":"2023-03-22T22:50:46.270158Z","iopub.status.idle":"2023-03-22T22:50:46.278371Z","shell.execute_reply.started":"2023-03-22T22:50:46.270092Z","shell.execute_reply":"2023-03-22T22:50:46.276917Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"Primary labels count:\", len(primary_label_counts.index))","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:46.280317Z","iopub.execute_input":"2023-03-22T22:50:46.281122Z","iopub.status.idle":"2023-03-22T22:50:46.291773Z","shell.execute_reply.started":"2023-03-22T22:50:46.281068Z","shell.execute_reply":"2023-03-22T22:50:46.290386Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">⚪ Let's build a bar plot to see the ratio of the number of instances for each of the classes. Since the number of labels exceeds the plot limit, an interactive graph was built, with which you can fully examine the distribution.</p>","metadata":{}},{"cell_type":"code","source":"primary_label_counts = train_metadata_df.primary_label.value_counts().sort_values()\n\nfig = px.bar(\n    x=primary_label_counts.values, y=primary_label_counts.index,\n    color_discrete_sequence=['cornflowerblue'],\n    orientation='h', height=1000\n)\nfig.update_layout(xaxis_title=\"Count\", yaxis_title=\"Label\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:46.293567Z","iopub.execute_input":"2023-03-22T22:50:46.295192Z","iopub.status.idle":"2023-03-22T22:50:46.605149Z","shell.execute_reply.started":"2023-03-22T22:50:46.295141Z","shell.execute_reply":"2023-03-22T22:50:46.603778Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"2.3\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 2.3 Consider the column <code><i>secondary labels</i></code></b></div>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\"> ⚪ Consider how common the secondary column is.</p>","metadata":{"execution":{"iopub.status.busy":"2023-03-07T19:37:28.447183Z","iopub.execute_input":"2023-03-07T19:37:28.448055Z","iopub.status.idle":"2023-03-07T19:37:28.457364Z","shell.execute_reply.started":"2023-03-07T19:37:28.447992Z","shell.execute_reply":"2023-03-07T19:37:28.455326Z"}}},{"cell_type":"code","source":"print(\"All secondary column occurrences:\", sum(train_metadata_df.secondary_labels != \"[]\"))","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:46.607115Z","iopub.execute_input":"2023-03-22T22:50:46.607592Z","iopub.status.idle":"2023-03-22T22:50:46.616575Z","shell.execute_reply.started":"2023-03-22T22:50:46.607553Z","shell.execute_reply":"2023-03-22T22:50:46.615706Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">⚪ Let's combine all secondary labels in one array and plot their distribution. Since the secondary labels are a list that is represented as a string, we can convert the string back to a list using the <b>eval</b> method.</p>","metadata":{}},{"cell_type":"code","source":"all_secondary_labels = sum([eval(x) for x in train_metadata_df.secondary_labels], [])\nall_secondary_labels_counts = pd.value_counts(all_secondary_labels).sort_values()","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:46.617875Z","iopub.execute_input":"2023-03-22T22:50:46.618213Z","iopub.status.idle":"2023-03-22T22:50:46.885672Z","shell.execute_reply.started":"2023-03-22T22:50:46.618180Z","shell.execute_reply":"2023-03-22T22:50:46.884630Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig = px.bar(\n    x=all_secondary_labels_counts.values, y=all_secondary_labels_counts.index,\n    color_discrete_sequence=['darkslateblue'],\n    orientation='h', height=1000\n)\nfig.update_layout(xaxis_title=\"Count\", yaxis_title=\"Secondary Label\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:46.887418Z","iopub.execute_input":"2023-03-22T22:50:46.887775Z","iopub.status.idle":"2023-03-22T22:50:46.954388Z","shell.execute_reply.started":"2023-03-22T22:50:46.887741Z","shell.execute_reply":"2023-03-22T22:50:46.953024Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"2.4\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 2.4 Consider the column <code><i>type</i></code></b></div>","metadata":{}},{"cell_type":"code","source":"print(\"Type column occurrences:\", sum(train_metadata_df.type != \"[]\"))","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:46.956599Z","iopub.execute_input":"2023-03-22T22:50:46.957089Z","iopub.status.idle":"2023-03-22T22:50:46.967643Z","shell.execute_reply.started":"2023-03-22T22:50:46.957033Z","shell.execute_reply":"2023-03-22T22:50:46.966094Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"type_labels = sum([eval(x) for x in train_metadata_df.type], [])\ntype_counts = pd.value_counts(type_labels).sort_values()","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:46.969485Z","iopub.execute_input":"2023-03-22T22:50:46.969879Z","iopub.status.idle":"2023-03-22T22:50:48.462076Z","shell.execute_reply.started":"2023-03-22T22:50:46.969845Z","shell.execute_reply":"2023-03-22T22:50:48.460442Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig = px.bar(\n    x=type_counts.values, y=[\n        f'{\" \".join(x.split(\" \")[:3])} ...' \n        if len(x.split(\" \")) > 3 else x \n        for x in type_counts.index\n    ],\n    color_discrete_sequence=['darkgoldenrod'],\n    orientation='h', height=1000\n)\nfig.update_layout(xaxis_title=\"Count\", yaxis_title=\"Audio type\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:48.464128Z","iopub.execute_input":"2023-03-22T22:50:48.464526Z","iopub.status.idle":"2023-03-22T22:50:48.538272Z","shell.execute_reply.started":"2023-03-22T22:50:48.464489Z","shell.execute_reply":"2023-03-22T22:50:48.536735Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"2.5\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 2.5 Consider the column <code><i>scientific name</i></code></b></div>","metadata":{}},{"cell_type":"code","source":"scientific_name_counts = train_metadata_df.scientific_name.value_counts().sort_values()\n\nfig = px.bar(\n    x=scientific_name_counts.values, y=scientific_name_counts.index,\n    color_discrete_sequence=['crimson'],\n    orientation='h', height=1000\n)\nfig.update_layout(xaxis_title=\"Count\", yaxis_title=\"Scientific name\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:48.539917Z","iopub.execute_input":"2023-03-22T22:50:48.540268Z","iopub.status.idle":"2023-03-22T22:50:48.612404Z","shell.execute_reply.started":"2023-03-22T22:50:48.540234Z","shell.execute_reply":"2023-03-22T22:50:48.611058Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"2.6\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 2.6 Consider the columns <code><i>latitude</i></code> & <code><i>longitude</i></code></b></div>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">🔴 Each record has data about the place of its creation (its latitude and longitude). Let's visualize all this data on a map using <b>folio</b>.</p>","metadata":{}},{"cell_type":"code","source":"# As we considired before we have some NaN values in the data, let's drop it\nfiltered_train_metadata_df = train_metadata_df.dropna()","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:48.614374Z","iopub.execute_input":"2023-03-22T22:50:48.614910Z","iopub.status.idle":"2023-03-22T22:50:48.637967Z","shell.execute_reply.started":"2023-03-22T22:50:48.614855Z","shell.execute_reply":"2023-03-22T22:50:48.636507Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig = px.density_mapbox(\n    filtered_train_metadata_df, \n    lat='latitude', lon='longitude', \n    radius=7, zoom=2,\n    mapbox_style=\"stamen-terrain\", \n    center=dict(\n        lat=filtered_train_metadata_df['latitude'].mean(), \n        lon=filtered_train_metadata_df['longitude'].mean()\n    )\n)\n\nfig.update_layout(margin={\"r\":0,\"t\":0,\"l\":0,\"b\":0})\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:48.639461Z","iopub.execute_input":"2023-03-22T22:50:48.640907Z","iopub.status.idle":"2023-03-22T22:50:48.797062Z","shell.execute_reply.started":"2023-03-22T22:50:48.640861Z","shell.execute_reply":"2023-03-22T22:50:48.795740Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">🔴 Let's combine latitute and longitude with a class label. When plotting the entire dataframe, the visualization lags a lot, so I sample 10% of the dataframe.</p>\n\n<p style=\"font-family: consolas; font-size: 16px;\">⚪ Each of the labels has its own unique color, and if you want to know the label on the map, you can simply click on the icon you are interested in and annotation will be shown.</p>","metadata":{}},{"cell_type":"code","source":"fig = px.scatter_mapbox(\n    filtered_train_metadata_df, \n    lat=\"latitude\", lon=\"longitude\", color=\"common_name\",\n    hover_name=\"filename\", hover_data=[\"common_name\", \"author\", \"rating\"],\n    zoom=2, height=500, \n    center=dict(\n        lat=filtered_train_metadata_df['latitude'].mean(), \n        lon=filtered_train_metadata_df['longitude'].mean()\n    )\n)\n\nfig.update_layout(mapbox_style=\"open-street-map\")\nfig.update_layout(margin={\"r\":0,\"t\":0,\"l\":0,\"b\":0})\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:48.798516Z","iopub.execute_input":"2023-03-22T22:50:48.798955Z","iopub.status.idle":"2023-03-22T22:50:50.746731Z","shell.execute_reply.started":"2023-03-22T22:50:48.798913Z","shell.execute_reply":"2023-03-22T22:50:50.744214Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"2.7\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 2.7 Consider the column <code><i>rating</i></code></b></div>","metadata":{}},{"cell_type":"code","source":"fig = px.histogram(train_metadata_df, x=\"rating\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:50.753546Z","iopub.execute_input":"2023-03-22T22:50:50.754110Z","iopub.status.idle":"2023-03-22T22:50:50.873744Z","shell.execute_reply.started":"2023-03-22T22:50:50.754070Z","shell.execute_reply":"2023-03-22T22:50:50.872357Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"3\"></a>\n# <div style=\"box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px inset, rgb(51, 51, 51) 0px 0px 0px 3px inset; padding:20px; font-size:32px; font-family: consolas; text-align:center; display:fill; border-radius:15px;  color:rgb(34, 34, 34);\"> <b> 3. Overview <i>eBird_Taxonomy_v2021.csv</i> file</b></div>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">🔴 In this .csv file represented the data on the relationships between different species. This data may be used to identify relationships between different species of birds based on their taxonomic classification.</p>\n\n<p style=\"font-family: consolas; font-size: 16px;\"> Description of the columns:</p>\n\n* <p style=\"font-family: consolas; font-size: 16px;\"> <code>TAXON_ORDER</code>: The taxonomic order of the species.</p>\n* <p style=\"font-family: consolas; font-size: 16px;\"> <code>CATEGORY</code>: The taxonomic category of the species (e.g., species, subspecies, genus, family, etc.)</p>\n* <p style=\"font-family: consolas; font-size: 16px;\"> <code>SPECIES_CODE</code>: A unique code assigned to each species.</p>\n* <p style=\"font-family: consolas; font-size: 16px;\"> <code>PRIMARY_COM_NAME</code>: The common name of the species.</p>\n* <p style=\"font-family: consolas; font-size: 16px;\"> <code>SCI_NAME</code>: The scientific name of the species.</p>\n* <p style=\"font-family: consolas; font-size: 16px;\"> <code>ORDER1</code>: The taxonomic order of the species.</p>\n* <p style=\"font-family: consolas; font-size: 16px;\"> <code>FAMILY</code>: The taxonomic family of the species.</p>\n* <p style=\"font-family: consolas; font-size: 16px;\"> <code>SPECIES_GROUP</code>: The taxonomic group that the species belongs to.</p>\n* <p style=\"font-family: consolas; font-size: 16px;\"> <code>REPORT_AS</code>: A code indicating how the species should be reported.</p>","metadata":{}},{"cell_type":"code","source":"ebt_df = pd.read_csv(\"/kaggle/input/birdclef-2023/eBird_Taxonomy_v2021.csv\")","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:50.875584Z","iopub.execute_input":"2023-03-22T22:50:50.876565Z","iopub.status.idle":"2023-03-22T22:50:50.954607Z","shell.execute_reply.started":"2023-03-22T22:50:50.876524Z","shell.execute_reply":"2023-03-22T22:50:50.953392Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ebt_df.head()","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:50.956180Z","iopub.execute_input":"2023-03-22T22:50:50.956547Z","iopub.status.idle":"2023-03-22T22:50:50.973468Z","shell.execute_reply.started":"2023-03-22T22:50:50.956511Z","shell.execute_reply":"2023-03-22T22:50:50.972070Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ebt_df.describe()","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:50.975271Z","iopub.execute_input":"2023-03-22T22:50:50.976408Z","iopub.status.idle":"2023-03-22T22:50:50.998492Z","shell.execute_reply.started":"2023-03-22T22:50:50.976356Z","shell.execute_reply":"2023-03-22T22:50:50.997391Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\"> ⚪ Let's get the len of this dataframe.</p>","metadata":{}},{"cell_type":"code","source":"len(ebt_df)","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:50.999630Z","iopub.execute_input":"2023-03-22T22:50:51.000269Z","iopub.status.idle":"2023-03-22T22:50:51.007730Z","shell.execute_reply.started":"2023-03-22T22:50:51.000232Z","shell.execute_reply":"2023-03-22T22:50:51.006401Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"3.1\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 3.1 Check for missing data</b></div>","metadata":{}},{"cell_type":"code","source":"ebt_df.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:51.009224Z","iopub.execute_input":"2023-03-22T22:50:51.009604Z","iopub.status.idle":"2023-03-22T22:50:51.031916Z","shell.execute_reply.started":"2023-03-22T22:50:51.009558Z","shell.execute_reply":"2023-03-22T22:50:51.031060Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"3.2\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 3.2 Histogram of the taxonomic order counts</b></div>","metadata":{}},{"cell_type":"code","source":"fig = px.histogram(ebt_df, x=\"TAXON_ORDER\", nbins=300, color_discrete_sequence=['goldenrod'])\nfig.update_layout(\n    title={\n        'text': \"Distribution of Taxonomic Orders\",\n        'y':0.95,\n        'x':0.5,\n        'xanchor': 'center',\n        'yanchor': 'top'\n    }\n)\n\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:51.033481Z","iopub.execute_input":"2023-03-22T22:50:51.034107Z","iopub.status.idle":"2023-03-22T22:50:51.111482Z","shell.execute_reply.started":"2023-03-22T22:50:51.034071Z","shell.execute_reply":"2023-03-22T22:50:51.110241Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"3.3\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 3.3 Category Taxonomic Order Distribution</b></div>","metadata":{}},{"cell_type":"code","source":"fig = px.box(\n    ebt_df, \n    x=\"TAXON_ORDER\", y=\"CATEGORY\", \n    color_discrete_sequence=['black'],\n    orientation='h', height=1000\n)\n\nfig.update_layout(\n    title={\n        'text': \"Category Taxonomic Order Distribution\",\n        'y':0.97,\n        'x':0.5,\n        'xanchor': 'center',\n        'yanchor': 'top'\n    }\n)\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:51.113342Z","iopub.execute_input":"2023-03-22T22:50:51.113744Z","iopub.status.idle":"2023-03-22T22:50:51.301856Z","shell.execute_reply.started":"2023-03-22T22:50:51.113707Z","shell.execute_reply":"2023-03-22T22:50:51.300871Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"3.4\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 3.4 Family Taxonomic Order Distribution</b></div>","metadata":{}},{"cell_type":"code","source":"fig = px.scatter(\n    ebt_df, \n    x=\"TAXON_ORDER\", y=\"FAMILY\", \n    color_discrete_sequence=['brown'], \n    orientation='h', height=1000\n)\n\nfig.update_layout(\n    title={\n        'text': \"Family Taxonomic Order Distribution\",\n        'y':0.97,\n        'x':0.5,\n        'xanchor': 'center',\n        'yanchor': 'top'\n    }\n)\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:51.303428Z","iopub.execute_input":"2023-03-22T22:50:51.304060Z","iopub.status.idle":"2023-03-22T22:50:51.503686Z","shell.execute_reply.started":"2023-03-22T22:50:51.304019Z","shell.execute_reply":"2023-03-22T22:50:51.502348Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"4\"></a>\n# <div style=\"box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px inset, rgb(51, 51, 51) 0px 0px 0px 3px inset; padding:20px; font-size:32px; font-family: consolas; text-align:center; display:fill; border-radius:15px;  color:rgb(34, 34, 34);\"> <b> 4. Audio Exploration Top11 most popular birds </b></div>","metadata":{}},{"cell_type":"code","source":"topx = 11\n\ntop11_pl = list(primary_label_counts.index[-topx:])[::-1]","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:51:14.898254Z","iopub.execute_input":"2023-03-22T22:51:14.898728Z","iopub.status.idle":"2023-03-22T22:51:14.904557Z","shell.execute_reply.started":"2023-03-22T22:51:14.898685Z","shell.execute_reply":"2023-03-22T22:51:14.903563Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">⚪ Let's print Top10 most popular birsd with its info</p>","metadata":{}},{"cell_type":"code","source":"for primary_label in top11_pl:\n    ebt_info = ebt_df[ebt_df.SPECIES_CODE == primary_label]\n    print(f\"\\nLabel - {color.BOLD}{color.PURPLE}{primary_label}{color.END}; Name - {color.BOLD}{color.DARKCYAN}{ebt_info.PRIMARY_COM_NAME.iloc[0]}{color.END}; Scientific Name - {color.BOLD}{color.GREEN}{ebt_info.SCI_NAME.iloc[0]}{color.END}.\")","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:51:15.632408Z","iopub.execute_input":"2023-03-22T22:51:15.632898Z","iopub.status.idle":"2023-03-22T22:51:15.666683Z","shell.execute_reply.started":"2023-03-22T22:51:15.632850Z","shell.execute_reply":"2023-03-22T22:51:15.665350Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<p style=\"font-family: consolas; font-size: 16px;\">🔴 <b>For each of the birds, the corresponding photo, description, audio and waveform for a small fragment from the audio will be displayed.</b> And you will see, that even visually (on the waveforms for the audio) sounds of different birds are different. Have a nice listening!</p>","metadata":{}},{"cell_type":"markdown","source":"<a id=\"4.1\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 4.1 Barn Swallow</b></div>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"text-align:center;\"><img src=\"https://cdn.download.ams.birds.cornell.edu/api/v1/asset/312652671/1200\"></p>\n\n<p style=\"font-family: consolas; font-size: 16px;\">🔴 <code><b>Label</b></code> : <i>barswa</i></p>\n<p style=\"font-family: consolas; font-size: 16px;\">⚪ <code><b>Scientific Name</b></code> : <i>Hirundo rustica</i></p>\n<p style=\"font-family: consolas; font-size: 16px;\">⚪ <code><b>Description</b></code> : The Barn Swallow (Hirundo rustica) is a small bird with a blue-black upper body, rusty-red throat, chest, and forehead. They are found in North America, Europe, and Asia, and are known for their acrobatic flying patterns, insect diet, and distinctive vocalizations, including trills, chirps, and warbles. They build their nests out of mud and straw and attach them to the undersides of eaves or other overhanging structures, often near human habitation. Barn Swallows are beneficial to humans as they help control the insect population.</p>","metadata":{}},{"cell_type":"code","source":"display_audio(\"/kaggle/input/birdclef-2023/train_audio\", \"barswa\", wf_offset=1, wf_duration=0.5)","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:51.553837Z","iopub.execute_input":"2023-03-22T22:50:51.554209Z","iopub.status.idle":"2023-03-22T22:50:51.658031Z","shell.execute_reply.started":"2023-03-22T22:50:51.554173Z","shell.execute_reply":"2023-03-22T22:50:51.656593Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"4.2\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 4.2 Willow Warbler</b></div>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"text-align:center;\"><img src=\"https://cdn.download.ams.birds.cornell.edu/api/v1/asset/178515121/1200\"></p>\n\n<p style=\"font-family: consolas; font-size: 16px;\">🔴 <code><b>Label</b></code> : <i>wlwwar</i></p>\n<p style=\"font-family: consolas; font-size: 16px;\">⚪ <code><b>Scientific Name</b></code> : <i>Phylloscopus trochilus</i></p>\n<p style=\"font-family: consolas; font-size: 16px;\">⚪ <code><b>Description</b></code> : The Willow Warbler (Phylloscopus trochilus) is a small passerine bird with olive-brown upperparts, pale underparts, and a faint yellowish stripe above the eye. They are found across Europe and Asia and are known for their distinctive descending song, which is often heard in spring and summer. Willow Warblers are migratory birds that breed in Europe and Asia and winter in sub-Saharan Africa. They prefer open woodland habitats with dense shrubs, and feed on insects, spiders, and small invertebrates. These birds are known for their subtle plumage and unassuming behavior, making them difficult to spot in their natural habitat.</p>","metadata":{}},{"cell_type":"code","source":"display_audio(\"/kaggle/input/birdclef-2023/train_audio\", \"wlwwar\", wf_offset=3, wf_duration=1, sr=20000)","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:51.659910Z","iopub.execute_input":"2023-03-22T22:50:51.661270Z","iopub.status.idle":"2023-03-22T22:50:51.802613Z","shell.execute_reply.started":"2023-03-22T22:50:51.661223Z","shell.execute_reply":"2023-03-22T22:50:51.801395Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"4.3\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 4.3 Thrush Nightingale</b></div>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"text-align:center;\"><img src=\"https://cdn.download.ams.birds.cornell.edu/api/v1/asset/53660801/1200\"></p>\n\n<p style=\"font-family: consolas; font-size: 16px;\">🔴 <code><b>Label</b></code> : <i>thrnig1</i></p>\n<p style=\"font-family: consolas; font-size: 16px;\">⚪ <code><b>Scientific Name</b></code> : <i>Luscinia luscinia</i></p>\n<p style=\"font-family: consolas; font-size: 16px;\">⚪ <code><b>Description</b></code> : The Thrush Nightingale (Luscinia luscinia) is a small migratory bird that belongs to the Muscicapidae family. It has a distinctive brownish-grey plumage with a rust-red tail, a white belly, and a dark eye stripe. This bird is found in Eastern Europe and Asia, and it prefers dense vegetation and undergrowth near water bodies such as rivers and wetlands. The Thrush Nightingale is known for its beautiful and complex songs that are delivered during the breeding season. Its song consists of a mixture of trills, warbles, and whistles that are melodious and pleasant to the ear.</p>","metadata":{}},{"cell_type":"code","source":"display_audio(\"/kaggle/input/birdclef-2023/train_audio\", \"thrnig1\", wf_offset=1, wf_duration=1)","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:51.804033Z","iopub.execute_input":"2023-03-22T22:50:51.805140Z","iopub.status.idle":"2023-03-22T22:50:51.942285Z","shell.execute_reply.started":"2023-03-22T22:50:51.805087Z","shell.execute_reply":"2023-03-22T22:50:51.940954Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"4.4\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 4.4 Western Yellow Wagtail</b></div>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"text-align:center;\"><img src=\"https://cdn.download.ams.birds.cornell.edu/api/v1/asset/257824121/1200\"></p>\n\n<p style=\"font-family: consolas; font-size: 16px;\">🔴 <code><b>Label</b></code> : <i>eaywag1</i></p>\n<p style=\"font-family: consolas; font-size: 16px;\">⚪ <code><b>Scientific Name</b></code> : <i>Motacilla flava</i></p>\n<p style=\"font-family: consolas; font-size: 16px;\">⚪ <code><b>Description</b></code> : The Western Yellow Wagtail (Motacilla flava) is a small bird found across Europe and Asia, with a distinctive yellow underparts and olive-green back. It prefers open grassy areas and feeds on insects. During the breeding season, it circles above its territory while singing a sweet, high-pitched song. It has a distinctive yellow coloration on its underparts and head, with an olive-green back and a long, slender tail. This bird prefers open grassy areas, including meadows, fields, and marshes. Vocalizations consist of a series of short, melodious phrases that rise and fall in pitch.</p>","metadata":{}},{"cell_type":"code","source":"display_audio(\"/kaggle/input/birdclef-2023/train_audio\", \"eaywag1\", wf_duration=1, sr=15000)","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:51.943796Z","iopub.execute_input":"2023-03-22T22:50:51.944907Z","iopub.status.idle":"2023-03-22T22:50:52.082768Z","shell.execute_reply.started":"2023-03-22T22:50:51.944861Z","shell.execute_reply":"2023-03-22T22:50:52.081438Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"4.5\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 4.5 Common Sandpiper</b></div>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"text-align:center;\"><img src=\"https://cdn.download.ams.birds.cornell.edu/api/v1/asset/45128861/1200\"></p>\n\n<p style=\"font-family: consolas; font-size: 16px;\">🔴 <code><b>Label</b></code> : <i>comsan</i></p>\n<p style=\"font-family: consolas; font-size: 16px;\">⚪ <code><b>Scientific Name</b></code> : <i>Actitis hypoleucos</i></p>\n<p style=\"font-family: consolas; font-size: 16px;\">⚪ <code><b>Description</b></code> : The Common Sandpiper (Actitis hypoleucos) is a small migratory wading bird found across Europe, Asia, and Africa. It has a distinctive white belly, brown back, and a streaked breast. This bird prefers freshwater habitats, including rivers, streams, and lakeshores. The Common Sandpiper feeds on small aquatic invertebrates, such as insects, crustaceans, and mollusks. It is known for its distinctive flight pattern, which consists of a series of quick flaps followed by a glide close to the water surface. During the breeding season, it is also known for its high-pitched and melodious whistling call that rises in pitch and is often heard at dawn and dusk. The Common Sandpiper's call is a sharp \"peet-weet\" or \"pee-oo-wee\" sound that can be heard from a distance.</p>","metadata":{}},{"cell_type":"code","source":"display_audio(\"/kaggle/input/birdclef-2023/train_audio\", \"comsan\", wf_duration=1.3, wf_offset=1.4, sr=12000)","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:52.084312Z","iopub.execute_input":"2023-03-22T22:50:52.084695Z","iopub.status.idle":"2023-03-22T22:50:52.233963Z","shell.execute_reply.started":"2023-03-22T22:50:52.084648Z","shell.execute_reply":"2023-03-22T22:50:52.232792Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"4.6\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 4.6 Wood Sandpiper</b></div>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"text-align:center;\"><img src=\"https://cdn.download.ams.birds.cornell.edu/api/v1/asset/253697141/1200\"></p>\n\n<p style=\"font-family: consolas; font-size: 16px;\">🔴 <code><b>Label</b></code> : <i>woosan</i></p>\n<p style=\"font-family: consolas; font-size: 16px;\">⚪ <code><b>Scientific Name</b></code> : <i>Tringa glareola</i></p>\n<p style=\"font-family: consolas; font-size: 16px;\">⚪ <code><b>Description</b></code> : The Wood Sandpiper (Tringa glareola) is a small to medium-sized wading bird that belongs to the family Scolopacidae. They breed in the boreal and temperate regions of Europe and Asia and migrate to Africa, South Asia, and Australia during the non-breeding season. In terms of vocalizations, the Wood Sandpiper is not known for its song, as it has a relatively simple call. Their call is a short, sharp \"tit\" or \"tut\" sound, often repeated several times in quick succession. They also make a longer, more melodious whistle during courtship displays, which is described as a \"pleased to meet you\" whistle. This whistle is usually accompanied by a display of the male's wings and tail, which are spread wide to show off their breeding plumage.</p>","metadata":{}},{"cell_type":"code","source":"display_audio(\"/kaggle/input/birdclef-2023/train_audio\", \"woosan\", wf_duration=0.8, sr=12000)","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:52.235382Z","iopub.execute_input":"2023-03-22T22:50:52.235714Z","iopub.status.idle":"2023-03-22T22:50:52.350818Z","shell.execute_reply.started":"2023-03-22T22:50:52.235679Z","shell.execute_reply":"2023-03-22T22:50:52.349485Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"4.7\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 4.7 Common Buzzard</b></div>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"text-align:center;\"><img src=\"https://cdn.download.ams.birds.cornell.edu/api/v1/asset/46432331/1200\"></p>\n\n<p style=\"font-family: consolas; font-size: 16px;\">🔴 <code><b>Label</b></code> : <i>combuz1</i></p>\n<p style=\"font-family: consolas; font-size: 16px;\">⚪ <code><b>Scientific Name</b></code> : <i>Buteo buteo</i></p>\n<p style=\"font-family: consolas; font-size: 16px;\">⚪ <code><b>Description</b></code> : The Common Buzzard (Buteo buteo) is a medium-sized bird of prey belonging to the family Accipitridae. It is found throughout much of Europe, Asia, and northern Africa, and is known for its distinctive soaring flight and sharp eyesight. In terms of vocalizations, the Common Buzzard is known for its mewing call, which is often heard during its soaring flight. This call is described as a high-pitched, plaintive \"mew,\" which may be repeated several times in quick succession. During courtship displays, the male may also make a loud, rasping call, which is sometimes compared to the sound of a chainsaw. The female may respond with a softer, lower-pitched call, which is sometimes described as a \"peep\" or \"kee-yah.\" Overall, the Common Buzzard is known for its distinctive appearance and vocalizations, making it a recognizable and popular bird of prey throughout much of its range.</p>","metadata":{}},{"cell_type":"code","source":"display_audio(\"/kaggle/input/birdclef-2023/train_audio\", \"combuz1\", wf_duration=2, sr=12000)","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:52.352341Z","iopub.execute_input":"2023-03-22T22:50:52.352778Z","iopub.status.idle":"2023-03-22T22:50:52.512281Z","shell.execute_reply.started":"2023-03-22T22:50:52.352742Z","shell.execute_reply":"2023-03-22T22:50:52.510812Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"4.8\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 4.8 European Bee-eater</b></div>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"text-align:center;\"><img src=\"https://cdn.download.ams.birds.cornell.edu/api/v1/asset/459241061/1200\"></p>\n\n<p style=\"font-family: consolas; font-size: 16px;\">🔴 <code><b>Label</b></code> : <i>eubeat1</i></p>\n<p style=\"font-family: consolas; font-size: 16px;\">⚪ <code><b>Scientific Name</b></code> : <i>Merops apiaster</i></p>\n<p style=\"font-family: consolas; font-size: 16px;\">⚪ <code><b>Description</b></code> : The European Bee-eater (Merops apiaster) is a colorful and distinctive bird belonging to the family Meropidae. It is found throughout much of Europe and parts of Asia and Africa, and is known for its vibrant plumage and distinctive feeding habits. In terms of vocalizations, the European Bee-eater has a distinctive and melodious call, which is often described as a series of liquid, rolling notes. The call is most commonly heard during flight or when the birds are perched together in groups, and may be repeated several times in quick succession. During courtship displays, the male may also produce a softer, more trilling call, which is used to attract a mate.</p>","metadata":{}},{"cell_type":"code","source":"display_audio(\"/kaggle/input/birdclef-2023/train_audio\", \"eubeat1\", wf_offset=1, wf_duration=2, sr=22000)","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:52.513754Z","iopub.execute_input":"2023-03-22T22:50:52.514247Z","iopub.status.idle":"2023-03-22T22:50:52.737031Z","shell.execute_reply.started":"2023-03-22T22:50:52.514209Z","shell.execute_reply":"2023-03-22T22:50:52.735802Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"4.9\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 4.9 Eurasian Hoopoe</b></div>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"text-align:center;\"><img src=\"https://cdn.download.ams.birds.cornell.edu/api/v1/asset/186308261/1200\"></p>\n\n<p style=\"font-family: consolas; font-size: 16px;\">🔴 <code><b>Label</b></code> : <i>hoopoe</i></p>\n<p style=\"font-family: consolas; font-size: 16px;\">⚪ <code><b>Scientific Name</b></code> : <i>Upupa epops</i></p>\n<p style=\"font-family: consolas; font-size: 16px;\">⚪ <code><b>Description</b></code> : The Eurasian Hoopoe (Upupa epops) is a distinctive and colorful bird belonging to the family Upupidae. It is found throughout much of Europe, Asia, and Africa, and is known for its unique appearance and distinctive \"hoop hoop\" call. In terms of vocalizations, the Eurasian Hoopoe has a distinctive \"hoop hoop\" call, which is often repeated several times in quick succession. The call is usually given while the bird is in flight or perched on a branch, and is a distinctive and unmistakable sound. The male may also produce a softer, purring call during courtship displays, which is used to attract a mate.</p>","metadata":{}},{"cell_type":"code","source":"display_audio(\"/kaggle/input/birdclef-2023/train_audio\", \"hoopoe\", wf_offset=0.5, wf_duration=3, sr=12000)","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:52.738616Z","iopub.execute_input":"2023-03-22T22:50:52.739872Z","iopub.status.idle":"2023-03-22T22:50:52.958230Z","shell.execute_reply.started":"2023-03-22T22:50:52.739820Z","shell.execute_reply":"2023-03-22T22:50:52.956582Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"4.10\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 4.10 Common House-Martin</b></div>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"text-align:center;\"><img src=\"https://cdn.download.ams.birds.cornell.edu/api/v1/asset/258242941/1800\"></p>\n\n<p style=\"font-family: consolas; font-size: 16px;\">🔴 <code><b>Label</b></code> : <i>cohmar1</i></p>\n<p style=\"font-family: consolas; font-size: 16px;\">⚪ <code><b>Scientific Name</b></code> : <i>Delichon urbicum</i></p>\n<p style=\"font-family: consolas; font-size: 16px;\">⚪ <code><b>Description</b></code> : The Common House-Martin (Delichon urbicum) is a small, agile bird belonging to the family Hirundinidae. It is found throughout much of Europe, Asia, and northern Africa, and is known for its distinctive nesting habits and aerial acrobatics. In terms of vocalizations, the Common House-Martin is not known for its song, as it has a relatively simple call. Its call is a soft, high-pitched \"tseep\" or \"tsip,\" which is often heard during flight or when the bird is perched on a nest. During courtship displays, the male may produce a more elaborate song, consisting of a series of rapid trills and warbles.</p>","metadata":{}},{"cell_type":"code","source":"display_audio(\"/kaggle/input/birdclef-2023/train_audio\", \"cohmar1\", wf_offset=8, wf_duration=5.8, sr=12000)","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:50:52.959913Z","iopub.execute_input":"2023-03-22T22:50:52.960733Z","iopub.status.idle":"2023-03-22T22:50:53.274040Z","shell.execute_reply.started":"2023-03-22T22:50:52.960685Z","shell.execute_reply":"2023-03-22T22:50:53.272585Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<a id=\"4.11\"></a>\n## <div style=\"box-shadow: rgba(0, 0, 0, 0.18) 0px 2px 4px inset; padding:20px; font-size:24px; font-family: consolas; text-align:center; display:fill; border-radius:15px; color:rgb(67, 66, 66)\"> <b> 4.11 Little Egret</b></div>","metadata":{}},{"cell_type":"markdown","source":"<p style=\"text-align:center;\"><img src=\"https://cdn.download.ams.birds.cornell.edu/api/v1/asset/168489091/1800\"></p>\n\n<p style=\"font-family: consolas; font-size: 16px;\">🔴 <code><b>Label</b></code> : <i>litegr</i></p>\n<p style=\"font-family: consolas; font-size: 16px;\">⚪ <code><b>Egretta garzetta</b></code> : <i>Hirundo rustica</i></p>\n<p style=\"font-family: consolas; font-size: 16px;\">⚪ <code><b>Description</b></code> : The Little Egret (Egretta garzetta) is a small white heron that is found throughout much of the world, including Europe, Asia, Africa, and Australia. It is a slender, elegant bird that stands about 60-70 cm tall with a wingspan of 88-106 cm. Its plumage is entirely white, with black legs and a long, thin, black bill. The Little Egret is known for its distinctive vocalizations, which consist of a series of croaking, guttural notes that are often given in flight. During the breeding season, males also perform a series of elaborate displays, including stretching their necks and pointing their bills skyward while making a series of calls.</p>","metadata":{}},{"cell_type":"code","source":"display_audio(\"/kaggle/input/birdclef-2023/train_audio\", \"litegr\", wf_offset=2, wf_duration=2)","metadata":{"execution":{"iopub.status.busy":"2023-03-22T22:54:54.997537Z","iopub.execute_input":"2023-03-22T22:54:54.997984Z","iopub.status.idle":"2023-03-22T22:54:55.084981Z","shell.execute_reply.started":"2023-03-22T22:54:54.997947Z","shell.execute_reply":"2023-03-22T22:54:55.083608Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# <div style=\"box-shadow: rgba(240, 46, 170, 0.4) -5px 5px inset, rgba(240, 46, 170, 0.3) -10px 10px inset, rgba(240, 46, 170, 0.2) -15px 15px inset, rgba(240, 46, 170, 0.1) -20px 20px inset, rgba(240, 46, 170, 0.05) -25px 25px inset; padding:20px; font-size:30px; font-family: consolas; display:fill; border-radius:15px; color: rgba(240, 46, 170, 0.7)\"> <b> ༼⁠ ⁠つ⁠ ⁠◕⁠‿⁠◕⁠ ⁠༽⁠つ Thank You!</b></div>\n\n<p style=\"font-family:verdana; color:rgb(34, 34, 34); font-family: consolas; font-size: 16px;\"> 💌 Thank you for taking the time to read through my notebook. I hope you found it interesting and informative. If you have any feedback or suggestions for improvement, please don't hesitate to let me know in the comments. <br><br> 🚀 If you liked this notebook, please consider upvoting it so that others can discover it too. Your support means a lot to me, and it helps to motivate me to create more content in the future. <br><br> ❤️ Once again, thank you for your support, and I hope to see you again soon!</p>","metadata":{}}]}