trap/test_training_data.ipynb

245 lines
2.4 MiB
Text
Raw Normal View History

2024-12-06 08:28:48 +01:00
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/ruben/suspicion/trap/.venv/lib/python3.10/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
" from .autonotebook import tqdm as notebook_tqdm\n"
]
}
],
"source": [
"from pathlib import Path\n",
"from typing import List\n",
"from trap.frame_emitter import Track\n",
"from trap.frame_emitter import Camera\n",
"from trap.tracker import TrackReader\n",
"\n",
"\n",
"path = Path(\"EXPERIMENTS/raw/hof3/\")\n",
"calibration_path = Path(\"../DATASETS/hof3/calibration.json\")\n",
"homography_path = Path(\"../DATASETS/hof3/homography.json\")\n",
"camera = Camera.from_paths(calibration_path, homography_path, 12)\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"reader = TrackReader(path, camera.fps, exclude_whitelisted = False, include_blacklisted=False)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from trap.tracker import FinalDisplacementFilter\n",
"\n",
"\n",
"tracks: List[Track] = [t for t in reader]\n",
"filter = FinalDisplacementFilter(2)\n",
"tracks = filter.apply(tracks, camera)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Track(track_id='7', history=[Detection(track_id='7', l=1320.8199462890625, t=251.9683380126953, w=111.053955078125, h=234.67745971679688, conf=1, state=<DetectionState.Confirmed: 2>, frame_nr=3264, det_class=1), Detection(track_id='7', l=1339.9742431640625, t=238.920166015625, w=105.037109375, h=222.37574768066406, conf=1, state=<DetectionState.Confirmed: 2>, frame_nr=3265, det_class=1), Detection(track_id='7', l=1352.3323974609375, t=229.05804443359375, w=104.625732421875, h=221.97633361816406, conf=1, state=<DetectionState.Confirmed: 2>, frame_nr=3266, det_class=1), Detection(track_id='7', l=1359.267822265625, t=220.7544708251953, w=106.5965576171875, h=226.98056030273438, conf=1, state=<DetectionState.Confirmed: 2>, frame_nr=3267, det_class=1), Detection(track_id='7', l=1362.710693359375, t=213.61810302734375, w=109.2371826171875, h=233.524169921875, conf=1, state=<DetectionState.Confirmed: 2>, frame_nr=3268, det_class=1), Detection(track_id='7', l=1364.126708984375, t=203.14120483398438, w=111.1407470703125, h=238.55650329589844, conf=1, state=<DetectionState.Confirmed: 2>, frame_nr=3269, det_class=1), Detection(track_id='7', l=1367.715576171875, t=190.77456665039062, w=112.6883544921875, h=245.13031005859375, conf=1, state=<DetectionState.Confirmed: 2>, frame_nr=3270, det_class=1), Detection(track_id='7', l=1375.32275390625, t=181.7355194091797, w=108.6031494140625, h=238.25833129882812, conf=1, state=<DetectionState.Confirmed: 2>, frame_nr=3271, det_class=1), Detection(track_id='7', l=1380.20654296875, t=170.72500610351562, w=103.9525146484375, h=230.0364227294922, conf=1, state=<DetectionState.Confirmed: 2>, frame_nr=3272, det_class=1), Detection(track_id='7', l=1385.44189453125, t=161.61102294921875, w=97.076416015625, h=216.43988037109375, conf=1, state=<DetectionState.Confirmed: 2>, frame_nr=3273, det_class=1), Detection(track_id='7', l=1387.068603515625, t=149.4908447265625, w=97.640869140625, h=220.21246337890625, conf=1, state=<DetectionState.Confirmed: 2>, frame_nr=3274, det_class=1), Detection(track_id='7', l=1389.26220703125, t=143.24551391601562, w=97.9940185546875, h=224.08978271484375, conf=1, state=<DetectionState.Confirmed: 2>, frame_nr=3275, det_class=1), Detection(track_id='7', l=1388.7193603515625, t=135.30145263671875, w=98.697021484375, h=228.9639129638672, conf=1, state=<DetectionState.Confirmed: 2>, frame_nr=3276, det_class=1), Detection(track_id='7', l=1391.044921875, t=126.18832397460938, w=95.349853515625, h=223.96878051757812, conf=1, state=<DetectionState.Confirmed: 2>, frame_nr=3277, det_class=1), Detection(track_id='7', l=1392.5245361328125, t=115.1940689086914, w=91.294921875, h=215.87339782714844, conf=1, state=<DetectionState.Confirmed: 2>, frame_nr=3278, det_class=1), Detection(track_id='7', l=1394.88720703125, t=104.04446411132812, w=87.3721923828125, h=207.13995361328125, conf=1, state=<DetectionState.Confirmed: 2>, frame_nr=3279, det_class=1), Detection(track_id='7', l=1395.7288818359375, t=94.92156982421875, w=87.2978515625, h=207.88204956054688, conf=1, state=<DetectionState.Confirmed: 2>, frame_nr=3280, det_class=1), Detection(track_id='7', l=1395.14404296875, t=89.08332061767578, w=87.2071533203125, h=209.1320037841797, conf=1, state=<DetectionState.Confirmed: 2>, frame_nr=3281, det_class=1), Detection(track_id='7', l=1393.6158447265625, t=83.175048828125, w=88.0908203125, h=213.34136962890625, conf=1, state=<DetectionState.Confirmed: 2>, frame_nr=3282, det_class=1), Detection(track_id='7', l=1393.5189208984375, t=79.1900634765625, w=87.788330078125, h=212.45541381835938, conf=1, state=<DetectionState.Confirmed: 2>, frame_nr=3283, det_class=1), Detection(track_id='7', l=1392.7437744140625, t=71.73565673828125, w=84.64892578125, h=204.18603515625, conf=1, state=<DetectionState.Confirmed: 2>, frame_nr=3284, det_class=1), Detection(track_id='7', l=1391.8515625, t=61.526771545410156, w=79.6556396484375, h=191.9879913330078, conf=1, state=<DetectionState.Confirmed: 2>, frame_nr=3285, det_class=1), Detection(track_id='7', l=1390.78076171875, t=58.899993896484375, w=77.8787
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"tracks[0]"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"\n",
"from trap.tracker import Smoother\n",
"\n",
"\n",
"smoother = Smoother(12, convolution=True)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"import cv2\n",
"from matplotlib import pyplot as plt\n",
"from matplotlib.axes import Axes\n",
"import tqdm\n"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
" 0%| | 0/4722 [00:00<?, ?it/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 4722/4722 [01:11<00:00, 65.98it/s] \n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABA4AAAT7CAYAAAAegfLqAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/NK7nSAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9eZRk6Xnf+X3f97177LlnZa1dXV2NBhoLQQLEQogUKXJgSuKxPJLo8aEkUmOJ5hxKY0qcsWzLI2tG0tGxR6IsDWc8mtFqebTQIimRAiFuWImlsXaju9Fd1VVZS2blFnvEXd/Ff2R1AU2gGwAJCCDwfs7Jcypu3Lxx742sOHF/93mfVzjnHJ7neZ7neZ7neZ7neV+E/HrvgOd5nud5nud5nud537h8cOB5nud5nud5nud53svywYHneZ7neZ7neZ7neS/LBwee53me53me53me570sHxx4nud5nud5nud5nveyfHDgeZ7neZ7neZ7ned7L8sGB53me53me53me53kvK/h678BvZ61lf3+fTqeDEOLrvTue53me53me53me903HOcd8PufMmTNI+co1Bd9wwcH+/j7nzp37eu+G53me53me53me533Tu3PnDmfPnn3Fdb7hgoNOpwOc7ny32/06743neZ7neZ7neZ7nffOZzWacO3fuwTX4K/mGCw5eHJ7Q7XZ9cOB5nud5nud5nud5X0NfTosA3xzR8zzP8zzP8zzP87yX5YMDz/M8z/M8z/M8z/Nelg8OPM/zPM/zPM/zPM97WT448DzP8zzP8zzP8zzvZfngwPM8z/M8z/M8z/O8l+WDA8/zPM/zPM/zPM/zXpYPDjzP8zzP8zzP8zzPe1k+OPA8z/M8z/M8z/M872X54MDzPM/zPM/zPM/zvJflgwPP8zzP8zzP8zzP816WDw48z/M8z/M8z/M8z3tZPjjwPM/zPM/zPM/zPO9l+eDA8zzP8zzP8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g3QqmI9toGi2mODT6FoeDsq76fo5t3sdZQLhYELUHOUyy7End3nTS7RzIvMEpSPtlQl1NiV7HsdBArfdz5M+y86ttxB4fUwZDowgUsFmMNta3Zne0+CA9eDA1qWxMRYZ1FoXDWYY3DaMvkMH8QHhhtqWYFD21kXCsXTG99iuuLOSLukEachgYbNZEtoBpDe+Vr8t42puH29DaFLgAehAcvhgY3JjdIjKRfGKKiYfFbv/UgPHgxNLDz+WmY0DTggwPP834P+YqnY3zf+97HH/pDf4gzZ84ghOAXfuEXXnbdH//xH0cIwc/8zM/8LnbR8zzP8zzvG9NnPvPf8+u/8Q7e974/xQvP/xK/9LF/wT/8+D+gMQ0f+vB/yq//xvfyiz//F/jXf/1j/JNf+xf8T3/v33HjM/sPfv/6J/d59z94jg+965h/8/N3MHlITIJI19Df/Z9AGIOUCOcQukTqhuCP/+8YfNfbGWyfIUpTVs+cY2XnLIPtM3QGq/Q3t+htbJJ1enRW1+isrNEaDJAq4OzVx9h59AJpu00YSUxdEkaC46NfQyWOrNMlbgeUzSeZLy2NaRA7FQQKt6wI7x4g6rvokyNmlSZc65A9/ijy4ln2r32KpixwWoMxhCo8rUCQ0YPwIG/yz4UGMnpJJYIK5EvCgslhTl1qJoc5prVD+3t/kldfCEgDgz25jlgcsL54kgsrNVHWhR/4r2H18tf0/XY4TooTbkxucG1yjbzJH4QGJ8UJLlAEm1uYyQQ7nzP7tV+j2t1l/oEPYOdzzGRCsLWFSJKv6X56nud9tX3FFQfL5ZLXve51/NiP/Rh/5I/8kZdd7+d//uf58Ic/zJkzZ152Hc/zPM/zvN+rfv03fgx4LwBNsce7PvR+/uc6w0WS4zt/l+8cnN6Zzo9Tnu10ed+Vn0c
"text/plain": [
"<Figure size 2000x1600 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"\n",
"fig = plt.figure(figsize=(20,16))\n",
"ax1, ax2 = fig.subplots(2)\n",
"\n",
"im = cv2.imread(\"../DATASETS/hof3/output.png\")\n",
"ax2.imshow(im)\n",
"ax1.set_aspect(1)\n",
"ax2.set_aspect(1)\n",
"\n",
"\n",
"\n",
"for track in (bar:= tqdm.tqdm(tracks)):\n",
" t = track.get_with_interpolated_history()\n",
" t = smoother.smooth_track(t)\n",
" points = t.get_projected_history(None, camera)\n",
" x, y = points[:,0], points[:,1]\n",
" ax1.plot(x, y, alpha=.2)\n",
" ax1.scatter(x, y, marker='x', alpha=.2)\n",
" l = [d.get_foot_coords()[0] for d in track.history]\n",
" t = [d.get_foot_coords()[1] for d in track.history]\n",
" ax2.plot(l, t, alpha=.2)\n",
" ax2.scatter(l, t, marker='x', alpha=.2)\n",
" # if bar.n > 100:\n",
" # break"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABlIAAAT7CAYAAADlxS3tAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/NK7nSAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOzdd5gV5d3/8ffMnLq9sJWqFDW2KFHUGH8WHhOfRGMBEiGKFRFNVEClLLB0RFBJaGJFhccIluTxiUlEYwyxgyZGowKCIOzC9nrqzPz+WN2EUKTtni2fl9e5ZM/cM+cze51rd2a/576/huu6LiIiIiIiIiIiIiIiIrIHM9EBRERERERERERERERE2ioVUkRERERERERERERERPZBhRQREREREREREREREZF9UCFFRERERERERERERERkH1RIERERERERERERERER2QcVUkRERERERERERERERPZBhRQREREREREREREREZF98CQ6wJHmOA47duwgNTUVwzASHUdEREREpMW5rktdXR2FhYWYpj4rJd9M900iIiIi0pkc7j1Thyuk7Nixg+7duyc6hoiIiIhIq9u2bRvdunVLdAxpB3TfJCIiIiKd0aHeM3W4QkpqairQ9A1JS0tLcBoRERERkZZXW1tL9+7dm6+FRb6J7ptEREREpDM53HumDldI+Xpaelpamm4IRERERKRT0RJNcqB03yQiIiIindGh3jNpAWUREREREREREREREZF9UCFFRERERERERERERERkH1RIERERERERERERERER2QcVUkRERERERERERERERPZBhRQREREREREREREREZF9UCFFRERERERERERERERkH1RIERERERERSZDi4mIMw9jtceyxxx7Qvk8//TSGYXDppZe2bEgRERERkU7Ok+gAIiIiIiIindnxxx/PmjVrmr/2eL75Nm3Lli2MHTuW733vey0ZTUREREREUCFFREREREQkoTweD/n5+Qc83rZthg0bxtSpU/nLX/5CdXX1N+4TiUSIRCLNX9fW1h5KVBERERGRTklLe4mIiIiIiCTQhg0bKCws5Oijj2bYsGFs3bp1v+OnTZtGbm4u119//QG/xuzZs0lPT29+dO/e/XBji4iIiIh0GiqkiIiIiIiIJMiAAQN4/PHH+f3vf8+SJUvYvHkz3/ve96irq9vr+LVr1/LII4/w0EMPHdTrjB8/npqamubHtm3bjkR8EREREZFOQUt7iYiIiIiIJMhFF13U/O+TTjqJAQMG0LNnT5555pk9ZpzU1dVx1VVX8dBDD9GlS5eDeh2/34/f7z8imUVEREREOhsVUkRERESk1S1/ZiX//PRj4h4DbA+2YQDgNW165Xdl1LUjEpxQJDEyMjLo168fGzdu3GPbpk2b2LJlCxdffHHzc47jAE19Vj799FN69+7dallF2pq1a17lxbdexjb8xDHxEueSAedy9sDzEx1NRERE2jkVUkRERESkxdw5awrU5uGPB/Hafvy2H58dwG/n0529N9e2v7CZ/f6zNPjqCHsbiHlD4IlhmTEsM85RBd1UaJEOq76+nk2bNnHVVVftse3YY4/lww8/3O25oqIi6urqWLBggfqeSIc2Z8FcqhrqiLkeHMeDa3sw4j688QD+eJCkWDJJsVS6O/+1235/La3hhVcWEwtWE/CEuGfC9ASdgYiIiLRnh1xIef3117n33ntZt24dJSUlPP/881x66aXN24uLi3n66afZtm0bPp+P/v37M3PmTAYMGLDPY86ePZvnnnuOTz75hGAwyFlnncU999zDMcccc6gxRURERCRB7pxVTO6OU0mKp+5zTMyMErXCRKwwpmuRGk3Hcj2kRTNJi2budR97q82c95+j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Z1e4f7JhTvdezrq5az+Q/
"text/plain": [
"<Figure size 2000x1600 with 6 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import numpy as np\n",
"from trajectron.environment import Environment\n",
"\n",
"from trap.tracker import Smoother\n",
"env = Environment(node_type_list=['PEDESTRIAN'], standardization=None)\n",
"n = 9\n",
"# n = 20\n",
"# n = 21\n",
"# print([d.frame_nr for d in tracks[n].history])\n",
"track = tracks[n].get_with_interpolated_history()\n",
"node_s = smoother.smooth_track(track).to_trajectron_node(camera, env)\n",
"node_o = track.to_trajectron_node(camera, env)\n",
"# print(node.data[:, {'velocity': ['x', 'y']}] * 12)\n",
"\n",
"fig = plt.figure(figsize=(20,16))\n",
"(ax1, ax2), (ax3, ax4), (ax5, ax6) = fig.subplots(3,2)\n",
"\n",
"for i in range(len(track.history)):\n",
" ax1.plot(node_o.data[:, {'position': ['x']}])\n",
" ax1.plot(node_s.data[:, {'position': ['x']}])\n",
" ax2.plot(node_o.data[:, {'position': ['y']}])\n",
" ax2.plot(node_s.data[:, {'position': ['y']}])\n",
" ax3.plot(node_o.data[:, {'velocity': ['x']}])\n",
" ax3.plot(node_s.data[:, {'velocity': ['x']}])\n",
" ax4.plot(node_o.data[:, {'velocity': ['y']}])\n",
" ax4.plot(node_s.data[:, {'velocity': ['y']}])\n",
" ax5.plot(np.linalg.norm(node_o.data[:, {'velocity': ['x', 'y']}], axis=1) * 12)\n",
" ax5.plot(np.linalg.norm(node_s.data[:, {'velocity': ['x', 'y']}], axis=1) * 12)\n",
" \n",
" ax6.plot(np.linalg.norm(node_o.data[:, {'acceleration': ['x', 'y']}], axis=1) * 12)\n",
" ax6.plot(np.linalg.norm(node_s.data[:, {'acceleration': ['x', 'y']}], axis=1) * 12)\n",
" # np.linalg.norm(node.data[:, {'acceleration': ['x', 'y']}], axis=1) * 12\n",
"# node.data[:, {'acceleration': ['x', 'y']}]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"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.10.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}