diff --git a/taco_analysis/analyze_taco.py b/taco_analysis/analyze_taco.py new file mode 100644 index 0000000000000000000000000000000000000000..ceb91461af5bf0ad4c61fadf9202f11cc48ae5ea --- /dev/null +++ b/taco_analysis/analyze_taco.py @@ -0,0 +1,295 @@ +#!/usr/bin/env python +"""Analyze the TACO dataset and generate summary plots. + +Usage: + python analyze_taco.py [--csv /path/to/taco_info.csv] [--output-dir /path/to/plots] +""" + +import argparse +from pathlib import Path + +import matplotlib +matplotlib.use("Agg") +import matplotlib.pyplot as plt +import numpy as np +import pandas as pd +import seaborn as sns + +sns.set_theme(style="whitegrid", font_scale=1.1) +FIGSIZE = (12, 6) +DPI = 150 + + +def plot_action_distribution(df: pd.DataFrame, out_dir: Path): + """Bar chart of sequences per action verb.""" + fig, ax = plt.subplots(figsize=FIGSIZE) + counts = df["action"].value_counts().sort_values(ascending=True) + counts.plot.barh(ax=ax, color=sns.color_palette("viridis", len(counts))) + ax.set_xlabel("Number of sequences") + ax.set_title("Sequences per Action") + for i, v in enumerate(counts): + ax.text(v + 1, i, str(v), va="center", fontsize=9) + plt.tight_layout() + fig.savefig(out_dir / "action_distribution.png", dpi=DPI) + plt.close(fig) + + +def plot_tool_distribution(df: pd.DataFrame, out_dir: Path): + """Bar chart of sequences per tool.""" + fig, ax = plt.subplots(figsize=FIGSIZE) + counts = df["tool"].value_counts().sort_values(ascending=True) + counts.plot.barh(ax=ax, color=sns.color_palette("mako", len(counts))) + ax.set_xlabel("Number of sequences") + ax.set_title("Sequences per Tool") + for i, v in enumerate(counts): + ax.text(v + 1, i, str(v), va="center", fontsize=9) + plt.tight_layout() + fig.savefig(out_dir / "tool_distribution.png", dpi=DPI) + plt.close(fig) + + +def plot_object_distribution(df: pd.DataFrame, out_dir: Path): + """Bar chart of sequences per object.""" + fig, ax = plt.subplots(figsize=FIGSIZE) + counts = df["object"].value_counts().sort_values(ascending=True) + counts.plot.barh(ax=ax, color=sns.color_palette("rocket", len(counts))) + ax.set_xlabel("Number of sequences") + ax.set_title("Sequences per Object") + for i, v in enumerate(counts): + ax.text(v + 1, i, str(v), va="center", fontsize=9) + plt.tight_layout() + fig.savefig(out_dir / "object_distribution.png", dpi=DPI) + plt.close(fig) + + +def plot_triplet_heatmap(df: pd.DataFrame, out_dir: Path): + """Heatmap of (action, object) combinations.""" + pivot = df.groupby(["action", "object"]).size().reset_index(name="count") + pivot = pivot.pivot(index="action", columns="object", values="count").fillna(0).astype(int) + fig, ax = plt.subplots(figsize=(14, 8)) + sns.heatmap(pivot, annot=True, fmt="d", cmap="YlOrRd", ax=ax, linewidths=0.5) + ax.set_title("Sequences per (Action, Object) Combination") + plt.tight_layout() + fig.savefig(out_dir / "action_object_heatmap.png", dpi=DPI) + plt.close(fig) + + +def plot_frame_count_distribution(df: pd.DataFrame, out_dir: Path): + """Histogram of frame counts across sequences.""" + valid = df[df["n_frames"] > 0] + if valid.empty: + return + fig, ax = plt.subplots(figsize=FIGSIZE) + ax.hist(valid["n_frames"], bins=50, color=sns.color_palette("deep")[0], edgecolor="white", alpha=0.8) + ax.axvline(valid["n_frames"].median(), color="red", linestyle="--", label=f'Median: {valid["n_frames"].median():.0f}') + ax.axvline(valid["n_frames"].mean(), color="orange", linestyle="--", label=f'Mean: {valid["n_frames"].mean():.0f}') + ax.set_xlabel("Number of frames") + ax.set_ylabel("Number of sequences") + ax.set_title("Frame Count Distribution") + ax.legend() + plt.tight_layout() + fig.savefig(out_dir / "frame_count_distribution.png", dpi=DPI) + plt.close(fig) + + +def plot_duration_distribution(df: pd.DataFrame, out_dir: Path): + """Histogram of sequence durations.""" + valid = df[df["duration_s"] > 0] + if valid.empty: + return + fig, ax = plt.subplots(figsize=FIGSIZE) + ax.hist(valid["duration_s"], bins=50, color=sns.color_palette("deep")[1], edgecolor="white", alpha=0.8) + ax.axvline(valid["duration_s"].median(), color="red", linestyle="--", label=f'Median: {valid["duration_s"].median():.1f}s') + ax.axvline(valid["duration_s"].mean(), color="orange", linestyle="--", label=f'Mean: {valid["duration_s"].mean():.1f}s') + ax.set_xlabel("Duration (seconds)") + ax.set_ylabel("Number of sequences") + ax.set_title("Sequence Duration Distribution") + ax.legend() + plt.tight_layout() + fig.savefig(out_dir / "duration_distribution.png", dpi=DPI) + plt.close(fig) + + +def plot_duration_by_action(df: pd.DataFrame, out_dir: Path): + """Box plot of duration per action.""" + valid = df[df["duration_s"] > 0] + if valid.empty: + return + order = valid.groupby("action")["duration_s"].median().sort_values(ascending=False).index + fig, ax = plt.subplots(figsize=FIGSIZE) + sns.boxplot(data=valid, x="action", y="duration_s", order=order, ax=ax, palette="viridis") + ax.set_xlabel("Action") + ax.set_ylabel("Duration (seconds)") + ax.set_title("Sequence Duration by Action") + plt.xticks(rotation=45, ha="right") + plt.tight_layout() + fig.savefig(out_dir / "duration_by_action.png", dpi=DPI) + plt.close(fig) + + +def plot_modality_completeness(df: pd.DataFrame, out_dir: Path): + """Bar chart of modality availability.""" + modality_cols = [ + "has_egocentric_rgb", "has_egocentric_depth", "has_hand_poses", + "has_object_poses", "has_segmentation", "has_alloc_cam_params", + "has_ego_cam_params", + ] + labels = [c.replace("has_", "").replace("_", " ").title() for c in modality_cols] + counts = [df[c].sum() for c in modality_cols] + pcts = [100 * c / len(df) for c in counts] + + fig, ax = plt.subplots(figsize=FIGSIZE) + bars = ax.barh(labels, pcts, color=sns.color_palette("Greens_d", len(labels))) + ax.set_xlabel("Availability (%)") + ax.set_title("Modality Availability Across Sequences") + ax.set_xlim(0, 105) + for i, (p, c) in enumerate(zip(pcts, counts)): + ax.text(p + 0.5, i, f"{p:.1f}% ({c}/{len(df)})", va="center", fontsize=9) + plt.tight_layout() + fig.savefig(out_dir / "modality_completeness.png", dpi=DPI) + plt.close(fig) + + +def plot_sequences_per_triplet(df: pd.DataFrame, out_dir: Path): + """Histogram of how many sequences each triplet has.""" + triplet_counts = df["triplet"].value_counts() + fig, ax = plt.subplots(figsize=FIGSIZE) + ax.hist(triplet_counts, bins=range(1, triplet_counts.max() + 2), color=sns.color_palette("deep")[2], + edgecolor="white", alpha=0.8, align="left") + ax.set_xlabel("Sequences per triplet") + ax.set_ylabel("Number of triplets") + ax.set_title(f"Sequences per Triplet ({df['triplet'].nunique()} unique triplets)") + ax.axvline(triplet_counts.median(), color="red", linestyle="--", + label=f"Median: {triplet_counts.median():.0f}") + ax.legend() + plt.tight_layout() + fig.savefig(out_dir / "sequences_per_triplet.png", dpi=DPI) + plt.close(fig) + + +def plot_date_timeline(df: pd.DataFrame, out_dir: Path): + """Sequences collected over time.""" + dates = pd.to_datetime(df["date"], format="%Y%m%d", errors="coerce") + valid = dates.dropna() + if valid.empty: + return + fig, ax = plt.subplots(figsize=FIGSIZE) + daily = valid.groupby(valid.dt.date).size() + daily.plot(kind="bar", ax=ax, color=sns.color_palette("deep")[3], width=0.8) + ax.set_xlabel("Date") + ax.set_ylabel("Sequences recorded") + ax.set_title("Data Collection Timeline") + # Reduce x-tick clutter + n_ticks = len(daily) + if n_ticks > 20: + step = max(1, n_ticks // 15) + ticks = ax.get_xticks() + ax.set_xticks(ticks[::step]) + plt.xticks(rotation=45, ha="right") + plt.tight_layout() + fig.savefig(out_dir / "collection_timeline.png", dpi=DPI) + plt.close(fig) + + +def plot_frames_by_action(df: pd.DataFrame, out_dir: Path): + """Box plot of frame counts per action.""" + valid = df[df["n_frames"] > 0] + if valid.empty: + return + order = valid.groupby("action")["n_frames"].median().sort_values(ascending=False).index + fig, ax = plt.subplots(figsize=FIGSIZE) + sns.boxplot(data=valid, x="action", y="n_frames", order=order, ax=ax, palette="mako") + ax.set_xlabel("Action") + ax.set_ylabel("Frame count") + ax.set_title("Frame Count by Action") + plt.xticks(rotation=45, ha="right") + plt.tight_layout() + fig.savefig(out_dir / "frames_by_action.png", dpi=DPI) + plt.close(fig) + + +def print_summary(df: pd.DataFrame): + """Print text summary to console.""" + print(f"\n{'='*70}") + print("TACO DATASET ANALYSIS SUMMARY") + print(f"{'='*70}") + print(f"Total sequences: {len(df)}") + print(f"Unique triplets: {df['triplet'].nunique()}") + print(f"Unique actions: {df['action'].nunique()}: {sorted(df['action'].unique())}") + print(f"Unique tools: {df['tool'].nunique()}: {sorted(df['tool'].unique())}") + print(f"Unique objects: {df['object'].nunique()}: {sorted(df['object'].unique())}") + print(f"All 12 cameras: {(df['n_allocentric_cameras'] == 12).sum()}/{len(df)}") + complete = df["all_modalities_complete"].sum() + print(f"Fully complete: {complete}/{len(df)} ({100*complete/len(df):.1f}%)") + + valid = df[df["n_frames"] > 0] + if len(valid) > 0: + print(f"\nVideo statistics ({len(valid)} sequences with video info):") + print(f" FPS: {valid['fps'].mode().iloc[0]}") + print(f" Frames: min={valid['n_frames'].min()}, median={valid['n_frames'].median():.0f}, " + f"mean={valid['n_frames'].mean():.0f}, max={valid['n_frames'].max()}") + print(f" Duration: min={valid['duration_s'].min():.1f}s, median={valid['duration_s'].median():.1f}s, " + f"mean={valid['duration_s'].mean():.1f}s, max={valid['duration_s'].max():.1f}s") + print(f" Total: {valid['duration_s'].sum()/3600:.1f} hours") + + # Top triplets + top = df["triplet"].value_counts().head(10) + print(f"\nTop 10 triplets by sequence count:") + for triplet, count in top.items(): + print(f" {triplet}: {count}") + + print(f"{'='*70}") + + +def main(): + parser = argparse.ArgumentParser(description="Analyze TACO dataset and generate plots") + parser.add_argument( + "--csv", type=Path, + default=Path(__file__).resolve().parent.parent / "taco_dataset" / "taco_info.csv", + help="Path to taco_info.csv", + ) + parser.add_argument( + "--output-dir", type=Path, + default=Path(__file__).resolve().parent / "plots", + help="Directory to save plots", + ) + args = parser.parse_args() + + df = pd.read_csv(args.csv) + out_dir = args.output_dir + out_dir.mkdir(parents=True, exist_ok=True) + + print(f"Loaded {len(df)} sequences from {args.csv}") + print(f"Saving plots to {out_dir}/") + + print_summary(df) + + print("\nGenerating plots...") + plot_action_distribution(df, out_dir) + print(" action_distribution.png") + plot_tool_distribution(df, out_dir) + print(" tool_distribution.png") + plot_object_distribution(df, out_dir) + print(" object_distribution.png") + plot_triplet_heatmap(df, out_dir) + print(" action_object_heatmap.png") + plot_frame_count_distribution(df, out_dir) + print(" frame_count_distribution.png") + plot_duration_distribution(df, out_dir) + print(" duration_distribution.png") + plot_duration_by_action(df, out_dir) + print(" duration_by_action.png") + plot_modality_completeness(df, out_dir) + print(" modality_completeness.png") + plot_sequences_per_triplet(df, out_dir) + print(" sequences_per_triplet.png") + plot_date_timeline(df, out_dir) + print(" collection_timeline.png") + plot_frames_by_action(df, out_dir) + print(" frames_by_action.png") + + print(f"\nDone! {11} plots saved to {out_dir}/") + + +if __name__ == "__main__": + main() diff --git a/taco_analysis/plots/action_distribution.png b/taco_analysis/plots/action_distribution.png new file mode 100644 index 0000000000000000000000000000000000000000..5460a6028862c0f5720ddbf22dcf885107737152 --- /dev/null +++ b/taco_analysis/plots/action_distribution.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:97fefdc6a855a740fcc5804f37c20d8817b5b8142dc3d782d0d8b894b258f54d +size 72066 diff --git a/taco_analysis/plots/action_object_heatmap.png b/taco_analysis/plots/action_object_heatmap.png new file mode 100644 index 0000000000000000000000000000000000000000..43d83b8a56578c65ac6b56fa29a108798914d4b1 --- /dev/null +++ b/taco_analysis/plots/action_object_heatmap.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:602d69c4d26ebe309508d2f3020a8bcc3691d68cd23cd57134933110d34e521b +size 140983 diff --git a/taco_analysis/plots/collection_timeline.png b/taco_analysis/plots/collection_timeline.png new file mode 100644 index 0000000000000000000000000000000000000000..1972e62c66d831e03767a02109aa6d43cbf0b772 --- /dev/null +++ b/taco_analysis/plots/collection_timeline.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:418221a4e461c2ee71463596cd05ad52383f399aa7331d0ff449802d1ac006ad +size 60167 diff --git a/taco_analysis/plots/duration_by_action.png b/taco_analysis/plots/duration_by_action.png new file mode 100644 index 0000000000000000000000000000000000000000..67640ba5de5793cd22281a62ff3768ab8cd75622 --- /dev/null +++ b/taco_analysis/plots/duration_by_action.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:675b70ddc10dd00dc6a204b6cd0af98ab8695b944fb53991abeea398ce861e3a +size 107244 diff --git a/taco_analysis/plots/duration_distribution.png b/taco_analysis/plots/duration_distribution.png new file mode 100644 index 0000000000000000000000000000000000000000..5ea0a8b1c9ab378eba79fb5279a4486b2117da69 --- /dev/null +++ b/taco_analysis/plots/duration_distribution.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:941b02c458d831748d0619d3c796c1755d72f22d7aaf894ad56662142d080621 +size 55481 diff --git a/taco_analysis/plots/epipolar/brushbrushcup_20231026_002_f0000_src4.png b/taco_analysis/plots/epipolar/brushbrushcup_20231026_002_f0000_src4.png new file mode 100644 index 0000000000000000000000000000000000000000..9280574c2fed68d43164d076e9627c6f95215bf7 --- /dev/null +++ b/taco_analysis/plots/epipolar/brushbrushcup_20231026_002_f0000_src4.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:27e4b2e6647667aad7a03675f55cea53f36bca2c85a003238dd8501c0cec7ab7 +size 2861117 diff --git a/taco_analysis/plots/epipolar/brushbrushcup_20231026_006_f0000_src4.png b/taco_analysis/plots/epipolar/brushbrushcup_20231026_006_f0000_src4.png new file mode 100644 index 0000000000000000000000000000000000000000..48184e711f67ef9bf5e9ea260b04439796a58f9a --- /dev/null +++ b/taco_analysis/plots/epipolar/brushbrushcup_20231026_006_f0000_src4.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e082d500ac2ef72635c684569d15974927086d2d56ed0348fbf5bd5d6fa4ca6b +size 2910576 diff --git a/taco_analysis/plots/epipolar/brushbrushcup_20231026_006_f0183_src4.png b/taco_analysis/plots/epipolar/brushbrushcup_20231026_006_f0183_src4.png new file mode 100644 index 0000000000000000000000000000000000000000..62f58cb4e0050b3ec2e542cc014faaf717b8af16 --- /dev/null +++ b/taco_analysis/plots/epipolar/brushbrushcup_20231026_006_f0183_src4.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b019d1a78cf37810a83e5a253d7093b0b79918c7265eeb346949c457f6f974c7 +size 3185512 diff --git a/taco_analysis/plots/epipolar/brushbrushhelmet_20231027_007_f0000_src5.png b/taco_analysis/plots/epipolar/brushbrushhelmet_20231027_007_f0000_src5.png new file mode 100644 index 0000000000000000000000000000000000000000..7fb8452950cb3054a87e6e9644c95f68d526ffab --- /dev/null +++ b/taco_analysis/plots/epipolar/brushbrushhelmet_20231027_007_f0000_src5.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2972ecb49d8810aa1ef1eb020baf606d9e7218646683d1a12a046fca03b1c13e +size 2956336 diff --git a/taco_analysis/plots/epipolar/brushbrushkettle_20231006_169_f0000_src1.png b/taco_analysis/plots/epipolar/brushbrushkettle_20231006_169_f0000_src1.png new file mode 100644 index 0000000000000000000000000000000000000000..5f48ec2292162007b4554973aae42900a963cc2a --- /dev/null +++ b/taco_analysis/plots/epipolar/brushbrushkettle_20231006_169_f0000_src1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:54a0869dbc3562e87e9d12d1544133c229a9d94d4833056f6e80650ba99f294c +size 2989448 diff --git a/taco_analysis/plots/epipolar/brushbrushkettle_20231006_169_f0000_src2.png b/taco_analysis/plots/epipolar/brushbrushkettle_20231006_169_f0000_src2.png new file mode 100644 index 0000000000000000000000000000000000000000..c3f95d6f7b170d5f5e956050940e6e930b00af9c --- /dev/null +++ b/taco_analysis/plots/epipolar/brushbrushkettle_20231006_169_f0000_src2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9e8aa717a593ac0b70b66f03bbc94acaab9b683fd383a9b3717e46d59cccacf2 +size 3092834 diff --git a/taco_analysis/plots/epipolar/brushbrushkettle_20231006_169_f0137_src1.png b/taco_analysis/plots/epipolar/brushbrushkettle_20231006_169_f0137_src1.png new file mode 100644 index 0000000000000000000000000000000000000000..505cf41176fe67cedd200af48ee8dcc341a9d506 --- /dev/null +++ b/taco_analysis/plots/epipolar/brushbrushkettle_20231006_169_f0137_src1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8c9cbedf3cc74b7463135cb032d1e6d0b079dc2cc61846bea3034bc578a0a91a +size 3320620 diff --git a/taco_analysis/plots/epipolar/brushbrushkettle_20231103_161_f0000_src3.png b/taco_analysis/plots/epipolar/brushbrushkettle_20231103_161_f0000_src3.png new file mode 100644 index 0000000000000000000000000000000000000000..64e67f03f685cdedc1d17a1371264a9da7f6c26b --- /dev/null +++ b/taco_analysis/plots/epipolar/brushbrushkettle_20231103_161_f0000_src3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1b07d2b86dd2a87ad3f86e5ec53ec6a61fb5e864958f6da442a7d60528735253 +size 2968570 diff --git a/taco_analysis/plots/epipolar/brushbrushkettle_20231103_161_f0134_src3.png b/taco_analysis/plots/epipolar/brushbrushkettle_20231103_161_f0134_src3.png new file mode 100644 index 0000000000000000000000000000000000000000..9f6017abdfda62ca12637c163f8cfcc57c11aa47 --- /dev/null +++ b/taco_analysis/plots/epipolar/brushbrushkettle_20231103_161_f0134_src3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:731281700fe1807daa68cba9517c003c0adfec83c25848698f923a69622644f5 +size 3260430 diff --git a/taco_analysis/plots/epipolar/brushbrushplate_20230928_044_f0000_src6.png b/taco_analysis/plots/epipolar/brushbrushplate_20230928_044_f0000_src6.png new file mode 100644 index 0000000000000000000000000000000000000000..3b4b68cbf406971703105f4e58efca5420c85722 --- /dev/null +++ b/taco_analysis/plots/epipolar/brushbrushplate_20230928_044_f0000_src6.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ee17202062b8ac5eb8c9499185b60c15e0b639eb424e15e6ed2bce195f176316 +size 3013159 diff --git a/taco_analysis/plots/epipolar/brushbrushplate_20230929_039_f0000_src8.png b/taco_analysis/plots/epipolar/brushbrushplate_20230929_039_f0000_src8.png new file mode 100644 index 0000000000000000000000000000000000000000..fbae8784dedba6ebb46feb30aa8d41bac835eeb8 --- /dev/null +++ b/taco_analysis/plots/epipolar/brushbrushplate_20230929_039_f0000_src8.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:635c993feb645c74177f41d42cb1e06c12422cab445b2a2ccd3e39232dc5a071 +size 3140295 diff --git a/taco_analysis/plots/epipolar/brushbrushplate_20231005_184_f0000_src2.png b/taco_analysis/plots/epipolar/brushbrushplate_20231005_184_f0000_src2.png new file mode 100644 index 0000000000000000000000000000000000000000..2d120b489b0d4669c66ea33e9a681a0251002360 --- /dev/null +++ b/taco_analysis/plots/epipolar/brushbrushplate_20231005_184_f0000_src2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:25c34bcce11a52f2b3a2fcf35dbbb434e9393c7890ce50bfb921f913caad0820 +size 3111232 diff --git a/taco_analysis/plots/epipolar/brushbrushplate_20231005_184_f0076_src2.png b/taco_analysis/plots/epipolar/brushbrushplate_20231005_184_f0076_src2.png new file mode 100644 index 0000000000000000000000000000000000000000..bb26a504edd18722e5c8189d0a7129ab110c2a52 --- /dev/null +++ b/taco_analysis/plots/epipolar/brushbrushplate_20231005_184_f0076_src2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ba3c695109ea2e864d13da85b06cb72efd524f930f166ed433051b8092128222 +size 3412136 diff --git a/taco_analysis/plots/epipolar/brushbrushteapot_20231006_227_f0000_src3.png b/taco_analysis/plots/epipolar/brushbrushteapot_20231006_227_f0000_src3.png new file mode 100644 index 0000000000000000000000000000000000000000..a0dfd693919f1b90258dd1de1683087ac7a63e41 --- /dev/null +++ b/taco_analysis/plots/epipolar/brushbrushteapot_20231006_227_f0000_src3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b1b40b411d2f6900c22c3b0b016413cce46690d1b24d10533e863dfc7ff6aa12 +size 3089194 diff --git a/taco_analysis/plots/epipolar/brusheraserbowl_20231103_027_f0000_src0.png b/taco_analysis/plots/epipolar/brusheraserbowl_20231103_027_f0000_src0.png new file mode 100644 index 0000000000000000000000000000000000000000..879eee895b3fbc9dfcf4739ee4712e75d640e8d2 --- /dev/null +++ b/taco_analysis/plots/epipolar/brusheraserbowl_20231103_027_f0000_src0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:24405e6e577233871b5919b688dd42652849cdcbc7f7e641ef53fc09c8873060 +size 3110612 diff --git a/taco_analysis/plots/epipolar/brusheraserbowl_20231103_027_f0099_src0.png b/taco_analysis/plots/epipolar/brusheraserbowl_20231103_027_f0099_src0.png new file mode 100644 index 0000000000000000000000000000000000000000..047299f93a89461526cf97c7d748df7a751d8755 --- /dev/null +++ b/taco_analysis/plots/epipolar/brusheraserbowl_20231103_027_f0099_src0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ec70df95fd1d5077a657eccfa7f9813514a6bfad97698d252f1c117137475d04 +size 3327554 diff --git a/taco_analysis/plots/epipolar/brusheraserbowl_20231103_031_f0000_src7.png b/taco_analysis/plots/epipolar/brusheraserbowl_20231103_031_f0000_src7.png new file mode 100644 index 0000000000000000000000000000000000000000..06a00ecf40200ce8369856d663a933da1d5812d4 --- /dev/null +++ b/taco_analysis/plots/epipolar/brusheraserbowl_20231103_031_f0000_src7.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6cb2638e0596edba282ff4360acb3178b30f3bae02a1df814fa2cb8d798739ad +size 3168583 diff --git a/taco_analysis/plots/epipolar/brusheraserbowl_20231103_045_f0000_src1.png b/taco_analysis/plots/epipolar/brusheraserbowl_20231103_045_f0000_src1.png new file mode 100644 index 0000000000000000000000000000000000000000..49996720cc9ae04704a418793600d7879b795896 --- /dev/null +++ b/taco_analysis/plots/epipolar/brusheraserbowl_20231103_045_f0000_src1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4e1b4261bfeff1ac2ba5d5b35383a59ac0cd294999c1d9fb8ba8c1273bd830ea +size 3148248 diff --git a/taco_analysis/plots/epipolar/brusheraserkettle_20231103_110_f0000_src2.png b/taco_analysis/plots/epipolar/brusheraserkettle_20231103_110_f0000_src2.png new file mode 100644 index 0000000000000000000000000000000000000000..eab78602353bbda93f9937b2524fb4782c6b1c7f --- /dev/null +++ b/taco_analysis/plots/epipolar/brusheraserkettle_20231103_110_f0000_src2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2f879875212ad252707eb174caff08d3f81b958ce232994f1a934602802a45d1 +size 3161093 diff --git a/taco_analysis/plots/epipolar/brusheraserkettle_20231103_110_f0103_src2.png b/taco_analysis/plots/epipolar/brusheraserkettle_20231103_110_f0103_src2.png new file mode 100644 index 0000000000000000000000000000000000000000..0407d9b0ff552729a4bc41e870d92c5a8cfd601d --- /dev/null +++ b/taco_analysis/plots/epipolar/brusheraserkettle_20231103_110_f0103_src2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:520467532b586358aa58251be5eac1eb5518cb001901ddd6c6d6d07f55736a19 +size 3470726 diff --git a/taco_analysis/plots/epipolar/brusheraserpan_20231103_001_f0000_src0.png b/taco_analysis/plots/epipolar/brusheraserpan_20231103_001_f0000_src0.png new file mode 100644 index 0000000000000000000000000000000000000000..cc4df42c8593cead5bb0f43ef00e7b1add3378ab --- /dev/null +++ b/taco_analysis/plots/epipolar/brusheraserpan_20231103_001_f0000_src0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:19f036aad23008c4d439f1e1fe304bce86cc6a0f4800fef9da3be85d93e56d0d +size 3120302 diff --git a/taco_analysis/plots/epipolar/brusheraserplate_20231027_049_f0000_src9.png b/taco_analysis/plots/epipolar/brusheraserplate_20231027_049_f0000_src9.png new file mode 100644 index 0000000000000000000000000000000000000000..f328a30ce619ff556662ce566c8012dd22abea93 --- /dev/null +++ b/taco_analysis/plots/epipolar/brusheraserplate_20231027_049_f0000_src9.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0d123716c206bdc032bd7930f40658673a6c3d8649b8584fba6e40cd3ad7203b +size 3030657 diff --git a/taco_analysis/plots/epipolar/brushrollerplate_20231019_241_f0000_src5.png b/taco_analysis/plots/epipolar/brushrollerplate_20231019_241_f0000_src5.png new file mode 100644 index 0000000000000000000000000000000000000000..ae75f793634493e06420ab78a2dc457c34ff605c --- /dev/null +++ b/taco_analysis/plots/epipolar/brushrollerplate_20231019_241_f0000_src5.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b824bd983eab262c3004bb0ad19fb5c48ef353429aeb58f73dd6cc7742228c2e +size 2977552 diff --git a/taco_analysis/plots/epipolar/cutspatulabowl_20231027_067_f0000_src6.png b/taco_analysis/plots/epipolar/cutspatulabowl_20231027_067_f0000_src6.png new file mode 100644 index 0000000000000000000000000000000000000000..0d2dc1fafdade246990a6fec6f92028afa5326c8 --- /dev/null +++ b/taco_analysis/plots/epipolar/cutspatulabowl_20231027_067_f0000_src6.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fad65fc69637dcd94fe0166c6d9169403fffe5577560af3d208d84897b8e5f20 +size 2979308 diff --git a/taco_analysis/plots/epipolar/dustbrushkettle_20231103_160_f0000_src3.png b/taco_analysis/plots/epipolar/dustbrushkettle_20231103_160_f0000_src3.png new file mode 100644 index 0000000000000000000000000000000000000000..ea3ed88cdc38c8f32b662efdc03093bd2e875098 --- /dev/null +++ b/taco_analysis/plots/epipolar/dustbrushkettle_20231103_160_f0000_src3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75e87d9a2c80b1a90aa89693c95bc321857e88e41432c47504c4566af416268d +size 2980652 diff --git a/taco_analysis/plots/epipolar/measurerulerbowl_20231104_088_f0000_src4.png b/taco_analysis/plots/epipolar/measurerulerbowl_20231104_088_f0000_src4.png new file mode 100644 index 0000000000000000000000000000000000000000..7f2921f623b079c68b705d93f0b9a1d218f79f9b --- /dev/null +++ b/taco_analysis/plots/epipolar/measurerulerbowl_20231104_088_f0000_src4.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8f569010d7181e4b63624be5b9e30c4eed885a071892d8d7ac0f3b28310a739e +size 2841991 diff --git a/taco_analysis/plots/epipolar/measurerulerbowl_20231104_088_f0135_src4.png b/taco_analysis/plots/epipolar/measurerulerbowl_20231104_088_f0135_src4.png new file mode 100644 index 0000000000000000000000000000000000000000..286ac354bb7b81f24edb047f20d81b0264ea6c63 --- /dev/null +++ b/taco_analysis/plots/epipolar/measurerulerbowl_20231104_088_f0135_src4.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8a2b4e5aaf6c9c2fe7e6c2bcfa79e6c43adaa413027d4bf1eb58443d0afca760 +size 3117422 diff --git a/taco_analysis/plots/epipolar/measurerulerplate_20231104_075_f0000_src1.png b/taco_analysis/plots/epipolar/measurerulerplate_20231104_075_f0000_src1.png new file mode 100644 index 0000000000000000000000000000000000000000..290ddfde8b9c94609b07967a34d83a8370a2ec88 --- /dev/null +++ b/taco_analysis/plots/epipolar/measurerulerplate_20231104_075_f0000_src1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c0365540aa6a8af9051143ce059089b3b1d3fd9053dae04eaece5a7d8184463e +size 3071365 diff --git a/taco_analysis/plots/epipolar/putinspatulapan_20231020_038_f0000_src9.png b/taco_analysis/plots/epipolar/putinspatulapan_20231020_038_f0000_src9.png new file mode 100644 index 0000000000000000000000000000000000000000..cbaaf134c9822dbc5ee6e1ef734c3abea1d52fba --- /dev/null +++ b/taco_analysis/plots/epipolar/putinspatulapan_20231020_038_f0000_src9.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4ecffce415a78750938bc0ecd8e2b009a8aebe2ea61c954cc0552b7951ad0c26 +size 2836866 diff --git a/taco_analysis/plots/epipolar/putoutbowlpan_20231015_091_f0000_src0.png b/taco_analysis/plots/epipolar/putoutbowlpan_20231015_091_f0000_src0.png new file mode 100644 index 0000000000000000000000000000000000000000..26d07eb94e41a0fc0a0dd822dc3d15f68c2d8a20 --- /dev/null +++ b/taco_analysis/plots/epipolar/putoutbowlpan_20231015_091_f0000_src0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ee0a4da158b100c1a562e5b548e22a972595c3b28409130512d24310aa4f21d9 +size 2937495 diff --git a/taco_analysis/plots/epipolar/scrapeoffknifeplate_20231015_210_f0000_src0.png b/taco_analysis/plots/epipolar/scrapeoffknifeplate_20231015_210_f0000_src0.png new file mode 100644 index 0000000000000000000000000000000000000000..b4dfbae7dd32ee92404427b2c7123bb17c63a6bb --- /dev/null +++ b/taco_analysis/plots/epipolar/scrapeoffknifeplate_20231015_210_f0000_src0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:08348e31bf9bad0cc2cb350beb6e6a376274f41a85d71bb2018f84af50220388 +size 2827718 diff --git a/taco_analysis/plots/epipolar/scrapeoffknifeplate_20231015_210_f0150_src0.png b/taco_analysis/plots/epipolar/scrapeoffknifeplate_20231015_210_f0150_src0.png new file mode 100644 index 0000000000000000000000000000000000000000..364d8bf1628d5a0fe58e79e7a0823666e7ffd7ea --- /dev/null +++ b/taco_analysis/plots/epipolar/scrapeoffknifeplate_20231015_210_f0150_src0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a53d4d96df08bff44387b0a635b094f017968fa481a68ed3b9a8d4acb639d36a +size 3159139 diff --git a/taco_analysis/plots/epipolar/screwscrewdriverbox_20231102_047_f0000_src2.png b/taco_analysis/plots/epipolar/screwscrewdriverbox_20231102_047_f0000_src2.png new file mode 100644 index 0000000000000000000000000000000000000000..89a76b61063acf6cc4f1aa6f4b25cd2b9b630b19 --- /dev/null +++ b/taco_analysis/plots/epipolar/screwscrewdriverbox_20231102_047_f0000_src2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3095119e2e213c68ca813a157d74cfc6bec1e0bebe98dcad017fb3b6d195d2b8 +size 3238337 diff --git a/taco_analysis/plots/epipolar/skimoffspoonplate_20231024_069_f0000_src1.png b/taco_analysis/plots/epipolar/skimoffspoonplate_20231024_069_f0000_src1.png new file mode 100644 index 0000000000000000000000000000000000000000..08c06e77697a621997911c9c06286e5d3adb2b3a --- /dev/null +++ b/taco_analysis/plots/epipolar/skimoffspoonplate_20231024_069_f0000_src1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75fcef739ee4e53683a503ae2836f2fb90797417ddcae8163daad3602d94d52e +size 2957994 diff --git a/taco_analysis/plots/epipolar/skimoffspoonplate_20231024_069_f0203_src1.png b/taco_analysis/plots/epipolar/skimoffspoonplate_20231024_069_f0203_src1.png new file mode 100644 index 0000000000000000000000000000000000000000..6dd302ac0b979461a599930f0ba5b9b69cd2f226 --- /dev/null +++ b/taco_analysis/plots/epipolar/skimoffspoonplate_20231024_069_f0203_src1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea6310b4b308d57173389732ebdc4dc3abbe90980dff36737527207148ea7053 +size 3243074 diff --git a/taco_analysis/plots/epipolar/smeargluegunbox_20231010_192_f0000_src4.png b/taco_analysis/plots/epipolar/smeargluegunbox_20231010_192_f0000_src4.png new file mode 100644 index 0000000000000000000000000000000000000000..bdad1ba7987752ced7f36b16b9187dc5fe51b458 --- /dev/null +++ b/taco_analysis/plots/epipolar/smeargluegunbox_20231010_192_f0000_src4.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1ffdb287c3cfc66e4ea3d7848fd2c4f700fdaf7c6f00495c606f4cef9fa2d5f1 +size 2814394 diff --git a/taco_analysis/plots/epipolar/stir-fryspatulaplate_20231104_127_f0000_src7.png b/taco_analysis/plots/epipolar/stir-fryspatulaplate_20231104_127_f0000_src7.png new file mode 100644 index 0000000000000000000000000000000000000000..22911fd0d5231a9eacb0873426165612d8d3df56 --- /dev/null +++ b/taco_analysis/plots/epipolar/stir-fryspatulaplate_20231104_127_f0000_src7.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2c2bf3688f39f77450750c6fe0149a559ad61ca0438981266416dc0d01d976b3 +size 2973804 diff --git a/taco_analysis/plots/epipolar/stirspatulabowl_20231024_111_f0000_src8.png b/taco_analysis/plots/epipolar/stirspatulabowl_20231024_111_f0000_src8.png new file mode 100644 index 0000000000000000000000000000000000000000..8de5a98342e3fbfed169ab0bb061ea01a2dd727c --- /dev/null +++ b/taco_analysis/plots/epipolar/stirspatulabowl_20231024_111_f0000_src8.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:76c9926cabddecb35ec7988df688c8a461bd7c022d9dd29da6a789dc2ca0002a +size 2961108 diff --git a/taco_analysis/plots/epipolar/stirspoonpan_20231020_079_f0000_src3.png b/taco_analysis/plots/epipolar/stirspoonpan_20231020_079_f0000_src3.png new file mode 100644 index 0000000000000000000000000000000000000000..09a0f830764c66b5ba8a0ef5509c6790c62d9a7e --- /dev/null +++ b/taco_analysis/plots/epipolar/stirspoonpan_20231020_079_f0000_src3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ffed82e26fe902060f0a512aa88a0239a8ac61c1fb1458cfb48aaa2303bcd6e4 +size 2902155 diff --git a/taco_analysis/plots/epipolar/stirspoonpan_20231020_079_f0168_src3.png b/taco_analysis/plots/epipolar/stirspoonpan_20231020_079_f0168_src3.png new file mode 100644 index 0000000000000000000000000000000000000000..20b3c633e995f0f4b381402e1a611339377a066d --- /dev/null +++ b/taco_analysis/plots/epipolar/stirspoonpan_20231020_079_f0168_src3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:382dba44b08ea922fbfe6a6c9cc694592eb756ed25c2a5b78c801d32f2ed4ee4 +size 3166123 diff --git a/taco_analysis/plots/frame_count_distribution.png b/taco_analysis/plots/frame_count_distribution.png new file mode 100644 index 0000000000000000000000000000000000000000..988b2efbc885c098493371029297e0047629c3cf --- /dev/null +++ b/taco_analysis/plots/frame_count_distribution.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:33d55276b47b4f4dc669ce47a855a1f685ed287dd3f28bdf064a29f7b4889f76 +size 50557 diff --git a/taco_analysis/plots/frames_by_action.png b/taco_analysis/plots/frames_by_action.png new file mode 100644 index 0000000000000000000000000000000000000000..b42c3dbd3004c6027addcbc0fb88296167461735 --- /dev/null +++ b/taco_analysis/plots/frames_by_action.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:740f64772ba20ef279db5960b3d6eaaee2652006c53d306db577ded61aa993ac +size 103786 diff --git a/taco_analysis/plots/mesh_overlay/dustrollerpan_20231019_214_f0000.png b/taco_analysis/plots/mesh_overlay/dustrollerpan_20231019_214_f0000.png new file mode 100644 index 0000000000000000000000000000000000000000..bdefab76d2d93e38df6945395d42b655b4db6e77 --- /dev/null +++ b/taco_analysis/plots/mesh_overlay/dustrollerpan_20231019_214_f0000.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:24fe16226087c83219124d656fa50529949ba5cf6107ad80fbd4f83d3030c7ce +size 2820098 diff --git a/taco_analysis/plots/mesh_overlay/dustrollerpan_20231019_214_f0116.png b/taco_analysis/plots/mesh_overlay/dustrollerpan_20231019_214_f0116.png new file mode 100644 index 0000000000000000000000000000000000000000..75ec123fdd1f8c5bd2752e53dca01b3853d083e4 --- /dev/null +++ b/taco_analysis/plots/mesh_overlay/dustrollerpan_20231019_214_f0116.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8c1d99fe504e598a89dd061bfca2117835961720d9a4f5a207b04b96aa5a9240 +size 3308931 diff --git a/taco_analysis/plots/mesh_overlay/emptybowlkettle_20231019_008_f0000.png b/taco_analysis/plots/mesh_overlay/emptybowlkettle_20231019_008_f0000.png new file mode 100644 index 0000000000000000000000000000000000000000..c8d0b7bc87334c19e3865016b6f7ec6cc7f500c6 --- /dev/null +++ b/taco_analysis/plots/mesh_overlay/emptybowlkettle_20231019_008_f0000.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:92c695a4090988201a464145f3877e46d2da8953586ed4733c5064ebedaaf382 +size 2718398 diff --git a/taco_analysis/plots/mesh_overlay/emptybowlkettle_20231019_008_f0149.png b/taco_analysis/plots/mesh_overlay/emptybowlkettle_20231019_008_f0149.png new file mode 100644 index 0000000000000000000000000000000000000000..430d0c2b644857553e956b3065f0643fa8ceb0f7 --- /dev/null +++ b/taco_analysis/plots/mesh_overlay/emptybowlkettle_20231019_008_f0149.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8bc32f841b911a27d9f769db953b7b901962c8637c6f95e75ba3ca5bf8e6ae51 +size 3122285 diff --git a/taco_analysis/plots/mesh_overlay/emptyboxplate_20231027_157_f0000.png b/taco_analysis/plots/mesh_overlay/emptyboxplate_20231027_157_f0000.png new file mode 100644 index 0000000000000000000000000000000000000000..86877d8e25d71ad43e6075fe5c87ab0f79b03405 --- /dev/null +++ b/taco_analysis/plots/mesh_overlay/emptyboxplate_20231027_157_f0000.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a60566f1182eee6dda5b95060a4fff8d2a56c7dcc73a0f263838494324674748 +size 2806461 diff --git a/taco_analysis/plots/mesh_overlay/emptyboxplate_20231027_157_f0154.png b/taco_analysis/plots/mesh_overlay/emptyboxplate_20231027_157_f0154.png new file mode 100644 index 0000000000000000000000000000000000000000..8d4cb2c95e151c4d1869f8041b45964dbd350718 --- /dev/null +++ b/taco_analysis/plots/mesh_overlay/emptyboxplate_20231027_157_f0154.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b7bdcd4274dffc7e27f0d3d51ed73bdadf75db96908b1a9b20379f6d7c6a336 +size 3223981 diff --git a/taco_analysis/plots/mesh_overlay/measurerulercup_20231104_108_f0000.png b/taco_analysis/plots/mesh_overlay/measurerulercup_20231104_108_f0000.png new file mode 100644 index 0000000000000000000000000000000000000000..c328bd4d8f7772af7b37fdb46de03286792ff4f6 --- /dev/null +++ b/taco_analysis/plots/mesh_overlay/measurerulercup_20231104_108_f0000.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a736b14c75ada08b6373baae66d6823afd330666dad3fc164434ac2c6633345f +size 2557904 diff --git a/taco_analysis/plots/mesh_overlay/measurerulercup_20231104_108_f0119.png b/taco_analysis/plots/mesh_overlay/measurerulercup_20231104_108_f0119.png new file mode 100644 index 0000000000000000000000000000000000000000..e3e3114b73ea930220f000ce78309ae34642d19d --- /dev/null +++ b/taco_analysis/plots/mesh_overlay/measurerulercup_20231104_108_f0119.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ead4a696fbe03a806558cbfced9e9265d05c30ddeb4f63b8cf9259ae709dab40 +size 3022535 diff --git a/taco_analysis/plots/mesh_overlay/pourinsomekettleplate_20231031_075_f0000.png b/taco_analysis/plots/mesh_overlay/pourinsomekettleplate_20231031_075_f0000.png new file mode 100644 index 0000000000000000000000000000000000000000..12372637b72ff2fe3a04305f93716a210ddbac78 --- /dev/null +++ b/taco_analysis/plots/mesh_overlay/pourinsomekettleplate_20231031_075_f0000.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:441d49d73d55b95ea65c24e743c51044929744af65de99fe63cd4ccc6f5d08b2 +size 2944981 diff --git a/taco_analysis/plots/mesh_overlay/pourinsomekettleplate_20231031_075_f0152.png b/taco_analysis/plots/mesh_overlay/pourinsomekettleplate_20231031_075_f0152.png new file mode 100644 index 0000000000000000000000000000000000000000..b2dd7cdb961badfdaa0874551cf2e62251bffd91 --- /dev/null +++ b/taco_analysis/plots/mesh_overlay/pourinsomekettleplate_20231031_075_f0152.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:44b3ad9ef4bafdd31036341ff757418b2f6ac1563baee1d32f7a062d81da9f24 +size 3451481 diff --git a/taco_analysis/plots/mesh_overlay/putoutbowlbowl_20231013_136_f0000.png b/taco_analysis/plots/mesh_overlay/putoutbowlbowl_20231013_136_f0000.png new file mode 100644 index 0000000000000000000000000000000000000000..a08ac8b3967fbac9a6b4cf9ae21e6aa28fb7d937 --- /dev/null +++ b/taco_analysis/plots/mesh_overlay/putoutbowlbowl_20231013_136_f0000.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f065e280b821660328900300d58826f1e1b335c916f0360b4adc8220aadf24b5 +size 2662514 diff --git a/taco_analysis/plots/mesh_overlay/putoutbowlbowl_20231013_136_f0116.png b/taco_analysis/plots/mesh_overlay/putoutbowlbowl_20231013_136_f0116.png new file mode 100644 index 0000000000000000000000000000000000000000..8905993762f9e0f2c63f7afbcf9c3ddb5fd29c46 --- /dev/null +++ b/taco_analysis/plots/mesh_overlay/putoutbowlbowl_20231013_136_f0116.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dfa424b541827f99a09fe8179e19c17590dec85c2b0d65069b8bb55fa2fcbed1 +size 3181190 diff --git a/taco_analysis/plots/mesh_overlay/scrapeoffknifeplate_20231020_200_f0000.png b/taco_analysis/plots/mesh_overlay/scrapeoffknifeplate_20231020_200_f0000.png new file mode 100644 index 0000000000000000000000000000000000000000..47749fb3d2606e969be5ff42e7083a900221a135 --- /dev/null +++ b/taco_analysis/plots/mesh_overlay/scrapeoffknifeplate_20231020_200_f0000.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e90a4e88490ac95623e0aeff98dbeda7ad0e1a58a43a558041c7641abed88058 +size 2629023 diff --git a/taco_analysis/plots/mesh_overlay/scrapeoffknifeplate_20231020_200_f0174.png b/taco_analysis/plots/mesh_overlay/scrapeoffknifeplate_20231020_200_f0174.png new file mode 100644 index 0000000000000000000000000000000000000000..18fd7116a3f1483f651075dc4e8bc21c73c87482 --- /dev/null +++ b/taco_analysis/plots/mesh_overlay/scrapeoffknifeplate_20231020_200_f0174.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:30b653254547d548d25fc9573ab6c8a622ad0f44d871ac01e0bb6e8dbb71b639 +size 3037697 diff --git a/taco_analysis/plots/mesh_overlay/skimoffbowlpan_20230926_017_f0000.png b/taco_analysis/plots/mesh_overlay/skimoffbowlpan_20230926_017_f0000.png new file mode 100644 index 0000000000000000000000000000000000000000..f8fe3bac458fc8d1cc3ceae0ace8d8f3aeaf8489 --- /dev/null +++ b/taco_analysis/plots/mesh_overlay/skimoffbowlpan_20230926_017_f0000.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3dd087371b71dc378c3581ae44cba6ceb912ad1b734918f5bf91061e280483bf +size 2913752 diff --git a/taco_analysis/plots/mesh_overlay/skimoffbowlpan_20230926_017_f0249.png b/taco_analysis/plots/mesh_overlay/skimoffbowlpan_20230926_017_f0249.png new file mode 100644 index 0000000000000000000000000000000000000000..8bfd7b914dd4e3abbae9c8ea1f527d9163635074 --- /dev/null +++ b/taco_analysis/plots/mesh_overlay/skimoffbowlpan_20230926_017_f0249.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5ea6d3febeb2ced48bf65e3e3a0c4155afcc6c714b592c20b310017ce5c2bdb9 +size 3360525 diff --git a/taco_analysis/plots/mesh_overlay/stir-fryspoonpan_20231020_050_f0000.png b/taco_analysis/plots/mesh_overlay/stir-fryspoonpan_20231020_050_f0000.png new file mode 100644 index 0000000000000000000000000000000000000000..eb3760ad5ceca47031ef8c9eefffdb782a15e9c6 --- /dev/null +++ b/taco_analysis/plots/mesh_overlay/stir-fryspoonpan_20231020_050_f0000.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8c49a127938429890302baebd10d6c3dc3f308474eb1a1f6429cd525cb4cdb99 +size 2681707 diff --git a/taco_analysis/plots/mesh_overlay/stir-fryspoonpan_20231020_050_f0155.png b/taco_analysis/plots/mesh_overlay/stir-fryspoonpan_20231020_050_f0155.png new file mode 100644 index 0000000000000000000000000000000000000000..cb964569a9ac65132e5f18a207cd9c97335ab715 --- /dev/null +++ b/taco_analysis/plots/mesh_overlay/stir-fryspoonpan_20231020_050_f0155.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:496a422cb8f4788cd11cdd3d27b9c0ecf992b4a18d02989151fc4a0bd5808c38 +size 3166959 diff --git a/taco_analysis/plots/mesh_overlay/stirspatulapan_20231020_037_f0000.png b/taco_analysis/plots/mesh_overlay/stirspatulapan_20231020_037_f0000.png new file mode 100644 index 0000000000000000000000000000000000000000..28330d22b52f11221c3c0521c361b9d8e4ba5139 --- /dev/null +++ b/taco_analysis/plots/mesh_overlay/stirspatulapan_20231020_037_f0000.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2dc87d32b05516a0bc055ff5ea5241584d5ea6cee30af96b168aaf24beff86d6 +size 2495810 diff --git a/taco_analysis/plots/mesh_overlay/stirspatulapan_20231020_037_f0130.png b/taco_analysis/plots/mesh_overlay/stirspatulapan_20231020_037_f0130.png new file mode 100644 index 0000000000000000000000000000000000000000..9ba3f469daf407926ccbfe9cd198c8f0daa761be --- /dev/null +++ b/taco_analysis/plots/mesh_overlay/stirspatulapan_20231020_037_f0130.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3014490b490e11a38a32ba0a1159ac3c743d9ccb1e5fe2598d076125f04a1bcc +size 2946169 diff --git a/taco_analysis/plots/modality_completeness.png b/taco_analysis/plots/modality_completeness.png new file mode 100644 index 0000000000000000000000000000000000000000..c76aa274778843c3cfbf4fcd6b802cf0bf8232b3 --- /dev/null +++ b/taco_analysis/plots/modality_completeness.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1fcb85806661aaa8c1bd62118756f8bb2febd8ca1e8feefcc9146f987d6ea043 +size 90765 diff --git a/taco_analysis/plots/object_distribution.png b/taco_analysis/plots/object_distribution.png new file mode 100644 index 0000000000000000000000000000000000000000..5907b9c71b413322ed1abca3ff10d648b0b4534c --- /dev/null +++ b/taco_analysis/plots/object_distribution.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e35a91e8d5255557fba7ffb9df20b48be1d498a3f79d434184c62a3251a115d3 +size 50742 diff --git a/taco_analysis/plots/scene_2d/brusheraserkettle_20231103_110.png b/taco_analysis/plots/scene_2d/brusheraserkettle_20231103_110.png new file mode 100644 index 0000000000000000000000000000000000000000..42a73034c239c21811ae073c4bc8ac9652f2ab69 --- /dev/null +++ b/taco_analysis/plots/scene_2d/brusheraserkettle_20231103_110.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce563826344d550a40779a8a8701117f2c408acefbee7511b7da82f2c1f7ab97 +size 131994 diff --git a/taco_analysis/plots/scene_2d/measurerulerbowl_20231104_088.png b/taco_analysis/plots/scene_2d/measurerulerbowl_20231104_088.png new file mode 100644 index 0000000000000000000000000000000000000000..d243273dcb4e3d624a69c9b770a8348bfaa135b2 --- /dev/null +++ b/taco_analysis/plots/scene_2d/measurerulerbowl_20231104_088.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cc51a2da59fdb0e13cd42c3d39517aa198a0ba79c1790cd50e49e5ccb6b5e50d +size 131720 diff --git a/taco_analysis/plots/scene_2d/scrapeoffknifeplate_20231015_210.png b/taco_analysis/plots/scene_2d/scrapeoffknifeplate_20231015_210.png new file mode 100644 index 0000000000000000000000000000000000000000..216a576efe1e16b2ed49bc80c2f5802e6236f12f --- /dev/null +++ b/taco_analysis/plots/scene_2d/scrapeoffknifeplate_20231015_210.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4c1dfba0bf34df2cbf0b8cf1e9050df53acc0f463f491091ded1416da41baf68 +size 132809 diff --git a/taco_analysis/plots/scene_2d/skimoffspoonplate_20231024_069.png b/taco_analysis/plots/scene_2d/skimoffspoonplate_20231024_069.png new file mode 100644 index 0000000000000000000000000000000000000000..9aef13487d6ba2639cba8f55ed0d9cf379a7e004 --- /dev/null +++ b/taco_analysis/plots/scene_2d/skimoffspoonplate_20231024_069.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75da0773df72907f9fe6381f8e0488353d309ca5014854143e4516821b65813e +size 134134 diff --git a/taco_analysis/plots/scene_2d/stirspoonpan_20231020_079.png b/taco_analysis/plots/scene_2d/stirspoonpan_20231020_079.png new file mode 100644 index 0000000000000000000000000000000000000000..c35a88ba93da7dd93f75126fc3c34d526ae85e74 --- /dev/null +++ b/taco_analysis/plots/scene_2d/stirspoonpan_20231020_079.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6a9b151cecb3ea67e8dbb370a24cf15971e61c4fda3d995eb3c3fb7831428717 +size 130528 diff --git a/taco_analysis/plots/scene_3d/brusheraserkettle_20231103_110_view1.png b/taco_analysis/plots/scene_3d/brusheraserkettle_20231103_110_view1.png new file mode 100644 index 0000000000000000000000000000000000000000..ea24c34d80feb3cc2ed9a37acf56b43715f9fc5c --- /dev/null +++ b/taco_analysis/plots/scene_3d/brusheraserkettle_20231103_110_view1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9f902995bf95ba768069487d565dc788483b569ad0f60715fb6eefb072f6edf3 +size 300031 diff --git a/taco_analysis/plots/scene_3d/brusheraserkettle_20231103_110_view2.png b/taco_analysis/plots/scene_3d/brusheraserkettle_20231103_110_view2.png new file mode 100644 index 0000000000000000000000000000000000000000..2c100b5d674183647d59014775463d1708c25298 --- /dev/null +++ b/taco_analysis/plots/scene_3d/brusheraserkettle_20231103_110_view2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ff5552048b71cd113bf983ec1abde0fe65465231aa00c4a7037f49b9751663ce +size 368115 diff --git a/taco_analysis/plots/scene_3d/measurerulerbowl_20231104_088_view1.png b/taco_analysis/plots/scene_3d/measurerulerbowl_20231104_088_view1.png new file mode 100644 index 0000000000000000000000000000000000000000..a09f8924c90b549984807f3b7c60f52fb544508d --- /dev/null +++ b/taco_analysis/plots/scene_3d/measurerulerbowl_20231104_088_view1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7869b04272cdae693ea15f8eb1084968a4457519185c1bcbca9b771f94fb8d93 +size 298035 diff --git a/taco_analysis/plots/scene_3d/measurerulerbowl_20231104_088_view2.png b/taco_analysis/plots/scene_3d/measurerulerbowl_20231104_088_view2.png new file mode 100644 index 0000000000000000000000000000000000000000..1da23280984ed543fc92fa4af9a8dddb8f49e8f8 --- /dev/null +++ b/taco_analysis/plots/scene_3d/measurerulerbowl_20231104_088_view2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3093c630f9e07809540f5ed177206398719b015becf2c9fde6beb54f8b0c30fd +size 366919 diff --git a/taco_analysis/plots/scene_3d/scrapeoffknifeplate_20231015_210_view1.png b/taco_analysis/plots/scene_3d/scrapeoffknifeplate_20231015_210_view1.png new file mode 100644 index 0000000000000000000000000000000000000000..973314058585b7d7509826d4f1ae13ed826a479d --- /dev/null +++ b/taco_analysis/plots/scene_3d/scrapeoffknifeplate_20231015_210_view1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c13a5c62e97b4c96323a1edd94abce255a15d32dfbd547bf1bab7fa81919fb28 +size 300104 diff --git a/taco_analysis/plots/scene_3d/scrapeoffknifeplate_20231015_210_view2.png b/taco_analysis/plots/scene_3d/scrapeoffknifeplate_20231015_210_view2.png new file mode 100644 index 0000000000000000000000000000000000000000..d579b8c24f80da97d2ffcae2f7cca9aff2bcdc23 --- /dev/null +++ b/taco_analysis/plots/scene_3d/scrapeoffknifeplate_20231015_210_view2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3cd39b05474e59f74507e6951582b6716bc9938ede1d7f6f58918764008e749b +size 370293 diff --git a/taco_analysis/plots/scene_3d/skimoffspoonplate_20231024_069_view1.png b/taco_analysis/plots/scene_3d/skimoffspoonplate_20231024_069_view1.png new file mode 100644 index 0000000000000000000000000000000000000000..cc3e19d2e683445f656e3965a13fb6f3602ef3c1 --- /dev/null +++ b/taco_analysis/plots/scene_3d/skimoffspoonplate_20231024_069_view1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5eb1212a3f6264465698c96264c949086ba41edf33305df67511b87fa3d08026 +size 299066 diff --git a/taco_analysis/plots/scene_3d/skimoffspoonplate_20231024_069_view2.png b/taco_analysis/plots/scene_3d/skimoffspoonplate_20231024_069_view2.png new file mode 100644 index 0000000000000000000000000000000000000000..2554b6982b7cee0240d57fa72f0ac7798041b3bc --- /dev/null +++ b/taco_analysis/plots/scene_3d/skimoffspoonplate_20231024_069_view2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b2bfd9625665f7589bdf423443e6fdcaea053dbf9d77315c305564f055cbc0ca +size 369963 diff --git a/taco_analysis/plots/scene_3d/stirspoonpan_20231020_079_view1.png b/taco_analysis/plots/scene_3d/stirspoonpan_20231020_079_view1.png new file mode 100644 index 0000000000000000000000000000000000000000..6f62242a0890e02b68583d78f14e976cf7aa7aca --- /dev/null +++ b/taco_analysis/plots/scene_3d/stirspoonpan_20231020_079_view1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:101df0659007c9e82f1cecd54ec72be0868c232e6453f5e6042a06eaec31758a +size 298947 diff --git a/taco_analysis/plots/scene_3d/stirspoonpan_20231020_079_view2.png b/taco_analysis/plots/scene_3d/stirspoonpan_20231020_079_view2.png new file mode 100644 index 0000000000000000000000000000000000000000..f0aaf810c2918300539f9fadd7164ccc519dca11 --- /dev/null +++ b/taco_analysis/plots/scene_3d/stirspoonpan_20231020_079_view2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:543c785a3402f207048bc64f8d7e949da9ec39cb1267bb5fef01b5dca68a58e4 +size 369629 diff --git a/taco_analysis/plots/sequences_per_triplet.png b/taco_analysis/plots/sequences_per_triplet.png new file mode 100644 index 0000000000000000000000000000000000000000..6b0abc6ff22f91c363526521f36854cedd3c5696 --- /dev/null +++ b/taco_analysis/plots/sequences_per_triplet.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1e22c43df4b2dec080a242db437481553afeca18a90647586f4b4da39a3b4a2f +size 49320 diff --git a/taco_analysis/plots/tool_distribution.png b/taco_analysis/plots/tool_distribution.png new file mode 100644 index 0000000000000000000000000000000000000000..a7a133768f457be99f55df99718fdb45919f4535 --- /dev/null +++ b/taco_analysis/plots/tool_distribution.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ffdadc11c17c19df087049b65c6f05a7e51d008690aedefef7c4a697467f62b0 +size 73865 diff --git a/taco_analysis/render_mesh_overlay.py b/taco_analysis/render_mesh_overlay.py new file mode 100644 index 0000000000000000000000000000000000000000..19e0b8f033b9da65e46400c079f489545a2ca2af --- /dev/null +++ b/taco_analysis/render_mesh_overlay.py @@ -0,0 +1,549 @@ +#!/usr/bin/env python +"""Render object meshes + hand skeletons onto all 12 allocentric views. + +For each selected sequence + frame, projects: + - Tool mesh (blue) and target mesh (coral) with filled triangles + wireframe + - Left hand skeleton (green) and right hand skeleton (yellow) + +Camera convention: p_cam = R @ p_world + T (world-to-camera) + +Hand poses: hand_pose (48,) = [0:3] global wrist rotation (axis-angle) + + [3:48] 15 finger joint rotations (axis-angle, NOT PCA). + hand_trans (3,) = wrist position in world (meters). + hand_shape (10,) = MANO beta parameters (optional). + Joints are computed via MANO forward kinematics (LBS). + +Usage: + python render_mesh_overlay.py --n-sequences 5 --seed 77 +""" + +import argparse +import inspect +import json +import pickle +from pathlib import Path + +# Monkey-patch for chumpy compat with Python 3.12+ / numpy 2.x +if not hasattr(inspect, "getargspec"): + inspect.getargspec = inspect.getfullargspec +import numpy as np +for _alias in ("bool", "int", "float", "complex", "object", "str"): + if not hasattr(np, _alias): + setattr(np, _alias, getattr(__builtins__, _alias, object)) +if not hasattr(np, "unicode"): + np.unicode = str + +import cv2 +import imageio +import pandas as pd +import scipy.sparse +import trimesh +from PIL import Image, ImageDraw + + +MESH_COLORS = { + "tool": (50, 120, 255), # blue (slightly darker/more saturated) + "target": (255, 90, 60), # coral (slightly darker) +} + +HAND_COLORS = { + "left": (50, 220, 100), # green + "right": (255, 220, 50), # yellow +} + +# Bone connections for drawing (21-joint order after MANO reorder): +# 0=wrist, 1-4=index, 5-8=middle, 9-12=ring, 13-16=pinky, 17-20=thumb +HAND_BONES = [ + (0, 1), (1, 2), (2, 3), (3, 4), # Index + (0, 5), (5, 6), (6, 7), (7, 8), # Middle + (0, 9), (9, 10), (10, 11), (11, 12), # Ring + (0, 13), (13, 14), (14, 15), (15, 16), # Pinky + (0, 17), (17, 18), (18, 19), (19, 20), # Thumb + (1, 5), (5, 9), (9, 13), # Palm cross-links +] + +# MANO joint reorder: maps 16 kinematic joints + 5 fingertip vertices -> 21 +# Output order: wrist, index(MCP,PIP,DIP,tip), middle(...), ring(...), pinky(...), thumb(...) +_JOINT_REORDER = [0, 13, 14, 15, 16, 1, 2, 3, 17, 4, 5, 6, 18, 10, 11, 12, 19, 7, 8, 9, 20] + +# Fingertip vertex indices in MANO mesh (thumb, index, middle, ring, pinky) +_TIPS_RIGHT = [745, 317, 444, 556, 673] +_TIPS_LEFT = [745, 317, 445, 556, 673] + + +# ── MANO numpy forward pass ───────────────────────────────────────── + +def _load_mano_pkl(path): + """Load a MANO .pkl, converting chumpy arrays to numpy.""" + with open(path, "rb") as f: + raw = pickle.load(f, encoding="latin1") + out = {} + for k, v in raw.items(): + if hasattr(v, "r"): + out[k] = np.array(v.r, dtype=np.float64) + elif scipy.sparse.issparse(v): + out[k] = v + elif isinstance(v, np.ndarray): + out[k] = v.astype(np.float64) if v.dtype.kind == "f" else v + else: + out[k] = v + return out + + +def _rodrigues(rotvec): + """Axis-angle (3,) -> rotation matrix (3,3).""" + angle = np.linalg.norm(rotvec) + if angle < 1e-8: + return np.eye(3, dtype=np.float64) + k = rotvec / angle + K = np.array([[0, -k[2], k[1]], + [k[2], 0, -k[0]], + [-k[1], k[0], 0]], dtype=np.float64) + return np.eye(3) + np.sin(angle) * K + (1 - np.cos(angle)) * (K @ K) + + +def _batch_rodrigues(axisang): + """(N, 3) axis-angle -> (N, 3, 3) rotation matrices.""" + return np.array([_rodrigues(a) for a in axisang]) + + +class ManoModel: + """Numpy-only MANO forward kinematics (no PyTorch/GPU needed). + + Mirrors manopth ManoLayer with use_pca=False, flat_hand_mean=True, center_idx=0. + """ + + def __init__(self, mano_pkl_path, side="right"): + d = _load_mano_pkl(mano_pkl_path) + self.v_template = d["v_template"] # (778, 3) + self.shapedirs = d["shapedirs"] # (778, 3, 10) + self.posedirs = d["posedirs"] # (778, 3, 135) + self.weights = d["weights"] # (778, 16) + self.faces = d["f"] # (F, 3) + self.side = side + + jr = d["J_regressor"] + self.J_regressor = jr.toarray() if scipy.sparse.issparse(jr) else np.array(jr) + + kt = d["kintree_table"] + self.parents = [int(kt[0, i]) for i in range(kt.shape[1])] + self.parents[0] = -1 # root has no parent + + self.tip_indices = _TIPS_RIGHT if side == "right" else _TIPS_LEFT + + def forward(self, hand_pose, hand_trans, betas=None): + """Compute 21 joint positions in world coordinates (meters). + + Args: + hand_pose: (48,) = [0:3] global rot + [3:48] 15 joint axis-angles + hand_trans: (3,) wrist translation in meters + betas: (10,) shape params or None (uses mean shape) + + Returns: + joints: (21, 3) in meters, world frame + """ + # 1. Shape blend shapes + if betas is not None and self.shapedirs.ndim == 3: + v_shaped = self.v_template + np.einsum("vci,i->vc", self.shapedirs, betas) + else: + v_shaped = self.v_template.copy() + + # 2. Joint locations from shaped mesh + J = self.J_regressor @ v_shaped # (16, 3) + + # 3. Full pose: 16 rotations (1 global + 15 finger) + full_pose = hand_pose[:48].copy() # use_pca=False, flat_hand_mean -> identity + rot_mats = _batch_rodrigues(full_pose.reshape(16, 3)) # (16, 3, 3) + + # 4. Pose blend shapes (based on rotations 1..15, excluding global) + pose_feature = (rot_mats[1:] - np.eye(3)).ravel() # (135,) + v_posed = v_shaped + np.einsum("vci,i->vc", self.posedirs, pose_feature) + + # 5. Forward kinematics + # Build 4x4 transforms for each joint + G = np.zeros((16, 4, 4), dtype=np.float64) + + # Root + G[0, :3, :3] = rot_mats[0] + G[0, :3, 3] = J[0] + G[0, 3, 3] = 1.0 + + for i in range(1, 16): + p = self.parents[i] + local = np.eye(4, dtype=np.float64) + local[:3, :3] = rot_mats[i] + local[:3, 3] = J[i] - J[p] + G[i] = G[p] @ local + + # 6. Joint positions from global transforms (BEFORE rest-pose correction) + jtr = G[:, :3, 3].copy() # (16, 3) + + # Remove rest-pose joint offsets (only needed for LBS skinning) + G_skin = G.copy() + for i in range(16): + Jh = np.append(J[i], 0.0) # (4,) + G_skin[i, :, 3] -= G_skin[i] @ Jh + + # 7. LBS skinning (for fingertip vertex positions only) + T = np.einsum("jab,vj->vab", G_skin, self.weights) # (778, 4, 4) + v_homo = np.concatenate([v_posed, np.ones((778, 1))], axis=1) # (778, 4) + v_final = np.einsum("vab,vb->va", T, v_homo)[:, :3] # (778, 3) + + # 8. Fingertip positions from skinned vertices + tips = v_final[self.tip_indices] # (5, 3) + jtr = np.concatenate([jtr, tips], axis=0) # (21, 3) + + # 9. Center on wrist (center_idx=0), then add translation + # MANO template is in meters; manolayer *1000 and loader /1000 cancel out. + center = jtr[0:1].copy() + jtr -= center + + # 10. Translate to world + jtr += hand_trans + + # 12. Reorder to visualization order + return jtr[_JOINT_REORDER] + + +# Module-level cache for MANO models +_mano_models = {} + + +def _get_mano_model(mano_root, side): + """Get or load a cached ManoModel.""" + key = (str(mano_root), side) + if key not in _mano_models: + fname = "MANO_LEFT.pkl" if side == "left" else "MANO_RIGHT.pkl" + _mano_models[key] = ManoModel(mano_root / fname, side=side) + return _mano_models[key] + + +# ── Core rendering ──────────────────────────────────────────────────── + +def load_calibration(path): + with open(path) as f: + return json.load(f) + + +def read_frame(video_path, frame_idx): + reader = imageio.get_reader(str(video_path)) + frame = reader.get_data(frame_idx) + reader.close() + return frame + + +def project_points(pts_world, K, R, T): + """Project Nx3 world points to Nx2 pixel coords + Nx depths.""" + p_cam = (R @ pts_world.T).T + T + depth = p_cam[:, 2].copy() + safe_z = np.where(np.abs(depth) > 1e-6, depth, 1e-6) + u = K[0, 0] * p_cam[:, 0] / safe_z + K[0, 2] + v = K[1, 1] * p_cam[:, 1] / safe_z + K[1, 2] + return np.stack([u, v], axis=1), depth + + +def render_mesh_on_image(img, verts_world, faces, K, R, T, + color=(70, 140, 255), fill_alpha=1.0, + edge_color=None, max_faces=5000): + """Render a mesh overlay: filled triangles + wireframe edges.""" + H, W = img.shape[:2] + uv, depth = project_points(verts_world, K, R, T) + + face_depths = depth[faces] + valid_mask = np.all(face_depths > 0.01, axis=1) + valid_faces = faces[valid_mask] + if len(valid_faces) == 0: + return img + + if len(valid_faces) > max_faces: + idx = np.random.choice(len(valid_faces), max_faces, replace=False) + valid_faces = valid_faces[idx] + + order = np.argsort(-depth[valid_faces].mean(axis=1)) + valid_faces = valid_faces[order] + uv_int = uv.astype(np.int32) + + overlay = img.copy() + for face in valid_faces: + pts = uv_int[face] + if (pts[:, 0].max() < -50 or pts[:, 0].min() > W + 50 or + pts[:, 1].max() < -50 or pts[:, 1].min() > H + 50): + continue + cv2.fillPoly(overlay, [pts.reshape(-1, 1, 2)], color) + result = cv2.addWeighted(overlay, fill_alpha, img, 1.0 - fill_alpha, 0) + + ec = edge_color or tuple(min(255, c + 30) for c in color) + for face in valid_faces[::2]: + pts = uv_int[face] + for j in range(3): + cv2.line(result, tuple(pts[j]), tuple(pts[(j + 1) % 3]), ec, 1, cv2.LINE_AA) + + return result + + +def draw_hand_skeleton(img, joints_world, K, R, T, color, scale_x, scale_y): + """Draw a hand skeleton (21 joints + bones) projected onto the image.""" + uv, depth = project_points(joints_world, K, R, T) + H, W = img.shape[:2] + + uv_s = uv.copy() + uv_s[:, 0] *= scale_x + uv_s[:, 1] *= scale_y + uv_int = uv_s.astype(np.int32) + + joint_color = tuple(min(255, c + 60) for c in color) + outline_color = tuple(max(0, c - 80) for c in color) + + bone_w = max(2, int(min(W, H) / 200)) + joint_r = max(3, int(min(W, H) / 150)) + + # Draw bones + for j1, j2 in HAND_BONES: + if depth[j1] < 0.01 or depth[j2] < 0.01: + continue + p1, p2 = tuple(uv_int[j1]), tuple(uv_int[j2]) + if (p1[0] < -50 and p2[0] < -50) or (p1[0] > W + 50 and p2[0] > W + 50): + continue + if (p1[1] < -50 and p2[1] < -50) or (p1[1] > H + 50 and p2[1] > H + 50): + continue + cv2.line(img, p1, p2, outline_color, bone_w + 2, cv2.LINE_AA) + cv2.line(img, p1, p2, joint_color, bone_w, cv2.LINE_AA) + + # Draw joints + for i in range(len(joints_world)): + if depth[i] < 0.01: + continue + u_s, v_s = uv_int[i] + if not (-30 <= u_s < W + 30 and -30 <= v_s < H + 30): + continue + # Tips slightly smaller, MCP/wrist larger + r = joint_r + 1 if i in (0, 1, 5, 9, 13, 17) else joint_r + cv2.circle(img, (u_s, v_s), r, outline_color, -1, cv2.LINE_AA) + cv2.circle(img, (u_s, v_s), max(1, r - 1), joint_color, -1, cv2.LINE_AA) + if i == 0: # Wrist emphasis + cv2.circle(img, (u_s, v_s), r + 2, (255, 255, 255), 1, cv2.LINE_AA) + + return img + + +# ── Hand data loading ───────────────────────────────────────────────── + +def load_hand_skeletons(root, row, frame_idx, mano_root=None): + """Load hand skeleton joint positions via MANO forward kinematics. + + Returns dict: {'left': (21, 3), 'right': (21, 3)} or empty if missing. + """ + hand_dir = row.get("hand_poses_dir", "") + if not hand_dir or pd.isna(hand_dir): + return {} + + if mano_root is None: + mano_root = root.parent / "mano_v1_2" / "models" + + result = {} + hand_path = root / hand_dir + frame_key = f"{frame_idx + 1:05d}" + + for side in ["left", "right"]: + pose_file = hand_path / f"{side}_hand.pkl" + if not pose_file.exists(): + continue + with open(pose_file, "rb") as f: + data = pickle.load(f) + if frame_key not in data: + continue + frame_data = data[frame_key] + if not isinstance(frame_data, dict): + continue + if "hand_pose" not in frame_data or "hand_trans" not in frame_data: + continue + + hand_pose = np.array(frame_data["hand_pose"], dtype=np.float64).ravel() + hand_trans = np.array(frame_data["hand_trans"], dtype=np.float64).ravel() + + # Load shape parameters (betas) if available + betas = None + shape_file = hand_path / f"{side}_hand_shape.pkl" + if shape_file.exists(): + with open(shape_file, "rb") as f: + shape_data = pickle.load(f) + betas = np.array(shape_data["hand_shape"], dtype=np.float64).ravel()[:10] + + mano = _get_mano_model(mano_root, side) + joints = mano.forward(hand_pose, hand_trans, betas=betas) + result[side] = joints + + return result + + +# ── Grid builder ────────────────────────────────────────────────────── + +def build_grid(root, row, calib, frame_idx, thumb_width=640, mano_root=None): + """Build a 4x3 grid of mesh + hand skeleton overlaid camera views.""" + + camera_ids = row["camera_ids"].split(";") + mr_dir = root / row["marker_removed_dir"] + models_dir = root / "object_models_released" + + # --- Load object meshes --- + meshes = [] + obj_dir_str = row.get("object_poses_dir", "") + if obj_dir_str and pd.notna(obj_dir_str): + obj_path = root / obj_dir_str + for npy_file in sorted(obj_path.glob("*.npy")): + poses = np.load(str(npy_file)) + if frame_idx >= len(poses): + continue + pose = poses[frame_idx].astype(np.float64) + parts = npy_file.stem.split("_") + role, obj_id = parts[0], parts[1] + model_path = models_dir / f"{obj_id}_cm.obj" + if not model_path.exists(): + continue + mesh = trimesh.load(str(model_path), process=False) + verts = np.array(mesh.vertices, dtype=np.float64) / 100.0 + verts_world = (pose[:3, :3] @ verts.T).T + pose[:3, 3] + color = MESH_COLORS.get(role, (180, 180, 180)) + meshes.append((verts_world, np.array(mesh.faces), color, f"{role}_{obj_id}")) + + # --- Load hand skeletons --- + hands = load_hand_skeletons(root, row, frame_idx, mano_root=mano_root) + + # --- Render each camera tile --- + label_h = 26 + tiles = [] + + for cam_id in camera_ids: + frame = read_frame(mr_dir / f"{cam_id}.mp4", frame_idx) + H_orig, W_orig = frame.shape[:2] + + cam_data = calib[cam_id] + K = np.array(cam_data["K"], dtype=np.float64).reshape(3, 3) + R = np.array(cam_data["R"], dtype=np.float64).reshape(3, 3) + T = np.array(cam_data["T"], dtype=np.float64).reshape(3) + + # Render object meshes (on full-res image) + img = frame.copy() + for verts_world, faces_arr, color, label in meshes: + img = render_mesh_on_image(img, verts_world, faces_arr, K, R, T, + color=color, fill_alpha=1.0, max_faces=5000) + + # Resize to thumbnail + thumb_h = int(thumb_width * H_orig / W_orig) + scale_x = thumb_width / W_orig + scale_y = thumb_h / H_orig + img_resized = cv2.resize(img, (thumb_width, thumb_h), interpolation=cv2.INTER_AREA) + + # Draw hand skeletons (on thumbnail coords) + for side, joints in hands.items(): + hand_color = HAND_COLORS[side] + img_resized = draw_hand_skeleton( + img_resized, joints, K, R, T, + hand_color, scale_x, scale_y, + ) + + # Assemble tile with label + tile = Image.new("RGB", (thumb_width, thumb_h + label_h), (25, 25, 25)) + tile_draw = ImageDraw.Draw(tile) + tile_draw.text((4, 4), f"cam {cam_id}", fill=(200, 200, 200)) + tile.paste(Image.fromarray(img_resized), (0, label_h)) + tiles.append(tile) + + # --- Arrange 4x3 grid --- + n_cols, n_rows = 4, 3 + tile_w, tile_h = tiles[0].size + gap = 3 + title_h = 40 + + grid_w = n_cols * tile_w + (n_cols - 1) * gap + grid_h = title_h + n_rows * tile_h + (n_rows - 1) * gap + grid = Image.new("RGB", (grid_w, grid_h), (15, 15, 15)) + gd = ImageDraw.Draw(grid) + + mesh_labels = ", ".join(lbl for _, _, _, lbl in meshes) + hand_labels = ", ".join(f"{s} hand" for s in hands) + title = f"{row['sequence_id']} | frame {frame_idx} | {mesh_labels} | {hand_labels}" + gd.text((10, 8), title, fill=(255, 255, 255)) + + # Legend + x_leg = grid_w - 450 + for role, color in MESH_COLORS.items(): + gd.rectangle([x_leg, 10, x_leg + 14, 24], fill=color) + gd.text((x_leg + 18, 8), role, fill=color) + x_leg += 80 + for side, color in HAND_COLORS.items(): + gd.ellipse([x_leg, 11, x_leg + 12, 23], fill=color) + gd.text((x_leg + 16, 8), f"{side[0].upper()} hand", fill=color) + x_leg += 90 + + for i, tile in enumerate(tiles): + r, c = divmod(i, n_cols) + x = c * (tile_w + gap) + y = title_h + r * (tile_h + gap) + grid.paste(tile, (x, y)) + + return grid + + +def main(): + parser = argparse.ArgumentParser(description="Render mesh + hand overlays on TACO views") + parser.add_argument("--csv", type=Path, + default=Path(__file__).resolve().parent.parent / "taco_dataset" / "taco_info.csv") + parser.add_argument("--root", type=Path, + default=Path(__file__).resolve().parent.parent / "taco_dataset") + parser.add_argument("--mano-root", type=Path, + default=Path(__file__).resolve().parent.parent / "mano_v1_2" / "models") + parser.add_argument("--save-dir", type=Path, + default=Path(__file__).resolve().parent / "plots" / "mesh_overlay") + parser.add_argument("--n-sequences", type=int, default=5) + parser.add_argument("--frames-per-seq", type=int, default=2) + parser.add_argument("--thumb-width", type=int, default=512) + parser.add_argument("--seed", type=int, default=77) + args = parser.parse_args() + + df = pd.read_csv(args.csv) + df = df[df["all_modalities_complete"] & (df["n_allocentric_cameras"] == 12)].reset_index(drop=True) + args.save_dir.mkdir(parents=True, exist_ok=True) + root = args.root.resolve() + + rng = np.random.RandomState(args.seed) + actions = sorted(df["action"].unique()) + rng.shuffle(actions) + + sampled = [] + for action in actions: + subset = df[df["action"] == action] + idx = subset.index[rng.randint(0, len(subset))] + if idx not in sampled: + sampled.append(idx) + if len(sampled) >= args.n_sequences: + break + + total = 0 + for i, seq_idx in enumerate(sampled): + row = df.iloc[seq_idx] + seq_id = row["sequence_id"] + n_frames = int(row["n_frames"]) + + calib_path = root / row["alloc_camera_params_path"] + with open(calib_path) as f: + calib = json.load(f) + + frame_indices = np.linspace(0, n_frames - 1, args.frames_per_seq, dtype=int).tolist() + + print(f"[{i+1}/{len(sampled)}] {seq_id} ({n_frames} frames)") + for fidx in frame_indices: + print(f" frame {fidx}...", end=" ", flush=True) + grid = build_grid(root, row, calib, fidx, thumb_width=args.thumb_width, + mano_root=args.mano_root) + safe = seq_id.replace("/", "_").replace(" ", "").replace(",", "").replace("(", "").replace(")", "") + fname = f"{safe}_f{fidx:04d}.png" + grid.save(args.save_dir / fname) + print(f"saved {fname}") + total += 1 + + print(f"\nDone — {total} grid images saved to {args.save_dir}/") + + +if __name__ == "__main__": + main() diff --git a/taco_analysis/visualize_taco_3d_scene.py b/taco_analysis/visualize_taco_3d_scene.py new file mode 100644 index 0000000000000000000000000000000000000000..15eb28d43cf5e45da266d5e7ded73d1d2a03e6be --- /dev/null +++ b/taco_analysis/visualize_taco_3d_scene.py @@ -0,0 +1,275 @@ +#!/usr/bin/env python +"""Visualize TACO camera setup and object meshes in 3D. + +For selected sequences, plots: + - 12 allocentric camera positions + frustums (colour-coded) + - Egocentric camera position + trajectory (if available) + - Object meshes at frame 0 pose (tool + target) + +Camera convention (from TACO dataset_utils): + calibration.json stores per-camera: + K: (9,) flat 3x3 intrinsic (row-major) + R: (9,) flat 3x3 rotation (world-to-camera) + T: (3,) translation (world-to-camera) + So: p_cam = R @ p_world + T + Camera center in world = -R^T @ T + +Usage: + python visualize_taco_3d_scene.py \ + --csv ../taco_dataset/taco_info.csv \ + --root ../taco_dataset \ + --save-dir plots/scene_3d +""" + +import argparse +import json +from pathlib import Path + +import matplotlib +matplotlib.use("Agg") +import matplotlib.pyplot as plt +import numpy as np +import pandas as pd +import trimesh +from mpl_toolkits.mplot3d.art3d import Poly3DCollection + + +# ── Camera geometry helpers ────────────────────────────────────────── + +def camera_center_world(R, T): + """Camera center in world coords: c = -R^T @ T.""" + return -R.T @ T + + +def camera_axes_world(R, scale=0.15): + """Camera axis directions in world frame (right, down, forward).""" + # OpenCV convention: x=right, y=down, z=forward + right = R.T @ np.array([1, 0, 0]) * scale + down = R.T @ np.array([0, 1, 0]) * scale + forward = R.T @ np.array([0, 0, 1]) * scale + return right, down, forward + + +def camera_frustum_world(R, T, K, w, h, scale=0.12): + """Return 5 points defining a camera frustum pyramid in world coords. + + Points: [center, top-left, top-right, bottom-right, bottom-left] + """ + c = camera_center_world(R, T) + fx, fy = K[0, 0], K[1, 1] + cx, cy = K[0, 2], K[1, 2] + + # Four image corners in normalized camera coords, at depth=scale + corners_cam = np.array([ + [(-cx) / fx * scale, (-cy) / fy * scale, scale], + [(w - cx) / fx * scale, (-cy) / fy * scale, scale], + [(w - cx) / fx * scale, (h - cy) / fy * scale, scale], + [(-cx) / fx * scale, (h - cy) / fy * scale, scale], + ]) + + # Transform to world + corners_world = (R.T @ corners_cam.T).T + c # (4, 3) + return c, corners_world + + +# ── Plotting ───────────────────────────────────────────────────────── + +def draw_frustum(ax, center, corners, color, alpha=0.15, label=None): + """Draw a camera frustum pyramid.""" + # Lines from center to each corner + for corner in corners: + ax.plot3D(*zip(center, corner), color=color, linewidth=1.0, alpha=0.8) + # Rectangle at far plane + rect = list(corners) + [corners[0]] + ax.plot3D(*zip(*rect), color=color, linewidth=0.8, alpha=0.6) + # Filled faces + faces = [[center, corners[i], corners[(i + 1) % 4]] for i in range(4)] + faces.append(list(corners)) + poly = Poly3DCollection(faces, alpha=alpha, facecolor=color, edgecolor=color, linewidth=0.3) + ax.add_collection3d(poly) + if label: + ax.text(*center, label, fontsize=5, color=color, ha="center") + + +def draw_mesh(ax, vertices, faces, color, alpha=0.3, max_faces=2000): + """Draw a mesh as a semi-transparent Poly3DCollection.""" + if len(faces) > max_faces: + # Subsample faces for performance + idx = np.random.choice(len(faces), max_faces, replace=False) + faces = faces[idx] + tris = vertices[faces] + poly = Poly3DCollection(tris, alpha=alpha, facecolor=color, edgecolor="none") + ax.add_collection3d(poly) + + +def plot_scene( + calib: dict, + root: Path, + row: pd.Series, + frame_idx: int = 0, + title: str = "", + figsize: tuple = (16, 12), +) -> plt.Figure: + """Create a 3D scene plot with cameras and objects.""" + + fig = plt.figure(figsize=figsize) + ax = fig.add_subplot(111, projection="3d") + + # Colour palette for 12 cameras + cmap = plt.cm.tab20(np.linspace(0, 1, 12)) + + all_positions = [] + + # ── Allocentric cameras ── + for i, cam_id in enumerate(sorted(calib.keys())): + data = calib[cam_id] + R = np.array(data["R"], dtype=np.float64).reshape(3, 3) + T = np.array(data["T"], dtype=np.float64).reshape(3) + K = np.array(data["K"], dtype=np.float64).reshape(3, 3) + w, h = data["imgSize"] + + center, corners = camera_frustum_world(R, T, K, w, h, scale=0.12) + all_positions.append(center) + draw_frustum(ax, center, corners, color=cmap[i], alpha=0.12, label=cam_id) + + all_positions = np.array(all_positions) + + # ── Egocentric camera trajectory ── + ego_cam_dir = row.get("ego_camera_params_dir", "") + if ego_cam_dir and pd.notna(ego_cam_dir): + ego_ext_path = root / ego_cam_dir / "egocentric_frame_extrinsic.npy" + if ego_ext_path.exists(): + ego_exts = np.load(str(ego_ext_path)) # (N, 4, 4) world-to-camera + ego_centers = [] + for ext in ego_exts: + R_ego = ext[:3, :3] + T_ego = ext[:3, 3] + ego_centers.append(camera_center_world(R_ego, T_ego)) + ego_centers = np.array(ego_centers) + ax.plot3D(ego_centers[:, 0], ego_centers[:, 1], ego_centers[:, 2], + color="magenta", linewidth=1.5, alpha=0.7, label="ego trajectory") + ax.scatter(*ego_centers[frame_idx], color="magenta", s=60, marker="^", + zorder=5, label=f"ego frame {frame_idx}") + + # ── Object meshes at frame pose ── + obj_dir = row.get("object_poses_dir", "") + obj_colors = {"tool": "dodgerblue", "target": "coral"} + models_dir = root / "object_models_released" + + if obj_dir and pd.notna(obj_dir): + obj_path = root / obj_dir + for npy_file in sorted(obj_path.glob("*.npy")): + poses = np.load(str(npy_file)) # (N, 4, 4) + if frame_idx >= len(poses): + continue + pose = poses[frame_idx].astype(np.float64) # object-to-world + + # Extract object ID from filename (e.g., "tool_035.npy" → "035") + stem = npy_file.stem # "tool_035" + parts = stem.split("_") + role = parts[0] # "tool" or "target" + obj_id = parts[1] # "035" + model_path = models_dir / f"{obj_id}_cm.obj" + + if model_path.exists(): + mesh = trimesh.load(str(model_path), process=False) + verts = np.array(mesh.vertices, dtype=np.float64) + # "_cm" suffix means units are centimeters → convert to meters + verts = verts / 100.0 + # Apply pose (object-to-world) + verts_world = (pose[:3, :3] @ verts.T).T + pose[:3, 3] + faces_arr = np.array(mesh.faces) + color = obj_colors.get(role, "gray") + draw_mesh(ax, verts_world, faces_arr, color=color, alpha=0.25) + centroid = verts_world.mean(axis=0) + ax.text(*centroid, f"{role}_{obj_id}", fontsize=7, color=color) + + # ── Scene origin axes ── + axis_len = 0.3 + ax.quiver(0, 0, 0, axis_len, 0, 0, color="red", arrow_length_ratio=0.1, linewidth=2) + ax.quiver(0, 0, 0, 0, axis_len, 0, color="green", arrow_length_ratio=0.1, linewidth=2) + ax.quiver(0, 0, 0, 0, 0, axis_len, color="blue", arrow_length_ratio=0.1, linewidth=2) + ax.text(axis_len * 1.1, 0, 0, "X", color="red", fontsize=9) + ax.text(0, axis_len * 1.1, 0, "Y", color="green", fontsize=9) + ax.text(0, 0, axis_len * 1.1, "Z", color="blue", fontsize=9) + + # ── Formatting ── + ax.set_xlabel("X (m)") + ax.set_ylabel("Y (m)") + ax.set_zlabel("Z (m)") + ax.set_title(title, fontsize=12, pad=20) + + # Set equal aspect ratio + all_pts = all_positions.copy() + if len(all_pts) > 0: + mid = all_pts.mean(axis=0) + max_range = (all_pts.max(axis=0) - all_pts.min(axis=0)).max() / 2 * 1.3 + ax.set_xlim(mid[0] - max_range, mid[0] + max_range) + ax.set_ylim(mid[1] - max_range, mid[1] + max_range) + ax.set_zlim(mid[2] - max_range, mid[2] + max_range) + + ax.legend(fontsize=8, loc="upper right") + return fig + + +# ── Main ───────────────────────────────────────────────────────────── + +def main(): + parser = argparse.ArgumentParser(description="3D visualization of TACO cameras + objects") + parser.add_argument("--csv", type=Path, + default=Path(__file__).resolve().parent.parent / "taco_dataset" / "taco_info.csv") + parser.add_argument("--root", type=Path, + default=Path(__file__).resolve().parent.parent / "taco_dataset") + parser.add_argument("--save-dir", type=Path, + default=Path(__file__).resolve().parent / "plots" / "scene_3d") + parser.add_argument("--n-sequences", type=int, default=5) + parser.add_argument("--seed", type=int, default=42) + args = parser.parse_args() + + df = pd.read_csv(args.csv) + df = df[df["all_modalities_complete"]].reset_index(drop=True) + args.save_dir.mkdir(parents=True, exist_ok=True) + root = args.root.resolve() + + rng = np.random.RandomState(args.seed) + actions = sorted(df["action"].unique()) + rng.shuffle(actions) + + sampled = [] + for action in actions: + subset = df[df["action"] == action] + idx = subset.index[rng.randint(0, len(subset))] + sampled.append(idx) + if len(sampled) >= args.n_sequences: + break + + for i, seq_idx in enumerate(sampled): + row = df.iloc[seq_idx] + seq_id = row["sequence_id"] + print(f"[{i+1}/{len(sampled)}] {seq_id}") + + calib_path = root / row["alloc_camera_params_path"] + with open(calib_path) as f: + calib = json.load(f) + + # Render from two viewpoints + for elev, azim, suffix in [(25, -60, "view1"), (45, 30, "view2")]: + fig = plot_scene( + calib=calib, + root=root, + row=row, + frame_idx=0, + title=f"{seq_id} (frame 0)", + ) + fig.axes[0].view_init(elev=elev, azim=azim) + safe_name = seq_id.replace("/", "_").replace(" ", "").replace(",", "").replace("(", "").replace(")", "") + fname = f"{safe_name}_{suffix}.png" + fig.savefig(args.save_dir / fname, dpi=150, bbox_inches="tight") + plt.close(fig) + print(f" saved {fname}") + + print(f"\nDone — {len(sampled) * 2} images saved to {args.save_dir}/") + + +if __name__ == "__main__": + main() diff --git a/taco_analysis/visualize_taco_cameras_topdown.py b/taco_analysis/visualize_taco_cameras_topdown.py new file mode 100644 index 0000000000000000000000000000000000000000..12bcf0f668e14e17e69b9d12b3935666d079976c --- /dev/null +++ b/taco_analysis/visualize_taco_cameras_topdown.py @@ -0,0 +1,208 @@ +#!/usr/bin/env python +"""Bird's-eye (XY) and side (XZ) views of TACO allocentric cameras + objects. + +Produces a 2-panel figure: top-down XY plane and side XZ plane. +Cameras shown as triangles pointing in their forward direction. +Objects shown as scatter clouds. + +Usage: + python visualize_taco_cameras_topdown.py +""" + +import argparse +import json +from pathlib import Path + +import matplotlib +matplotlib.use("Agg") +import matplotlib.pyplot as plt +import matplotlib.patches as mpatches +import numpy as np +import pandas as pd +import trimesh + + +# Camera convention: R,T are world-to-camera → center = -R^T @ T + +def load_cameras(calib: dict): + """Return arrays of camera positions, forward dirs, and IDs.""" + positions, forwards, ids = [], [], [] + for cam_id in sorted(calib.keys()): + data = calib[cam_id] + R = np.array(data["R"], dtype=np.float64).reshape(3, 3) + T = np.array(data["T"], dtype=np.float64).reshape(3) + c = -R.T @ T + fwd = R.T @ np.array([0.0, 0.0, 1.0]) + positions.append(c) + forwards.append(fwd) + ids.append(cam_id) + return np.array(positions), np.array(forwards), ids + + +def load_ego_trajectory(root, row): + """Load egocentric camera trajectory.""" + ego_dir = row.get("ego_camera_params_dir", "") + if not ego_dir or pd.isna(ego_dir): + return None + ext_path = root / ego_dir / "egocentric_frame_extrinsic.npy" + if not ext_path.exists(): + return None + exts = np.load(str(ext_path)) + centers = [] + for ext in exts: + R, T = ext[:3, :3], ext[:3, 3] + centers.append(-R.T @ T) + return np.array(centers) + + +def load_objects(root, row, frame_idx=0): + """Load object mesh vertices in world coords at given frame.""" + obj_dir = row.get("object_poses_dir", "") + if not obj_dir or pd.isna(obj_dir): + return {} + models_dir = root / "object_models_released" + obj_path = root / obj_dir + objects = {} + for npy_file in sorted(obj_path.glob("*.npy")): + poses = np.load(str(npy_file)) + if frame_idx >= len(poses): + continue + pose = poses[frame_idx].astype(np.float64) + parts = npy_file.stem.split("_") + role, obj_id = parts[0], parts[1] + model_path = models_dir / f"{obj_id}_cm.obj" + if model_path.exists(): + mesh = trimesh.load(str(model_path), process=False) + verts = np.array(mesh.vertices, dtype=np.float64) / 100.0 # cm→m + verts_world = (pose[:3, :3] @ verts.T).T + pose[:3, 3] + objects[f"{role}_{obj_id}"] = verts_world + return objects + + +def plot_scene_2d(calib, root, row, save_path, frame_idx=0): + """Create a 2-panel (XY + XZ) plot.""" + positions, forwards, cam_ids = load_cameras(calib) + ego_traj = load_ego_trajectory(root, row) + objects = load_objects(root, row, frame_idx) + + fig, (ax_xy, ax_xz) = plt.subplots(1, 2, figsize=(18, 8)) + + cmap = plt.cm.tab20(np.linspace(0, 1, 12)) + arrow_len = 0.15 + + # ── XY (top-down) ── + for i, (pos, fwd, cid) in enumerate(zip(positions, forwards, cam_ids)): + ax_xy.scatter(pos[0], pos[1], c=[cmap[i]], s=60, zorder=5, edgecolors="k", linewidth=0.5) + ax_xy.annotate(cid[-3:], (pos[0], pos[1]), fontsize=6, ha="center", va="bottom", + xytext=(0, 5), textcoords="offset points", color=cmap[i]) + ax_xy.arrow(pos[0], pos[1], fwd[0] * arrow_len, fwd[1] * arrow_len, + head_width=0.03, head_length=0.02, fc=cmap[i], ec=cmap[i], alpha=0.7) + + if ego_traj is not None: + ax_xy.plot(ego_traj[:, 0], ego_traj[:, 1], "m-", linewidth=1, alpha=0.5, label="ego") + ax_xy.scatter(ego_traj[frame_idx, 0], ego_traj[frame_idx, 1], + c="magenta", marker="^", s=80, zorder=6, label=f"ego f{frame_idx}") + + obj_colors = {"tool": "dodgerblue", "target": "coral"} + for name, verts in objects.items(): + role = name.split("_")[0] + c = obj_colors.get(role, "gray") + # Plot bounding box outline + mn, mx = verts.min(axis=0), verts.max(axis=0) + rect = plt.Rectangle((mn[0], mn[1]), mx[0] - mn[0], mx[1] - mn[1], + fill=True, facecolor=c, alpha=0.3, edgecolor=c, linewidth=1.5) + ax_xy.add_patch(rect) + centroid = verts.mean(axis=0) + ax_xy.text(centroid[0], centroid[1], name, fontsize=7, color=c, ha="center", va="center", + fontweight="bold") + + ax_xy.set_xlabel("X (m)") + ax_xy.set_ylabel("Y (m)") + ax_xy.set_title("Top-down (XY plane)") + ax_xy.set_aspect("equal") + ax_xy.grid(True, alpha=0.3) + ax_xy.legend(fontsize=7, loc="upper right") + + # ── XZ (side view) ── + for i, (pos, fwd, cid) in enumerate(zip(positions, forwards, cam_ids)): + ax_xz.scatter(pos[0], pos[2], c=[cmap[i]], s=60, zorder=5, edgecolors="k", linewidth=0.5) + ax_xz.annotate(cid[-3:], (pos[0], pos[2]), fontsize=6, ha="center", va="bottom", + xytext=(0, 5), textcoords="offset points", color=cmap[i]) + ax_xz.arrow(pos[0], pos[2], fwd[0] * arrow_len, fwd[2] * arrow_len, + head_width=0.03, head_length=0.02, fc=cmap[i], ec=cmap[i], alpha=0.7) + + if ego_traj is not None: + ax_xz.plot(ego_traj[:, 0], ego_traj[:, 2], "m-", linewidth=1, alpha=0.5) + ax_xz.scatter(ego_traj[frame_idx, 0], ego_traj[frame_idx, 2], + c="magenta", marker="^", s=80, zorder=6) + + for name, verts in objects.items(): + role = name.split("_")[0] + c = obj_colors.get(role, "gray") + mn, mx = verts.min(axis=0), verts.max(axis=0) + rect = plt.Rectangle((mn[0], mn[2]), mx[0] - mn[0], mx[2] - mn[2], + fill=True, facecolor=c, alpha=0.3, edgecolor=c, linewidth=1.5) + ax_xz.add_patch(rect) + centroid = verts.mean(axis=0) + ax_xz.text(centroid[0], centroid[2], name, fontsize=7, color=c, ha="center", va="center", + fontweight="bold") + + ax_xz.set_xlabel("X (m)") + ax_xz.set_ylabel("Z (m)") + ax_xz.set_title("Side view (XZ plane)") + ax_xz.set_aspect("equal") + ax_xz.grid(True, alpha=0.3) + + fig.suptitle(f"{row['sequence_id']} (frame {frame_idx})", fontsize=13, fontweight="bold") + plt.tight_layout() + fig.savefig(save_path, dpi=150, bbox_inches="tight") + plt.close(fig) + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("--csv", type=Path, + default=Path(__file__).resolve().parent.parent / "taco_dataset" / "taco_info.csv") + parser.add_argument("--root", type=Path, + default=Path(__file__).resolve().parent.parent / "taco_dataset") + parser.add_argument("--save-dir", type=Path, + default=Path(__file__).resolve().parent / "plots" / "scene_2d") + parser.add_argument("--n-sequences", type=int, default=5) + parser.add_argument("--seed", type=int, default=42) + args = parser.parse_args() + + df = pd.read_csv(args.csv) + df = df[df["all_modalities_complete"]].reset_index(drop=True) + args.save_dir.mkdir(parents=True, exist_ok=True) + root = args.root.resolve() + + rng = np.random.RandomState(args.seed) + actions = sorted(df["action"].unique()) + rng.shuffle(actions) + + sampled = [] + for action in actions: + subset = df[df["action"] == action] + idx = subset.index[rng.randint(0, len(subset))] + sampled.append(idx) + if len(sampled) >= args.n_sequences: + break + + for i, seq_idx in enumerate(sampled): + row = df.iloc[seq_idx] + seq_id = row["sequence_id"] + print(f"[{i+1}/{len(sampled)}] {seq_id}") + + calib_path = root / row["alloc_camera_params_path"] + with open(calib_path) as f: + calib = json.load(f) + + safe = seq_id.replace("/", "_").replace(" ", "").replace(",", "").replace("(", "").replace(")", "") + plot_scene_2d(calib, root, row, args.save_dir / f"{safe}.png") + print(f" saved {safe}.png") + + print(f"\nDone — {len(sampled)} images saved to {args.save_dir}/") + + +if __name__ == "__main__": + main() diff --git a/taco_analysis/visualize_taco_epipolar.py b/taco_analysis/visualize_taco_epipolar.py new file mode 100644 index 0000000000000000000000000000000000000000..c507d3f139373831414ad1718ff3dbddf433e6d7 --- /dev/null +++ b/taco_analysis/visualize_taco_epipolar.py @@ -0,0 +1,335 @@ +#!/usr/bin/env python +"""Visualize epipolar lines across TACO allocentric cameras. + +For a given sequence and frame, picks one source camera and draws random +sample points on it. For every other camera, computes the fundamental +matrix from the allocentric calibration and draws the corresponding +epipolar lines. Arranges all views in a grid and saves the image. + +Usage: + python visualize_taco_epipolar.py \ + --csv ../taco_dataset/taco_info.csv \ + --root ../taco_dataset \ + --save-dir plots/epipolar \ + --n-sequences 3 +""" + +import argparse +import json +import math +from pathlib import Path + +import imageio +import numpy as np +import pandas as pd +from PIL import Image, ImageDraw, ImageFont + + +# ── Epipolar geometry ──────────────────────────────────────────────── + +def compute_fundamental_matrix(K_src, K_tgt, R_src, T_src, R_tgt, T_tgt): + """Compute F such that x_tgt^T @ F @ x_src = 0. + + Calibration gives world-to-camera transforms per camera: + p_cam = R @ p_world + T + + So c2w_src = [R_src | T_src] inverted, etc. + Relative transform: T_tgt_from_src = (R_tgt, T_tgt) @ inv(R_src, T_src) + """ + # Relative rotation / translation + R_rel = R_tgt @ R_src.T # (3,3) + t_rel = T_tgt - R_rel @ T_src # (3,) + + # Essential → Fundamental + tx = np.array([ + [0, -t_rel[2], t_rel[1]], + [t_rel[2], 0, -t_rel[0]], + [-t_rel[1], t_rel[0], 0], + ], dtype=np.float64) + + E = tx @ R_rel + K_tgt_inv_T = np.linalg.inv(K_tgt).T + K_src_inv = np.linalg.inv(K_src) + F = K_tgt_inv_T @ E @ K_src_inv + norm = np.linalg.norm(F) + return F / norm if norm > 1e-12 else F + + +def epipolar_line_endpoints(F, px, py, W, H): + """Compute clipped endpoints of the epipolar line in the target image.""" + line = F @ np.array([px, py, 1.0]) + a, b, c = line + + pts = [] + if abs(b) > 1e-10: + y = -c / b + if -1 <= y <= H + 1: + pts.append((0.0, float(y))) + y = -(a * W + c) / b + if -1 <= y <= H + 1: + pts.append((float(W), float(y))) + if abs(a) > 1e-10: + x = -c / a + if -1 <= x <= W + 1: + pts.append((float(x), 0.0)) + x = -(b * H + c) / a + if -1 <= x <= W + 1: + pts.append((float(x), float(H))) + + unique = [] + for p in pts: + if not any(abs(p[0] - u[0]) < 2 and abs(p[1] - u[1]) < 2 for u in unique): + unique.append(p) + return (unique[0], unique[1]) if len(unique) >= 2 else None + + +# ── Colour helpers ─────────────────────────────────────────────────── + +def random_colors(n, seed=42): + rng = np.random.RandomState(seed) + colors = [] + for _ in range(n): + hue = rng.uniform(0, 1) + r = int(255 * max(0, min(1, abs(hue * 6 - 3) - 1))) + g = int(255 * max(0, min(1, 2 - abs(hue * 6 - 2)))) + b = int(255 * max(0, min(1, 2 - abs(hue * 6 - 4)))) + brightness = max(r, g, b) + if brightness < 150: + scale = 150 / max(brightness, 1) + r = min(255, int(r * scale)) + g = min(255, int(g * scale)) + b = min(255, int(b * scale)) + colors.append((r, g, b)) + return colors + + +# ── Data loading ───────────────────────────────────────────────────── + +def load_calibration(calib_path: Path) -> dict: + """Load calibration.json → dict[cam_id] = {K, R, T}.""" + with open(calib_path) as f: + raw = json.load(f) + calib = {} + for cam_id, data in raw.items(): + K = np.array(data["K"], dtype=np.float64).reshape(3, 3) + R = np.array(data["R"], dtype=np.float64).reshape(3, 3) + T = np.array(data["T"], dtype=np.float64).reshape(3,) + calib[cam_id] = {"K": K, "R": R, "T": T} + return calib + + +def read_frame(video_path: Path, frame_idx: int) -> np.ndarray: + """Read a single frame from an MP4 video via imageio.""" + reader = imageio.get_reader(str(video_path)) + frame = reader.get_data(frame_idx) + reader.close() + return frame # (H, W, 3) uint8 + + +# ── Grid visualisation ─────────────────────────────────────────────── + +def build_epipolar_grid( + root: Path, + row: pd.Series, + frame_idx: int, + source_cam_idx: int = 0, + num_points: int = 15, + seed: int = 42, + thumb_width: int = 640, +) -> Image.Image: + """Build a grid image for one sequence / frame. + + The source camera gets random sample points drawn. + Every other camera gets the corresponding epipolar lines. + """ + camera_ids = row["camera_ids"].split(";") + n_cams = len(camera_ids) + source_cam = camera_ids[source_cam_idx] + + # Load calibration + calib_path = root / row["alloc_camera_params_path"] + calib = load_calibration(calib_path) + + # Load source frame + mr_dir = root / row["marker_removed_dir"] + src_frame = read_frame(mr_dir / f"{source_cam}.mp4", frame_idx) + H_orig, W_orig = src_frame.shape[:2] + + # Thumbnail dimensions (preserve aspect) + thumb_h = int(thumb_width * H_orig / W_orig) + scale_x = thumb_width / W_orig + scale_y = thumb_h / H_orig + + # Sample random points on the source image + rng = np.random.RandomState(seed) + margin_x, margin_y = W_orig // 6, H_orig // 6 + pts = [(rng.randint(margin_x, W_orig - margin_x), + rng.randint(margin_y, H_orig - margin_y)) + for _ in range(num_points)] + colors = random_colors(num_points, seed) + + K_src = calib[source_cam]["K"] + R_src = calib[source_cam]["R"] + T_src = calib[source_cam]["T"] + + # Build each camera tile + tiles = [] + label_h = 24 + for cam_id in camera_ids: + frame = read_frame(mr_dir / f"{cam_id}.mp4", frame_idx) + img = Image.fromarray(frame).resize((thumb_width, thumb_h), Image.LANCZOS) + draw = ImageDraw.Draw(img) + + point_r = max(3, thumb_width // 120) + line_w = max(2, thumb_width // 240) + + if cam_id == source_cam: + # Draw sample points on source + for (px, py), color in zip(pts, colors): + sx, sy = px * scale_x, py * scale_y + draw.ellipse( + [sx - point_r, sy - point_r, sx + point_r, sy + point_r], + fill=color, outline=(255, 255, 255), width=1, + ) + else: + # Draw epipolar lines on target + K_tgt = calib[cam_id]["K"] + R_tgt = calib[cam_id]["R"] + T_tgt = calib[cam_id]["T"] + F = compute_fundamental_matrix(K_src, K_tgt, R_src, T_src, R_tgt, T_tgt) + for (px, py), color in zip(pts, colors): + endpoints = epipolar_line_endpoints(F, px, py, W_orig, H_orig) + if endpoints: + (x1, y1), (x2, y2) = endpoints + draw.line( + [(x1 * scale_x, y1 * scale_y), + (x2 * scale_x, y2 * scale_y)], + fill=color, width=line_w, + ) + # Small dot at same pixel location (for reference) + sx, sy = px * scale_x, py * scale_y + r2 = max(2, point_r // 2) + draw.ellipse( + [sx - r2, sy - r2, sx + r2, sy + r2], + fill=None, outline=color, width=1, + ) + + # Add label bar on top + tile = Image.new("RGB", (thumb_width, thumb_h + label_h), (30, 30, 30)) + tile_draw = ImageDraw.Draw(tile) + label = f"cam {cam_id}" + if cam_id == source_cam: + label += " [SOURCE]" + tile_draw.text((4, 4), label, fill=(100, 255, 100)) + else: + tile_draw.text((4, 4), label, fill=(200, 200, 200)) + tile.paste(img, (0, label_h)) + tiles.append(tile) + + # Arrange in grid: 4 columns × 3 rows (for 12 cameras) + n_cols = 4 + n_rows = math.ceil(n_cams / n_cols) + tile_w, tile_h = tiles[0].size + gap = 3 + + # Title bar + title_h = 36 + grid_w = n_cols * tile_w + (n_cols - 1) * gap + grid_h = title_h + n_rows * tile_h + (n_rows - 1) * gap + grid = Image.new("RGB", (grid_w, grid_h), (20, 20, 20)) + grid_draw = ImageDraw.Draw(grid) + + title = f"{row['sequence_id']} | frame {frame_idx} | source: cam {source_cam} | {num_points} points" + grid_draw.text((10, 8), title, fill=(255, 255, 255)) + + for i, tile in enumerate(tiles): + r, c = divmod(i, n_cols) + x = c * (tile_w + gap) + y = title_h + r * (tile_h + gap) + grid.paste(tile, (x, y)) + + return grid + + +# ── Main ───────────────────────────────────────────────────────────── + +def main(): + parser = argparse.ArgumentParser(description="Visualize TACO epipolar lines across cameras") + parser.add_argument("--csv", type=Path, + default=Path(__file__).resolve().parent.parent / "taco_dataset" / "taco_info.csv") + parser.add_argument("--root", type=Path, + default=Path(__file__).resolve().parent.parent / "taco_dataset") + parser.add_argument("--save-dir", type=Path, + default=Path(__file__).resolve().parent / "plots" / "epipolar") + parser.add_argument("--n-sequences", type=int, default=5, + help="Number of sequences to sample") + parser.add_argument("--frames-per-seq", type=int, default=2, + help="Frames to visualize per sequence") + parser.add_argument("--num-points", type=int, default=15) + parser.add_argument("--seed", type=int, default=42) + parser.add_argument("--thumb-width", type=int, default=512) + args = parser.parse_args() + + df = pd.read_csv(args.csv) + # Filter to complete sequences with all cameras + df = df[(df["all_modalities_complete"]) & (df["n_allocentric_cameras"] == 12)].reset_index(drop=True) + print(f"Loaded {len(df)} complete sequences with 12 cameras") + + args.save_dir.mkdir(parents=True, exist_ok=True) + + # Sample diverse sequences (one per action, round-robin) + rng = np.random.RandomState(args.seed) + actions = sorted(df["action"].unique()) + rng.shuffle(actions) + sampled_indices = [] + action_cycle = 0 + while len(sampled_indices) < args.n_sequences: + action = actions[action_cycle % len(actions)] + subset = df[df["action"] == action] + pick = rng.randint(0, len(subset)) + global_idx = subset.index[pick] + if global_idx not in sampled_indices: + sampled_indices.append(global_idx) + action_cycle += 1 + sampled_indices = sampled_indices[:args.n_sequences] + + # Also cycle through different source cameras + camera_ids_all = df.iloc[0]["camera_ids"].split(";") + + total = 0 + for i, seq_idx in enumerate(sampled_indices): + row = df.iloc[seq_idx] + n_frames = int(row["n_frames"]) + seq_id_safe = row["sequence_id"].replace("/", "_").replace(" ", "").replace(",", "").replace("(", "").replace(")", "") + + # Pick evenly-spaced frames + if args.frames_per_seq >= n_frames: + frame_indices = list(range(n_frames)) + else: + frame_indices = np.linspace(0, n_frames - 1, args.frames_per_seq, dtype=int).tolist() + + # Rotate source camera across sequences + source_cam_idx = i % len(camera_ids_all) + + print(f"\n[{i+1}/{args.n_sequences}] {row['sequence_id']} ({n_frames} frames, source cam idx={source_cam_idx})") + for fidx in frame_indices: + print(f" frame {fidx}...", end=" ", flush=True) + grid = build_epipolar_grid( + root=args.root.resolve(), + row=row, + frame_idx=fidx, + source_cam_idx=source_cam_idx, + num_points=args.num_points, + seed=args.seed + fidx, + thumb_width=args.thumb_width, + ) + fname = f"{seq_id_safe}_f{fidx:04d}_src{source_cam_idx}.png" + grid.save(args.save_dir / fname) + print(f"saved {fname}") + total += 1 + + print(f"\nDone — {total} grid images saved to {args.save_dir}/") + + +if __name__ == "__main__": + main()