{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "cdab3238", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "6af26676e14c442ca27bbe59c2bc6bce", "version_major": 2, "version_minor": 0 }, "text/plain": [ "README.md: 0.00B [00:00, ?B/s]" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stderr", "output_type": "stream", "text": [ "c:\\Users\\HaiPham\\miniconda3\\envs\\vis_3d\\lib\\site-packages\\huggingface_hub\\file_download.py:138: UserWarning: `huggingface_hub` cache-system uses symlinks by default to efficiently store duplicated files but your machine does not support them in C:\\Users\\HaiPham\\.cache\\huggingface\\hub\\datasets--haiphamcse--aistpp. Caching files will still work but in a degraded version that might require more space on your disk. This warning can be disabled by setting the `HF_HUB_DISABLE_SYMLINKS_WARNING` environment variable. For more details, see https://huggingface.co/docs/huggingface_hub/how-to-cache#limitations.\n", "To support symlinks on Windows, you either need to activate Developer Mode or to run Python as an administrator. In order to activate developer mode, see this article: https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development\n", " warnings.warn(message)\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "1d153a3803d04e848a340a2d2457b010", "version_major": 2, "version_minor": 0 }, "text/plain": [ "data/train-00000-of-00001.parquet: 0%| | 0.00/34.1M [00:00" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "sel = np.linspace(0, n_total - 1, 32).astype(int).tolist()\n", "\n", "tensors = []\n", "for fi in sel:\n", " rgb = np.array(row[\"images\"][fi]) # HWC RGB\n", " bgr = rgb[:, :, ::-1].copy()\n", " draw(bgr, kp2d[fi])\n", " ts = row[\"frame_timestamps\"][fi]\n", " cv2.putText(bgr, f\"{ts:.2f}s\", (8, 22),\n", " cv2.FONT_HERSHEY_SIMPLEX, 0.6, (255, 255, 255), 2)\n", " out = bgr[:, :, ::-1].copy() # back to RGB\n", " tensors.append(torch.from_numpy(out).permute(2, 0, 1).float() / 255.0)\n", "\n", "grid = make_grid(torch.stack(tensors), nrow=8, padding=3)\n", "grid_np = grid.permute(1, 2, 0).numpy()\n", "\n", "# combined figure: waveform + frame grid\n", "fig = plt.figure(figsize=(15, 10))\n", "gs = fig.add_gridspec(2, 1, height_ratios=[1, 3], hspace=0.18)\n", "\n", "ax_a = fig.add_subplot(gs[0])\n", "t = np.arange(len(audio)) / sr\n", "ax_a.plot(t, audio, lw=0.4, color=\"#1f77b4\")\n", "ax_a.set_xlim(0, dur)\n", "ax_a.set_title(f\"Audio (re-stitched from audio_chunks) | {seq} \"\n", " f\"sr={sr}Hz {dur:.2f}s\", fontsize=11)\n", "ax_a.set_xlabel(\"time (s)\"); ax_a.set_ylabel(\"amp\")\n", "for fi in sel:\n", " ax_a.axvline(row[\"frame_timestamps\"][fi], color=\"red\", alpha=0.5, lw=1)\n", "\n", "ax_i = fig.add_subplot(gs[1])\n", "ax_i.imshow(np.clip(grid_np, 0, 1))\n", "ax_i.axis(\"off\")\n" ] } ], "metadata": { "kernelspec": { "display_name": "vis_3d", "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.15" } }, "nbformat": 4, "nbformat_minor": 5 }