diff options
Diffstat (limited to 'evaluation/adept_ablation/recon')
-rw-r--r-- | evaluation/adept_ablation/recon/evaluation_loci_looped_norecon.ipynb | 464 | ||||
-rw-r--r-- | evaluation/adept_ablation/recon/evaluation_loci_looped_recon.ipynb | 466 |
2 files changed, 930 insertions, 0 deletions
diff --git a/evaluation/adept_ablation/recon/evaluation_loci_looped_norecon.ipynb b/evaluation/adept_ablation/recon/evaluation_loci_looped_norecon.ipynb new file mode 100644 index 0000000..a1bbc32 --- /dev/null +++ b/evaluation/adept_ablation/recon/evaluation_loci_looped_norecon.ipynb @@ -0,0 +1,464 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [], + "source": [ + "import pandas as pd\n", + "import matplotlib.pyplot as plt\n", + "import numpy as np\n", + "import seaborn as sns\n", + "import warnings\n", + "import scipy.stats as stats\n", + "import os\n", + "\n", + "warnings.simplefilter(action='ignore', category=FutureWarning)\n", + "pd.options.mode.chained_assignment = None \n", + "plt.style.use('ggplot')\n", + "sns.color_palette(\"Paired\");\n", + "sns.set_theme();" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Data Loading" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [], + "source": [ + "# setting path to results folder\n", + "root_path = '../../../out/pretrained/adept_ablations/recon'\n", + "\n", + "# list all folders in root path that don't stat with a dot\n", + "nets = ['norecon']\n", + "\n", + "# read pickle file\n", + "tf = pd.DataFrame()\n", + "sf = pd.DataFrame()\n", + "af = pd.DataFrame()\n", + "\n", + "# load statistics files from nets\n", + "for net in nets:\n", + " path = os.path.join(root_path, net, 'results')\n", + " with open(os.path.join(path, 'trialframe.csv'), 'rb') as f:\n", + " tf_temp = pd.read_csv(f, index_col=0)\n", + " tf_temp['net'] = net\n", + " tf = pd.concat([tf,tf_temp])\n", + "\n", + " with open(os.path.join(path, 'slotframe.csv'), 'rb') as f:\n", + " sf_temp = pd.read_csv(f, index_col=0)\n", + " sf_temp['net'] = net\n", + " sf = pd.concat([sf,sf_temp])\n", + "\n", + " with open(os.path.join(path, 'accframe.csv'), 'rb') as f:\n", + " af_temp = pd.read_csv(f, index_col=0)\n", + " af_temp['net'] = net\n", + " af = pd.concat([af,af_temp])\n", + "\n", + "# cast variables\n", + "sf['visible'] = sf['visible'].astype(bool)\n", + "sf['bound'] = sf['bound'].astype(bool)\n", + "sf['occluder'] = sf['occluder'].astype(bool)\n", + "sf['inimage'] = sf['inimage'].astype(bool)\n", + "sf['vanishing'] = sf['vanishing'].astype(bool)\n", + "sf['alpha_pos'] = 1-sf['alpha_pos']\n", + "sf['alpha_ges'] = 1-sf['alpha_ges']\n", + "\n", + "# scale to percentage\n", + "sf['TE'] = sf['TE'] * 100\n", + "\n", + "# add surprise as dummy code\n", + "tf['control'] = [('control' in set) for set in tf['set']]\n", + "sf['control'] = [('control' in set) for set in sf['set']]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Calculate Tracking Error (TE)" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Tracking Error when visible: M: 1.75 , STD: 1.23, Count: 1563\n", + "Tracking Error when occluded: M: 2.09 , STD: 1.39, Count: 486\n" + ] + } + ], + "source": [ + "grouping = (sf.inimage & sf.bound & ~sf.occluder & sf.control)\n", + "\n", + "def get_stats(col):\n", + " return f' M: {col.mean():.3} , STD: {col.std():.3}, Count: {col.count()}'\n", + "\n", + "# When Visible\n", + "temp = sf[grouping & sf.visible]\n", + "print(f'Tracking Error when visible:' + get_stats(temp['TE']))\n", + "\n", + "# When Occluded\n", + "temp = sf[grouping & ~sf.visible]\n", + "print(f'Tracking Error when occluded:' + get_stats(temp['TE']))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Calculate Succesfull Trackings (TE)" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "<div>\n", + "<style scoped>\n", + " .dataframe tbody tr th:only-of-type {\n", + " vertical-align: middle;\n", + " }\n", + "\n", + " .dataframe tbody tr th {\n", + " vertical-align: top;\n", + " }\n", + "\n", + " .dataframe thead th {\n", + " text-align: right;\n", + " }\n", + "</style>\n", + "<table border=\"1\" class=\"dataframe\">\n", + " <thead>\n", + " <tr style=\"text-align: right;\">\n", + " <th></th>\n", + " <th>set</th>\n", + " <th>evalmode</th>\n", + " <th>tracked_pos</th>\n", + " <th>tracked_neg</th>\n", + " <th>tracked_pos_pro</th>\n", + " <th>tracked_neg_pro</th>\n", + " </tr>\n", + " </thead>\n", + " <tbody>\n", + " <tr>\n", + " <th>0</th>\n", + " <td>control</td>\n", + " <td>open</td>\n", + " <td>47</td>\n", + " <td>1</td>\n", + " <td>0.979167</td>\n", + " <td>0.020833</td>\n", + " </tr>\n", + " </tbody>\n", + "</table>\n", + "</div>" + ], + "text/plain": [ + " set evalmode tracked_pos tracked_neg tracked_pos_pro \\\n", + "0 control open 47 1 0.979167 \n", + "\n", + " tracked_neg_pro \n", + "0 0.020833 " + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# succesfull trackings: In the last visible moment of the target, the slot was less than 10% away from the target\n", + "# determine last visible frame numeric\n", + "grouping_factors = ['net','set','evalmode','scene','slot']\n", + "ff = sf[sf.visible & sf.bound & sf.inimage].groupby(grouping_factors).max()\n", + "ff.rename(columns = {'frame':'last_visible'}, inplace = True)\n", + "sf = sf.merge(ff[['last_visible']], on=grouping_factors, how='left')\n", + "\n", + "# same for first bound frame\n", + "ff = sf[sf.visible & sf.bound & sf.inimage].groupby(grouping_factors).min()\n", + "ff.rename(columns = {'frame':'first_visible'}, inplace = True)\n", + "sf = sf.merge(ff[['first_visible']], on=grouping_factors, how='left')\n", + "\n", + "# add dummy variable to sf\n", + "sf['last_visible'] = (sf['last_visible'] == sf['frame'])\n", + "\n", + "# extract the trials where the target was last visible and threshold the TE\n", + "ff = sf[sf['last_visible']] \n", + "ff['tracked_pos'] = (ff['TE'] < 10)\n", + "ff['tracked_neg'] = (ff['TE'] >= 10)\n", + "\n", + "# fill NaN with 0\n", + "sf = sf.merge(ff[grouping_factors + ['tracked_pos', 'tracked_neg']], on=grouping_factors, how='left')\n", + "sf['tracked_pos'].fillna(False, inplace=True)\n", + "sf['tracked_neg'].fillna(False, inplace=True)\n", + "\n", + "# Aggreagte over all scenes\n", + "temp = sf[(sf['frame']== 1) & ~sf.occluder & sf.control & (sf.first_visible < 20)]\n", + "temp = temp.groupby(['set', 'evalmode']).sum()\n", + "temp = temp[['tracked_pos', 'tracked_neg']]\n", + "temp = temp.reset_index()\n", + "\n", + "temp['tracked_pos_pro'] = temp['tracked_pos'] / (temp['tracked_pos'] + temp['tracked_neg'])\n", + "temp['tracked_neg_pro'] = temp['tracked_neg'] / (temp['tracked_pos'] + temp['tracked_neg'])\n", + "\n", + "temp" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Mostly Tracked stats" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": {}, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXYAAAEmCAYAAAB20LuSAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAAmQklEQVR4nO3deUCUdeLH8fcAgkcqiDPgbeZNoB0mkWm6rtfPKzXzpFYjj1WSWlcNrzwWKs0jy5Iys7Qyb3YNybNS03RTsrytvGEUNVEQmJnfH27Tsh6ADg48fF5/8czzzDMfYPz45Znn+T4mh8PhQEREDMPD3QFERMS1VOwiIgajYhcRMRgVu4iIwajYRUQMRsUuImIwKnYREYPxcncAgPPnL2O363R6V/D3v4dz59LcHUPkOnpvuo6Hhwk/vzI3XV8oit1ud6jYXUg/Syms9N68O3QoRkT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DpUqVsNls7o5VLKjYRaRAlCpVivnz57N9+3ZatmzJwoULKVOmjLtjFQsqdhEpENOmTePKlSvMnj2b8uXLk5yczPTp090dq1jQWTEiIgajEbuIiMGo2EVEDEbFLpIPx48fzzEHikhhpGIXyYdTp07x888/uzuGyC3pw1Mp1i5fvsyYMWP49ddf8fDwICgoiEmTJrFp0ybmzp1LVlYWJUuWZNSoUYSEhNCuXTuSk5Np0qQJ77//vrvji9yQRuxSrH355ZdcvnyZVatWOW8AfuzYMWbMmMG8efNYuXIlkydPZvjw4Vy9epUpU6ZQvXp1lboUaprdUYq1hx56iBkzZtC/f3/CwsJ45pln2LJlCykpKTz77LPO7Uwmk+Y6kSJDxS7FWrVq1fjyyy/Zvn073377LX/5y18YNGgQjz76KDNnznRud/r0aSwWCzt37nRfWJE80qEYKdYWL17MmDFjaNasGSNHjqRZs2ZcvHiRLVu2cOTIEQA2b95M586dycjIwNPTk6ysLDenFrk1jdilWOvatSs7duygQ4cOlCpVikqVKtG/f3/uu+8+XnzxRRwOB15eXsydO5cyZcpQu3ZtfHx86NGjB59//vkN7+kp4m46K0ZExGB0KEZExGBU7CIiBqNiFxExGBW7iIjBqNhFRAxGxS4iYjAqdhERg1Gxi4gYzP8DK9ahmaov8k8AAAAASUVORK5CYII=", + "text/plain": [ + "<Figure size 432x288 with 1 Axes>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "temp = af[af.index == 'OVERALL']\n", + "temp['mostly_tracked'] = temp['mostly_tracked'] / temp['num_unique_objects']\n", + "temp['partially_tracked'] = temp['partially_tracked'] / temp['num_unique_objects']\n", + "temp['mostly_lost'] = temp['mostly_lost'] / temp['num_unique_objects']\n", + "g = temp[['mostly_tracked', 'partially_tracked', 'mostly_lost','set']].set_index(['set']).groupby(['set']).mean().plot(kind='bar', stacked=True);" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# MOTA " + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "<div>\n", + "<style scoped>\n", + " .dataframe tbody tr th:only-of-type {\n", + " vertical-align: middle;\n", + " }\n", + "\n", + " .dataframe tbody tr th {\n", + " vertical-align: top;\n", + " }\n", + "\n", + " .dataframe thead th {\n", + " text-align: right;\n", + " }\n", + "</style>\n", + "<table border=\"1\" class=\"dataframe\">\n", + " <thead>\n", + " <tr style=\"text-align: right;\">\n", + " <th></th>\n", + " <th>idf1</th>\n", + " <th>idp</th>\n", + " <th>idr</th>\n", + " <th>recall</th>\n", + " <th>precision</th>\n", + " <th>num_unique_objects</th>\n", + " <th>mostly_tracked</th>\n", + " <th>partially_tracked</th>\n", + " <th>mostly_lost</th>\n", + " <th>num_false_positives</th>\n", + " <th>num_misses</th>\n", + " <th>num_switches</th>\n", + " <th>num_fragmentations</th>\n", + " <th>mota</th>\n", + " <th>motp</th>\n", + " <th>num_transfer</th>\n", + " <th>num_ascend</th>\n", + " <th>num_migrate</th>\n", + " </tr>\n", + " <tr>\n", + " <th>set</th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " </tr>\n", + " </thead>\n", + " <tbody>\n", + " <tr>\n", + " <th>control</th>\n", + " <td>0.793020</td>\n", + " <td>0.965426</td>\n", + " <td>0.672861</td>\n", + " <td>0.675311</td>\n", + " <td>0.968942</td>\n", + " <td>86.0</td>\n", + " <td>44.0</td>\n", + " <td>12.0</td>\n", + " <td>30.0</td>\n", + " <td>106.0</td>\n", + " <td>1590.0</td>\n", + " <td>2.0</td>\n", + " <td>37.0</td>\n", + " <td>0.653257</td>\n", + " <td>0.035403</td>\n", + " <td>0.0</td>\n", + " <td>2.0</td>\n", + " <td>0.0</td>\n", + " </tr>\n", + " <tr>\n", + " <th>surprise</th>\n", + " <td>0.781989</td>\n", + " <td>0.959484</td>\n", + " <td>0.659911</td>\n", + " <td>0.666244</td>\n", + " <td>0.968692</td>\n", + " <td>33.0</td>\n", + " <td>13.0</td>\n", + " <td>7.0</td>\n", + " <td>13.0</td>\n", + " <td>34.0</td>\n", + " <td>527.0</td>\n", + " <td>2.0</td>\n", + " <td>11.0</td>\n", + " <td>0.643445</td>\n", + " <td>0.034990</td>\n", + " <td>0.0</td>\n", + " <td>2.0</td>\n", + " <td>0.0</td>\n", + " </tr>\n", + " </tbody>\n", + "</table>\n", + "</div>" + ], + "text/plain": [ + " idf1 idp idr recall precision \\\n", + "set \n", + "control 0.793020 0.965426 0.672861 0.675311 0.968942 \n", + "surprise 0.781989 0.959484 0.659911 0.666244 0.968692 \n", + "\n", + " num_unique_objects mostly_tracked partially_tracked mostly_lost \\\n", + "set \n", + "control 86.0 44.0 12.0 30.0 \n", + "surprise 33.0 13.0 7.0 13.0 \n", + "\n", + " num_false_positives num_misses num_switches num_fragmentations \\\n", + "set \n", + "control 106.0 1590.0 2.0 37.0 \n", + "surprise 34.0 527.0 2.0 11.0 \n", + "\n", + " mota motp num_transfer num_ascend num_migrate \n", + "set \n", + "control 0.653257 0.035403 0.0 2.0 0.0 \n", + "surprise 0.643445 0.034990 0.0 2.0 0.0 " + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "af[af.index == 'OVERALL'].groupby(['set']).mean()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Gate Openings" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Percept gate openings when visible: M: 0.257 , STD: 0.237, Count: 1563\n", + "Percept gate openings when occluded: M: 0.00921 , STD: 0.0524, Count: 486\n" + ] + } + ], + "source": [ + "grouping = (sf.inimage & sf.bound & ~sf.occluder & sf.control)\n", + "temp = sf[grouping & sf.visible]\n", + "print(f'Percept gate openings when visible:' + get_stats(temp['alpha_pos'] + temp['alpha_ges']))\n", + "temp = sf[grouping & ~sf.visible]\n", + "print(f'Percept gate openings when occluded:' + get_stats(temp['alpha_pos'] + temp['alpha_ges']))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "loci23", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.16" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/evaluation/adept_ablation/recon/evaluation_loci_looped_recon.ipynb b/evaluation/adept_ablation/recon/evaluation_loci_looped_recon.ipynb new file mode 100644 index 0000000..a6422e0 --- /dev/null +++ b/evaluation/adept_ablation/recon/evaluation_loci_looped_recon.ipynb @@ -0,0 +1,466 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import pandas as pd\n", + "import matplotlib.pyplot as plt\n", + "import numpy as np\n", + "import seaborn as sns\n", + "import warnings\n", + "import scipy.stats as stats\n", + "import os\n", + "\n", + "warnings.simplefilter(action='ignore', category=FutureWarning)\n", + "pd.options.mode.chained_assignment = None \n", + "plt.style.use('ggplot')\n", + "sns.color_palette(\"Paired\");\n", + "sns.set_theme();" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Data Loading" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "# setting path to results folder\n", + "root_path = '../../../out/pretrained/adept_ablations/recon'\n", + "\n", + "# list all folders in root path that don't stat with a dot\n", + "nets = ['recon']\n", + "\n", + "# read pickle file\n", + "tf = pd.DataFrame()\n", + "sf = pd.DataFrame()\n", + "af = pd.DataFrame()\n", + "\n", + "# load statistics files from nets\n", + "for net in nets:\n", + " path = os.path.join(root_path, net, 'results')\n", + " with open(os.path.join(path, 'trialframe.csv'), 'rb') as f:\n", + " tf_temp = pd.read_csv(f, index_col=0)\n", + " tf_temp['net'] = net\n", + " tf = pd.concat([tf,tf_temp])\n", + "\n", + " with open(os.path.join(path, 'slotframe.csv'), 'rb') as f:\n", + " sf_temp = pd.read_csv(f, index_col=0)\n", + " sf_temp['net'] = net\n", + " sf = pd.concat([sf,sf_temp])\n", + "\n", + " with open(os.path.join(path, 'accframe.csv'), 'rb') as f:\n", + " af_temp = pd.read_csv(f, index_col=0)\n", + " af_temp['net'] = net\n", + " af = pd.concat([af,af_temp])\n", + "\n", + "# cast variables\n", + "sf['visible'] = sf['visible'].astype(bool)\n", + "sf['bound'] = sf['bound'].astype(bool)\n", + "sf['occluder'] = sf['occluder'].astype(bool)\n", + "sf['inimage'] = sf['inimage'].astype(bool)\n", + "sf['vanishing'] = sf['vanishing'].astype(bool)\n", + "sf['alpha_pos'] = 1-sf['alpha_pos']\n", + "sf['alpha_ges'] = 1-sf['alpha_ges']\n", + "\n", + "# scale to percentage\n", + "sf['TE'] = sf['TE'] * 100\n", + "\n", + "# add surprise as dummy code\n", + "tf['control'] = [('control' in set) for set in tf['set']]\n", + "sf['control'] = [('control' in set) for set in sf['set']]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Calculate Tracking Error (TE)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Tracking Error when visible: M: 2.95 , STD: 4.8, Count: 1686\n", + "Tracking Error when occluded: M: 2.54 , STD: 2.52, Count: 477\n" + ] + } + ], + "source": [ + "grouping = (sf.inimage & sf.bound & ~sf.occluder & sf.control)\n", + "\n", + "def get_stats(col):\n", + " return f' M: {col.mean():.3} , STD: {col.std():.3}, Count: {col.count()}'\n", + "\n", + "# When Visible\n", + "temp = sf[grouping & sf.visible]\n", + "print(f'Tracking Error when visible:' + get_stats(temp['TE']))\n", + "\n", + "# When Occluded\n", + "temp = sf[grouping & ~sf.visible]\n", + "print(f'Tracking Error when occluded:' + get_stats(temp['TE']))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Calculate Succesfull Trackings (TE)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "<div>\n", + "<style scoped>\n", + " .dataframe tbody tr th:only-of-type {\n", + " vertical-align: middle;\n", + " }\n", + "\n", + " .dataframe tbody tr th {\n", + " vertical-align: top;\n", + " }\n", + "\n", + " .dataframe thead th {\n", + " text-align: right;\n", + " }\n", + "</style>\n", + "<table border=\"1\" class=\"dataframe\">\n", + " <thead>\n", + " <tr style=\"text-align: right;\">\n", + " <th></th>\n", + " <th>set</th>\n", + " <th>evalmode</th>\n", + " <th>tracked_pos</th>\n", + " <th>tracked_neg</th>\n", + " <th>tracked_pos_pro</th>\n", + " <th>tracked_neg_pro</th>\n", + " </tr>\n", + " </thead>\n", + " <tbody>\n", + " <tr>\n", + " <th>0</th>\n", + " <td>control</td>\n", + " <td>open</td>\n", + " <td>37</td>\n", + " <td>9</td>\n", + " <td>0.804348</td>\n", + " <td>0.195652</td>\n", + " </tr>\n", + " </tbody>\n", + "</table>\n", + "</div>" + ], + "text/plain": [ + " set evalmode tracked_pos tracked_neg tracked_pos_pro \\\n", + "0 control open 37 9 0.804348 \n", + "\n", + " tracked_neg_pro \n", + "0 0.195652 " + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# succesfull trackings: In the last visible moment of the target, the slot was less than 10% away from the target\n", + "# determine last visible frame numeric\n", + "grouping_factors = ['net','set','evalmode','scene','slot']\n", + "ff = sf[sf.visible & sf.bound & sf.inimage].groupby(grouping_factors).max()\n", + "ff.rename(columns = {'frame':'last_visible'}, inplace = True)\n", + "sf = sf.merge(ff[['last_visible']], on=grouping_factors, how='left')\n", + "\n", + "# same for first bound frame\n", + "ff = sf[sf.visible & sf.bound & sf.inimage].groupby(grouping_factors).min()\n", + "ff.rename(columns = {'frame':'first_visible'}, inplace = True)\n", + "sf = sf.merge(ff[['first_visible']], on=grouping_factors, how='left')\n", + "\n", + "# add dummy variable to sf\n", + "sf['last_visible'] = (sf['last_visible'] == sf['frame'])\n", + "\n", + "# extract the trials where the target was last visible and threshold the TE\n", + "ff = sf[sf['last_visible']] \n", + "ff['tracked_pos'] = (ff['TE'] < 10)\n", + "ff['tracked_neg'] = (ff['TE'] >= 10)\n", + "\n", + "# fill NaN with 0\n", + "sf = sf.merge(ff[grouping_factors + ['tracked_pos', 'tracked_neg']], on=grouping_factors, how='left')\n", + "sf['tracked_pos'].fillna(False, inplace=True)\n", + "sf['tracked_neg'].fillna(False, inplace=True)\n", + "\n", + "# Aggreagte over all scenes\n", + "temp = sf[(sf['frame']== 1) & ~sf.occluder & sf.control & (sf.first_visible < 20)]\n", + "temp = temp.groupby(['set', 'evalmode']).sum()\n", + "temp = temp[['tracked_pos', 'tracked_neg']]\n", + "temp = temp.reset_index()\n", + "\n", + "temp['tracked_pos_pro'] = temp['tracked_pos'] / (temp['tracked_pos'] + temp['tracked_neg'])\n", + "temp['tracked_neg_pro'] = temp['tracked_neg'] / (temp['tracked_pos'] + temp['tracked_neg'])\n", + "\n", + "temp" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Mostly Tracked stats" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXYAAAEmCAYAAAB20LuSAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAAioklEQVR4nO3dd3hUVf7H8fek0UsIoSoiCkdABUGKBVFkXeuqix10V0SKCy7Kqvij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rn6VLvSiodFOzRrzvwrjHmBXLvOgXO97YkEQCqAZfk/skTIDiuXYqRgj36XQHsBVoApxEcN3wxsNHDmkSw1l5S+F5SHBTs0a870NpauxdYlztKZjnwvLdlSWlnjFlEAQ99sdaqxV7MFOzRLx44ELJ8AD1BSUqGoSGv44FrgXRvSildFOzR701goTFmFsFA7wS85WlFIoC1dkm+VfONMcuBwV7UU5roBiUHGGNuANoDB4Gl1to3va1I5NAkYHl8wJnAeGvt6R6VVGqoxe4Aa+1sYLbXdYjks4TgvyJ9BO88/RXo7WlFpYRuUBKR4nIL8DRwBrCZ4KgtOQEU7CJSXMYDXwF/JTgk9xz0PN4TQsEuIsUlxlr7IXA1MMda+zPq/j0hFOwiUlz2GmP6EbzT9F1jzL0Enx0gxUzBLiLFpTPBqXo7WWvTgbrAbd6WVDpouKOIiGPUYhcRcYyCXUTEMQp2kSIwxpxqjJnjdR0iR6NgFymaUwg+OFykxNLFUynVjDEVgReBhgRve18N9ACuAgYCCQRvrvkXsAKwBEd3LLXW/tmLmkUKoxa7lHbXA5Wstc2BVrnrTgMeAa601p5DcM771wk+S7YbsFmhLiWZ7gKT0u4T4BFjzGLgI2Ac8CegNrDAmEO9Ln5AsxJKVFCLXUo1a+33BAN7NFAZmA/EAgustc3z/gBtgfWeFSpSBAp2KdWMMb0I9rF/aK19CPiA4EOYLzPGnJG7z5XAOqAckE3waUAiJZYunkqpZoypAEwBziZ4kfQnoCvQERhAcC7xbKCvtfZjY0w1YBGwH2hjrdUvkJQ4CnYREceoK0ZExDEKdhERxyjYRUQco2AXEXGMgl1ExDEKdhERxyjYRUQco2AXEXHM/wMWsHwldsBw8QAAAABJRU5ErkJggg==", + "text/plain": [ + "<Figure size 432x288 with 1 Axes>" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "temp = af[af.index == 'OVERALL']\n", + "temp['mostly_tracked'] = temp['mostly_tracked'] / temp['num_unique_objects']\n", + "temp['partially_tracked'] = temp['partially_tracked'] / temp['num_unique_objects']\n", + "temp['mostly_lost'] = temp['mostly_lost'] / temp['num_unique_objects']\n", + "g = temp[['mostly_tracked', 'partially_tracked', 'mostly_lost','set']].set_index(['set']).groupby(['set']).mean().plot(kind='bar', stacked=True);" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# MOTA " + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "<div>\n", + "<style scoped>\n", + " .dataframe tbody tr th:only-of-type {\n", + " vertical-align: middle;\n", + " }\n", + "\n", + " .dataframe tbody tr th {\n", + " vertical-align: top;\n", + " }\n", + "\n", + " .dataframe thead th {\n", + " text-align: right;\n", + " }\n", + "</style>\n", + "<table border=\"1\" class=\"dataframe\">\n", + " <thead>\n", + " <tr style=\"text-align: right;\">\n", + " <th></th>\n", + " <th>idf1</th>\n", + " <th>idp</th>\n", + " <th>idr</th>\n", + " <th>recall</th>\n", + " <th>precision</th>\n", + " <th>num_unique_objects</th>\n", + " <th>mostly_tracked</th>\n", + " <th>partially_tracked</th>\n", + " <th>mostly_lost</th>\n", + " <th>num_false_positives</th>\n", + " <th>num_misses</th>\n", + " <th>num_switches</th>\n", + " <th>num_fragmentations</th>\n", + " <th>mota</th>\n", + " <th>motp</th>\n", + " <th>num_transfer</th>\n", + " <th>num_ascend</th>\n", + " <th>num_migrate</th>\n", + " </tr>\n", + " <tr>\n", + " <th>set</th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " <th></th>\n", + " </tr>\n", + " </thead>\n", + " <tbody>\n", + " <tr>\n", + " <th>control</th>\n", + " <td>0.754576</td>\n", + " <td>0.919577</td>\n", + " <td>0.639779</td>\n", + " <td>0.662855</td>\n", + " <td>0.952744</td>\n", + " <td>86.0</td>\n", + " <td>38.0</td>\n", + " <td>18.0</td>\n", + " <td>30.0</td>\n", + " <td>161.0</td>\n", + " <td>1651.0</td>\n", + " <td>13.0</td>\n", + " <td>28.0</td>\n", + " <td>0.627323</td>\n", + " <td>0.037094</td>\n", + " <td>0.0</td>\n", + " <td>12.0</td>\n", + " <td>0.0</td>\n", + " </tr>\n", + " <tr>\n", + " <th>surprise</th>\n", + " <td>0.790401</td>\n", + " <td>0.968750</td>\n", + " <td>0.667511</td>\n", + " <td>0.667511</td>\n", + " <td>0.968750</td>\n", + " <td>33.0</td>\n", + " <td>13.0</td>\n", + " <td>8.0</td>\n", + " <td>12.0</td>\n", + " <td>34.0</td>\n", + " <td>525.0</td>\n", + " <td>0.0</td>\n", + " <td>11.0</td>\n", + " <td>0.645978</td>\n", + " <td>0.034979</td>\n", + " <td>0.0</td>\n", + " <td>0.0</td>\n", + " <td>0.0</td>\n", + " </tr>\n", + " </tbody>\n", + "</table>\n", + "</div>" + ], + "text/plain": [ + " idf1 idp idr recall precision \\\n", + "set \n", + "control 0.754576 0.919577 0.639779 0.662855 0.952744 \n", + "surprise 0.790401 0.968750 0.667511 0.667511 0.968750 \n", + "\n", + " num_unique_objects mostly_tracked partially_tracked mostly_lost \\\n", + "set \n", + "control 86.0 38.0 18.0 30.0 \n", + "surprise 33.0 13.0 8.0 12.0 \n", + "\n", + " num_false_positives num_misses num_switches num_fragmentations \\\n", + "set \n", + "control 161.0 1651.0 13.0 28.0 \n", + "surprise 34.0 525.0 0.0 11.0 \n", + "\n", + " mota motp num_transfer num_ascend num_migrate \n", + "set \n", + "control 0.627323 0.037094 0.0 12.0 0.0 \n", + "surprise 0.645978 0.034979 0.0 0.0 0.0 " + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "af[af.index == 'OVERALL'].groupby(['set']).mean()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Gate Openings" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Percept gate openings when visible: M: 0.223 , STD: 0.303, Count: 1686\n", + "Percept gate openings when occluded: M: 0.00995 , STD: 0.0471, Count: 477\n" + ] + } + ], + "source": [ + "grouping = (sf.inimage & sf.bound & ~sf.occluder & sf.control)\n", + "temp = sf[grouping & sf.visible]\n", + "print(f'Percept gate openings when visible:' + get_stats(temp['alpha_pos'] + temp['alpha_ges']))\n", + "temp = sf[grouping & ~sf.visible]\n", + "print(f'Percept gate openings when occluded:' + get_stats(temp['alpha_pos'] + temp['alpha_ges']))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "loci23", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.16" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} |