{"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":"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-17T12:48:55.437912Z","iopub.execute_input":"2023-03-17T12:48:55.438364Z","iopub.status.idle":"2023-03-17T12:48:55.446280Z","shell.execute_reply.started":"2023-03-17T12:48:55.438327Z","shell.execute_reply":"2023-03-17T12:48:55.444240Z"},"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-17T12:49:03.997083Z","iopub.execute_input":"2023-03-17T12:49:03.997639Z","iopub.status.idle":"2023-03-17T12:49:04.005541Z","shell.execute_reply.started":"2023-03-17T12:49:03.997580Z","shell.execute_reply":"2023-03-17T12:49:04.004333Z"},"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-17T12:49:20.768677Z","iopub.execute_input":"2023-03-17T12:49:20.770086Z","iopub.status.idle":"2023-03-17T12:49:20.779860Z","shell.execute_reply.started":"2023-03-17T12:49:20.770035Z","shell.execute_reply":"2023-03-17T12:49:20.777749Z"},"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    })","metadata":{"execution":{"iopub.status.busy":"2023-03-17T12:49:28.011103Z","iopub.execute_input":"2023-03-17T12:49:28.011643Z","iopub.status.idle":"2023-03-17T12:49:28.024800Z","shell.execute_reply.started":"2023-03-17T12:49:28.011605Z","shell.execute_reply":"2023-03-17T12:49:28.023372Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"len(os.listdir(\"/kaggle/input/birdclef-2023/train_audio\"))","metadata":{"execution":{"iopub.status.busy":"2023-03-17T12:49:45.940967Z","iopub.execute_input":"2023-03-17T12:49:45.941437Z","iopub.status.idle":"2023-03-17T12:49:45.958828Z","shell.execute_reply.started":"2023-03-17T12:49:45.941401Z","shell.execute_reply":"2023-03-17T12:49:45.957528Z"},"trusted":true},"execution_count":null,"outputs":[]},{"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-17T12:49:53.060966Z","iopub.execute_input":"2023-03-17T12:49:53.061809Z","iopub.status.idle":"2023-03-17T12:49:53.376186Z","shell.execute_reply.started":"2023-03-17T12:49:53.061769Z","shell.execute_reply":"2023-03-17T12:49:53.374587Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!ls /kaggle/input/birdclef-2023/test_soundscapes","metadata":{"execution":{"iopub.status.busy":"2023-03-17T12:53:44.256789Z","iopub.execute_input":"2023-03-17T12:53:44.257854Z","iopub.status.idle":"2023-03-17T12:53:45.396506Z","shell.execute_reply.started":"2023-03-17T12:53:44.257789Z","shell.execute_reply":"2023-03-17T12:53:45.395177Z"},"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-17T12:53:46.863677Z","iopub.execute_input":"2023-03-17T12:53:46.864411Z","iopub.status.idle":"2023-03-17T12:53:47.970414Z","shell.execute_reply.started":"2023-03-17T12:53:46.864354Z","shell.execute_reply":"2023-03-17T12:53:47.969047Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"display_audio(\"/kaggle/input/birdclef-2023/test_soundscapes\", \"\", \"soundscape_29201\")","metadata":{"execution":{"iopub.status.busy":"2023-03-17T13:49:25.990296Z","iopub.execute_input":"2023-03-17T13:49:25.990718Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_metadata_df = pd.read_csv(\"/kaggle/input/birdclef-2023/train_metadata.csv\")","metadata":{"execution":{"iopub.status.busy":"2023-03-17T13:06:13.690474Z","iopub.execute_input":"2023-03-17T13:06:13.691633Z","iopub.status.idle":"2023-03-17T13:06:13.775845Z","shell.execute_reply.started":"2023-03-17T13:06:13.691596Z","shell.execute_reply":"2023-03-17T13:06:13.774880Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_metadata_df.head()","metadata":{"execution":{"iopub.status.busy":"2023-03-17T13:07:03.902631Z","iopub.execute_input":"2023-03-17T13:07:03.902994Z","iopub.status.idle":"2023-03-17T13:07:03.922367Z","shell.execute_reply.started":"2023-03-17T13:07:03.902963Z","shell.execute_reply":"2023-03-17T13:07:03.921212Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"Examples count:\", len(train_metadata_df))","metadata":{"execution":{"iopub.status.busy":"2023-03-17T13:07:14.103078Z","iopub.execute_input":"2023-03-17T13:07:14.103474Z","iopub.status.idle":"2023-03-17T13:07:14.109059Z","shell.execute_reply.started":"2023-03-17T13:07:14.103440Z","shell.execute_reply":"2023-03-17T13:07:14.108040Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_metadata_df.describe()","metadata":{"execution":{"iopub.status.busy":"2023-03-17T13:07:20.099746Z","iopub.execute_input":"2023-03-17T13:07:20.100138Z","iopub.status.idle":"2023-03-17T13:07:20.125693Z","shell.execute_reply.started":"2023-03-17T13:07:20.100104Z","shell.execute_reply":"2023-03-17T13:07:20.124747Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_metadata_df.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2023-03-17T13:07:23.121559Z","iopub.execute_input":"2023-03-17T13:07:23.121959Z","iopub.status.idle":"2023-03-17T13:07:23.139800Z","shell.execute_reply.started":"2023-03-17T13:07:23.121926Z","shell.execute_reply":"2023-03-17T13:07:23.138882Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"primary_label_counts = train_metadata_df.primary_label.value_counts()","metadata":{"execution":{"iopub.status.busy":"2023-03-17T13:07:33.654672Z","iopub.execute_input":"2023-03-17T13:07:33.655028Z","iopub.status.idle":"2023-03-17T13:07:33.661780Z","shell.execute_reply.started":"2023-03-17T13:07:33.654999Z","shell.execute_reply":"2023-03-17T13:07:33.660587Z"},"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-17T13:07:36.526986Z","iopub.execute_input":"2023-03-17T13:07:36.527401Z","iopub.status.idle":"2023-03-17T13:07:36.533469Z","shell.execute_reply.started":"2023-03-17T13:07:36.527353Z","shell.execute_reply":"2023-03-17T13:07:36.532155Z"},"trusted":true},"execution_count":null,"outputs":[]},{"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-17T13:07:57.908096Z","iopub.execute_input":"2023-03-17T13:07:57.908495Z","iopub.status.idle":"2023-03-17T13:07:57.974607Z","shell.execute_reply.started":"2023-03-17T13:07:57.908463Z","shell.execute_reply":"2023-03-17T13:07:57.973454Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"All secondary column occurrences:\", sum(train_metadata_df.secondary_labels != \"[]\"))","metadata":{"execution":{"iopub.status.busy":"2023-03-17T13:08:13.967058Z","iopub.execute_input":"2023-03-17T13:08:13.967459Z","iopub.status.idle":"2023-03-17T13:08:13.977782Z","shell.execute_reply.started":"2023-03-17T13:08:13.967425Z","shell.execute_reply":"2023-03-17T13:08:13.976537Z"},"trusted":true},"execution_count":null,"outputs":[]},{"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-17T13:08:14.841417Z","iopub.execute_input":"2023-03-17T13:08:14.841826Z","iopub.status.idle":"2023-03-17T13:08:15.094628Z","shell.execute_reply.started":"2023-03-17T13:08:14.841792Z","shell.execute_reply":"2023-03-17T13:08:15.093756Z"},"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-17T13:08:25.278488Z","iopub.execute_input":"2023-03-17T13:08:25.278921Z","iopub.status.idle":"2023-03-17T13:08:25.341221Z","shell.execute_reply.started":"2023-03-17T13:08:25.278885Z","shell.execute_reply":"2023-03-17T13:08:25.340056Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"Type column occurrences:\", sum(train_metadata_df.type != \"[]\"))","metadata":{"execution":{"iopub.status.busy":"2023-03-17T13:08:36.312610Z","iopub.execute_input":"2023-03-17T13:08:36.313777Z","iopub.status.idle":"2023-03-17T13:08:36.323533Z","shell.execute_reply.started":"2023-03-17T13:08:36.313724Z","shell.execute_reply":"2023-03-17T13:08:36.322451Z"},"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-17T13:08:49.826336Z","iopub.execute_input":"2023-03-17T13:08:49.826695Z","iopub.status.idle":"2023-03-17T13:08:51.272762Z","shell.execute_reply.started":"2023-03-17T13:08:49.826665Z","shell.execute_reply":"2023-03-17T13:08:51.271587Z"},"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()\n\n","metadata":{"execution":{"iopub.status.busy":"2023-03-17T13:08:58.591600Z","iopub.execute_input":"2023-03-17T13:08:58.592003Z","iopub.status.idle":"2023-03-17T13:08:58.655376Z","shell.execute_reply.started":"2023-03-17T13:08:58.591969Z","shell.execute_reply":"2023-03-17T13:08:58.654581Z"},"trusted":true},"execution_count":null,"outputs":[]},{"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-17T13:09:06.627036Z","iopub.execute_input":"2023-03-17T13:09:06.627451Z","iopub.status.idle":"2023-03-17T13:09:06.692343Z","shell.execute_reply.started":"2023-03-17T13:09:06.627416Z","shell.execute_reply":"2023-03-17T13:09:06.691219Z"},"trusted":true},"execution_count":null,"outputs":[]},{"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-17T13:11:44.772435Z","iopub.execute_input":"2023-03-17T13:11:44.772819Z","iopub.status.idle":"2023-03-17T13:11:44.790036Z","shell.execute_reply.started":"2023-03-17T13:11:44.772780Z","shell.execute_reply":"2023-03-17T13:11:44.788931Z"},"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()\n","metadata":{"execution":{"iopub.status.busy":"2023-03-17T13:11:52.620294Z","iopub.execute_input":"2023-03-17T13:11:52.621478Z","iopub.status.idle":"2023-03-17T13:11:52.755939Z","shell.execute_reply.started":"2023-03-17T13:11:52.621408Z","shell.execute_reply":"2023-03-17T13:11:52.754900Z"},"trusted":true},"execution_count":null,"outputs":[]},{"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-17T13:13:01.269842Z","iopub.execute_input":"2023-03-17T13:13:01.270735Z","iopub.status.idle":"2023-03-17T13:13:03.012527Z","shell.execute_reply.started":"2023-03-17T13:13:01.270700Z","shell.execute_reply":"2023-03-17T13:13:03.011448Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig = px.histogram(train_metadata_df, x=\"rating\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-03-17T13:15:52.140212Z","iopub.execute_input":"2023-03-17T13:15:52.140545Z","iopub.status.idle":"2023-03-17T13:15:52.207127Z","shell.execute_reply.started":"2023-03-17T13:15:52.140514Z","shell.execute_reply":"2023-03-17T13:15:52.206061Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ebt_df = pd.read_csv(\"/kaggle/input/birdclef-2023/eBird_Taxonomy_v2021.csv\")","metadata":{"execution":{"iopub.status.busy":"2023-03-17T13:16:24.941184Z","iopub.execute_input":"2023-03-17T13:16:24.941946Z","iopub.status.idle":"2023-03-17T13:16:25.022649Z","shell.execute_reply.started":"2023-03-17T13:16:24.941905Z","shell.execute_reply":"2023-03-17T13:16:25.021731Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ebt_df.head()","metadata":{"execution":{"iopub.status.busy":"2023-03-17T13:17:06.721810Z","iopub.execute_input":"2023-03-17T13:17:06.722223Z","iopub.status.idle":"2023-03-17T13:17:06.737427Z","shell.execute_reply.started":"2023-03-17T13:17:06.722190Z","shell.execute_reply":"2023-03-17T13:17:06.736207Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ebt_df.describe()","metadata":{"execution":{"iopub.status.busy":"2023-03-17T13:17:08.320477Z","iopub.execute_input":"2023-03-17T13:17:08.321611Z","iopub.status.idle":"2023-03-17T13:17:08.339181Z","shell.execute_reply.started":"2023-03-17T13:17:08.321560Z","shell.execute_reply":"2023-03-17T13:17:08.338026Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"len(ebt_df)","metadata":{"execution":{"iopub.status.busy":"2023-03-17T13:17:47.341911Z","iopub.execute_input":"2023-03-17T13:17:47.343123Z","iopub.status.idle":"2023-03-17T13:17:47.349439Z","shell.execute_reply.started":"2023-03-17T13:17:47.343081Z","shell.execute_reply":"2023-03-17T13:17:47.348438Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ebt_df.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2023-03-17T13:17:49.842688Z","iopub.execute_input":"2023-03-17T13:17:49.843081Z","iopub.status.idle":"2023-03-17T13:17:49.858878Z","shell.execute_reply.started":"2023-03-17T13:17:49.843049Z","shell.execute_reply":"2023-03-17T13:17:49.857655Z"},"trusted":true},"execution_count":null,"outputs":[]},{"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-17T13:18:09.432477Z","iopub.execute_input":"2023-03-17T13:18:09.433501Z","iopub.status.idle":"2023-03-17T13:18:09.502763Z","shell.execute_reply.started":"2023-03-17T13:18:09.433460Z","shell.execute_reply":"2023-03-17T13:18:09.501756Z"},"trusted":true},"execution_count":null,"outputs":[]},{"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-17T13:18:35.048911Z","iopub.execute_input":"2023-03-17T13:18:35.049886Z","iopub.status.idle":"2023-03-17T13:18:35.225424Z","shell.execute_reply.started":"2023-03-17T13:18:35.049843Z","shell.execute_reply":"2023-03-17T13:18:35.224413Z"},"trusted":true},"execution_count":null,"outputs":[]},{"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-17T13:19:13.445742Z","iopub.execute_input":"2023-03-17T13:19:13.446614Z","iopub.status.idle":"2023-03-17T13:19:13.637518Z","shell.execute_reply.started":"2023-03-17T13:19:13.446577Z","shell.execute_reply":"2023-03-17T13:19:13.636459Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"topx = 10\n\ntop10_pl = list(primary_label_counts.index[-topx:])[::-1]","metadata":{"execution":{"iopub.status.busy":"2023-03-17T13:20:50.900101Z","iopub.execute_input":"2023-03-17T13:20:50.901060Z","iopub.status.idle":"2023-03-17T13:20:50.906003Z","shell.execute_reply.started":"2023-03-17T13:20:50.901021Z","shell.execute_reply":"2023-03-17T13:20:50.904883Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for primary_label in top10_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-17T13:21:01.362253Z","iopub.execute_input":"2023-03-17T13:21:01.362624Z","iopub.status.idle":"2023-03-17T13:21:01.390782Z","shell.execute_reply.started":"2023-03-17T13:21:01.362594Z","shell.execute_reply":"2023-03-17T13:21:01.389466Z"},"trusted":true},"execution_count":null,"outputs":[]},{"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-17T13:26:50.071078Z","iopub.execute_input":"2023-03-17T13:26:50.071530Z","iopub.status.idle":"2023-03-17T13:26:50.229128Z","shell.execute_reply.started":"2023-03-17T13:26:50.071494Z","shell.execute_reply":"2023-03-17T13:26:50.227946Z"},"trusted":true},"execution_count":null,"outputs":[]},{"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-17T13:27:48.129520Z","iopub.execute_input":"2023-03-17T13:27:48.130446Z","iopub.status.idle":"2023-03-17T13:27:48.256510Z","shell.execute_reply.started":"2023-03-17T13:27:48.130402Z","shell.execute_reply":"2023-03-17T13:27:48.254868Z"},"trusted":true},"execution_count":null,"outputs":[]},{"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-17T13:30:05.709889Z","iopub.execute_input":"2023-03-17T13:30:05.710312Z","iopub.status.idle":"2023-03-17T13:30:05.778343Z","shell.execute_reply.started":"2023-03-17T13:30:05.710278Z","shell.execute_reply":"2023-03-17T13:30:05.777280Z"},"trusted":true},"execution_count":null,"outputs":[]},{"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-17T13:30:58.245121Z","iopub.execute_input":"2023-03-17T13:30:58.246261Z","iopub.status.idle":"2023-03-17T13:30:58.392444Z","shell.execute_reply.started":"2023-03-17T13:30:58.246211Z","shell.execute_reply":"2023-03-17T13:30:58.391369Z"},"trusted":true},"execution_count":null,"outputs":[]},{"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-17T13:31:57.888954Z","iopub.execute_input":"2023-03-17T13:31:57.889375Z"},"trusted":true},"execution_count":null,"outputs":[]},{"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-17T13:33:37.216052Z","iopub.execute_input":"2023-03-17T13:33:37.216442Z","iopub.status.idle":"2023-03-17T13:33:37.391216Z","shell.execute_reply.started":"2023-03-17T13:33:37.216409Z","shell.execute_reply":"2023-03-17T13:33:37.390092Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"display_audio(\"/kaggle/input/birdclef-2023/train_audio\", \"eubeat1\", wf_offset=1, wf_duration=2, sr=22000)","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"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-17T13:43:12.941845Z","iopub.execute_input":"2023-03-17T13:43:12.942255Z","iopub.status.idle":"2023-03-17T13:43:13.139710Z","shell.execute_reply.started":"2023-03-17T13:43:12.942220Z","shell.execute_reply":"2023-03-17T13:43:13.138402Z"},"trusted":true},"execution_count":null,"outputs":[]},{"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-17T13:45:23.219033Z","iopub.execute_input":"2023-03-17T13:45:23.219813Z","iopub.status.idle":"2023-03-17T13:45:23.527746Z","shell.execute_reply.started":"2023-03-17T13:45:23.219777Z","shell.execute_reply":"2023-03-17T13:45:23.524470Z"},"trusted":true},"execution_count":null,"outputs":[]}]}