trap/test_training_data.ipynb

236 lines
2.3 MiB
Text
Raw Permalink Normal View History

2024-12-06 08:28:48 +01:00
{
"cells": [
{
"cell_type": "code",
2024-12-10 15:43:30 +01:00
"execution_count": 2,
2024-12-06 08:28:48 +01:00
"metadata": {},
2024-12-10 15:43:30 +01:00
"outputs": [],
2024-12-06 08:28:48 +01:00
"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",
2024-12-10 15:43:30 +01:00
"execution_count": 3,
2024-12-06 08:28:48 +01:00
"metadata": {},
"outputs": [],
"source": [
"reader = TrackReader(path, camera.fps, exclude_whitelisted = False, include_blacklisted=False)"
]
},
{
"cell_type": "code",
2024-12-10 15:43:30 +01:00
"execution_count": 4,
2024-12-06 08:28:48 +01:00
"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",
2024-12-10 15:43:30 +01:00
"execution_count": 5,
2024-12-06 08:28:48 +01:00
"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
]
},
2024-12-10 15:43:30 +01:00
"execution_count": 5,
2024-12-06 08:28:48 +01:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"tracks[0]"
]
},
{
"cell_type": "code",
2024-12-10 15:43:30 +01:00
"execution_count": 6,
2024-12-06 08:28:48 +01:00
"metadata": {},
"outputs": [],
"source": [
"\n",
"from trap.tracker import Smoother\n",
"\n",
"\n",
"smoother = Smoother(12, convolution=True)"
]
},
{
"cell_type": "code",
2024-12-10 15:43:30 +01:00
"execution_count": 7,
2024-12-06 08:28:48 +01:00
"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",
2024-12-10 15:43:30 +01:00
"execution_count": 8,
2024-12-06 08:28:48 +01:00
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
2024-12-10 15:43:30 +01:00
" 0%| | 0/2682 [00:00<?, ?it/s]"
2024-12-06 08:28:48 +01:00
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
2024-12-10 15:43:30 +01:00
"100%|██████████| 2682/2682 [00:26<00:00, 100.91it/s]\n"
2024-12-06 08:28:48 +01:00
]
},
{
"data": {
2024-12-10 15:43:30 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAABBsAAAT7CAYAAADfBrhGAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/NK7nSAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9yY+s25nf+33XWm8ffWSfuXPvffY+PA3JIqtIlbqSr0rNvboFWRMDhuFBQRBwB5pIAwka6C8Q5FHJgO7AhmHBFx4YFiwB17At68qSqm5JZBXJYnf63Wef0TdvvxoP9uEpHpKiqsRTbNcHCOwd8b75xkJmZCLWL571LOGcc3ie53me53me53me531C5E96AJ7neZ7neZ7neZ7n/XzxYYPneZ7neZ7neZ7neZ8oHzZ4nud5nud5nud5nveJ8mGD53me53me53me53mfKB82eJ7neZ7neZ7neZ73ifJhg+d5nud5nud5nud5nygfNnie53me53me53me94kKftID+F7WWi4vL+n1egghftLD8TzP8zzP8zzP8zwPcM6x2Ww4Pj5Gyh9eu/BTFzZcXl5yenr6kx6G53me53me53me53k/wNnZGXfu3Pmh5/zUhQ29Xg94Ofh+v/8THo3neZ7neZ7neZ7neQDr9ZrT09OP5u0/zE9d2PCdpRP9ft+HDZ7neZ7neZ7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55942vEnQ7jkxNk5CeqP22cMbTn5x8to6ifP8c2DdHpXdqLc/KvfAUhFdmf+iJC+cDI8zzvO3zY4Hme53neD2W1xZQttjU4YzGtoXprTv1iRT3Z0q4cgYJoT8Feh8CC2WjqeYW
2024-12-06 08:28:48 +01:00
"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/f6zNPjqCHsbiHlD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CxKIJ5EcTSEYP5lemLiui+vU4Nq7cOI7ce0NOPYucMN7nVtiuCYe14MHA8t0sCwX0+tgeBziPj8Rj5czfzyS/gPPbbFzXLfmNd5cvZiAEccTt/GGwhCOE7IN6jw+bMukygo0DY4CFfX0KHuP7HgEM9XPpq69qEwqxAqnk12fR0akC7mNheQ2FgJgG3GKxj5OXVI5lr+RruqvJSIi0mm06NJeDQ0NlJSUUF5ezkMPPcSrr77K22+/TW5u7jce8+abb+all15i7dq1dOvWbZ/j9jYjpXv37pqiLiIiItKKFj+2jC8+gR41fYiaYbZ1e4f7JhTvdezrq5az+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
}