{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.11.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":59156,"databundleVersionId":13874099,"sourceType":"competition"}],"dockerImageVersionId":31153,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"A quick visualisation for the benefit of [this comment](https://www.kaggle.com/competitions/MABe-mouse-behavior-detection/discussion/609470#3298960).","metadata":{}},{"cell_type":"code","source":"from matplotlib import pyplot as plt\nimport polars as pl\nimport seaborn as sns\n\ndef plot_frame_breakdown(video, frame):\n    df = (pl.read_parquet(f'/kaggle/input/MABe-mouse-behavior-detection/train_tracking/{video}.parquet')\n            .filter(pl.col('video_frame') == frame)\n            .with_columns(\n                pl.col(\"bodypart\").str.extract(r\"(left|right|nose)$\", 1).fill_null(\"center\").alias(\"side\")\n            )\n         )\n\n    fig, ax = plt.subplots(1, 2, figsize=(14, 6), sharey=True)\n    fig.suptitle(f'{video}/{frame}')\n    sns.scatterplot(df, x='x', y='y', hue='mouse_id', ax=ax[0])\n    sns.scatterplot(df, x='x', y='y', hue='side', hue_order = ['left','center','right','nose'], ax=ax[1])\n    [a.set_aspect('equal') for a in ax]","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true,"execution":{"iopub.status.busy":"2025-10-06T20:06:16.824978Z","iopub.execute_input":"2025-10-06T20:06:16.825301Z","iopub.status.idle":"2025-10-06T20:06:17.956330Z","shell.execute_reply.started":"2025-10-06T20:06:16.825264Z","shell.execute_reply":"2025-10-06T20:06:17.955455Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"plot_frame_breakdown('MABe22_movies/1100085542', 1100)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-10-06T20:06:17.957726Z","iopub.execute_input":"2025-10-06T20:06:17.958257Z","iopub.status.idle":"2025-10-06T20:06:18.533770Z","shell.execute_reply.started":"2025-10-06T20:06:17.958223Z","shell.execute_reply":"2025-10-06T20:06:18.532713Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"plot_frame_breakdown('AdaptableSnail/1212811043', 1100)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-10-06T20:06:18.534631Z","iopub.execute_input":"2025-10-06T20:06:18.534894Z","iopub.status.idle":"2025-10-06T20:06:19.141145Z","shell.execute_reply.started":"2025-10-06T20:06:18.534872Z","shell.execute_reply":"2025-10-06T20:06:19.140076Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"plot_frame_breakdown('InvincibleJellyfish/1106234543', 8500)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-10-06T20:06:19.142970Z","iopub.execute_input":"2025-10-06T20:06:19.143390Z","iopub.status.idle":"2025-10-06T20:06:19.654091Z","shell.execute_reply.started":"2025-10-06T20:06:19.143361Z","shell.execute_reply":"2025-10-06T20:06:19.653182Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"plot_frame_breakdown('MABe22_keypoints/1000217804', 1000)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-10-06T20:15:47.329654Z","iopub.execute_input":"2025-10-06T20:15:47.330630Z","iopub.status.idle":"2025-10-06T20:15:47.878825Z","shell.execute_reply.started":"2025-10-06T20:15:47.330591Z","shell.execute_reply":"2025-10-06T20:15:47.877701Z"}},"outputs":[],"execution_count":null}]}