nbv_sim/scripts/print_stats.ipynb
2021-12-22 14:40:48 +01:00

111 lines
3.3 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Generate table entry of a single experiment."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"logfile = \"\"\n",
"\n",
"df = pd.read_csv(logfile)\n",
"df = df[df.result != \"no_motion_plan_found\"]\n",
"\n",
"n_attempts = len(df.index)\n",
"n_succeeded = (df.result == \"succeeded\").sum()\n",
"n_failed = (df.result == \"failed\").sum()\n",
"n_aborted = (df.result == \"aborted\").sum()\n",
"\n",
"views_mean = df.view_count.mean()\n",
"views_std = df.view_count.std()\n",
"\n",
"search_time_mean = df.search_time.mean()\n",
"search_time_std = df.search_time.std()\n",
"\n",
"total_time_mean = (df.search_time + df.grasp_time).mean()\n",
"total_time_std = (df.search_time + df.grasp_time).std()\n",
"\n",
"print(f\"${(n_succeeded / n_attempts) * 100:.0f}$ & ${(n_failed / n_attempts) * 100:.0f}$ & ${(n_aborted / n_attempts) * 100:.0f}$ & ${views_mean:.0f} \\pm {views_std:.0f}$ & ${search_time_mean:.1f} \\pm {search_time_std:.1f}$ & ${total_time_mean:.1f} \\pm {total_time_std:.1f}$\")\n",
"# print(f\"${n_succeeded}/{n_attempts}$ & ${n_failed}/{n_attempts}$ & ${n_aborted}/{n_attempts}$ & ${views_mean:.0f} \\pm {views_std:.0f}$ & ${search_time_mean:.1f} \\pm {search_time_std:.1f}$ & ${total_time_mean:.1f} \\pm {total_time_std:.1f}$\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Compute timings"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"view_generation = df.view_generation / df.view_count\n",
"state_update = df.state_update / df.view_count\n",
"tsdf_update = df.tsdf_integration / df.view_count\n",
"grasp_prediction = df.grasp_prediction / df.view_count\n",
"grasp_selection = df.grasp_selection / df.view_count\n",
"ig_computation = df.ig_computation / df.view_count\n",
"\n",
"print(f\"View generation: {view_generation.mean():.3f}\")\n",
"print(f\"State update: {state_update.mean():.3f}\")\n",
"print(f\" TSDF update: {tsdf_update.mean():.3f}\")\n",
"print(f\" Grasp prediction: {grasp_prediction.mean():.3f}\")\n",
"print(f\" Grasp selection: {grasp_selection.mean():.3f}\")\n",
"print(f\"IG computation: {ig_computation.mean():.3f}\")\n",
"print(\"---\")\n",
"print(f\"Total time: {view_generation.mean() + state_update.mean() + ig_computation.mean():.3f}\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"interpreter": {
"hash": "fb16c2a7860a3d6783f021a002ede0627d3977ca7b794dfd7ea4f613fe21e5c4"
},
"kernelspec": {
"display_name": "Python 3.8.10 64-bit ('noetic': venv)",
"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.10"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}