Skip to content
Snippets Groups Projects
demo.ipynb 3.4 MiB
Newer Older
     "ename": "IndexError",
     "evalue": "list index out of range",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mIndexError\u001b[0m                                Traceback (most recent call last)",
      "Cell \u001b[0;32mIn[24], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mefficiency_tbls\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m2\u001b[39;49m\u001b[43m]\u001b[49m \u001b[38;5;66;03m# KITTI\u001b[39;00m\n",
      "\u001b[0;31mIndexError\u001b[0m: list index out of range"
     ]
    }
   ],
   "source": [
    "efficiency_tbls[2] # KITTI"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\\begin{tabular}{rll}\n",
      "\\toprule\n",
      "$1 - \\epsilon^g$ & Max multiplicative & s.n. Empirical DE-CCP \\\\\n",
      "\\midrule\n",
      "0.95 & 5.46e+06±3.43e+05 & 1.51e+06±1.65e+05 \\\\\n",
      "0.86 & 1.28e+06±1.23e+05 & 4.67e+05±3.84e+04 \\\\\n",
      "0.76 & 4.76e+05±4.16e+04 & 2.04e+05±1.89e+04 \\\\\n",
      "0.67 & 2.00e+05±1.88e+04 & 9.65e+04±8.98e+03 \\\\\n",
      "0.57 & 9.16e+04±8.32e+03 & 4.67e+04±3.29e+03 \\\\\n",
      "0.48 & 4.07e+04±3.47e+03 & 2.19e+04±2.10e+03 \\\\\n",
      "0.38 & 1.75e+04±1.79e+03 & 9.72e+03±9.11e+02 \\\\\n",
      "0.29 & 6.92e+03±6.31e+02 & 3.80e+03±4.10e+02 \\\\\n",
      "0.19 & 2.24e+03±2.88e+02 & 1.18e+03±1.29e+02 \\\\\n",
      "0.10 & 4.93e+02±6.61e+01 & 2.70e+02±1.84e+01 \\\\\n",
      "\\bottomrule\n",
      "\\end{tabular}\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(efficiency_tbls[2].to_latex(index=False, float_format=\"{:.2f}\".format))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'res3' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[0;32mIn[34], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28mlen\u001b[39m(res\u001b[38;5;241m.\u001b[39mlogs[\u001b[38;5;241m0\u001b[39m][\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mcal_dissims\u001b[39m\u001b[38;5;124m'\u001b[39m]), \u001b[38;5;28mlen\u001b[39m(res2\u001b[38;5;241m.\u001b[39mlogs[\u001b[38;5;241m0\u001b[39m][\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mcal_dissims\u001b[39m\u001b[38;5;124m'\u001b[39m]), \u001b[38;5;28mlen\u001b[39m(\u001b[43mres3\u001b[49m\u001b[38;5;241m.\u001b[39mlogs[\u001b[38;5;241m0\u001b[39m][\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mcal_dissims\u001b[39m\u001b[38;5;124m'\u001b[39m])\n",
      "\u001b[0;31mNameError\u001b[0m: name 'res3' is not defined"
     ]
    }
   ],
   "source": [
    "len(res.logs[0]['cal_dissims']), len(res2.logs[0]['cal_dissims']), len(res3.logs[0]['cal_dissims'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[(3786, 4),\n",
       " (3786, 4),\n",
       " (3786, 4),\n",
       " (3786, 4),\n",
       " (3786, 4),\n",
       " (3786, 4),\n",
       " (3786, 4),\n",
       " (3786, 4),\n",
       " (3786, 4),\n",
       " (3786, 4)]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "[res.logs[i]['cal_dissims'].shape for i in range(10)]"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {},
   "source": [
    "import torch\n",
    "from sklearn.model_selection import KFold, train_test_split\n",
    "\n",
    "from src.data import FullKitti, Split\n",
    "from src.detectors import YOLOv8\n",
    "\n",
    "\n",
    "kitti = FullKitti('datasets', download=True)\n",
    "tra_set, test_set = train_test_split(kitti, test_size=0.10)\n",
    "tra_set, cal_set = train_test_split(tra_set, test_size=0.15)\n",
    "split = Split(dataset=kitti, label=12,\n",
    "              subsets=[tra_set, cal_set, test_set])\n",
    "\n",
    "detector = YOLOv8()\n",
    "device = torch.device('cuda:0')\n",
    "results = detector.train(split, device=device, epochs=300, from_scratch=True)\n",
    "results\n",
    "\n",
    "# Plot tra_res\n",
    "# Describe KITTI test vs tra folders vs total counts, splits counts & filtered counts\n",
    "# Solve eff(max-additive) << eff(bonferroni) & yolov8n.pt vs from scratch"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "\"\"\" To Do(s):\n",
    "    - produce a manual Tikz picture -> Done, \n",
    "    - rewrite the methodology section -> Done,\n",
    "    - rewrite the results section -> ,\n",
    "    - write the discussion section,\n",
    "    - write the conclusion section,\n",
    "    - clean the code -> make a 'release branch with a minimal code':\n",
    "        - only fine tune (for now/untill ECAI),\n",
    "        - fix quantile level vs (1 - eps)*(1 + 1/n),\n",
    "        - correct the summary table and plot descriptive statistics -> Done,\n",
    "        - modify the generated data (break max-additive) and fix the gumbel copula,\n",
    "        - use a one class panda frame with png names (make sure it's 1D, 2D & 3D compatible?),\n",
    "        - use plotly or a board/logger for detailed demos,\n",
    "        - use seaborn for summarized results?,\n",
    "        - use boxplots rather than scatters for effs?,\n",
    "        - use pytorch lightning to parallelize tra & conf on 1-n GPU(s),\n",
    "        - use hydra to serialize the confs of experiments,\n",
    "        - use mappy to reduce conf boiler plate code & parallelize on GPU(s)?,\n",
    "        - pub3, 4 & 5 = mtv qtls, mxd/true m-task c.o.d & coRL UQdrivenRL,\n",
    "            - read some of that mtv qtl paper & pbcrs.com::mxd ...,\n",
    "\"\"\";\n",
    "#make the cfmz|reporter plot some random 3-10 pictures?!?"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "TBD",
   "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.8.18"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}