{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# RoboX Egotask Dataset Explorer\n\nExplore the **RoboX-EgoTask-v1.7** bundle — egocentric dataset. \nThis notebook is auto-generated for this specific campaign. Run all cells to get a quick overview." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from pathlib import Path\nimport json, sys, random\nfrom collections import Counter\n\nDATASET_ROOT = Path(\"..\") # bundle root\nCAMPAIGN_TYPE = \"ego_task\"\n\nif not DATASET_ROOT.exists():\n sys.exit(f\"Dataset not found: {DATASET_ROOT}\")\n\nclips = [json.loads(l) for l in (DATASET_ROOT / 'metadata' / 'clips.jsonl').read_text().splitlines() if l.strip()]\nsplits = {}\nfor c in clips:\n splits.setdefault(c.get('split', 'unknown'), []).append(c)\n\nstats = json.loads((DATASET_ROOT / 'stats.json').read_text())\nmanifest = json.loads((DATASET_ROOT / 'manifest.json').read_text())\n\nprint(f\"Dataset : {manifest['dataset_name']} v{manifest['schema_version']}\")\nprint(f\"Campaign : {manifest['campaign']}\")\nprint(f\"Profile : {manifest['dataset_profile']}\")\nprint(f\"Clips : {stats['total_clips']} | Recordings: {stats['total_recordings']}\")\nprint(f\"Duration : {stats['total_duration_sec']:.1f}s\")\nprint(f\"Contributors: {stats['unique_contributors']}\")\nprint(f\"Splits : { {k: len(v) for k, v in splits.items()} }\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Sensor Tier Distribution" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "tiers = Counter(c.get('sensor_tier') for c in clips)\nprint(\"Sensor tier distribution:\")\nfor tier, count in sorted(tiers.items(), key=lambda x: -x[1]):\n pct = 100 * count / len(clips)\n bar = '█' * count\n print(f\" {tier:15s}: {bar} {count} clips ({pct:.1f}%)\")\n\ntier_cov = stats.get('annotation_coverage_by_sensor_tier', {})\nif tier_cov:\n print()\n print(\"Annotation coverage by tier:\")\n for tier, values in tier_cov.items():\n cov_summary = ', '.join(f\"{k}={v['percent']:.0f}%\" for k, v in values['coverage'].items())\n print(f\" [{tier}] ({values['total']} clips): {cov_summary}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Object / Domain Distribution" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "obj_counts = Counter(\n c['labels'].get('object') for c in clips if c.get('labels', {}).get('object')\n)\ndom_counts = Counter(\n c['labels'].get('object_domain') for c in clips if c.get('labels', {}).get('object_domain')\n)\nif obj_counts:\n print('Object distribution:')\n for label, count in obj_counts.most_common():\n print(f' {label:25s}: {count}')\nif dom_counts:\n print()\n print('Domain distribution:')\n for dom, count in dom_counts.most_common():\n print(f' {dom:25s}: {count}')\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Clip Duration Distribution" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "dd = stats.get('duration_distribution', {})\nprint(\"Duration stats:\")\nprint(f\" min : {dd.get('min_sec')} s\")\nprint(f\" max : {dd.get('max_sec')} s\")\nprint(f\" mean : {dd.get('mean_sec')} s\")\nprint(f\" median : {dd.get('median_sec')} s\")\n\nbuckets = [0, 2, 4, 6, 10, 20, 999]\nbucket_labels = ['<2s', '2-4s', '4-6s', '6-10s', '10-20s', '>20s']\nbucket_counts = [0] * 6\nfor d in [c['duration_sec'] for c in clips]:\n for i in range(len(buckets) - 1):\n if buckets[i] <= d < buckets[i + 1]:\n bucket_counts[i] += 1\n break\nprint()\nprint(\"Distribution:\")\nfor label, count in zip(bucket_labels, bucket_counts):\n bar = '█' * count\n print(f\" {label:6s}: {bar} ({count})\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Object Tracks — temporal density and in_hand" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "track_dir = DATASET_ROOT / 'annotations' / 'object_tracks'\ntrack_files = sorted(track_dir.glob('*.jsonl'))\ncandidates = []\nfor tf in track_files:\n lines = [l for l in tf.read_text().splitlines() if l.strip()]\n candidates.append((len(lines), tf))\ncandidates.sort(reverse=True)\nprint(\"Top 5 clips by object track density:\")\nfor count, path in candidates[:5]:\n print(f\" {path.stem}: {count} observations\")\nif candidates:\n best = candidates[0][1]\n lines = [json.loads(l) for l in best.read_text().splitlines() if l.strip()]\n print(f\"\\nFirst 3 observations from {best.stem}:\")\n for obs in lines[:3]:\n for o in obs.get('objects', []):\n print(f\" frame={obs.get('frame')} ts={obs.get('timestamp_sec'):.3f}s track_id={o.get('track_id')} label={o.get('class_label')} in_hand={o.get('in_hand')}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Sample Narrations" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "sample = [c for c in clips if c.get('narration')]\nrandom.shuffle(sample)\nprint(\"5 random clips with narration:\")\nfor c in sample[:5]:\n gs = c.get('grip_summary')\n print(f\" [{c['split']}] {c['clip_id']} tier={c['sensor_tier']}\")\n print(f\" {c['narration'][:100]}\")\n if gs:\n print(f\" grip: {gs['dominant_grip']} hand={gs['grip_hand']}\")\n print()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Showcase Clips" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "showcase_path = DATASET_ROOT / 'showcase' / 'best_clips.json'\nif showcase_path.exists():\n showcase = json.loads(showcase_path.read_text())\n print(f\"Showcase: {showcase.get('dataset')}\")\n for clip in showcase.get('clips', []):\n print(f\" [{clip['split']}] {clip['clip_id']} tier={clip['sensor_tier']}\")\n if clip.get('labels'):\n print(f\" labels: {clip['labels']}\")\n if clip.get('narration'):\n print(f\" {clip['narration'][:80]}\")\n print()\nelse:\n print(\"No showcase file found.\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Validation & Sanitization Status" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "val = json.loads((DATASET_ROOT / 'VALIDATION_REPORT.json').read_text())\nsan = json.loads((DATASET_ROOT / 'SANITIZATION_REPORT.json').read_text())\nprint(\"Validation:\", '✅ PASSED' if val['passed'] else '❌ FAILED')\nprint(f\" errors : {val['summary']['error_count']}\")\nprint(f\" warnings: {val['summary']['warning_count']}\")\nprint()\nprint(\"Sanitization:\", '✅ PASSED' if san['passed'] else '❌ FAILED')\nprint(f\" findings: {san['summary']['finding_count']}\")\nprint()\nprint(\"Privacy review:\", '✅' if manifest.get('privacy_review_passed') else '❌')" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "name": "python", "version": "3.10.0" } }, "nbformat": 4, "nbformat_minor": 4 }